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

Function completePausedResult

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

Source from the content-addressed store, hash-verified

298 });
299
300const completePausedResult = async (
301 client: Client,
302 initial: ToolCallResult,
303): Promise<Record<string, unknown>> => {
304 let result = initial;
305 for (let attempt = 0; attempt < 5; attempt++) {
306 if (result.isError) {
307 fail(`tool returned isError: ${JSON.stringify(result.content)}`);
308 }
309
310 const structured = result.structuredContent;
311 if (!isRecord(structured)) {
312 fail(`tool returned no structured content: ${JSON.stringify(result.content)}`);
313 }
314 const structuredRecord = structured as Record<string, unknown>;
315
316 if (structuredRecord.status !== "waiting_for_interaction") {
317 return structuredRecord;
318 }
319
320 const executionId = structuredRecord.executionId;
321 if (typeof executionId !== "string" || executionId.length === 0) {
322 fail(`paused result missing executionId: ${JSON.stringify(structuredRecord)}`);
323 }
324
325 console.log(`[smoke-sidecar] auto-accepting paused execution ${executionId}`);
326 result = await client.callTool({
327 name: "resume",
328 arguments: { executionId, action: "accept", content: "{}" },
329 });
330 }
331
332 return fail("execute still paused after 5 resume attempts");
333};
334
335const stageSidecarWithUnavailableOp = async (
336 sidecarRoot: string,

Callers 1

mainFunction · 0.85

Calls 3

logMethod · 0.80
failFunction · 0.70
isRecordFunction · 0.70

Tested by

no test coverage detected