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

Function resumeUnavailableResult

packages/hosts/mcp/src/tool-server.ts:706–749  ·  view source on GitHub ↗
(input: {
  readonly status: ResumeUnavailableStatus;
  readonly executionId: string;
  readonly ttlMs?: number;
})

Source from the content-addressed store, hash-verified

704 "To recover, run the execute tool again with the original code; if it pauses, a fresh executionId will be issued.";
705
706const resumeUnavailableResult = (input: {
707 readonly status: ResumeUnavailableStatus;
708 readonly executionId: string;
709 readonly ttlMs?: number;
710}): McpToolResult => {
711 const windowMs = input.ttlMs ?? PAUSED_APPROVAL_TIMEOUT_MS;
712 const approvalWindow = formatTtlDuration(windowMs);
713 const textByStatus: Record<ResumeUnavailableStatus, string[]> = {
714 execution_not_found: [
715 `Paused execution is unknown: ${input.executionId}.`,
716 `Paused executions are only resumable for a limited window; this id may have expired or never existed.`,
717 recoveryText,
718 ],
719 execution_expired: [
720 `Paused execution expired: ${input.executionId}.`,
721 `Approval windows last ${approvalWindow}; the owning session no longer has a live pause for this executionId.`,
722 recoveryText,
723 ],
724 execution_forbidden: [
725 `Paused execution cannot be resumed by this authenticated identity: ${input.executionId}.`,
726 "Resume must be called by the same account and organization that owns the paused session.",
727 ],
728 execution_already_settled: [
729 `Paused execution has already settled: ${input.executionId}.`,
730 "The resume result is no longer available for replay.",
731 "Run execute again only if the result is still needed.",
732 ],
733 };
734 return {
735 content: [
736 {
737 type: "text" as const,
738 text: textByStatus[input.status].join(" "),
739 },
740 ],
741 structuredContent: {
742 status: input.status,
743 executionId: input.executionId,
744 ...(input.status === "execution_expired" ? { ttlMs: windowMs } : {}),
745 ...(input.status === "execution_forbidden" ? {} : { recovery: "re_execute" }),
746 },
747 isError: true,
748 };
749};
750
751const missingExecutionResult = (executionId: string): McpToolResult =>
752 resumeUnavailableResult({ status: "execution_not_found", executionId });

Callers 3

missingExecutionResultFunction · 0.85
alreadySettledResultFunction · 0.85
fallbackOutcomeResultFunction · 0.85

Calls 1

formatTtlDurationFunction · 0.90

Tested by

no test coverage detected