MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / completePausedResult

Function completePausedResult

apps/desktop/scripts/smoke-sidecar.ts:287–320  ·  view source on GitHub ↗
(
  client: Client,
  initial: ToolCallResult,
)

Source from the content-addressed store, hash-verified

285 });
286
287const completePausedResult = async (
288 client: Client,
289 initial: ToolCallResult,
290): Promise<Record<string, unknown>> => {
291 let result = initial;
292 for (let attempt = 0; attempt < 5; attempt++) {
293 if (result.isError) {
294 fail(`tool returned isError: ${JSON.stringify(result.content)}`);
295 }
296
297 const structured = result.structuredContent;
298 if (!isRecord(structured)) {
299 fail(`tool returned no structured content: ${JSON.stringify(result.content)}`);
300 }
301 const structuredRecord = structured as Record<string, unknown>;
302
303 if (structuredRecord.status !== "waiting_for_interaction") {
304 return structuredRecord;
305 }
306
307 const executionId = structuredRecord.executionId;
308 if (typeof executionId !== "string" || executionId.length === 0) {
309 fail(`paused result missing executionId: ${JSON.stringify(structuredRecord)}`);
310 }
311
312 console.log(`[smoke-sidecar] auto-accepting paused execution ${executionId}`);
313 result = await client.callTool({
314 name: "resume",
315 arguments: { executionId, action: "accept", content: "{}" },
316 });
317 }
318
319 return fail("execute still paused after 5 resume attempts");
320};
321
322const main = async () => {
323 if (!(await Bun.file(BINARY).exists())) {

Callers 1

mainFunction · 0.85

Calls 3

logMethod · 0.80
failFunction · 0.70
isRecordFunction · 0.70

Tested by

no test coverage detected