@opencorelabs/lucidity 0.3.0 → 0.7.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 +18 -3
- 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 +185 -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 +266 -47
- package/dist/room/computer.d.ts.map +1 -1
- package/dist/room/computer.js +9 -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 +202 -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 +320 -54
- package/src/room/computer.ts +9 -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/dayPlan.d.ts +9 -0
- package/vendor/decisions/dist/dayPlan.js +82 -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 +6 -0
- package/vendor/decisions/dist/index.js +6 -0
- package/vendor/decisions/dist/jev.d.ts +15 -0
- package/vendor/decisions/dist/jev.js +244 -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/dayPlan.ts +80 -0
- package/vendor/decisions/src/gate.ts +32 -0
- package/vendor/decisions/src/index.ts +6 -0
- package/vendor/decisions/src/jev.ts +295 -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 +117 -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 +214 -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 +10 -0
- package/vendor/runtime/dist/executor/types.d.ts.map +1 -1
- package/vendor/runtime/dist/harness/index.d.ts +2 -0
- package/vendor/runtime/dist/harness/index.d.ts.map +1 -1
- package/vendor/runtime/dist/harness/index.js +46 -1
- package/vendor/runtime/dist/harness/types.d.ts +5 -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/dayPlanning.d.ts +44 -0
- package/vendor/runtime/dist/prompts/dayPlanning.d.ts.map +1 -0
- package/vendor/runtime/dist/prompts/dayPlanning.js +42 -0
- 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 +137 -7
- package/vendor/runtime/src/executor/claudeCode.ts +6 -4
- package/vendor/runtime/src/executor/codex.ts +281 -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 +10 -0
- package/vendor/runtime/src/harness/index.ts +51 -6
- package/vendor/runtime/src/harness/types.ts +5 -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/dayPlanning.ts +46 -0
- 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 +664 -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 +1534 -0
- package/vendor/shared/dist/commands.d.ts.map +1 -0
- package/vendor/shared/dist/commands.js +233 -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 +12 -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/dayPlan.d.ts +86 -0
- package/vendor/shared/dist/dayPlan.d.ts.map +1 -0
- package/vendor/shared/dist/dayPlan.js +46 -0
- package/vendor/shared/dist/dayPlanning.d.ts +139 -0
- package/vendor/shared/dist/dayPlanning.d.ts.map +1 -0
- package/vendor/shared/dist/dayPlanning.js +67 -0
- 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 +28 -2
- package/vendor/shared/dist/index.d.ts.map +1 -1
- package/vendor/shared/dist/index.js +25 -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 +976 -59
- package/vendor/shared/dist/schemas/harness.d.ts.map +1 -1
- package/vendor/shared/dist/schemas/harness.js +124 -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 +740 -0
- package/vendor/shared/src/commandText.ts +25 -0
- package/vendor/shared/src/commands.ts +255 -0
- package/vendor/shared/src/computer.ts +25 -6
- package/vendor/shared/src/constants.ts +9 -2
- package/vendor/shared/src/dayPlan.ts +81 -0
- package/vendor/shared/src/dayPlanning.ts +77 -0
- package/vendor/shared/src/githubContributions.ts +70 -0
- package/vendor/shared/src/habitContributions.ts +144 -0
- package/vendor/shared/src/index.ts +44 -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 +146 -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,19 +263,101 @@ 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 structured = req.kind === 'ask' && (req.dayPlan ? 'day-plan' : req.projectPlan ? 'project-plan' : undefined);
|
|
285
|
+
const send = (frame: unknown) => sendFrame(structured
|
|
286
|
+
? { ...(frame as Record<string, unknown>), purpose: structured } : frame);
|
|
287
|
+
if (req.kind === 'voice-capture' || req.kind === 'voice-capture-status') {
|
|
288
|
+
try {
|
|
289
|
+
if (!deps.captures)
|
|
290
|
+
throw new Error(
|
|
291
|
+
'Update Lucidity on your computer to receive Watch recordings.',
|
|
292
|
+
);
|
|
293
|
+
// Existing receipts remain readable even if the provider later signs out.
|
|
294
|
+
const previous = deps.captures.status(req.credentialId, req.captureId);
|
|
295
|
+
if (req.kind === 'voice-capture' && !previous && deps.runtime) {
|
|
296
|
+
for (const feature of ['transcribe', 'ask']) {
|
|
297
|
+
const availability = computerAvailability(
|
|
298
|
+
{
|
|
299
|
+
type: 'presence',
|
|
300
|
+
daemonConnected: true,
|
|
301
|
+
runtime: deps.runtime(),
|
|
302
|
+
},
|
|
303
|
+
'online',
|
|
304
|
+
feature,
|
|
305
|
+
);
|
|
306
|
+
if (!availability.canSend)
|
|
307
|
+
throw new Error(`${availability.title}. ${availability.detail}`);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
const receipt =
|
|
311
|
+
req.kind === 'voice-capture'
|
|
312
|
+
? deps.captures.submit(req.credentialId, {
|
|
313
|
+
captureId: req.captureId,
|
|
314
|
+
audio: req.audio,
|
|
315
|
+
})
|
|
316
|
+
: previous;
|
|
317
|
+
send({ requestId: req.id, kind: 'voice-capture', receipt });
|
|
318
|
+
} catch (error) {
|
|
319
|
+
send({
|
|
320
|
+
type: 'error',
|
|
321
|
+
requestId: req.id,
|
|
322
|
+
message:
|
|
323
|
+
error instanceof Error
|
|
324
|
+
? error.message
|
|
325
|
+
: 'Voice capture is unavailable.',
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
253
330
|
deps.telemetry?.record('request', req.kind, req.id);
|
|
331
|
+
if (req.kind === 'queue-control') {
|
|
332
|
+
try {
|
|
333
|
+
if (!deps.turnQueue)
|
|
334
|
+
throw new Error(
|
|
335
|
+
'Update Lucidity on your computer to manage queued messages.',
|
|
336
|
+
);
|
|
337
|
+
await deps.turnQueue.control(req.targetId, req.action, req.activeId);
|
|
338
|
+
send({ kind: 'control', requestId: req.id, accepted: true });
|
|
339
|
+
} catch (error) {
|
|
340
|
+
send({
|
|
341
|
+
kind: 'control',
|
|
342
|
+
requestId: req.id,
|
|
343
|
+
accepted: false,
|
|
344
|
+
message: (error as Error).message,
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
254
349
|
if (
|
|
255
350
|
deps.runtime &&
|
|
256
351
|
!['pull', 'cancel', 'permission', 'steer'].includes(req.kind)
|
|
257
352
|
) {
|
|
258
353
|
let provider: AgentProvider | undefined;
|
|
259
354
|
try {
|
|
260
|
-
provider =
|
|
355
|
+
provider = req.kind === 'ask' && req.dayPlan ? deps.runtime().defaults.code :
|
|
261
356
|
'resume' in req && req.resume
|
|
262
357
|
? decodeSession(req.resume).provider
|
|
263
|
-
:
|
|
358
|
+
: 'provider' in req
|
|
359
|
+
? req.provider
|
|
360
|
+
: undefined;
|
|
264
361
|
} catch {
|
|
265
362
|
send({
|
|
266
363
|
type: 'error',
|
|
@@ -273,7 +370,7 @@ export async function dispatchRequest(
|
|
|
273
370
|
const availability = computerAvailability(
|
|
274
371
|
{ type: 'presence', daemonConnected: true, runtime: deps.runtime() },
|
|
275
372
|
'online',
|
|
276
|
-
req.kind,
|
|
373
|
+
req.kind === 'ask' && req.dayPlan ? 'day-plan' : req.kind,
|
|
277
374
|
provider,
|
|
278
375
|
);
|
|
279
376
|
if (!availability.canSend) {
|
|
@@ -348,6 +445,26 @@ export async function dispatchRequest(
|
|
|
348
445
|
send({ kind: 'control', requestId: req.id, ...result });
|
|
349
446
|
return;
|
|
350
447
|
}
|
|
448
|
+
if (req.kind === 'commands') {
|
|
449
|
+
try {
|
|
450
|
+
if (!deps.commands)
|
|
451
|
+
throw new Error('Update Lucidity on your computer to use commands.');
|
|
452
|
+
send({
|
|
453
|
+
kind: 'commands',
|
|
454
|
+
requestId: req.id,
|
|
455
|
+
provider: req.provider,
|
|
456
|
+
commands: await deps.commands(req.provider, req.context),
|
|
457
|
+
});
|
|
458
|
+
} catch (error) {
|
|
459
|
+
send({
|
|
460
|
+
type: 'error',
|
|
461
|
+
requestId: req.id,
|
|
462
|
+
message:
|
|
463
|
+
error instanceof Error ? error.message : 'Command discovery failed.',
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
351
468
|
if (req.kind === 'models') {
|
|
352
469
|
try {
|
|
353
470
|
send({
|
|
@@ -400,6 +517,7 @@ export async function dispatchRequest(
|
|
|
400
517
|
for (const frame of state.frames) {
|
|
401
518
|
if (frame.seq > req.sinceSeq) sendRaw(frame);
|
|
402
519
|
}
|
|
520
|
+
if (!state.terminated) deps.turnQueue?.confirm(req.targetId);
|
|
403
521
|
// A phone may already have every logged frame while the turn waits for its
|
|
404
522
|
// decision. Reconfirm that live approval with a new sequence so reconnect
|
|
405
523
|
// restores its controls instead of waiting forever for another model token.
|
|
@@ -409,7 +527,11 @@ export async function dispatchRequest(
|
|
|
409
527
|
// restarted mid-turn). Settle it with a synthesized, persisted terminal so the phone
|
|
410
528
|
// stops waiting and a repeat pull is idempotent. If it's still in `inFlight`, live
|
|
411
529
|
// frames past maxSeq keep flowing on the current socket (deduped by seq) — leave it.
|
|
412
|
-
if (
|
|
530
|
+
if (
|
|
531
|
+
!state.terminated &&
|
|
532
|
+
!inFlight?.has(req.targetId) &&
|
|
533
|
+
!deps.turnQueue?.owns(req.targetId)
|
|
534
|
+
) {
|
|
413
535
|
sendRaw(
|
|
414
536
|
turnLogs.append(req.targetId, {
|
|
415
537
|
type: 'error',
|
|
@@ -421,6 +543,21 @@ export async function dispatchRequest(
|
|
|
421
543
|
return;
|
|
422
544
|
}
|
|
423
545
|
|
|
546
|
+
if ((req.kind === 'ask' || req.kind === 'code') && req.queue) {
|
|
547
|
+
try {
|
|
548
|
+
if (!deps.turnQueue)
|
|
549
|
+
throw new Error('Update Lucidity on your computer to queue messages.');
|
|
550
|
+
deps.turnQueue.enqueue(req);
|
|
551
|
+
} catch (error) {
|
|
552
|
+
send({
|
|
553
|
+
type: 'error',
|
|
554
|
+
requestId: req.id,
|
|
555
|
+
message: (error as Error).message,
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
return;
|
|
559
|
+
}
|
|
560
|
+
|
|
424
561
|
if (
|
|
425
562
|
deps.recordAcceptance &&
|
|
426
563
|
['ask', 'code', 'conduct', 'briefing', 'attention', 'clone'].includes(
|
|
@@ -437,6 +574,12 @@ export async function dispatchRequest(
|
|
|
437
574
|
const accepted = deps.turnLogs.append(req.id, {
|
|
438
575
|
type: 'accepted',
|
|
439
576
|
requestId: req.id,
|
|
577
|
+
scope: {
|
|
578
|
+
kind: req.kind,
|
|
579
|
+
...('repoId' in req ? { repoId: req.repoId } : {}),
|
|
580
|
+
...('workerId' in req ? { workerId: req.workerId } : {}),
|
|
581
|
+
...('mode' in req ? { mode: req.mode } : {}),
|
|
582
|
+
},
|
|
440
583
|
});
|
|
441
584
|
if (!deps.turnLogs.read(req.id).exists) {
|
|
442
585
|
send({
|
|
@@ -460,14 +603,26 @@ export async function dispatchRequest(
|
|
|
460
603
|
// must still be cancellable, and the `signal?.aborted` checks below mean a cancel that lands
|
|
461
604
|
// while queued drops the run instead of starting it late.
|
|
462
605
|
const onLane = <T>(lane: string, fn: () => Promise<T>): Promise<T> =>
|
|
463
|
-
deps.queue
|
|
606
|
+
deps.queue
|
|
607
|
+
? deps.queue.run(lane, () =>
|
|
608
|
+
signal?.aborted ? Promise.resolve(undefined as T) : fn(),
|
|
609
|
+
)
|
|
610
|
+
: signal?.aborted
|
|
611
|
+
? Promise.resolve(undefined as T)
|
|
612
|
+
: fn();
|
|
464
613
|
|
|
465
614
|
try {
|
|
466
615
|
if (req.kind === 'ask') {
|
|
467
616
|
await onLane('room:ask', async () => {
|
|
468
617
|
const base = {
|
|
469
|
-
...(await askContext()),
|
|
470
|
-
prompt:
|
|
618
|
+
...(structured ? { user: { name: '' } } : await askContext(req.prompt)),
|
|
619
|
+
prompt:
|
|
620
|
+
req.handoff && !req.resume && !structured
|
|
621
|
+
? handoffPrompt(req.prompt, req.handoff, { coding: false })
|
|
622
|
+
: req.prompt,
|
|
623
|
+
provider: req.resume ? undefined : req.provider,
|
|
624
|
+
projectPlan: req.projectPlan,
|
|
625
|
+
dayPlan: req.dayPlan,
|
|
471
626
|
images: req.images,
|
|
472
627
|
requestId: req.id,
|
|
473
628
|
onApproval: deps.controls
|
|
@@ -488,7 +643,7 @@ export async function dispatchRequest(
|
|
|
488
643
|
// attempt with a first-output deadline. Yields nothing in time → retry once
|
|
489
644
|
// fresh so the turn still lands and a new session id is captured. A user
|
|
490
645
|
// cancel (`signal.aborted`) must not retry. Mirrors runCodeTurn.
|
|
491
|
-
const resumed = req.resume
|
|
646
|
+
const resumed = req.resume && !structured
|
|
492
647
|
? await consumeResumed(
|
|
493
648
|
(sig) =>
|
|
494
649
|
harness.askStream({
|
|
@@ -516,7 +671,7 @@ export async function dispatchRequest(
|
|
|
516
671
|
onEvent(ev);
|
|
517
672
|
}
|
|
518
673
|
} else {
|
|
519
|
-
const reply = await harness.ask({ ...base, resume: req.resume });
|
|
674
|
+
const reply = await harness.ask({ ...base, resume: structured ? undefined : req.resume });
|
|
520
675
|
send({
|
|
521
676
|
requestId: req.id,
|
|
522
677
|
kind: 'ask',
|
|
@@ -621,6 +776,23 @@ export async function dispatchRequest(
|
|
|
621
776
|
requestId: req.id,
|
|
622
777
|
message: 'Cloning is not enabled on this daemon yet.',
|
|
623
778
|
});
|
|
779
|
+
} else if (req.kind === 'transcribe') {
|
|
780
|
+
if (!deps.speech)
|
|
781
|
+
throw new Error(
|
|
782
|
+
'Speech recognition is not installed on this computer.',
|
|
783
|
+
);
|
|
784
|
+
const transcript = await onLane('speech', () =>
|
|
785
|
+
deps.speech!.transcribe(req.audio, signal),
|
|
786
|
+
);
|
|
787
|
+
send({ requestId: req.id, kind: 'transcription', transcript });
|
|
788
|
+
} else if (req.kind === 'getAutomations' || req.kind === 'automation') {
|
|
789
|
+
if (!deps.automations)
|
|
790
|
+
throw new Error('Update Lucidity on your computer to use automations.');
|
|
791
|
+
const snapshot =
|
|
792
|
+
req.kind === 'getAutomations'
|
|
793
|
+
? deps.automations.snapshot(req)
|
|
794
|
+
: await deps.automations.command(req.command);
|
|
795
|
+
send({ requestId: req.id, kind: 'automations', snapshot });
|
|
624
796
|
} else if (req.kind === 'getConfig') {
|
|
625
797
|
// Daemon Settings read: reply with the redacted config (secrets stripped).
|
|
626
798
|
if (deps.getConfig)
|
|
@@ -697,6 +869,8 @@ export async function dispatchRequest(
|
|
|
697
869
|
prompt: req.prompt,
|
|
698
870
|
images: req.images,
|
|
699
871
|
resume: req.resume,
|
|
872
|
+
provider: req.provider,
|
|
873
|
+
handoff: req.handoff,
|
|
700
874
|
mode: req.mode,
|
|
701
875
|
expectedBranch: req.expectedBranch,
|
|
702
876
|
workerId: req.workerId,
|
|
@@ -725,11 +899,14 @@ export async function dispatchRequest(
|
|
|
725
899
|
}
|
|
726
900
|
|
|
727
901
|
export interface RoomClientOptions {
|
|
902
|
+
speech?: SpeechService;
|
|
903
|
+
capturesDir?: string;
|
|
728
904
|
computerId?: string;
|
|
729
905
|
providerHealth?: () => { claude: ProviderHealth; codex: ProviderHealth };
|
|
730
906
|
onProviderHealth?: (listener: () => void) => () => void;
|
|
731
907
|
controls?: AgentControls;
|
|
732
908
|
models?: (provider: AgentProvider) => Promise<ExecutorModel[]>;
|
|
909
|
+
commands?: (provider: AgentProvider, context?: AgentCommandContext) => Promise<AgentCommandOption[]>;
|
|
733
910
|
config: DaemonConfig;
|
|
734
911
|
harness: LucidHarness;
|
|
735
912
|
vault: Vault;
|
|
@@ -747,6 +924,7 @@ export interface RoomClientOptions {
|
|
|
747
924
|
cloneHandler?: CloneHandler;
|
|
748
925
|
/** Read the daemon's redacted config for the phone's Daemon Settings screen. */
|
|
749
926
|
getConfig?: () => DaemonConfigView;
|
|
927
|
+
automations?: AutomationService;
|
|
750
928
|
/** Persist + live-apply a config patch from Daemon Settings; reports restart intent. */
|
|
751
929
|
setConfig?: (
|
|
752
930
|
patch: DaemonConfigPatch,
|
|
@@ -898,9 +1076,10 @@ export function startRoomClient(opts: RoomClientOptions): RoomClientHandle {
|
|
|
898
1076
|
const url =
|
|
899
1077
|
roomUrl(config.apiUrl, config.machineName) +
|
|
900
1078
|
`&device=${encodeURIComponent(identity)}`;
|
|
901
|
-
const askContext = () => loadAskContext(config, vault);
|
|
1079
|
+
const askContext = (query?: string) => loadAskContext(config, vault, query);
|
|
902
1080
|
const briefingContext = () => loadBriefingContext(config, vault);
|
|
903
1081
|
const turnLogs = opts.turnLogs ?? new TurnLogStore();
|
|
1082
|
+
const executionLanes = queue ?? new LaneQueue();
|
|
904
1083
|
// The daemon's side of an incident bundle (#314): a rolling connection timeline the
|
|
905
1084
|
// `incident` handler joins to the turn log. In-memory — the durable evidence is the turn log.
|
|
906
1085
|
const telemetry = new RoomTelemetry();
|
|
@@ -912,6 +1091,8 @@ export function startRoomClient(opts: RoomClientOptions): RoomClientHandle {
|
|
|
912
1091
|
// Survives reconnects — an in-flight run outlives a dropped socket, so a `cancel`
|
|
913
1092
|
// sent after re-dialing must still be able to find and abort it.
|
|
914
1093
|
const inFlight = new Map<string, AbortController>();
|
|
1094
|
+
let durableQueue: DurableTurnQueue | undefined;
|
|
1095
|
+
let captures: VoiceCaptureService | undefined;
|
|
915
1096
|
|
|
916
1097
|
// Send to whatever socket is CURRENT, read fresh each call — an in-flight turn started
|
|
917
1098
|
// on a socket that later dropped must deliver its remaining frames to the reconnected
|
|
@@ -941,6 +1122,7 @@ export function startRoomClient(opts: RoomClientOptions): RoomClientHandle {
|
|
|
941
1122
|
typeof rec.requestId === 'string'
|
|
942
1123
|
) {
|
|
943
1124
|
sendRaw(turnLogs.append(rec.requestId, rec));
|
|
1125
|
+
durableQueue?.wake();
|
|
944
1126
|
return;
|
|
945
1127
|
}
|
|
946
1128
|
}
|
|
@@ -1001,6 +1183,122 @@ export function startRoomClient(opts: RoomClientOptions): RoomClientHandle {
|
|
|
1001
1183
|
reconnectTimer.unref?.();
|
|
1002
1184
|
}
|
|
1003
1185
|
|
|
1186
|
+
const dispatch = (raw: string, overrides: Partial<DispatchDeps> = {}) =>
|
|
1187
|
+
dispatchRequest(raw, {
|
|
1188
|
+
harness,
|
|
1189
|
+
recordAcceptance: true,
|
|
1190
|
+
runtime: opts.providerHealth ? () => computerRuntime(opts) : undefined,
|
|
1191
|
+
controls: opts.controls,
|
|
1192
|
+
models: opts.models,
|
|
1193
|
+
commands: opts.commands,
|
|
1194
|
+
askContext,
|
|
1195
|
+
briefingContext,
|
|
1196
|
+
send: turnSend,
|
|
1197
|
+
sendRaw,
|
|
1198
|
+
turnLogs,
|
|
1199
|
+
signal,
|
|
1200
|
+
codeHandler,
|
|
1201
|
+
conductHandler,
|
|
1202
|
+
cloneHandler,
|
|
1203
|
+
queue: executionLanes,
|
|
1204
|
+
inFlight,
|
|
1205
|
+
attention: opts.attention,
|
|
1206
|
+
logger: log,
|
|
1207
|
+
// Live allowlist (#78) + each row's live branch (#121); shared with pushRepos above.
|
|
1208
|
+
listRepos,
|
|
1209
|
+
listPrs: (repoId, mode) => resolvePrs(repoId, mode, config),
|
|
1210
|
+
getConfig,
|
|
1211
|
+
speech: opts.speech,
|
|
1212
|
+
captures,
|
|
1213
|
+
automations: opts.automations,
|
|
1214
|
+
setConfig: setConfig
|
|
1215
|
+
? (patch, restart) => {
|
|
1216
|
+
const result = setConfig(patch, restart);
|
|
1217
|
+
publishComputer();
|
|
1218
|
+
return result;
|
|
1219
|
+
}
|
|
1220
|
+
: undefined,
|
|
1221
|
+
requestRestart,
|
|
1222
|
+
telemetry,
|
|
1223
|
+
machine: config.machineName,
|
|
1224
|
+
incidentsDir: opts.incidentsDir,
|
|
1225
|
+
|
|
1226
|
+
turnQueue: durableQueue,
|
|
1227
|
+
...overrides,
|
|
1228
|
+
});
|
|
1229
|
+
durableQueue = new DurableTurnQueue({
|
|
1230
|
+
dir: turnLogs.queueDirectory(),
|
|
1231
|
+
logs: turnLogs,
|
|
1232
|
+
lanes: executionLanes,
|
|
1233
|
+
sendRaw,
|
|
1234
|
+
execute: (request) =>
|
|
1235
|
+
dispatch(JSON.stringify(request), {
|
|
1236
|
+
recordAcceptance: false,
|
|
1237
|
+
queue: undefined,
|
|
1238
|
+
}),
|
|
1239
|
+
steer: opts.controls
|
|
1240
|
+
? (targetId, prompt) => opts.controls!.steer(targetId, prompt)
|
|
1241
|
+
: undefined,
|
|
1242
|
+
});
|
|
1243
|
+
durableQueue.wake();
|
|
1244
|
+
|
|
1245
|
+
if (opts.speech) {
|
|
1246
|
+
// Never resume another account's queued commands after replacing credentials.
|
|
1247
|
+
const account = createHash('sha256')
|
|
1248
|
+
.update(`${config.apiUrl}\n${config.apiKey}`)
|
|
1249
|
+
.digest('hex');
|
|
1250
|
+
try {
|
|
1251
|
+
captures = new VoiceCaptureService({
|
|
1252
|
+
directory:
|
|
1253
|
+
opts.capturesDir ?? join(CONFIG_DIR, 'voice-captures', account),
|
|
1254
|
+
logger: log,
|
|
1255
|
+
transcribe: (audio, signal) =>
|
|
1256
|
+
executionLanes.run('speech', () =>
|
|
1257
|
+
opts.speech!.transcribe(audio, signal),
|
|
1258
|
+
),
|
|
1259
|
+
act: async (transcript, signal) => {
|
|
1260
|
+
let answer: string | undefined;
|
|
1261
|
+
let failure: string | undefined;
|
|
1262
|
+
await dispatch(
|
|
1263
|
+
JSON.stringify({
|
|
1264
|
+
id: uuidv7(),
|
|
1265
|
+
kind: 'ask',
|
|
1266
|
+
prompt: transcript,
|
|
1267
|
+
stream: false,
|
|
1268
|
+
}),
|
|
1269
|
+
{
|
|
1270
|
+
signal,
|
|
1271
|
+
recordAcceptance: false,
|
|
1272
|
+
// The Watch has no approval UI. Provider defaults deny requests that
|
|
1273
|
+
// require an interactive decision; the user's existing tool scope applies.
|
|
1274
|
+
controls: undefined,
|
|
1275
|
+
send: (frame) => {
|
|
1276
|
+
const result = frame as {
|
|
1277
|
+
kind?: string;
|
|
1278
|
+
type?: string;
|
|
1279
|
+
text?: string;
|
|
1280
|
+
message?: string;
|
|
1281
|
+
};
|
|
1282
|
+
if (result.kind === 'ask') answer = result.text;
|
|
1283
|
+
if (result.type === 'error') failure = result.message;
|
|
1284
|
+
},
|
|
1285
|
+
},
|
|
1286
|
+
);
|
|
1287
|
+
if (failure || answer === undefined)
|
|
1288
|
+
throw new Error('Voice action did not finish.');
|
|
1289
|
+
return answer;
|
|
1290
|
+
},
|
|
1291
|
+
});
|
|
1292
|
+
captures.wake();
|
|
1293
|
+
} catch {
|
|
1294
|
+
// Preserve the receipt ledger: disabling capture prevents replay while
|
|
1295
|
+
// leaving the computer's other features available.
|
|
1296
|
+
log(
|
|
1297
|
+
'Voice capture is disabled because its saved receipts could not be opened.',
|
|
1298
|
+
);
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1004
1302
|
function connect(): void {
|
|
1005
1303
|
if (stopped) return;
|
|
1006
1304
|
const ws = new WebSocket(url, {
|
|
@@ -1036,41 +1334,7 @@ export function startRoomClient(opts: RoomClientOptions): RoomClientHandle {
|
|
|
1036
1334
|
const raw = Array.isArray(data)
|
|
1037
1335
|
? Buffer.concat(data).toString()
|
|
1038
1336
|
: 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) => {
|
|
1337
|
+
void dispatch(raw).catch((err) => {
|
|
1074
1338
|
log(
|
|
1075
1339
|
`dispatch error: ${err instanceof Error ? err.message : String(err)}`,
|
|
1076
1340
|
);
|
|
@@ -1118,6 +1382,8 @@ export function startRoomClient(opts: RoomClientOptions): RoomClientHandle {
|
|
|
1118
1382
|
function stop(): void {
|
|
1119
1383
|
if (stopped) return;
|
|
1120
1384
|
stopped = true;
|
|
1385
|
+
captures?.stop();
|
|
1386
|
+
durableQueue?.stop();
|
|
1121
1387
|
clearInterval(redialWatchdog);
|
|
1122
1388
|
unsubscribeHealth?.();
|
|
1123
1389
|
if (reconnectTimer) {
|
package/src/room/computer.ts
CHANGED
|
@@ -39,21 +39,30 @@ export function computerRuntime(opts: RoomClientOptions): ComputerRuntime {
|
|
|
39
39
|
protocol: COMPUTER_PROTOCOL,
|
|
40
40
|
features: [
|
|
41
41
|
'ask',
|
|
42
|
+
'project-plan',
|
|
43
|
+
'day-plan',
|
|
42
44
|
'briefing',
|
|
43
45
|
'journal',
|
|
44
46
|
'repos',
|
|
45
47
|
'prs',
|
|
46
48
|
'pull',
|
|
47
49
|
'cancel',
|
|
50
|
+
'turn-queue',
|
|
51
|
+
'queue-control',
|
|
52
|
+
'provider-handoff',
|
|
48
53
|
'incident',
|
|
49
54
|
'voice-diag',
|
|
55
|
+
...(opts.speech?.view().available ? ['transcribe'] : []),
|
|
56
|
+
...(opts.speech ? ['voice-capture', 'voice-capture-status'] : []),
|
|
50
57
|
...(opts.models ? ['models'] : []),
|
|
58
|
+
...(opts.commands ? ['commands'] : []),
|
|
51
59
|
...(opts.controls ? ['permission', 'steer'] : []),
|
|
52
60
|
...(opts.codeHandler ? ['code'] : []),
|
|
53
61
|
...(opts.conductHandler ? ['conduct'] : []),
|
|
54
62
|
...(opts.cloneHandler ? ['clone'] : []),
|
|
55
63
|
...(opts.attention ? ['attention'] : []),
|
|
56
64
|
...(opts.getConfig ? ['getConfig'] : []),
|
|
65
|
+
...(opts.automations ? ['getAutomations', 'automation'] : []),
|
|
57
66
|
...(opts.setConfig ? ['setConfig'] : []),
|
|
58
67
|
],
|
|
59
68
|
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,
|