@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
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { listNotes, readNote, editNote, writeNote } from '@lucidity/notes';
|
|
3
|
+
import { goalNoteId, withGoalNoteId, } from '@lucidity/shared';
|
|
4
|
+
/** Paths and note text never leave this computer for the hosted Goals API. */
|
|
5
|
+
export function createGoalNotes(root) {
|
|
6
|
+
if (!root)
|
|
7
|
+
return undefined;
|
|
8
|
+
function scan() {
|
|
9
|
+
const summaries = listNotes(root, { limit: 2001 });
|
|
10
|
+
const notes = [];
|
|
11
|
+
let complete = summaries.length <= 2000;
|
|
12
|
+
for (const summary of summaries.slice(0, 2000)) {
|
|
13
|
+
try {
|
|
14
|
+
const note = readNote(root, summary.path);
|
|
15
|
+
notes.push({
|
|
16
|
+
kind: 'note',
|
|
17
|
+
id: goalNoteId(note.content) ?? randomUUID(),
|
|
18
|
+
path: note.path,
|
|
19
|
+
content: note.content,
|
|
20
|
+
title: note.title,
|
|
21
|
+
description: note.body.slice(0, 2000),
|
|
22
|
+
updatedAt: note.mtime,
|
|
23
|
+
status: null,
|
|
24
|
+
projectId: null,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
complete = false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const counts = new Map();
|
|
32
|
+
notes.forEach((note) => counts.set(note.id, (counts.get(note.id) ?? 0) + 1));
|
|
33
|
+
if ([...counts.values()].some((count) => count > 1))
|
|
34
|
+
complete = false;
|
|
35
|
+
return {
|
|
36
|
+
notes: notes.filter((note) => counts.get(note.id) === 1),
|
|
37
|
+
complete,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
list: scan,
|
|
42
|
+
link(note) {
|
|
43
|
+
const current = readNote(root, note.path);
|
|
44
|
+
if (current.content !== note.content)
|
|
45
|
+
throw new Error('The note changed during linking. Try again.');
|
|
46
|
+
const next = withGoalNoteId(current.content, note.id);
|
|
47
|
+
if (next !== current.content) {
|
|
48
|
+
if (!current.content)
|
|
49
|
+
throw new Error('Write something in this note before linking it.');
|
|
50
|
+
editNote(root, note.path, current.content, next);
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
read(id) {
|
|
54
|
+
const note = scan().notes.find((item) => goalNoteId(item.content) === id);
|
|
55
|
+
if (!note)
|
|
56
|
+
throw new Error('The linked note is not available in this vault.');
|
|
57
|
+
return note;
|
|
58
|
+
},
|
|
59
|
+
saveDraft(id, markdown) {
|
|
60
|
+
const content = withGoalNoteId(markdown, id);
|
|
61
|
+
const path = `Goals/Draft-${id}.md`;
|
|
62
|
+
try {
|
|
63
|
+
writeNote(root, path, content, 'create');
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
// Idempotent retry of our own exact output; never overwrite a user's edits.
|
|
67
|
+
if (readNote(root, path).content !== content)
|
|
68
|
+
throw error;
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { HealthAwareExecutor } from '@lucidity/runtime';
|
|
2
|
+
import { HealthAwareExecutor, ExecutionOwnership, OwnedExecutor } from '@lucidity/runtime';
|
|
3
3
|
import { AgentControls } from './agentControls.js';
|
|
4
|
+
import { WorkspaceRegistry } from './coding/workspaceRegistry.js';
|
|
4
5
|
import { join } from 'node:path';
|
|
5
6
|
import { ClaudeAgentExecutor, CodexExecutor, ProviderRouter, CLAUDE_AGENT_SDK_VERSION, CODEX_RUNTIME_VERSION, createLucidHarness, createApiClient, } from '@lucidity/runtime';
|
|
6
7
|
import { loadConfig, normalizeProviderPatch, configView, writeConfigPatch, persistNormalizedConfig, patchNeedsRestart, applyPatchInMemory, chatAgentFromConfig, CONFIG_PATH, CONFIG_DIR, } from './config.js';
|
|
7
8
|
import { LaneQueue } from './queue.js';
|
|
8
9
|
import { AutomationStore } from './automations/store.js';
|
|
9
10
|
import { AutomationService } from './automations/service.js';
|
|
11
|
+
import { SavedWorkflow } from './automations/workflow.js';
|
|
10
12
|
import { createDeckDesigner } from './automations/designer.js';
|
|
11
13
|
import { createAgentAutomation } from './automations/agent.js';
|
|
12
14
|
import { runAutomationsCli } from './automations/cli.js';
|
|
@@ -14,6 +16,8 @@ import { importJobHistory } from './automations/history.js';
|
|
|
14
16
|
import { setupDesign } from './automations/setup.js';
|
|
15
17
|
import { runJob } from './jobs/runner.js';
|
|
16
18
|
import { runBriefing } from './jobs/briefing.js';
|
|
19
|
+
import { runGoalTracking } from './jobs/goals.js';
|
|
20
|
+
import { createGoalNotes } from './goals/notes.js';
|
|
17
21
|
import { runWeeklyReview } from './jobs/weeklyReview.js';
|
|
18
22
|
import { runExtraction } from './jobs/extraction.js';
|
|
19
23
|
import { fileState, runVoiceReview } from './jobs/voiceReview.js';
|
|
@@ -31,14 +35,17 @@ import { SpeechService } from './speech/service.js';
|
|
|
31
35
|
import { FluidAudioEngine } from './speech/fluidAudio.js';
|
|
32
36
|
import { createSessionJournalSource } from './room/journalSource.js';
|
|
33
37
|
import { TurnLogStore } from './turnLog.js';
|
|
38
|
+
import { DaemonLease } from './daemonLease.js';
|
|
39
|
+
import { RecoveryExecutor, recoverProviderRuns } from './providerRecovery.js';
|
|
34
40
|
import { commandContext } from './coding/commandContext.js';
|
|
35
41
|
import { runCodeTurn } from './coding/runCodeTurn.js';
|
|
36
|
-
import { runConductTurn } from './coding/conduct.js';
|
|
37
42
|
import { cloneRepo } from './coding/cloneRepo.js';
|
|
38
43
|
import { listAllowlist } from './coding/discover.js';
|
|
39
44
|
import { resolveRepo } from './coding/repos.js';
|
|
40
45
|
import { watchBranches } from './coding/branchWatch.js';
|
|
46
|
+
import { mergedPrHead } from './coding/listPrs.js';
|
|
41
47
|
import { sweepStaleRequests } from './sweepStale.js';
|
|
48
|
+
import { stampLogs } from './logTimestamps.js';
|
|
42
49
|
import { runSetup } from './setup/server.js';
|
|
43
50
|
import { runClientSetup } from './mcp/clients.js';
|
|
44
51
|
import { runDecisionsCli } from './decisions/cli.js';
|
|
@@ -120,13 +127,18 @@ async function main() {
|
|
|
120
127
|
`(Use --run-now <job> to run a job once.)`);
|
|
121
128
|
process.exit(1);
|
|
122
129
|
}
|
|
130
|
+
stampLogs();
|
|
123
131
|
// The executor default is the Coding pair — the capable model. Every real-time turn
|
|
124
132
|
// (ask/voice) passes the Chat pair explicitly, and coding turns pass the Coding pair
|
|
125
133
|
// explicitly; this default catches only the batch jobs (briefing/weekly/attention),
|
|
126
134
|
// which want depth, not speed. So nothing ever silently falls back to the fast model.
|
|
135
|
+
const lease = args.runNow === undefined ? new DaemonLease(CONFIG_DIR) : undefined;
|
|
136
|
+
process.once('exit', () => lease?.close());
|
|
137
|
+
const ownership = new ExecutionOwnership();
|
|
138
|
+
const turnLogs = args.runNow === undefined ? new TurnLogStore() : undefined;
|
|
127
139
|
const providers = {
|
|
128
|
-
claude: new HealthAwareExecutor(new ClaudeAgentExecutor({ oauthToken: config.oauthToken })),
|
|
129
|
-
codex: new HealthAwareExecutor(new CodexExecutor()),
|
|
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)),
|
|
130
142
|
};
|
|
131
143
|
const controls = new AgentControls(Object.values(providers));
|
|
132
144
|
const executor = new ProviderRouter(providers, () => ({
|
|
@@ -189,9 +201,13 @@ async function main() {
|
|
|
189
201
|
if (persistNormalizedConfig(config)) {
|
|
190
202
|
console.error('[config] migrated to the two-model schema (chatModel/codeModel).');
|
|
191
203
|
}
|
|
192
|
-
|
|
204
|
+
if (!turnLogs)
|
|
205
|
+
throw new Error('Daemon storage is unavailable.');
|
|
206
|
+
await recoverProviderRuns(turnLogs, providers);
|
|
207
|
+
turnLogs.runtime.set('supervisor', 'current', lease.owner);
|
|
208
|
+
const workspaces = new WorkspaceRegistry(turnLogs.runtime, () => listAllowlist(config));
|
|
193
209
|
turnLogs.prune();
|
|
194
|
-
const automationStore = new AutomationStore(join(CONFIG_DIR, 'automations'));
|
|
210
|
+
const automationStore = new AutomationStore(join(CONFIG_DIR, 'automations'), turnLogs.runtime);
|
|
195
211
|
const designer = createDeckDesigner({
|
|
196
212
|
config,
|
|
197
213
|
directory: CONFIG_DIR,
|
|
@@ -218,6 +234,7 @@ async function main() {
|
|
|
218
234
|
}
|
|
219
235
|
},
|
|
220
236
|
store: automationStore,
|
|
237
|
+
resumable: (job) => job.id === 'builtin:briefing',
|
|
221
238
|
validateRepo: designer.validateRepo,
|
|
222
239
|
saveGuidance: designer.saveGuidance,
|
|
223
240
|
connections: designer.connections,
|
|
@@ -234,9 +251,17 @@ async function main() {
|
|
|
234
251
|
let result;
|
|
235
252
|
await runJob(job.id.replace('builtin:', ''), queue, async () => {
|
|
236
253
|
if (job.id === 'builtin:briefing')
|
|
237
|
-
result = await runBriefing(config, bounded, deliverer, attention);
|
|
254
|
+
result = await runBriefing(config, bounded, deliverer, attention, new SavedWorkflow(automationStore, run.id, signal));
|
|
238
255
|
else if (job.id === 'builtin:weekly-review')
|
|
239
256
|
result = await runWeeklyReview(config, bounded, deliverer);
|
|
257
|
+
else if (job.id === 'builtin:goals')
|
|
258
|
+
// Goals composes this run's signal with each draft's cancellation signal.
|
|
259
|
+
result = await runGoalTracking({
|
|
260
|
+
api: createApiClient({ apiUrl: config.apiUrl, apiKey: config.apiKey }),
|
|
261
|
+
executor,
|
|
262
|
+
notes: createGoalNotes(config.notesPath),
|
|
263
|
+
signal,
|
|
264
|
+
});
|
|
240
265
|
else if (job.id === 'builtin:extraction')
|
|
241
266
|
result = await runExtraction(config, bounded);
|
|
242
267
|
else if (job.id === 'builtin:voice-review')
|
|
@@ -287,6 +312,9 @@ async function main() {
|
|
|
287
312
|
frequency: 'weekly',
|
|
288
313
|
dayOfWeek: config.weeklyReviewDay,
|
|
289
314
|
}, config.weeklyReview);
|
|
315
|
+
automations.registerBuiltin('builtin:goals', 'Goals', {
|
|
316
|
+
...daily('00:00'), frequency: 'interval', everyHours: 1,
|
|
317
|
+
});
|
|
290
318
|
automations.registerBuiltin('builtin:extraction', 'Journal extraction', {
|
|
291
319
|
...daily('00:00'),
|
|
292
320
|
frequency: 'interval',
|
|
@@ -310,7 +338,9 @@ async function main() {
|
|
|
310
338
|
importJobHistory(automationStore, join(CONFIG_DIR, 'runs'));
|
|
311
339
|
automations.start();
|
|
312
340
|
// Interactive chat server (lite local gateway): loopback + token auth.
|
|
341
|
+
const roomController = new AbortController();
|
|
313
342
|
const chatServer = createChatServer({
|
|
343
|
+
signal: roomController.signal,
|
|
314
344
|
config,
|
|
315
345
|
executor: chatExecutor,
|
|
316
346
|
token: ensureChatToken(),
|
|
@@ -323,7 +353,6 @@ async function main() {
|
|
|
323
353
|
// Room client (free path): dial the hosted relay so the phone can reach Lucid,
|
|
324
354
|
// serving ask/briefing/journal through the shared harness. Best-effort — it
|
|
325
355
|
// reconnects on its own and never takes the daemon down.
|
|
326
|
-
const roomController = new AbortController();
|
|
327
356
|
const vault = createVault(config.vaultPath);
|
|
328
357
|
const harness = createLucidHarness({
|
|
329
358
|
executor,
|
|
@@ -351,10 +380,14 @@ async function main() {
|
|
|
351
380
|
harness,
|
|
352
381
|
controls,
|
|
353
382
|
models: (provider) => providers[provider].models(),
|
|
354
|
-
commands: (provider, context) =>
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
383
|
+
commands: async (provider, context) => {
|
|
384
|
+
const commands = await providers[provider].commands({
|
|
385
|
+
...commandContext(context, config), mcp: context ? codingMcp : mcp,
|
|
386
|
+
});
|
|
387
|
+
return context ? [...commands.filter((command) => command.name !== 'review'), {
|
|
388
|
+
name: 'review', description: 'Read-only review without a workspace checkpoint', argumentHint: '[instructions]', acceptsArguments: true, startsConversation: true,
|
|
389
|
+
}] : commands;
|
|
390
|
+
},
|
|
358
391
|
providerHealth: () => ({
|
|
359
392
|
claude: providers.claude.health(),
|
|
360
393
|
codex: providers.codex.health(),
|
|
@@ -366,6 +399,7 @@ async function main() {
|
|
|
366
399
|
vault,
|
|
367
400
|
signal: roomController.signal,
|
|
368
401
|
turnLogs,
|
|
402
|
+
workspaces,
|
|
369
403
|
attention,
|
|
370
404
|
// The same lane queue the scheduler and local chat use, so a phone turn can't run a second
|
|
371
405
|
// `claude` on a session that a briefing (or another device) already has open.
|
|
@@ -374,7 +408,8 @@ async function main() {
|
|
|
374
408
|
// trusted roots. Each turn resolves against the LIVE allowlist so a repo
|
|
375
409
|
// cloned into a root is codeable without a restart.
|
|
376
410
|
codeHandler: config.repos.length || config.repoRoots.length
|
|
377
|
-
? (req, ctx) => runCodeTurn(req, {
|
|
411
|
+
? (req, ctx) => runCodeTurn({ ...req, resume: workspaces.resume(req) }, {
|
|
412
|
+
prepareWorkspace: (request) => workspaces.prepare(request),
|
|
378
413
|
repos: listAllowlist(config),
|
|
379
414
|
executor,
|
|
380
415
|
mcp: codingMcp,
|
|
@@ -386,27 +421,6 @@ async function main() {
|
|
|
386
421
|
allowInPlace: config.allowInPlace,
|
|
387
422
|
})
|
|
388
423
|
: undefined,
|
|
389
|
-
// The fleet conductor (multi-worktree fan-out). Enabled wherever coding is; each fan-out's
|
|
390
|
-
// workers become Lucidity subtasks via the same API key the daemon already holds, so the
|
|
391
|
-
// task graph is the fleet's org chart. Tasks land in the Inbox for now (projectId null).
|
|
392
|
-
conductHandler: config.repos.length || config.repoRoots.length
|
|
393
|
-
? (req, ctx) => runConductTurn(req, {
|
|
394
|
-
onWorkerApproval: (requestId, approval) => controls.request(requestId, approval, ctx.signal, ctx.send),
|
|
395
|
-
onEnd: (requestId) => controls.end(requestId),
|
|
396
|
-
repos: listAllowlist(config),
|
|
397
|
-
executor,
|
|
398
|
-
send: ctx.send,
|
|
399
|
-
signal: ctx.signal,
|
|
400
|
-
model: config.codeModel,
|
|
401
|
-
effort: config.codeEffort,
|
|
402
|
-
api: config.apiKey
|
|
403
|
-
? createApiClient({
|
|
404
|
-
apiUrl: config.apiUrl,
|
|
405
|
-
apiKey: config.apiKey,
|
|
406
|
-
})
|
|
407
|
-
: undefined,
|
|
408
|
-
})
|
|
409
|
-
: undefined,
|
|
410
424
|
// Phone-initiated clone (#78) is enabled when a workspace root is configured.
|
|
411
425
|
cloneHandler: config.workspaceRoot
|
|
412
426
|
? (req, ctx) => cloneRepo(req, {
|
|
@@ -439,8 +453,7 @@ async function main() {
|
|
|
439
453
|
requestRestart: () => {
|
|
440
454
|
console.error('[daemon] restarting to apply a config change.');
|
|
441
455
|
setTimeout(() => {
|
|
442
|
-
|
|
443
|
-
process.exit(0);
|
|
456
|
+
void shutdown();
|
|
444
457
|
}, RESTART_ACK_FLUSH_MS);
|
|
445
458
|
},
|
|
446
459
|
});
|
|
@@ -460,6 +473,12 @@ async function main() {
|
|
|
460
473
|
void roomClient.pushRepos();
|
|
461
474
|
})
|
|
462
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();
|
|
463
482
|
const tz = config.timezone ? ` ${config.timezone}` : '';
|
|
464
483
|
const next = automationStore
|
|
465
484
|
.jobs()
|
|
@@ -481,17 +500,33 @@ async function main() {
|
|
|
481
500
|
console.error(`[daemon] Lucid daemon started. Briefing ${config.briefingTime}${tz} → ${deliverer.name}${weekly}. ` +
|
|
482
501
|
`Scheduled work: ${config.scheduledWork !== false ? 'on' : 'off'}. Next briefing: ${next ?? 'none'}. Chat on 127.0.0.1:${config.chatPort}. ` +
|
|
483
502
|
`Room dialing ${config.apiUrl}. ${tools}.${shell} ${runtimeVersions}.`);
|
|
503
|
+
let shuttingDown;
|
|
484
504
|
const shutdown = () => {
|
|
505
|
+
if (shuttingDown)
|
|
506
|
+
return shuttingDown;
|
|
485
507
|
console.error('[daemon] shutting down.');
|
|
486
508
|
speech.dispose();
|
|
487
|
-
|
|
509
|
+
const stoppedAutomations = automations.stop();
|
|
488
510
|
chatServer.close();
|
|
489
511
|
branchWatcher?.stop();
|
|
512
|
+
clearInterval(mergedSweep);
|
|
490
513
|
roomClient.stop();
|
|
491
514
|
roomController.abort();
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
515
|
+
shuttingDown = (async () => {
|
|
516
|
+
await Promise.all([
|
|
517
|
+
stoppedAutomations,
|
|
518
|
+
roomClient.drain(),
|
|
519
|
+
...Object.values(providers).map((provider) => provider.dispose()),
|
|
520
|
+
]);
|
|
521
|
+
await queue.drain();
|
|
522
|
+
turnLogs.close();
|
|
523
|
+
lease?.close();
|
|
524
|
+
process.exit(0);
|
|
525
|
+
})().catch((error) => {
|
|
526
|
+
console.error(`[daemon] shutdown failed: ${String(error)}`);
|
|
527
|
+
process.exit(1);
|
|
528
|
+
});
|
|
529
|
+
return shuttingDown;
|
|
495
530
|
};
|
|
496
531
|
process.on('SIGINT', shutdown);
|
|
497
532
|
process.on('SIGTERM', shutdown);
|
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,15 @@
|
|
|
1
|
+
import type { AgentExecutor, ApiClient } from '@lucidity/runtime';
|
|
2
|
+
import type { GoalNotes } from '../goals/notes.js';
|
|
3
|
+
import type { JobResult } from './runner.js';
|
|
4
|
+
export interface GoalJobDependencies {
|
|
5
|
+
api: ApiClient;
|
|
6
|
+
executor: Pick<AgentExecutor, 'run'>;
|
|
7
|
+
notes?: GoalNotes;
|
|
8
|
+
signal?: AbortSignal;
|
|
9
|
+
now?: () => Date;
|
|
10
|
+
/** Short interval in tests; normally cancellation is checked every five seconds. */
|
|
11
|
+
cancellationPollMs?: number;
|
|
12
|
+
}
|
|
13
|
+
/** A shared automation job, with server receipts across restarts and computers. No routine notifications. */
|
|
14
|
+
export declare function runGoalTracking(deps: GoalJobDependencies): Promise<JobResult>;
|
|
15
|
+
//# sourceMappingURL=goals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"goals.d.ts","sourceRoot":"","sources":["../../src/jobs/goals.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAclE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AA4B7C,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,SAAS,CAAC;IACf,QAAQ,EAAE,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;IACrC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;IACjB,oFAAoF;IACpF,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,6GAA6G;AAC7G,wBAAsB,eAAe,CACnC,IAAI,EAAE,mBAAmB,GACxB,OAAO,CAAC,SAAS,CAAC,CA6NpB"}
|