@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
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
const text = (max: number) => z.string().trim().min(1).max(max);
|
|
4
|
+
const dueDate = z.string().datetime({ offset: true }).nullable();
|
|
5
|
+
const task = z.object({
|
|
6
|
+
title: text(500),
|
|
7
|
+
description: z.string().max(8000).nullable(),
|
|
8
|
+
dueDate,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
/** A bounded plan. No project/task exists until the API commits this whole bundle. */
|
|
12
|
+
export const ProjectCreationPlanSchema = z
|
|
13
|
+
.object({
|
|
14
|
+
name: text(255),
|
|
15
|
+
description: z.string().max(8000).nullable(),
|
|
16
|
+
organizationId: z.uuidv7().nullable(),
|
|
17
|
+
tasks: z.array(task.extend({ subtasks: z.array(task).max(30) })).max(30),
|
|
18
|
+
})
|
|
19
|
+
.superRefine((plan, ctx) => {
|
|
20
|
+
if (plan.tasks.reduce((n, item) => n + 1 + item.subtasks.length, 0) > 100)
|
|
21
|
+
ctx.addIssue({
|
|
22
|
+
code: 'custom',
|
|
23
|
+
message: 'Create at most 100 tasks at a time.',
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
export type ProjectCreationPlan = z.infer<typeof ProjectCreationPlanSchema>;
|
|
27
|
+
|
|
28
|
+
export const ProjectPlanningContextSchema = z.object({
|
|
29
|
+
capturedAt: z.string().datetime(),
|
|
30
|
+
timeZone: text(100).refine((zone) => {
|
|
31
|
+
try {
|
|
32
|
+
new Intl.DateTimeFormat('en', { timeZone: zone });
|
|
33
|
+
return true;
|
|
34
|
+
} catch {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
}, 'Choose a valid time zone.'),
|
|
38
|
+
organizationId: z.uuidv7().nullable(),
|
|
39
|
+
organizations: z
|
|
40
|
+
.array(z.object({ id: z.uuidv7(), name: text(200), handle: text(100) }))
|
|
41
|
+
.max(100),
|
|
42
|
+
});
|
|
43
|
+
export type ProjectPlanningContext = z.infer<
|
|
44
|
+
typeof ProjectPlanningContextSchema
|
|
45
|
+
>;
|
|
46
|
+
|
|
47
|
+
export const ProjectPlanningResultSchema = z.discriminatedUnion('status', [
|
|
48
|
+
z.object({ status: z.literal('ready'), plan: ProjectCreationPlanSchema }),
|
|
49
|
+
z.object({ status: z.literal('clarify'), question: text(1000) }),
|
|
50
|
+
]);
|
|
51
|
+
export type ProjectPlanningResult = z.infer<typeof ProjectPlanningResultSchema>;
|
|
52
|
+
|
|
53
|
+
export const CreateProjectBundleSchema = z.object({
|
|
54
|
+
/** Also the resulting project ID, making a lost-response retry idempotent. */
|
|
55
|
+
operationId: z.uuidv7(),
|
|
56
|
+
plan: ProjectCreationPlanSchema,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
/** Only short labels take the manual path. Instructions/ambiguous prose need interpretation. */
|
|
60
|
+
export function projectInputNeedsPlanning(input: string): boolean {
|
|
61
|
+
const value = input.trim();
|
|
62
|
+
return (
|
|
63
|
+
/[\r\n]/.test(value) ||
|
|
64
|
+
value.length > 80 ||
|
|
65
|
+
value.split(/\s+/).length > 6 ||
|
|
66
|
+
/[.!?](?:\s|$)/.test(value) ||
|
|
67
|
+
/^(?:(?:hey\s+\w+[, ]+)?(?:please\s+|can\s+you\s+|could\s+you\s+|i\s+(?:want|need)\s+|let['’]s\s+))?(?:create|add|make|start|set\s+up|plan|organize|organise)\b/i.test(
|
|
68
|
+
value,
|
|
69
|
+
) ||
|
|
70
|
+
/\b(?:called|named|call\s+it|sub\s*tasks?|tasks?\s+for|in\s+\S+|under\s+\S+)\b/i.test(
|
|
71
|
+
value,
|
|
72
|
+
)
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function literalProjectPlan(
|
|
77
|
+
name: string,
|
|
78
|
+
organizationId: string | null,
|
|
79
|
+
): ProjectCreationPlan {
|
|
80
|
+
return ProjectCreationPlanSchema.parse({
|
|
81
|
+
name,
|
|
82
|
+
organizationId,
|
|
83
|
+
description: null,
|
|
84
|
+
tasks: [],
|
|
85
|
+
});
|
|
86
|
+
}
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
import { casual } from 'chrono-node/en';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Quick add: recognise a due date/time and a `#project` in a task title while it is typed.
|
|
5
|
+
*
|
|
6
|
+
* Deterministic and local, so it runs on every keystroke and costs nothing. The result is text
|
|
7
|
+
* ranges plus calendar values, never instants: the caller turns a calendar date into a Date in
|
|
8
|
+
* the timezone it cares about (the device's own, on the phone).
|
|
9
|
+
*
|
|
10
|
+
* `#` is for projects and `@` is reserved for people. `#12` stays a task reference.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export type CalendarDate = { year: number; month: number; day: number };
|
|
14
|
+
export type ClockTime = { hour: number; minute: number };
|
|
15
|
+
export type QuickAddProject = { id: string; name: string; key?: string | null };
|
|
16
|
+
|
|
17
|
+
export type QuickAddDateToken = {
|
|
18
|
+
kind: 'date';
|
|
19
|
+
/** Stable while the matched words are unchanged, so a dismissal survives further typing. */
|
|
20
|
+
key: string;
|
|
21
|
+
start: number;
|
|
22
|
+
end: number;
|
|
23
|
+
text: string;
|
|
24
|
+
date: CalendarDate;
|
|
25
|
+
time: ClockTime | null;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type QuickAddProjectToken = {
|
|
29
|
+
kind: 'project';
|
|
30
|
+
key: string;
|
|
31
|
+
start: number;
|
|
32
|
+
end: number;
|
|
33
|
+
text: string;
|
|
34
|
+
projectId: string;
|
|
35
|
+
name: string;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export type QuickAddToken = QuickAddDateToken | QuickAddProjectToken;
|
|
39
|
+
|
|
40
|
+
export type QuickAddOptions = {
|
|
41
|
+
now: Date;
|
|
42
|
+
/** IANA zone the calendar is read in. Defaults to the runtime's local zone. */
|
|
43
|
+
timeZone?: string;
|
|
44
|
+
/** Destinations `#` may name. Omit to skip project recognition entirely. */
|
|
45
|
+
projects?: QuickAddProject[];
|
|
46
|
+
/** Also recognise dates. Defaults to true. */
|
|
47
|
+
dates?: boolean;
|
|
48
|
+
/** Token keys the user chose to keep as plain text. */
|
|
49
|
+
ignore?: readonly string[];
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const NUMERIC_DATE = /(?<![\d-])\b\d{1,2}[/.\-]\d{1,2}(?:[/.\-]\d{2,4})?\b/;
|
|
53
|
+
const RECURRENCE = /\b(?:every|each)\s+(?:(?:other|\d+)\s+)?(?:day|week|month|year|morning|evening|night|weekday|weekend|monday|tuesday|wednesday|thursday|friday|saturday|sunday)s?\b|\b(?:daily|weekly|monthly|yearly)\b/i;
|
|
54
|
+
const RELATIVE_TIME = /\b(?:in\s+(?:an?|\d+)\s+(?:hours?|minutes?|mins?)|(?:an?|\d+)\s+(?:hours?|minutes?|mins?)\s+from now)\b/i;
|
|
55
|
+
const NOON_OR_MIDNIGHT = /\b(?:noon|midday|midnight)\b/i;
|
|
56
|
+
const TWENTY_FOUR_HOUR = /\b[01]\d:\d\d\b/;
|
|
57
|
+
const PAST_REFERENCE = /\b(?:last|previous|yesterday|ago)\b/i;
|
|
58
|
+
/** Words Chrono reads as a date that are far more often just words: "sun cream", "morning run". */
|
|
59
|
+
const ORDINARY_WORD = /^(?:sun|sat|wed|morning|afternoon|evening|night)$/i;
|
|
60
|
+
/** Words that only existed to introduce the date, dropped with it from the title. */
|
|
61
|
+
const LEADING_PREPOSITION = /(?:^|\s)(?:on|at|by|due|before|for)\s*$/i;
|
|
62
|
+
|
|
63
|
+
function partsIn(date: Date, timeZone?: string) {
|
|
64
|
+
// The phone reads its own zone, which needs no Intl. That keeps "is 9am still ahead?" off each
|
|
65
|
+
// JS engine's handling of 24-hour formatting options.
|
|
66
|
+
if (!timeZone) {
|
|
67
|
+
return {
|
|
68
|
+
year: date.getFullYear(), month: date.getMonth() + 1, day: date.getDate(),
|
|
69
|
+
hour: date.getHours(), minute: date.getMinutes(), second: date.getSeconds(),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const parts = new Intl.DateTimeFormat('en-US', {
|
|
73
|
+
timeZone, hourCycle: 'h23', year: 'numeric', month: 'numeric', day: 'numeric',
|
|
74
|
+
hour: 'numeric', minute: 'numeric', second: 'numeric',
|
|
75
|
+
}).formatToParts(date);
|
|
76
|
+
const get = (type: string) => Number(parts.find((p) => p.type === type)?.value);
|
|
77
|
+
// Some engines write midnight as 24 even with h23.
|
|
78
|
+
return { year: get('year'), month: get('month'), day: get('day'), hour: get('hour') % 24, minute: get('minute'), second: get('second') };
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** Minutes east of UTC for `timeZone` at `date`, the shape Chrono's reference expects. */
|
|
82
|
+
function offsetMinutes(date: Date, timeZone?: string): number {
|
|
83
|
+
if (!timeZone) return -date.getTimezoneOffset();
|
|
84
|
+
const p = partsIn(date, timeZone);
|
|
85
|
+
const asUtc = Date.UTC(p.year, p.month - 1, p.day, p.hour, p.minute, p.second);
|
|
86
|
+
return Math.round((asUtc - Math.floor(date.getTime() / 1000) * 1000) / 60_000);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const dayNumber = (d: CalendarDate) => Date.UTC(d.year, d.month - 1, d.day) / 86_400_000;
|
|
90
|
+
|
|
91
|
+
function addDays(d: CalendarDate, days: number): CalendarDate {
|
|
92
|
+
const next = new Date(Date.UTC(d.year, d.month - 1, d.day + days));
|
|
93
|
+
return { year: next.getUTCFullYear(), month: next.getUTCMonth() + 1, day: next.getUTCDate() };
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function validDate(d: CalendarDate): boolean {
|
|
97
|
+
const check = new Date(Date.UTC(d.year, d.month - 1, d.day));
|
|
98
|
+
return check.getUTCFullYear() === d.year && check.getUTCMonth() === d.month - 1 && check.getUTCDate() === d.day;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const minutesOf = (t: ClockTime) => t.hour * 60 + t.minute;
|
|
102
|
+
|
|
103
|
+
/** `#Name` or `#KEY`, ending at a word boundary. Any name beats any key, then longest first. */
|
|
104
|
+
function findProject(text: string, projects: QuickAddProject[], ignore: ReadonlySet<string>) {
|
|
105
|
+
const labels = [
|
|
106
|
+
...[...projects].sort((a, b) => b.name.length - a.name.length).map((project) => ({ project, label: project.name })),
|
|
107
|
+
...projects.map((project) => ({ project, label: project.key ?? '' })),
|
|
108
|
+
].filter(({ label }) => label.trim());
|
|
109
|
+
for (let i = text.indexOf('#'); i !== -1; i = text.indexOf('#', i + 1)) {
|
|
110
|
+
if (i > 0 && !/[\s(]/.test(text[i - 1]!)) continue;
|
|
111
|
+
const rest = text.slice(i + 1);
|
|
112
|
+
if (/^\d/.test(rest)) continue;
|
|
113
|
+
const lower = rest.toLowerCase();
|
|
114
|
+
for (const { project, label } of labels) {
|
|
115
|
+
const candidate = label.toLowerCase();
|
|
116
|
+
if (!lower.startsWith(candidate)) continue;
|
|
117
|
+
const after = rest[candidate.length];
|
|
118
|
+
if (after !== undefined && !/[\s.,;:!?)]/.test(after)) continue;
|
|
119
|
+
const token: QuickAddProjectToken = {
|
|
120
|
+
kind: 'project', key: `project:${candidate}`, start: i, end: i + 1 + candidate.length,
|
|
121
|
+
text: text.slice(i, i + 1 + candidate.length), projectId: project.id, name: project.name,
|
|
122
|
+
};
|
|
123
|
+
if (!ignore.has(token.key)) return token;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function findDate(text: string, options: QuickAddOptions, ignore: ReadonlySet<string>, skip: (start: number, end: number) => boolean) {
|
|
130
|
+
const { now, timeZone } = options;
|
|
131
|
+
const today: CalendarDate = partsIn(now, timeZone);
|
|
132
|
+
const nowClock = partsIn(now, timeZone);
|
|
133
|
+
// "6.30 pm" is a time in most of the world; Chrono reads it as a decimal. Same length, so the
|
|
134
|
+
// ranges it reports still index into the original text.
|
|
135
|
+
const normalized = text.replace(/\b(\d{1,2})\.(\d{2})(\s*[ap]\.?m\.?\b)/gi, '$1:$2$3');
|
|
136
|
+
const results = casual.parse(normalized, { instant: now, timezone: offsetMinutes(now, timeZone) });
|
|
137
|
+
for (const result of results) {
|
|
138
|
+
const start = result.index;
|
|
139
|
+
const end = start + result.text.length;
|
|
140
|
+
const words = text.slice(start, end);
|
|
141
|
+
const key = `date:${words.toLowerCase()}`;
|
|
142
|
+
if (ignore.has(key) || skip(start, end)) continue;
|
|
143
|
+
// "Monday.com" is a product, not a weekday.
|
|
144
|
+
if (ORDINARY_WORD.test(result.text) || /^\.[a-z]/i.test(text.slice(end, end + 2))) continue;
|
|
145
|
+
// Ranges, repeats and numeric dates like 03/04 need a decision the typist hasn't made.
|
|
146
|
+
if (result.end || RECURRENCE.test(text) || NUMERIC_DATE.test(result.text)) continue;
|
|
147
|
+
const s = result.start;
|
|
148
|
+
// A month with no day ("the march", "in March") is too vague to set a deadline from.
|
|
149
|
+
if (s.isCertain('month') && !s.isCertain('day') && !s.isCertain('weekday')) continue;
|
|
150
|
+
const relative = RELATIVE_TIME.test(result.text);
|
|
151
|
+
if (s.isCertain('timezoneOffset') && !relative) continue;
|
|
152
|
+
|
|
153
|
+
let date: CalendarDate;
|
|
154
|
+
let time: ClockTime | null = null;
|
|
155
|
+
if (relative) {
|
|
156
|
+
const at = partsIn(s.date(), timeZone);
|
|
157
|
+
date = { year: at.year, month: at.month, day: at.day };
|
|
158
|
+
time = { hour: at.hour, minute: at.minute };
|
|
159
|
+
} else {
|
|
160
|
+
date = { year: s.get('year')!, month: s.get('month')!, day: s.get('day')! };
|
|
161
|
+
if (!validDate(date)) continue;
|
|
162
|
+
if (s.isCertain('hour')) {
|
|
163
|
+
let hour = s.get('hour')!;
|
|
164
|
+
// A bare "at 6" is evening and "at 9" is morning. Shown before saving, so a wrong
|
|
165
|
+
// guess costs a tap rather than a missed deadline.
|
|
166
|
+
if (!s.isCertain('meridiem') && hour >= 1 && hour <= 7
|
|
167
|
+
&& !NOON_OR_MIDNIGHT.test(result.text) && !TWENTY_FOUR_HOUR.test(result.text)) hour += 12;
|
|
168
|
+
time = { hour, minute: s.get('minute') ?? 0 };
|
|
169
|
+
}
|
|
170
|
+
const certainDay = s.isCertain('day') || s.isCertain('weekday');
|
|
171
|
+
// Roll omitted years and weekdays by calendar day, never by Chrono's implied noon.
|
|
172
|
+
if (dayNumber(date) < dayNumber(today) && !s.isCertain('year') && !PAST_REFERENCE.test(result.text)) {
|
|
173
|
+
if (s.isCertain('month') && s.isCertain('day')) date = { ...date, year: date.year + 1 };
|
|
174
|
+
else if (s.isCertain('weekday')) date = addDays(date, 7);
|
|
175
|
+
}
|
|
176
|
+
if (time && dayNumber(date) === dayNumber(today) && minutesOf(time) <= minutesOf(nowClock)) {
|
|
177
|
+
// "at 6pm" typed at 7pm means tomorrow; "Sunday 6pm" typed on Sunday evening means next week.
|
|
178
|
+
if (!certainDay) date = addDays(date, 1);
|
|
179
|
+
else if (s.isCertain('weekday') && !s.isCertain('day')) date = addDays(date, 7);
|
|
180
|
+
}
|
|
181
|
+
if (!validDate(date)) continue;
|
|
182
|
+
}
|
|
183
|
+
const past = dayNumber(date) < dayNumber(today)
|
|
184
|
+
|| (time !== null && dayNumber(date) === dayNumber(today) && minutesOf(time) <= minutesOf(nowClock));
|
|
185
|
+
if (past) continue;
|
|
186
|
+
return { kind: 'date', key, start, end, text: words, date, time } satisfies QuickAddDateToken;
|
|
187
|
+
}
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** At most one date and one project, in text order. */
|
|
192
|
+
export function parseQuickAdd(text: string, options: QuickAddOptions): QuickAddToken[] {
|
|
193
|
+
const ignore = new Set(options.ignore ?? []);
|
|
194
|
+
const project = options.projects?.length ? findProject(text, options.projects, ignore) : null;
|
|
195
|
+
const overlaps = (start: number, end: number) => !!project && start < project.end && end > project.start;
|
|
196
|
+
const date = options.dates === false ? null : findDate(text, options, ignore, overlaps);
|
|
197
|
+
return [date, project].filter((t): t is QuickAddToken => t !== null).sort((a, b) => a.start - b.start);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/** The title with recognised words removed. Falls back to the original if nothing would remain. */
|
|
201
|
+
export function stripQuickAdd(text: string, tokens: readonly QuickAddToken[]): string {
|
|
202
|
+
let out = text;
|
|
203
|
+
for (const token of [...tokens].sort((a, b) => b.start - a.start)) {
|
|
204
|
+
let before = out.slice(0, token.start);
|
|
205
|
+
if (token.kind === 'date') before = before.replace(LEADING_PREPOSITION, (m) => (/^\s/.test(m) ? ' ' : ''));
|
|
206
|
+
out = `${before} ${out.slice(token.end)}`;
|
|
207
|
+
}
|
|
208
|
+
const title = out.replace(/\s+([,.;:!?])/g, '$1').replace(/\s{2,}/g, ' ').replace(/^[\s,;:\-–]+|[\s,;:\-–]+$/g, '').trim();
|
|
209
|
+
return title || text.trim();
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* The `#fragment` being typed at the end of the text, with the projects it could become. Null
|
|
214
|
+
* when the text doesn't end in a fragment or nothing matches, so a hashtag that isn't a
|
|
215
|
+
* project doesn't keep a suggestion strip open.
|
|
216
|
+
*/
|
|
217
|
+
export function projectSuggestions(text: string, projects: readonly QuickAddProject[], limit = 5) {
|
|
218
|
+
const match = /(^|[\s(])#([^#\n]*)$/.exec(text);
|
|
219
|
+
if (!match) return null;
|
|
220
|
+
const query = match[2]!;
|
|
221
|
+
if (/^\d/.test(query) || /\s$/.test(query)) return null;
|
|
222
|
+
const start = match.index + match[1]!.length;
|
|
223
|
+
const q = query.toLowerCase();
|
|
224
|
+
const scored = projects
|
|
225
|
+
.map((p) => {
|
|
226
|
+
const name = p.name.toLowerCase();
|
|
227
|
+
const key = p.key?.toLowerCase() ?? '';
|
|
228
|
+
// Prefix, then key, then the start of a later word; anywhere inside only once the query is
|
|
229
|
+
// long enough that the match means something ("ho" is inside "School").
|
|
230
|
+
const rank = !q ? 3 : name.startsWith(q) ? 0 : key.startsWith(q) ? 1
|
|
231
|
+
: name.split(/\s+/).some((w) => w.startsWith(q)) ? 2 : q.length >= 3 && name.includes(q) ? 3 : -1;
|
|
232
|
+
return { project: p, rank };
|
|
233
|
+
})
|
|
234
|
+
.filter((s) => s.rank >= 0)
|
|
235
|
+
.sort((a, b) => a.rank - b.rank || a.project.name.localeCompare(b.project.name))
|
|
236
|
+
.slice(0, limit)
|
|
237
|
+
.map((s) => s.project);
|
|
238
|
+
// Typed out in full already: the chip says so, a strip offering the same name again is noise.
|
|
239
|
+
if (scored.length === 1 && scored[0]!.name.toLowerCase() === q) return null;
|
|
240
|
+
return scored.length ? { start, query, projects: scored } : null;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
const WEEKDAY_NAMES = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
|
244
|
+
const MONTH_NAMES = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Words for a date and time that read naturally in a title and parse back to exactly the same
|
|
248
|
+
* value: "today", "tomorrow", a weekday within the week, otherwise "28 Sep" (with the year only
|
|
249
|
+
* when it differs). Used to rewrite the title when a chip is changed, so the text never
|
|
250
|
+
* disagrees with the chip.
|
|
251
|
+
*/
|
|
252
|
+
export function datePhrase(
|
|
253
|
+
date: CalendarDate,
|
|
254
|
+
time: ClockTime | null,
|
|
255
|
+
options: { now: Date; timeZone?: string }
|
|
256
|
+
): string {
|
|
257
|
+
const today = partsIn(options.now, options.timeZone);
|
|
258
|
+
const days = dayNumber(date) - dayNumber(today);
|
|
259
|
+
const weekday = new Date(Date.UTC(date.year, date.month - 1, date.day)).getUTCDay();
|
|
260
|
+
const day =
|
|
261
|
+
days === 0 ? 'today'
|
|
262
|
+
: days === 1 ? 'tomorrow'
|
|
263
|
+
: days > 1 && days < 7 ? WEEKDAY_NAMES[weekday]!
|
|
264
|
+
: `${date.day} ${MONTH_NAMES[date.month - 1]}${date.year !== today.year ? ` ${date.year}` : ''}`;
|
|
265
|
+
if (!time) return day;
|
|
266
|
+
const hour = time.hour % 12 || 12;
|
|
267
|
+
const minute = time.minute ? `:${String(time.minute).padStart(2, '0')}` : '';
|
|
268
|
+
return `${day} at ${hour}${minute}${time.hour < 12 ? 'am' : 'pm'}`;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/** The text with one recognised token's words replaced. */
|
|
272
|
+
export function replaceToken(text: string, token: QuickAddToken, replacement: string): string {
|
|
273
|
+
return `${text.slice(0, token.start)}${replacement}${text.slice(token.end)}`;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/** Replace the `#fragment` at `start` with the chosen project's full name. */
|
|
277
|
+
export function completeProject(text: string, start: number, project: QuickAddProject): string {
|
|
278
|
+
return `${text.slice(0, start)}#${project.name} `;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
const HOUR_WORDS = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve'];
|
|
282
|
+
const HOUR_WORD = `(${HOUR_WORDS.join('|')}|\\d{1,2})`;
|
|
283
|
+
const MINUTE_WORDS: Record<string, number> = {
|
|
284
|
+
'oh five': 5, five: 5, ten: 10, fifteen: 15, twenty: 20, 'twenty five': 25, thirty: 30,
|
|
285
|
+
'thirty five': 35, forty: 40, 'forty five': 45, fifty: 50, 'fifty five': 55,
|
|
286
|
+
};
|
|
287
|
+
const MINUTE_WORD = `(${Object.keys(MINUTE_WORDS).sort((a, b) => b.length - a.length).map((w) => w.replace(' ', '[\\s-]')).join('|')})`;
|
|
288
|
+
const MERIDIEM = '(\\s*(?:a\\.?m\\.?|p\\.?m\\.?)(?![a-z]))';
|
|
289
|
+
const hourOf = (word: string) => (/^\d/.test(word) ? Number(word) : HOUR_WORDS.indexOf(word.toLowerCase()) + 1);
|
|
290
|
+
const minuteOf = (word: string) => MINUTE_WORDS[word.toLowerCase().replace(/[\s-]+/g, ' ')] ?? 0;
|
|
291
|
+
const clock = (hour: number, minute: number) => (minute ? `${hour}:${String(minute).padStart(2, '0')}` : `${hour}`);
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Spoken times in digits, so the quick-add parser reads them: speech recognition writes "monday six
|
|
295
|
+
* pm" and "half past five", and Chrono only reads "monday 6 pm" and "5:30". Only words that are
|
|
296
|
+
* certainly a time change: an hour next to am/pm, after "at", or with "o'clock" or "half past".
|
|
297
|
+
* "buy six eggs" stays as it is. Not for text being typed: the lengths change.
|
|
298
|
+
*/
|
|
299
|
+
export function spokenTimes(text: string): string {
|
|
300
|
+
const flags = 'gi';
|
|
301
|
+
return text
|
|
302
|
+
.replace(new RegExp(`\\bhalf\\s+past\\s+${HOUR_WORD}\\b`, flags), (_, h: string) => `${hourOf(h)}:30`)
|
|
303
|
+
.replace(new RegExp(`\\bquarter\\s+past\\s+${HOUR_WORD}\\b`, flags), (_, h: string) => `${hourOf(h)}:15`)
|
|
304
|
+
.replace(new RegExp(`\\bquarter\\s+to\\s+${HOUR_WORD}\\b`, flags), (_, h: string) => `${((hourOf(h) + 10) % 12) + 1}:45`)
|
|
305
|
+
.replace(new RegExp(`\\b${HOUR_WORD}\\s+o['’]?\\s?clock\\b`, flags), (_, h: string) => `${hourOf(h)}:00`)
|
|
306
|
+
.replace(new RegExp(`\\b${HOUR_WORD}(?:\\s+${MINUTE_WORD})?${MERIDIEM}`, flags), (_, h: string, m: string | undefined, ap: string) =>
|
|
307
|
+
`${clock(hourOf(h), m ? minuteOf(m) : 0)}${ap}`)
|
|
308
|
+
.replace(new RegExp(`\\b(at\\s+)${HOUR_WORD}(?:\\s+${MINUTE_WORD})?\\b`, flags), (_, at: string, h: string, m: string | undefined) =>
|
|
309
|
+
`${at}${clock(hourOf(h), m ? minuteOf(m) : 0)}`);
|
|
310
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const RecurrenceTimeZoneSchema = z.string().max(100).refine((value) => {
|
|
4
|
+
try { new Intl.DateTimeFormat('en', { timeZone: value }).format(); return true; }
|
|
5
|
+
catch { return false; }
|
|
6
|
+
}, 'Use an IANA timezone such as Asia/Kolkata');
|
|
7
|
+
|
|
8
|
+
/** Calendar days and local clock time, deliberately separate from an absolute reminder. */
|
|
9
|
+
export const RecurringReminderSchema = z.object({
|
|
10
|
+
daysBefore: z.number().int().min(0).max(31),
|
|
11
|
+
time: z.string().regex(/^(?:[01]\d|2[0-3]):[0-5]\d$/),
|
|
12
|
+
});
|
|
13
|
+
export const TaskOccurrenceSchema = z.object({
|
|
14
|
+
id: z.uuid(), taskId: z.uuid(), version: z.number().int(), ordinal: z.number().int(),
|
|
15
|
+
scheduledDate: z.iso.date(), dueDate: z.iso.date(),
|
|
16
|
+
state: z.enum(['pending', 'completed', 'skipped', 'cancelled']),
|
|
17
|
+
reminderAt: z.coerce.date().nullable(), completedAt: z.coerce.date().nullable(),
|
|
18
|
+
oneTimeReminderAt: z.coerce.date().nullable(),
|
|
19
|
+
createdAt: z.coerce.date(),
|
|
20
|
+
});
|
|
21
|
+
export const UpdateOccurrenceSchema = z.object({
|
|
22
|
+
state: z.enum(['pending', 'completed', 'skipped']).optional(),
|
|
23
|
+
dueDate: z.iso.date().optional(),
|
|
24
|
+
}).refine((value) => value.state !== undefined || value.dueDate !== undefined, 'Specify a change');
|
|
25
|
+
export type TaskOccurrence = z.infer<typeof TaskOccurrenceSchema>;
|
|
26
|
+
export type UpdateOccurrence = z.infer<typeof UpdateOccurrenceSchema>;
|
|
27
|
+
export type RecurringReminder = z.infer<typeof RecurringReminderSchema>;
|
|
28
|
+
|
|
29
|
+
/** Date-only recurrence projections use a UTC storage date, not a midnight instant to localize. */
|
|
30
|
+
export function displayTaskDueDate(task: { dueDate?: Date | string | null; recurringFrequency?: string | null; dueDatePrecision?: string | null; dueTimeZone?: string | null }): Date | null {
|
|
31
|
+
if (!task.dueDate) return null;
|
|
32
|
+
const date = new Date(task.dueDate);
|
|
33
|
+
if (task.recurringFrequency || task.dueDatePrecision === 'date' && task.dueTimeZone === 'UTC') {
|
|
34
|
+
return new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), 12);
|
|
35
|
+
}
|
|
36
|
+
return date;
|
|
37
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { RecurringReminder } from './recurrence.js';
|
|
2
|
+
|
|
3
|
+
type RelativeReminder = { rule: RecurringReminder } | { error: string };
|
|
4
|
+
const NUMBERS: Record<string, number> = {
|
|
5
|
+
a: 1, an: 1, one: 1, two: 2, three: 3, four: 4, five: 5, six: 6,
|
|
6
|
+
seven: 7, eight: 8, nine: 9, ten: 10, eleven: 11, twelve: 12,
|
|
7
|
+
};
|
|
8
|
+
const number = (word: string) => NUMBERS[word] ?? Number(word);
|
|
9
|
+
const NEED_TIME = 'Include a clock time, for example “the day before at 10pm”.';
|
|
10
|
+
const COUNT_WORD = '(?:\\d+|a|an|and|zero|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twenty|thirty|forty|fifty|sixty|seventy|eighty|ninety|hundred|thousand|million|point|half|quarter)';
|
|
11
|
+
const COMPOUND_COUNT = new RegExp(`\\b${COUNT_WORD}(?:[ -]+${COUNT_WORD})+ (?:days?|weeks?) before\\b`);
|
|
12
|
+
|
|
13
|
+
/** Null is an absolute reminder. An incomplete relative phrase must never fall back to today. */
|
|
14
|
+
export function readRelativeReminder(text: string): RelativeReminder | null {
|
|
15
|
+
const words = text.toLowerCase().replace(/\b([ap])\.?\s*m\.?/g, '$1m')
|
|
16
|
+
.replace(/[.!?]+$/, '').replace(/\s+/g, ' ').trim();
|
|
17
|
+
// Do not read just the final word of “twenty one days” as a one-day offset.
|
|
18
|
+
if (COMPOUND_COUNT.test(words)) return { error: 'Use digits for the number of whole days, for example “21 days before at 10pm”.' };
|
|
19
|
+
if (/\b(?:minutes?|hours?|months?|years?) before\b|\b(?:days?|weeks?) (?:after|earlier|prior)\b|(?:-\d+|\d+\.\d+) (?:days?|weeks?) before\b/.test(words)) {
|
|
20
|
+
return { error: 'Use whole calendar days before the due date, for example “the day before at 10pm”.' };
|
|
21
|
+
}
|
|
22
|
+
const cue = /\b(?:(?:(?:the|a|one|\d+) )?days? before|(?:\w+ )?(?:days?|weeks?) before|the same day|on (?:the )?due (?:day|date))\b/.exec(words);
|
|
23
|
+
if (!cue) return null;
|
|
24
|
+
const phrase = words.slice(cue.index).replace(/\s+(?:each time|every time|for every occurrence)$/, '');
|
|
25
|
+
const match = /^(?:((?:(?:the|a|one|\d+) )?day before)|((?:\w+) days? before)|((?:(?:the|a|one|\d+|\w+) )?weeks? before)|(the same day|on (?:the )?due (?:day|date)))(?: at (.+))?$/.exec(phrase);
|
|
26
|
+
if (!match) return { error: NEED_TIME };
|
|
27
|
+
let daysBefore = 0;
|
|
28
|
+
if (match[1]) daysBefore = number(match[1].split(' ')[0]!.replace(/^(?:the|day)$/, 'one'));
|
|
29
|
+
else if (match[2]) daysBefore = number(match[2].split(' ')[0]!);
|
|
30
|
+
else if (match[3]) daysBefore = 7 * number(match[3].split(' ')[0]!.replace(/^(?:the|week)$/, 'one'));
|
|
31
|
+
if (!Number.isInteger(daysBefore) || daysBefore < 0 || daysBefore > 31) return { error: 'Choose a reminder from the same day to 31 days before.' };
|
|
32
|
+
const clock = match[5];
|
|
33
|
+
if (!clock) return { error: NEED_TIME };
|
|
34
|
+
let hour: number;
|
|
35
|
+
let minute = 0;
|
|
36
|
+
if (clock === 'noon') hour = 12;
|
|
37
|
+
else if (clock === 'midnight') hour = 0;
|
|
38
|
+
else {
|
|
39
|
+
const time = /^(\d{1,2}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)(?::([0-5]\d))?\s*(am|pm)?$/.exec(clock);
|
|
40
|
+
if (!time) return { error: NEED_TIME };
|
|
41
|
+
hour = number(time[1]!);
|
|
42
|
+
minute = Number(time[2] ?? 0);
|
|
43
|
+
if (time[3]) {
|
|
44
|
+
if (hour < 1 || hour > 12) return { error: NEED_TIME };
|
|
45
|
+
hour = hour % 12 + (time[3] === 'pm' ? 12 : 0);
|
|
46
|
+
} else if (time[2] === undefined || hour > 23) return { error: 'Say AM or PM, or use a 24-hour time such as 22:00.' };
|
|
47
|
+
}
|
|
48
|
+
return { rule: { daysBefore, time: `${String(hour).padStart(2, '0')}:${String(minute).padStart(2, '0')}` } };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function relativeReminderLabel(rule: RecurringReminder): string {
|
|
52
|
+
const day = rule.daysBefore === 0 ? 'the same day' : rule.daysBefore === 1 ? 'the day before' : `${rule.daysBefore} days before`;
|
|
53
|
+
return `${day} at ${rule.time}, every occurrence`;
|
|
54
|
+
}
|
|
@@ -10,6 +10,11 @@ export const CreateCommentSchema = z.object({
|
|
|
10
10
|
* because the MCP server already sends it.
|
|
11
11
|
*/
|
|
12
12
|
source: z.enum(COMMENT_SOURCE_VALUES).default('user'),
|
|
13
|
+
/** Optional provider claim for agent comments; never inferred from legacy source. */
|
|
14
|
+
agentProvider: z.enum(['claude', 'codex']).nullable().optional(),
|
|
15
|
+
/** Caller-reported display metadata; a host app does not identify its model. */
|
|
16
|
+
agentModel: z.string().trim().min(1).max(100).nullable().optional(),
|
|
17
|
+
agentClient: z.string().trim().min(1).max(100).nullable().optional(),
|
|
13
18
|
});
|
|
14
19
|
|
|
15
20
|
export const CommentSchema = CreateCommentSchema.extend({
|