(input: {
readonly status: ResumeUnavailableStatus;
readonly executionId: string;
readonly ttlMs?: number;
})
| 544 | "To recover, run the execute tool again with the original code; if it pauses, a fresh executionId will be issued."; |
| 545 | |
| 546 | const resumeUnavailableResult = (input: { |
| 547 | readonly status: ResumeUnavailableStatus; |
| 548 | readonly executionId: string; |
| 549 | readonly ttlMs?: number; |
| 550 | }): McpToolResult => { |
| 551 | const windowMs = input.ttlMs ?? PAUSED_APPROVAL_TIMEOUT_MS; |
| 552 | const approvalWindow = formatTtlDuration(windowMs); |
| 553 | const textByStatus: Record<ResumeUnavailableStatus, string[]> = { |
| 554 | execution_not_found: [ |
| 555 | `Paused execution is unknown: ${input.executionId}.`, |
| 556 | `Paused executions are only resumable for a limited window; this id may have expired or never existed.`, |
| 557 | recoveryText, |
| 558 | ], |
| 559 | execution_expired: [ |
| 560 | `Paused execution expired: ${input.executionId}.`, |
| 561 | `Approval windows last ${approvalWindow}; the owning session no longer has a live pause for this executionId.`, |
| 562 | recoveryText, |
| 563 | ], |
| 564 | execution_forbidden: [ |
| 565 | `Paused execution cannot be resumed by this authenticated identity: ${input.executionId}.`, |
| 566 | "Resume must be called by the same account and organization that owns the paused session.", |
| 567 | ], |
| 568 | execution_already_settled: [ |
| 569 | `Paused execution has already settled: ${input.executionId}.`, |
| 570 | "The resume result is no longer available for replay.", |
| 571 | "Run execute again only if the result is still needed.", |
| 572 | ], |
| 573 | }; |
| 574 | return { |
| 575 | content: [ |
| 576 | { |
| 577 | type: "text" as const, |
| 578 | text: textByStatus[input.status].join(" "), |
| 579 | }, |
| 580 | ], |
| 581 | structuredContent: { |
| 582 | status: input.status, |
| 583 | executionId: input.executionId, |
| 584 | ...(input.status === "execution_expired" ? { ttlMs: windowMs } : {}), |
| 585 | ...(input.status === "execution_forbidden" ? {} : { recovery: "re_execute" }), |
| 586 | }, |
| 587 | isError: true, |
| 588 | }; |
| 589 | }; |
| 590 | |
| 591 | const missingExecutionResult = (executionId: string): McpToolResult => |
| 592 | resumeUnavailableResult({ status: "execution_not_found", executionId }); |
no test coverage detected