@opencorelabs/lucidity 0.8.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 +2 -2
- package/dist/assets/speech/lucidity-speech +0 -0
- 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/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 +3 -14
- package/dist/coding/runCodeTurn.d.ts.map +1 -1
- package/dist/coding/runCodeTurn.js +21 -86
- 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 +49 -1
- package/dist/coding/workspaceRegistry.d.ts.map +1 -1
- package/dist/coding/workspaceRegistry.js +208 -17
- package/dist/coding/worktree.d.ts +61 -18
- package/dist/coding/worktree.d.ts.map +1 -1
- package/dist/coding/worktree.js +149 -17
- 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/index.js +21 -28
- 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/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/room/client.d.ts +2 -20
- package/dist/room/client.d.ts.map +1 -1
- package/dist/room/client.js +18 -29
- package/dist/room/computer.d.ts.map +1 -1
- package/dist/room/computer.js +1 -2
- package/dist/room/incidents.d.ts +3 -0
- package/dist/room/incidents.d.ts.map +1 -1
- package/dist/room/incidents.js +1 -0
- package/dist/room/turnQueue.d.ts.map +1 -1
- package/dist/room/turnQueue.js +28 -22
- package/dist/runtimeStore.d.ts +2 -0
- package/dist/runtimeStore.d.ts.map +1 -1
- package/dist/runtimeStore.js +17 -0
- package/dist/vault.d.ts +6 -3
- package/dist/vault.d.ts.map +1 -1
- package/dist/vault.js +18 -4
- package/package.json +1 -1
- package/src/automations/service.ts +47 -21
- package/src/automations/store.ts +41 -50
- package/src/automations/workflow.ts +49 -0
- package/src/coding/listPrs.ts +14 -0
- package/src/coding/runCodeTurn.ts +26 -95
- package/src/coding/runReview.ts +83 -0
- package/src/coding/workspaceRegistry.ts +186 -16
- package/src/coding/worktree.ts +161 -20
- package/src/coding/worktreeSetup.ts +50 -0
- package/src/index.ts +22 -31
- package/src/jobs/briefing.ts +62 -109
- package/src/logTimestamps.ts +14 -0
- package/src/providerRecovery.ts +99 -0
- package/src/room/client.ts +19 -54
- package/src/room/computer.ts +1 -2
- package/src/room/incidents.ts +4 -0
- package/src/room/turnQueue.ts +27 -29
- package/src/runtimeStore.ts +18 -1
- package/src/vault.ts +16 -7
- package/vendor/mcp-server/package.json +1 -1
- package/vendor/runtime/README.md +34 -0
- package/vendor/runtime/dist/executor/claudeAgent.d.ts +4 -0
- package/vendor/runtime/dist/executor/claudeAgent.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/claudeAgent.js +57 -4
- package/vendor/runtime/dist/executor/codex.d.ts +7 -2
- package/vendor/runtime/dist/executor/codex.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/codex.js +47 -4
- 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/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/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/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/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/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/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/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/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/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/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 +3 -1
- package/vendor/runtime/dist/executor/codexRpc.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/codexRpc.js +3 -2
- package/vendor/runtime/dist/executor/health.d.ts +6 -1
- package/vendor/runtime/dist/executor/health.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/health.js +4 -0
- package/vendor/runtime/dist/executor/ownership.d.ts +6 -1
- package/vendor/runtime/dist/executor/ownership.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/ownership.js +7 -0
- package/vendor/runtime/dist/executor/types.d.ts +25 -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 +1 -1
- package/vendor/runtime/dist/index.d.ts.map +1 -1
- package/vendor/runtime/src/executor/claudeAgent.ts +50 -4
- package/vendor/runtime/src/executor/codex.ts +51 -5
- package/vendor/runtime/src/executor/codexProtocol/AgentPath.ts +5 -0
- 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/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/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/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/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/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/ThreadSection.ts +21 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/ThreadSectionAppearance.ts +8 -0
- 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/TurnStatus.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/WebSearchAction.ts +5 -0
- package/vendor/runtime/src/executor/codexRpc.ts +4 -2
- package/vendor/runtime/src/executor/health.ts +5 -1
- package/vendor/runtime/src/executor/ownership.ts +8 -1
- package/vendor/runtime/src/executor/types.ts +18 -1
- package/vendor/runtime/src/harness/index.ts +1 -0
- package/vendor/runtime/src/index.ts +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/computer.d.ts +1 -1
- package/vendor/shared/dist/computer.d.ts.map +1 -1
- package/vendor/shared/dist/computer.js +1 -2
- package/vendor/shared/dist/constants.d.ts +1 -1
- package/vendor/shared/dist/constants.d.ts.map +1 -1
- package/vendor/shared/dist/constants.js +3 -10
- package/vendor/shared/dist/index.d.ts +4 -2
- package/vendor/shared/dist/index.d.ts.map +1 -1
- package/vendor/shared/dist/index.js +3 -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 +98 -169
- package/vendor/shared/dist/schemas/harness.d.ts.map +1 -1
- package/vendor/shared/dist/schemas/harness.js +19 -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 +117 -0
- package/vendor/shared/dist/workspaces.d.ts.map +1 -1
- package/vendor/shared/dist/workspaces.js +50 -1
- package/vendor/shared/src/automations.ts +12 -0
- package/vendor/shared/src/computer.ts +3 -3
- package/vendor/shared/src/constants.ts +3 -10
- package/vendor/shared/src/index.ts +3 -6
- package/vendor/shared/src/messagingSafety.ts +11 -0
- package/vendor/shared/src/schemas/harness.ts +18 -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 +56 -1
- package/dist/coding/conduct.d.ts +0 -48
- package/dist/coding/conduct.d.ts.map +0 -1
- package/dist/coding/conduct.js +0 -263
- 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/src/coding/conduct.ts +0 -325
- package/src/coding/fleetPlan.ts +0 -135
- package/src/coding/fleetTasks.ts +0 -109
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worktreeSetup.d.ts","sourceRoot":"","sources":["../../src/coding/worktreeSetup.ts"],"names":[],"mappings":"AAsBA,mEAAmE;AACnE,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAE1E;AAED,uGAAuG;AACvG,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAUjG;AAED,+EAA+E;AAC/E,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQlI"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { execFile } from 'node:child_process';
|
|
2
|
+
import { promisify } from 'node:util';
|
|
3
|
+
import { copyFileSync, existsSync, mkdirSync, readdirSync, statSync } from 'node:fs';
|
|
4
|
+
import { dirname, join, posix } from 'node:path';
|
|
5
|
+
const exec = promisify(execFile);
|
|
6
|
+
const SETUP_TIMEOUT_MS = 15 * 60 * 1000;
|
|
7
|
+
/** Wildcards are honoured in the file name only: `.env*` and `apps/api/.env.*` work, `**` does not. */
|
|
8
|
+
function matches(repoRoot, pattern) {
|
|
9
|
+
const clean = posix.normalize(pattern);
|
|
10
|
+
if (clean.startsWith('..') || clean.startsWith('/'))
|
|
11
|
+
return [];
|
|
12
|
+
const dir = posix.dirname(clean);
|
|
13
|
+
if (/[*?]/.test(dir))
|
|
14
|
+
return [];
|
|
15
|
+
const name = new RegExp(`^${posix.basename(clean).replace(/[.+^${}()|[\]\\]/g, '\\$&').replace(/\*/g, '.*').replace(/\?/g, '.')}$`);
|
|
16
|
+
const from = join(repoRoot, dir);
|
|
17
|
+
if (!existsSync(from))
|
|
18
|
+
return [];
|
|
19
|
+
return readdirSync(from)
|
|
20
|
+
.filter((entry) => name.test(entry) && statSync(join(from, entry)).isFile())
|
|
21
|
+
.map((entry) => posix.join(dir, entry));
|
|
22
|
+
}
|
|
23
|
+
/** The files the copy list matches in the repository right now. */
|
|
24
|
+
export function matchedFiles(repoRoot, include) {
|
|
25
|
+
return [...new Set(include.flatMap((pattern) => matches(repoRoot, pattern)))];
|
|
26
|
+
}
|
|
27
|
+
/** Copy the repository's listed files into the worktree. A file already there is never overwritten. */
|
|
28
|
+
export function copyIncludedFiles(repoRoot, worktree, include) {
|
|
29
|
+
const copied = [];
|
|
30
|
+
for (const file of matchedFiles(repoRoot, include)) {
|
|
31
|
+
const to = join(worktree, file);
|
|
32
|
+
if (existsSync(to))
|
|
33
|
+
continue;
|
|
34
|
+
mkdirSync(dirname(to), { recursive: true });
|
|
35
|
+
copyFileSync(join(repoRoot, file), to);
|
|
36
|
+
copied.push(file);
|
|
37
|
+
}
|
|
38
|
+
return copied;
|
|
39
|
+
}
|
|
40
|
+
/** Run one of the repository's commands (setup or archive) in the worktree. */
|
|
41
|
+
export async function runSetupScript(repoRoot, worktree, name, setup, port) {
|
|
42
|
+
await exec('/bin/sh', ['-c', setup], {
|
|
43
|
+
cwd: worktree,
|
|
44
|
+
timeout: SETUP_TIMEOUT_MS,
|
|
45
|
+
maxBuffer: 32 * 1024 * 1024,
|
|
46
|
+
env: { ...process.env, LUCIDITY_ROOT_PATH: repoRoot, LUCIDITY_WORKTREE_PATH: worktree, LUCIDITY_WORKTREE_NAME: name,
|
|
47
|
+
...(port ? { LUCIDITY_PORT: String(port) } : {}) },
|
|
48
|
+
});
|
|
49
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import { loadConfig, normalizeProviderPatch, configView, writeConfigPatch, persi
|
|
|
8
8
|
import { LaneQueue } from './queue.js';
|
|
9
9
|
import { AutomationStore } from './automations/store.js';
|
|
10
10
|
import { AutomationService } from './automations/service.js';
|
|
11
|
+
import { SavedWorkflow } from './automations/workflow.js';
|
|
11
12
|
import { createDeckDesigner } from './automations/designer.js';
|
|
12
13
|
import { createAgentAutomation } from './automations/agent.js';
|
|
13
14
|
import { runAutomationsCli } from './automations/cli.js';
|
|
@@ -35,14 +36,16 @@ import { FluidAudioEngine } from './speech/fluidAudio.js';
|
|
|
35
36
|
import { createSessionJournalSource } from './room/journalSource.js';
|
|
36
37
|
import { TurnLogStore } from './turnLog.js';
|
|
37
38
|
import { DaemonLease } from './daemonLease.js';
|
|
39
|
+
import { RecoveryExecutor, recoverProviderRuns } from './providerRecovery.js';
|
|
38
40
|
import { commandContext } from './coding/commandContext.js';
|
|
39
41
|
import { runCodeTurn } from './coding/runCodeTurn.js';
|
|
40
|
-
import { runConductTurn } from './coding/conduct.js';
|
|
41
42
|
import { cloneRepo } from './coding/cloneRepo.js';
|
|
42
43
|
import { listAllowlist } from './coding/discover.js';
|
|
43
44
|
import { resolveRepo } from './coding/repos.js';
|
|
44
45
|
import { watchBranches } from './coding/branchWatch.js';
|
|
46
|
+
import { mergedPrHead } from './coding/listPrs.js';
|
|
45
47
|
import { sweepStaleRequests } from './sweepStale.js';
|
|
48
|
+
import { stampLogs } from './logTimestamps.js';
|
|
46
49
|
import { runSetup } from './setup/server.js';
|
|
47
50
|
import { runClientSetup } from './mcp/clients.js';
|
|
48
51
|
import { runDecisionsCli } from './decisions/cli.js';
|
|
@@ -124,6 +127,7 @@ async function main() {
|
|
|
124
127
|
`(Use --run-now <job> to run a job once.)`);
|
|
125
128
|
process.exit(1);
|
|
126
129
|
}
|
|
130
|
+
stampLogs();
|
|
127
131
|
// The executor default is the Coding pair — the capable model. Every real-time turn
|
|
128
132
|
// (ask/voice) passes the Chat pair explicitly, and coding turns pass the Coding pair
|
|
129
133
|
// explicitly; this default catches only the batch jobs (briefing/weekly/attention),
|
|
@@ -131,9 +135,10 @@ async function main() {
|
|
|
131
135
|
const lease = args.runNow === undefined ? new DaemonLease(CONFIG_DIR) : undefined;
|
|
132
136
|
process.once('exit', () => lease?.close());
|
|
133
137
|
const ownership = new ExecutionOwnership();
|
|
138
|
+
const turnLogs = args.runNow === undefined ? new TurnLogStore() : undefined;
|
|
134
139
|
const providers = {
|
|
135
|
-
claude: new HealthAwareExecutor(new OwnedExecutor(new ClaudeAgentExecutor({ oauthToken: config.oauthToken }), 'claude', ownership)),
|
|
136
|
-
codex: new HealthAwareExecutor(new OwnedExecutor(new CodexExecutor(), 'codex', ownership)),
|
|
140
|
+
claude: new HealthAwareExecutor(new OwnedExecutor(new RecoveryExecutor(new ClaudeAgentExecutor({ oauthToken: config.oauthToken }), 'claude', turnLogs?.runtime), 'claude', ownership)),
|
|
141
|
+
codex: new HealthAwareExecutor(new OwnedExecutor(new RecoveryExecutor(new CodexExecutor(), 'codex', turnLogs?.runtime), 'codex', ownership)),
|
|
137
142
|
};
|
|
138
143
|
const controls = new AgentControls(Object.values(providers));
|
|
139
144
|
const executor = new ProviderRouter(providers, () => ({
|
|
@@ -196,11 +201,13 @@ async function main() {
|
|
|
196
201
|
if (persistNormalizedConfig(config)) {
|
|
197
202
|
console.error('[config] migrated to the two-model schema (chatModel/codeModel).');
|
|
198
203
|
}
|
|
199
|
-
|
|
204
|
+
if (!turnLogs)
|
|
205
|
+
throw new Error('Daemon storage is unavailable.');
|
|
206
|
+
await recoverProviderRuns(turnLogs, providers);
|
|
200
207
|
turnLogs.runtime.set('supervisor', 'current', lease.owner);
|
|
201
208
|
const workspaces = new WorkspaceRegistry(turnLogs.runtime, () => listAllowlist(config));
|
|
202
209
|
turnLogs.prune();
|
|
203
|
-
const automationStore = new AutomationStore(join(CONFIG_DIR, 'automations'));
|
|
210
|
+
const automationStore = new AutomationStore(join(CONFIG_DIR, 'automations'), turnLogs.runtime);
|
|
204
211
|
const designer = createDeckDesigner({
|
|
205
212
|
config,
|
|
206
213
|
directory: CONFIG_DIR,
|
|
@@ -227,6 +234,7 @@ async function main() {
|
|
|
227
234
|
}
|
|
228
235
|
},
|
|
229
236
|
store: automationStore,
|
|
237
|
+
resumable: (job) => job.id === 'builtin:briefing',
|
|
230
238
|
validateRepo: designer.validateRepo,
|
|
231
239
|
saveGuidance: designer.saveGuidance,
|
|
232
240
|
connections: designer.connections,
|
|
@@ -243,7 +251,7 @@ async function main() {
|
|
|
243
251
|
let result;
|
|
244
252
|
await runJob(job.id.replace('builtin:', ''), queue, async () => {
|
|
245
253
|
if (job.id === 'builtin:briefing')
|
|
246
|
-
result = await runBriefing(config, bounded, deliverer, attention);
|
|
254
|
+
result = await runBriefing(config, bounded, deliverer, attention, new SavedWorkflow(automationStore, run.id, signal));
|
|
247
255
|
else if (job.id === 'builtin:weekly-review')
|
|
248
256
|
result = await runWeeklyReview(config, bounded, deliverer);
|
|
249
257
|
else if (job.id === 'builtin:goals')
|
|
@@ -413,28 +421,6 @@ async function main() {
|
|
|
413
421
|
allowInPlace: config.allowInPlace,
|
|
414
422
|
})
|
|
415
423
|
: undefined,
|
|
416
|
-
// The fleet conductor (multi-worktree fan-out). Enabled wherever coding is; each fan-out's
|
|
417
|
-
// workers become Lucidity subtasks via the same API key the daemon already holds, so the
|
|
418
|
-
// task graph is the fleet's org chart. Tasks land in the Inbox for now (projectId null).
|
|
419
|
-
conductHandler: config.repos.length || config.repoRoots.length
|
|
420
|
-
? (req, ctx) => runConductTurn(req, {
|
|
421
|
-
runWorker: ctx.runWorker,
|
|
422
|
-
onWorkerApproval: (requestId, approval) => controls.request(requestId, approval, ctx.signal, ctx.send),
|
|
423
|
-
onEnd: (requestId) => controls.end(requestId),
|
|
424
|
-
repos: listAllowlist(config),
|
|
425
|
-
executor,
|
|
426
|
-
send: ctx.send,
|
|
427
|
-
signal: ctx.signal,
|
|
428
|
-
model: config.codeModel,
|
|
429
|
-
effort: config.codeEffort,
|
|
430
|
-
api: config.apiKey
|
|
431
|
-
? createApiClient({
|
|
432
|
-
apiUrl: config.apiUrl,
|
|
433
|
-
apiKey: config.apiKey,
|
|
434
|
-
})
|
|
435
|
-
: undefined,
|
|
436
|
-
})
|
|
437
|
-
: undefined,
|
|
438
424
|
// Phone-initiated clone (#78) is enabled when a workspace root is configured.
|
|
439
425
|
cloneHandler: config.workspaceRoot
|
|
440
426
|
? (req, ctx) => cloneRepo(req, {
|
|
@@ -487,6 +473,12 @@ async function main() {
|
|
|
487
473
|
void roomClient.pushRepos();
|
|
488
474
|
})
|
|
489
475
|
: null;
|
|
476
|
+
// Archive-on-merge has no event to hang on (the merge happens on GitHub), so look every few
|
|
477
|
+
// minutes. It asks gh only for worktrees in repositories that turned the setting on.
|
|
478
|
+
const mergedSweep = setInterval(() => {
|
|
479
|
+
void workspaces.archiveMerged(mergedPrHead).catch(() => { });
|
|
480
|
+
}, 5 * 60_000);
|
|
481
|
+
mergedSweep.unref();
|
|
490
482
|
const tz = config.timezone ? ` ${config.timezone}` : '';
|
|
491
483
|
const next = automationStore
|
|
492
484
|
.jobs()
|
|
@@ -517,6 +509,7 @@ async function main() {
|
|
|
517
509
|
const stoppedAutomations = automations.stop();
|
|
518
510
|
chatServer.close();
|
|
519
511
|
branchWatcher?.stop();
|
|
512
|
+
clearInterval(mergedSweep);
|
|
520
513
|
roomClient.stop();
|
|
521
514
|
roomController.abort();
|
|
522
515
|
shuttingDown = (async () => {
|
package/dist/jobs/briefing.d.ts
CHANGED
|
@@ -2,29 +2,15 @@ import { type AgentExecutor } from '@lucidity/runtime';
|
|
|
2
2
|
import type { DaemonConfig } from '../config.js';
|
|
3
3
|
import type { Deliverer } from '../delivery/index.js';
|
|
4
4
|
import type { AttentionPublisher } from '../attention.js';
|
|
5
|
+
import type { SavedWorkflow } from '../automations/workflow.js';
|
|
5
6
|
export interface BriefingResult {
|
|
6
7
|
text: string;
|
|
7
8
|
costUsd?: number;
|
|
8
9
|
sessionId?: string;
|
|
9
|
-
/** Delivery channel used. */
|
|
10
10
|
delivered: string;
|
|
11
|
-
/** Present if the briefing succeeded but delivery failed. */
|
|
12
11
|
deliveryError?: string;
|
|
13
|
-
/** Number of new durable facts learned this run. */
|
|
14
12
|
factsLearned: number;
|
|
15
|
-
/** How many attention boards this run produced for the phone (#320). */
|
|
16
13
|
boardsPublished: number;
|
|
17
14
|
}
|
|
18
|
-
|
|
19
|
-
* The daily briefing pipeline:
|
|
20
|
-
* 1. fetch today's tasks + profile
|
|
21
|
-
* 2. read persona (SOUL.md) + durable facts (MEMORY.md) from the vault
|
|
22
|
-
* 3. assemble + run the briefing
|
|
23
|
-
* 4. deliver (notification) — failure is a warning, not a run failure
|
|
24
|
-
* 5. reflect → merge new facts into MEMORY.md (if config.reflect)
|
|
25
|
-
* 6. write a session log
|
|
26
|
-
* Returns metadata for the run log. stdout transcript + run-record timing are
|
|
27
|
-
* handled by the caller.
|
|
28
|
-
*/
|
|
29
|
-
export declare function runBriefing(config: DaemonConfig, executor: AgentExecutor, deliverer: Deliverer, attention?: AttentionPublisher): Promise<BriefingResult>;
|
|
15
|
+
export declare function runBriefing(config: DaemonConfig, executor: AgentExecutor, deliverer: Deliverer, attention?: AttentionPublisher, workflow?: SavedWorkflow): Promise<BriefingResult>;
|
|
30
16
|
//# sourceMappingURL=briefing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"briefing.d.ts","sourceRoot":"","sources":["../../src/jobs/briefing.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"briefing.d.ts","sourceRoot":"","sources":["../../src/jobs/briefing.ts"],"names":[],"mappings":"AAAA,OAAO,EAEoC,KAAK,aAAa,EAC5D,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAKhE,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,wBAAsB,WAAW,CAC/B,MAAM,EAAE,YAAY,EACpB,QAAQ,EAAE,aAAa,EACvB,SAAS,EAAE,SAAS,EACpB,SAAS,CAAC,EAAE,kBAAkB,EAC9B,QAAQ,CAAC,EAAE,aAAa,GACvB,OAAO,CAAC,cAAc,CAAC,CA4EzB"}
|
package/dist/jobs/briefing.js
CHANGED
|
@@ -2,112 +2,84 @@ import { buildBriefingPrompt, splitBriefingOutput, buildMemoryReflectionPrompt,
|
|
|
2
2
|
import { createVault } from '../vault.js';
|
|
3
3
|
import { loadNotesContext } from '../notesContext.js';
|
|
4
4
|
import { loadFlaggedTasks } from '../importantTasks.js';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
api.request('/api/tasks/today'),
|
|
23
|
-
api.request('/api/users/me'),
|
|
24
|
-
loadFlaggedTasks(api),
|
|
25
|
-
]);
|
|
26
|
-
const vault = createVault(config.vaultPath);
|
|
27
|
-
const persona = vault.readPersona();
|
|
28
|
-
const facts = vault.readMemoryFacts();
|
|
29
|
-
const memory = facts.length
|
|
30
|
-
? facts.map((f) => `- ${f}`).join('\n')
|
|
31
|
-
: undefined;
|
|
32
|
-
const notes = loadNotesContext(config);
|
|
33
|
-
// 1. Briefing — and, in the same turn, the phone's attention board (#320). One model call
|
|
34
|
-
// producing both, so the two framings come from one reading of the day and can't disagree.
|
|
35
|
-
const prompt = buildBriefingPrompt({
|
|
36
|
-
user,
|
|
37
|
-
tasks,
|
|
38
|
-
persona,
|
|
39
|
-
memory,
|
|
40
|
-
notes,
|
|
41
|
-
flagged,
|
|
42
|
-
withBoard: attention != null,
|
|
5
|
+
export async function runBriefing(config, executor, deliverer, attention, workflow) {
|
|
6
|
+
const step = (key, policy, action) => workflow ? workflow.step(key, policy, action) : Promise.resolve().then(action);
|
|
7
|
+
const context = await step('Collect context', 'retry', async () => {
|
|
8
|
+
const api = createApiClient({ apiUrl: config.apiUrl, apiKey: config.apiKey });
|
|
9
|
+
const [tasks, user, flagged] = await Promise.all([
|
|
10
|
+
api.request('/api/tasks/today'), api.request('/api/users/me'), loadFlaggedTasks(api),
|
|
11
|
+
]);
|
|
12
|
+
const vault = createVault(config.vaultPath);
|
|
13
|
+
const facts = vault.readMemoryFacts();
|
|
14
|
+
return {
|
|
15
|
+
tasks, user, flagged, persona: vault.readPersona(),
|
|
16
|
+
memory: facts.length ? facts.map((f) => `- ${f}`).join('\n') : undefined,
|
|
17
|
+
notes: loadNotesContext(config), startedAt: new Date().toISOString(),
|
|
18
|
+
model: config.codeModel, effort: config.codeEffort, provider: config.codeProvider,
|
|
19
|
+
reflect: config.reflect, vaultPath: config.vaultPath, delivery: deliverer.name,
|
|
20
|
+
withBoard: attention != null,
|
|
21
|
+
};
|
|
43
22
|
});
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
effort:
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
// A board that failed to parse costs us the board, never the briefing.
|
|
52
|
-
const split = attention
|
|
53
|
-
? splitBriefingOutput(briefing.text, [...tasks, ...flagged])
|
|
54
|
-
: { briefing: briefing.text, boards: [] };
|
|
23
|
+
const { tasks, user, persona, memory, flagged } = context;
|
|
24
|
+
const vault = createVault(context.vaultPath);
|
|
25
|
+
const briefing = await step('Generate briefing', 'retry', () => executor.run({
|
|
26
|
+
...buildBriefingPrompt({ user, tasks, persona, memory, notes: context.notes, flagged, withBoard: context.withBoard }),
|
|
27
|
+
model: context.model, effort: context.effort, provider: context.provider, noTools: true,
|
|
28
|
+
}));
|
|
29
|
+
const split = context.withBoard ? splitBriefingOutput(briefing.text, [...tasks, ...flagged]) : { briefing: briefing.text, boards: [] };
|
|
55
30
|
const text = split.briefing;
|
|
56
31
|
let costUsd = briefing.costUsd;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
32
|
+
// The local artifact has a stable identity and an exact-content receipt. Save before delivery.
|
|
33
|
+
if (workflow)
|
|
34
|
+
await step('Save briefing', 'retry', () => vault.writeSessionLog({
|
|
35
|
+
startedAt: context.startedAt, body: text, deliveredVia: 'See automation run for delivery outcome', factsLearned: [],
|
|
36
|
+
}, { id: workflow.runId, strict: true }));
|
|
37
|
+
// Board publication replaces one dated value. Rehydrate it on resume without regressing a newer board.
|
|
38
|
+
if (attention && split.boards.length && (!attention.latest() || attention.latest().writtenAt <= context.startedAt))
|
|
39
|
+
attention.publish(split.boards, new Date(context.startedAt));
|
|
40
|
+
await step('Publish board', 'retry', () => ({ writtenAt: context.startedAt, boards: split.boards }));
|
|
62
41
|
let deliveryError;
|
|
63
42
|
try {
|
|
64
|
-
await
|
|
43
|
+
await step('Deliver notification', 'effect', async () => {
|
|
44
|
+
if (deliverer.name !== context.delivery)
|
|
45
|
+
throw new Error('The delivery channel changed since this run started.');
|
|
46
|
+
await deliverer.deliver({ title: 'Lucidity', body: text });
|
|
47
|
+
return { delivered: deliverer.name };
|
|
48
|
+
});
|
|
65
49
|
}
|
|
66
|
-
catch (
|
|
67
|
-
|
|
68
|
-
|
|
50
|
+
catch (error) {
|
|
51
|
+
if (workflow)
|
|
52
|
+
throw error;
|
|
53
|
+
deliveryError = error instanceof Error ? error.message : String(error);
|
|
69
54
|
}
|
|
70
|
-
// 3. Reflect → update MEMORY.md (best-effort; never fails the run)
|
|
71
55
|
let learned = [];
|
|
72
|
-
if (
|
|
56
|
+
if (context.reflect) {
|
|
73
57
|
try {
|
|
74
|
-
const
|
|
75
|
-
persona,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
briefing: text,
|
|
79
|
-
memory,
|
|
80
|
-
});
|
|
81
|
-
const reflection = await executor.run({
|
|
82
|
-
systemPrompt: rp.systemPrompt,
|
|
83
|
-
userPrompt: rp.userPrompt,
|
|
84
|
-
model: config.codeModel,
|
|
85
|
-
effort: config.codeEffort,
|
|
86
|
-
});
|
|
58
|
+
const reflection = await step('Reflect', 'retry', () => executor.run({
|
|
59
|
+
...buildMemoryReflectionPrompt({ persona, user, tasks, briefing: text, memory }),
|
|
60
|
+
model: context.model, effort: context.effort, provider: context.provider, noTools: true,
|
|
61
|
+
}));
|
|
87
62
|
if (reflection.costUsd != null)
|
|
88
63
|
costUsd = (costUsd ?? 0) + reflection.costUsd;
|
|
89
64
|
learned = parseFacts(reflection.text);
|
|
90
|
-
|
|
91
|
-
|
|
65
|
+
await step('Update memory', 'effect', () => {
|
|
66
|
+
// Read and merge synchronously at commit time, never reuse the initial facts snapshot.
|
|
67
|
+
if (learned.length)
|
|
68
|
+
vault.writeMemoryFacts(mergeFacts(vault.readMemoryFacts(!!workflow), learned), !!workflow);
|
|
69
|
+
return { factsLearned: learned.length };
|
|
70
|
+
});
|
|
92
71
|
}
|
|
93
|
-
catch (
|
|
94
|
-
|
|
72
|
+
catch (error) {
|
|
73
|
+
if (workflow)
|
|
74
|
+
throw error;
|
|
75
|
+
console.error(`[briefing] reflection failed: ${String(error)}`);
|
|
95
76
|
}
|
|
96
77
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
return {
|
|
105
|
-
text,
|
|
106
|
-
costUsd,
|
|
107
|
-
sessionId: briefing.sessionId,
|
|
108
|
-
delivered: deliverer.name,
|
|
109
|
-
deliveryError,
|
|
110
|
-
factsLearned: learned.length,
|
|
111
|
-
boardsPublished: attention ? split.boards.length : 0,
|
|
112
|
-
};
|
|
78
|
+
if (!workflow)
|
|
79
|
+
vault.writeSessionLog({
|
|
80
|
+
startedAt: context.startedAt, body: text,
|
|
81
|
+
deliveredVia: deliveryError ? `${deliverer.name} (failed)` : deliverer.name,
|
|
82
|
+
factsLearned: learned,
|
|
83
|
+
});
|
|
84
|
+
return { text, costUsd, sessionId: briefing.sessionId, delivered: context.delivery, deliveryError, factsLearned: learned.length, boardsPublished: split.boards.length };
|
|
113
85
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type Level = 'log' | 'warn' | 'error';
|
|
2
|
+
/**
|
|
3
|
+
* Put the time on every line the daemon logs. launchd appends stdout and stderr to
|
|
4
|
+
* `daemon.out.log` and `daemon.err.log` with nothing added, so a relay 502 could not be placed
|
|
5
|
+
* against the turn it interrupted (#505). Only the daemon run mode calls this: the CLI commands
|
|
6
|
+
* print for a person and stay unstamped.
|
|
7
|
+
*/
|
|
8
|
+
export declare function stampLogs(target?: Pick<Console, Level>, now?: () => Date): void;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=logTimestamps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logTimestamps.d.ts","sourceRoot":"","sources":["../src/logTimestamps.ts"],"names":[],"mappings":"AAAA,KAAK,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;AAEtC;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,MAAM,GAAE,IAAI,CAAC,OAAO,EAAE,KAAK,CAAW,EAAE,GAAG,GAAE,MAAM,IAAuB,GAAG,IAAI,CAK1G"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Put the time on every line the daemon logs. launchd appends stdout and stderr to
|
|
3
|
+
* `daemon.out.log` and `daemon.err.log` with nothing added, so a relay 502 could not be placed
|
|
4
|
+
* against the turn it interrupted (#505). Only the daemon run mode calls this: the CLI commands
|
|
5
|
+
* print for a person and stay unstamped.
|
|
6
|
+
*/
|
|
7
|
+
export function stampLogs(target = console, now = () => new Date()) {
|
|
8
|
+
for (const level of ['log', 'warn', 'error']) {
|
|
9
|
+
const write = target[level].bind(target);
|
|
10
|
+
target[level] = (...args) => write(now().toISOString(), ...args);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type AgentExecutor, type AgentProvider, type ExecutorRunInput, type ExecutorResult, type ExecutorStreamEvent, type ProviderRunRef, type ProviderInspection } from '@lucidity/runtime';
|
|
2
|
+
import type { RuntimeStore } from './runtimeStore.js';
|
|
3
|
+
import type { TurnLogStore } from './turnLog.js';
|
|
4
|
+
export interface SavedProviderRun extends ProviderRunRef {
|
|
5
|
+
version: 1;
|
|
6
|
+
requestId: string;
|
|
7
|
+
provider: AgentProvider;
|
|
8
|
+
ownerPid: number;
|
|
9
|
+
cwd?: string;
|
|
10
|
+
model?: string;
|
|
11
|
+
effort?: string;
|
|
12
|
+
result?: ExecutorResult;
|
|
13
|
+
}
|
|
14
|
+
/** Persist provider evidence before callers transform or publish their result. */
|
|
15
|
+
export declare class RecoveryExecutor implements AgentExecutor {
|
|
16
|
+
private readonly executor;
|
|
17
|
+
private readonly provider;
|
|
18
|
+
private readonly store?;
|
|
19
|
+
constructor(executor: AgentExecutor, provider: AgentProvider, store?: RuntimeStore | undefined);
|
|
20
|
+
get name(): string;
|
|
21
|
+
get strictResume(): boolean | undefined;
|
|
22
|
+
get recoveryCapability(): "native-turn" | "completion-receipt" | undefined;
|
|
23
|
+
inspect(ref: ProviderRunRef, options?: {
|
|
24
|
+
cwd?: string;
|
|
25
|
+
timeoutMs?: number;
|
|
26
|
+
}): Promise<ProviderInspection>;
|
|
27
|
+
models(): Promise<{
|
|
28
|
+
id: string;
|
|
29
|
+
label: string;
|
|
30
|
+
efforts: string[];
|
|
31
|
+
resolvedId?: string | undefined;
|
|
32
|
+
description?: string | undefined;
|
|
33
|
+
isDefault?: boolean | undefined;
|
|
34
|
+
defaultEffort?: string | undefined;
|
|
35
|
+
upgrade?: string | undefined;
|
|
36
|
+
}[]>;
|
|
37
|
+
commands(input?: Pick<ExecutorRunInput, 'cwd' | 'permissionMode' | 'mcp'>): Promise<import("@lucidity/shared").AgentCommandOption[]>;
|
|
38
|
+
steer(id: string, text: string): Promise<void>;
|
|
39
|
+
interrupt(id: string): Promise<boolean>;
|
|
40
|
+
dispose(): Promise<void>;
|
|
41
|
+
run(input: ExecutorRunInput): Promise<ExecutorResult>;
|
|
42
|
+
runStream(input: ExecutorRunInput): AsyncIterable<ExecutorStreamEvent>;
|
|
43
|
+
}
|
|
44
|
+
declare function processAlive(pid?: number): boolean;
|
|
45
|
+
/** Called under DaemonLease, before constructing queues or starting any new work. */
|
|
46
|
+
export declare function recoverProviderRuns(logs: TurnLogStore, providers: Record<AgentProvider, AgentExecutor>, alive?: typeof processAlive): Promise<void>;
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=providerRecovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providerRecovery.d.ts","sourceRoot":"","sources":["../src/providerRecovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACxB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,WAAW,gBAAiB,SAAQ,cAAc;IACtD,OAAO,EAAE,CAAC,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,aAAa,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB;AAED,kFAAkF;AAClF,qBAAa,gBAAiB,YAAW,aAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAAiB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAAiB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC;gBAA1F,QAAQ,EAAE,aAAa,EAAmB,QAAQ,EAAE,aAAa,EAAmB,KAAK,CAAC,EAAE,YAAY,YAAA;IACrI,IAAI,IAAI,WAAiC;IACzC,IAAI,YAAY,wBAAyC;IACzD,IAAI,kBAAkB,qDAA+C;IACrE,OAAO,CAAC,GAAG,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAGzG,MAAM;;;;;;;;;;IACN,QAAQ,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,KAAK,GAAG,gBAAgB,GAAG,KAAK,CAAC;IACzE,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAC9B,SAAS,CAAC,EAAE,EAAE,MAAM;IACd,OAAO;IACP,GAAG,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC;IAIpD,SAAS,CAAC,KAAK,EAAE,gBAAgB,GAAG,aAAa,CAAC,mBAAmB,CAAC;CAoB9E;AAED,iBAAS,YAAY,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAI3C;AAED,qFAAqF;AACrF,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,CAAC,aAAa,EAAE,aAAa,CAAC,EAAE,KAAK,sBAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CA2BlJ"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { encodeSession, } from '@lucidity/runtime';
|
|
2
|
+
/** Persist provider evidence before callers transform or publish their result. */
|
|
3
|
+
export class RecoveryExecutor {
|
|
4
|
+
executor;
|
|
5
|
+
provider;
|
|
6
|
+
store;
|
|
7
|
+
constructor(executor, provider, store) {
|
|
8
|
+
this.executor = executor;
|
|
9
|
+
this.provider = provider;
|
|
10
|
+
this.store = store;
|
|
11
|
+
}
|
|
12
|
+
get name() { return this.executor.name; }
|
|
13
|
+
get strictResume() { return this.executor.strictResume; }
|
|
14
|
+
get recoveryCapability() { return this.executor.recoveryCapability; }
|
|
15
|
+
inspect(ref, options) {
|
|
16
|
+
return this.executor.inspect?.(ref, options) ?? Promise.resolve({ status: 'unsupported', reason: 'Provider history inspection is unavailable.' });
|
|
17
|
+
}
|
|
18
|
+
models() { return this.executor.models?.() ?? Promise.resolve([]); }
|
|
19
|
+
commands(input) { return this.executor.commands?.(input) ?? Promise.resolve([]); }
|
|
20
|
+
steer(id, text) { return this.executor.steer?.(id, text) ?? Promise.reject(new Error('Steering is unavailable.')); }
|
|
21
|
+
interrupt(id) { return this.executor.interrupt?.(id) ?? Promise.resolve(false); }
|
|
22
|
+
async dispose() { await this.executor.dispose?.(); }
|
|
23
|
+
async run(input) {
|
|
24
|
+
// Non-streaming consumers may validate or transform structured results.
|
|
25
|
+
return this.executor.run(input);
|
|
26
|
+
}
|
|
27
|
+
async *runStream(input) {
|
|
28
|
+
if (!this.executor.runStream)
|
|
29
|
+
throw new Error('Streaming is unavailable.');
|
|
30
|
+
const request = input.requestId && this.store?.command(input.requestId);
|
|
31
|
+
const recordable = request && (request.kind === 'code' || (request.kind === 'ask' && !request.dayPlan && !request.projectPlan));
|
|
32
|
+
if (!recordable) {
|
|
33
|
+
yield* this.executor.runStream(input);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
let saved = {
|
|
37
|
+
version: 1, requestId: input.requestId, provider: this.provider, ownerPid: process.pid,
|
|
38
|
+
cwd: input.cwd, sessionId: input.resume ?? input.sessionId, model: input.model, effort: input.effort,
|
|
39
|
+
};
|
|
40
|
+
const persist = (patch) => {
|
|
41
|
+
saved = { ...saved, ...patch };
|
|
42
|
+
this.store.set('provider-runs', saved.requestId, saved);
|
|
43
|
+
};
|
|
44
|
+
persist({});
|
|
45
|
+
for await (const event of this.executor.runStream({ ...input, onRecovery: (ref) => { persist(ref); input.onRecovery?.(ref); } })) {
|
|
46
|
+
if (event.type === 'session')
|
|
47
|
+
persist({ sessionId: event.sessionId });
|
|
48
|
+
if (event.type === 'done')
|
|
49
|
+
persist({ result: event, sessionId: event.sessionId ?? saved.sessionId });
|
|
50
|
+
yield event;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function processAlive(pid) {
|
|
55
|
+
if (!pid)
|
|
56
|
+
return false;
|
|
57
|
+
try {
|
|
58
|
+
process.kill(pid, 0);
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
return error.code !== 'ESRCH';
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/** Called under DaemonLease, before constructing queues or starting any new work. */
|
|
66
|
+
export async function recoverProviderRuns(logs, providers, alive = processAlive) {
|
|
67
|
+
for (const saved of logs.runtime.list('provider-runs')) {
|
|
68
|
+
const state = logs.read(saved.requestId);
|
|
69
|
+
const terminal = state.frames.at(-1);
|
|
70
|
+
if (state.terminated && terminal?.code !== 'interrupted_unknown')
|
|
71
|
+
continue;
|
|
72
|
+
if (saved.version !== 1)
|
|
73
|
+
continue;
|
|
74
|
+
// A surviving native child can still own a workspace even after its daemon died.
|
|
75
|
+
if (alive(saved.ownerPid) || alive(saved.pid))
|
|
76
|
+
throw new Error(`Cannot recover ${saved.requestId}: its prior provider owner is still running. Wait for it to exit before restarting Lucidity.`);
|
|
77
|
+
let evidence;
|
|
78
|
+
if (saved.result)
|
|
79
|
+
evidence = { status: 'completed', result: saved.result };
|
|
80
|
+
else {
|
|
81
|
+
try {
|
|
82
|
+
evidence = await providers[saved.provider].inspect?.(saved, { cwd: saved.cwd, timeoutMs: 10_000 }) ??
|
|
83
|
+
{ status: 'unsupported', reason: 'Provider history inspection is unavailable.' };
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
evidence = { status: 'unknown', reason: 'Provider history inspection failed.' };
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
const sessionId = saved.sessionId ? encodeSession({ provider: saved.provider, id: saved.sessionId, model: saved.model, effort: saved.effort }) : undefined;
|
|
90
|
+
const reconciliation = { requestId: saved.requestId, checkedAt: new Date().toISOString(), ...evidence,
|
|
91
|
+
...(evidence.status === 'completed' ? { result: { ...evidence.result, sessionId } } : {}) };
|
|
92
|
+
// Already-terminal unknown runs retain their original event stream. Review reads this linked record.
|
|
93
|
+
logs.runtime.set('reconciliation', saved.requestId, reconciliation);
|
|
94
|
+
if (!state.terminated && evidence.status === 'completed') {
|
|
95
|
+
if (sessionId)
|
|
96
|
+
logs.append(saved.requestId, { type: 'session', requestId: saved.requestId, sessionId });
|
|
97
|
+
logs.append(saved.requestId, { type: 'done', requestId: saved.requestId, ...evidence.result, sessionId, recovered: true });
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
package/dist/room/client.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { DurableTurnQueue } from './turnQueue.js';
|
|
|
2
2
|
import type { AgentControls } from '../agentControls.js';
|
|
3
3
|
import type { AgentProvider, ExecutorModel } from '@lucidity/runtime';
|
|
4
4
|
import { type AgentCommandOption, type AgentCommandContext, type ComputerRuntime, type ProviderHealth } from '@lucidity/shared';
|
|
5
|
-
import type { WorkspaceMode, PrInfo, HarnessImage,
|
|
5
|
+
import type { WorkspaceMode, PrInfo, HarnessImage, DaemonConfigView, DaemonConfigPatch } from '@lucidity/shared';
|
|
6
6
|
import type { LucidHarness } from '@lucidity/runtime';
|
|
7
7
|
import type { DaemonConfig } from '../config.js';
|
|
8
8
|
import type { AutomationService } from '../automations/service.js';
|
|
@@ -28,6 +28,7 @@ import type { WorkspaceRegistry } from '../coding/workspaceRegistry.js';
|
|
|
28
28
|
* we use the `ws` package — Node's global WebSocket can't set request headers).
|
|
29
29
|
*/
|
|
30
30
|
export type CodeHandler = (req: {
|
|
31
|
+
recoveryOf?: string;
|
|
31
32
|
id: string;
|
|
32
33
|
repoId: string;
|
|
33
34
|
prompt: string;
|
|
@@ -49,21 +50,6 @@ export type CloneHandler = (req: {
|
|
|
49
50
|
send: (obj: unknown) => void;
|
|
50
51
|
signal?: AbortSignal;
|
|
51
52
|
}) => Promise<void>;
|
|
52
|
-
export type ConductHandler = (req: {
|
|
53
|
-
id: string;
|
|
54
|
-
repoId: string;
|
|
55
|
-
phase: 'plan' | 'run' | 'setup' | 'integrate';
|
|
56
|
-
prompt: string;
|
|
57
|
-
images?: HarnessImage[];
|
|
58
|
-
plan?: FleetPlan;
|
|
59
|
-
resume?: string;
|
|
60
|
-
/** A quick incremental spawn: skip the dogfood task graph (no parent task, no subtask). */
|
|
61
|
-
ephemeral?: boolean;
|
|
62
|
-
}, ctx: {
|
|
63
|
-
send: (obj: unknown) => void;
|
|
64
|
-
signal?: AbortSignal;
|
|
65
|
-
runWorker: NonNullable<import('../coding/conduct.js').RunConductTurnDeps['runWorker']>;
|
|
66
|
-
}) => Promise<void>;
|
|
67
53
|
/** One row of the phone's repo picker: which repo, what branch it sits on right now,
|
|
68
54
|
* and whether this daemon will let a turn run in that checkout (#121). */
|
|
69
55
|
export interface RepoInfo {
|
|
@@ -100,8 +86,6 @@ export interface DispatchDeps {
|
|
|
100
86
|
signal?: AbortSignal;
|
|
101
87
|
/** Handle a `code` turn (M7). Absent → coding stays disabled. */
|
|
102
88
|
codeHandler?: CodeHandler;
|
|
103
|
-
/** Handle a `conduct` turn (the fleet conductor). Absent → the conductor stays disabled. */
|
|
104
|
-
conductHandler?: ConductHandler;
|
|
105
89
|
/** Handle a `clone` turn (#78). Absent → phone cloning stays disabled. */
|
|
106
90
|
cloneHandler?: CloneHandler;
|
|
107
91
|
/** The phone's repo picker (`repos` request). A callback, not a value: resolving each
|
|
@@ -174,8 +158,6 @@ export interface RoomClientOptions {
|
|
|
174
158
|
logger?: (msg: string) => void;
|
|
175
159
|
/** Handle `code` turns (M7). Absent → coding disabled. */
|
|
176
160
|
codeHandler?: CodeHandler;
|
|
177
|
-
/** Handle `conduct` turns (the fleet conductor). Absent → the conductor disabled. */
|
|
178
|
-
conductHandler?: ConductHandler;
|
|
179
161
|
/** Serialises room turns per lane — see `DispatchDeps.queue`. Share the daemon's one instance
|
|
180
162
|
* so room turns also serialise against scheduled briefings and the local chat server. */
|
|
181
163
|
queue?: LaneQueue;
|