Disallow unsafe type assertions (#18688)

This commit is contained in:
Christian Gunderman
2026-02-10 00:10:15 +00:00
committed by GitHub
parent bce1caefd0
commit fd65416a2f
188 changed files with 592 additions and 47 deletions
@@ -70,6 +70,7 @@ export async function awaitConfirmation(
MessageBusType.TOOL_CONFIRMATION_RESPONSE,
{ signal },
)) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
const response = msg as ToolConfirmationResponse;
if (response.correlationId === correlationId) {
return {
@@ -84,6 +85,7 @@ export async function awaitConfirmation(
}
}
} catch (error) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
if (signal.aborted || (error as Error).name === 'AbortError') {
throw new Error('Operation cancelled');
}
@@ -232,6 +234,7 @@ async function handleExternalModification(
}
const result = await modifier.handleModifyWithEditor(
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
state.firstActiveCall as WaitingToolCall,
editor,
signal,
@@ -258,6 +261,7 @@ async function handleInlineModification(
): Promise<void> {
const { state, modifier } = deps;
const result = await modifier.applyInlineModify(
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
state.firstActiveCall as WaitingToolCall,
payload,
signal,
+1
View File
@@ -476,6 +476,7 @@ export class Scheduler {
if (signal.aborted) throw new Error('Operation cancelled');
this.state.updateStatus(callId, 'executing');
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
const activeCall = this.state.firstActiveCall as ExecutingToolCall;
const result = await runWithToolCallContext(
@@ -370,6 +370,7 @@ export class SchedulerStateManager {
confirmationDetails = data.confirmationDetails;
} else {
// TODO: Remove legacy callback shape once event-driven migration is complete
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
confirmationDetails = data as ToolCallConfirmationDetails;
}
@@ -489,6 +490,7 @@ export class SchedulerStateManager {
private toExecuting(call: ToolCall, data?: unknown): ExecutingToolCall {
this.validateHasToolAndInvocation(call, 'executing');
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
const execData = data as Partial<ExecutingToolCall> | undefined;
const liveOutput =
execData?.liveOutput ??
@@ -48,6 +48,7 @@ export class ToolModificationHandler {
typeof toolCall.request.args
>(
toolCall.request.args,
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
modifyContext as ModifyContext<typeof toolCall.request.args>,
editorType,
signal,
@@ -76,6 +77,7 @@ export class ToolModificationHandler {
return undefined;
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
const modifyContext = toolCall.tool.getModifyContext(
signal,
) as ModifyContext<typeof toolCall.request.args>;