@opencorelabs/lucidity 0.7.0 → 0.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -2
- package/dist/assets/speech/lucidity-speech +0 -0
- package/dist/automations/agent.d.ts.map +1 -1
- package/dist/automations/agent.js +2 -0
- package/dist/automations/designer.d.ts +1 -1
- package/dist/automations/service.d.ts +4 -0
- package/dist/automations/service.d.ts.map +1 -1
- package/dist/automations/service.js +60 -22
- package/dist/automations/store.d.ts +9 -3
- package/dist/automations/store.d.ts.map +1 -1
- package/dist/automations/store.js +45 -32
- package/dist/automations/workflow.d.ts +14 -0
- package/dist/automations/workflow.d.ts.map +1 -0
- package/dist/automations/workflow.js +57 -0
- package/dist/chat/server.d.ts +1 -0
- package/dist/chat/server.d.ts.map +1 -1
- package/dist/chat/server.js +6 -1
- package/dist/coding/listPrs.d.ts +2 -0
- package/dist/coding/listPrs.d.ts.map +1 -1
- package/dist/coding/listPrs.js +10 -0
- package/dist/coding/runCodeTurn.d.ts +6 -30
- package/dist/coding/runCodeTurn.d.ts.map +1 -1
- package/dist/coding/runCodeTurn.js +145 -218
- package/dist/coding/runReview.d.ts +10 -0
- package/dist/coding/runReview.d.ts.map +1 -0
- package/dist/coding/runReview.js +87 -0
- package/dist/coding/workspaceRegistry.d.ts +72 -0
- package/dist/coding/workspaceRegistry.d.ts.map +1 -0
- package/dist/coding/workspaceRegistry.js +421 -0
- package/dist/coding/worktree.d.ts +72 -32
- package/dist/coding/worktree.d.ts.map +1 -1
- package/dist/coding/worktree.js +190 -38
- package/dist/coding/worktreeSetup.d.ts +7 -0
- package/dist/coding/worktreeSetup.d.ts.map +1 -0
- package/dist/coding/worktreeSetup.js +49 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/daemonLease.d.ts +12 -0
- package/dist/daemonLease.d.ts.map +1 -0
- package/dist/daemonLease.js +32 -0
- package/dist/goals/assessment.d.ts +115 -0
- package/dist/goals/assessment.d.ts.map +1 -0
- package/dist/goals/assessment.js +67 -0
- package/dist/goals/notes.d.ts +18 -0
- package/dist/goals/notes.d.ts.map +1 -0
- package/dist/goals/notes.js +72 -0
- package/dist/index.js +75 -40
- package/dist/jobs/briefing.d.ts +2 -16
- package/dist/jobs/briefing.d.ts.map +1 -1
- package/dist/jobs/briefing.js +65 -93
- package/dist/jobs/goals.d.ts +15 -0
- package/dist/jobs/goals.d.ts.map +1 -0
- package/dist/jobs/goals.js +286 -0
- package/dist/jobs/weeklyReview.d.ts.map +1 -1
- package/dist/jobs/weeklyReview.js +3 -2
- package/dist/logTimestamps.d.ts +10 -0
- package/dist/logTimestamps.d.ts.map +1 -0
- package/dist/logTimestamps.js +12 -0
- package/dist/providerRecovery.d.ts +48 -0
- package/dist/providerRecovery.d.ts.map +1 -0
- package/dist/providerRecovery.js +100 -0
- package/dist/queue.d.ts +1 -0
- package/dist/queue.d.ts.map +1 -1
- package/dist/queue.js +4 -0
- package/dist/room/client.d.ts +6 -19
- package/dist/room/client.d.ts.map +1 -1
- package/dist/room/client.js +127 -123
- package/dist/room/computer.js +1 -1
- package/dist/room/durablePublish.d.ts +6 -0
- package/dist/room/durablePublish.d.ts.map +1 -0
- package/dist/room/durablePublish.js +19 -0
- package/dist/room/incidents.d.ts +4 -1
- package/dist/room/incidents.d.ts.map +1 -1
- package/dist/room/incidents.js +15 -7
- package/dist/room/turnQueue.d.ts.map +1 -1
- package/dist/room/turnQueue.js +55 -46
- package/dist/runtimeStore.d.ts +46 -0
- package/dist/runtimeStore.d.ts.map +1 -0
- package/dist/runtimeStore.js +205 -0
- package/dist/setup/server.js +1 -1
- package/dist/turnLog.d.ts +10 -40
- package/dist/turnLog.d.ts.map +1 -1
- package/dist/turnLog.js +33 -56
- package/dist/vault.d.ts +6 -3
- package/dist/vault.d.ts.map +1 -1
- package/dist/vault.js +18 -4
- package/package.json +4 -4
- package/src/automations/agent.ts +2 -0
- package/src/automations/service.ts +47 -21
- package/src/automations/store.ts +41 -50
- package/src/automations/workflow.ts +49 -0
- package/src/chat/server.ts +7 -1
- package/src/coding/listPrs.ts +14 -0
- package/src/coding/runCodeTurn.ts +51 -139
- package/src/coding/runReview.ts +83 -0
- package/src/coding/workspaceRegistry.ts +380 -0
- package/src/coding/worktree.ts +205 -40
- package/src/coding/worktreeSetup.ts +50 -0
- package/src/config.ts +2 -0
- package/src/daemonLease.ts +33 -0
- package/src/goals/assessment.ts +106 -0
- package/src/goals/notes.ts +88 -0
- package/src/index.ts +76 -46
- package/src/jobs/briefing.ts +62 -109
- package/src/jobs/goals.ts +384 -0
- package/src/jobs/weeklyReview.ts +4 -3
- package/src/logTimestamps.ts +14 -0
- package/src/providerRecovery.ts +99 -0
- package/src/queue.ts +4 -0
- package/src/room/client.ts +84 -116
- package/src/room/computer.ts +1 -1
- package/src/room/durablePublish.ts +25 -0
- package/src/room/incidents.ts +20 -8
- package/src/room/turnQueue.ts +53 -56
- package/src/runtimeStore.ts +207 -0
- package/src/setup/server.ts +1 -1
- package/src/turnLog.ts +32 -75
- package/src/vault.ts +16 -7
- package/vendor/mcp-server/dist/index.js +2 -0
- package/vendor/mcp-server/dist/tools/goals.d.ts +4 -0
- package/vendor/mcp-server/dist/tools/goals.d.ts.map +1 -0
- package/vendor/mcp-server/dist/tools/goals.js +38 -0
- package/vendor/mcp-server/package.json +1 -1
- package/vendor/mcp-server/src/index.ts +2 -0
- package/vendor/mcp-server/src/tools/goals.ts +62 -0
- package/vendor/runtime/README.md +36 -2
- package/vendor/runtime/dist/executor/asyncQueue.d.ts +1 -0
- package/vendor/runtime/dist/executor/asyncQueue.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/asyncQueue.js +3 -0
- package/vendor/runtime/dist/executor/claudeAgent.d.ts +5 -1
- package/vendor/runtime/dist/executor/claudeAgent.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/claudeAgent.js +77 -13
- package/vendor/runtime/dist/executor/codex.d.ts +8 -2
- package/vendor/runtime/dist/executor/codex.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/codex.js +113 -38
- package/vendor/runtime/dist/executor/codexProtocol/AgentPath.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/AgentPath.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/AgentPath.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/FunctionCallOutputContentItem.d.ts +4 -1
- package/vendor/runtime/dist/executor/codexProtocol/FunctionCallOutputContentItem.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/codexProtocol/ImageGenerationFailure.d.ts +6 -0
- package/vendor/runtime/dist/executor/codexProtocol/ImageGenerationFailure.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/ImageGenerationFailure.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/ImageGenerationItem.d.ts +12 -0
- package/vendor/runtime/dist/executor/codexProtocol/ImageGenerationItem.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/ImageGenerationItem.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/LegacyAppPathString.d.ts +24 -0
- package/vendor/runtime/dist/executor/codexProtocol/LegacyAppPathString.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/LegacyAppPathString.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/MessagePhase.d.ts +8 -0
- package/vendor/runtime/dist/executor/codexProtocol/MessagePhase.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/MessagePhase.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/Personality.d.ts +3 -0
- package/vendor/runtime/dist/executor/codexProtocol/Personality.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/codexProtocol/PlanType.d.ts +1 -1
- package/vendor/runtime/dist/executor/codexProtocol/PlanType.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/codexProtocol/SleepItem.d.ts +8 -0
- package/vendor/runtime/dist/executor/codexProtocol/SleepItem.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/SleepItem.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/SubAgentSource.d.ts +14 -0
- package/vendor/runtime/dist/executor/codexProtocol/SubAgentSource.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/SubAgentSource.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/ThreadId.d.ts +7 -0
- package/vendor/runtime/dist/executor/codexProtocol/ThreadId.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/ThreadId.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/WebSearchItem.d.ts +15 -0
- package/vendor/runtime/dist/executor/codexProtocol/WebSearchItem.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/WebSearchItem.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/AgentMessageDelivery.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/AgentMessageDelivery.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/AgentMessageDelivery.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/AsyncUserInputQuestion.d.ts +5 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/AsyncUserInputQuestion.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/AsyncUserInputQuestion.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CodexErrorInfo.d.ts +29 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CodexErrorInfo.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CodexErrorInfo.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentState.d.ts +6 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentState.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentState.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentStatus.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentStatus.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentStatus.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentTool.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentTool.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentTool.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentToolCallStatus.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentToolCallStatus.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentToolCallStatus.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CommandAction.d.ts +20 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CommandAction.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CommandAction.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CommandExecutionSource.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CommandExecutionSource.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CommandExecutionSource.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CommandExecutionStatus.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CommandExecutionStatus.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CommandExecutionStatus.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CyberAccessProgram.d.ts +6 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CyberAccessProgram.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CyberAccessProgram.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/DynamicToolCallOutputContentItem.d.ts +11 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/DynamicToolCallOutputContentItem.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/DynamicToolCallOutputContentItem.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/DynamicToolCallStatus.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/DynamicToolCallStatus.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/DynamicToolCallStatus.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/FileUpdateChange.d.ts +7 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/FileUpdateChange.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/FileUpdateChange.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/GetAccountRateLimitsResponse.d.ts +5 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/GetAccountRateLimitsResponse.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/codexProtocol/v2/GitInfo.d.ts +6 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/GitInfo.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/GitInfo.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/HookPromptFragment.d.ts +5 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/HookPromptFragment.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/HookPromptFragment.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpAppDisplayMode.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpAppDisplayMode.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpAppDisplayMode.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpAppUi.d.ts +9 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpAppUi.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpAppUi.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallAppContext.d.ts +8 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallAppContext.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallAppContext.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallError.d.ts +4 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallError.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallError.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallResult.d.ts +7 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallResult.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallResult.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallStatus.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallStatus.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallStatus.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MemoryCitation.d.ts +6 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MemoryCitation.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MemoryCitation.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MemoryCitationEntry.d.ts +7 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MemoryCitationEntry.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MemoryCitationEntry.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MisalignmentErrorDetails.d.ts +16 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MisalignmentErrorDetails.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MisalignmentErrorDetails.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MisalignmentSteer.d.ts +4 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MisalignmentSteer.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MisalignmentSteer.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/Model.d.ts +8 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/Model.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/codexProtocol/v2/ModelAccessPrograms.d.ts +11 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ModelAccessPrograms.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ModelAccessPrograms.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/NonSteerableTurnKind.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/NonSteerableTurnKind.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/NonSteerableTurnKind.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/PatchApplyStatus.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/PatchApplyStatus.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/PatchApplyStatus.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/PatchChangeKind.d.ts +9 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/PatchChangeKind.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/PatchChangeKind.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitSnapshot.d.ts +4 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitSnapshot.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewStartParams.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewStartParams.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/codexProtocol/v2/SessionSource.d.ts +7 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SessionSource.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SessionSource.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SubAgentActivityKind.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SubAgentActivityKind.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SubAgentActivityKind.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/Thread.d.ts +100 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/Thread.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/Thread.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadActiveFlag.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadActiveFlag.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadActiveFlag.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadHistoryMode.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadHistoryMode.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadHistoryMode.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadItem.d.ts +216 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadItem.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadItem.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadReadParams.d.ts +11 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadReadParams.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadReadParams.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadReadResponse.d.ts +5 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadReadResponse.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadReadResponse.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadResumeParams.d.ts +4 -1
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadResumeParams.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSection.d.ts +19 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSection.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSection.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSectionAppearance.d.ts +8 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSectionAppearance.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSectionAppearance.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadStartParams.d.ts +3 -1
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadStartParams.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadStatus.d.ts +12 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadStatus.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadStatus.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/Turn.d.ts +36 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/Turn.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/Turn.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/TurnError.d.ts +12 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/TurnError.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/TurnError.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/TurnItemsView.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/TurnItemsView.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/TurnItemsView.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/TurnStartParams.d.ts +7 -2
- package/vendor/runtime/dist/executor/codexProtocol/v2/TurnStartParams.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/codexProtocol/v2/TurnStatus.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/TurnStatus.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/TurnStatus.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/UserInput.d.ts +3 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/UserInput.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/codexProtocol/v2/WebSearchAction.d.ts +15 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/WebSearchAction.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/WebSearchAction.js +2 -0
- package/vendor/runtime/dist/executor/codexRpc.d.ts +13 -4
- package/vendor/runtime/dist/executor/codexRpc.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/codexRpc.js +21 -5
- package/vendor/runtime/dist/executor/codexSessions.d.ts +30 -0
- package/vendor/runtime/dist/executor/codexSessions.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexSessions.js +88 -0
- package/vendor/runtime/dist/executor/health.d.ts +8 -2
- package/vendor/runtime/dist/executor/health.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/health.js +21 -5
- package/vendor/runtime/dist/executor/liveTurns.d.ts +2 -1
- package/vendor/runtime/dist/executor/liveTurns.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/liveTurns.js +12 -5
- package/vendor/runtime/dist/executor/ownership.d.ts +40 -0
- package/vendor/runtime/dist/executor/ownership.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/ownership.js +106 -0
- package/vendor/runtime/dist/executor/providerRouter.d.ts +1 -0
- package/vendor/runtime/dist/executor/providerRouter.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/providerRouter.js +5 -0
- package/vendor/runtime/dist/executor/types.d.ts +27 -0
- package/vendor/runtime/dist/executor/types.d.ts.map +1 -1
- package/vendor/runtime/dist/harness/index.d.ts.map +1 -1
- package/vendor/runtime/dist/harness/index.js +1 -0
- package/vendor/runtime/dist/index.d.ts +2 -1
- package/vendor/runtime/dist/index.d.ts.map +1 -1
- package/vendor/runtime/dist/index.js +1 -0
- package/vendor/runtime/src/executor/asyncQueue.ts +3 -0
- package/vendor/runtime/src/executor/claudeAgent.ts +66 -13
- package/vendor/runtime/src/executor/codex.ts +124 -47
- package/vendor/runtime/src/executor/codexProtocol/AgentPath.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/FunctionCallOutputContentItem.ts +1 -1
- package/vendor/runtime/src/executor/codexProtocol/ImageGenerationFailure.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/ImageGenerationItem.ts +7 -0
- package/vendor/runtime/src/executor/codexProtocol/LegacyAppPathString.ts +27 -0
- package/vendor/runtime/src/executor/codexProtocol/MessagePhase.ts +11 -0
- package/vendor/runtime/src/executor/codexProtocol/Personality.ts +3 -0
- package/vendor/runtime/src/executor/codexProtocol/PlanType.ts +1 -1
- package/vendor/runtime/src/executor/codexProtocol/README.md +2 -2
- package/vendor/runtime/src/executor/codexProtocol/SleepItem.ts +8 -0
- package/vendor/runtime/src/executor/codexProtocol/SubAgentSource.ts +7 -0
- package/vendor/runtime/src/executor/codexProtocol/ThreadId.ts +10 -0
- package/vendor/runtime/src/executor/codexProtocol/WebSearchItem.ts +14 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/AgentMessageDelivery.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/AsyncUserInputQuestion.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/CodexErrorInfo.ts +12 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/CollabAgentState.ts +6 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/CollabAgentStatus.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/CollabAgentTool.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/CollabAgentToolCallStatus.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/CommandAction.ts +6 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/CommandExecutionSource.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/CommandExecutionStatus.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/CyberAccessProgram.ts +9 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/DynamicToolCallOutputContentItem.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/DynamicToolCallStatus.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/FileUpdateChange.ts +6 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/GetAccountRateLimitsResponse.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/GitInfo.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/HookPromptFragment.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/McpAppDisplayMode.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/McpAppUi.ts +9 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/McpToolCallAppContext.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/McpToolCallError.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/McpToolCallResult.ts +6 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/McpToolCallStatus.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/MemoryCitation.ts +6 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/MemoryCitationEntry.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/MisalignmentErrorDetails.ts +18 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/MisalignmentSteer.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/Model.ts +11 -2
- package/vendor/runtime/src/executor/codexProtocol/v2/ModelAccessPrograms.ts +13 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/NonSteerableTurnKind.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/PatchApplyStatus.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/PatchChangeKind.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/RateLimitSnapshot.ts +5 -1
- package/vendor/runtime/src/executor/codexProtocol/v2/ReviewStartParams.ts +2 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/SessionSource.ts +6 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/SubAgentActivityKind.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/Thread.ts +104 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/ThreadActiveFlag.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/ThreadHistoryMode.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/ThreadItem.ts +125 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/ThreadReadParams.ts +12 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/ThreadReadResponse.ts +6 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/ThreadResumeParams.ts +5 -1
- package/vendor/runtime/src/executor/codexProtocol/v2/ThreadSection.ts +21 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/ThreadSectionAppearance.ts +8 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/ThreadStartParams.ts +4 -1
- package/vendor/runtime/src/executor/codexProtocol/v2/ThreadStatus.ts +6 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/Turn.ts +37 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/TurnError.ts +11 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/TurnItemsView.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/TurnStartParams.ts +7 -2
- package/vendor/runtime/src/executor/codexProtocol/v2/TurnStatus.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/UserInput.ts +1 -1
- package/vendor/runtime/src/executor/codexProtocol/v2/WebSearchAction.ts +5 -0
- package/vendor/runtime/src/executor/codexRpc.ts +26 -6
- package/vendor/runtime/src/executor/codexSessions.ts +108 -0
- package/vendor/runtime/src/executor/health.ts +21 -7
- package/vendor/runtime/src/executor/liveTurns.ts +12 -5
- package/vendor/runtime/src/executor/ownership.ts +83 -0
- package/vendor/runtime/src/executor/providerRouter.ts +6 -0
- package/vendor/runtime/src/executor/types.ts +20 -1
- package/vendor/runtime/src/harness/index.ts +1 -0
- package/vendor/runtime/src/index.ts +2 -1
- package/vendor/shared/dist/agentCommands.d.ts +1 -0
- package/vendor/shared/dist/agentCommands.d.ts.map +1 -1
- package/vendor/shared/dist/automations.d.ts +34 -0
- package/vendor/shared/dist/automations.d.ts.map +1 -1
- package/vendor/shared/dist/automations.js +12 -0
- package/vendor/shared/dist/cardStudio.d.ts +41 -0
- package/vendor/shared/dist/cardStudio.d.ts.map +1 -1
- package/vendor/shared/dist/cardStudio.js +13 -3
- package/vendor/shared/dist/computer.d.ts +7 -1
- package/vendor/shared/dist/computer.d.ts.map +1 -1
- package/vendor/shared/dist/computer.js +13 -4
- package/vendor/shared/dist/constants.d.ts +3 -3
- package/vendor/shared/dist/constants.d.ts.map +1 -1
- package/vendor/shared/dist/constants.js +8 -14
- package/vendor/shared/dist/goalNotes.d.ts +4 -0
- package/vendor/shared/dist/goalNotes.d.ts.map +1 -0
- package/vendor/shared/dist/goalNotes.js +23 -0
- package/vendor/shared/dist/goals.d.ts +835 -0
- package/vendor/shared/dist/goals.d.ts.map +1 -0
- package/vendor/shared/dist/goals.js +198 -0
- package/vendor/shared/dist/index.d.ts +7 -2
- package/vendor/shared/dist/index.d.ts.map +1 -1
- package/vendor/shared/dist/index.js +6 -1
- package/vendor/shared/dist/journal-vault.d.ts +1 -1
- package/vendor/shared/dist/messagingSafety.d.ts +21 -0
- package/vendor/shared/dist/messagingSafety.d.ts.map +1 -0
- package/vendor/shared/dist/messagingSafety.js +8 -0
- package/vendor/shared/dist/schemas/harness.d.ts +199 -169
- package/vendor/shared/dist/schemas/harness.d.ts.map +1 -1
- package/vendor/shared/dist/schemas/harness.js +25 -124
- package/vendor/shared/dist/smartCapture.d.ts +24 -0
- package/vendor/shared/dist/smartCapture.d.ts.map +1 -1
- package/vendor/shared/dist/smartCapture.js +15 -0
- package/vendor/shared/dist/taskSync.d.ts +342 -0
- package/vendor/shared/dist/taskSync.d.ts.map +1 -0
- package/vendor/shared/dist/taskSync.js +111 -0
- package/vendor/shared/dist/types.d.ts +1 -4
- package/vendor/shared/dist/types.d.ts.map +1 -1
- package/vendor/shared/dist/voiceCapture.d.ts +1 -1
- package/vendor/shared/dist/workspaces.d.ts +255 -0
- package/vendor/shared/dist/workspaces.d.ts.map +1 -0
- package/vendor/shared/dist/workspaces.js +89 -0
- package/vendor/shared/src/agentCommands.ts +1 -0
- package/vendor/shared/src/automations.ts +12 -0
- package/vendor/shared/src/cardStudio.ts +13 -3
- package/vendor/shared/src/computer.ts +19 -5
- package/vendor/shared/src/constants.ts +8 -14
- package/vendor/shared/src/goalNotes.ts +23 -0
- package/vendor/shared/src/goals.ts +237 -0
- package/vendor/shared/src/index.ts +7 -6
- package/vendor/shared/src/messagingSafety.ts +11 -0
- package/vendor/shared/src/schemas/harness.ts +24 -130
- package/vendor/shared/src/smartCapture.ts +27 -0
- package/vendor/shared/src/taskSync.ts +81 -0
- package/vendor/shared/src/types.ts +0 -6
- package/vendor/shared/src/workspaces.ts +103 -0
- package/dist/coding/conduct.d.ts +0 -69
- package/dist/coding/conduct.d.ts.map +0 -1
- package/dist/coding/conduct.js +0 -348
- package/dist/coding/fleetIntegrate.d.ts +0 -37
- package/dist/coding/fleetIntegrate.d.ts.map +0 -1
- package/dist/coding/fleetIntegrate.js +0 -64
- package/dist/coding/fleetPlan.d.ts +0 -20
- package/dist/coding/fleetPlan.d.ts.map +0 -1
- package/dist/coding/fleetPlan.js +0 -125
- package/dist/coding/fleetTasks.d.ts +0 -33
- package/dist/coding/fleetTasks.d.ts.map +0 -1
- package/dist/coding/fleetTasks.js +0 -75
- package/dist/coding/openFleetPr.d.ts +0 -41
- package/dist/coding/openFleetPr.d.ts.map +0 -1
- package/dist/coding/openFleetPr.js +0 -121
- package/src/coding/conduct.ts +0 -462
- package/src/coding/fleetIntegrate.ts +0 -95
- package/src/coding/fleetPlan.ts +0 -135
- package/src/coding/fleetTasks.ts +0 -109
- package/src/coding/openFleetPr.ts +0 -148
package/dist/room/client.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { publishDurably } from './durablePublish.js';
|
|
1
2
|
import { computerId, computerRuntime } from './computer.js';
|
|
2
3
|
import { DurableTurnQueue } from './turnQueue.js';
|
|
3
4
|
import { WebSocket } from 'ws';
|
|
@@ -38,13 +39,6 @@ const STREAM_EVENT_TYPES = new Set([
|
|
|
38
39
|
'clone_result',
|
|
39
40
|
'error',
|
|
40
41
|
'cancelled',
|
|
41
|
-
// Conductor fleet events — logged + seq-stamped like any turn frame so a mid-fleet `pull`
|
|
42
|
-
// replays the plan and the workers' progress instead of settling the turn as cut off.
|
|
43
|
-
'fleet_plan',
|
|
44
|
-
'worker_status',
|
|
45
|
-
'fleet_conflict',
|
|
46
|
-
'worker_pr',
|
|
47
|
-
'fleet_done',
|
|
48
42
|
]);
|
|
49
43
|
function sendStreamEvent(send, requestId, ev, freshStart = false) {
|
|
50
44
|
if (ev.type === 'session')
|
|
@@ -52,7 +46,7 @@ function sendStreamEvent(send, requestId, ev, freshStart = false) {
|
|
|
52
46
|
else if (ev.type === 'delta')
|
|
53
47
|
send({ type: 'delta', requestId, text: ev.text });
|
|
54
48
|
else if (ev.type === 'tool_call')
|
|
55
|
-
send({
|
|
49
|
+
send({ ...ev, requestId });
|
|
56
50
|
else
|
|
57
51
|
send({
|
|
58
52
|
type: 'done',
|
|
@@ -95,8 +89,16 @@ export async function dispatchRequest(raw, deps) {
|
|
|
95
89
|
}
|
|
96
90
|
const req = parsed.data;
|
|
97
91
|
const structured = req.kind === 'ask' && (req.dayPlan ? 'day-plan' : req.projectPlan ? 'project-plan' : undefined);
|
|
98
|
-
|
|
99
|
-
|
|
92
|
+
let deferTerminal = false;
|
|
93
|
+
let terminal;
|
|
94
|
+
const send = (frame) => {
|
|
95
|
+
const event = frame;
|
|
96
|
+
if (deferTerminal && event?.requestId === req.id && (['done', 'error', 'cancelled'].includes(String(event.type)) || ['ask', 'briefing', 'attention'].includes(String(event.kind)))) {
|
|
97
|
+
terminal ??= event;
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
sendFrame(structured ? { ...event, purpose: structured } : frame);
|
|
101
|
+
};
|
|
100
102
|
if (req.kind === 'voice-capture' || req.kind === 'voice-capture-status') {
|
|
101
103
|
try {
|
|
102
104
|
if (!deps.captures)
|
|
@@ -192,6 +194,7 @@ export async function dispatchRequest(raw, deps) {
|
|
|
192
194
|
reason: req.reason,
|
|
193
195
|
snapshot: req.snapshot,
|
|
194
196
|
diag: req.diag,
|
|
197
|
+
perf: req.perf,
|
|
195
198
|
});
|
|
196
199
|
const path = writeIncidentBundle(bundle, deps.incidentsDir);
|
|
197
200
|
deps.telemetry?.record('incident', bundle.summary, bundle.requestId ?? undefined);
|
|
@@ -274,13 +277,18 @@ export async function dispatchRequest(raw, deps) {
|
|
|
274
277
|
const controller = inFlight?.get(req.targetId);
|
|
275
278
|
if (controller) {
|
|
276
279
|
controller.abort();
|
|
277
|
-
//
|
|
278
|
-
// landing at maxSeq+1) — a later pull then sees a settled turn.
|
|
279
|
-
send({ type: 'cancelled', requestId: req.targetId });
|
|
280
|
+
// The owner publishes cancellation after the provider and workspace are released.
|
|
280
281
|
}
|
|
281
282
|
else {
|
|
282
|
-
// Conductor workers have provider-owned request IDs, separate from the parent lane.
|
|
283
283
|
await deps.controls?.interrupt(req.targetId);
|
|
284
|
+
// Completion can beat Stop while its terminal frame is lost in transit. Replay
|
|
285
|
+
// the actual outcome so the phone settles without rewriting finished work.
|
|
286
|
+
const state = deps.turnLogs.read(req.targetId);
|
|
287
|
+
if (state.terminated) {
|
|
288
|
+
log(`stop for finished turn ${req.targetId}: replaying its ${state.frames.length} frames`);
|
|
289
|
+
for (const frame of state.frames)
|
|
290
|
+
deps.sendRaw(frame);
|
|
291
|
+
}
|
|
284
292
|
}
|
|
285
293
|
return;
|
|
286
294
|
}
|
|
@@ -299,6 +307,10 @@ export async function dispatchRequest(raw, deps) {
|
|
|
299
307
|
});
|
|
300
308
|
return;
|
|
301
309
|
}
|
|
310
|
+
// The phone is still waiting on a turn this computer already finished: its last frame was
|
|
311
|
+
// lost on the way. Worth a line, it is the only trace on this side of that failure (#505).
|
|
312
|
+
if (state.terminated && state.frames.some((frame) => frame.seq > req.sinceSeq))
|
|
313
|
+
log(`pull for finished turn ${req.targetId}: phone had seq ${req.sinceSeq} of ${state.frames.length}`);
|
|
302
314
|
// Replay the gap verbatim (already logged; don't re-log).
|
|
303
315
|
for (const frame of state.frames) {
|
|
304
316
|
if (frame.seq > req.sinceSeq)
|
|
@@ -311,19 +323,6 @@ export async function dispatchRequest(raw, deps) {
|
|
|
311
323
|
// restores its controls instead of waiting forever for another model token.
|
|
312
324
|
if (!state.terminated && inFlight?.has(req.targetId))
|
|
313
325
|
deps.controls?.publishPending(req.targetId);
|
|
314
|
-
// Open log (no terminal) with no live run owning it → the subprocess died (the daemon
|
|
315
|
-
// restarted mid-turn). Settle it with a synthesized, persisted terminal so the phone
|
|
316
|
-
// stops waiting and a repeat pull is idempotent. If it's still in `inFlight`, live
|
|
317
|
-
// frames past maxSeq keep flowing on the current socket (deduped by seq) — leave it.
|
|
318
|
-
if (!state.terminated &&
|
|
319
|
-
!inFlight?.has(req.targetId) &&
|
|
320
|
-
!deps.turnQueue?.owns(req.targetId)) {
|
|
321
|
-
sendRaw(turnLogs.append(req.targetId, {
|
|
322
|
-
type: 'error',
|
|
323
|
-
requestId: req.targetId,
|
|
324
|
-
message: 'Lucid restarted before finishing this turn.',
|
|
325
|
-
}));
|
|
326
|
-
}
|
|
327
326
|
return;
|
|
328
327
|
}
|
|
329
328
|
if ((req.kind === 'ask' || req.kind === 'code') && req.queue) {
|
|
@@ -342,40 +341,27 @@ export async function dispatchRequest(raw, deps) {
|
|
|
342
341
|
return;
|
|
343
342
|
}
|
|
344
343
|
if (deps.recordAcceptance &&
|
|
345
|
-
['ask', 'code', '
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
344
|
+
['ask', 'code', 'briefing', 'attention', 'clone'].includes(req.kind)) {
|
|
345
|
+
try {
|
|
346
|
+
deps.turnLogs.read(req.id); // Adopt legacy receipts before admission.
|
|
347
|
+
const receipt = deps.turnLogs.runtime.accept(req);
|
|
348
|
+
for (const frame of receipt.frames)
|
|
349
349
|
deps.sendRaw(frame);
|
|
350
|
-
|
|
350
|
+
if (receipt.duplicate || inFlight?.has(req.id))
|
|
351
|
+
return;
|
|
351
352
|
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
type: 'accepted',
|
|
356
|
-
requestId: req.id,
|
|
357
|
-
scope: {
|
|
358
|
-
kind: req.kind,
|
|
359
|
-
...('repoId' in req ? { repoId: req.repoId } : {}),
|
|
360
|
-
...('workerId' in req ? { workerId: req.workerId } : {}),
|
|
361
|
-
...('mode' in req ? { mode: req.mode } : {}),
|
|
362
|
-
},
|
|
363
|
-
});
|
|
364
|
-
if (!deps.turnLogs.read(req.id).exists) {
|
|
365
|
-
send({
|
|
366
|
-
type: 'error',
|
|
367
|
-
requestId: req.id,
|
|
368
|
-
message: 'Cannot save the request safely on this computer. Check available disk space and retry.',
|
|
369
|
-
});
|
|
353
|
+
catch (error) {
|
|
354
|
+
deps.sendRaw({ type: 'error', requestId: req.id,
|
|
355
|
+
message: `Cannot accept this request safely: ${error instanceof Error ? error.message : String(error)}` });
|
|
370
356
|
return;
|
|
371
357
|
}
|
|
372
|
-
deps.sendRaw(accepted);
|
|
373
358
|
}
|
|
374
359
|
// Own abort controller per request, combined with the daemon-shutdown signal, so a
|
|
375
360
|
// `cancel` message (stop button) can kill just this run without affecting others.
|
|
376
361
|
const ownController = new AbortController();
|
|
377
362
|
const signal = combineSignals(outerSignal, ownController.signal);
|
|
378
363
|
inFlight?.set(req.id, ownController);
|
|
364
|
+
deferTerminal = true;
|
|
379
365
|
// Wait for the lane INSIDE the try, and after `inFlight.set` above — a turn waiting its turn
|
|
380
366
|
// must still be cancellable, and the `signal?.aborted` checks below mean a cancel that lands
|
|
381
367
|
// while queued drops the run instead of starting it late.
|
|
@@ -519,6 +505,16 @@ export async function dispatchRequest(raw, deps) {
|
|
|
519
505
|
nextBefore: result.nextBefore,
|
|
520
506
|
});
|
|
521
507
|
}
|
|
508
|
+
else if (req.kind === 'workspaces') {
|
|
509
|
+
if (!deps.workspaces)
|
|
510
|
+
throw new Error('Update Lucidity on the computer to use persistent workers.');
|
|
511
|
+
if (req.command.action === 'continue-run') {
|
|
512
|
+
if (!deps.turnQueue)
|
|
513
|
+
throw new Error('The computer queue is unavailable.');
|
|
514
|
+
deps.turnQueue.enqueue(deps.workspaces.continuation(req.command));
|
|
515
|
+
}
|
|
516
|
+
send({ requestId: req.id, kind: 'workspaces', snapshot: await deps.workspaces.command(req.command, req.id) });
|
|
517
|
+
}
|
|
522
518
|
else if (req.kind === 'repos') {
|
|
523
519
|
send({
|
|
524
520
|
requestId: req.id,
|
|
@@ -595,35 +591,9 @@ export async function dispatchRequest(raw, deps) {
|
|
|
595
591
|
deps.requestRestart?.();
|
|
596
592
|
}
|
|
597
593
|
}
|
|
598
|
-
else if (req.kind === 'conduct') {
|
|
599
|
-
if (deps.conductHandler) {
|
|
600
|
-
// The whole fleet holds the repo's lane: its workers write isolated worktrees, but
|
|
601
|
-
// integration resets and merges onto lucid/<repo>, so no other turn on this repo (a
|
|
602
|
-
// bare code turn, or a second fleet) may run meanwhile.
|
|
603
|
-
await onLane(`room:code:${req.repoId}`, () => deps.conductHandler({
|
|
604
|
-
id: req.id,
|
|
605
|
-
repoId: req.repoId,
|
|
606
|
-
phase: req.phase,
|
|
607
|
-
prompt: req.prompt,
|
|
608
|
-
images: req.images,
|
|
609
|
-
plan: req.plan,
|
|
610
|
-
resume: req.resume,
|
|
611
|
-
// Forward it or a quick spawn silently mints a parent task + subtask anyway: the
|
|
612
|
-
// phone sends `ephemeral`, conduct honours it, and this hop used to drop it.
|
|
613
|
-
ephemeral: req.ephemeral,
|
|
614
|
-
}, { send, signal }));
|
|
615
|
-
}
|
|
616
|
-
else {
|
|
617
|
-
send({
|
|
618
|
-
type: 'error',
|
|
619
|
-
requestId: req.id,
|
|
620
|
-
message: 'The conductor is not enabled on this daemon.',
|
|
621
|
-
});
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
594
|
else if (deps.codeHandler) {
|
|
625
595
|
// Per-worktree lane: two turns sharing a worktree/cwd must serialize, but genuinely
|
|
626
|
-
// independent work runs in parallel. The bare repo session and each
|
|
596
|
+
// independent work runs in parallel. The bare repo session and each worktree
|
|
627
597
|
// (`workerId`) own separate worktrees, so each gets its own lane — a phone turn drilled
|
|
628
598
|
// into worker A can't collide with worker B, and a bare turn keeps today's exact key.
|
|
629
599
|
const lane = req.workerId
|
|
@@ -640,6 +610,7 @@ export async function dispatchRequest(raw, deps) {
|
|
|
640
610
|
mode: req.mode,
|
|
641
611
|
expectedBranch: req.expectedBranch,
|
|
642
612
|
workerId: req.workerId,
|
|
613
|
+
...(req.recoveryOf ? { recoveryOf: req.recoveryOf } : {}),
|
|
643
614
|
}, { send, signal }));
|
|
644
615
|
}
|
|
645
616
|
else {
|
|
@@ -653,8 +624,10 @@ export async function dispatchRequest(raw, deps) {
|
|
|
653
624
|
catch (err) {
|
|
654
625
|
// A deadline/cancel abort surfaces as an AbortError ("The operation was aborted").
|
|
655
626
|
// Never forward that literal text to the phone — end the turn quietly instead.
|
|
656
|
-
if (isAbortError(err))
|
|
627
|
+
if (isAbortError(err)) {
|
|
628
|
+
send({ type: 'cancelled', requestId: req.id });
|
|
657
629
|
return;
|
|
630
|
+
}
|
|
658
631
|
const message = err instanceof Error ? err.message : String(err);
|
|
659
632
|
deps.telemetry?.record('dispatch-error', message, req.id);
|
|
660
633
|
send({ type: 'error', requestId: req.id, message });
|
|
@@ -662,6 +635,11 @@ export async function dispatchRequest(raw, deps) {
|
|
|
662
635
|
finally {
|
|
663
636
|
deps.controls?.end(req.id);
|
|
664
637
|
inFlight?.delete(req.id);
|
|
638
|
+
deferTerminal = false;
|
|
639
|
+
if (signal?.aborted)
|
|
640
|
+
send({ type: 'cancelled', requestId: req.id });
|
|
641
|
+
else if (terminal)
|
|
642
|
+
send(terminal);
|
|
665
643
|
}
|
|
666
644
|
}
|
|
667
645
|
const MAX_BACKOFF_MS = 30_000;
|
|
@@ -731,7 +709,7 @@ export function roomUrl(apiUrl, machine) {
|
|
|
731
709
|
* halts reconnection. Also stops automatically if `signal` aborts.
|
|
732
710
|
*/
|
|
733
711
|
export function startRoomClient(opts) {
|
|
734
|
-
const { config, harness, vault, signal, codeHandler,
|
|
712
|
+
const { config, harness, vault, signal, codeHandler, cloneHandler, queue, getConfig, setConfig, requestRestart, } = opts;
|
|
735
713
|
const log = opts.logger ?? ((m) => console.error(`[room] ${m}`));
|
|
736
714
|
const identity = opts.computerId ?? computerId();
|
|
737
715
|
const url = roomUrl(config.apiUrl, config.machineName) +
|
|
@@ -776,11 +754,23 @@ export function startRoomClient(opts) {
|
|
|
776
754
|
if (typeof rec.type === 'string' &&
|
|
777
755
|
STREAM_EVENT_TYPES.has(rec.type) &&
|
|
778
756
|
typeof rec.requestId === 'string') {
|
|
779
|
-
|
|
757
|
+
publishDurably(turnLogs, { ...rec, requestId: rec.requestId }, inFlight, sendRaw);
|
|
780
758
|
durableQueue?.wake();
|
|
781
759
|
return;
|
|
782
760
|
}
|
|
783
761
|
}
|
|
762
|
+
const buffered = obj;
|
|
763
|
+
if (buffered && typeof buffered.requestId === 'string' && ['ask', 'briefing', 'attention'].includes(String(buffered.kind))) {
|
|
764
|
+
publishDurably(turnLogs, { ...buffered, type: 'done', requestId: buffered.requestId }, inFlight, (frame) => {
|
|
765
|
+
const saved = frame;
|
|
766
|
+
if (saved.type === 'error')
|
|
767
|
+
sendRaw(frame);
|
|
768
|
+
else
|
|
769
|
+
sendRaw({ ...buffered, seq: saved.seq });
|
|
770
|
+
});
|
|
771
|
+
durableQueue?.wake();
|
|
772
|
+
return;
|
|
773
|
+
}
|
|
784
774
|
sendRaw(obj);
|
|
785
775
|
};
|
|
786
776
|
// The phone's repo list — recomputed live so a freshly-cloned repo appears with no restart, and
|
|
@@ -831,47 +821,54 @@ export function startRoomClient(opts) {
|
|
|
831
821
|
}, delay);
|
|
832
822
|
reconnectTimer.unref?.();
|
|
833
823
|
}
|
|
834
|
-
const
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
824
|
+
const pendingRequests = new Set();
|
|
825
|
+
const dispatch = (raw, overrides = {}) => {
|
|
826
|
+
if (stopped)
|
|
827
|
+
return Promise.resolve();
|
|
828
|
+
const pending = dispatchRequest(raw, {
|
|
829
|
+
harness,
|
|
830
|
+
recordAcceptance: true,
|
|
831
|
+
runtime: opts.providerHealth ? () => computerRuntime(opts) : undefined,
|
|
832
|
+
controls: opts.controls,
|
|
833
|
+
models: opts.models,
|
|
834
|
+
commands: opts.commands,
|
|
835
|
+
askContext,
|
|
836
|
+
briefingContext,
|
|
837
|
+
send: turnSend,
|
|
838
|
+
sendRaw,
|
|
839
|
+
turnLogs,
|
|
840
|
+
workspaces: opts.workspaces,
|
|
841
|
+
signal,
|
|
842
|
+
codeHandler,
|
|
843
|
+
cloneHandler,
|
|
844
|
+
queue: executionLanes,
|
|
845
|
+
inFlight,
|
|
846
|
+
attention: opts.attention,
|
|
847
|
+
logger: log,
|
|
848
|
+
// Live allowlist (#78) + each row's live branch (#121); shared with pushRepos above.
|
|
849
|
+
listRepos,
|
|
850
|
+
listPrs: (repoId, mode) => resolvePrs(repoId, mode, config),
|
|
851
|
+
getConfig,
|
|
852
|
+
speech: opts.speech,
|
|
853
|
+
captures,
|
|
854
|
+
automations: opts.automations,
|
|
855
|
+
setConfig: setConfig
|
|
856
|
+
? (patch, restart) => {
|
|
857
|
+
const result = setConfig(patch, restart);
|
|
858
|
+
publishComputer();
|
|
859
|
+
return result;
|
|
860
|
+
}
|
|
861
|
+
: undefined,
|
|
862
|
+
requestRestart,
|
|
863
|
+
telemetry,
|
|
864
|
+
machine: config.machineName,
|
|
865
|
+
incidentsDir: opts.incidentsDir,
|
|
866
|
+
turnQueue: durableQueue,
|
|
867
|
+
...overrides,
|
|
868
|
+
}).finally(() => { pendingRequests.delete(pending); });
|
|
869
|
+
pendingRequests.add(pending);
|
|
870
|
+
return pending;
|
|
871
|
+
};
|
|
875
872
|
durableQueue = new DurableTurnQueue({
|
|
876
873
|
dir: turnLogs.queueDirectory(),
|
|
877
874
|
logs: turnLogs,
|
|
@@ -885,6 +882,7 @@ export function startRoomClient(opts) {
|
|
|
885
882
|
? (targetId, prompt) => opts.controls.steer(targetId, prompt)
|
|
886
883
|
: undefined,
|
|
887
884
|
});
|
|
885
|
+
turnLogs.reconcile((id) => durableQueue.owns(id));
|
|
888
886
|
durableQueue.wake();
|
|
889
887
|
if (opts.speech) {
|
|
890
888
|
// Never resume another account's queued commands after replacing credentials.
|
|
@@ -1014,6 +1012,8 @@ export function startRoomClient(opts) {
|
|
|
1014
1012
|
stopped = true;
|
|
1015
1013
|
captures?.stop();
|
|
1016
1014
|
durableQueue?.stop();
|
|
1015
|
+
for (const controller of inFlight.values())
|
|
1016
|
+
controller.abort();
|
|
1017
1017
|
clearInterval(redialWatchdog);
|
|
1018
1018
|
unsubscribeHealth?.();
|
|
1019
1019
|
if (reconnectTimer) {
|
|
@@ -1031,5 +1031,9 @@ export function startRoomClient(opts) {
|
|
|
1031
1031
|
}
|
|
1032
1032
|
if (!stopped)
|
|
1033
1033
|
connect();
|
|
1034
|
-
return { stop, push: sendRaw, pushRepos
|
|
1034
|
+
return { stop, push: sendRaw, pushRepos, async drain() {
|
|
1035
|
+
while (pendingRequests.size)
|
|
1036
|
+
await Promise.allSettled(pendingRequests);
|
|
1037
|
+
await executionLanes.drain();
|
|
1038
|
+
} };
|
|
1035
1039
|
}
|
package/dist/room/computer.js
CHANGED
|
@@ -54,7 +54,7 @@ export function computerRuntime(opts) {
|
|
|
54
54
|
...(opts.commands ? ['commands'] : []),
|
|
55
55
|
...(opts.controls ? ['permission', 'steer'] : []),
|
|
56
56
|
...(opts.codeHandler ? ['code'] : []),
|
|
57
|
-
...(opts.
|
|
57
|
+
...(opts.workspaces ? ['workspaces', 'checkout-history', 'repo-settings', 'worktree-delete'] : []),
|
|
58
58
|
...(opts.cloneHandler ? ['clone'] : []),
|
|
59
59
|
...(opts.attention ? ['attention'] : []),
|
|
60
60
|
...(opts.getConfig ? ['getConfig'] : []),
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { TurnLogStore } from '../turnLog.js';
|
|
2
|
+
/** A durability failure stops owned work. Its uncertain outcome is reported only after release. */
|
|
3
|
+
export declare function publishDurably(logs: TurnLogStore, event: Record<string, unknown> & {
|
|
4
|
+
requestId: string;
|
|
5
|
+
}, inFlight: Map<string, AbortController>, send: (frame: unknown) => void): void;
|
|
6
|
+
//# sourceMappingURL=durablePublish.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"durablePublish.d.ts","sourceRoot":"","sources":["../../src/room/durablePublish.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAIlD,mGAAmG;AACnG,wBAAgB,cAAc,CAC5B,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,EACtD,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,EACtC,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAC7B,IAAI,CAcN"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const terminalTypes = new Set(['done', 'error', 'cancelled']);
|
|
2
|
+
/** A durability failure stops owned work. Its uncertain outcome is reported only after release. */
|
|
3
|
+
export function publishDurably(logs, event, inFlight, send) {
|
|
4
|
+
let frame;
|
|
5
|
+
try {
|
|
6
|
+
frame = logs.append(event.requestId, event);
|
|
7
|
+
}
|
|
8
|
+
catch (error) {
|
|
9
|
+
for (const controller of inFlight.values())
|
|
10
|
+
controller.abort();
|
|
11
|
+
if (terminalTypes.has(String(event.type)) && !inFlight.has(event.requestId)) {
|
|
12
|
+
send({ type: 'error', requestId: event.requestId, code: 'durability_fault',
|
|
13
|
+
message: "Computer storage failed. This turn's final outcome could not be saved. Free disk space and restart Lucidity, then inspect the workspace before retrying." });
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
throw error;
|
|
17
|
+
}
|
|
18
|
+
send(frame);
|
|
19
|
+
}
|
package/dist/room/incidents.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ import { type InvariantFinding } from './detectors.js';
|
|
|
17
17
|
* - session-reset — delivered and answered, but from a fresh memoryless session (`freshStart`):
|
|
18
18
|
* the turn succeeded yet lost its thread memory.
|
|
19
19
|
*/
|
|
20
|
-
export type IncidentClass = 'ok' | 'cancelled' | 'pending' | 'outbound-loss' | 'inbound-loss' | 'session-reset';
|
|
20
|
+
export type IncidentClass = 'ok' | 'execution-error' | 'history-unavailable' | 'cancelled' | 'pending' | 'outbound-loss' | 'inbound-loss' | 'session-reset';
|
|
21
21
|
/** The daemon's turn-log view of one turn, reduced to what the join needs. */
|
|
22
22
|
export interface DaemonTurnView {
|
|
23
23
|
exists: boolean;
|
|
@@ -93,6 +93,8 @@ export interface IncidentBundle {
|
|
|
93
93
|
snapshot?: IncidentSnapshot;
|
|
94
94
|
/** The tail of the phone's diag ring, when the frame carried it. */
|
|
95
95
|
phoneDiag?: IncidentDiagEvent[];
|
|
96
|
+
/** The phone's stutter-meter reading, when the frame carried one. */
|
|
97
|
+
perf?: Record<string, unknown>;
|
|
96
98
|
}
|
|
97
99
|
/**
|
|
98
100
|
* Classify one turn from the phone record joined to the daemon's turn-log view. Pure — the
|
|
@@ -113,6 +115,7 @@ export interface BuildIncidentOptions {
|
|
|
113
115
|
/** The phone socket snapshot + diag ring, when the frame carried them — feeds the detectors. */
|
|
114
116
|
snapshot?: IncidentSnapshot;
|
|
115
117
|
diag?: IncidentDiagEvent[];
|
|
118
|
+
perf?: Record<string, unknown>;
|
|
116
119
|
now?: () => number;
|
|
117
120
|
}
|
|
118
121
|
/** Join the phone ledger to the turn log and produce the bundle object (does not write it). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"incidents.d.ts","sourceRoot":"","sources":["../../src/room/incidents.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,gBAAgB,CAAC;AAExB;;;;;;;;;;;;;;GAcG;AAEH,MAAM,MAAM,aAAa,GACrB,IAAI,GACJ,WAAW,GACX,SAAS,GACT,eAAe,GACf,cAAc,GACd,eAAe,CAAC;AAEpB,8EAA8E;AAC9E,MAA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C3B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAED,+FAA+F;AAC/F,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,oBAAoB,GACzB,cAAc,CA0HhB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,cAAc,EACtB,GAAG,GAAE,MAAsB,EAC3B,GAAG,GAAE,MAAM,MAAiB,GAC3B,MAAM,GAAG,IAAI,CAUf"}
|
package/dist/room/incidents.js
CHANGED
|
@@ -31,7 +31,9 @@ function terminalTypeOf(frames) {
|
|
|
31
31
|
}
|
|
32
32
|
/** Severity for picking which turn a bundle headlines. Higher = worse. */
|
|
33
33
|
const SEVERITY = {
|
|
34
|
+
'execution-error': 4,
|
|
34
35
|
'outbound-loss': 4,
|
|
36
|
+
'history-unavailable': 1,
|
|
35
37
|
'session-reset': 3,
|
|
36
38
|
'inbound-loss': 2,
|
|
37
39
|
pending: 1,
|
|
@@ -49,7 +51,9 @@ export function classifyTurn(phone, daemon) {
|
|
|
49
51
|
return 'session-reset';
|
|
50
52
|
// The phone got a terminal: a real reply, or a daemon error that reached it. Either way the
|
|
51
53
|
// connection worked — an error the phone displayed is not a connection loss.
|
|
52
|
-
if (phone.state === '
|
|
54
|
+
if (phone.state === 'error')
|
|
55
|
+
return 'execution-error';
|
|
56
|
+
if (phone.state === 'done')
|
|
53
57
|
return 'ok';
|
|
54
58
|
if (phone.state === 'cancelled')
|
|
55
59
|
return 'cancelled';
|
|
@@ -63,14 +67,13 @@ export function classifyTurn(phone, daemon) {
|
|
|
63
67
|
return 'inbound-loss'; // Mac wrote frames the phone never saw
|
|
64
68
|
return 'pending'; // Mac still working, phone has caught up — no loss yet
|
|
65
69
|
}
|
|
66
|
-
//
|
|
67
|
-
//
|
|
68
|
-
// is what turns "no record" into a real outbound loss.
|
|
70
|
+
// Missing legacy logs may have expired. Even a settled phone request is not proof
|
|
71
|
+
// that the daemon never accepted it.
|
|
69
72
|
const settled = phone.state === 'timeout' ||
|
|
70
73
|
phone.state === 'lost' ||
|
|
71
74
|
phone.endedAt != null;
|
|
72
75
|
if (phone.staleSend || phone.transport === 'outbox' || settled)
|
|
73
|
-
return '
|
|
76
|
+
return 'history-unavailable';
|
|
74
77
|
return 'pending';
|
|
75
78
|
}
|
|
76
79
|
/** A turn is truly recoverable only when the Mac finished it with a real reply (`done`). An
|
|
@@ -86,13 +89,17 @@ function noteFor(t) {
|
|
|
86
89
|
const id = requestId.slice(0, 8);
|
|
87
90
|
const missed = Math.max(0, daemon.maxSeq - (phone.seq ?? 0));
|
|
88
91
|
switch (t.class) {
|
|
92
|
+
case 'execution-error':
|
|
93
|
+
return `Turn ${id} delivered an execution error${daemon.terminalDetail ? `: ${daemon.terminalDetail}` : '.'} Inspect that failure before retrying; delivery and execution are separate outcomes.`;
|
|
94
|
+
case 'history-unavailable':
|
|
95
|
+
return `No retained receipt for turn ${id}. Its earlier history may have expired or it may never have been accepted. The outcome is unknown; do not rerun it automatically.`;
|
|
89
96
|
case 'outbound-loss':
|
|
90
97
|
return `Turn ${id} (${phone.kind}) left the phone ${phone.staleSend ? 'on a socket that only looked open' : 'via the outbox'} but the daemon's turn log has no record of it — the prompt never reached the Mac.`;
|
|
91
98
|
case 'inbound-loss':
|
|
92
99
|
// Terminal TYPE decides whether this is a waiting reply or a dead turn — the crux the old
|
|
93
100
|
// "recoverable via a pull" note got wrong (it called a restart-killed turn recoverable).
|
|
94
101
|
if (daemon.terminalType === 'error')
|
|
95
|
-
return `The Mac terminated turn ${id} with an error${daemon.terminalDetail ? ` ("${daemon.terminalDetail}")` : ''} at seq ${daemon.maxSeq}; the phone settled '${phone.state}' at seq ${phone.seq ?? 0}
|
|
102
|
+
return `The Mac terminated turn ${id} with an error${daemon.terminalDetail ? ` ("${daemon.terminalDetail}")` : ''} at seq ${daemon.maxSeq}; the phone settled '${phone.state}' at seq ${phone.seq ?? 0}. The recorded error is available by pull. Inspect workspace and provider state before choosing to retry.`;
|
|
96
103
|
if (daemon.terminalType === 'done')
|
|
97
104
|
return `The Mac ran turn ${id} to completion (done at seq ${daemon.maxSeq}) but the phone settled '${phone.state}' at seq ${phone.seq ?? 0} — it is missing ${missed} frame${missed === 1 ? '' : 's'} incl. the reply, which is on disk and recoverable via a pull.`;
|
|
98
105
|
return `The Mac produced ${daemon.maxSeq} frames for turn ${id} (not yet terminated) but the phone settled '${phone.state}' at seq ${phone.seq ?? 0} — it is ${missed} frame${missed === 1 ? '' : 's'} behind; a pull replays the gap.`;
|
|
@@ -110,7 +117,7 @@ function noteFor(t) {
|
|
|
110
117
|
function pickOffender(turns, focusRequestId) {
|
|
111
118
|
if (focusRequestId) {
|
|
112
119
|
const f = turns.find((t) => t.requestId === focusRequestId);
|
|
113
|
-
if (f
|
|
120
|
+
if (f)
|
|
114
121
|
return f;
|
|
115
122
|
}
|
|
116
123
|
const candidates = turns.filter((t) => SEVERITY[t.class] >= 1);
|
|
@@ -228,6 +235,7 @@ export function buildIncidentBundle(opts) {
|
|
|
228
235
|
timeline: opts.timeline,
|
|
229
236
|
...(opts.snapshot ? { snapshot: opts.snapshot } : {}),
|
|
230
237
|
...(opts.diag ? { phoneDiag: opts.diag } : {}),
|
|
238
|
+
...(opts.perf ? { perf: opts.perf } : {}),
|
|
231
239
|
};
|
|
232
240
|
}
|
|
233
241
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"turnQueue.d.ts","sourceRoot":"","sources":["../../src/room/turnQueue.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"turnQueue.d.ts","sourceRoot":"","sources":["../../src/room/turnQueue.ts"],"names":[],"mappings":"AAQA,OAAO,EAAwB,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,aA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