(
executionId: string,
response: ResumeResponse,
extra: McpRequestJoinKeys,
)
| 1839 | ); |
| 1840 | |
| 1841 | const resumeExecution = ( |
| 1842 | executionId: string, |
| 1843 | response: ResumeResponse, |
| 1844 | extra: McpRequestJoinKeys, |
| 1845 | ): Effect.Effect<McpToolResult, E> => |
| 1846 | Effect.gen(function* () { |
| 1847 | yield* startMarker("mcp.host.tool.resume.start", { |
| 1848 | "mcp.tool.name": "resume", |
| 1849 | "mcp.execute.execution_id": executionId, |
| 1850 | }); |
| 1851 | debugLog("resume.call", { |
| 1852 | executionId, |
| 1853 | action: response.action, |
| 1854 | hasContent: response.content !== undefined, |
| 1855 | persist: response.meta?.persist, |
| 1856 | clientCapabilities: server.server.getClientCapabilities() ?? null, |
| 1857 | }); |
| 1858 | const outcome = yield* resumeWithLifecycle(executionId, response); |
| 1859 | if (!outcome) { |
| 1860 | debugLog("resume.missing_execution", { executionId }); |
| 1861 | if (yield* localExecutionAlreadySettled(executionId)) { |
| 1862 | return alreadySettledResult(executionId); |
| 1863 | } |
| 1864 | const fallback = yield* resumeFallback(executionId, response); |
| 1865 | if (fallback) { |
| 1866 | debugLog("resume.fallback_result", { executionId, status: fallback.status }); |
| 1867 | return fallbackOutcomeResult(executionId, fallback); |
| 1868 | } |
| 1869 | return missingExecutionResult(executionId); |
| 1870 | } |
| 1871 | debugLog("resume.result", { |
| 1872 | executionId, |
| 1873 | status: outcome.status, |
| 1874 | nextExecutionId: outcome.status === "paused" ? outcome.execution.id : undefined, |
| 1875 | interactionKind: |
| 1876 | outcome.status === "paused" |
| 1877 | ? pausedInteractionKind(outcome.execution.elicitationContext.request) |
| 1878 | : undefined, |
| 1879 | }); |
| 1880 | if (outcome.status === "paused") { |
| 1881 | return yield* formatPausedModelResult(outcome.execution, "resume"); |
| 1882 | } |
| 1883 | return toMcpResult(outcome.result); |
| 1884 | }).pipe( |
| 1885 | Effect.withSpan("mcp.host.tool.resume", { |
| 1886 | attributes: { |
| 1887 | "mcp.tool.name": "resume", |
| 1888 | "mcp.execute.resume.action": response.action, |
| 1889 | "mcp.execute.execution_id": executionId, |
| 1890 | }, |
| 1891 | }), |
| 1892 | Effect.annotateSpans(joinKeyAttributes(extra)), |
| 1893 | ); |
| 1894 | |
| 1895 | const requireUserResumeApproval = (executionId: string): Effect.Effect<McpToolResult> => |
| 1896 | Effect.sync(() => { |
no test coverage detected