@opencorelabs/lucidity 0.2.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 +36 -34
- package/bin/lucidity.js +2 -0
- 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 +6 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +21 -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 +190 -34
- 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 +26 -0
- package/dist/mcp/clients.d.ts.map +1 -0
- package/dist/mcp/clients.js +193 -0
- package/dist/mcp/config.d.ts +5 -2
- package/dist/mcp/config.d.ts.map +1 -1
- package/dist/mcp/config.js +48 -6
- package/dist/mcp/paired.d.ts +2 -0
- package/dist/mcp/paired.d.ts.map +1 -0
- package/dist/mcp/paired.js +21 -0
- package/dist/mcp/pairedConfig.d.ts +3 -0
- package/dist/mcp/pairedConfig.d.ts.map +1 -0
- package/dist/mcp/pairedConfig.js +33 -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/setup/page.d.ts +3 -0
- package/dist/setup/page.d.ts.map +1 -0
- package/dist/setup/page.js +120 -0
- package/dist/setup/server.d.ts +26 -0
- package/dist/setup/server.d.ts.map +1 -0
- package/dist/setup/server.js +398 -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 +32 -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 +204 -58
- 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 +269 -0
- package/src/mcp/config.ts +58 -7
- package/src/mcp/paired.ts +23 -0
- package/src/mcp/pairedConfig.ts +44 -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/setup/page.ts +122 -0
- package/src/setup/server.ts +483 -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 +130 -48
- 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 +26 -5
- 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 +41 -5
- 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/memory.d.ts +2 -2
- package/vendor/mcp-server/dist/tools/memory.d.ts.map +1 -1
- package/vendor/mcp-server/dist/tools/memory.js +24 -14
- package/vendor/mcp-server/dist/tools/milestones.d.ts.map +1 -1
- package/vendor/mcp-server/dist/tools/milestones.js +30 -0
- package/vendor/mcp-server/dist/tools/notes.d.ts.map +1 -1
- package/vendor/mcp-server/dist/tools/notes.js +30 -5
- package/vendor/mcp-server/dist/tools/projects.d.ts.map +1 -1
- package/vendor/mcp-server/dist/tools/projects.js +15 -0
- package/vendor/mcp-server/dist/tools/queries.d.ts.map +1 -1
- package/vendor/mcp-server/dist/tools/queries.js +27 -2
- 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 +99 -22
- 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 +33 -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 +43 -4
- 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/memory.ts +26 -12
- package/vendor/mcp-server/src/tools/milestones.ts +36 -0
- package/vendor/mcp-server/src/tools/notes.ts +35 -4
- package/vendor/mcp-server/src/tools/projects.ts +18 -0
- package/vendor/mcp-server/src/tools/queries.ts +30 -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 +104 -24
- 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/brandArtwork.d.ts +4 -0
- package/vendor/shared/dist/brandArtwork.d.ts.map +1 -0
- package/vendor/shared/dist/brandArtwork.js +7 -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 -1
- package/vendor/shared/dist/index.d.ts.map +1 -1
- package/vendor/shared/dist/index.js +23 -1
- 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/setupAppearance.d.ts +6 -0
- package/vendor/shared/dist/setupAppearance.d.ts.map +1 -0
- package/vendor/shared/dist/setupAppearance.js +17 -0
- 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/brandArtwork.ts +7 -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 -0
- 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/setupAppearance.ts +32 -0
- 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,340 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const CardIdSchema = z.enum([
|
|
4
|
+
'attention',
|
|
5
|
+
'today',
|
|
6
|
+
'github',
|
|
7
|
+
'habits',
|
|
8
|
+
'habit-contributions',
|
|
9
|
+
'focus',
|
|
10
|
+
'weekly-review',
|
|
11
|
+
]);
|
|
12
|
+
export type CardId = z.infer<typeof CardIdSchema>;
|
|
13
|
+
export const CardStyleSchema = z.enum(['glance', 'act']);
|
|
14
|
+
export type CardStyle = z.infer<typeof CardStyleSchema>;
|
|
15
|
+
export const CARD_CATALOG: {
|
|
16
|
+
id: CardId;
|
|
17
|
+
name: string;
|
|
18
|
+
description: string;
|
|
19
|
+
source: string;
|
|
20
|
+
styles: boolean;
|
|
21
|
+
}[] = [
|
|
22
|
+
{
|
|
23
|
+
id: 'attention',
|
|
24
|
+
name: 'Attention',
|
|
25
|
+
description: 'A timely nudge from Lucid, with a next step you can take.',
|
|
26
|
+
source: 'Lucid on your connected computer',
|
|
27
|
+
styles: false,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: 'today',
|
|
31
|
+
name: 'Today',
|
|
32
|
+
description: 'Keep today’s tasks and overdue work in view.',
|
|
33
|
+
source: 'Your Lucidity tasks',
|
|
34
|
+
styles: false,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: 'github',
|
|
38
|
+
name: 'GitHub',
|
|
39
|
+
description: 'Your contributions, one day at a time.',
|
|
40
|
+
source: 'Your connected GitHub account',
|
|
41
|
+
styles: false,
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: 'habits',
|
|
45
|
+
name: 'Daily rhythm',
|
|
46
|
+
description: 'Small actions that add up. Set a habit and mark each day.',
|
|
47
|
+
source: 'Your habit check-ins',
|
|
48
|
+
styles: true,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: 'habit-contributions',
|
|
52
|
+
name: 'Habit contributions',
|
|
53
|
+
description: 'A card for each habit. See the days you showed up, then flip to make it yours.',
|
|
54
|
+
source: 'Your habit check-ins, shared with Daily rhythm',
|
|
55
|
+
styles: true,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: 'focus',
|
|
59
|
+
name: 'Focus',
|
|
60
|
+
description: 'Protect a little time with a 25 or 50 minute session.',
|
|
61
|
+
source: 'Your focus sessions',
|
|
62
|
+
styles: true,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: 'weekly-review',
|
|
66
|
+
name: 'Week in view',
|
|
67
|
+
description: 'Look back at finished tasks and where your week went.',
|
|
68
|
+
source: 'Completed tasks assigned to you, or created by you without an assignee',
|
|
69
|
+
styles: true,
|
|
70
|
+
},
|
|
71
|
+
];
|
|
72
|
+
|
|
73
|
+
export const CardPreferencesSchema = z.object({
|
|
74
|
+
order: z
|
|
75
|
+
.array(CardIdSchema)
|
|
76
|
+
.max(7)
|
|
77
|
+
.refine((ids) => new Set(ids).size === ids.length),
|
|
78
|
+
styles: z.object({
|
|
79
|
+
habits: CardStyleSchema,
|
|
80
|
+
'habit-contributions': CardStyleSchema.default('glance'),
|
|
81
|
+
focus: CardStyleSchema,
|
|
82
|
+
'weekly-review': CardStyleSchema,
|
|
83
|
+
}),
|
|
84
|
+
dismissed: z.array(z.string().max(240)).max(100),
|
|
85
|
+
});
|
|
86
|
+
export type CardPreferences = z.infer<typeof CardPreferencesSchema>;
|
|
87
|
+
export type StyledCardId = keyof CardPreferences['styles'];
|
|
88
|
+
export const DEFAULT_CARD_PREFERENCES: CardPreferences = {
|
|
89
|
+
order: ['attention', 'today', 'github'],
|
|
90
|
+
styles: {
|
|
91
|
+
habits: 'act',
|
|
92
|
+
'habit-contributions': 'glance',
|
|
93
|
+
focus: 'act',
|
|
94
|
+
'weekly-review': 'act',
|
|
95
|
+
},
|
|
96
|
+
dismissed: [],
|
|
97
|
+
};
|
|
98
|
+
export const CardPreferenceChangeSchema = z.discriminatedUnion('type', [
|
|
99
|
+
z.object({
|
|
100
|
+
type: z.literal('add'),
|
|
101
|
+
id: CardIdSchema,
|
|
102
|
+
index: z.number().int().min(0).max(6).optional(),
|
|
103
|
+
}),
|
|
104
|
+
z.object({ type: z.literal('remove'), id: CardIdSchema }),
|
|
105
|
+
z.object({
|
|
106
|
+
type: z.literal('move'),
|
|
107
|
+
id: CardIdSchema,
|
|
108
|
+
before: CardIdSchema.nullable(),
|
|
109
|
+
}),
|
|
110
|
+
z.object({
|
|
111
|
+
type: z.literal('style'),
|
|
112
|
+
id: z.enum(['habits', 'habit-contributions', 'focus', 'weekly-review']),
|
|
113
|
+
style: CardStyleSchema,
|
|
114
|
+
}),
|
|
115
|
+
z.object({ type: z.literal('dismiss'), key: z.string().min(1).max(240) }),
|
|
116
|
+
]);
|
|
117
|
+
export type CardPreferenceChange = z.infer<typeof CardPreferenceChangeSchema>;
|
|
118
|
+
|
|
119
|
+
/** Operations merge against the latest account state, avoiding lost edits across devices. */
|
|
120
|
+
export function changeCardPreferences(
|
|
121
|
+
current: CardPreferences,
|
|
122
|
+
change: CardPreferenceChange
|
|
123
|
+
): CardPreferences {
|
|
124
|
+
const next = {
|
|
125
|
+
order: [...current.order],
|
|
126
|
+
styles: { ...current.styles },
|
|
127
|
+
dismissed: [...current.dismissed],
|
|
128
|
+
};
|
|
129
|
+
if (change.type === 'add' && !next.order.includes(change.id))
|
|
130
|
+
next.order.splice(change.index ?? next.order.length, 0, change.id);
|
|
131
|
+
if (change.type === 'remove') next.order = next.order.filter((id) => id !== change.id);
|
|
132
|
+
if (change.type === 'move' && next.order.includes(change.id) && change.before !== change.id) {
|
|
133
|
+
next.order = next.order.filter((id) => id !== change.id);
|
|
134
|
+
const index = change.before === null ? -1 : next.order.indexOf(change.before);
|
|
135
|
+
next.order.splice(index < 0 ? next.order.length : index, 0, change.id);
|
|
136
|
+
}
|
|
137
|
+
if (change.type === 'style') next.styles[change.id] = change.style;
|
|
138
|
+
if (change.type === 'dismiss')
|
|
139
|
+
next.dismissed = [...new Set([...next.dismissed, change.key])].slice(-100);
|
|
140
|
+
return next;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export const StudioDateSchema = z
|
|
144
|
+
.string()
|
|
145
|
+
.regex(/^\d{4}-\d{2}-\d{2}$/)
|
|
146
|
+
.refine((value) => {
|
|
147
|
+
const date = new Date(`${value}T12:00:00Z`);
|
|
148
|
+
return Number.isFinite(date.getTime()) && date.toISOString().slice(0, 10) === value;
|
|
149
|
+
});
|
|
150
|
+
export function studioLocalDate(now: Date, timeZone: string): string {
|
|
151
|
+
const parts = new Intl.DateTimeFormat('en-US', {
|
|
152
|
+
timeZone,
|
|
153
|
+
year: 'numeric',
|
|
154
|
+
month: '2-digit',
|
|
155
|
+
day: '2-digit',
|
|
156
|
+
}).formatToParts(now);
|
|
157
|
+
const part = (type: string) => parts.find((p) => p.type === type)!.value;
|
|
158
|
+
return `${part('year')}-${part('month')}-${part('day')}`;
|
|
159
|
+
}
|
|
160
|
+
export function shiftStudioDate(date: string, days: number): string {
|
|
161
|
+
const value = new Date(`${date}T12:00:00Z`);
|
|
162
|
+
value.setUTCDate(value.getUTCDate() + days);
|
|
163
|
+
return value.toISOString().slice(0, 10);
|
|
164
|
+
}
|
|
165
|
+
/** Previous complete Monday–Sunday week; calendar arithmetic is independent of DST. */
|
|
166
|
+
export function studioWeek(today: string, offset = 0) {
|
|
167
|
+
const weekday = (new Date(`${today}T12:00:00Z`).getUTCDay() + 6) % 7;
|
|
168
|
+
const start = shiftStudioDate(today, -weekday - 7 + offset * 7);
|
|
169
|
+
return {
|
|
170
|
+
start,
|
|
171
|
+
end: shiftStudioDate(start, 7),
|
|
172
|
+
days: Array.from({ length: 7 }, (_, i) => shiftStudioDate(start, i)),
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export const HabitColorSchema = z.enum(['green', 'amber', 'berry', 'blue', 'coral', 'teal']);
|
|
177
|
+
export type HabitColor = z.infer<typeof HabitColorSchema>;
|
|
178
|
+
export const HabitIconSchema = z.enum([
|
|
179
|
+
'check',
|
|
180
|
+
'book',
|
|
181
|
+
'guitar',
|
|
182
|
+
'dumbbell',
|
|
183
|
+
'walk',
|
|
184
|
+
'water',
|
|
185
|
+
'leaf',
|
|
186
|
+
'heart',
|
|
187
|
+
'moon',
|
|
188
|
+
'pencil',
|
|
189
|
+
'code',
|
|
190
|
+
'music',
|
|
191
|
+
]);
|
|
192
|
+
export type HabitIcon = z.infer<typeof HabitIconSchema>;
|
|
193
|
+
/** Recent editable days plus an immutable prefix keep lifetime statistics small and exact. */
|
|
194
|
+
export const HabitHistorySchema = z.object({
|
|
195
|
+
windowStart: StudioDateSchema,
|
|
196
|
+
firstDayBefore: StudioDateSchema.nullable(),
|
|
197
|
+
totalBefore: z.number().int().nonnegative(),
|
|
198
|
+
longestBefore: z.number().int().nonnegative(),
|
|
199
|
+
streakBefore: z.number().int().nonnegative(),
|
|
200
|
+
days: z.array(StudioDateSchema),
|
|
201
|
+
});
|
|
202
|
+
export type HabitHistory = z.infer<typeof HabitHistorySchema>;
|
|
203
|
+
export const HabitInputSchema = z.object({
|
|
204
|
+
name: z.string().trim().min(1).max(80),
|
|
205
|
+
goal: z.string().trim().max(80).default(''),
|
|
206
|
+
color: HabitColorSchema.optional(),
|
|
207
|
+
// Optional for older clients/caches; the database supplies the default on creation.
|
|
208
|
+
icon: HabitIconSchema.optional(),
|
|
209
|
+
});
|
|
210
|
+
export const HabitSchema = HabitInputSchema.extend({
|
|
211
|
+
id: z.string().uuid(),
|
|
212
|
+
archived: z.boolean(),
|
|
213
|
+
createdAt: z.string(),
|
|
214
|
+
updatedAt: z.string(),
|
|
215
|
+
days: z.array(StudioDateSchema),
|
|
216
|
+
// Optional while old devices/caches transition; missing history is not a zero total.
|
|
217
|
+
history: HabitHistorySchema.optional(),
|
|
218
|
+
});
|
|
219
|
+
export type StudioHabit = z.infer<typeof HabitSchema>;
|
|
220
|
+
export const FocusSessionSchema = z.object({
|
|
221
|
+
id: z.string().uuid(),
|
|
222
|
+
taskId: z.string().uuid().nullable(),
|
|
223
|
+
taskTitle: z.string().nullable(),
|
|
224
|
+
durationSeconds: z.number(),
|
|
225
|
+
elapsedSeconds: z.number(),
|
|
226
|
+
resumedAt: z.string().nullable(),
|
|
227
|
+
startedAt: z.string(),
|
|
228
|
+
endedAt: z.string().nullable(),
|
|
229
|
+
status: z.enum(['running', 'paused', 'completed', 'ended']),
|
|
230
|
+
revision: z.number(),
|
|
231
|
+
});
|
|
232
|
+
export type FocusSession = z.infer<typeof FocusSessionSchema>;
|
|
233
|
+
export function focusElapsed(
|
|
234
|
+
session: Pick<FocusSession, 'elapsedSeconds' | 'resumedAt' | 'durationSeconds'>,
|
|
235
|
+
now = Date.now()
|
|
236
|
+
) {
|
|
237
|
+
return Math.min(
|
|
238
|
+
session.durationSeconds,
|
|
239
|
+
session.elapsedSeconds +
|
|
240
|
+
(session.resumedAt
|
|
241
|
+
? Math.max(0, Math.floor((now - Date.parse(session.resumedAt)) / 1000))
|
|
242
|
+
: 0)
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
export const StudioSnapshotSchema = z.object({
|
|
246
|
+
revision: z.number().int().nonnegative().default(0),
|
|
247
|
+
preferences: CardPreferencesSchema,
|
|
248
|
+
habits: z.array(HabitSchema),
|
|
249
|
+
focus: z.object({
|
|
250
|
+
active: FocusSessionSchema.nullable(),
|
|
251
|
+
history: z.array(FocusSessionSchema),
|
|
252
|
+
}),
|
|
253
|
+
refreshedAt: z.string(),
|
|
254
|
+
today: StudioDateSchema,
|
|
255
|
+
});
|
|
256
|
+
export type StudioSnapshot = z.infer<typeof StudioSnapshotSchema>;
|
|
257
|
+
export const WeeklyReviewSchema = z.object({
|
|
258
|
+
start: StudioDateSchema,
|
|
259
|
+
end: StudioDateSchema,
|
|
260
|
+
total: z.number(),
|
|
261
|
+
refreshedAt: z.string(),
|
|
262
|
+
days: z.array(z.object({ date: StudioDateSchema, count: z.number() })),
|
|
263
|
+
projects: z.array(
|
|
264
|
+
z.object({
|
|
265
|
+
id: z.string().nullable(),
|
|
266
|
+
name: z.string(),
|
|
267
|
+
count: z.number(),
|
|
268
|
+
})
|
|
269
|
+
),
|
|
270
|
+
tasks: z.array(z.object({ id: z.string(), title: z.string(), completedAt: z.string() })),
|
|
271
|
+
nextOffset: z.number().nullable(),
|
|
272
|
+
});
|
|
273
|
+
export type WeeklyReview = z.infer<typeof WeeklyReviewSchema>;
|
|
274
|
+
|
|
275
|
+
/** Durable commands carry desired values; replaying a toggle would undo the user's intent. */
|
|
276
|
+
export const StudioCommandSchema = z.discriminatedUnion('type', [
|
|
277
|
+
z.object({
|
|
278
|
+
type: z.literal('preferences'),
|
|
279
|
+
changes: z.array(CardPreferenceChangeSchema).min(1).max(12),
|
|
280
|
+
}),
|
|
281
|
+
z.object({
|
|
282
|
+
type: z.literal('check-in'),
|
|
283
|
+
habitId: z.string().uuid(),
|
|
284
|
+
day: StudioDateSchema,
|
|
285
|
+
checked: z.boolean(),
|
|
286
|
+
timeZone: z.string().min(1).max(100),
|
|
287
|
+
}),
|
|
288
|
+
]);
|
|
289
|
+
export type StudioCommand = z.infer<typeof StudioCommandSchema>;
|
|
290
|
+
export const StudioOperationSchema = z.object({
|
|
291
|
+
version: z.literal(1),
|
|
292
|
+
id: z.string().uuid(),
|
|
293
|
+
command: StudioCommandSchema,
|
|
294
|
+
});
|
|
295
|
+
export type StudioOperation = z.infer<typeof StudioOperationSchema>;
|
|
296
|
+
export const StudioAcknowledgmentSchema = z.object({
|
|
297
|
+
id: z.string().uuid(),
|
|
298
|
+
revision: z.number().int().nonnegative(),
|
|
299
|
+
preferences: CardPreferencesSchema,
|
|
300
|
+
});
|
|
301
|
+
export type StudioAcknowledgment = z.infer<typeof StudioAcknowledgmentSchema>;
|
|
302
|
+
export const CardStoreRecordSchema = z.object({
|
|
303
|
+
version: z.literal(1),
|
|
304
|
+
confirmed: StudioSnapshotSchema.nullable(),
|
|
305
|
+
operations: z.array(StudioOperationSchema.extend({ failure: z.string().optional() })),
|
|
306
|
+
faces: z.record(z.string(), z.object({ face: CardStyleSchema, defaultStyle: CardStyleSchema })),
|
|
307
|
+
});
|
|
308
|
+
export type CardStoreRecord = z.infer<typeof CardStoreRecordSchema>;
|
|
309
|
+
export function applyStudioCommand(
|
|
310
|
+
snapshot: StudioSnapshot,
|
|
311
|
+
command: StudioCommand
|
|
312
|
+
): StudioSnapshot {
|
|
313
|
+
if (command.type === 'preferences')
|
|
314
|
+
return {
|
|
315
|
+
...snapshot,
|
|
316
|
+
preferences: command.changes.reduce(changeCardPreferences, snapshot.preferences),
|
|
317
|
+
};
|
|
318
|
+
return {
|
|
319
|
+
...snapshot,
|
|
320
|
+
habits: snapshot.habits.map((habit) =>
|
|
321
|
+
habit.id !== command.habitId
|
|
322
|
+
? habit
|
|
323
|
+
: {
|
|
324
|
+
...habit,
|
|
325
|
+
days: command.checked
|
|
326
|
+
? [...new Set([...habit.days, command.day])].sort()
|
|
327
|
+
: habit.days.filter((day) => day !== command.day),
|
|
328
|
+
history:
|
|
329
|
+
habit.history && command.day >= habit.history.windowStart
|
|
330
|
+
? {
|
|
331
|
+
...habit.history,
|
|
332
|
+
days: command.checked
|
|
333
|
+
? [...new Set([...habit.history.days, command.day])].sort()
|
|
334
|
+
: habit.history.days.filter((day) => day !== command.day),
|
|
335
|
+
}
|
|
336
|
+
: habit.history,
|
|
337
|
+
}
|
|
338
|
+
),
|
|
339
|
+
};
|
|
340
|
+
}
|