@opencorelabs/lucidity 0.3.0 → 0.6.0
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/licenses/FluidAudio/LICENSE +201 -0
- package/dist/assets/speech/licenses/FluidAudio/ThirdPartyLicenses/fastcluster-LICENSE.md +11 -0
- package/dist/assets/speech/licenses/FluidAudio/ThirdPartyLicenses/vbx-LICENSE.md +201 -0
- package/dist/assets/speech/lucidity-speech +0 -0
- package/dist/automations/agent.d.ts +16 -0
- package/dist/automations/agent.d.ts.map +1 -0
- package/dist/automations/agent.js +196 -0
- package/dist/automations/cli.d.ts +4 -0
- package/dist/automations/cli.d.ts.map +1 -0
- package/dist/automations/cli.js +44 -0
- package/dist/automations/connections.d.ts +11 -0
- package/dist/automations/connections.d.ts.map +1 -0
- package/dist/automations/connections.js +74 -0
- package/dist/automations/designer.d.ts +39 -0
- package/dist/automations/designer.d.ts.map +1 -0
- package/dist/automations/designer.js +450 -0
- package/dist/automations/history.d.ts +4 -0
- package/dist/automations/history.d.ts.map +1 -0
- package/dist/automations/history.js +57 -0
- package/dist/automations/learning.d.ts +19 -0
- package/dist/automations/learning.d.ts.map +1 -0
- package/dist/automations/learning.js +121 -0
- package/dist/automations/pinterest.d.ts +21 -0
- package/dist/automations/pinterest.d.ts.map +1 -0
- package/dist/automations/pinterest.js +113 -0
- package/dist/automations/service.d.ts +42 -0
- package/dist/automations/service.d.ts.map +1 -0
- package/dist/automations/service.js +406 -0
- package/dist/automations/setup.d.ts +3 -0
- package/dist/automations/setup.d.ts.map +1 -0
- package/dist/automations/setup.js +48 -0
- package/dist/automations/skill.d.ts +3 -0
- package/dist/automations/skill.d.ts.map +1 -0
- package/dist/automations/skill.js +29 -0
- package/dist/automations/store.d.ts +13 -0
- package/dist/automations/store.d.ts.map +1 -0
- package/dist/automations/store.js +46 -0
- package/dist/chat/server.d.ts +2 -0
- package/dist/chat/server.d.ts.map +1 -1
- package/dist/chat/server.js +46 -2
- package/dist/coding/commandContext.d.ts +6 -0
- package/dist/coding/commandContext.d.ts.map +1 -0
- package/dist/coding/commandContext.js +20 -0
- package/dist/coding/runCodeTurn.d.ts +12 -2
- package/dist/coding/runCodeTurn.d.ts.map +1 -1
- package/dist/coding/runCodeTurn.js +49 -19
- package/dist/coding/worktree.d.ts +3 -4
- package/dist/coding/worktree.d.ts.map +1 -1
- package/dist/coding/worktree.js +3 -4
- package/dist/config.d.ts +4 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +20 -3
- package/dist/decisions/cli.d.ts +2 -0
- package/dist/decisions/cli.d.ts.map +1 -0
- package/dist/decisions/cli.js +106 -0
- package/dist/decisions/client.d.ts +20 -0
- package/dist/decisions/client.d.ts.map +1 -0
- package/dist/decisions/client.js +41 -0
- package/dist/handoff.d.ts +11 -0
- package/dist/handoff.d.ts.map +1 -0
- package/dist/handoff.js +21 -0
- package/dist/index.js +179 -40
- package/dist/jobs/briefing.js +1 -1
- package/dist/jobs/extraction.d.ts.map +1 -1
- package/dist/jobs/extraction.js +112 -22
- package/dist/jobs/fastModeReview.d.ts +39 -0
- package/dist/jobs/fastModeReview.d.ts.map +1 -0
- package/dist/jobs/fastModeReview.js +192 -0
- package/dist/jobs/voiceReview.d.ts +24 -0
- package/dist/jobs/voiceReview.d.ts.map +1 -0
- package/dist/jobs/voiceReview.js +128 -0
- package/dist/mcp/clients.d.ts +5 -0
- package/dist/mcp/clients.d.ts.map +1 -1
- package/dist/mcp/clients.js +1 -1
- package/dist/mcp/config.d.ts +3 -1
- package/dist/mcp/config.d.ts.map +1 -1
- package/dist/mcp/config.js +48 -6
- package/dist/mcp/paired.js +1 -0
- package/dist/notesContext.d.ts.map +1 -1
- package/dist/notesContext.js +3 -2
- package/dist/room/client.d.ts +20 -7
- package/dist/room/client.d.ts.map +1 -1
- package/dist/room/client.js +262 -45
- package/dist/room/computer.d.ts.map +1 -1
- package/dist/room/computer.js +8 -0
- package/dist/room/context.d.ts +3 -2
- package/dist/room/context.d.ts.map +1 -1
- package/dist/room/context.js +10 -3
- package/dist/room/turnQueue.d.ts +40 -0
- package/dist/room/turnQueue.d.ts.map +1 -0
- package/dist/room/turnQueue.js +301 -0
- package/dist/skills/lucidity-automations/SKILL.md +54 -0
- package/dist/speech/captures.d.ts +30 -0
- package/dist/speech/captures.d.ts.map +1 -0
- package/dist/speech/captures.js +209 -0
- package/dist/speech/fluidAudio.d.ts +28 -0
- package/dist/speech/fluidAudio.d.ts.map +1 -0
- package/dist/speech/fluidAudio.js +182 -0
- package/dist/speech/service.d.ts +14 -0
- package/dist/speech/service.d.ts.map +1 -0
- package/dist/speech/service.js +88 -0
- package/dist/speech/types.d.ts +19 -0
- package/dist/speech/types.d.ts.map +1 -0
- package/dist/speech/types.js +1 -0
- package/dist/turnLog.d.ts +1 -0
- package/dist/turnLog.d.ts.map +1 -1
- package/dist/turnLog.js +3 -0
- package/native/speech/Package.resolved +15 -0
- package/native/speech/Package.swift +16 -0
- package/native/speech/Sources/lucidity-speech/Speech.swift +81 -0
- package/package.json +6 -2
- package/src/automations/agent.ts +239 -0
- package/src/automations/cli.ts +52 -0
- package/src/automations/connections.ts +83 -0
- package/src/automations/designer.ts +594 -0
- package/src/automations/history.ts +59 -0
- package/src/automations/learning.ts +180 -0
- package/src/automations/pinterest.ts +146 -0
- package/src/automations/service.ts +505 -0
- package/src/automations/setup.ts +71 -0
- package/src/automations/skill.ts +40 -0
- package/src/automations/store.ts +63 -0
- package/src/chat/server.ts +62 -3
- package/src/coding/commandContext.ts +29 -0
- package/src/coding/runCodeTurn.ts +65 -21
- package/src/coding/worktree.ts +3 -4
- package/src/config.ts +29 -2
- package/src/decisions/cli.ts +136 -0
- package/src/decisions/client.ts +62 -0
- package/src/handoff.ts +28 -0
- package/src/index.ts +196 -67
- package/src/jobs/briefing.ts +1 -1
- package/src/jobs/extraction.ts +157 -32
- package/src/jobs/fastModeReview.ts +221 -0
- package/src/jobs/voiceReview.ts +156 -0
- package/src/mcp/clients.ts +1 -1
- package/src/mcp/config.ts +56 -6
- package/src/mcp/paired.ts +1 -0
- package/src/notesContext.ts +3 -2
- package/src/room/client.ts +316 -52
- package/src/room/computer.ts +8 -0
- package/src/room/context.ts +12 -3
- package/src/room/turnQueue.ts +358 -0
- package/src/speech/captures.ts +265 -0
- package/src/speech/fluidAudio.ts +242 -0
- package/src/speech/service.ts +108 -0
- package/src/speech/types.ts +13 -0
- package/src/turnLog.ts +4 -0
- package/vendor/decisions/LICENSE +662 -0
- package/vendor/decisions/dist/capture.d.ts +79 -0
- package/vendor/decisions/dist/capture.js +183 -0
- package/vendor/decisions/dist/command.d.ts +202 -0
- package/vendor/decisions/dist/command.js +750 -0
- package/vendor/decisions/dist/gate.d.ts +12 -0
- package/vendor/decisions/dist/gate.js +18 -0
- package/vendor/decisions/dist/index.d.ts +5 -0
- package/vendor/decisions/dist/index.js +5 -0
- package/vendor/decisions/dist/jev.d.ts +15 -0
- package/vendor/decisions/dist/jev.js +242 -0
- package/vendor/decisions/dist/types.d.ts +67 -0
- package/vendor/decisions/dist/types.js +1 -0
- package/vendor/decisions/package.json +22 -0
- package/vendor/decisions/src/capture.ts +199 -0
- package/vendor/decisions/src/command.ts +836 -0
- package/vendor/decisions/src/gate.ts +32 -0
- package/vendor/decisions/src/index.ts +5 -0
- package/vendor/decisions/src/jev.ts +293 -0
- package/vendor/decisions/src/types.ts +79 -0
- package/vendor/mcp-server/README.md +6 -1
- package/vendor/mcp-server/dist/client.d.ts +1 -0
- package/vendor/mcp-server/dist/client.d.ts.map +1 -1
- package/vendor/mcp-server/dist/client.js +8 -0
- package/vendor/mcp-server/dist/commentProvider.d.ts +3 -0
- package/vendor/mcp-server/dist/commentProvider.d.ts.map +1 -0
- package/vendor/mcp-server/dist/commentProvider.js +10 -0
- package/vendor/mcp-server/dist/index.js +21 -6
- package/vendor/mcp-server/dist/tools/automations.d.ts +6 -0
- package/vendor/mcp-server/dist/tools/automations.d.ts.map +1 -0
- package/vendor/mcp-server/dist/tools/automations.js +163 -0
- package/vendor/mcp-server/dist/tools/commandEventFormat.d.ts +52 -0
- package/vendor/mcp-server/dist/tools/commandEventFormat.d.ts.map +1 -0
- package/vendor/mcp-server/dist/tools/commandEventFormat.js +83 -0
- package/vendor/mcp-server/dist/tools/commandEvents.d.ts +3 -0
- package/vendor/mcp-server/dist/tools/commandEvents.d.ts.map +1 -0
- package/vendor/mcp-server/dist/tools/commandEvents.js +21 -0
- package/vendor/mcp-server/dist/tools/comments.d.ts.map +1 -1
- package/vendor/mcp-server/dist/tools/comments.js +25 -4
- package/vendor/mcp-server/dist/tools/index.d.ts +2 -0
- package/vendor/mcp-server/dist/tools/index.d.ts.map +1 -1
- package/vendor/mcp-server/dist/tools/index.js +2 -0
- package/vendor/mcp-server/dist/tools/journal.d.ts +3 -0
- package/vendor/mcp-server/dist/tools/journal.d.ts.map +1 -0
- package/vendor/mcp-server/dist/tools/journal.js +131 -0
- package/vendor/mcp-server/dist/tools/taskActivity.d.ts +3 -0
- package/vendor/mcp-server/dist/tools/taskActivity.d.ts.map +1 -0
- package/vendor/mcp-server/dist/tools/taskActivity.js +32 -0
- package/vendor/mcp-server/dist/tools/taskOccurrences.d.ts +3 -0
- package/vendor/mcp-server/dist/tools/taskOccurrences.d.ts.map +1 -0
- package/vendor/mcp-server/dist/tools/taskOccurrences.js +12 -0
- package/vendor/mcp-server/dist/tools/taskTrash.d.ts +3 -0
- package/vendor/mcp-server/dist/tools/taskTrash.d.ts.map +1 -0
- package/vendor/mcp-server/dist/tools/taskTrash.js +21 -0
- package/vendor/mcp-server/dist/tools/tasks.d.ts.map +1 -1
- package/vendor/mcp-server/dist/tools/tasks.js +67 -27
- package/vendor/mcp-server/package.json +5 -1
- package/vendor/mcp-server/src/client.ts +10 -0
- package/vendor/mcp-server/src/commentProvider.ts +9 -0
- package/vendor/mcp-server/src/index.ts +20 -6
- package/vendor/mcp-server/src/tools/automations.ts +199 -0
- package/vendor/mcp-server/src/tools/commandEventFormat.ts +108 -0
- package/vendor/mcp-server/src/tools/commandEvents.ts +27 -0
- package/vendor/mcp-server/src/tools/comments.ts +24 -3
- package/vendor/mcp-server/src/tools/index.ts +2 -0
- package/vendor/mcp-server/src/tools/journal.ts +168 -0
- package/vendor/mcp-server/src/tools/taskActivity.ts +55 -0
- package/vendor/mcp-server/src/tools/taskOccurrences.ts +26 -0
- package/vendor/mcp-server/src/tools/taskTrash.ts +23 -0
- package/vendor/mcp-server/src/tools/tasks.ts +66 -30
- package/vendor/notes/dist/index.d.ts +2 -0
- package/vendor/notes/dist/index.d.ts.map +1 -1
- package/vendor/notes/dist/index.js +2 -0
- package/vendor/notes/dist/journal-backend.d.ts +4 -0
- package/vendor/notes/dist/journal-backend.d.ts.map +1 -0
- package/vendor/notes/dist/journal-backend.js +33 -0
- package/vendor/notes/dist/journal.d.ts +7 -0
- package/vendor/notes/dist/journal.d.ts.map +1 -0
- package/vendor/notes/dist/journal.js +173 -0
- package/vendor/notes/dist/vault.d.ts.map +1 -1
- package/vendor/notes/dist/vault.js +6 -1
- package/vendor/notes/src/index.ts +2 -0
- package/vendor/notes/src/journal-backend.ts +53 -0
- package/vendor/notes/src/journal.ts +194 -0
- package/vendor/notes/src/vault.ts +9 -1
- package/vendor/runtime/README.md +4 -0
- package/vendor/runtime/dist/executor/claudeAgent.d.ts +2 -0
- package/vendor/runtime/dist/executor/claudeAgent.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/claudeAgent.js +113 -8
- package/vendor/runtime/dist/executor/claudeCode.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/claudeCode.js +8 -4
- package/vendor/runtime/dist/executor/codex.d.ts +2 -0
- package/vendor/runtime/dist/executor/codex.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/codex.js +213 -11
- package/vendor/runtime/dist/executor/codexProtocol/PlanType.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/PlanType.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/PlanType.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CreditsSnapshot.d.ts +6 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CreditsSnapshot.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CreditsSnapshot.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/GetAccountRateLimitsResponse.d.ts +26 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/GetAccountRateLimitsResponse.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/GetAccountRateLimitsResponse.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitReachedType.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitReachedType.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitReachedType.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCredit.d.ts +27 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCredit.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCredit.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCreditStatus.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCreditStatus.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCreditStatus.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCreditsSummary.d.ts +13 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCreditsSummary.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCreditsSummary.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetType.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetType.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetType.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitSnapshot.d.ts +20 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitSnapshot.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitSnapshot.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitWindow.d.ts +6 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitWindow.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitWindow.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewDelivery.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewDelivery.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewDelivery.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewStartParams.d.ts +12 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewStartParams.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewStartParams.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewTarget.d.ts +17 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewTarget.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewTarget.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillDependencies.d.ts +5 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillDependencies.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillDependencies.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillErrorInfo.d.ts +5 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillErrorInfo.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillErrorInfo.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillInterface.d.ts +18 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillInterface.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillInterface.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillMetadata.d.ts +22 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillMetadata.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillMetadata.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillScope.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillScope.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillScope.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillToolDependency.d.ts +9 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillToolDependency.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillToolDependency.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillsListEntry.d.ts +8 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillsListEntry.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillsListEntry.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillsListResponse.d.ts +5 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillsListResponse.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillsListResponse.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SpendControlLimitSnapshot.d.ts +7 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SpendControlLimitSnapshot.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SpendControlLimitSnapshot.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSetNameParams.d.ts +5 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSetNameParams.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSetNameParams.js +2 -0
- package/vendor/runtime/dist/executor/health.d.ts +1 -0
- package/vendor/runtime/dist/executor/health.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/health.js +3 -0
- package/vendor/runtime/dist/executor/liveTurns.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/liveTurns.js +3 -0
- package/vendor/runtime/dist/executor/providerRouter.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/providerRouter.js +2 -1
- package/vendor/runtime/dist/executor/types.d.ts +8 -0
- package/vendor/runtime/dist/executor/types.d.ts.map +1 -1
- package/vendor/runtime/dist/harness/index.d.ts +1 -0
- package/vendor/runtime/dist/harness/index.d.ts.map +1 -1
- package/vendor/runtime/dist/harness/index.js +35 -1
- package/vendor/runtime/dist/harness/types.d.ts +4 -1
- package/vendor/runtime/dist/harness/types.d.ts.map +1 -1
- 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 +2 -0
- package/vendor/runtime/dist/journal/context.d.ts +18 -0
- package/vendor/runtime/dist/journal/context.d.ts.map +1 -1
- package/vendor/runtime/dist/journal/context.js +19 -5
- package/vendor/runtime/dist/prompts/briefing.d.ts +4 -7
- package/vendor/runtime/dist/prompts/briefing.d.ts.map +1 -1
- package/vendor/runtime/dist/prompts/briefing.js +61 -12
- package/vendor/runtime/dist/prompts/cardStatement.d.ts +7 -0
- package/vendor/runtime/dist/prompts/cardStatement.d.ts.map +1 -0
- package/vendor/runtime/dist/prompts/cardStatement.js +52 -0
- package/vendor/runtime/dist/prompts/chat.d.ts +1 -0
- package/vendor/runtime/dist/prompts/chat.d.ts.map +1 -1
- package/vendor/runtime/dist/prompts/chat.js +15 -1
- package/vendor/runtime/dist/prompts/projectCapture.d.ts +7 -0
- package/vendor/runtime/dist/prompts/projectCapture.d.ts.map +1 -0
- package/vendor/runtime/dist/prompts/projectCapture.js +31 -0
- package/vendor/runtime/src/executor/claudeAgent.ts +133 -7
- package/vendor/runtime/src/executor/claudeCode.ts +6 -4
- package/vendor/runtime/src/executor/codex.ts +280 -20
- package/vendor/runtime/src/executor/codexProtocol/PlanType.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/CreditsSnapshot.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/GetAccountRateLimitsResponse.ts +25 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/RateLimitReachedType.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/RateLimitResetCredit.ts +27 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/RateLimitResetCreditStatus.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/RateLimitResetCreditsSummary.ts +14 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/RateLimitResetType.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/RateLimitSnapshot.ts +14 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/RateLimitWindow.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/ReviewDelivery.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/ReviewStartParams.ts +12 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/ReviewTarget.ts +9 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/SkillDependencies.ts +6 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/SkillErrorInfo.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/SkillInterface.ts +14 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/SkillMetadata.ts +17 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/SkillScope.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/SkillToolDependency.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/SkillsListEntry.ts +7 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/SkillsListResponse.ts +6 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/SpendControlLimitSnapshot.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/ThreadSetNameParams.ts +5 -0
- package/vendor/runtime/src/executor/health.ts +3 -0
- package/vendor/runtime/src/executor/liveTurns.ts +3 -0
- package/vendor/runtime/src/executor/providerRouter.ts +2 -1
- package/vendor/runtime/src/executor/types.ts +8 -0
- package/vendor/runtime/src/harness/index.ts +40 -6
- package/vendor/runtime/src/harness/types.ts +4 -1
- package/vendor/runtime/src/index.ts +4 -1
- package/vendor/runtime/src/journal/context.ts +40 -7
- package/vendor/runtime/src/prompts/briefing.ts +62 -17
- package/vendor/runtime/src/prompts/cardStatement.ts +64 -0
- package/vendor/runtime/src/prompts/chat.ts +25 -3
- package/vendor/runtime/src/prompts/projectCapture.ts +51 -0
- package/vendor/shared/dist/agentCommands.d.ts +22 -0
- package/vendor/shared/dist/agentCommands.d.ts.map +1 -0
- package/vendor/shared/dist/agentCommands.js +11 -0
- package/vendor/shared/dist/automationTemplates.d.ts +37 -0
- package/vendor/shared/dist/automationTemplates.d.ts.map +1 -0
- package/vendor/shared/dist/automationTemplates.js +48 -0
- package/vendor/shared/dist/automations.d.ts +1052 -0
- package/vendor/shared/dist/automations.d.ts.map +1 -0
- package/vendor/shared/dist/automations.js +300 -0
- package/vendor/shared/dist/cardStatement.d.ts +28 -0
- package/vendor/shared/dist/cardStatement.d.ts.map +1 -0
- package/vendor/shared/dist/cardStatement.js +37 -0
- package/vendor/shared/dist/cardStudio.d.ts +756 -0
- package/vendor/shared/dist/cardStudio.d.ts.map +1 -0
- package/vendor/shared/dist/cardStudio.js +297 -0
- package/vendor/shared/dist/commandLocal.d.ts +218 -0
- package/vendor/shared/dist/commandLocal.d.ts.map +1 -0
- package/vendor/shared/dist/commandLocal.js +662 -0
- package/vendor/shared/dist/commandText.d.ts +12 -0
- package/vendor/shared/dist/commandText.d.ts.map +1 -0
- package/vendor/shared/dist/commandText.js +21 -0
- package/vendor/shared/dist/commands.d.ts +1516 -0
- package/vendor/shared/dist/commands.d.ts.map +1 -0
- package/vendor/shared/dist/commands.js +231 -0
- package/vendor/shared/dist/computer.d.ts +9 -9
- package/vendor/shared/dist/computer.d.ts.map +1 -1
- package/vendor/shared/dist/computer.js +11 -2
- 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 +9 -2
- package/vendor/shared/dist/githubContributions.d.ts +93 -0
- package/vendor/shared/dist/githubContributions.d.ts.map +1 -0
- package/vendor/shared/dist/githubContributions.js +54 -0
- package/vendor/shared/dist/habitContributions.d.ts +26 -0
- package/vendor/shared/dist/habitContributions.d.ts.map +1 -0
- package/vendor/shared/dist/habitContributions.js +119 -0
- package/vendor/shared/dist/index.d.ts +26 -2
- package/vendor/shared/dist/index.d.ts.map +1 -1
- package/vendor/shared/dist/index.js +23 -2
- package/vendor/shared/dist/journal-migration.d.ts +29 -0
- package/vendor/shared/dist/journal-migration.d.ts.map +1 -0
- package/vendor/shared/dist/journal-migration.js +73 -0
- package/vendor/shared/dist/journal-vault.d.ts +414 -0
- package/vendor/shared/dist/journal-vault.d.ts.map +1 -0
- package/vendor/shared/dist/journal-vault.js +972 -0
- package/vendor/shared/dist/projectCapture.d.ts +73 -0
- package/vendor/shared/dist/projectCapture.d.ts.map +1 -0
- package/vendor/shared/dist/projectCapture.js +66 -0
- package/vendor/shared/dist/quickAdd.d.ts +90 -0
- package/vendor/shared/dist/quickAdd.d.ts.map +1 -0
- package/vendor/shared/dist/quickAdd.js +260 -0
- package/vendor/shared/dist/recurrence.d.ts +44 -0
- package/vendor/shared/dist/recurrence.d.ts.map +1 -0
- package/vendor/shared/dist/recurrence.js +37 -0
- package/vendor/shared/dist/reminderWords.d.ts +11 -0
- package/vendor/shared/dist/reminderWords.d.ts.map +1 -0
- package/vendor/shared/dist/reminderWords.js +63 -0
- package/vendor/shared/dist/schemas/comment.d.ts +13 -1
- package/vendor/shared/dist/schemas/comment.d.ts.map +1 -1
- package/vendor/shared/dist/schemas/comment.js +5 -0
- package/vendor/shared/dist/schemas/conversation.d.ts +3 -3
- package/vendor/shared/dist/schemas/harness.d.ts +922 -59
- package/vendor/shared/dist/schemas/harness.d.ts.map +1 -1
- package/vendor/shared/dist/schemas/harness.js +122 -3
- package/vendor/shared/dist/schemas/journal.d.ts +10 -0
- package/vendor/shared/dist/schemas/journal.d.ts.map +1 -1
- package/vendor/shared/dist/schemas/journal.js +10 -2
- package/vendor/shared/dist/schemas/notification.d.ts +1 -1
- package/vendor/shared/dist/schemas/organization.d.ts +3 -2
- package/vendor/shared/dist/schemas/organization.d.ts.map +1 -1
- package/vendor/shared/dist/schemas/organization.js +3 -2
- package/vendor/shared/dist/schemas/proposal.d.ts +7 -3
- package/vendor/shared/dist/schemas/proposal.d.ts.map +1 -1
- package/vendor/shared/dist/schemas/proposal.js +2 -1
- package/vendor/shared/dist/schemas/request.d.ts +44 -4
- package/vendor/shared/dist/schemas/request.d.ts.map +1 -1
- package/vendor/shared/dist/schemas/task.d.ts +83 -8
- package/vendor/shared/dist/schemas/task.d.ts.map +1 -1
- package/vendor/shared/dist/schemas/task.js +20 -2
- package/vendor/shared/dist/schemas/timeSession.d.ts +2 -2
- package/vendor/shared/dist/smartCapture.d.ts +60 -0
- package/vendor/shared/dist/smartCapture.d.ts.map +1 -0
- package/vendor/shared/dist/smartCapture.js +56 -0
- package/vendor/shared/dist/speech.d.ts +39 -0
- package/vendor/shared/dist/speech.d.ts.map +1 -0
- package/vendor/shared/dist/speech.js +36 -0
- package/vendor/shared/dist/spokenNames.d.ts +25 -0
- package/vendor/shared/dist/spokenNames.d.ts.map +1 -0
- package/vendor/shared/dist/spokenNames.js +120 -0
- package/vendor/shared/dist/taskActivity.d.ts +76 -0
- package/vendor/shared/dist/taskActivity.d.ts.map +1 -0
- package/vendor/shared/dist/taskActivity.js +27 -0
- package/vendor/shared/dist/vault-search.d.ts +50 -0
- package/vendor/shared/dist/vault-search.d.ts.map +1 -0
- package/vendor/shared/dist/vault-search.js +177 -0
- package/vendor/shared/dist/voiceCapture.d.ts +32 -0
- package/vendor/shared/dist/voiceCapture.d.ts.map +1 -0
- package/vendor/shared/dist/voiceCapture.js +29 -0
- package/vendor/shared/package.json +4 -0
- package/vendor/shared/src/agentCommands.ts +35 -0
- package/vendor/shared/src/automationTemplates.ts +54 -0
- package/vendor/shared/src/automations.ts +329 -0
- package/vendor/shared/src/cardStatement.ts +49 -0
- package/vendor/shared/src/cardStudio.ts +340 -0
- package/vendor/shared/src/commandLocal.ts +738 -0
- package/vendor/shared/src/commandText.ts +25 -0
- package/vendor/shared/src/commands.ts +253 -0
- package/vendor/shared/src/computer.ts +23 -6
- package/vendor/shared/src/constants.ts +9 -2
- package/vendor/shared/src/githubContributions.ts +70 -0
- package/vendor/shared/src/habitContributions.ts +144 -0
- package/vendor/shared/src/index.ts +42 -1
- package/vendor/shared/src/journal-migration.ts +130 -0
- package/vendor/shared/src/journal-vault.ts +1240 -0
- package/vendor/shared/src/projectCapture.ts +86 -0
- package/vendor/shared/src/quickAdd.ts +310 -0
- package/vendor/shared/src/recurrence.ts +37 -0
- package/vendor/shared/src/reminderWords.ts +54 -0
- package/vendor/shared/src/schemas/comment.ts +5 -0
- package/vendor/shared/src/schemas/harness.ts +144 -7
- package/vendor/shared/src/schemas/journal.ts +15 -6
- package/vendor/shared/src/schemas/organization.ts +3 -2
- package/vendor/shared/src/schemas/proposal.ts +6 -1
- package/vendor/shared/src/schemas/task.ts +20 -2
- package/vendor/shared/src/smartCapture.ts +67 -0
- package/vendor/shared/src/speech.ts +44 -0
- package/vendor/shared/src/spokenNames.ts +128 -0
- package/vendor/shared/src/taskActivity.ts +34 -0
- package/vendor/shared/src/vault-search.ts +243 -0
- package/vendor/shared/src/voiceCapture.ts +34 -0
package/src/room/client.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { computerId, computerRuntime } from './computer.js';
|
|
2
|
+
import { DurableTurnQueue } from './turnQueue.js';
|
|
2
3
|
import type { AgentControls } from '../agentControls.js';
|
|
3
4
|
import type { AgentProvider, ExecutorModel } from '@lucidity/runtime';
|
|
4
5
|
import { WebSocket } from 'ws';
|
|
5
6
|
import {
|
|
6
7
|
HarnessRequestSchema,
|
|
8
|
+
type AgentCommandOption,
|
|
9
|
+
type AgentCommandContext,
|
|
7
10
|
computerAvailability,
|
|
8
11
|
type ComputerRuntime,
|
|
9
12
|
type ProviderHealth,
|
|
@@ -19,6 +22,7 @@ import type {
|
|
|
19
22
|
} from '@lucidity/shared';
|
|
20
23
|
import type { ExecutorStreamEvent, LucidHarness } from '@lucidity/runtime';
|
|
21
24
|
import type { DaemonConfig } from '../config.js';
|
|
25
|
+
import type { AutomationService } from '../automations/service.js';
|
|
22
26
|
import type { Vault } from '../vault.js';
|
|
23
27
|
import {
|
|
24
28
|
loadAskContext,
|
|
@@ -38,11 +42,18 @@ import {
|
|
|
38
42
|
} from '../streamDeadline.js';
|
|
39
43
|
import { TurnLogStore } from '../turnLog.js';
|
|
40
44
|
import type { AttentionPublisher } from '../attention.js';
|
|
41
|
-
import type { AttentionBoardEntry } from '@lucidity/shared';
|
|
45
|
+
import type { AttentionBoardEntry, ProviderHandoff } from '@lucidity/shared';
|
|
42
46
|
import { LaneQueue } from '../queue.js';
|
|
43
47
|
import { RoomTelemetry } from './telemetry.js';
|
|
44
48
|
import { buildIncidentBundle, writeIncidentBundle } from './incidents.js';
|
|
45
49
|
import { writeVoiceDiagBundle } from './voiceDiag.js';
|
|
50
|
+
import type { SpeechService } from '../speech/service.js';
|
|
51
|
+
import { VoiceCaptureService } from '../speech/captures.js';
|
|
52
|
+
import { CONFIG_DIR } from '../config.js';
|
|
53
|
+
import { handoffPrompt } from '../handoff.js';
|
|
54
|
+
import { createHash } from 'node:crypto';
|
|
55
|
+
import { join } from 'node:path';
|
|
56
|
+
import { uuidv7 } from 'uuidv7';
|
|
46
57
|
|
|
47
58
|
/** Frame `type`s that carry recoverable turn output — the ones written to the durable
|
|
48
59
|
* turn log and stamped with a `seq`. Buffered responses (`kind` replies) and any other
|
|
@@ -91,6 +102,8 @@ export type CodeHandler = (
|
|
|
91
102
|
prompt: string;
|
|
92
103
|
images?: HarnessImage[];
|
|
93
104
|
resume?: string;
|
|
105
|
+
provider?: AgentProvider;
|
|
106
|
+
handoff?: ProviderHandoff;
|
|
94
107
|
workerId?: string;
|
|
95
108
|
mode?: WorkspaceMode;
|
|
96
109
|
expectedBranch?: string;
|
|
@@ -130,12 +143,16 @@ export interface RepoInfo {
|
|
|
130
143
|
}
|
|
131
144
|
|
|
132
145
|
export interface DispatchDeps {
|
|
146
|
+
speech?: Pick<SpeechService, 'transcribe'>;
|
|
147
|
+
captures?: Pick<VoiceCaptureService, 'submit' | 'status'>;
|
|
148
|
+
turnQueue?: DurableTurnQueue;
|
|
133
149
|
recordAcceptance?: boolean;
|
|
134
150
|
runtime?: () => ComputerRuntime;
|
|
135
151
|
controls?: AgentControls;
|
|
136
152
|
models?: (provider: AgentProvider) => Promise<ExecutorModel[]>;
|
|
153
|
+
commands?: (provider: AgentProvider, context?: AgentCommandContext) => Promise<AgentCommandOption[]>;
|
|
137
154
|
harness: LucidHarness;
|
|
138
|
-
askContext: () => Promise<AskContext>;
|
|
155
|
+
askContext: (query?: string) => Promise<AskContext>;
|
|
139
156
|
briefingContext: () => Promise<BriefingContext>;
|
|
140
157
|
/** Serialize + send one wire message to the counterpart (phone). For a stream frame
|
|
141
158
|
* this appends it to the durable turn log and stamps a `seq` before sending; other
|
|
@@ -172,6 +189,7 @@ export interface DispatchDeps {
|
|
|
172
189
|
logger?: (msg: string) => void;
|
|
173
190
|
/** Read the daemon's redacted config (`getConfig`, Daemon Settings). Absent → editing disabled. */
|
|
174
191
|
getConfig?: () => DaemonConfigView;
|
|
192
|
+
automations?: AutomationService;
|
|
175
193
|
/** Persist + live-apply a config patch (`setConfig`). Returns the new redacted config plus
|
|
176
194
|
* whether the change needs a restart and whether one was triggered. Absent → editing disabled. */
|
|
177
195
|
setConfig?: (
|
|
@@ -182,11 +200,8 @@ export interface DispatchDeps {
|
|
|
182
200
|
requestRestart?: () => void;
|
|
183
201
|
/** First-output deadline (ms) for a resumed run before it's treated as a dead handle. Test seam. */
|
|
184
202
|
resumeDeadlineMs?: number;
|
|
185
|
-
/** Serialises
|
|
186
|
-
*
|
|
187
|
-
* knows the resume handle the previous turn produced. This is the backstop for what the phone
|
|
188
|
-
* can't see: a second device, or a double-send that slips past it. Absent → runs unserialised,
|
|
189
|
-
* as before. */
|
|
203
|
+
/** Serialises execution in each workspace. Durable queued requests resolve their
|
|
204
|
+
* predecessor's session on the daemon before taking this lane. */
|
|
190
205
|
queue?: LaneQueue;
|
|
191
206
|
/** Structured connection telemetry (#314) — the daemon's side of the join. Records the
|
|
192
207
|
* request timeline and supplies it as the incident bundle's connection context. */
|
|
@@ -234,7 +249,7 @@ export async function dispatchRequest(
|
|
|
234
249
|
harness,
|
|
235
250
|
askContext,
|
|
236
251
|
briefingContext,
|
|
237
|
-
send,
|
|
252
|
+
send: sendFrame,
|
|
238
253
|
signal: outerSignal,
|
|
239
254
|
inFlight,
|
|
240
255
|
attention,
|
|
@@ -248,9 +263,88 @@ export async function dispatchRequest(
|
|
|
248
263
|
return;
|
|
249
264
|
}
|
|
250
265
|
const parsed = HarnessRequestSchema.safeParse(json);
|
|
251
|
-
if (!parsed.success)
|
|
266
|
+
if (!parsed.success) {
|
|
267
|
+
const invalid = json as { id?: unknown; kind?: unknown } | null;
|
|
268
|
+
if (
|
|
269
|
+
invalid?.kind === 'transcribe' &&
|
|
270
|
+
typeof invalid.id === 'string' &&
|
|
271
|
+
/^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(
|
|
272
|
+
invalid.id,
|
|
273
|
+
)
|
|
274
|
+
) {
|
|
275
|
+
sendFrame({
|
|
276
|
+
type: 'error',
|
|
277
|
+
requestId: invalid.id,
|
|
278
|
+
message: 'Use a supported audio recording under 10 MB.',
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
252
283
|
const req = parsed.data;
|
|
284
|
+
const send = (frame: unknown) => sendFrame(req.kind === 'ask' && req.projectPlan
|
|
285
|
+
? { ...(frame as Record<string, unknown>), purpose: 'project-plan' } : frame);
|
|
286
|
+
if (req.kind === 'voice-capture' || req.kind === 'voice-capture-status') {
|
|
287
|
+
try {
|
|
288
|
+
if (!deps.captures)
|
|
289
|
+
throw new Error(
|
|
290
|
+
'Update Lucidity on your computer to receive Watch recordings.',
|
|
291
|
+
);
|
|
292
|
+
// Existing receipts remain readable even if the provider later signs out.
|
|
293
|
+
const previous = deps.captures.status(req.credentialId, req.captureId);
|
|
294
|
+
if (req.kind === 'voice-capture' && !previous && deps.runtime) {
|
|
295
|
+
for (const feature of ['transcribe', 'ask']) {
|
|
296
|
+
const availability = computerAvailability(
|
|
297
|
+
{
|
|
298
|
+
type: 'presence',
|
|
299
|
+
daemonConnected: true,
|
|
300
|
+
runtime: deps.runtime(),
|
|
301
|
+
},
|
|
302
|
+
'online',
|
|
303
|
+
feature,
|
|
304
|
+
);
|
|
305
|
+
if (!availability.canSend)
|
|
306
|
+
throw new Error(`${availability.title}. ${availability.detail}`);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
const receipt =
|
|
310
|
+
req.kind === 'voice-capture'
|
|
311
|
+
? deps.captures.submit(req.credentialId, {
|
|
312
|
+
captureId: req.captureId,
|
|
313
|
+
audio: req.audio,
|
|
314
|
+
})
|
|
315
|
+
: previous;
|
|
316
|
+
send({ requestId: req.id, kind: 'voice-capture', receipt });
|
|
317
|
+
} catch (error) {
|
|
318
|
+
send({
|
|
319
|
+
type: 'error',
|
|
320
|
+
requestId: req.id,
|
|
321
|
+
message:
|
|
322
|
+
error instanceof Error
|
|
323
|
+
? error.message
|
|
324
|
+
: 'Voice capture is unavailable.',
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
253
329
|
deps.telemetry?.record('request', req.kind, req.id);
|
|
330
|
+
if (req.kind === 'queue-control') {
|
|
331
|
+
try {
|
|
332
|
+
if (!deps.turnQueue)
|
|
333
|
+
throw new Error(
|
|
334
|
+
'Update Lucidity on your computer to manage queued messages.',
|
|
335
|
+
);
|
|
336
|
+
await deps.turnQueue.control(req.targetId, req.action, req.activeId);
|
|
337
|
+
send({ kind: 'control', requestId: req.id, accepted: true });
|
|
338
|
+
} catch (error) {
|
|
339
|
+
send({
|
|
340
|
+
kind: 'control',
|
|
341
|
+
requestId: req.id,
|
|
342
|
+
accepted: false,
|
|
343
|
+
message: (error as Error).message,
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
254
348
|
if (
|
|
255
349
|
deps.runtime &&
|
|
256
350
|
!['pull', 'cancel', 'permission', 'steer'].includes(req.kind)
|
|
@@ -260,7 +354,9 @@ export async function dispatchRequest(
|
|
|
260
354
|
provider =
|
|
261
355
|
'resume' in req && req.resume
|
|
262
356
|
? decodeSession(req.resume).provider
|
|
263
|
-
:
|
|
357
|
+
: 'provider' in req
|
|
358
|
+
? req.provider
|
|
359
|
+
: undefined;
|
|
264
360
|
} catch {
|
|
265
361
|
send({
|
|
266
362
|
type: 'error',
|
|
@@ -348,6 +444,26 @@ export async function dispatchRequest(
|
|
|
348
444
|
send({ kind: 'control', requestId: req.id, ...result });
|
|
349
445
|
return;
|
|
350
446
|
}
|
|
447
|
+
if (req.kind === 'commands') {
|
|
448
|
+
try {
|
|
449
|
+
if (!deps.commands)
|
|
450
|
+
throw new Error('Update Lucidity on your computer to use commands.');
|
|
451
|
+
send({
|
|
452
|
+
kind: 'commands',
|
|
453
|
+
requestId: req.id,
|
|
454
|
+
provider: req.provider,
|
|
455
|
+
commands: await deps.commands(req.provider, req.context),
|
|
456
|
+
});
|
|
457
|
+
} catch (error) {
|
|
458
|
+
send({
|
|
459
|
+
type: 'error',
|
|
460
|
+
requestId: req.id,
|
|
461
|
+
message:
|
|
462
|
+
error instanceof Error ? error.message : 'Command discovery failed.',
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
351
467
|
if (req.kind === 'models') {
|
|
352
468
|
try {
|
|
353
469
|
send({
|
|
@@ -400,6 +516,7 @@ export async function dispatchRequest(
|
|
|
400
516
|
for (const frame of state.frames) {
|
|
401
517
|
if (frame.seq > req.sinceSeq) sendRaw(frame);
|
|
402
518
|
}
|
|
519
|
+
if (!state.terminated) deps.turnQueue?.confirm(req.targetId);
|
|
403
520
|
// A phone may already have every logged frame while the turn waits for its
|
|
404
521
|
// decision. Reconfirm that live approval with a new sequence so reconnect
|
|
405
522
|
// restores its controls instead of waiting forever for another model token.
|
|
@@ -409,7 +526,11 @@ export async function dispatchRequest(
|
|
|
409
526
|
// restarted mid-turn). Settle it with a synthesized, persisted terminal so the phone
|
|
410
527
|
// stops waiting and a repeat pull is idempotent. If it's still in `inFlight`, live
|
|
411
528
|
// frames past maxSeq keep flowing on the current socket (deduped by seq) — leave it.
|
|
412
|
-
if (
|
|
529
|
+
if (
|
|
530
|
+
!state.terminated &&
|
|
531
|
+
!inFlight?.has(req.targetId) &&
|
|
532
|
+
!deps.turnQueue?.owns(req.targetId)
|
|
533
|
+
) {
|
|
413
534
|
sendRaw(
|
|
414
535
|
turnLogs.append(req.targetId, {
|
|
415
536
|
type: 'error',
|
|
@@ -421,6 +542,21 @@ export async function dispatchRequest(
|
|
|
421
542
|
return;
|
|
422
543
|
}
|
|
423
544
|
|
|
545
|
+
if ((req.kind === 'ask' || req.kind === 'code') && req.queue) {
|
|
546
|
+
try {
|
|
547
|
+
if (!deps.turnQueue)
|
|
548
|
+
throw new Error('Update Lucidity on your computer to queue messages.');
|
|
549
|
+
deps.turnQueue.enqueue(req);
|
|
550
|
+
} catch (error) {
|
|
551
|
+
send({
|
|
552
|
+
type: 'error',
|
|
553
|
+
requestId: req.id,
|
|
554
|
+
message: (error as Error).message,
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
559
|
+
|
|
424
560
|
if (
|
|
425
561
|
deps.recordAcceptance &&
|
|
426
562
|
['ask', 'code', 'conduct', 'briefing', 'attention', 'clone'].includes(
|
|
@@ -437,6 +573,12 @@ export async function dispatchRequest(
|
|
|
437
573
|
const accepted = deps.turnLogs.append(req.id, {
|
|
438
574
|
type: 'accepted',
|
|
439
575
|
requestId: req.id,
|
|
576
|
+
scope: {
|
|
577
|
+
kind: req.kind,
|
|
578
|
+
...('repoId' in req ? { repoId: req.repoId } : {}),
|
|
579
|
+
...('workerId' in req ? { workerId: req.workerId } : {}),
|
|
580
|
+
...('mode' in req ? { mode: req.mode } : {}),
|
|
581
|
+
},
|
|
440
582
|
});
|
|
441
583
|
if (!deps.turnLogs.read(req.id).exists) {
|
|
442
584
|
send({
|
|
@@ -460,14 +602,25 @@ export async function dispatchRequest(
|
|
|
460
602
|
// must still be cancellable, and the `signal?.aborted` checks below mean a cancel that lands
|
|
461
603
|
// while queued drops the run instead of starting it late.
|
|
462
604
|
const onLane = <T>(lane: string, fn: () => Promise<T>): Promise<T> =>
|
|
463
|
-
deps.queue
|
|
605
|
+
deps.queue
|
|
606
|
+
? deps.queue.run(lane, () =>
|
|
607
|
+
signal?.aborted ? Promise.resolve(undefined as T) : fn(),
|
|
608
|
+
)
|
|
609
|
+
: signal?.aborted
|
|
610
|
+
? Promise.resolve(undefined as T)
|
|
611
|
+
: fn();
|
|
464
612
|
|
|
465
613
|
try {
|
|
466
614
|
if (req.kind === 'ask') {
|
|
467
615
|
await onLane('room:ask', async () => {
|
|
468
616
|
const base = {
|
|
469
|
-
...(await askContext()),
|
|
470
|
-
prompt:
|
|
617
|
+
...(req.projectPlan ? { user: { name: '' } } : await askContext(req.prompt)),
|
|
618
|
+
prompt:
|
|
619
|
+
req.handoff && !req.resume
|
|
620
|
+
? handoffPrompt(req.prompt, req.handoff, { coding: false })
|
|
621
|
+
: req.prompt,
|
|
622
|
+
provider: req.resume ? undefined : req.provider,
|
|
623
|
+
projectPlan: req.projectPlan,
|
|
471
624
|
images: req.images,
|
|
472
625
|
requestId: req.id,
|
|
473
626
|
onApproval: deps.controls
|
|
@@ -488,7 +641,7 @@ export async function dispatchRequest(
|
|
|
488
641
|
// attempt with a first-output deadline. Yields nothing in time → retry once
|
|
489
642
|
// fresh so the turn still lands and a new session id is captured. A user
|
|
490
643
|
// cancel (`signal.aborted`) must not retry. Mirrors runCodeTurn.
|
|
491
|
-
const resumed = req.resume
|
|
644
|
+
const resumed = req.resume && !req.projectPlan
|
|
492
645
|
? await consumeResumed(
|
|
493
646
|
(sig) =>
|
|
494
647
|
harness.askStream({
|
|
@@ -516,7 +669,7 @@ export async function dispatchRequest(
|
|
|
516
669
|
onEvent(ev);
|
|
517
670
|
}
|
|
518
671
|
} else {
|
|
519
|
-
const reply = await harness.ask({ ...base, resume: req.resume });
|
|
672
|
+
const reply = await harness.ask({ ...base, resume: req.projectPlan ? undefined : req.resume });
|
|
520
673
|
send({
|
|
521
674
|
requestId: req.id,
|
|
522
675
|
kind: 'ask',
|
|
@@ -621,6 +774,23 @@ export async function dispatchRequest(
|
|
|
621
774
|
requestId: req.id,
|
|
622
775
|
message: 'Cloning is not enabled on this daemon yet.',
|
|
623
776
|
});
|
|
777
|
+
} else if (req.kind === 'transcribe') {
|
|
778
|
+
if (!deps.speech)
|
|
779
|
+
throw new Error(
|
|
780
|
+
'Speech recognition is not installed on this computer.',
|
|
781
|
+
);
|
|
782
|
+
const transcript = await onLane('speech', () =>
|
|
783
|
+
deps.speech!.transcribe(req.audio, signal),
|
|
784
|
+
);
|
|
785
|
+
send({ requestId: req.id, kind: 'transcription', transcript });
|
|
786
|
+
} else if (req.kind === 'getAutomations' || req.kind === 'automation') {
|
|
787
|
+
if (!deps.automations)
|
|
788
|
+
throw new Error('Update Lucidity on your computer to use automations.');
|
|
789
|
+
const snapshot =
|
|
790
|
+
req.kind === 'getAutomations'
|
|
791
|
+
? deps.automations.snapshot(req)
|
|
792
|
+
: await deps.automations.command(req.command);
|
|
793
|
+
send({ requestId: req.id, kind: 'automations', snapshot });
|
|
624
794
|
} else if (req.kind === 'getConfig') {
|
|
625
795
|
// Daemon Settings read: reply with the redacted config (secrets stripped).
|
|
626
796
|
if (deps.getConfig)
|
|
@@ -697,6 +867,8 @@ export async function dispatchRequest(
|
|
|
697
867
|
prompt: req.prompt,
|
|
698
868
|
images: req.images,
|
|
699
869
|
resume: req.resume,
|
|
870
|
+
provider: req.provider,
|
|
871
|
+
handoff: req.handoff,
|
|
700
872
|
mode: req.mode,
|
|
701
873
|
expectedBranch: req.expectedBranch,
|
|
702
874
|
workerId: req.workerId,
|
|
@@ -725,11 +897,14 @@ export async function dispatchRequest(
|
|
|
725
897
|
}
|
|
726
898
|
|
|
727
899
|
export interface RoomClientOptions {
|
|
900
|
+
speech?: SpeechService;
|
|
901
|
+
capturesDir?: string;
|
|
728
902
|
computerId?: string;
|
|
729
903
|
providerHealth?: () => { claude: ProviderHealth; codex: ProviderHealth };
|
|
730
904
|
onProviderHealth?: (listener: () => void) => () => void;
|
|
731
905
|
controls?: AgentControls;
|
|
732
906
|
models?: (provider: AgentProvider) => Promise<ExecutorModel[]>;
|
|
907
|
+
commands?: (provider: AgentProvider, context?: AgentCommandContext) => Promise<AgentCommandOption[]>;
|
|
733
908
|
config: DaemonConfig;
|
|
734
909
|
harness: LucidHarness;
|
|
735
910
|
vault: Vault;
|
|
@@ -747,6 +922,7 @@ export interface RoomClientOptions {
|
|
|
747
922
|
cloneHandler?: CloneHandler;
|
|
748
923
|
/** Read the daemon's redacted config for the phone's Daemon Settings screen. */
|
|
749
924
|
getConfig?: () => DaemonConfigView;
|
|
925
|
+
automations?: AutomationService;
|
|
750
926
|
/** Persist + live-apply a config patch from Daemon Settings; reports restart intent. */
|
|
751
927
|
setConfig?: (
|
|
752
928
|
patch: DaemonConfigPatch,
|
|
@@ -898,9 +1074,10 @@ export function startRoomClient(opts: RoomClientOptions): RoomClientHandle {
|
|
|
898
1074
|
const url =
|
|
899
1075
|
roomUrl(config.apiUrl, config.machineName) +
|
|
900
1076
|
`&device=${encodeURIComponent(identity)}`;
|
|
901
|
-
const askContext = () => loadAskContext(config, vault);
|
|
1077
|
+
const askContext = (query?: string) => loadAskContext(config, vault, query);
|
|
902
1078
|
const briefingContext = () => loadBriefingContext(config, vault);
|
|
903
1079
|
const turnLogs = opts.turnLogs ?? new TurnLogStore();
|
|
1080
|
+
const executionLanes = queue ?? new LaneQueue();
|
|
904
1081
|
// The daemon's side of an incident bundle (#314): a rolling connection timeline the
|
|
905
1082
|
// `incident` handler joins to the turn log. In-memory — the durable evidence is the turn log.
|
|
906
1083
|
const telemetry = new RoomTelemetry();
|
|
@@ -912,6 +1089,8 @@ export function startRoomClient(opts: RoomClientOptions): RoomClientHandle {
|
|
|
912
1089
|
// Survives reconnects — an in-flight run outlives a dropped socket, so a `cancel`
|
|
913
1090
|
// sent after re-dialing must still be able to find and abort it.
|
|
914
1091
|
const inFlight = new Map<string, AbortController>();
|
|
1092
|
+
let durableQueue: DurableTurnQueue | undefined;
|
|
1093
|
+
let captures: VoiceCaptureService | undefined;
|
|
915
1094
|
|
|
916
1095
|
// Send to whatever socket is CURRENT, read fresh each call — an in-flight turn started
|
|
917
1096
|
// on a socket that later dropped must deliver its remaining frames to the reconnected
|
|
@@ -941,6 +1120,7 @@ export function startRoomClient(opts: RoomClientOptions): RoomClientHandle {
|
|
|
941
1120
|
typeof rec.requestId === 'string'
|
|
942
1121
|
) {
|
|
943
1122
|
sendRaw(turnLogs.append(rec.requestId, rec));
|
|
1123
|
+
durableQueue?.wake();
|
|
944
1124
|
return;
|
|
945
1125
|
}
|
|
946
1126
|
}
|
|
@@ -1001,6 +1181,122 @@ export function startRoomClient(opts: RoomClientOptions): RoomClientHandle {
|
|
|
1001
1181
|
reconnectTimer.unref?.();
|
|
1002
1182
|
}
|
|
1003
1183
|
|
|
1184
|
+
const dispatch = (raw: string, overrides: Partial<DispatchDeps> = {}) =>
|
|
1185
|
+
dispatchRequest(raw, {
|
|
1186
|
+
harness,
|
|
1187
|
+
recordAcceptance: true,
|
|
1188
|
+
runtime: opts.providerHealth ? () => computerRuntime(opts) : undefined,
|
|
1189
|
+
controls: opts.controls,
|
|
1190
|
+
models: opts.models,
|
|
1191
|
+
commands: opts.commands,
|
|
1192
|
+
askContext,
|
|
1193
|
+
briefingContext,
|
|
1194
|
+
send: turnSend,
|
|
1195
|
+
sendRaw,
|
|
1196
|
+
turnLogs,
|
|
1197
|
+
signal,
|
|
1198
|
+
codeHandler,
|
|
1199
|
+
conductHandler,
|
|
1200
|
+
cloneHandler,
|
|
1201
|
+
queue: executionLanes,
|
|
1202
|
+
inFlight,
|
|
1203
|
+
attention: opts.attention,
|
|
1204
|
+
logger: log,
|
|
1205
|
+
// Live allowlist (#78) + each row's live branch (#121); shared with pushRepos above.
|
|
1206
|
+
listRepos,
|
|
1207
|
+
listPrs: (repoId, mode) => resolvePrs(repoId, mode, config),
|
|
1208
|
+
getConfig,
|
|
1209
|
+
speech: opts.speech,
|
|
1210
|
+
captures,
|
|
1211
|
+
automations: opts.automations,
|
|
1212
|
+
setConfig: setConfig
|
|
1213
|
+
? (patch, restart) => {
|
|
1214
|
+
const result = setConfig(patch, restart);
|
|
1215
|
+
publishComputer();
|
|
1216
|
+
return result;
|
|
1217
|
+
}
|
|
1218
|
+
: undefined,
|
|
1219
|
+
requestRestart,
|
|
1220
|
+
telemetry,
|
|
1221
|
+
machine: config.machineName,
|
|
1222
|
+
incidentsDir: opts.incidentsDir,
|
|
1223
|
+
|
|
1224
|
+
turnQueue: durableQueue,
|
|
1225
|
+
...overrides,
|
|
1226
|
+
});
|
|
1227
|
+
durableQueue = new DurableTurnQueue({
|
|
1228
|
+
dir: turnLogs.queueDirectory(),
|
|
1229
|
+
logs: turnLogs,
|
|
1230
|
+
lanes: executionLanes,
|
|
1231
|
+
sendRaw,
|
|
1232
|
+
execute: (request) =>
|
|
1233
|
+
dispatch(JSON.stringify(request), {
|
|
1234
|
+
recordAcceptance: false,
|
|
1235
|
+
queue: undefined,
|
|
1236
|
+
}),
|
|
1237
|
+
steer: opts.controls
|
|
1238
|
+
? (targetId, prompt) => opts.controls!.steer(targetId, prompt)
|
|
1239
|
+
: undefined,
|
|
1240
|
+
});
|
|
1241
|
+
durableQueue.wake();
|
|
1242
|
+
|
|
1243
|
+
if (opts.speech) {
|
|
1244
|
+
// Never resume another account's queued commands after replacing credentials.
|
|
1245
|
+
const account = createHash('sha256')
|
|
1246
|
+
.update(`${config.apiUrl}\n${config.apiKey}`)
|
|
1247
|
+
.digest('hex');
|
|
1248
|
+
try {
|
|
1249
|
+
captures = new VoiceCaptureService({
|
|
1250
|
+
directory:
|
|
1251
|
+
opts.capturesDir ?? join(CONFIG_DIR, 'voice-captures', account),
|
|
1252
|
+
logger: log,
|
|
1253
|
+
transcribe: (audio, signal) =>
|
|
1254
|
+
executionLanes.run('speech', () =>
|
|
1255
|
+
opts.speech!.transcribe(audio, signal),
|
|
1256
|
+
),
|
|
1257
|
+
act: async (transcript, signal) => {
|
|
1258
|
+
let answer: string | undefined;
|
|
1259
|
+
let failure: string | undefined;
|
|
1260
|
+
await dispatch(
|
|
1261
|
+
JSON.stringify({
|
|
1262
|
+
id: uuidv7(),
|
|
1263
|
+
kind: 'ask',
|
|
1264
|
+
prompt: transcript,
|
|
1265
|
+
stream: false,
|
|
1266
|
+
}),
|
|
1267
|
+
{
|
|
1268
|
+
signal,
|
|
1269
|
+
recordAcceptance: false,
|
|
1270
|
+
// The Watch has no approval UI. Provider defaults deny requests that
|
|
1271
|
+
// require an interactive decision; the user's existing tool scope applies.
|
|
1272
|
+
controls: undefined,
|
|
1273
|
+
send: (frame) => {
|
|
1274
|
+
const result = frame as {
|
|
1275
|
+
kind?: string;
|
|
1276
|
+
type?: string;
|
|
1277
|
+
text?: string;
|
|
1278
|
+
message?: string;
|
|
1279
|
+
};
|
|
1280
|
+
if (result.kind === 'ask') answer = result.text;
|
|
1281
|
+
if (result.type === 'error') failure = result.message;
|
|
1282
|
+
},
|
|
1283
|
+
},
|
|
1284
|
+
);
|
|
1285
|
+
if (failure || answer === undefined)
|
|
1286
|
+
throw new Error('Voice action did not finish.');
|
|
1287
|
+
return answer;
|
|
1288
|
+
},
|
|
1289
|
+
});
|
|
1290
|
+
captures.wake();
|
|
1291
|
+
} catch {
|
|
1292
|
+
// Preserve the receipt ledger: disabling capture prevents replay while
|
|
1293
|
+
// leaving the computer's other features available.
|
|
1294
|
+
log(
|
|
1295
|
+
'Voice capture is disabled because its saved receipts could not be opened.',
|
|
1296
|
+
);
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1004
1300
|
function connect(): void {
|
|
1005
1301
|
if (stopped) return;
|
|
1006
1302
|
const ws = new WebSocket(url, {
|
|
@@ -1036,41 +1332,7 @@ export function startRoomClient(opts: RoomClientOptions): RoomClientHandle {
|
|
|
1036
1332
|
const raw = Array.isArray(data)
|
|
1037
1333
|
? Buffer.concat(data).toString()
|
|
1038
1334
|
: data.toString();
|
|
1039
|
-
void
|
|
1040
|
-
harness,
|
|
1041
|
-
recordAcceptance: true,
|
|
1042
|
-
runtime: opts.providerHealth ? () => computerRuntime(opts) : undefined,
|
|
1043
|
-
controls: opts.controls,
|
|
1044
|
-
models: opts.models,
|
|
1045
|
-
askContext,
|
|
1046
|
-
briefingContext,
|
|
1047
|
-
send: turnSend,
|
|
1048
|
-
sendRaw,
|
|
1049
|
-
turnLogs,
|
|
1050
|
-
signal,
|
|
1051
|
-
codeHandler,
|
|
1052
|
-
conductHandler,
|
|
1053
|
-
cloneHandler,
|
|
1054
|
-
queue,
|
|
1055
|
-
inFlight,
|
|
1056
|
-
attention: opts.attention,
|
|
1057
|
-
logger: log,
|
|
1058
|
-
// Live allowlist (#78) + each row's live branch (#121); shared with pushRepos above.
|
|
1059
|
-
listRepos,
|
|
1060
|
-
listPrs: (repoId, mode) => resolvePrs(repoId, mode, config),
|
|
1061
|
-
getConfig,
|
|
1062
|
-
setConfig: setConfig
|
|
1063
|
-
? (patch, restart) => {
|
|
1064
|
-
const result = setConfig(patch, restart);
|
|
1065
|
-
publishComputer();
|
|
1066
|
-
return result;
|
|
1067
|
-
}
|
|
1068
|
-
: undefined,
|
|
1069
|
-
requestRestart,
|
|
1070
|
-
telemetry,
|
|
1071
|
-
machine: config.machineName,
|
|
1072
|
-
incidentsDir: opts.incidentsDir,
|
|
1073
|
-
}).catch((err) => {
|
|
1335
|
+
void dispatch(raw).catch((err) => {
|
|
1074
1336
|
log(
|
|
1075
1337
|
`dispatch error: ${err instanceof Error ? err.message : String(err)}`,
|
|
1076
1338
|
);
|
|
@@ -1118,6 +1380,8 @@ export function startRoomClient(opts: RoomClientOptions): RoomClientHandle {
|
|
|
1118
1380
|
function stop(): void {
|
|
1119
1381
|
if (stopped) return;
|
|
1120
1382
|
stopped = true;
|
|
1383
|
+
captures?.stop();
|
|
1384
|
+
durableQueue?.stop();
|
|
1121
1385
|
clearInterval(redialWatchdog);
|
|
1122
1386
|
unsubscribeHealth?.();
|
|
1123
1387
|
if (reconnectTimer) {
|
package/src/room/computer.ts
CHANGED
|
@@ -39,21 +39,29 @@ export function computerRuntime(opts: RoomClientOptions): ComputerRuntime {
|
|
|
39
39
|
protocol: COMPUTER_PROTOCOL,
|
|
40
40
|
features: [
|
|
41
41
|
'ask',
|
|
42
|
+
'project-plan',
|
|
42
43
|
'briefing',
|
|
43
44
|
'journal',
|
|
44
45
|
'repos',
|
|
45
46
|
'prs',
|
|
46
47
|
'pull',
|
|
47
48
|
'cancel',
|
|
49
|
+
'turn-queue',
|
|
50
|
+
'queue-control',
|
|
51
|
+
'provider-handoff',
|
|
48
52
|
'incident',
|
|
49
53
|
'voice-diag',
|
|
54
|
+
...(opts.speech?.view().available ? ['transcribe'] : []),
|
|
55
|
+
...(opts.speech ? ['voice-capture', 'voice-capture-status'] : []),
|
|
50
56
|
...(opts.models ? ['models'] : []),
|
|
57
|
+
...(opts.commands ? ['commands'] : []),
|
|
51
58
|
...(opts.controls ? ['permission', 'steer'] : []),
|
|
52
59
|
...(opts.codeHandler ? ['code'] : []),
|
|
53
60
|
...(opts.conductHandler ? ['conduct'] : []),
|
|
54
61
|
...(opts.cloneHandler ? ['clone'] : []),
|
|
55
62
|
...(opts.attention ? ['attention'] : []),
|
|
56
63
|
...(opts.getConfig ? ['getConfig'] : []),
|
|
64
|
+
...(opts.automations ? ['getAutomations', 'automation'] : []),
|
|
57
65
|
...(opts.setConfig ? ['setConfig'] : []),
|
|
58
66
|
],
|
|
59
67
|
permissions: [
|
package/src/room/context.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { createApiClient } from '@lucidity/runtime';
|
|
1
|
+
import { createApiClient, loadJournalContext } from '@lucidity/runtime';
|
|
2
|
+
import { privateJournalBackend } from '@lucidity/notes';
|
|
2
3
|
import type { Task, User } from '@lucidity/shared';
|
|
3
4
|
import type { DaemonConfig, EffortLevel } from '../config.js';
|
|
4
5
|
import type { Vault } from '../vault.js';
|
|
@@ -8,7 +9,7 @@ import { loadFlaggedTasks } from '../importantTasks.js';
|
|
|
8
9
|
/**
|
|
9
10
|
* Per-request context gatherers for the room client. The harness bakes in the
|
|
10
11
|
* persona at construction; everything else (who the user is, durable memory, a
|
|
11
|
-
* recent-notes
|
|
12
|
+
* recent-notes and journal digests, a task snapshot) is assembled here per turn, mirroring
|
|
12
13
|
* the chat server's turn-1 build and the briefing job. All API reads are
|
|
13
14
|
* best-effort: offline → Lucid still answers, just with less context.
|
|
14
15
|
*/
|
|
@@ -17,6 +18,7 @@ export interface AskContext {
|
|
|
17
18
|
user: Pick<User, 'name'>;
|
|
18
19
|
memory?: string;
|
|
19
20
|
notes?: string;
|
|
21
|
+
journal?: string;
|
|
20
22
|
context?: string;
|
|
21
23
|
/** The Chat pair — Ask Lucid + voice run on the latency-tuned model, not the daemon's
|
|
22
24
|
* batch default. Spread straight onto the harness AskInput by the room ask handler. */
|
|
@@ -41,21 +43,27 @@ function memoryFrom(vault: Vault): string | undefined {
|
|
|
41
43
|
export async function loadAskContext(
|
|
42
44
|
config: DaemonConfig,
|
|
43
45
|
vault: Vault,
|
|
46
|
+
query?: string,
|
|
44
47
|
): Promise<AskContext> {
|
|
45
48
|
const memory = memoryFrom(vault);
|
|
46
49
|
const notes = loadNotesContext(config);
|
|
47
50
|
let name = '';
|
|
48
51
|
let context: string | undefined;
|
|
52
|
+
let journal: string | undefined;
|
|
49
53
|
try {
|
|
50
54
|
const api = createApiClient({
|
|
51
55
|
apiUrl: config.apiUrl,
|
|
52
56
|
apiKey: config.apiKey,
|
|
53
57
|
});
|
|
54
|
-
const [tasks, user] = await Promise.all([
|
|
58
|
+
const [tasks, user, journalDigest] = await Promise.all([
|
|
55
59
|
api.request<Task[]>('/api/tasks/today').catch(() => [] as Task[]),
|
|
56
60
|
api.request<User>('/api/users/me'),
|
|
61
|
+
privateJournalBackend((path) => api.request(path), config.notesPath)
|
|
62
|
+
.then((backend) => loadJournalContext(api, { query, backend }))
|
|
63
|
+
.catch(() => undefined),
|
|
57
64
|
]);
|
|
58
65
|
name = user.name ?? '';
|
|
66
|
+
journal = journalDigest?.text;
|
|
59
67
|
const titles = tasks.map((t) => t.title).filter(Boolean);
|
|
60
68
|
if (titles.length) context = `Today/overdue tasks: ${titles.join('; ')}`;
|
|
61
69
|
} catch {
|
|
@@ -65,6 +73,7 @@ export async function loadAskContext(
|
|
|
65
73
|
user: { name },
|
|
66
74
|
memory,
|
|
67
75
|
notes,
|
|
76
|
+
journal,
|
|
68
77
|
context,
|
|
69
78
|
model: config.chatModel,
|
|
70
79
|
effort: config.chatEffort,
|