(
executionId: string,
action: "accept" | "decline" | "cancel",
content: Record<string, unknown> | undefined,
extra: McpRequestJoinKeys,
)
| 1302 | ); |
| 1303 | |
| 1304 | const resumeExecution = ( |
| 1305 | executionId: string, |
| 1306 | action: "accept" | "decline" | "cancel", |
| 1307 | content: Record<string, unknown> | undefined, |
| 1308 | extra: McpRequestJoinKeys, |
| 1309 | ): Effect.Effect<McpToolResult, E> => |
| 1310 | Effect.gen(function* () { |
| 1311 | yield* startMarker("mcp.host.tool.resume.start", { |
| 1312 | "mcp.tool.name": "resume", |
| 1313 | "mcp.execute.execution_id": executionId, |
| 1314 | }); |
| 1315 | debugLog("resume.call", { |
| 1316 | executionId, |
| 1317 | action, |
| 1318 | hasContent: content !== undefined, |
| 1319 | clientCapabilities: server.server.getClientCapabilities() ?? null, |
| 1320 | }); |
| 1321 | const outcome = yield* resumeWithLifecycle(executionId, { action, content }); |
| 1322 | if (!outcome) { |
| 1323 | debugLog("resume.missing_execution", { executionId }); |
| 1324 | if (yield* localExecutionAlreadySettled(executionId)) { |
| 1325 | return alreadySettledResult(executionId); |
| 1326 | } |
| 1327 | const fallback = yield* resumeFallback(executionId, { action, content }); |
| 1328 | if (fallback) { |
| 1329 | debugLog("resume.fallback_result", { executionId, status: fallback.status }); |
| 1330 | return fallbackOutcomeResult(executionId, fallback); |
| 1331 | } |
| 1332 | return missingExecutionResult(executionId); |
| 1333 | } |
| 1334 | debugLog("resume.result", { |
| 1335 | executionId, |
| 1336 | status: outcome.status, |
| 1337 | nextExecutionId: outcome.status === "paused" ? outcome.execution.id : undefined, |
| 1338 | interactionKind: |
| 1339 | outcome.status === "paused" |
| 1340 | ? pausedInteractionKind(outcome.execution.elicitationContext.request) |
| 1341 | : undefined, |
| 1342 | }); |
| 1343 | if (outcome.status === "paused") { |
| 1344 | return yield* formatPausedModelResult(outcome.execution, "resume"); |
| 1345 | } |
| 1346 | return toMcpResult(outcome.result); |
| 1347 | }).pipe( |
| 1348 | Effect.withSpan("mcp.host.tool.resume", { |
| 1349 | attributes: { |
| 1350 | "mcp.tool.name": "resume", |
| 1351 | "mcp.execute.resume.action": action, |
| 1352 | "mcp.execute.execution_id": executionId, |
| 1353 | }, |
| 1354 | }), |
| 1355 | Effect.annotateSpans(joinKeyAttributes(extra)), |
| 1356 | ); |
| 1357 | |
| 1358 | const requireUserResumeApproval = (executionId: string): Effect.Effect<McpToolResult> => |
| 1359 | Effect.sync(() => { |
no test coverage detected