fix: resolve TypeScript errors in async-jobs extension (#569)

Add missing parameters (signal, onUpdate, ctx) to tool execute signatures
and details property to return objects to satisfy AgentToolResult<T> type.
Fix string-to-boolean type mismatch on display property in sendMessage calls.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
TÂCHES 2026-03-15 19:07:57 -06:00 committed by GitHub
parent dfd2a1b5b4
commit 96cd2732bf
4 changed files with 12 additions and 8 deletions

View file

@ -71,7 +71,7 @@ export function createAsyncBashTool(
"Check /jobs to see all running and recent background jobs.",
],
parameters: schema,
async execute(_toolCallId, params) {
async execute(_toolCallId, params, _signal, _onUpdate, _ctx) {
const manager = getManager();
const cwd = getCwd();
const { command, timeout, label } = params;
@ -91,6 +91,7 @@ export function createAsyncBashTool(
"Use `await_job` to get results when ready, or `cancel_job` to stop.",
].join("\n"),
}],
details: undefined,
};
},
};

View file

@ -24,7 +24,7 @@ export function createAwaitTool(getManager: () => AsyncJobManager): ToolDefiniti
description:
"Wait for background jobs to complete. Provide specific job IDs or omit to wait for the next job that finishes. Returns results of completed jobs.",
parameters: schema,
async execute(_toolCallId, params) {
async execute(_toolCallId, params, _signal, _onUpdate, _ctx) {
const manager = getManager();
const { jobs: jobIds } = params;
@ -43,6 +43,7 @@ export function createAwaitTool(getManager: () => AsyncJobManager): ToolDefiniti
if (notFound.length > 0 && watched.length === 0) {
return {
content: [{ type: "text", text: `No jobs found: ${notFound.join(", ")}` }],
details: undefined,
};
}
} else {
@ -50,6 +51,7 @@ export function createAwaitTool(getManager: () => AsyncJobManager): ToolDefiniti
if (watched.length === 0) {
return {
content: [{ type: "text", text: "No running background jobs." }],
details: undefined,
};
}
}
@ -59,7 +61,7 @@ export function createAwaitTool(getManager: () => AsyncJobManager): ToolDefiniti
if (running.length === 0) {
const result = formatResults(watched);
manager.acknowledgeDeliveries(watched.map((j) => j.id));
return { content: [{ type: "text", text: result }] };
return { content: [{ type: "text", text: result }], details: undefined };
}
// Wait for at least one to complete
@ -75,7 +77,7 @@ export function createAwaitTool(getManager: () => AsyncJobManager): ToolDefiniti
result += `\n\n**Still running:** ${stillRunning.map((j) => `${j.id} (${j.label})`).join(", ")}`;
}
return { content: [{ type: "text", text: result }] };
return { content: [{ type: "text", text: result }], details: undefined };
},
};
}

View file

@ -16,7 +16,7 @@ export function createCancelJobTool(getManager: () => AsyncJobManager): ToolDefi
label: "Cancel Background Job",
description: "Cancel a running background job by its ID.",
parameters: schema,
async execute(_toolCallId, params) {
async execute(_toolCallId, params, _signal, _onUpdate, _ctx) {
const manager = getManager();
const result = manager.cancel(params.job_id);
@ -28,6 +28,7 @@ export function createCancelJobTool(getManager: () => AsyncJobManager): ToolDefi
return {
content: [{ type: "text", text: messages[result] ?? `Unknown result: ${result}` }],
details: undefined,
};
},
};

View file

@ -62,7 +62,7 @@ export default function AsyncJobs(pi: ExtensionAPI) {
"",
truncatedOutput,
].join("\n"),
display: `Background job ${job.id} ${job.status}`,
display: true,
},
{ deliverAs: "followUp", triggerTurn: true },
);
@ -92,7 +92,7 @@ export default function AsyncJobs(pi: ExtensionAPI) {
pi.sendMessage({
customType: "async_jobs_list",
content: "No async job manager active.",
display: "No jobs",
display: true,
});
return;
}
@ -126,7 +126,7 @@ export default function AsyncJobs(pi: ExtensionAPI) {
pi.sendMessage({
customType: "async_jobs_list",
content: lines.join("\n"),
display: `${running.length} running, ${completed.length} recent`,
display: true,
});
},
});