@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
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import {
|
|
3
|
+
VoiceCaptureAudioSchema,
|
|
4
|
+
VoiceCaptureReceiptSchema,
|
|
5
|
+
} from '../voiceCapture.js';
|
|
6
|
+
import {
|
|
7
|
+
ComputerSpeechSchema,
|
|
8
|
+
SpeechAudioSchema,
|
|
9
|
+
SpeechModelIdSchema,
|
|
10
|
+
SpeechTranscriptSchema,
|
|
11
|
+
} from '../speech.js';
|
|
12
|
+
import {
|
|
13
|
+
AutomationCommandSchema,
|
|
14
|
+
AutomationSnapshotSchema,
|
|
15
|
+
} from '../automations.js';
|
|
16
|
+
import { ProjectPlanningContextSchema } from '../projectCapture.js';
|
|
17
|
+
import { validatedCardSegments } from '../cardStatement.js';
|
|
2
18
|
import {
|
|
3
19
|
SENDER_KINDS,
|
|
4
20
|
HARNESS_REQUEST_KINDS,
|
|
@@ -44,14 +60,36 @@ export const HarnessImageSchema = z.object({
|
|
|
44
60
|
// At most a handful per turn — keeps the worst-case replay-buffer footprint bounded.
|
|
45
61
|
const harnessImagesField = z.array(HarnessImageSchema).max(6).optional();
|
|
46
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Carries a conversation over to the other provider, for when its own provider has run out of
|
|
65
|
+
* allowance or the user switches. The provider sessions can't share memory, so the new one gets
|
|
66
|
+
* the conversation as the phone shows it. Only read on a turn with no `resume`.
|
|
67
|
+
*/
|
|
68
|
+
export const ProviderHandoffSchema = z.object({
|
|
69
|
+
from: z.enum(['claude', 'codex']),
|
|
70
|
+
/** Oldest first, already trimmed by the phone to its most recent part. */
|
|
71
|
+
transcript: z.string().min(1).max(120_000),
|
|
72
|
+
});
|
|
73
|
+
export type ProviderHandoff = z.infer<typeof ProviderHandoffSchema>;
|
|
74
|
+
|
|
75
|
+
/** Start a new session on this provider instead of the configured default. Ignored with `resume`. */
|
|
76
|
+
const providerField = z.enum(['claude', 'codex']).optional();
|
|
77
|
+
|
|
47
78
|
// One-shot question to Lucid ("Ask Lucid"). The only kind that carries free text.
|
|
48
79
|
export const AskRequestSchema = HarnessRequestBase.extend({
|
|
49
80
|
kind: z.literal('ask'),
|
|
50
81
|
prompt: z.string().min(1).max(8000),
|
|
82
|
+
/** Feature-gated, tool-free project interpretation; never resumes a chat session. */
|
|
83
|
+
projectPlan: ProjectPlanningContextSchema.optional(),
|
|
51
84
|
/** Photos attached to the question (vision). Optional; absent on a text-only ask. */
|
|
52
85
|
images: harnessImagesField,
|
|
53
86
|
/** Claude Code session id to continue (conversation continuity via --resume). */
|
|
54
87
|
resume: z.string().optional(),
|
|
88
|
+
provider: providerField,
|
|
89
|
+
handoff: ProviderHandoffSchema.optional(),
|
|
90
|
+
/** Daemon-owned durable queue; feature-gated by turn-queue. */
|
|
91
|
+
queue: z.boolean().optional(),
|
|
92
|
+
afterRequestId: z.uuidv7().optional(),
|
|
55
93
|
});
|
|
56
94
|
|
|
57
95
|
// Today's briefing. The engine derives the content from the user's tasks, so no
|
|
@@ -80,6 +118,11 @@ export const CodeRequestSchema = HarnessRequestBase.extend({
|
|
|
80
118
|
/** Claude Code session id to continue — threads both the conversation (--resume)
|
|
81
119
|
* and the files (re-attach the session's lucid/<repoId> branch) across turns. */
|
|
82
120
|
resume: z.string().optional(),
|
|
121
|
+
provider: providerField,
|
|
122
|
+
/** Also keeps the workspace as it is, where a turn without `resume` would start it fresh. */
|
|
123
|
+
handoff: ProviderHandoffSchema.optional(),
|
|
124
|
+
queue: z.boolean().optional(),
|
|
125
|
+
afterRequestId: z.uuidv7().optional(),
|
|
83
126
|
/** Conductor worker id (a fleet subtask's id). Present when the phone drills into one
|
|
84
127
|
* worker of a fan-out and sends it a follow-up turn: the daemon runs it in that worker's
|
|
85
128
|
* isolated `fleet/<repoId>/<workerId>` worktree, on its own lane. Absent → the bare repo
|
|
@@ -329,13 +372,15 @@ const timeString = z
|
|
|
329
372
|
// The capability dial the phone can flip (GitHub #98). `connected` is reserved and not
|
|
330
373
|
// editable, so it's absent from the patch; the view reports it read-only.
|
|
331
374
|
export const DaemonCapabilitiesPatchSchema = z
|
|
332
|
-
.object({ tasks: z.boolean(), memory: z.boolean() })
|
|
375
|
+
.object({ tasks: z.boolean(), memory: z.boolean(), automations: z.boolean() })
|
|
333
376
|
.partial();
|
|
334
377
|
|
|
335
378
|
// The daemon's config as shown to the phone — every displayable field, with secrets
|
|
336
379
|
// (`apiKey`, `oauthToken`) redacted to a presence boolean. Read-only fields (paths,
|
|
337
380
|
// repo allowlist, apiUrl) are included so the screen can surface the whole config.
|
|
338
381
|
export const DaemonConfigViewSchema = z.object({
|
|
382
|
+
sttModel: SpeechModelIdSchema.optional(),
|
|
383
|
+
speech: ComputerSpeechSchema.optional(),
|
|
339
384
|
// Editable, applied live. Two role-scoped model/effort pairs: `chat*` drives the
|
|
340
385
|
// real-time turns a human waits on (Ask Lucid + voice), tuned for latency; `code*`
|
|
341
386
|
// drives repo coding turns and the batch jobs (briefing/weekly/attention), tuned
|
|
@@ -360,6 +405,7 @@ export const DaemonConfigViewSchema = z.object({
|
|
|
360
405
|
tasks: z.boolean(),
|
|
361
406
|
memory: z.boolean(),
|
|
362
407
|
connected: z.boolean(),
|
|
408
|
+
automations: z.boolean().optional(),
|
|
363
409
|
}),
|
|
364
410
|
// How much of the machine chat may touch (Puny God). Editable; restart-wired.
|
|
365
411
|
agentMode: z.enum(AGENT_MODES),
|
|
@@ -381,6 +427,7 @@ export const DaemonConfigViewSchema = z.object({
|
|
|
381
427
|
// and read-only fields are intentionally excluded, so the daemon rejects anything else.
|
|
382
428
|
export const DaemonConfigPatchSchema = z
|
|
383
429
|
.object({
|
|
430
|
+
sttModel: SpeechModelIdSchema,
|
|
384
431
|
chatProvider: z.enum(['claude', 'codex']),
|
|
385
432
|
codeProvider: z.enum(['claude', 'codex']),
|
|
386
433
|
chatModel: z.string().min(1),
|
|
@@ -407,6 +454,12 @@ export const SteerRequestSchema = HarnessRequestBase.extend({
|
|
|
407
454
|
targetId: z.uuidv7(),
|
|
408
455
|
prompt: z.string().trim().min(1).max(8000),
|
|
409
456
|
});
|
|
457
|
+
export const QueueControlRequestSchema = HarnessRequestBase.extend({
|
|
458
|
+
kind: z.literal('queue-control'),
|
|
459
|
+
targetId: z.uuidv7(),
|
|
460
|
+
action: z.enum(['cancel', 'steer']),
|
|
461
|
+
activeId: z.uuidv7().optional(),
|
|
462
|
+
});
|
|
410
463
|
export const PermissionRequestSchema = HarnessRequestBase.extend({
|
|
411
464
|
kind: z.literal('permission'),
|
|
412
465
|
targetId: z.uuidv7(),
|
|
@@ -418,6 +471,16 @@ export const ModelsRequestSchema = HarnessRequestBase.extend({
|
|
|
418
471
|
provider: AgentProviderSchema,
|
|
419
472
|
});
|
|
420
473
|
|
|
474
|
+
export const CommandsRequestSchema = HarnessRequestBase.extend({
|
|
475
|
+
kind: z.literal('commands'),
|
|
476
|
+
provider: AgentProviderSchema,
|
|
477
|
+
context: z.object({
|
|
478
|
+
repoId: z.string().min(1),
|
|
479
|
+
mode: z.enum(['worktree', 'in-place']).optional(),
|
|
480
|
+
workerId: z.string().min(1).optional(),
|
|
481
|
+
}).optional(),
|
|
482
|
+
});
|
|
483
|
+
|
|
421
484
|
// Read the daemon's current config for the Daemon Settings screen.
|
|
422
485
|
export const GetConfigRequestSchema = HarnessRequestBase.extend({
|
|
423
486
|
kind: z.literal('getConfig'),
|
|
@@ -441,9 +504,37 @@ export const AttentionRequestSchema = HarnessRequestBase.extend({
|
|
|
441
504
|
});
|
|
442
505
|
|
|
443
506
|
export const HarnessRequestSchema = z.discriminatedUnion('kind', [
|
|
507
|
+
HarnessRequestBase.extend({
|
|
508
|
+
kind: z.literal('voice-capture'),
|
|
509
|
+
credentialId: z.uuid(),
|
|
510
|
+
captureId: z.uuid(),
|
|
511
|
+
audio: VoiceCaptureAudioSchema,
|
|
512
|
+
}),
|
|
513
|
+
HarnessRequestBase.extend({
|
|
514
|
+
kind: z.literal('voice-capture-status'),
|
|
515
|
+
credentialId: z.uuid(),
|
|
516
|
+
captureId: z.uuid(),
|
|
517
|
+
}),
|
|
518
|
+
HarnessRequestBase.extend({
|
|
519
|
+
kind: z.literal('transcribe'),
|
|
520
|
+
audio: SpeechAudioSchema,
|
|
521
|
+
}),
|
|
522
|
+
HarnessRequestBase.extend({
|
|
523
|
+
kind: z.literal('getAutomations'),
|
|
524
|
+
jobId: z.string().max(120).optional(),
|
|
525
|
+
runId: z.string().max(120).optional(),
|
|
526
|
+
before: z.string().max(120).optional(),
|
|
527
|
+
limit: z.number().int().min(1).max(30).optional(),
|
|
528
|
+
}),
|
|
529
|
+
HarnessRequestBase.extend({
|
|
530
|
+
kind: z.literal('automation'),
|
|
531
|
+
command: AutomationCommandSchema,
|
|
532
|
+
}),
|
|
533
|
+
QueueControlRequestSchema,
|
|
444
534
|
SteerRequestSchema,
|
|
445
535
|
PermissionRequestSchema,
|
|
446
536
|
ModelsRequestSchema,
|
|
537
|
+
CommandsRequestSchema,
|
|
447
538
|
AskRequestSchema,
|
|
448
539
|
BriefingRequestSchema,
|
|
449
540
|
JournalRequestSchema,
|
|
@@ -513,11 +604,20 @@ export const DeviceConflictSchema = z.object({
|
|
|
513
604
|
// The cost of having no `requestId` is that the relay won't hold it for a phone that's offline,
|
|
514
605
|
// so a push can be missed. The phone caches the last board and the daemon recomposes on its next
|
|
515
606
|
// trigger, so a miss heals rather than persisting.
|
|
516
|
-
export const AttentionBoardEntrySchema = z
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
607
|
+
export const AttentionBoardEntrySchema = z
|
|
608
|
+
.object({
|
|
609
|
+
/** Short all-caps eyebrow for the card ("WORK", "SHIPPING"). Absent → the card says ATTENTION. */
|
|
610
|
+
label: z.string().optional(),
|
|
611
|
+
text: z.string(),
|
|
612
|
+
/** Existing task behind the card's Open task action. Older boards may have no target. */
|
|
613
|
+
taskId: z.string().min(1).optional(),
|
|
614
|
+
/** Optional AI-authored runs. Unknown/invalid styles fall back to the plain text. */
|
|
615
|
+
segments: z.unknown().optional(),
|
|
616
|
+
})
|
|
617
|
+
.transform(({ segments: input, ...board }) => {
|
|
618
|
+
const segments = validatedCardSegments(board.text, input);
|
|
619
|
+
return { ...board, ...(segments ? { segments } : {}) };
|
|
620
|
+
});
|
|
521
621
|
|
|
522
622
|
export const AttentionBoardSchema = z.object({
|
|
523
623
|
type: z.literal('attention_board'),
|
|
@@ -678,9 +778,37 @@ export const ModelsResponseSchema = HarnessResponseBase.extend({
|
|
|
678
778
|
models: z.array(AgentModelOptionSchema),
|
|
679
779
|
});
|
|
680
780
|
|
|
781
|
+
export const CommandsResponseSchema = HarnessResponseBase.extend({
|
|
782
|
+
kind: z.literal('commands'),
|
|
783
|
+
provider: AgentProviderSchema,
|
|
784
|
+
commands: z.array(
|
|
785
|
+
z.object({
|
|
786
|
+
name: z.string(),
|
|
787
|
+
description: z.string(),
|
|
788
|
+
argumentHint: z.string(),
|
|
789
|
+
acceptsArguments: z.boolean().optional(),
|
|
790
|
+
aliases: z.array(z.string()).optional(),
|
|
791
|
+
clearsContext: z.boolean().optional(),
|
|
792
|
+
}),
|
|
793
|
+
),
|
|
794
|
+
});
|
|
795
|
+
|
|
681
796
|
export const HarnessResponseSchema = z.discriminatedUnion('kind', [
|
|
797
|
+
HarnessResponseBase.extend({
|
|
798
|
+
kind: z.literal('voice-capture'),
|
|
799
|
+
receipt: VoiceCaptureReceiptSchema.nullable(),
|
|
800
|
+
}),
|
|
801
|
+
HarnessResponseBase.extend({
|
|
802
|
+
kind: z.literal('transcription'),
|
|
803
|
+
transcript: SpeechTranscriptSchema,
|
|
804
|
+
}),
|
|
805
|
+
HarnessResponseBase.extend({
|
|
806
|
+
kind: z.literal('automations'),
|
|
807
|
+
snapshot: AutomationSnapshotSchema,
|
|
808
|
+
}),
|
|
682
809
|
ControlResponseSchema,
|
|
683
810
|
ModelsResponseSchema,
|
|
811
|
+
CommandsResponseSchema,
|
|
684
812
|
AskResponseSchema,
|
|
685
813
|
BriefingResponseSchema,
|
|
686
814
|
JournalResponseSchema,
|
|
@@ -705,6 +833,11 @@ export const HarnessResponseSchema = z.discriminatedUnion('kind', [
|
|
|
705
833
|
// kept OUT of this schema (the relay forwards frames verbatim and never validates them
|
|
706
834
|
// through here), so it isn't a member below.
|
|
707
835
|
export const HarnessStreamEventSchema = z.discriminatedUnion('type', [
|
|
836
|
+
z.object({
|
|
837
|
+
type: z.literal('queue_state'),
|
|
838
|
+
requestId: z.uuidv7(),
|
|
839
|
+
state: z.enum(['queued', 'running']),
|
|
840
|
+
}),
|
|
708
841
|
z.object({
|
|
709
842
|
// Durable receipt written before execution; recovery only pulls saved output.
|
|
710
843
|
type: z.literal('accepted'),
|
|
@@ -832,7 +965,11 @@ export const HarnessStreamEventSchema = z.discriminatedUnion('type', [
|
|
|
832
965
|
message: z.string(),
|
|
833
966
|
}),
|
|
834
967
|
// A `cancel` request successfully stopped this in-flight turn.
|
|
835
|
-
z.object({
|
|
968
|
+
z.object({
|
|
969
|
+
type: z.literal('cancelled'),
|
|
970
|
+
requestId: z.uuidv7(),
|
|
971
|
+
queueAction: z.enum(['cancel', 'steer']).optional(),
|
|
972
|
+
}),
|
|
836
973
|
]);
|
|
837
974
|
|
|
838
975
|
// ---- Message (forward-compat: chat + M4 agent turns) ----------------------
|
|
@@ -9,7 +9,9 @@ import {
|
|
|
9
9
|
|
|
10
10
|
export const LocalDateSchema = z
|
|
11
11
|
.string()
|
|
12
|
-
.refine(isValidLocalDate, {
|
|
12
|
+
.refine(isValidLocalDate, {
|
|
13
|
+
message: 'Expected a real calendar date as YYYY-MM-DD',
|
|
14
|
+
});
|
|
13
15
|
|
|
14
16
|
/**
|
|
15
17
|
* Trimmed at the ends but otherwise untouched — no whitespace collapsing, unlike a bio.
|
|
@@ -71,7 +73,9 @@ export const CorrectJournalSegmentSchema = z.object({
|
|
|
71
73
|
message: `A correction cannot exceed ${TRANSCRIPT_MAX_LENGTH} characters`,
|
|
72
74
|
})
|
|
73
75
|
.transform((s) => s.trim())
|
|
74
|
-
.refine((s) => s.length > 0, {
|
|
76
|
+
.refine((s) => s.length > 0, {
|
|
77
|
+
message: 'A correction cannot be empty — send null to clear it',
|
|
78
|
+
})
|
|
75
79
|
.nullable(),
|
|
76
80
|
});
|
|
77
81
|
|
|
@@ -109,9 +113,15 @@ export const JournalObservationSchema = z.object({
|
|
|
109
113
|
* said is what makes the review queue trustworthy — otherwise you're accepting proposals on
|
|
110
114
|
* faith.
|
|
111
115
|
*/
|
|
112
|
-
export const JournalSegmentWithObservationsSchema = JournalSegmentSchema.extend(
|
|
113
|
-
|
|
114
|
-
|
|
116
|
+
export const JournalSegmentWithObservationsSchema = JournalSegmentSchema.extend(
|
|
117
|
+
{
|
|
118
|
+
observations: z.array(JournalObservationSchema),
|
|
119
|
+
revisions: z.array(z.string()).optional(),
|
|
120
|
+
conflicts: z
|
|
121
|
+
.array(z.object({ revision: z.string(), text: z.string() }))
|
|
122
|
+
.optional(),
|
|
123
|
+
},
|
|
124
|
+
);
|
|
115
125
|
|
|
116
126
|
export const JournalDayWithSegmentsSchema = JournalDaySchema.extend({
|
|
117
127
|
segments: z.array(JournalSegmentWithObservationsSchema),
|
|
@@ -194,4 +204,3 @@ export const WriteJournalObservationsSchema = z.object({
|
|
|
194
204
|
}),
|
|
195
205
|
),
|
|
196
206
|
});
|
|
197
|
-
|
|
@@ -68,7 +68,7 @@ export const UpdateOrganizationSchema = z.object({
|
|
|
68
68
|
/**
|
|
69
69
|
* An organization's public profile — the GitHub-shaped page. What it contains
|
|
70
70
|
* depends on the viewer: a member sees every project, everyone else sees only
|
|
71
|
-
* the public ones.
|
|
71
|
+
* the public ones. People and their roles are returned only to active members.
|
|
72
72
|
*/
|
|
73
73
|
export const OrganizationProfileSchema = z.object({
|
|
74
74
|
id: z.uuidv7(),
|
|
@@ -101,7 +101,8 @@ export const OrganizationProfileSchema = z.object({
|
|
|
101
101
|
),
|
|
102
102
|
});
|
|
103
103
|
|
|
104
|
-
/**
|
|
104
|
+
/** An active affiliation: own profile, or an organization shared with the viewer.
|
|
105
|
+
* `role` belongs to the person whose profile is being viewed, not the viewer. */
|
|
105
106
|
export const UserOrganizationSchema = z.object({
|
|
106
107
|
id: z.uuidv7(),
|
|
107
108
|
name: z.string(),
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
PROPOSAL_KINDS,
|
|
4
|
+
PROPOSAL_STATUSES,
|
|
5
|
+
PROPOSAL_LINK_TARGETS,
|
|
6
|
+
} from '../constants.js';
|
|
3
7
|
|
|
4
8
|
/**
|
|
5
9
|
* A task Lucid heard you commit to. Accepting creates it.
|
|
@@ -76,6 +80,7 @@ export const ProposalSchema = z.object({
|
|
|
76
80
|
* to prevent, not a UI detail.
|
|
77
81
|
*/
|
|
78
82
|
export const ProposalWithEvidenceSchema = ProposalSchema.extend({
|
|
83
|
+
storage: z.enum(['vault', 'server']).optional(),
|
|
79
84
|
evidence: z
|
|
80
85
|
.object({
|
|
81
86
|
segmentId: z.uuidv7(),
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { CaptureContextSchema } from '../smartCapture.js';
|
|
3
|
+
import { RecurrenceTimeZoneSchema, RecurringReminderSchema } from '../recurrence.js';
|
|
2
4
|
import {
|
|
3
5
|
TASK_STATUS_VALUES,
|
|
4
6
|
PRIORITY_MIN,
|
|
@@ -12,6 +14,7 @@ export const CreateTaskSchema = z.object({
|
|
|
12
14
|
// instead of minting its own, so an optimistic row and its saved row share one stable
|
|
13
15
|
// id (no temp→real swap). Omitted by older/other clients → server generates the id.
|
|
14
16
|
id: z.uuidv7().optional(),
|
|
17
|
+
captureContext: CaptureContextSchema.optional(),
|
|
15
18
|
title: z.string().min(1).max(500),
|
|
16
19
|
projectId: z.uuidv7().nullable().optional(),
|
|
17
20
|
milestoneId: z.uuidv7().nullable().optional(),
|
|
@@ -25,9 +28,14 @@ export const CreateTaskSchema = z.object({
|
|
|
25
28
|
priority: z.number().min(PRIORITY_MIN).max(PRIORITY_MAX).default(500),
|
|
26
29
|
position: z.number().optional(),
|
|
27
30
|
completedAt: z.coerce.date().optional(),
|
|
28
|
-
|
|
31
|
+
// Null is an explicit "no date" (it locks the date for smart capture). Without
|
|
32
|
+
// nullable() the coercion turns it into 1 January 1970.
|
|
33
|
+
dueDate: z.coerce.date().nullable().optional(),
|
|
29
34
|
reminderAt: z.coerce.date().nullable().optional(),
|
|
30
35
|
recurringFrequency: z.enum(RECURRING_FREQUENCY_VALUES).nullable().optional(),
|
|
36
|
+
recurrenceTimeZone: RecurrenceTimeZoneSchema.optional(),
|
|
37
|
+
recurrenceAnchor: z.iso.date().nullable().optional(),
|
|
38
|
+
recurringReminder: RecurringReminderSchema.nullable().optional(),
|
|
31
39
|
});
|
|
32
40
|
|
|
33
41
|
/**
|
|
@@ -69,10 +77,20 @@ export const TaskSchema = CreateTaskSchema.extend({
|
|
|
69
77
|
taskNumber: z.number().nullable(),
|
|
70
78
|
/** Identifiers this task used to answer to, oldest first. Appended on a move. */
|
|
71
79
|
previousIdentifiers: z.array(z.string()).default([]),
|
|
80
|
+
captureContext: CaptureContextSchema.nullable().optional(),
|
|
81
|
+
captureRevision: z.number().int().optional(),
|
|
82
|
+
dueDatePrecision: z.enum(['date', 'time']).nullable().optional(),
|
|
83
|
+
dueTimeZone: z.string().nullable().optional(),
|
|
72
84
|
completedAt: z.coerce.date().nullable(),
|
|
85
|
+
deletedAt: z.coerce.date().nullable().optional(),
|
|
86
|
+
deletedBy: z.uuid().nullable().optional(),
|
|
87
|
+
deletionBatchId: z.uuid().nullable().optional(),
|
|
73
88
|
dueDate: z.coerce.date().nullable(),
|
|
74
89
|
reminderAt: z.coerce.date().nullable(),
|
|
75
90
|
recurringFrequency: z.enum(RECURRING_FREQUENCY_VALUES).nullable(),
|
|
91
|
+
recurrenceAnchor: z.iso.date().nullable().optional(),
|
|
92
|
+
recurrenceVersion: z.number().int().optional(),
|
|
93
|
+
currentOccurrenceId: z.uuid().nullable().optional(),
|
|
76
94
|
reviewedAt: z.coerce.date().nullable(),
|
|
77
95
|
activeTimerStartedAt: z.coerce.date().nullable(),
|
|
78
96
|
totalElapsedSeconds: z.number(),
|
|
@@ -85,7 +103,7 @@ export const TaskSchema = CreateTaskSchema.extend({
|
|
|
85
103
|
// `.partial()` makes fields optional but does NOT strip defaults, so without
|
|
86
104
|
// these overrides an update that omits status/priority would inject
|
|
87
105
|
// status:'pending' and priority:500 and silently clobber the stored values.
|
|
88
|
-
export const UpdateTaskSchema = CreateTaskSchema.omit({ id: true })
|
|
106
|
+
export const UpdateTaskSchema = CreateTaskSchema.omit({ id: true, captureContext: true })
|
|
89
107
|
.partial()
|
|
90
108
|
.extend({
|
|
91
109
|
projectId: z.uuidv7().nullable().optional(),
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const CaptureContextSchema = z.object({
|
|
4
|
+
capturedAt: z.iso.datetime({ offset: true }),
|
|
5
|
+
timeZone: z.string().min(1).max(100).refine(value => {
|
|
6
|
+
try { new Intl.DateTimeFormat('en', { timeZone: value }); return true; } catch { return false; }
|
|
7
|
+
}, 'Use an IANA timezone'),
|
|
8
|
+
source: z.enum(['app', 'web', 'watch', 'shortcut', 'mcp', 'daemon', 'api']),
|
|
9
|
+
// Explicit selection of Inbox/no date can be distinguished from an untouched default.
|
|
10
|
+
lockedFields: z.array(z.enum(['project', 'date'])).max(2).optional(),
|
|
11
|
+
// Automated producers must explicitly request analysis of an unstructured capture.
|
|
12
|
+
analyze: z.boolean().optional(),
|
|
13
|
+
// A task made by voice in Fast mode: the words heard, and whether the phone or Jev read them.
|
|
14
|
+
// Lets a later review compare the title with what was actually said.
|
|
15
|
+
heard: z.string().trim().min(1).max(500).optional(),
|
|
16
|
+
readBy: z.enum(['phone', 'jev']).optional(),
|
|
17
|
+
});
|
|
18
|
+
export type CaptureContext = z.infer<typeof CaptureContextSchema>;
|
|
19
|
+
|
|
20
|
+
/** Omitted fields are untouched defaults; explicit null means Inbox/no date. */
|
|
21
|
+
export function createCaptureContext(source: 'app' | 'web', input: {
|
|
22
|
+
projectId?: string | null;
|
|
23
|
+
dueDate?: unknown;
|
|
24
|
+
captureContext?: CaptureContext;
|
|
25
|
+
}): CaptureContext {
|
|
26
|
+
const existing = input.captureContext;
|
|
27
|
+
return {
|
|
28
|
+
capturedAt: new Date().toISOString(),
|
|
29
|
+
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
30
|
+
source,
|
|
31
|
+
...existing,
|
|
32
|
+
lockedFields: [...new Set([
|
|
33
|
+
...(existing?.lockedFields ?? []),
|
|
34
|
+
...(input.projectId !== undefined ? ['project' as const] : []),
|
|
35
|
+
...(input.dueDate !== undefined ? ['date' as const] : []),
|
|
36
|
+
])],
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Preserve the captured calendar date and show timed deadlines in their original zone. */
|
|
41
|
+
export function formatCapturedDueDate(task: {
|
|
42
|
+
dueDate?: Date | string | null;
|
|
43
|
+
dueDatePrecision?: 'date' | 'time' | null;
|
|
44
|
+
dueTimeZone?: string | null;
|
|
45
|
+
}): { label: string; dateInputValue: string } | null {
|
|
46
|
+
if (!task.dueDate || !task.dueDatePrecision || !task.dueTimeZone) return null;
|
|
47
|
+
try {
|
|
48
|
+
const date = new Date(task.dueDate);
|
|
49
|
+
const timeZone = task.dueTimeZone;
|
|
50
|
+
const parts = new Intl.DateTimeFormat('en', { timeZone, year: 'numeric', month: '2-digit', day: '2-digit' }).formatToParts(date);
|
|
51
|
+
const part = (type: string) => parts.find(p => p.type === type)!.value;
|
|
52
|
+
const label = new Intl.DateTimeFormat('en', {
|
|
53
|
+
timeZone, weekday: 'short', month: 'short', day: 'numeric', year: 'numeric',
|
|
54
|
+
...(task.dueDatePrecision === 'time' ? { hour: 'numeric', minute: '2-digit', timeZoneName: 'short' } as const : {}),
|
|
55
|
+
}).format(date);
|
|
56
|
+
return { label, dateInputValue: `${part('year')}-${part('month')}-${part('day')}` };
|
|
57
|
+
} catch { return null; }
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export type SmartCaptureReview = {
|
|
61
|
+
status: 'pending' | 'processing' | 'ready' | 'applied' | 'dismissed' | 'undone' | 'skipped' | 'failed' | 'stale';
|
|
62
|
+
project?: { id: string; name: string };
|
|
63
|
+
date?: { dueDate: string; label: string; precision: 'date' | 'time'; timeZone: string };
|
|
64
|
+
duplicate?: { id: string; title: string };
|
|
65
|
+
message?: string;
|
|
66
|
+
pollAfterMs?: number | null;
|
|
67
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const DEFAULT_SPEECH_MODEL = 'parakeet-tdt-0.6b-v2';
|
|
4
|
+
export const MAX_SPEECH_BYTES = 10 * 1024 * 1024;
|
|
5
|
+
export const MAX_SPEECH_SECONDS = 300;
|
|
6
|
+
// Allows a cold model download. Clients must preserve their recording on timeout/disconnect.
|
|
7
|
+
export const SPEECH_REQUEST_TIMEOUT_MS = 10 * 60 * 1000;
|
|
8
|
+
export const SpeechModelIdSchema = z
|
|
9
|
+
.string()
|
|
10
|
+
.min(1)
|
|
11
|
+
.max(100)
|
|
12
|
+
.regex(/^[a-zA-Z0-9._-]+$/);
|
|
13
|
+
export const SpeechModelSchema = z.object({
|
|
14
|
+
id: SpeechModelIdSchema,
|
|
15
|
+
label: z.string(),
|
|
16
|
+
description: z.string(),
|
|
17
|
+
});
|
|
18
|
+
export type SpeechModel = z.infer<typeof SpeechModelSchema>;
|
|
19
|
+
|
|
20
|
+
export const ComputerSpeechSchema = z.object({
|
|
21
|
+
models: z.array(SpeechModelSchema),
|
|
22
|
+
available: z.boolean(),
|
|
23
|
+
reason: z.string().optional(),
|
|
24
|
+
});
|
|
25
|
+
export type ComputerSpeech = z.infer<typeof ComputerSpeechSchema>;
|
|
26
|
+
|
|
27
|
+
// Complete files only. No user-supplied computer paths, URLs, or executable names.
|
|
28
|
+
export const SpeechAudioSchema = z.object({
|
|
29
|
+
format: z.enum(['wav', 'm4a', 'mp3', 'caf']),
|
|
30
|
+
base64: z
|
|
31
|
+
.string()
|
|
32
|
+
.min(4)
|
|
33
|
+
.max(4 * Math.ceil(MAX_SPEECH_BYTES / 3))
|
|
34
|
+
.regex(/^[A-Za-z0-9+/]*={0,2}$/)
|
|
35
|
+
.refine((value) => value.length % 4 === 0),
|
|
36
|
+
});
|
|
37
|
+
export type SpeechAudio = z.infer<typeof SpeechAudioSchema>;
|
|
38
|
+
|
|
39
|
+
export const SpeechTranscriptSchema = z.object({
|
|
40
|
+
text: z.string().max(100_000),
|
|
41
|
+
modelId: SpeechModelIdSchema,
|
|
42
|
+
durationSeconds: z.number().positive().max(MAX_SPEECH_SECONDS),
|
|
43
|
+
});
|
|
44
|
+
export type SpeechTranscript = z.infer<typeof SpeechTranscriptSchema>;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Puts the names the app knows back into what speech recognition heard.
|
|
3
|
+
*
|
|
4
|
+
* Names are what recognition gets wrong, and Parakeet can't be told a vocabulary: "Neucleosoft"
|
|
5
|
+
* arrives as "nucleus of". So a run of heard words is compared with each project, milestone and
|
|
6
|
+
* organization name by how it sounds, and replaced when the two are one sound apart.
|
|
7
|
+
*
|
|
8
|
+
* Deliberately cautious, since a wrong swap changes what an instruction does, and tuned against
|
|
9
|
+
* the instructions actually said to Fast mode. A name said right is never touched. Only names with
|
|
10
|
+
* at least five consonant sounds are considered, and those with five must sound exactly alike;
|
|
11
|
+
* longer ones may be one sound apart ("nucleus of" for "Neucleosoft"). The first sound must match
|
|
12
|
+
* ("voice setting" is not "Vacation in goa"), a run never starts with a command word ("open cone"
|
|
13
|
+
* is not "Pinecone"), and a run that could be two names is left alone.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** Consonant sounds in order, similar ones merged, vowels dropped: "nucleus of" is "nklsf". */
|
|
17
|
+
export function soundKey(words: string): string {
|
|
18
|
+
return words
|
|
19
|
+
.normalize('NFKD')
|
|
20
|
+
.toLowerCase()
|
|
21
|
+
.replace(/[^a-z]/g, '')
|
|
22
|
+
.replace(/ph/g, 'f')
|
|
23
|
+
.replace(/ck/g, 'k')
|
|
24
|
+
.replace(/sch/g, 'sk')
|
|
25
|
+
.replace(/[cs]h/g, 'x')
|
|
26
|
+
.replace(/c(?=[eiy])/g, 's')
|
|
27
|
+
.replace(/[cq]/g, 'k')
|
|
28
|
+
.replace(/x/g, 'ks')
|
|
29
|
+
.replace(/z/g, 's')
|
|
30
|
+
.replace(/v/g, 'f')
|
|
31
|
+
.replace(/dg/g, 'j')
|
|
32
|
+
.replace(/g(?=[eiy])/g, 'j')
|
|
33
|
+
.replace(/^kn/, 'n')
|
|
34
|
+
.replace(/^wr/, 'r')
|
|
35
|
+
.replace(/[aeiouyhw]/g, '')
|
|
36
|
+
.replace(/(.)\1+/g, '$1');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function distance(a: string, b: string): number {
|
|
40
|
+
const row = Array.from({ length: b.length + 1 }, (_, i) => i);
|
|
41
|
+
for (let i = 1; i <= a.length; i++) {
|
|
42
|
+
let diagonal = row[0]!;
|
|
43
|
+
row[0] = i;
|
|
44
|
+
for (let j = 1; j <= b.length; j++) {
|
|
45
|
+
const above = row[j]!;
|
|
46
|
+
row[j] = Math.min(row[j]! + 1, row[j - 1]! + 1, diagonal + (a[i - 1] === b[j - 1] ? 0 : 1));
|
|
47
|
+
diagonal = above;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return row[b.length]!;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Words a name never starts with in speech: verbs and small words of the instruction around it. */
|
|
54
|
+
const NOT_A_START = new Set([
|
|
55
|
+
'open', 'show', 'go', 'take', 'add', 'move', 'put', 'create', 'make', 'mark', 'set', 'the', 'a',
|
|
56
|
+
'an', 'my', 'to', 'in', 'into', 'for', 'of', 'on', 'at', 'and', 'it', 'this', 'that', 'project',
|
|
57
|
+
'projects', 'task', 'tasks', 'milestone', 'milestones', 'me', 'please',
|
|
58
|
+
]);
|
|
59
|
+
|
|
60
|
+
const MIN_SOUNDS = 5;
|
|
61
|
+
/** Names this long or longer may be one sound off. */
|
|
62
|
+
const FUZZY_SOUNDS = 6;
|
|
63
|
+
|
|
64
|
+
/** The name as it should read in text: no emoji or symbols, "neucleosoft/K5" as two words. */
|
|
65
|
+
const plain = (name: string) =>
|
|
66
|
+
name.replace(/[/:_]/g, ' ').replace(/[^\p{L}\p{N}\s'&.-]/gu, '').replace(/\s+/g, ' ').trim();
|
|
67
|
+
|
|
68
|
+
export interface RepairedName {
|
|
69
|
+
heard: string;
|
|
70
|
+
name: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function repairNames(text: string, names: readonly string[]): { text: string; repaired: RepairedName[] } {
|
|
74
|
+
const known = [...new Set(names.map(plain).filter(Boolean))]
|
|
75
|
+
.map((name) => ({ name, key: soundKey(name), words: name.split(' ').length }))
|
|
76
|
+
.filter((n) => n.key.length >= MIN_SOUNDS);
|
|
77
|
+
const exact = new Set(known.map((n) => n.name.toLowerCase()));
|
|
78
|
+
const words = text.split(/\s+/).filter(Boolean);
|
|
79
|
+
if (!known.length || !words.length) return { text, repaired: [] };
|
|
80
|
+
|
|
81
|
+
const bare = (word: string) => word.toLowerCase().replace(/[^\p{L}\p{N}']/gu, '');
|
|
82
|
+
const out: string[] = [];
|
|
83
|
+
const repaired: RepairedName[] = [];
|
|
84
|
+
const longest = Math.max(...known.map((n) => n.words));
|
|
85
|
+
for (let i = 0; i < words.length; ) {
|
|
86
|
+
// A name said right: keep it as said, and don't let part of it start another match.
|
|
87
|
+
const said = Array.from({ length: Math.min(longest, words.length - i) }, (_, k) => i + k + 1)
|
|
88
|
+
.reverse()
|
|
89
|
+
.find((end) => exact.has(words.slice(i, end).map(bare).join(' ')));
|
|
90
|
+
if (said) {
|
|
91
|
+
out.push(...words.slice(i, said));
|
|
92
|
+
i = said;
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
let best: { name: string; end: number; score: number; off: number } | null = null;
|
|
96
|
+
let tied = false;
|
|
97
|
+
if (!NOT_A_START.has(bare(words[i]!))) {
|
|
98
|
+
for (const n of known) {
|
|
99
|
+
for (let end = i + 1; end <= Math.min(words.length, i + n.words + 2); end++) {
|
|
100
|
+
const key = soundKey(words.slice(i, end).map(bare).join(' '));
|
|
101
|
+
if (!key || key[0] !== n.key[0]) continue;
|
|
102
|
+
const score = distance(key, n.key);
|
|
103
|
+
if (score > (n.key.length >= FUZZY_SOUNDS ? 1 : 0)) continue;
|
|
104
|
+
// Closest in sound, then closest in length to the name, then the longer run: "nucleus of
|
|
105
|
+
// procurement" is "neucleosoft/Procurement" before it is "Neucleosoft".
|
|
106
|
+
const off = Math.abs(end - i - n.words);
|
|
107
|
+
const better =
|
|
108
|
+
!best || score < best.score || (score === best.score && (off < best.off || (off === best.off && end > best.end)));
|
|
109
|
+
if (better) {
|
|
110
|
+
best = { name: n.name, end, score, off };
|
|
111
|
+
tied = false;
|
|
112
|
+
} else if (score === best!.score && off === best!.off && end === best!.end && best!.name !== n.name) tied = true;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
if (best && !tied) {
|
|
117
|
+
// Keep the punctuation that ended the run: "nucleus of." reads "Neucleosoft.".
|
|
118
|
+
const trailing = /[^\p{L}\p{N}]+$/u.exec(words[best.end - 1]!)?.[0] ?? '';
|
|
119
|
+
repaired.push({ heard: words.slice(i, best.end).join(' '), name: best.name });
|
|
120
|
+
out.push(best.name + trailing);
|
|
121
|
+
i = best.end;
|
|
122
|
+
} else {
|
|
123
|
+
out.push(words[i]!);
|
|
124
|
+
i++;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return repaired.length ? { text: out.join(' '), repaired } : { text, repaired };
|
|
128
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const TASK_ACTIVITY_FIELDS = [
|
|
4
|
+
'title', 'description', 'status', 'dueDate', 'reminderAt', 'recurringFrequency',
|
|
5
|
+
'projectId', 'milestoneId', 'parentTaskId', 'assigneeId', 'priority',
|
|
6
|
+
'recurringReminder', 'recurrenceTimeZone',
|
|
7
|
+
] as const;
|
|
8
|
+
|
|
9
|
+
export const TaskActivityChangeSchema = z.object({
|
|
10
|
+
field: z.enum(TASK_ACTIVITY_FIELDS),
|
|
11
|
+
from: z.union([z.string(), z.number(), z.null()]),
|
|
12
|
+
to: z.union([z.string(), z.number(), z.null()]),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export const TaskEventSchema = z.object({
|
|
16
|
+
id: z.uuid(),
|
|
17
|
+
taskId: z.uuid(),
|
|
18
|
+
occurrenceId: z.uuid().nullable().optional(),
|
|
19
|
+
occurrenceDate: z.iso.date().nullable().optional(),
|
|
20
|
+
actorId: z.uuid().nullable(),
|
|
21
|
+
actorKind: z.enum(['human', 'agent', 'system', 'unknown']),
|
|
22
|
+
actorName: z.string().nullable(),
|
|
23
|
+
actorHandle: z.string().nullable(),
|
|
24
|
+
agentProvider: z.enum(['claude', 'codex']).nullable(),
|
|
25
|
+
agentModel: z.string().nullable(),
|
|
26
|
+
agentClient: z.string().nullable(),
|
|
27
|
+
type: z.enum(['created', 'updated', 'deleted', 'restored', 'occurrence']),
|
|
28
|
+
changes: z.array(TaskActivityChangeSchema),
|
|
29
|
+
createdAt: z.coerce.date(),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export type TaskEvent = z.infer<typeof TaskEventSchema>;
|
|
33
|
+
export type TaskActivityChange = z.infer<typeof TaskActivityChangeSchema>;
|
|
34
|
+
export type TaskActivityPage = { events: TaskEvent[]; nextCursor: string | null };
|