@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/src/room/client.ts
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 type { AgentControls } from '../agentControls.js';
|
|
@@ -16,7 +17,6 @@ import type {
|
|
|
16
17
|
WorkspaceMode,
|
|
17
18
|
PrInfo,
|
|
18
19
|
HarnessImage,
|
|
19
|
-
FleetPlan,
|
|
20
20
|
DaemonConfigView,
|
|
21
21
|
DaemonConfigPatch,
|
|
22
22
|
} from '@lucidity/shared';
|
|
@@ -54,6 +54,7 @@ import { handoffPrompt } from '../handoff.js';
|
|
|
54
54
|
import { createHash } from 'node:crypto';
|
|
55
55
|
import { join } from 'node:path';
|
|
56
56
|
import { uuidv7 } from 'uuidv7';
|
|
57
|
+
import type { WorkspaceRegistry } from '../coding/workspaceRegistry.js';
|
|
57
58
|
|
|
58
59
|
/** Frame `type`s that carry recoverable turn output — the ones written to the durable
|
|
59
60
|
* turn log and stamped with a `seq`. Buffered responses (`kind` replies) and any other
|
|
@@ -74,13 +75,6 @@ const STREAM_EVENT_TYPES = new Set([
|
|
|
74
75
|
'clone_result',
|
|
75
76
|
'error',
|
|
76
77
|
'cancelled',
|
|
77
|
-
// Conductor fleet events — logged + seq-stamped like any turn frame so a mid-fleet `pull`
|
|
78
|
-
// replays the plan and the workers' progress instead of settling the turn as cut off.
|
|
79
|
-
'fleet_plan',
|
|
80
|
-
'worker_status',
|
|
81
|
-
'fleet_conflict',
|
|
82
|
-
'worker_pr',
|
|
83
|
-
'fleet_done',
|
|
84
78
|
]);
|
|
85
79
|
|
|
86
80
|
/**
|
|
@@ -97,6 +91,7 @@ const STREAM_EVENT_TYPES = new Set([
|
|
|
97
91
|
|
|
98
92
|
export type CodeHandler = (
|
|
99
93
|
req: {
|
|
94
|
+
recoveryOf?: string;
|
|
100
95
|
id: string;
|
|
101
96
|
repoId: string;
|
|
102
97
|
prompt: string;
|
|
@@ -116,21 +111,6 @@ export type CloneHandler = (
|
|
|
116
111
|
ctx: { send: (obj: unknown) => void; signal?: AbortSignal },
|
|
117
112
|
) => Promise<void>;
|
|
118
113
|
|
|
119
|
-
export type ConductHandler = (
|
|
120
|
-
req: {
|
|
121
|
-
id: string;
|
|
122
|
-
repoId: string;
|
|
123
|
-
phase: 'plan' | 'run' | 'setup' | 'integrate';
|
|
124
|
-
prompt: string;
|
|
125
|
-
images?: HarnessImage[];
|
|
126
|
-
plan?: FleetPlan;
|
|
127
|
-
resume?: string;
|
|
128
|
-
/** A quick incremental spawn: skip the dogfood task graph (no parent task, no subtask). */
|
|
129
|
-
ephemeral?: boolean;
|
|
130
|
-
},
|
|
131
|
-
ctx: { send: (obj: unknown) => void; signal?: AbortSignal },
|
|
132
|
-
) => Promise<void>;
|
|
133
|
-
|
|
134
114
|
/** One row of the phone's repo picker: which repo, what branch it sits on right now,
|
|
135
115
|
* and whether this daemon will let a turn run in that checkout (#121). */
|
|
136
116
|
export interface RepoInfo {
|
|
@@ -143,6 +123,7 @@ export interface RepoInfo {
|
|
|
143
123
|
}
|
|
144
124
|
|
|
145
125
|
export interface DispatchDeps {
|
|
126
|
+
workspaces?: WorkspaceRegistry;
|
|
146
127
|
speech?: Pick<SpeechService, 'transcribe'>;
|
|
147
128
|
captures?: Pick<VoiceCaptureService, 'submit' | 'status'>;
|
|
148
129
|
turnQueue?: DurableTurnQueue;
|
|
@@ -167,8 +148,6 @@ export interface DispatchDeps {
|
|
|
167
148
|
signal?: AbortSignal;
|
|
168
149
|
/** Handle a `code` turn (M7). Absent → coding stays disabled. */
|
|
169
150
|
codeHandler?: CodeHandler;
|
|
170
|
-
/** Handle a `conduct` turn (the fleet conductor). Absent → the conductor stays disabled. */
|
|
171
|
-
conductHandler?: ConductHandler;
|
|
172
151
|
/** Handle a `clone` turn (#78). Absent → phone cloning stays disabled. */
|
|
173
152
|
cloneHandler?: CloneHandler;
|
|
174
153
|
/** The phone's repo picker (`repos` request). A callback, not a value: resolving each
|
|
@@ -223,7 +202,7 @@ function sendStreamEvent(
|
|
|
223
202
|
else if (ev.type === 'delta')
|
|
224
203
|
send({ type: 'delta', requestId, text: ev.text });
|
|
225
204
|
else if (ev.type === 'tool_call')
|
|
226
|
-
send({
|
|
205
|
+
send({ ...ev, requestId });
|
|
227
206
|
else
|
|
228
207
|
send({
|
|
229
208
|
type: 'done',
|
|
@@ -282,8 +261,16 @@ export async function dispatchRequest(
|
|
|
282
261
|
}
|
|
283
262
|
const req = parsed.data;
|
|
284
263
|
const structured = req.kind === 'ask' && (req.dayPlan ? 'day-plan' : req.projectPlan ? 'project-plan' : undefined);
|
|
285
|
-
|
|
286
|
-
|
|
264
|
+
let deferTerminal = false;
|
|
265
|
+
let terminal: Record<string, unknown> | undefined;
|
|
266
|
+
const send = (frame: unknown) => {
|
|
267
|
+
const event = frame as Record<string, unknown>;
|
|
268
|
+
if (deferTerminal && event?.requestId === req.id && (['done', 'error', 'cancelled'].includes(String(event.type)) || ['ask', 'briefing', 'attention'].includes(String(event.kind)))) {
|
|
269
|
+
terminal ??= event;
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
sendFrame(structured ? { ...event, purpose: structured } : frame);
|
|
273
|
+
};
|
|
287
274
|
if (req.kind === 'voice-capture' || req.kind === 'voice-capture-status') {
|
|
288
275
|
try {
|
|
289
276
|
if (!deps.captures)
|
|
@@ -395,6 +382,7 @@ export async function dispatchRequest(
|
|
|
395
382
|
reason: req.reason,
|
|
396
383
|
snapshot: req.snapshot,
|
|
397
384
|
diag: req.diag,
|
|
385
|
+
perf: req.perf,
|
|
398
386
|
});
|
|
399
387
|
const path = writeIncidentBundle(bundle, deps.incidentsDir);
|
|
400
388
|
deps.telemetry?.record(
|
|
@@ -488,12 +476,16 @@ export async function dispatchRequest(
|
|
|
488
476
|
const controller = inFlight?.get(req.targetId);
|
|
489
477
|
if (controller) {
|
|
490
478
|
controller.abort();
|
|
491
|
-
//
|
|
492
|
-
// landing at maxSeq+1) — a later pull then sees a settled turn.
|
|
493
|
-
send({ type: 'cancelled', requestId: req.targetId });
|
|
479
|
+
// The owner publishes cancellation after the provider and workspace are released.
|
|
494
480
|
} else {
|
|
495
|
-
// Conductor workers have provider-owned request IDs, separate from the parent lane.
|
|
496
481
|
await deps.controls?.interrupt(req.targetId);
|
|
482
|
+
// Completion can beat Stop while its terminal frame is lost in transit. Replay
|
|
483
|
+
// the actual outcome so the phone settles without rewriting finished work.
|
|
484
|
+
const state = deps.turnLogs.read(req.targetId);
|
|
485
|
+
if (state.terminated) {
|
|
486
|
+
log(`stop for finished turn ${req.targetId}: replaying its ${state.frames.length} frames`);
|
|
487
|
+
for (const frame of state.frames) deps.sendRaw(frame);
|
|
488
|
+
}
|
|
497
489
|
}
|
|
498
490
|
return;
|
|
499
491
|
}
|
|
@@ -513,6 +505,10 @@ export async function dispatchRequest(
|
|
|
513
505
|
});
|
|
514
506
|
return;
|
|
515
507
|
}
|
|
508
|
+
// The phone is still waiting on a turn this computer already finished: its last frame was
|
|
509
|
+
// lost on the way. Worth a line, it is the only trace on this side of that failure (#505).
|
|
510
|
+
if (state.terminated && state.frames.some((frame) => frame.seq > req.sinceSeq))
|
|
511
|
+
log(`pull for finished turn ${req.targetId}: phone had seq ${req.sinceSeq} of ${state.frames.length}`);
|
|
516
512
|
// Replay the gap verbatim (already logged; don't re-log).
|
|
517
513
|
for (const frame of state.frames) {
|
|
518
514
|
if (frame.seq > req.sinceSeq) sendRaw(frame);
|
|
@@ -523,23 +519,6 @@ export async function dispatchRequest(
|
|
|
523
519
|
// restores its controls instead of waiting forever for another model token.
|
|
524
520
|
if (!state.terminated && inFlight?.has(req.targetId))
|
|
525
521
|
deps.controls?.publishPending(req.targetId);
|
|
526
|
-
// Open log (no terminal) with no live run owning it → the subprocess died (the daemon
|
|
527
|
-
// restarted mid-turn). Settle it with a synthesized, persisted terminal so the phone
|
|
528
|
-
// stops waiting and a repeat pull is idempotent. If it's still in `inFlight`, live
|
|
529
|
-
// frames past maxSeq keep flowing on the current socket (deduped by seq) — leave it.
|
|
530
|
-
if (
|
|
531
|
-
!state.terminated &&
|
|
532
|
-
!inFlight?.has(req.targetId) &&
|
|
533
|
-
!deps.turnQueue?.owns(req.targetId)
|
|
534
|
-
) {
|
|
535
|
-
sendRaw(
|
|
536
|
-
turnLogs.append(req.targetId, {
|
|
537
|
-
type: 'error',
|
|
538
|
-
requestId: req.targetId,
|
|
539
|
-
message: 'Lucid restarted before finishing this turn.',
|
|
540
|
-
}),
|
|
541
|
-
);
|
|
542
|
-
}
|
|
543
522
|
return;
|
|
544
523
|
}
|
|
545
524
|
|
|
@@ -560,37 +539,20 @@ export async function dispatchRequest(
|
|
|
560
539
|
|
|
561
540
|
if (
|
|
562
541
|
deps.recordAcceptance &&
|
|
563
|
-
['ask', 'code', '
|
|
542
|
+
['ask', 'code', 'briefing', 'attention', 'clone'].includes(
|
|
564
543
|
req.kind,
|
|
565
544
|
)
|
|
566
545
|
) {
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
type: 'accepted',
|
|
576
|
-
requestId: req.id,
|
|
577
|
-
scope: {
|
|
578
|
-
kind: req.kind,
|
|
579
|
-
...('repoId' in req ? { repoId: req.repoId } : {}),
|
|
580
|
-
...('workerId' in req ? { workerId: req.workerId } : {}),
|
|
581
|
-
...('mode' in req ? { mode: req.mode } : {}),
|
|
582
|
-
},
|
|
583
|
-
});
|
|
584
|
-
if (!deps.turnLogs.read(req.id).exists) {
|
|
585
|
-
send({
|
|
586
|
-
type: 'error',
|
|
587
|
-
requestId: req.id,
|
|
588
|
-
message:
|
|
589
|
-
'Cannot save the request safely on this computer. Check available disk space and retry.',
|
|
590
|
-
});
|
|
546
|
+
try {
|
|
547
|
+
deps.turnLogs.read(req.id); // Adopt legacy receipts before admission.
|
|
548
|
+
const receipt = deps.turnLogs.runtime.accept(req);
|
|
549
|
+
for (const frame of receipt.frames) deps.sendRaw(frame);
|
|
550
|
+
if (receipt.duplicate || inFlight?.has(req.id)) return;
|
|
551
|
+
} catch (error) {
|
|
552
|
+
deps.sendRaw({ type: 'error', requestId: req.id,
|
|
553
|
+
message: `Cannot accept this request safely: ${error instanceof Error ? error.message : String(error)}` });
|
|
591
554
|
return;
|
|
592
555
|
}
|
|
593
|
-
deps.sendRaw(accepted);
|
|
594
556
|
}
|
|
595
557
|
|
|
596
558
|
// Own abort controller per request, combined with the daemon-shutdown signal, so a
|
|
@@ -598,6 +560,7 @@ export async function dispatchRequest(
|
|
|
598
560
|
const ownController = new AbortController();
|
|
599
561
|
const signal = combineSignals(outerSignal, ownController.signal);
|
|
600
562
|
inFlight?.set(req.id, ownController);
|
|
563
|
+
deferTerminal = true;
|
|
601
564
|
|
|
602
565
|
// Wait for the lane INSIDE the try, and after `inFlight.set` above — a turn waiting its turn
|
|
603
566
|
// must still be cancellable, and the `signal?.aborted` checks below mean a cancel that lands
|
|
@@ -752,6 +715,13 @@ export async function dispatchRequest(
|
|
|
752
715
|
entries: result.entries,
|
|
753
716
|
nextBefore: result.nextBefore,
|
|
754
717
|
});
|
|
718
|
+
} else if (req.kind === 'workspaces') {
|
|
719
|
+
if (!deps.workspaces) throw new Error('Update Lucidity on the computer to use persistent workers.');
|
|
720
|
+
if (req.command.action === 'continue-run') {
|
|
721
|
+
if (!deps.turnQueue) throw new Error('The computer queue is unavailable.');
|
|
722
|
+
deps.turnQueue.enqueue(deps.workspaces.continuation(req.command));
|
|
723
|
+
}
|
|
724
|
+
send({ requestId: req.id, kind: 'workspaces', snapshot: await deps.workspaces.command(req.command, req.id) });
|
|
755
725
|
} else if (req.kind === 'repos') {
|
|
756
726
|
send({
|
|
757
727
|
requestId: req.id,
|
|
@@ -824,38 +794,9 @@ export async function dispatchRequest(
|
|
|
824
794
|
});
|
|
825
795
|
if (r.restarting) deps.requestRestart?.();
|
|
826
796
|
}
|
|
827
|
-
} else if (req.kind === 'conduct') {
|
|
828
|
-
if (deps.conductHandler) {
|
|
829
|
-
// The whole fleet holds the repo's lane: its workers write isolated worktrees, but
|
|
830
|
-
// integration resets and merges onto lucid/<repo>, so no other turn on this repo (a
|
|
831
|
-
// bare code turn, or a second fleet) may run meanwhile.
|
|
832
|
-
await onLane(`room:code:${req.repoId}`, () =>
|
|
833
|
-
deps.conductHandler!(
|
|
834
|
-
{
|
|
835
|
-
id: req.id,
|
|
836
|
-
repoId: req.repoId,
|
|
837
|
-
phase: req.phase,
|
|
838
|
-
prompt: req.prompt,
|
|
839
|
-
images: req.images,
|
|
840
|
-
plan: req.plan,
|
|
841
|
-
resume: req.resume,
|
|
842
|
-
// Forward it or a quick spawn silently mints a parent task + subtask anyway: the
|
|
843
|
-
// phone sends `ephemeral`, conduct honours it, and this hop used to drop it.
|
|
844
|
-
ephemeral: req.ephemeral,
|
|
845
|
-
},
|
|
846
|
-
{ send, signal },
|
|
847
|
-
),
|
|
848
|
-
);
|
|
849
|
-
} else {
|
|
850
|
-
send({
|
|
851
|
-
type: 'error',
|
|
852
|
-
requestId: req.id,
|
|
853
|
-
message: 'The conductor is not enabled on this daemon.',
|
|
854
|
-
});
|
|
855
|
-
}
|
|
856
797
|
} else if (deps.codeHandler) {
|
|
857
798
|
// Per-worktree lane: two turns sharing a worktree/cwd must serialize, but genuinely
|
|
858
|
-
// independent work runs in parallel. The bare repo session and each
|
|
799
|
+
// independent work runs in parallel. The bare repo session and each worktree
|
|
859
800
|
// (`workerId`) own separate worktrees, so each gets its own lane — a phone turn drilled
|
|
860
801
|
// into worker A can't collide with worker B, and a bare turn keeps today's exact key.
|
|
861
802
|
const lane = req.workerId
|
|
@@ -874,6 +815,7 @@ export async function dispatchRequest(
|
|
|
874
815
|
mode: req.mode,
|
|
875
816
|
expectedBranch: req.expectedBranch,
|
|
876
817
|
workerId: req.workerId,
|
|
818
|
+
...(req.recoveryOf ? { recoveryOf: req.recoveryOf } : {}),
|
|
877
819
|
},
|
|
878
820
|
{ send, signal },
|
|
879
821
|
),
|
|
@@ -888,17 +830,24 @@ export async function dispatchRequest(
|
|
|
888
830
|
} catch (err) {
|
|
889
831
|
// A deadline/cancel abort surfaces as an AbortError ("The operation was aborted").
|
|
890
832
|
// Never forward that literal text to the phone — end the turn quietly instead.
|
|
891
|
-
if (isAbortError(err))
|
|
833
|
+
if (isAbortError(err)) {
|
|
834
|
+
send({ type: 'cancelled', requestId: req.id });
|
|
835
|
+
return;
|
|
836
|
+
}
|
|
892
837
|
const message = err instanceof Error ? err.message : String(err);
|
|
893
838
|
deps.telemetry?.record('dispatch-error', message, req.id);
|
|
894
839
|
send({ type: 'error', requestId: req.id, message });
|
|
895
840
|
} finally {
|
|
896
841
|
deps.controls?.end(req.id);
|
|
897
842
|
inFlight?.delete(req.id);
|
|
843
|
+
deferTerminal = false;
|
|
844
|
+
if (signal?.aborted) send({ type: 'cancelled', requestId: req.id });
|
|
845
|
+
else if (terminal) send(terminal);
|
|
898
846
|
}
|
|
899
847
|
}
|
|
900
848
|
|
|
901
849
|
export interface RoomClientOptions {
|
|
850
|
+
workspaces?: WorkspaceRegistry;
|
|
902
851
|
speech?: SpeechService;
|
|
903
852
|
capturesDir?: string;
|
|
904
853
|
computerId?: string;
|
|
@@ -915,8 +864,6 @@ export interface RoomClientOptions {
|
|
|
915
864
|
logger?: (msg: string) => void;
|
|
916
865
|
/** Handle `code` turns (M7). Absent → coding disabled. */
|
|
917
866
|
codeHandler?: CodeHandler;
|
|
918
|
-
/** Handle `conduct` turns (the fleet conductor). Absent → the conductor disabled. */
|
|
919
|
-
conductHandler?: ConductHandler;
|
|
920
867
|
/** Serialises room turns per lane — see `DispatchDeps.queue`. Share the daemon's one instance
|
|
921
868
|
* so room turns also serialise against scheduled briefings and the local chat server. */
|
|
922
869
|
queue?: LaneQueue;
|
|
@@ -945,6 +892,7 @@ export interface RoomClientOptions {
|
|
|
945
892
|
|
|
946
893
|
export interface RoomClientHandle {
|
|
947
894
|
stop(): void;
|
|
895
|
+
drain(): Promise<void>;
|
|
948
896
|
/**
|
|
949
897
|
* Send an unsolicited frame to the phone (#320).
|
|
950
898
|
*
|
|
@@ -1064,7 +1012,6 @@ export function startRoomClient(opts: RoomClientOptions): RoomClientHandle {
|
|
|
1064
1012
|
vault,
|
|
1065
1013
|
signal,
|
|
1066
1014
|
codeHandler,
|
|
1067
|
-
conductHandler,
|
|
1068
1015
|
cloneHandler,
|
|
1069
1016
|
queue,
|
|
1070
1017
|
getConfig,
|
|
@@ -1121,11 +1068,22 @@ export function startRoomClient(opts: RoomClientOptions): RoomClientHandle {
|
|
|
1121
1068
|
STREAM_EVENT_TYPES.has(rec.type) &&
|
|
1122
1069
|
typeof rec.requestId === 'string'
|
|
1123
1070
|
) {
|
|
1124
|
-
|
|
1071
|
+
publishDurably(turnLogs, { ...rec, requestId: rec.requestId }, inFlight, sendRaw);
|
|
1125
1072
|
durableQueue?.wake();
|
|
1126
1073
|
return;
|
|
1127
1074
|
}
|
|
1128
1075
|
}
|
|
1076
|
+
const buffered = obj as Record<string, unknown>;
|
|
1077
|
+
if (buffered && typeof buffered.requestId === 'string' && ['ask', 'briefing', 'attention'].includes(String(buffered.kind))) {
|
|
1078
|
+
publishDurably(turnLogs, { ...buffered, type: 'done', requestId: buffered.requestId }, inFlight,
|
|
1079
|
+
(frame) => {
|
|
1080
|
+
const saved = frame as Record<string, unknown>;
|
|
1081
|
+
if (saved.type === 'error') sendRaw(frame);
|
|
1082
|
+
else sendRaw({ ...buffered, seq: saved.seq });
|
|
1083
|
+
});
|
|
1084
|
+
durableQueue?.wake();
|
|
1085
|
+
return;
|
|
1086
|
+
}
|
|
1129
1087
|
sendRaw(obj);
|
|
1130
1088
|
};
|
|
1131
1089
|
|
|
@@ -1183,8 +1141,10 @@ export function startRoomClient(opts: RoomClientOptions): RoomClientHandle {
|
|
|
1183
1141
|
reconnectTimer.unref?.();
|
|
1184
1142
|
}
|
|
1185
1143
|
|
|
1186
|
-
const
|
|
1187
|
-
|
|
1144
|
+
const pendingRequests = new Set<Promise<void>>();
|
|
1145
|
+
const dispatch = (raw: string, overrides: Partial<DispatchDeps> = {}): Promise<void> => {
|
|
1146
|
+
if (stopped) return Promise.resolve();
|
|
1147
|
+
const pending = dispatchRequest(raw, {
|
|
1188
1148
|
harness,
|
|
1189
1149
|
recordAcceptance: true,
|
|
1190
1150
|
runtime: opts.providerHealth ? () => computerRuntime(opts) : undefined,
|
|
@@ -1196,10 +1156,10 @@ export function startRoomClient(opts: RoomClientOptions): RoomClientHandle {
|
|
|
1196
1156
|
send: turnSend,
|
|
1197
1157
|
sendRaw,
|
|
1198
1158
|
turnLogs,
|
|
1159
|
+
workspaces: opts.workspaces,
|
|
1199
1160
|
signal,
|
|
1200
1161
|
codeHandler,
|
|
1201
|
-
|
|
1202
|
-
cloneHandler,
|
|
1162
|
+
cloneHandler,
|
|
1203
1163
|
queue: executionLanes,
|
|
1204
1164
|
inFlight,
|
|
1205
1165
|
attention: opts.attention,
|
|
@@ -1225,7 +1185,10 @@ export function startRoomClient(opts: RoomClientOptions): RoomClientHandle {
|
|
|
1225
1185
|
|
|
1226
1186
|
turnQueue: durableQueue,
|
|
1227
1187
|
...overrides,
|
|
1228
|
-
});
|
|
1188
|
+
}).finally(() => { pendingRequests.delete(pending); });
|
|
1189
|
+
pendingRequests.add(pending);
|
|
1190
|
+
return pending;
|
|
1191
|
+
};
|
|
1229
1192
|
durableQueue = new DurableTurnQueue({
|
|
1230
1193
|
dir: turnLogs.queueDirectory(),
|
|
1231
1194
|
logs: turnLogs,
|
|
@@ -1240,6 +1203,7 @@ export function startRoomClient(opts: RoomClientOptions): RoomClientHandle {
|
|
|
1240
1203
|
? (targetId, prompt) => opts.controls!.steer(targetId, prompt)
|
|
1241
1204
|
: undefined,
|
|
1242
1205
|
});
|
|
1206
|
+
turnLogs.reconcile((id) => durableQueue!.owns(id));
|
|
1243
1207
|
durableQueue.wake();
|
|
1244
1208
|
|
|
1245
1209
|
if (opts.speech) {
|
|
@@ -1384,6 +1348,7 @@ export function startRoomClient(opts: RoomClientOptions): RoomClientHandle {
|
|
|
1384
1348
|
stopped = true;
|
|
1385
1349
|
captures?.stop();
|
|
1386
1350
|
durableQueue?.stop();
|
|
1351
|
+
for (const controller of inFlight.values()) controller.abort();
|
|
1387
1352
|
clearInterval(redialWatchdog);
|
|
1388
1353
|
unsubscribeHealth?.();
|
|
1389
1354
|
if (reconnectTimer) {
|
|
@@ -1400,5 +1365,8 @@ export function startRoomClient(opts: RoomClientOptions): RoomClientHandle {
|
|
|
1400
1365
|
}
|
|
1401
1366
|
if (!stopped) connect();
|
|
1402
1367
|
|
|
1403
|
-
return { stop, push: sendRaw, pushRepos
|
|
1368
|
+
return { stop, push: sendRaw, pushRepos, async drain() {
|
|
1369
|
+
while (pendingRequests.size) await Promise.allSettled(pendingRequests);
|
|
1370
|
+
await executionLanes.drain();
|
|
1371
|
+
} };
|
|
1404
1372
|
}
|
package/src/room/computer.ts
CHANGED
|
@@ -58,7 +58,7 @@ export function computerRuntime(opts: RoomClientOptions): ComputerRuntime {
|
|
|
58
58
|
...(opts.commands ? ['commands'] : []),
|
|
59
59
|
...(opts.controls ? ['permission', 'steer'] : []),
|
|
60
60
|
...(opts.codeHandler ? ['code'] : []),
|
|
61
|
-
...(opts.
|
|
61
|
+
...(opts.workspaces ? ['workspaces', 'checkout-history', 'repo-settings', 'worktree-delete'] : []),
|
|
62
62
|
...(opts.cloneHandler ? ['clone'] : []),
|
|
63
63
|
...(opts.attention ? ['attention'] : []),
|
|
64
64
|
...(opts.getConfig ? ['getConfig'] : []),
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { TurnLogStore } from '../turnLog.js';
|
|
2
|
+
|
|
3
|
+
const terminalTypes = new Set(['done', 'error', 'cancelled']);
|
|
4
|
+
|
|
5
|
+
/** A durability failure stops owned work. Its uncertain outcome is reported only after release. */
|
|
6
|
+
export function publishDurably(
|
|
7
|
+
logs: TurnLogStore,
|
|
8
|
+
event: Record<string, unknown> & { requestId: string },
|
|
9
|
+
inFlight: Map<string, AbortController>,
|
|
10
|
+
send: (frame: unknown) => void,
|
|
11
|
+
): void {
|
|
12
|
+
let frame: unknown;
|
|
13
|
+
try {
|
|
14
|
+
frame = logs.append(event.requestId, event);
|
|
15
|
+
} catch (error) {
|
|
16
|
+
for (const controller of inFlight.values()) controller.abort();
|
|
17
|
+
if (terminalTypes.has(String(event.type)) && !inFlight.has(event.requestId)) {
|
|
18
|
+
send({ type: 'error', requestId: event.requestId, code: 'durability_fault',
|
|
19
|
+
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." });
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
send(frame);
|
|
25
|
+
}
|
package/src/room/incidents.ts
CHANGED
|
@@ -31,7 +31,9 @@ import {
|
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
33
|
export type IncidentClass =
|
|
34
|
-
| 'ok' // delivered
|
|
34
|
+
| 'ok' // delivered a completed answer
|
|
35
|
+
| 'execution-error' // delivery succeeded; execution failed
|
|
36
|
+
| 'history-unavailable' // no retained receipt; acceptance cannot be established
|
|
35
37
|
| 'cancelled' // the user stopped it — not a failure
|
|
36
38
|
| 'pending' // still plausibly in flight — too early to call a loss
|
|
37
39
|
| 'outbound-loss'
|
|
@@ -150,11 +152,15 @@ export interface IncidentBundle {
|
|
|
150
152
|
snapshot?: IncidentSnapshot;
|
|
151
153
|
/** The tail of the phone's diag ring, when the frame carried it. */
|
|
152
154
|
phoneDiag?: IncidentDiagEvent[];
|
|
155
|
+
/** The phone's stutter-meter reading, when the frame carried one. */
|
|
156
|
+
perf?: Record<string, unknown>;
|
|
153
157
|
}
|
|
154
158
|
|
|
155
159
|
/** Severity for picking which turn a bundle headlines. Higher = worse. */
|
|
156
160
|
const SEVERITY: Record<IncidentClass, number> = {
|
|
161
|
+
'execution-error': 4,
|
|
157
162
|
'outbound-loss': 4,
|
|
163
|
+
'history-unavailable': 1,
|
|
158
164
|
'session-reset': 3,
|
|
159
165
|
'inbound-loss': 2,
|
|
160
166
|
pending: 1,
|
|
@@ -175,7 +181,8 @@ export function classifyTurn(
|
|
|
175
181
|
if (phone.sessionReset) return 'session-reset';
|
|
176
182
|
// The phone got a terminal: a real reply, or a daemon error that reached it. Either way the
|
|
177
183
|
// connection worked — an error the phone displayed is not a connection loss.
|
|
178
|
-
if (phone.state === '
|
|
184
|
+
if (phone.state === 'error') return 'execution-error';
|
|
185
|
+
if (phone.state === 'done') return 'ok';
|
|
179
186
|
if (phone.state === 'cancelled') return 'cancelled';
|
|
180
187
|
|
|
181
188
|
const phoneSeq = phone.seq ?? 0;
|
|
@@ -187,15 +194,14 @@ export function classifyTurn(
|
|
|
187
194
|
return 'pending'; // Mac still working, phone has caught up — no loss yet
|
|
188
195
|
}
|
|
189
196
|
|
|
190
|
-
//
|
|
191
|
-
//
|
|
192
|
-
// is what turns "no record" into a real outbound loss.
|
|
197
|
+
// Missing legacy logs may have expired. Even a settled phone request is not proof
|
|
198
|
+
// that the daemon never accepted it.
|
|
193
199
|
const settled =
|
|
194
200
|
phone.state === 'timeout' ||
|
|
195
201
|
phone.state === 'lost' ||
|
|
196
202
|
phone.endedAt != null;
|
|
197
203
|
if (phone.staleSend || phone.transport === 'outbox' || settled)
|
|
198
|
-
return '
|
|
204
|
+
return 'history-unavailable';
|
|
199
205
|
return 'pending';
|
|
200
206
|
}
|
|
201
207
|
|
|
@@ -212,6 +218,10 @@ function noteFor(t: JoinedTurn): string {
|
|
|
212
218
|
const id = requestId.slice(0, 8);
|
|
213
219
|
const missed = Math.max(0, daemon.maxSeq - (phone.seq ?? 0));
|
|
214
220
|
switch (t.class) {
|
|
221
|
+
case 'execution-error':
|
|
222
|
+
return `Turn ${id} delivered an execution error${daemon.terminalDetail ? `: ${daemon.terminalDetail}` : '.'} Inspect that failure before retrying; delivery and execution are separate outcomes.`;
|
|
223
|
+
case 'history-unavailable':
|
|
224
|
+
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.`;
|
|
215
225
|
case 'outbound-loss':
|
|
216
226
|
return `Turn ${id} (${phone.kind}) left the phone ${
|
|
217
227
|
phone.staleSend ? 'on a socket that only looked open' : 'via the outbox'
|
|
@@ -224,7 +234,7 @@ function noteFor(t: JoinedTurn): string {
|
|
|
224
234
|
daemon.terminalDetail ? ` ("${daemon.terminalDetail}")` : ''
|
|
225
235
|
} at seq ${daemon.maxSeq}; the phone settled '${phone.state}' at seq ${
|
|
226
236
|
phone.seq ?? 0
|
|
227
|
-
}
|
|
237
|
+
}. The recorded error is available by pull. Inspect workspace and provider state before choosing to retry.`;
|
|
228
238
|
if (daemon.terminalType === 'done')
|
|
229
239
|
return `The Mac ran turn ${id} to completion (done at seq ${daemon.maxSeq}) but the phone settled '${phone.state}' at seq ${
|
|
230
240
|
phone.seq ?? 0
|
|
@@ -252,7 +262,7 @@ function pickOffender(
|
|
|
252
262
|
): JoinedTurn | null {
|
|
253
263
|
if (focusRequestId) {
|
|
254
264
|
const f = turns.find((t) => t.requestId === focusRequestId);
|
|
255
|
-
if (f
|
|
265
|
+
if (f) return f;
|
|
256
266
|
}
|
|
257
267
|
const candidates = turns.filter((t) => SEVERITY[t.class] >= 1);
|
|
258
268
|
if (!candidates.length) return null;
|
|
@@ -274,6 +284,7 @@ export interface BuildIncidentOptions {
|
|
|
274
284
|
/** The phone socket snapshot + diag ring, when the frame carried them — feeds the detectors. */
|
|
275
285
|
snapshot?: IncidentSnapshot;
|
|
276
286
|
diag?: IncidentDiagEvent[];
|
|
287
|
+
perf?: Record<string, unknown>;
|
|
277
288
|
now?: () => number;
|
|
278
289
|
}
|
|
279
290
|
|
|
@@ -400,6 +411,7 @@ export function buildIncidentBundle(
|
|
|
400
411
|
timeline: opts.timeline,
|
|
401
412
|
...(opts.snapshot ? { snapshot: opts.snapshot } : {}),
|
|
402
413
|
...(opts.diag ? { phoneDiag: opts.diag } : {}),
|
|
414
|
+
...(opts.perf ? { perf: opts.perf } : {}),
|
|
403
415
|
};
|
|
404
416
|
}
|
|
405
417
|
|