@opencorelabs/lucidity 0.3.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -3
- package/dist/assets/speech/licenses/FluidAudio/LICENSE +201 -0
- package/dist/assets/speech/licenses/FluidAudio/ThirdPartyLicenses/fastcluster-LICENSE.md +11 -0
- package/dist/assets/speech/licenses/FluidAudio/ThirdPartyLicenses/vbx-LICENSE.md +201 -0
- package/dist/assets/speech/lucidity-speech +0 -0
- package/dist/automations/agent.d.ts +16 -0
- package/dist/automations/agent.d.ts.map +1 -0
- package/dist/automations/agent.js +196 -0
- package/dist/automations/cli.d.ts +4 -0
- package/dist/automations/cli.d.ts.map +1 -0
- package/dist/automations/cli.js +44 -0
- package/dist/automations/connections.d.ts +11 -0
- package/dist/automations/connections.d.ts.map +1 -0
- package/dist/automations/connections.js +74 -0
- package/dist/automations/designer.d.ts +39 -0
- package/dist/automations/designer.d.ts.map +1 -0
- package/dist/automations/designer.js +450 -0
- package/dist/automations/history.d.ts +4 -0
- package/dist/automations/history.d.ts.map +1 -0
- package/dist/automations/history.js +57 -0
- package/dist/automations/learning.d.ts +19 -0
- package/dist/automations/learning.d.ts.map +1 -0
- package/dist/automations/learning.js +121 -0
- package/dist/automations/pinterest.d.ts +21 -0
- package/dist/automations/pinterest.d.ts.map +1 -0
- package/dist/automations/pinterest.js +113 -0
- package/dist/automations/service.d.ts +42 -0
- package/dist/automations/service.d.ts.map +1 -0
- package/dist/automations/service.js +406 -0
- package/dist/automations/setup.d.ts +3 -0
- package/dist/automations/setup.d.ts.map +1 -0
- package/dist/automations/setup.js +48 -0
- package/dist/automations/skill.d.ts +3 -0
- package/dist/automations/skill.d.ts.map +1 -0
- package/dist/automations/skill.js +29 -0
- package/dist/automations/store.d.ts +13 -0
- package/dist/automations/store.d.ts.map +1 -0
- package/dist/automations/store.js +46 -0
- package/dist/chat/server.d.ts +2 -0
- package/dist/chat/server.d.ts.map +1 -1
- package/dist/chat/server.js +46 -2
- package/dist/coding/commandContext.d.ts +6 -0
- package/dist/coding/commandContext.d.ts.map +1 -0
- package/dist/coding/commandContext.js +20 -0
- package/dist/coding/runCodeTurn.d.ts +12 -2
- package/dist/coding/runCodeTurn.d.ts.map +1 -1
- package/dist/coding/runCodeTurn.js +49 -19
- package/dist/coding/worktree.d.ts +3 -4
- package/dist/coding/worktree.d.ts.map +1 -1
- package/dist/coding/worktree.js +3 -4
- package/dist/config.d.ts +4 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +20 -3
- package/dist/decisions/cli.d.ts +2 -0
- package/dist/decisions/cli.d.ts.map +1 -0
- package/dist/decisions/cli.js +106 -0
- package/dist/decisions/client.d.ts +20 -0
- package/dist/decisions/client.d.ts.map +1 -0
- package/dist/decisions/client.js +41 -0
- package/dist/handoff.d.ts +11 -0
- package/dist/handoff.d.ts.map +1 -0
- package/dist/handoff.js +21 -0
- package/dist/index.js +185 -40
- package/dist/jobs/briefing.js +1 -1
- package/dist/jobs/extraction.d.ts.map +1 -1
- package/dist/jobs/extraction.js +112 -22
- package/dist/jobs/fastModeReview.d.ts +39 -0
- package/dist/jobs/fastModeReview.d.ts.map +1 -0
- package/dist/jobs/fastModeReview.js +192 -0
- package/dist/jobs/voiceReview.d.ts +24 -0
- package/dist/jobs/voiceReview.d.ts.map +1 -0
- package/dist/jobs/voiceReview.js +128 -0
- package/dist/mcp/clients.d.ts +5 -0
- package/dist/mcp/clients.d.ts.map +1 -1
- package/dist/mcp/clients.js +1 -1
- package/dist/mcp/config.d.ts +3 -1
- package/dist/mcp/config.d.ts.map +1 -1
- package/dist/mcp/config.js +48 -6
- package/dist/mcp/paired.js +1 -0
- package/dist/notesContext.d.ts.map +1 -1
- package/dist/notesContext.js +3 -2
- package/dist/room/client.d.ts +20 -7
- package/dist/room/client.d.ts.map +1 -1
- package/dist/room/client.js +266 -47
- package/dist/room/computer.d.ts.map +1 -1
- package/dist/room/computer.js +9 -0
- package/dist/room/context.d.ts +3 -2
- package/dist/room/context.d.ts.map +1 -1
- package/dist/room/context.js +10 -3
- package/dist/room/turnQueue.d.ts +40 -0
- package/dist/room/turnQueue.d.ts.map +1 -0
- package/dist/room/turnQueue.js +301 -0
- package/dist/skills/lucidity-automations/SKILL.md +54 -0
- package/dist/speech/captures.d.ts +30 -0
- package/dist/speech/captures.d.ts.map +1 -0
- package/dist/speech/captures.js +209 -0
- package/dist/speech/fluidAudio.d.ts +28 -0
- package/dist/speech/fluidAudio.d.ts.map +1 -0
- package/dist/speech/fluidAudio.js +182 -0
- package/dist/speech/service.d.ts +14 -0
- package/dist/speech/service.d.ts.map +1 -0
- package/dist/speech/service.js +88 -0
- package/dist/speech/types.d.ts +19 -0
- package/dist/speech/types.d.ts.map +1 -0
- package/dist/speech/types.js +1 -0
- package/dist/turnLog.d.ts +1 -0
- package/dist/turnLog.d.ts.map +1 -1
- package/dist/turnLog.js +3 -0
- package/native/speech/Package.resolved +15 -0
- package/native/speech/Package.swift +16 -0
- package/native/speech/Sources/lucidity-speech/Speech.swift +81 -0
- package/package.json +6 -2
- package/src/automations/agent.ts +239 -0
- package/src/automations/cli.ts +52 -0
- package/src/automations/connections.ts +83 -0
- package/src/automations/designer.ts +594 -0
- package/src/automations/history.ts +59 -0
- package/src/automations/learning.ts +180 -0
- package/src/automations/pinterest.ts +146 -0
- package/src/automations/service.ts +505 -0
- package/src/automations/setup.ts +71 -0
- package/src/automations/skill.ts +40 -0
- package/src/automations/store.ts +63 -0
- package/src/chat/server.ts +62 -3
- package/src/coding/commandContext.ts +29 -0
- package/src/coding/runCodeTurn.ts +65 -21
- package/src/coding/worktree.ts +3 -4
- package/src/config.ts +29 -2
- package/src/decisions/cli.ts +136 -0
- package/src/decisions/client.ts +62 -0
- package/src/handoff.ts +28 -0
- package/src/index.ts +202 -67
- package/src/jobs/briefing.ts +1 -1
- package/src/jobs/extraction.ts +157 -32
- package/src/jobs/fastModeReview.ts +221 -0
- package/src/jobs/voiceReview.ts +156 -0
- package/src/mcp/clients.ts +1 -1
- package/src/mcp/config.ts +56 -6
- package/src/mcp/paired.ts +1 -0
- package/src/notesContext.ts +3 -2
- package/src/room/client.ts +320 -54
- package/src/room/computer.ts +9 -0
- package/src/room/context.ts +12 -3
- package/src/room/turnQueue.ts +358 -0
- package/src/speech/captures.ts +265 -0
- package/src/speech/fluidAudio.ts +242 -0
- package/src/speech/service.ts +108 -0
- package/src/speech/types.ts +13 -0
- package/src/turnLog.ts +4 -0
- package/vendor/decisions/LICENSE +662 -0
- package/vendor/decisions/dist/capture.d.ts +79 -0
- package/vendor/decisions/dist/capture.js +183 -0
- package/vendor/decisions/dist/command.d.ts +202 -0
- package/vendor/decisions/dist/command.js +750 -0
- package/vendor/decisions/dist/dayPlan.d.ts +9 -0
- package/vendor/decisions/dist/dayPlan.js +82 -0
- package/vendor/decisions/dist/gate.d.ts +12 -0
- package/vendor/decisions/dist/gate.js +18 -0
- package/vendor/decisions/dist/index.d.ts +6 -0
- package/vendor/decisions/dist/index.js +6 -0
- package/vendor/decisions/dist/jev.d.ts +15 -0
- package/vendor/decisions/dist/jev.js +244 -0
- package/vendor/decisions/dist/types.d.ts +67 -0
- package/vendor/decisions/dist/types.js +1 -0
- package/vendor/decisions/package.json +22 -0
- package/vendor/decisions/src/capture.ts +199 -0
- package/vendor/decisions/src/command.ts +836 -0
- package/vendor/decisions/src/dayPlan.ts +80 -0
- package/vendor/decisions/src/gate.ts +32 -0
- package/vendor/decisions/src/index.ts +6 -0
- package/vendor/decisions/src/jev.ts +295 -0
- package/vendor/decisions/src/types.ts +79 -0
- package/vendor/mcp-server/README.md +6 -1
- package/vendor/mcp-server/dist/client.d.ts +1 -0
- package/vendor/mcp-server/dist/client.d.ts.map +1 -1
- package/vendor/mcp-server/dist/client.js +8 -0
- package/vendor/mcp-server/dist/commentProvider.d.ts +3 -0
- package/vendor/mcp-server/dist/commentProvider.d.ts.map +1 -0
- package/vendor/mcp-server/dist/commentProvider.js +10 -0
- package/vendor/mcp-server/dist/index.js +21 -6
- package/vendor/mcp-server/dist/tools/automations.d.ts +6 -0
- package/vendor/mcp-server/dist/tools/automations.d.ts.map +1 -0
- package/vendor/mcp-server/dist/tools/automations.js +163 -0
- package/vendor/mcp-server/dist/tools/commandEventFormat.d.ts +52 -0
- package/vendor/mcp-server/dist/tools/commandEventFormat.d.ts.map +1 -0
- package/vendor/mcp-server/dist/tools/commandEventFormat.js +83 -0
- package/vendor/mcp-server/dist/tools/commandEvents.d.ts +3 -0
- package/vendor/mcp-server/dist/tools/commandEvents.d.ts.map +1 -0
- package/vendor/mcp-server/dist/tools/commandEvents.js +21 -0
- package/vendor/mcp-server/dist/tools/comments.d.ts.map +1 -1
- package/vendor/mcp-server/dist/tools/comments.js +25 -4
- package/vendor/mcp-server/dist/tools/index.d.ts +2 -0
- package/vendor/mcp-server/dist/tools/index.d.ts.map +1 -1
- package/vendor/mcp-server/dist/tools/index.js +2 -0
- package/vendor/mcp-server/dist/tools/journal.d.ts +3 -0
- package/vendor/mcp-server/dist/tools/journal.d.ts.map +1 -0
- package/vendor/mcp-server/dist/tools/journal.js +131 -0
- package/vendor/mcp-server/dist/tools/taskActivity.d.ts +3 -0
- package/vendor/mcp-server/dist/tools/taskActivity.d.ts.map +1 -0
- package/vendor/mcp-server/dist/tools/taskActivity.js +32 -0
- package/vendor/mcp-server/dist/tools/taskOccurrences.d.ts +3 -0
- package/vendor/mcp-server/dist/tools/taskOccurrences.d.ts.map +1 -0
- package/vendor/mcp-server/dist/tools/taskOccurrences.js +12 -0
- package/vendor/mcp-server/dist/tools/taskTrash.d.ts +3 -0
- package/vendor/mcp-server/dist/tools/taskTrash.d.ts.map +1 -0
- package/vendor/mcp-server/dist/tools/taskTrash.js +21 -0
- package/vendor/mcp-server/dist/tools/tasks.d.ts.map +1 -1
- package/vendor/mcp-server/dist/tools/tasks.js +67 -27
- package/vendor/mcp-server/package.json +5 -1
- package/vendor/mcp-server/src/client.ts +10 -0
- package/vendor/mcp-server/src/commentProvider.ts +9 -0
- package/vendor/mcp-server/src/index.ts +20 -6
- package/vendor/mcp-server/src/tools/automations.ts +199 -0
- package/vendor/mcp-server/src/tools/commandEventFormat.ts +108 -0
- package/vendor/mcp-server/src/tools/commandEvents.ts +27 -0
- package/vendor/mcp-server/src/tools/comments.ts +24 -3
- package/vendor/mcp-server/src/tools/index.ts +2 -0
- package/vendor/mcp-server/src/tools/journal.ts +168 -0
- package/vendor/mcp-server/src/tools/taskActivity.ts +55 -0
- package/vendor/mcp-server/src/tools/taskOccurrences.ts +26 -0
- package/vendor/mcp-server/src/tools/taskTrash.ts +23 -0
- package/vendor/mcp-server/src/tools/tasks.ts +66 -30
- package/vendor/notes/dist/index.d.ts +2 -0
- package/vendor/notes/dist/index.d.ts.map +1 -1
- package/vendor/notes/dist/index.js +2 -0
- package/vendor/notes/dist/journal-backend.d.ts +4 -0
- package/vendor/notes/dist/journal-backend.d.ts.map +1 -0
- package/vendor/notes/dist/journal-backend.js +33 -0
- package/vendor/notes/dist/journal.d.ts +7 -0
- package/vendor/notes/dist/journal.d.ts.map +1 -0
- package/vendor/notes/dist/journal.js +173 -0
- package/vendor/notes/dist/vault.d.ts.map +1 -1
- package/vendor/notes/dist/vault.js +6 -1
- package/vendor/notes/src/index.ts +2 -0
- package/vendor/notes/src/journal-backend.ts +53 -0
- package/vendor/notes/src/journal.ts +194 -0
- package/vendor/notes/src/vault.ts +9 -1
- package/vendor/runtime/README.md +4 -0
- package/vendor/runtime/dist/executor/claudeAgent.d.ts +2 -0
- package/vendor/runtime/dist/executor/claudeAgent.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/claudeAgent.js +117 -8
- package/vendor/runtime/dist/executor/claudeCode.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/claudeCode.js +8 -4
- package/vendor/runtime/dist/executor/codex.d.ts +2 -0
- package/vendor/runtime/dist/executor/codex.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/codex.js +214 -11
- package/vendor/runtime/dist/executor/codexProtocol/PlanType.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/PlanType.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/PlanType.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CreditsSnapshot.d.ts +6 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CreditsSnapshot.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CreditsSnapshot.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/GetAccountRateLimitsResponse.d.ts +26 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/GetAccountRateLimitsResponse.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/GetAccountRateLimitsResponse.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitReachedType.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitReachedType.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitReachedType.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCredit.d.ts +27 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCredit.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCredit.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCreditStatus.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCreditStatus.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCreditStatus.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCreditsSummary.d.ts +13 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCreditsSummary.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetCreditsSummary.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetType.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetType.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitResetType.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitSnapshot.d.ts +20 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitSnapshot.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitSnapshot.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitWindow.d.ts +6 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitWindow.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitWindow.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewDelivery.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewDelivery.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewDelivery.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewStartParams.d.ts +12 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewStartParams.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewStartParams.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewTarget.d.ts +17 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewTarget.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewTarget.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillDependencies.d.ts +5 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillDependencies.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillDependencies.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillErrorInfo.d.ts +5 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillErrorInfo.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillErrorInfo.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillInterface.d.ts +18 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillInterface.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillInterface.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillMetadata.d.ts +22 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillMetadata.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillMetadata.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillScope.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillScope.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillScope.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillToolDependency.d.ts +9 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillToolDependency.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillToolDependency.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillsListEntry.d.ts +8 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillsListEntry.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillsListEntry.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillsListResponse.d.ts +5 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillsListResponse.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SkillsListResponse.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SpendControlLimitSnapshot.d.ts +7 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SpendControlLimitSnapshot.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SpendControlLimitSnapshot.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSetNameParams.d.ts +5 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSetNameParams.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSetNameParams.js +2 -0
- package/vendor/runtime/dist/executor/health.d.ts +1 -0
- package/vendor/runtime/dist/executor/health.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/health.js +3 -0
- package/vendor/runtime/dist/executor/liveTurns.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/liveTurns.js +3 -0
- package/vendor/runtime/dist/executor/providerRouter.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/providerRouter.js +2 -1
- package/vendor/runtime/dist/executor/types.d.ts +10 -0
- package/vendor/runtime/dist/executor/types.d.ts.map +1 -1
- package/vendor/runtime/dist/harness/index.d.ts +2 -0
- package/vendor/runtime/dist/harness/index.d.ts.map +1 -1
- package/vendor/runtime/dist/harness/index.js +46 -1
- package/vendor/runtime/dist/harness/types.d.ts +5 -1
- package/vendor/runtime/dist/harness/types.d.ts.map +1 -1
- package/vendor/runtime/dist/index.d.ts +2 -1
- package/vendor/runtime/dist/index.d.ts.map +1 -1
- package/vendor/runtime/dist/index.js +2 -0
- package/vendor/runtime/dist/journal/context.d.ts +18 -0
- package/vendor/runtime/dist/journal/context.d.ts.map +1 -1
- package/vendor/runtime/dist/journal/context.js +19 -5
- package/vendor/runtime/dist/prompts/briefing.d.ts +4 -7
- package/vendor/runtime/dist/prompts/briefing.d.ts.map +1 -1
- package/vendor/runtime/dist/prompts/briefing.js +61 -12
- package/vendor/runtime/dist/prompts/cardStatement.d.ts +7 -0
- package/vendor/runtime/dist/prompts/cardStatement.d.ts.map +1 -0
- package/vendor/runtime/dist/prompts/cardStatement.js +52 -0
- package/vendor/runtime/dist/prompts/chat.d.ts +1 -0
- package/vendor/runtime/dist/prompts/chat.d.ts.map +1 -1
- package/vendor/runtime/dist/prompts/chat.js +15 -1
- package/vendor/runtime/dist/prompts/dayPlanning.d.ts +44 -0
- package/vendor/runtime/dist/prompts/dayPlanning.d.ts.map +1 -0
- package/vendor/runtime/dist/prompts/dayPlanning.js +42 -0
- package/vendor/runtime/dist/prompts/projectCapture.d.ts +7 -0
- package/vendor/runtime/dist/prompts/projectCapture.d.ts.map +1 -0
- package/vendor/runtime/dist/prompts/projectCapture.js +31 -0
- package/vendor/runtime/src/executor/claudeAgent.ts +137 -7
- package/vendor/runtime/src/executor/claudeCode.ts +6 -4
- package/vendor/runtime/src/executor/codex.ts +281 -20
- package/vendor/runtime/src/executor/codexProtocol/PlanType.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/CreditsSnapshot.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/GetAccountRateLimitsResponse.ts +25 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/RateLimitReachedType.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/RateLimitResetCredit.ts +27 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/RateLimitResetCreditStatus.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/RateLimitResetCreditsSummary.ts +14 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/RateLimitResetType.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/RateLimitSnapshot.ts +14 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/RateLimitWindow.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/ReviewDelivery.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/ReviewStartParams.ts +12 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/ReviewTarget.ts +9 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/SkillDependencies.ts +6 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/SkillErrorInfo.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/SkillInterface.ts +14 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/SkillMetadata.ts +17 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/SkillScope.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/SkillToolDependency.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/SkillsListEntry.ts +7 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/SkillsListResponse.ts +6 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/SpendControlLimitSnapshot.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/ThreadSetNameParams.ts +5 -0
- package/vendor/runtime/src/executor/health.ts +3 -0
- package/vendor/runtime/src/executor/liveTurns.ts +3 -0
- package/vendor/runtime/src/executor/providerRouter.ts +2 -1
- package/vendor/runtime/src/executor/types.ts +10 -0
- package/vendor/runtime/src/harness/index.ts +51 -6
- package/vendor/runtime/src/harness/types.ts +5 -1
- package/vendor/runtime/src/index.ts +4 -1
- package/vendor/runtime/src/journal/context.ts +40 -7
- package/vendor/runtime/src/prompts/briefing.ts +62 -17
- package/vendor/runtime/src/prompts/cardStatement.ts +64 -0
- package/vendor/runtime/src/prompts/chat.ts +25 -3
- package/vendor/runtime/src/prompts/dayPlanning.ts +46 -0
- package/vendor/runtime/src/prompts/projectCapture.ts +51 -0
- package/vendor/shared/dist/agentCommands.d.ts +22 -0
- package/vendor/shared/dist/agentCommands.d.ts.map +1 -0
- package/vendor/shared/dist/agentCommands.js +11 -0
- package/vendor/shared/dist/automationTemplates.d.ts +37 -0
- package/vendor/shared/dist/automationTemplates.d.ts.map +1 -0
- package/vendor/shared/dist/automationTemplates.js +48 -0
- package/vendor/shared/dist/automations.d.ts +1052 -0
- package/vendor/shared/dist/automations.d.ts.map +1 -0
- package/vendor/shared/dist/automations.js +300 -0
- package/vendor/shared/dist/cardStatement.d.ts +28 -0
- package/vendor/shared/dist/cardStatement.d.ts.map +1 -0
- package/vendor/shared/dist/cardStatement.js +37 -0
- package/vendor/shared/dist/cardStudio.d.ts +756 -0
- package/vendor/shared/dist/cardStudio.d.ts.map +1 -0
- package/vendor/shared/dist/cardStudio.js +297 -0
- package/vendor/shared/dist/commandLocal.d.ts +218 -0
- package/vendor/shared/dist/commandLocal.d.ts.map +1 -0
- package/vendor/shared/dist/commandLocal.js +664 -0
- package/vendor/shared/dist/commandText.d.ts +12 -0
- package/vendor/shared/dist/commandText.d.ts.map +1 -0
- package/vendor/shared/dist/commandText.js +21 -0
- package/vendor/shared/dist/commands.d.ts +1534 -0
- package/vendor/shared/dist/commands.d.ts.map +1 -0
- package/vendor/shared/dist/commands.js +233 -0
- package/vendor/shared/dist/computer.d.ts +9 -9
- package/vendor/shared/dist/computer.d.ts.map +1 -1
- package/vendor/shared/dist/computer.js +12 -2
- package/vendor/shared/dist/constants.d.ts +3 -3
- package/vendor/shared/dist/constants.d.ts.map +1 -1
- package/vendor/shared/dist/constants.js +9 -2
- package/vendor/shared/dist/dayPlan.d.ts +86 -0
- package/vendor/shared/dist/dayPlan.d.ts.map +1 -0
- package/vendor/shared/dist/dayPlan.js +46 -0
- package/vendor/shared/dist/dayPlanning.d.ts +139 -0
- package/vendor/shared/dist/dayPlanning.d.ts.map +1 -0
- package/vendor/shared/dist/dayPlanning.js +67 -0
- package/vendor/shared/dist/githubContributions.d.ts +93 -0
- package/vendor/shared/dist/githubContributions.d.ts.map +1 -0
- package/vendor/shared/dist/githubContributions.js +54 -0
- package/vendor/shared/dist/habitContributions.d.ts +26 -0
- package/vendor/shared/dist/habitContributions.d.ts.map +1 -0
- package/vendor/shared/dist/habitContributions.js +119 -0
- package/vendor/shared/dist/index.d.ts +28 -2
- package/vendor/shared/dist/index.d.ts.map +1 -1
- package/vendor/shared/dist/index.js +25 -2
- package/vendor/shared/dist/journal-migration.d.ts +29 -0
- package/vendor/shared/dist/journal-migration.d.ts.map +1 -0
- package/vendor/shared/dist/journal-migration.js +73 -0
- package/vendor/shared/dist/journal-vault.d.ts +414 -0
- package/vendor/shared/dist/journal-vault.d.ts.map +1 -0
- package/vendor/shared/dist/journal-vault.js +972 -0
- package/vendor/shared/dist/projectCapture.d.ts +73 -0
- package/vendor/shared/dist/projectCapture.d.ts.map +1 -0
- package/vendor/shared/dist/projectCapture.js +66 -0
- package/vendor/shared/dist/quickAdd.d.ts +90 -0
- package/vendor/shared/dist/quickAdd.d.ts.map +1 -0
- package/vendor/shared/dist/quickAdd.js +260 -0
- package/vendor/shared/dist/recurrence.d.ts +44 -0
- package/vendor/shared/dist/recurrence.d.ts.map +1 -0
- package/vendor/shared/dist/recurrence.js +37 -0
- package/vendor/shared/dist/reminderWords.d.ts +11 -0
- package/vendor/shared/dist/reminderWords.d.ts.map +1 -0
- package/vendor/shared/dist/reminderWords.js +63 -0
- package/vendor/shared/dist/schemas/comment.d.ts +13 -1
- package/vendor/shared/dist/schemas/comment.d.ts.map +1 -1
- package/vendor/shared/dist/schemas/comment.js +5 -0
- package/vendor/shared/dist/schemas/conversation.d.ts +3 -3
- package/vendor/shared/dist/schemas/harness.d.ts +976 -59
- package/vendor/shared/dist/schemas/harness.d.ts.map +1 -1
- package/vendor/shared/dist/schemas/harness.js +124 -3
- package/vendor/shared/dist/schemas/journal.d.ts +10 -0
- package/vendor/shared/dist/schemas/journal.d.ts.map +1 -1
- package/vendor/shared/dist/schemas/journal.js +10 -2
- package/vendor/shared/dist/schemas/notification.d.ts +1 -1
- package/vendor/shared/dist/schemas/organization.d.ts +3 -2
- package/vendor/shared/dist/schemas/organization.d.ts.map +1 -1
- package/vendor/shared/dist/schemas/organization.js +3 -2
- package/vendor/shared/dist/schemas/proposal.d.ts +7 -3
- package/vendor/shared/dist/schemas/proposal.d.ts.map +1 -1
- package/vendor/shared/dist/schemas/proposal.js +2 -1
- package/vendor/shared/dist/schemas/request.d.ts +44 -4
- package/vendor/shared/dist/schemas/request.d.ts.map +1 -1
- package/vendor/shared/dist/schemas/task.d.ts +83 -8
- package/vendor/shared/dist/schemas/task.d.ts.map +1 -1
- package/vendor/shared/dist/schemas/task.js +20 -2
- package/vendor/shared/dist/schemas/timeSession.d.ts +2 -2
- package/vendor/shared/dist/smartCapture.d.ts +60 -0
- package/vendor/shared/dist/smartCapture.d.ts.map +1 -0
- package/vendor/shared/dist/smartCapture.js +56 -0
- package/vendor/shared/dist/speech.d.ts +39 -0
- package/vendor/shared/dist/speech.d.ts.map +1 -0
- package/vendor/shared/dist/speech.js +36 -0
- package/vendor/shared/dist/spokenNames.d.ts +25 -0
- package/vendor/shared/dist/spokenNames.d.ts.map +1 -0
- package/vendor/shared/dist/spokenNames.js +120 -0
- package/vendor/shared/dist/taskActivity.d.ts +76 -0
- package/vendor/shared/dist/taskActivity.d.ts.map +1 -0
- package/vendor/shared/dist/taskActivity.js +27 -0
- package/vendor/shared/dist/vault-search.d.ts +50 -0
- package/vendor/shared/dist/vault-search.d.ts.map +1 -0
- package/vendor/shared/dist/vault-search.js +177 -0
- package/vendor/shared/dist/voiceCapture.d.ts +32 -0
- package/vendor/shared/dist/voiceCapture.d.ts.map +1 -0
- package/vendor/shared/dist/voiceCapture.js +29 -0
- package/vendor/shared/package.json +4 -0
- package/vendor/shared/src/agentCommands.ts +35 -0
- package/vendor/shared/src/automationTemplates.ts +54 -0
- package/vendor/shared/src/automations.ts +329 -0
- package/vendor/shared/src/cardStatement.ts +49 -0
- package/vendor/shared/src/cardStudio.ts +340 -0
- package/vendor/shared/src/commandLocal.ts +740 -0
- package/vendor/shared/src/commandText.ts +25 -0
- package/vendor/shared/src/commands.ts +255 -0
- package/vendor/shared/src/computer.ts +25 -6
- package/vendor/shared/src/constants.ts +9 -2
- package/vendor/shared/src/dayPlan.ts +81 -0
- package/vendor/shared/src/dayPlanning.ts +77 -0
- package/vendor/shared/src/githubContributions.ts +70 -0
- package/vendor/shared/src/habitContributions.ts +144 -0
- package/vendor/shared/src/index.ts +44 -1
- package/vendor/shared/src/journal-migration.ts +130 -0
- package/vendor/shared/src/journal-vault.ts +1240 -0
- package/vendor/shared/src/projectCapture.ts +86 -0
- package/vendor/shared/src/quickAdd.ts +310 -0
- package/vendor/shared/src/recurrence.ts +37 -0
- package/vendor/shared/src/reminderWords.ts +54 -0
- package/vendor/shared/src/schemas/comment.ts +5 -0
- package/vendor/shared/src/schemas/harness.ts +146 -7
- package/vendor/shared/src/schemas/journal.ts +15 -6
- package/vendor/shared/src/schemas/organization.ts +3 -2
- package/vendor/shared/src/schemas/proposal.ts +6 -1
- package/vendor/shared/src/schemas/task.ts +20 -2
- package/vendor/shared/src/smartCapture.ts +67 -0
- package/vendor/shared/src/speech.ts +44 -0
- package/vendor/shared/src/spokenNames.ts +128 -0
- package/vendor/shared/src/taskActivity.ts +34 -0
- package/vendor/shared/src/vault-search.ts +243 -0
- package/vendor/shared/src/voiceCapture.ts +34 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { findAgentCommand, parseAgentCommand, } from '@lucidity/shared';
|
|
1
2
|
import { randomUUID } from 'node:crypto';
|
|
2
3
|
import { readFileSync } from 'node:fs';
|
|
3
4
|
import { query, } from '@anthropic-ai/claude-agent-sdk';
|
|
@@ -48,7 +49,7 @@ export function claudeAgentOptions(input, oauthToken) {
|
|
|
48
49
|
if (input.effort &&
|
|
49
50
|
!['low', 'medium', 'high', 'xhigh', 'max'].includes(input.effort))
|
|
50
51
|
throw new Error(`Unsupported Claude effort: ${input.effort}.`);
|
|
51
|
-
const mcpServers = input.mcp
|
|
52
|
+
const mcpServers = input.mcp && !input.noTools
|
|
52
53
|
? JSON.parse(readFileSync(input.mcp.configPath, 'utf8')).mcpServers
|
|
53
54
|
: {};
|
|
54
55
|
return {
|
|
@@ -56,6 +57,7 @@ export function claudeAgentOptions(input, oauthToken) {
|
|
|
56
57
|
env: claudeSubscriptionEnv(oauthToken),
|
|
57
58
|
model: input.model,
|
|
58
59
|
effort: input.effort,
|
|
60
|
+
outputFormat: input.outputSchema ? { type: 'json_schema', schema: input.outputSchema } : undefined,
|
|
59
61
|
resume: input.resume,
|
|
60
62
|
sessionId: input.resume ? undefined : input.sessionId,
|
|
61
63
|
systemPrompt: input.systemPrompt
|
|
@@ -64,12 +66,15 @@ export function claudeAgentOptions(input, oauthToken) {
|
|
|
64
66
|
includePartialMessages: true,
|
|
65
67
|
extraArgs: { 'replay-user-messages': null },
|
|
66
68
|
// Coding deliberately loads repo instructions. Companion sessions are isolated.
|
|
67
|
-
settingSources: input.permissionMode
|
|
69
|
+
settingSources: input.permissionMode && !input.readTools
|
|
70
|
+
? ['user', 'project', 'local']
|
|
71
|
+
: [],
|
|
68
72
|
strictMcpConfig: true,
|
|
69
73
|
mcpServers,
|
|
70
74
|
permissionMode: input.permissionMode ?? 'default',
|
|
71
75
|
allowDangerouslySkipPermissions: input.permissionMode === 'bypassPermissions',
|
|
72
76
|
allowedTools: [
|
|
77
|
+
...(input.readTools ?? []),
|
|
73
78
|
...(input.allowedTools ?? []),
|
|
74
79
|
...(input.mcp?.allowedTools ?? []),
|
|
75
80
|
],
|
|
@@ -78,9 +83,21 @@ export function claudeAgentOptions(input, oauthToken) {
|
|
|
78
83
|
...(input.permissionMode ? [] : WRITE_TOOLS),
|
|
79
84
|
],
|
|
80
85
|
// Do not allow a subagent to regain file/shell tools in a companion session.
|
|
81
|
-
tools: input.
|
|
82
|
-
?
|
|
83
|
-
|
|
86
|
+
tools: input.readTools
|
|
87
|
+
? [
|
|
88
|
+
...input.readTools,
|
|
89
|
+
...(input.mcp ? ['ListMcpResources', 'ReadMcpResource'] : []),
|
|
90
|
+
]
|
|
91
|
+
: input.permissionMode
|
|
92
|
+
? undefined
|
|
93
|
+
: [
|
|
94
|
+
'Read',
|
|
95
|
+
'Glob',
|
|
96
|
+
'Grep',
|
|
97
|
+
'WebSearch',
|
|
98
|
+
'WebFetch',
|
|
99
|
+
...(input.mcp ? ['ListMcpResources', 'ReadMcpResource'] : []),
|
|
100
|
+
],
|
|
84
101
|
canUseTool: async (toolName, toolInput, ctx) => {
|
|
85
102
|
if (ctx.signal.aborted)
|
|
86
103
|
return { behavior: 'deny', message: 'Turn ended.' };
|
|
@@ -95,6 +112,7 @@ export function claudeAgentOptions(input, oauthToken) {
|
|
|
95
112
|
? { behavior: 'allow', updatedInput: toolInput }
|
|
96
113
|
: { behavior: 'deny', message: 'Permission was not granted.' };
|
|
97
114
|
},
|
|
115
|
+
...(input.noTools ? { tools: [], allowedTools: [], mcpServers: {}, settingSources: [] } : {}),
|
|
98
116
|
};
|
|
99
117
|
}
|
|
100
118
|
/** Check resolved authentication after settings load, before sending any prompt. */
|
|
@@ -116,6 +134,19 @@ export function requireClaudeSubscription(account) {
|
|
|
116
134
|
throw new Error('Claude needs subscription authentication. Sign in with Claude Code or configure an OAuth token; API-key billing is disabled.');
|
|
117
135
|
}
|
|
118
136
|
}
|
|
137
|
+
// The SDK already filters terminal-only commands. These additional commands either
|
|
138
|
+
// launch server-owned workflows or change process settings that Lucidity reapplies
|
|
139
|
+
// on the next turn. Keep those out until they can update Lucidity's own controls.
|
|
140
|
+
const CLIENT_OWNED_COMMANDS = new Set([
|
|
141
|
+
'model', 'effort', 'config', 'fast', 'autocompact', 'mcp',
|
|
142
|
+
'__remote-workflow', 'workflow-launch-exec', 'theme', 'terminal-setup',
|
|
143
|
+
]);
|
|
144
|
+
/** Include bundled, user, project, plugin and MCP commands advertised by this query. */
|
|
145
|
+
function chatCommands(commands) {
|
|
146
|
+
return commands
|
|
147
|
+
.filter((command) => !CLIENT_OWNED_COMMANDS.has(command.name) && !command.name.startsWith('__'))
|
|
148
|
+
.map((command) => ({ ...command, acceptsArguments: true, clearsContext: command.name === 'clear' }));
|
|
149
|
+
}
|
|
119
150
|
/** The pinned SDK owns its matching native CLI; no PATH-selected Claude binary. */
|
|
120
151
|
export class ClaudeAgentExecutor {
|
|
121
152
|
options;
|
|
@@ -173,6 +204,35 @@ export class ClaudeAgentExecutor {
|
|
|
173
204
|
active.close();
|
|
174
205
|
}
|
|
175
206
|
}
|
|
207
|
+
async commands(input = {}) {
|
|
208
|
+
const incoming = new AsyncQueue();
|
|
209
|
+
const abortController = new AbortController();
|
|
210
|
+
const active = (this.options.query ?? query)({
|
|
211
|
+
prompt: incoming,
|
|
212
|
+
options: {
|
|
213
|
+
...claudeAgentOptions({ ...input, userPrompt: '' }, this.options.oauthToken),
|
|
214
|
+
abortController,
|
|
215
|
+
},
|
|
216
|
+
});
|
|
217
|
+
let timer;
|
|
218
|
+
try {
|
|
219
|
+
return await Promise.race([
|
|
220
|
+
(async () => {
|
|
221
|
+
requireClaudeSubscription(await active.accountInfo());
|
|
222
|
+
return chatCommands(await active.supportedCommands());
|
|
223
|
+
})(),
|
|
224
|
+
new Promise((_, reject) => {
|
|
225
|
+
timer = setTimeout(() => reject(new Error('Command discovery timed out.')), 15_000);
|
|
226
|
+
}),
|
|
227
|
+
]);
|
|
228
|
+
}
|
|
229
|
+
finally {
|
|
230
|
+
clearTimeout(timer);
|
|
231
|
+
incoming.end();
|
|
232
|
+
abortController.abort();
|
|
233
|
+
active.close();
|
|
234
|
+
}
|
|
235
|
+
}
|
|
176
236
|
async run(input) {
|
|
177
237
|
for await (const event of this.runStream(input))
|
|
178
238
|
if (event.type === 'done')
|
|
@@ -180,12 +240,23 @@ export class ClaudeAgentExecutor {
|
|
|
180
240
|
throw new Error('Claude ended without a result.');
|
|
181
241
|
}
|
|
182
242
|
async *runStream(input) {
|
|
243
|
+
const command = parseAgentCommand(input.userPrompt);
|
|
244
|
+
if (command && !input.resume)
|
|
245
|
+
throw new Error('Start a conversation before using commands.');
|
|
246
|
+
if (command && input.images?.length)
|
|
247
|
+
throw new Error('Send commands without image attachments.');
|
|
183
248
|
const incoming = new AsyncQueue();
|
|
249
|
+
let commandOutput = '';
|
|
250
|
+
let compacted = false;
|
|
251
|
+
let cleared = false;
|
|
252
|
+
let commandName = command?.name;
|
|
184
253
|
let active;
|
|
185
254
|
let ended = false;
|
|
186
255
|
let ready = false;
|
|
187
256
|
const pending = new Set();
|
|
188
257
|
const owner = this.turns.open(input, async (text) => {
|
|
258
|
+
if (command)
|
|
259
|
+
throw new Error('Wait for the command to finish before sending a message.');
|
|
189
260
|
if (ended || !active || !ready)
|
|
190
261
|
throw new Error('Claude has no active turn to steer.');
|
|
191
262
|
const update = message({ userPrompt: text }, 'now');
|
|
@@ -193,7 +264,7 @@ export class ClaudeAgentExecutor {
|
|
|
193
264
|
incoming.push(update);
|
|
194
265
|
});
|
|
195
266
|
const toolNames = new Map();
|
|
196
|
-
|
|
267
|
+
let initial = message(input);
|
|
197
268
|
try {
|
|
198
269
|
owner.check();
|
|
199
270
|
active = (this.options.query ?? query)({
|
|
@@ -205,12 +276,33 @@ export class ClaudeAgentExecutor {
|
|
|
205
276
|
});
|
|
206
277
|
requireClaudeSubscription(await active.accountInfo());
|
|
207
278
|
owner.check();
|
|
279
|
+
if (command) {
|
|
280
|
+
const supported = findAgentCommand(chatCommands(await active.supportedCommands()), command.name);
|
|
281
|
+
if (!supported)
|
|
282
|
+
throw new Error(`/${command.name} is not supported by Claude in Lucidity.`);
|
|
283
|
+
commandName = supported.name;
|
|
284
|
+
initial = message({
|
|
285
|
+
...input,
|
|
286
|
+
userPrompt: `/${commandName}${command.arguments ? ` ${command.arguments}` : ''}`,
|
|
287
|
+
});
|
|
288
|
+
yield { type: 'tool_call', name: `/${commandName}`, phase: 'start' };
|
|
289
|
+
}
|
|
208
290
|
incoming.push(initial);
|
|
209
291
|
ready = true;
|
|
210
292
|
for await (const event of active) {
|
|
211
293
|
owner.check();
|
|
212
294
|
if (event.type === 'system' && event.subtype === 'init')
|
|
213
295
|
yield { type: 'session', sessionId: event.session_id };
|
|
296
|
+
if (event.type === 'system' &&
|
|
297
|
+
event.subtype === 'local_command_output' &&
|
|
298
|
+
command) {
|
|
299
|
+
commandOutput += event.content;
|
|
300
|
+
yield { type: 'delta', text: event.content };
|
|
301
|
+
}
|
|
302
|
+
if (event.type === 'system' && event.subtype === 'compact_boundary')
|
|
303
|
+
compacted = true;
|
|
304
|
+
if (event.type === 'conversation_reset')
|
|
305
|
+
cleared = true;
|
|
214
306
|
if (event.type === 'user' && event.uuid)
|
|
215
307
|
pending.delete(event.uuid);
|
|
216
308
|
if (event.type === 'stream_event') {
|
|
@@ -240,16 +332,33 @@ export class ClaudeAgentExecutor {
|
|
|
240
332
|
}
|
|
241
333
|
else if (event.type === 'result') {
|
|
242
334
|
if (event.subtype !== 'success' || event.is_error) {
|
|
243
|
-
throw new Error(
|
|
335
|
+
throw new Error((command &&
|
|
336
|
+
(event.subtype === 'success'
|
|
337
|
+
? event.result
|
|
338
|
+
: event.errors.join('\n'))) ||
|
|
339
|
+
`Claude could not complete the turn (${event.subtype}). Check subscription access and usage limits.`);
|
|
244
340
|
}
|
|
245
341
|
// A late priority message may become a subsequent loop in this same SDK
|
|
246
342
|
// query. Keep consuming until its echoed user message and result arrive.
|
|
247
343
|
if (pending.size)
|
|
248
344
|
continue;
|
|
345
|
+
if (input.outputSchema && event.structured_output === undefined)
|
|
346
|
+
throw new Error('Claude did not return the requested structured result.');
|
|
249
347
|
ended = true;
|
|
348
|
+
if (command)
|
|
349
|
+
yield { type: 'tool_call', name: `/${commandName}`, phase: 'end' };
|
|
250
350
|
yield {
|
|
251
351
|
type: 'done',
|
|
252
|
-
text:
|
|
352
|
+
text: (input.outputSchema ? JSON.stringify(event.structured_output) : '') ||
|
|
353
|
+
event.result.trim() ||
|
|
354
|
+
commandOutput.trim() ||
|
|
355
|
+
(compacted
|
|
356
|
+
? 'Conversation compacted. You can continue here.'
|
|
357
|
+
: cleared
|
|
358
|
+
? 'Context cleared. Earlier messages remain in this chat, but future replies start with empty context.'
|
|
359
|
+
: command
|
|
360
|
+
? `/${commandName} completed.`
|
|
361
|
+
: ''),
|
|
253
362
|
sessionId: event.session_id,
|
|
254
363
|
costUsd: event.total_cost_usd,
|
|
255
364
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claudeCode.d.ts","sourceRoot":"","sources":["../../src/executor/claudeCode.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACpB,MAAM,YAAY,CAAC;AA+EpB;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,GAAG,MAAM,CAQjE;AAYD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,GACb,gBAAgB,GAAG,SAAS,CAmB9B;AAED,mFAAmF;AACnF,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAOxE;AAED,MAAM,WAAW,yBAAyB;IACxC,mEAAmE;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;qFACiF;IACjF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,oDAAoD;IACpD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,6DAA6D;AAC7D,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAiBD;;;;;;;;GAQG;AACH,qBAAa,kBAAmB,YAAW,aAAa;IACtD,QAAQ,CAAC,IAAI,iBAAiB;IAC9B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IAIjC,OAAO,CAAC,YAAY,CAAC,CAAS;IAC9B,OAAO,CAAC,aAAa,CAAC,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAC1C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAS;gBAEzB,IAAI,GAAE,yBAA8B;IAQhD;;uFAEmF;IACnF,WAAW,CAAC,QAAQ,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAKhE,GAAG,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC;IA6F9C,SAAS,CACd,KAAK,EAAE,gBAAgB,GACtB,aAAa,CAAC,mBAAmB,CAAC;IAsGrC,OAAO,CAAC,eAAe;
|
|
1
|
+
{"version":3,"file":"claudeCode.d.ts","sourceRoot":"","sources":["../../src/executor/claudeCode.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACpB,MAAM,YAAY,CAAC;AA+EpB;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,GAAG,MAAM,CAQjE;AAYD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,GACb,gBAAgB,GAAG,SAAS,CAmB9B;AAED,mFAAmF;AACnF,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAOxE;AAED,MAAM,WAAW,yBAAyB;IACxC,mEAAmE;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;qFACiF;IACjF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,oDAAoD;IACpD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,6DAA6D;AAC7D,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAiBD;;;;;;;;GAQG;AACH,qBAAa,kBAAmB,YAAW,aAAa;IACtD,QAAQ,CAAC,IAAI,iBAAiB;IAC9B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IAIjC,OAAO,CAAC,YAAY,CAAC,CAAS;IAC9B,OAAO,CAAC,aAAa,CAAC,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAC1C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAS;gBAEzB,IAAI,GAAE,yBAA8B;IAQhD;;uFAEmF;IACnF,WAAW,CAAC,QAAQ,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAKhE,GAAG,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC;IA6F9C,SAAS,CACd,KAAK,EAAE,gBAAgB,GACtB,aAAa,CAAC,mBAAmB,CAAC;IAsGrC,OAAO,CAAC,eAAe;IAiDvB,OAAO,CAAC,SAAS;IAyCjB,OAAO,CAAC,QAAQ;IAQhB,OAAO,CAAC,KAAK;IAkBb,OAAO,CAAC,UAAU;CAKnB"}
|
|
@@ -378,16 +378,18 @@ export class ClaudeCodeExecutor {
|
|
|
378
378
|
}
|
|
379
379
|
// Effort is a per-invocation session flag (each `claude -p` is a fresh process),
|
|
380
380
|
// so it sits OUTSIDE the resume branch to reach resumed turns too.
|
|
381
|
+
if (input.noTools)
|
|
382
|
+
args.push('--tools', '', '--strict-mcp-config', '--setting-sources', '');
|
|
381
383
|
const effort = input.effort ?? this.defaultEffort;
|
|
382
384
|
if (effort)
|
|
383
385
|
args.push('--effort', effort);
|
|
384
386
|
if (input.permissionMode)
|
|
385
387
|
args.push('--permission-mode', input.permissionMode);
|
|
386
|
-
if (input.allowedTools?.length)
|
|
388
|
+
if (input.allowedTools?.length && !input.noTools)
|
|
387
389
|
args.push('--allowedTools', input.allowedTools.join(','));
|
|
388
390
|
// MCP tools are re-supplied on every invocation (each `claude -p` is a fresh
|
|
389
391
|
// process), so this sits OUTSIDE the resume branch to reach resumed turns too.
|
|
390
|
-
if (input.mcp) {
|
|
392
|
+
if (input.mcp && !input.noTools) {
|
|
391
393
|
args.push('--mcp-config', input.mcp.configPath, '--strict-mcp-config');
|
|
392
394
|
if (input.mcp.allowedTools?.length)
|
|
393
395
|
args.push('--allowedTools', input.mcp.allowedTools.join(','));
|
|
@@ -417,14 +419,16 @@ export class ClaudeCodeExecutor {
|
|
|
417
419
|
const model = input.model ?? this.defaultModel;
|
|
418
420
|
if (model)
|
|
419
421
|
args.push('--model', model);
|
|
422
|
+
if (input.noTools)
|
|
423
|
+
args.push('--tools', '', '--strict-mcp-config', '--setting-sources', '');
|
|
420
424
|
const effort = input.effort ?? this.defaultEffort;
|
|
421
425
|
if (effort)
|
|
422
426
|
args.push('--effort', effort);
|
|
423
427
|
if (input.permissionMode)
|
|
424
428
|
args.push('--permission-mode', input.permissionMode);
|
|
425
|
-
if (input.allowedTools?.length)
|
|
429
|
+
if (input.allowedTools?.length && !input.noTools)
|
|
426
430
|
args.push('--allowedTools', input.allowedTools.join(','));
|
|
427
|
-
if (input.mcp) {
|
|
431
|
+
if (input.mcp && !input.noTools) {
|
|
428
432
|
args.push('--mcp-config', input.mcp.configPath, '--strict-mcp-config');
|
|
429
433
|
if (input.mcp.allowedTools?.length) {
|
|
430
434
|
args.push('--allowedTools', input.mcp.allowedTools.join(','));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type AgentCommandOption } from '@lucidity/shared';
|
|
1
2
|
import { type CodexConnection } from './codexRpc.js';
|
|
2
3
|
import type { AgentExecutor, ExecutorRunInput, ExecutorStreamEvent, ExecutorModel, ExecutorResult } from './types.js';
|
|
3
4
|
import type { ThreadStartParams } from './codexProtocol/v2/ThreadStartParams.js';
|
|
@@ -17,6 +18,7 @@ export declare class CodexExecutor implements AgentExecutor {
|
|
|
17
18
|
interrupt(requestId: string): Promise<boolean>;
|
|
18
19
|
dispose(): Promise<void>;
|
|
19
20
|
models(): Promise<ExecutorModel[]>;
|
|
21
|
+
commands(input?: Pick<ExecutorRunInput, 'cwd' | 'permissionMode'>): Promise<AgentCommandOption[]>;
|
|
20
22
|
run(input: ExecutorRunInput): Promise<ExecutorResult>;
|
|
21
23
|
runStream(input: ExecutorRunInput): AsyncIterable<ExecutorStreamEvent>;
|
|
22
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../src/executor/codex.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../src/executor/codex.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAGL,KAAK,eAAe,EAErB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,cAAc,EACf,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AA6BjF,uEAAuE;AACvE,wBAAgB,cAAc,CAC5B,KAAK,EAAE,gBAAgB,EACvB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjC,WAAW,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAmG1C;AAED,qBAAa,aAAc,YAAW,aAAa;IAK/C,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJ1B,QAAQ,CAAC,IAAI,sBAAsB;IACnC,QAAQ,CAAC,YAAY,QAAQ;IAC7B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmB;gBAEtB,OAAO,GAAE;QACxB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,KAAK,eAAe,CAAC;KACxC;IAER,OAAO,CAAC,OAAO;IAKf,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAG/B,SAAS,CAAC,SAAS,EAAE,MAAM;IAG3B,OAAO;IAIP,MAAM,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IAgClC,QAAQ,CACZ,KAAK,GAAE,IAAI,CAAC,gBAAgB,EAAE,KAAK,GAAG,gBAAgB,CAAM,GAC3D,OAAO,CAAC,kBAAkB,EAAE,CAAC;IA2C1B,GAAG,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC;IAMpD,SAAS,CACd,KAAK,EAAE,gBAAgB,GACtB,aAAa,CAAC,mBAAmB,CAAC;CAoXtC"}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import { parseAgentCommand, findAgentCommand, } from '@lucidity/shared';
|
|
1
2
|
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { randomUUID } from 'node:crypto';
|
|
2
4
|
import { CodexRpc, initializeCodex, } from './codexRpc.js';
|
|
3
5
|
import { LiveTurns, abortError } from './liveTurns.js';
|
|
6
|
+
// App-server does not persist an empty thread until its first turn. Keep a durable
|
|
7
|
+
// reset marker in Lucidity's provider session envelope until that turn starts.
|
|
8
|
+
const EMPTY_SESSION_PREFIX = 'lucidity-codex-empty:';
|
|
9
|
+
const isEmptySession = (id) => id?.startsWith(EMPTY_SESSION_PREFIX) ?? false;
|
|
4
10
|
function userInput(input) {
|
|
5
11
|
return [
|
|
6
12
|
...(input.images ?? []).map((image) => ({
|
|
@@ -13,7 +19,7 @@ function userInput(input) {
|
|
|
13
19
|
/** Override inherited tool integrations before starting any thread. */
|
|
14
20
|
export function codexRunConfig(input, inherited) {
|
|
15
21
|
const config = {
|
|
16
|
-
'features.shell_tool': !!input.permissionMode,
|
|
22
|
+
'features.shell_tool': !!input.permissionMode && !input.noTools,
|
|
17
23
|
'features.apps': false,
|
|
18
24
|
'features.multi_agent': false,
|
|
19
25
|
'features.multi_agent_v2': false,
|
|
@@ -30,7 +36,9 @@ export function codexRunConfig(input, inherited) {
|
|
|
30
36
|
'features.code_mode_only': false,
|
|
31
37
|
'features.skill_mcp_dependency_install': false,
|
|
32
38
|
'features.workspace_dependencies': false,
|
|
33
|
-
'features.hooks': !!input.permissionMode &&
|
|
39
|
+
'features.hooks': !!input.permissionMode &&
|
|
40
|
+
input.permissionMode !== 'plan' &&
|
|
41
|
+
!input.noTools,
|
|
34
42
|
model_provider: 'openai',
|
|
35
43
|
};
|
|
36
44
|
// config/read expands optional fields to null; those cannot round-trip to TOML.
|
|
@@ -46,11 +54,17 @@ export function codexRunConfig(input, inherited) {
|
|
|
46
54
|
};
|
|
47
55
|
}
|
|
48
56
|
config.mcp_servers = serversConfig;
|
|
57
|
+
if (input.readTools)
|
|
58
|
+
config.web_search = input.readTools.includes('WebSearch')
|
|
59
|
+
? 'live'
|
|
60
|
+
: 'disabled';
|
|
49
61
|
config.plugins = Object.fromEntries(Object.keys((inherited.plugins ?? {})).map((name) => [
|
|
50
62
|
name,
|
|
51
63
|
{ enabled: false },
|
|
52
64
|
]));
|
|
53
|
-
if (input.
|
|
65
|
+
if (input.noTools)
|
|
66
|
+
config.web_search = 'disabled';
|
|
67
|
+
if (input.mcp && !input.noTools) {
|
|
54
68
|
const servers = JSON.parse(readFileSync(input.mcp.configPath, 'utf8'))
|
|
55
69
|
.mcpServers;
|
|
56
70
|
for (const [name, server] of Object.entries(servers)) {
|
|
@@ -63,7 +77,16 @@ export function codexRunConfig(input, inherited) {
|
|
|
63
77
|
if (allowed.some((tool) => tool.includes('*') && tool !== '*'))
|
|
64
78
|
throw new Error('Unsupported MCP tool pattern for Codex.');
|
|
65
79
|
serversConfig[name] = {
|
|
66
|
-
...server
|
|
80
|
+
...(server.url
|
|
81
|
+
? {
|
|
82
|
+
url: server.url,
|
|
83
|
+
...(server.headers ? { http_headers: server.headers } : {}),
|
|
84
|
+
}
|
|
85
|
+
: {
|
|
86
|
+
command: server.command,
|
|
87
|
+
...(server.args ? { args: server.args } : {}),
|
|
88
|
+
...(server.env ? { env: server.env } : {}),
|
|
89
|
+
}),
|
|
67
90
|
enabled: true,
|
|
68
91
|
required: true,
|
|
69
92
|
default_tools_approval_mode: 'approve',
|
|
@@ -121,6 +144,46 @@ export class CodexExecutor {
|
|
|
121
144
|
rpc.close();
|
|
122
145
|
}
|
|
123
146
|
}
|
|
147
|
+
async commands(input = {}) {
|
|
148
|
+
return [
|
|
149
|
+
{
|
|
150
|
+
name: 'compact',
|
|
151
|
+
description: 'Summarize older messages to free up context.',
|
|
152
|
+
argumentHint: '',
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
name: 'new',
|
|
156
|
+
aliases: ['clear'],
|
|
157
|
+
description: 'Start fresh context while keeping earlier messages visible.',
|
|
158
|
+
argumentHint: '',
|
|
159
|
+
clearsContext: true,
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
name: 'status',
|
|
163
|
+
description: 'Show the model, workspace and account limits.',
|
|
164
|
+
argumentHint: '',
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
name: 'rename',
|
|
168
|
+
description: 'Rename the provider conversation.',
|
|
169
|
+
argumentHint: '<name>',
|
|
170
|
+
},
|
|
171
|
+
...(input.cwd && input.permissionMode
|
|
172
|
+
? [
|
|
173
|
+
{
|
|
174
|
+
name: 'review',
|
|
175
|
+
description: 'Review uncommitted changes or give review instructions.',
|
|
176
|
+
argumentHint: '[instructions]',
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
name: 'skills',
|
|
180
|
+
description: 'List skills available in this workspace.',
|
|
181
|
+
argumentHint: '',
|
|
182
|
+
},
|
|
183
|
+
]
|
|
184
|
+
: []),
|
|
185
|
+
];
|
|
186
|
+
}
|
|
124
187
|
async run(input) {
|
|
125
188
|
for await (const event of this.runStream(input))
|
|
126
189
|
if (event.type === 'done')
|
|
@@ -128,6 +191,42 @@ export class CodexExecutor {
|
|
|
128
191
|
throw new Error('Codex ended without a result.');
|
|
129
192
|
}
|
|
130
193
|
async *runStream(input) {
|
|
194
|
+
if (input.signal?.aborted)
|
|
195
|
+
throw abortError();
|
|
196
|
+
let command = parseAgentCommand(input.userPrompt);
|
|
197
|
+
if (command) {
|
|
198
|
+
const supported = findAgentCommand(await this.commands(input), command.name);
|
|
199
|
+
if (!supported)
|
|
200
|
+
throw new Error(`/${command.name} is not supported by Codex in Lucidity.`);
|
|
201
|
+
if (!input.resume)
|
|
202
|
+
throw new Error('Start a conversation before using commands.');
|
|
203
|
+
if ((!supported.argumentHint && command.arguments) ||
|
|
204
|
+
input.images?.length)
|
|
205
|
+
throw new Error(`/${supported.name} does not accept ${input.images?.length ? 'images' : 'arguments'} with Codex.`);
|
|
206
|
+
if (supported.name === 'rename' && !command.arguments)
|
|
207
|
+
throw new Error('Enter a name after /rename.');
|
|
208
|
+
command = { ...command, name: supported.name };
|
|
209
|
+
}
|
|
210
|
+
if (command?.name === 'new') {
|
|
211
|
+
const sessionId = `${EMPTY_SESSION_PREFIX}${randomUUID()}`;
|
|
212
|
+
yield { type: 'session', sessionId };
|
|
213
|
+
yield {
|
|
214
|
+
type: 'done',
|
|
215
|
+
text: 'Context cleared. Earlier messages remain visible here.',
|
|
216
|
+
sessionId,
|
|
217
|
+
};
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
if (isEmptySession(input.resume) && command?.name === 'compact') {
|
|
221
|
+
yield {
|
|
222
|
+
type: 'done',
|
|
223
|
+
text: 'Not enough messages to compact.',
|
|
224
|
+
sessionId: input.resume,
|
|
225
|
+
};
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
if (isEmptySession(input.resume) && command?.name === 'rename')
|
|
229
|
+
throw new Error('Send a message in the new conversation before renaming it.');
|
|
131
230
|
let threadId = '';
|
|
132
231
|
let turnId = '';
|
|
133
232
|
let ended = false;
|
|
@@ -135,6 +234,8 @@ export class CodexExecutor {
|
|
|
135
234
|
let owner;
|
|
136
235
|
try {
|
|
137
236
|
owner = this.turns.open(input, async (text) => {
|
|
237
|
+
if (command)
|
|
238
|
+
throw new Error('Wait for the command to finish before sending a message.');
|
|
138
239
|
if (!turnId || ended)
|
|
139
240
|
throw new Error('Codex has no active turn to steer.');
|
|
140
241
|
const params = {
|
|
@@ -210,7 +311,9 @@ export class CodexExecutor {
|
|
|
210
311
|
: input.permissionMode && input.permissionMode !== 'plan'
|
|
211
312
|
? 'on-request'
|
|
212
313
|
: 'never',
|
|
213
|
-
|
|
314
|
+
// Apply the daemon's Auto mode on both new and resumed threads instead
|
|
315
|
+
// of overriding it with a human reviewer on every turn.
|
|
316
|
+
approvalsReviewer: input.permissionMode === 'auto' ? 'auto_review' : 'user',
|
|
214
317
|
sandbox: input.permissionMode === 'bypassPermissions'
|
|
215
318
|
? 'danger-full-access'
|
|
216
319
|
: input.permissionMode && input.permissionMode !== 'plan'
|
|
@@ -219,23 +322,98 @@ export class CodexExecutor {
|
|
|
219
322
|
developerInstructions: input.systemPrompt,
|
|
220
323
|
config: codexRunConfig(input, inherited.config),
|
|
221
324
|
};
|
|
222
|
-
const thread = input.resume
|
|
325
|
+
const thread = input.resume && !isEmptySession(input.resume)
|
|
223
326
|
? await rpc.request('thread/resume', {
|
|
224
327
|
...params,
|
|
225
328
|
threadId: input.resume,
|
|
226
329
|
})
|
|
227
330
|
: await rpc.request('thread/start', params);
|
|
228
331
|
threadId = thread.thread.id;
|
|
332
|
+
const sessionId = isEmptySession(input.resume) &&
|
|
333
|
+
command &&
|
|
334
|
+
['status', 'skills'].includes(command.name)
|
|
335
|
+
? input.resume
|
|
336
|
+
: threadId;
|
|
229
337
|
// Publish affinity before tools run, so an interrupted first turn can resume safely.
|
|
230
|
-
yield { type: 'session', sessionId
|
|
338
|
+
yield { type: 'session', sessionId };
|
|
339
|
+
// These controls finish with their RPC response and never start an inference turn.
|
|
340
|
+
if (command && ['status', 'rename', 'skills'].includes(command.name)) {
|
|
341
|
+
yield { type: 'tool_call', name: `/${command.name}`, phase: 'start' };
|
|
342
|
+
let text = '';
|
|
343
|
+
if (command.name === 'rename') {
|
|
344
|
+
await rpc.request('thread/name/set', {
|
|
345
|
+
threadId,
|
|
346
|
+
name: command.arguments,
|
|
347
|
+
});
|
|
348
|
+
text = `Conversation renamed to ${command.arguments}.`;
|
|
349
|
+
}
|
|
350
|
+
if (command.name === 'status') {
|
|
351
|
+
const limits = await rpc.request('account/rateLimits/read', {});
|
|
352
|
+
const buckets = limits.rateLimitsByLimitId
|
|
353
|
+
? Object.values(limits.rateLimitsByLimitId).filter(Boolean)
|
|
354
|
+
: [limits.rateLimits];
|
|
355
|
+
text = [
|
|
356
|
+
`Model: ${thread.model ?? input.model ?? 'Provider default'}`,
|
|
357
|
+
`Effort: ${input.effort ?? thread.reasoningEffort ?? 'Provider default'}`,
|
|
358
|
+
`Workspace: ${thread.cwd ?? input.cwd ?? 'Default'}`,
|
|
359
|
+
...buckets.flatMap((bucket) => [bucket?.primary, bucket?.secondary].flatMap((window) => window
|
|
360
|
+
? [
|
|
361
|
+
`${bucket?.limitName ?? 'Usage'} (${window.windowDurationMins ? `${window.windowDurationMins} min` : 'window'}): ${window.usedPercent}% used${window.resetsAt ? `; resets ${new Date(window.resetsAt * 1000).toISOString()}` : ''}`,
|
|
362
|
+
]
|
|
363
|
+
: [])),
|
|
364
|
+
].join('\n');
|
|
365
|
+
}
|
|
366
|
+
if (command.name === 'skills') {
|
|
367
|
+
const result = await rpc.request('skills/list', {
|
|
368
|
+
cwds: [input.cwd],
|
|
369
|
+
forceReload: true,
|
|
370
|
+
});
|
|
371
|
+
text =
|
|
372
|
+
result.data
|
|
373
|
+
.flatMap((entry) => [
|
|
374
|
+
...entry.skills
|
|
375
|
+
.filter((skill) => skill.enabled)
|
|
376
|
+
.map((skill) => `- $${skill.name}: ${skill.description}`),
|
|
377
|
+
...entry.errors.map((error) => `Could not load skill: ${error.message}`),
|
|
378
|
+
])
|
|
379
|
+
.join('\n') || 'No skills are available in this workspace.';
|
|
380
|
+
}
|
|
381
|
+
owner.check();
|
|
382
|
+
ended = true;
|
|
383
|
+
yield { type: 'tool_call', name: `/${command.name}`, phase: 'end' };
|
|
384
|
+
yield { type: 'done', text, sessionId };
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
231
387
|
const start = {
|
|
232
388
|
threadId,
|
|
233
389
|
input: userInput(input),
|
|
234
390
|
model: input.model,
|
|
235
391
|
effort: input.effort,
|
|
392
|
+
outputSchema: input.outputSchema,
|
|
236
393
|
};
|
|
237
|
-
|
|
238
|
-
|
|
394
|
+
if (command?.name === 'compact') {
|
|
395
|
+
yield {
|
|
396
|
+
type: 'tool_call',
|
|
397
|
+
name: 'Compact conversation',
|
|
398
|
+
phase: 'start',
|
|
399
|
+
};
|
|
400
|
+
await rpc.request('thread/compact/start', { threadId });
|
|
401
|
+
}
|
|
402
|
+
else if (command?.name === 'review') {
|
|
403
|
+
yield { type: 'tool_call', name: '/review', phase: 'start' };
|
|
404
|
+
const review = await rpc.request('review/start', {
|
|
405
|
+
threadId,
|
|
406
|
+
delivery: 'inline',
|
|
407
|
+
target: command.arguments
|
|
408
|
+
? { type: 'custom', instructions: command.arguments }
|
|
409
|
+
: { type: 'uncommittedChanges' },
|
|
410
|
+
});
|
|
411
|
+
turnId = review.turn.id;
|
|
412
|
+
}
|
|
413
|
+
else {
|
|
414
|
+
const turn = await rpc.request('turn/start', start);
|
|
415
|
+
turnId = turn.turn.id;
|
|
416
|
+
}
|
|
239
417
|
let finalText = '';
|
|
240
418
|
let streamedText = '';
|
|
241
419
|
for await (const event of rpc.events) {
|
|
@@ -243,6 +421,10 @@ export class CodexExecutor {
|
|
|
243
421
|
const p = event.params ?? {};
|
|
244
422
|
if (p.threadId !== threadId)
|
|
245
423
|
continue;
|
|
424
|
+
if (command && event.method === 'turn/started' && !turnId) {
|
|
425
|
+
turnId = p.turn.id;
|
|
426
|
+
continue;
|
|
427
|
+
}
|
|
246
428
|
if (p.turnId && p.turnId !== turnId)
|
|
247
429
|
continue;
|
|
248
430
|
if (event.method === 'item/agentMessage/delta' &&
|
|
@@ -253,6 +435,9 @@ export class CodexExecutor {
|
|
|
253
435
|
else if (event.method === 'item/started' ||
|
|
254
436
|
event.method === 'item/completed') {
|
|
255
437
|
const item = p.item;
|
|
438
|
+
if (item.type === 'exitedReviewMode' &&
|
|
439
|
+
event.method === 'item/completed')
|
|
440
|
+
finalText = item.review ?? finalText;
|
|
256
441
|
if (item.type === 'agentMessage' &&
|
|
257
442
|
event.method === 'item/completed' &&
|
|
258
443
|
item.phase !== 'commentary')
|
|
@@ -263,7 +448,15 @@ export class CodexExecutor {
|
|
|
263
448
|
? 'Edit files'
|
|
264
449
|
: item.type === 'mcpToolCall'
|
|
265
450
|
? `mcp__${item.server}__${item.tool}`
|
|
266
|
-
:
|
|
451
|
+
: item.type === 'webSearch'
|
|
452
|
+
? 'WebSearch'
|
|
453
|
+
: item.type === 'imageView'
|
|
454
|
+
? 'View image'
|
|
455
|
+
: item.type === 'imageGeneration'
|
|
456
|
+
? 'Generate image'
|
|
457
|
+
: item.type === 'dynamicToolCall'
|
|
458
|
+
? (item.tool ?? 'Dynamic tool')
|
|
459
|
+
: undefined;
|
|
267
460
|
if (name)
|
|
268
461
|
yield {
|
|
269
462
|
type: 'tool_call',
|
|
@@ -280,9 +473,19 @@ export class CodexExecutor {
|
|
|
280
473
|
throw abortError();
|
|
281
474
|
if (completed.status !== 'completed')
|
|
282
475
|
throw new Error(completed.error?.message ?? `Codex turn ${completed.status}.`);
|
|
476
|
+
if (command)
|
|
477
|
+
yield {
|
|
478
|
+
type: 'tool_call',
|
|
479
|
+
name: command.name === 'compact'
|
|
480
|
+
? 'Compact conversation'
|
|
481
|
+
: `/${command.name}`,
|
|
482
|
+
phase: 'end',
|
|
483
|
+
};
|
|
283
484
|
yield {
|
|
284
485
|
type: 'done',
|
|
285
|
-
text:
|
|
486
|
+
text: command?.name === 'compact'
|
|
487
|
+
? 'Conversation compacted. You can continue here.'
|
|
488
|
+
: (finalText || streamedText).trim(),
|
|
286
489
|
sessionId: threadId,
|
|
287
490
|
};
|
|
288
491
|
return;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export type PlanType = "free" | "go" | "plus" | "pro" | "prolite" | "team" | "self_serve_business_prolite" | "self_serve_business_usage_based" | "business" | "ent26" | "enterprise_cbp_automation" | "enterprise_cbp_usage_based" | "enterprise" | "edu" | "edu_plus" | "edu_pro" | "unknown";
|
|
2
|
+
//# sourceMappingURL=PlanType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlanType.d.ts","sourceRoot":"","sources":["../../../src/executor/codexProtocol/PlanType.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,KAAK,GAAG,SAAS,GAAG,MAAM,GAAG,6BAA6B,GAAG,iCAAiC,GAAG,UAAU,GAAG,OAAO,GAAG,2BAA2B,GAAG,4BAA4B,GAAG,YAAY,GAAG,KAAK,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreditsSnapshot.d.ts","sourceRoot":"","sources":["../../../../src/executor/codexProtocol/v2/CreditsSnapshot.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,eAAe,GAAG;IAAE,UAAU,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAAE,CAAC"}
|