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

Function resumeUnavailableResult

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

Source from the content-addressed store, hash-verified

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