@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
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
findAgentCommand,
|
|
3
|
+
parseAgentCommand,
|
|
4
|
+
type AgentCommandOption,
|
|
5
|
+
} from '@lucidity/shared';
|
|
1
6
|
import { randomUUID } from 'node:crypto';
|
|
2
7
|
import { readFileSync } from 'node:fs';
|
|
3
8
|
import {
|
|
@@ -72,7 +77,7 @@ export function claudeAgentOptions(
|
|
|
72
77
|
!['low', 'medium', 'high', 'xhigh', 'max'].includes(input.effort)
|
|
73
78
|
)
|
|
74
79
|
throw new Error(`Unsupported Claude effort: ${input.effort}.`);
|
|
75
|
-
const mcpServers = input.mcp
|
|
80
|
+
const mcpServers = input.mcp && !input.noTools
|
|
76
81
|
? (
|
|
77
82
|
JSON.parse(readFileSync(input.mcp.configPath, 'utf8')) as {
|
|
78
83
|
mcpServers: Options['mcpServers'];
|
|
@@ -92,13 +97,17 @@ export function claudeAgentOptions(
|
|
|
92
97
|
includePartialMessages: true,
|
|
93
98
|
extraArgs: { 'replay-user-messages': null },
|
|
94
99
|
// Coding deliberately loads repo instructions. Companion sessions are isolated.
|
|
95
|
-
settingSources:
|
|
100
|
+
settingSources:
|
|
101
|
+
input.permissionMode && !input.readTools
|
|
102
|
+
? ['user', 'project', 'local']
|
|
103
|
+
: [],
|
|
96
104
|
strictMcpConfig: true,
|
|
97
105
|
mcpServers,
|
|
98
106
|
permissionMode: input.permissionMode ?? 'default',
|
|
99
107
|
allowDangerouslySkipPermissions:
|
|
100
108
|
input.permissionMode === 'bypassPermissions',
|
|
101
109
|
allowedTools: [
|
|
110
|
+
...(input.readTools ?? []),
|
|
102
111
|
...(input.allowedTools ?? []),
|
|
103
112
|
...(input.mcp?.allowedTools ?? []),
|
|
104
113
|
],
|
|
@@ -107,9 +116,21 @@ export function claudeAgentOptions(
|
|
|
107
116
|
...(input.permissionMode ? [] : WRITE_TOOLS),
|
|
108
117
|
],
|
|
109
118
|
// Do not allow a subagent to regain file/shell tools in a companion session.
|
|
110
|
-
tools: input.
|
|
111
|
-
?
|
|
112
|
-
|
|
119
|
+
tools: input.readTools
|
|
120
|
+
? [
|
|
121
|
+
...input.readTools,
|
|
122
|
+
...(input.mcp ? ['ListMcpResources', 'ReadMcpResource'] : []),
|
|
123
|
+
]
|
|
124
|
+
: input.permissionMode
|
|
125
|
+
? undefined
|
|
126
|
+
: [
|
|
127
|
+
'Read',
|
|
128
|
+
'Glob',
|
|
129
|
+
'Grep',
|
|
130
|
+
'WebSearch',
|
|
131
|
+
'WebFetch',
|
|
132
|
+
...(input.mcp ? ['ListMcpResources', 'ReadMcpResource'] : []),
|
|
133
|
+
],
|
|
113
134
|
canUseTool: async (toolName, toolInput, ctx) => {
|
|
114
135
|
if (ctx.signal.aborted)
|
|
115
136
|
return { behavior: 'deny', message: 'Turn ended.' };
|
|
@@ -125,6 +146,7 @@ export function claudeAgentOptions(
|
|
|
125
146
|
? { behavior: 'allow', updatedInput: toolInput }
|
|
126
147
|
: { behavior: 'deny', message: 'Permission was not granted.' };
|
|
127
148
|
},
|
|
149
|
+
...(input.noTools ? { tools: [], allowedTools: [], mcpServers: {}, settingSources: [] } : {}),
|
|
128
150
|
};
|
|
129
151
|
}
|
|
130
152
|
|
|
@@ -154,6 +176,23 @@ export function requireClaudeSubscription(account: AccountInfo): void {
|
|
|
154
176
|
}
|
|
155
177
|
}
|
|
156
178
|
|
|
179
|
+
// The SDK already filters terminal-only commands. These additional commands either
|
|
180
|
+
// launch server-owned workflows or change process settings that Lucidity reapplies
|
|
181
|
+
// on the next turn. Keep those out until they can update Lucidity's own controls.
|
|
182
|
+
const CLIENT_OWNED_COMMANDS = new Set([
|
|
183
|
+
'model', 'effort', 'config', 'fast', 'autocompact', 'mcp',
|
|
184
|
+
'__remote-workflow', 'workflow-launch-exec', 'theme', 'terminal-setup',
|
|
185
|
+
]);
|
|
186
|
+
|
|
187
|
+
/** Include bundled, user, project, plugin and MCP commands advertised by this query. */
|
|
188
|
+
function chatCommands(
|
|
189
|
+
commands: Awaited<ReturnType<Query['supportedCommands']>>,
|
|
190
|
+
): AgentCommandOption[] {
|
|
191
|
+
return commands
|
|
192
|
+
.filter((command) => !CLIENT_OWNED_COMMANDS.has(command.name) && !command.name.startsWith('__'))
|
|
193
|
+
.map((command) => ({ ...command, acceptsArguments: true, clearsContext: command.name === 'clear' }));
|
|
194
|
+
}
|
|
195
|
+
|
|
157
196
|
/** The pinned SDK owns its matching native CLI; no PATH-selected Claude binary. */
|
|
158
197
|
export class ClaudeAgentExecutor implements AgentExecutor {
|
|
159
198
|
readonly name = 'claude-agent-sdk';
|
|
@@ -219,6 +258,38 @@ export class ClaudeAgentExecutor implements AgentExecutor {
|
|
|
219
258
|
}
|
|
220
259
|
}
|
|
221
260
|
|
|
261
|
+
async commands(input: Pick<ExecutorRunInput, 'cwd' | 'permissionMode' | 'mcp'> = {}): Promise<AgentCommandOption[]> {
|
|
262
|
+
const incoming = new AsyncQueue<SDKUserMessage>();
|
|
263
|
+
const abortController = new AbortController();
|
|
264
|
+
const active = (this.options.query ?? query)({
|
|
265
|
+
prompt: incoming,
|
|
266
|
+
options: {
|
|
267
|
+
...claudeAgentOptions({ ...input, userPrompt: '' }, this.options.oauthToken),
|
|
268
|
+
abortController,
|
|
269
|
+
},
|
|
270
|
+
});
|
|
271
|
+
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
272
|
+
try {
|
|
273
|
+
return await Promise.race([
|
|
274
|
+
(async () => {
|
|
275
|
+
requireClaudeSubscription(await active.accountInfo());
|
|
276
|
+
return chatCommands(await active.supportedCommands());
|
|
277
|
+
})(),
|
|
278
|
+
new Promise<never>((_, reject) => {
|
|
279
|
+
timer = setTimeout(
|
|
280
|
+
() => reject(new Error('Command discovery timed out.')),
|
|
281
|
+
15_000,
|
|
282
|
+
);
|
|
283
|
+
}),
|
|
284
|
+
]);
|
|
285
|
+
} finally {
|
|
286
|
+
clearTimeout(timer);
|
|
287
|
+
incoming.end();
|
|
288
|
+
abortController.abort();
|
|
289
|
+
active.close();
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
222
293
|
async run(input: ExecutorRunInput): Promise<ExecutorResult> {
|
|
223
294
|
for await (const event of this.runStream(input))
|
|
224
295
|
if (event.type === 'done') return event;
|
|
@@ -228,12 +299,25 @@ export class ClaudeAgentExecutor implements AgentExecutor {
|
|
|
228
299
|
async *runStream(
|
|
229
300
|
input: ExecutorRunInput,
|
|
230
301
|
): AsyncIterable<ExecutorStreamEvent> {
|
|
302
|
+
const command = parseAgentCommand(input.userPrompt);
|
|
303
|
+
if (command && !input.resume)
|
|
304
|
+
throw new Error('Start a conversation before using commands.');
|
|
305
|
+
if (command && input.images?.length)
|
|
306
|
+
throw new Error('Send commands without image attachments.');
|
|
231
307
|
const incoming = new AsyncQueue<SDKUserMessage>();
|
|
308
|
+
let commandOutput = '';
|
|
309
|
+
let compacted = false;
|
|
310
|
+
let cleared = false;
|
|
311
|
+
let commandName = command?.name;
|
|
232
312
|
let active: Query | undefined;
|
|
233
313
|
let ended = false;
|
|
234
314
|
let ready = false;
|
|
235
315
|
const pending = new Set<string>();
|
|
236
316
|
const owner = this.turns.open(input, async (text) => {
|
|
317
|
+
if (command)
|
|
318
|
+
throw new Error(
|
|
319
|
+
'Wait for the command to finish before sending a message.',
|
|
320
|
+
);
|
|
237
321
|
if (ended || !active || !ready)
|
|
238
322
|
throw new Error('Claude has no active turn to steer.');
|
|
239
323
|
const update = message({ userPrompt: text }, 'now');
|
|
@@ -241,7 +325,7 @@ export class ClaudeAgentExecutor implements AgentExecutor {
|
|
|
241
325
|
incoming.push(update);
|
|
242
326
|
});
|
|
243
327
|
const toolNames = new Map<string, string>();
|
|
244
|
-
|
|
328
|
+
let initial = message(input);
|
|
245
329
|
try {
|
|
246
330
|
owner.check();
|
|
247
331
|
active = (this.options.query ?? query)({
|
|
@@ -253,12 +337,39 @@ export class ClaudeAgentExecutor implements AgentExecutor {
|
|
|
253
337
|
});
|
|
254
338
|
requireClaudeSubscription(await active.accountInfo());
|
|
255
339
|
owner.check();
|
|
340
|
+
if (command) {
|
|
341
|
+
const supported = findAgentCommand(
|
|
342
|
+
chatCommands(await active.supportedCommands()),
|
|
343
|
+
command.name,
|
|
344
|
+
);
|
|
345
|
+
if (!supported)
|
|
346
|
+
throw new Error(
|
|
347
|
+
`/${command.name} is not supported by Claude in Lucidity.`,
|
|
348
|
+
);
|
|
349
|
+
commandName = supported.name;
|
|
350
|
+
initial = message({
|
|
351
|
+
...input,
|
|
352
|
+
userPrompt: `/${commandName}${command.arguments ? ` ${command.arguments}` : ''}`,
|
|
353
|
+
});
|
|
354
|
+
yield { type: 'tool_call', name: `/${commandName}`, phase: 'start' };
|
|
355
|
+
}
|
|
256
356
|
incoming.push(initial);
|
|
257
357
|
ready = true;
|
|
258
358
|
for await (const event of active) {
|
|
259
359
|
owner.check();
|
|
260
360
|
if (event.type === 'system' && event.subtype === 'init')
|
|
261
361
|
yield { type: 'session', sessionId: event.session_id };
|
|
362
|
+
if (
|
|
363
|
+
event.type === 'system' &&
|
|
364
|
+
event.subtype === 'local_command_output' &&
|
|
365
|
+
command
|
|
366
|
+
) {
|
|
367
|
+
commandOutput += event.content;
|
|
368
|
+
yield { type: 'delta', text: event.content };
|
|
369
|
+
}
|
|
370
|
+
if (event.type === 'system' && event.subtype === 'compact_boundary')
|
|
371
|
+
compacted = true;
|
|
372
|
+
if (event.type === 'conversation_reset') cleared = true;
|
|
262
373
|
if (event.type === 'user' && event.uuid) pending.delete(event.uuid);
|
|
263
374
|
if (event.type === 'stream_event') {
|
|
264
375
|
const e = event.event;
|
|
@@ -290,6 +401,10 @@ export class ClaudeAgentExecutor implements AgentExecutor {
|
|
|
290
401
|
} else if (event.type === 'result') {
|
|
291
402
|
if (event.subtype !== 'success' || event.is_error) {
|
|
292
403
|
throw new Error(
|
|
404
|
+
(command &&
|
|
405
|
+
(event.subtype === 'success'
|
|
406
|
+
? event.result
|
|
407
|
+
: event.errors.join('\n'))) ||
|
|
293
408
|
`Claude could not complete the turn (${event.subtype}). Check subscription access and usage limits.`,
|
|
294
409
|
);
|
|
295
410
|
}
|
|
@@ -297,9 +412,20 @@ export class ClaudeAgentExecutor implements AgentExecutor {
|
|
|
297
412
|
// query. Keep consuming until its echoed user message and result arrive.
|
|
298
413
|
if (pending.size) continue;
|
|
299
414
|
ended = true;
|
|
415
|
+
if (command)
|
|
416
|
+
yield { type: 'tool_call', name: `/${commandName}`, phase: 'end' };
|
|
300
417
|
yield {
|
|
301
418
|
type: 'done',
|
|
302
|
-
text:
|
|
419
|
+
text:
|
|
420
|
+
event.result.trim() ||
|
|
421
|
+
commandOutput.trim() ||
|
|
422
|
+
(compacted
|
|
423
|
+
? 'Conversation compacted. You can continue here.'
|
|
424
|
+
: cleared
|
|
425
|
+
? 'Context cleared. Earlier messages remain in this chat, but future replies start with empty context.'
|
|
426
|
+
: command
|
|
427
|
+
? `/${commandName} completed.`
|
|
428
|
+
: ''),
|
|
303
429
|
sessionId: event.session_id,
|
|
304
430
|
costUsd: event.total_cost_usd,
|
|
305
431
|
};
|
|
@@ -446,15 +446,16 @@ export class ClaudeCodeExecutor implements AgentExecutor {
|
|
|
446
446
|
}
|
|
447
447
|
// Effort is a per-invocation session flag (each `claude -p` is a fresh process),
|
|
448
448
|
// so it sits OUTSIDE the resume branch to reach resumed turns too.
|
|
449
|
+
if (input.noTools) args.push('--tools', '', '--strict-mcp-config', '--setting-sources', '');
|
|
449
450
|
const effort = input.effort ?? this.defaultEffort;
|
|
450
451
|
if (effort) args.push('--effort', effort);
|
|
451
452
|
if (input.permissionMode)
|
|
452
453
|
args.push('--permission-mode', input.permissionMode);
|
|
453
|
-
if (input.allowedTools?.length)
|
|
454
|
+
if (input.allowedTools?.length && !input.noTools)
|
|
454
455
|
args.push('--allowedTools', input.allowedTools.join(','));
|
|
455
456
|
// MCP tools are re-supplied on every invocation (each `claude -p` is a fresh
|
|
456
457
|
// process), so this sits OUTSIDE the resume branch to reach resumed turns too.
|
|
457
|
-
if (input.mcp) {
|
|
458
|
+
if (input.mcp && !input.noTools) {
|
|
458
459
|
args.push('--mcp-config', input.mcp.configPath, '--strict-mcp-config');
|
|
459
460
|
if (input.mcp.allowedTools?.length)
|
|
460
461
|
args.push('--allowedTools', input.mcp.allowedTools.join(','));
|
|
@@ -488,13 +489,14 @@ export class ClaudeCodeExecutor implements AgentExecutor {
|
|
|
488
489
|
args.push('--append-system-prompt', input.systemPrompt);
|
|
489
490
|
const model = input.model ?? this.defaultModel;
|
|
490
491
|
if (model) args.push('--model', model);
|
|
492
|
+
if (input.noTools) args.push('--tools', '', '--strict-mcp-config', '--setting-sources', '');
|
|
491
493
|
const effort = input.effort ?? this.defaultEffort;
|
|
492
494
|
if (effort) args.push('--effort', effort);
|
|
493
495
|
if (input.permissionMode)
|
|
494
496
|
args.push('--permission-mode', input.permissionMode);
|
|
495
|
-
if (input.allowedTools?.length)
|
|
497
|
+
if (input.allowedTools?.length && !input.noTools)
|
|
496
498
|
args.push('--allowedTools', input.allowedTools.join(','));
|
|
497
|
-
if (input.mcp) {
|
|
499
|
+
if (input.mcp && !input.noTools) {
|
|
498
500
|
args.push('--mcp-config', input.mcp.configPath, '--strict-mcp-config');
|
|
499
501
|
if (input.mcp.allowedTools?.length) {
|
|
500
502
|
args.push('--allowedTools', input.mcp.allowedTools.join(','));
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
parseAgentCommand,
|
|
3
|
+
findAgentCommand,
|
|
4
|
+
type AgentCommandOption,
|
|
5
|
+
} from '@lucidity/shared';
|
|
1
6
|
import { readFileSync } from 'node:fs';
|
|
7
|
+
import { randomUUID } from 'node:crypto';
|
|
2
8
|
import {
|
|
3
9
|
CodexRpc,
|
|
4
10
|
initializeCodex,
|
|
@@ -19,6 +25,16 @@ import type { TurnStartParams } from './codexProtocol/v2/TurnStartParams.js';
|
|
|
19
25
|
import type { TurnSteerParams } from './codexProtocol/v2/TurnSteerParams.js';
|
|
20
26
|
import type { ModelListResponse } from './codexProtocol/v2/ModelListResponse.js';
|
|
21
27
|
import type { UserInput } from './codexProtocol/v2/UserInput.js';
|
|
28
|
+
import type { ReviewStartParams } from './codexProtocol/v2/ReviewStartParams.js';
|
|
29
|
+
import type { ThreadSetNameParams } from './codexProtocol/v2/ThreadSetNameParams.js';
|
|
30
|
+
import type { GetAccountRateLimitsResponse } from './codexProtocol/v2/GetAccountRateLimitsResponse.js';
|
|
31
|
+
import type { SkillsListResponse } from './codexProtocol/v2/SkillsListResponse.js';
|
|
32
|
+
|
|
33
|
+
// App-server does not persist an empty thread until its first turn. Keep a durable
|
|
34
|
+
// reset marker in Lucidity's provider session envelope until that turn starts.
|
|
35
|
+
const EMPTY_SESSION_PREFIX = 'lucidity-codex-empty:';
|
|
36
|
+
const isEmptySession = (id?: string) =>
|
|
37
|
+
id?.startsWith(EMPTY_SESSION_PREFIX) ?? false;
|
|
22
38
|
|
|
23
39
|
function userInput(
|
|
24
40
|
input: Pick<ExecutorRunInput, 'userPrompt' | 'images'>,
|
|
@@ -38,7 +54,7 @@ export function codexRunConfig(
|
|
|
38
54
|
inherited: Record<string, unknown>,
|
|
39
55
|
): NonNullable<ThreadStartParams['config']> {
|
|
40
56
|
const config: NonNullable<ThreadStartParams['config']> = {
|
|
41
|
-
'features.shell_tool': !!input.permissionMode,
|
|
57
|
+
'features.shell_tool': !!input.permissionMode && !input.noTools,
|
|
42
58
|
'features.apps': false,
|
|
43
59
|
'features.multi_agent': false,
|
|
44
60
|
'features.multi_agent_v2': false,
|
|
@@ -55,7 +71,10 @@ export function codexRunConfig(
|
|
|
55
71
|
'features.code_mode_only': false,
|
|
56
72
|
'features.skill_mcp_dependency_install': false,
|
|
57
73
|
'features.workspace_dependencies': false,
|
|
58
|
-
'features.hooks':
|
|
74
|
+
'features.hooks':
|
|
75
|
+
!!input.permissionMode &&
|
|
76
|
+
input.permissionMode !== 'plan' &&
|
|
77
|
+
!input.noTools,
|
|
59
78
|
model_provider: 'openai',
|
|
60
79
|
};
|
|
61
80
|
// config/read expands optional fields to null; those cannot round-trip to TOML.
|
|
@@ -81,17 +100,29 @@ export function codexRunConfig(
|
|
|
81
100
|
};
|
|
82
101
|
}
|
|
83
102
|
config.mcp_servers = serversConfig;
|
|
103
|
+
if (input.readTools)
|
|
104
|
+
config.web_search = input.readTools.includes('WebSearch')
|
|
105
|
+
? 'live'
|
|
106
|
+
: 'disabled';
|
|
84
107
|
config.plugins = Object.fromEntries(
|
|
85
108
|
Object.keys((inherited.plugins ?? {}) as object).map((name) => [
|
|
86
109
|
name,
|
|
87
110
|
{ enabled: false },
|
|
88
111
|
]),
|
|
89
112
|
);
|
|
90
|
-
if (input.
|
|
113
|
+
if (input.noTools) config.web_search = 'disabled';
|
|
114
|
+
if (input.mcp && !input.noTools) {
|
|
91
115
|
const servers = JSON.parse(readFileSync(input.mcp.configPath, 'utf8'))
|
|
92
116
|
.mcpServers as Record<
|
|
93
117
|
string,
|
|
94
|
-
{
|
|
118
|
+
{
|
|
119
|
+
command?: string;
|
|
120
|
+
args?: string[];
|
|
121
|
+
env?: Record<string, string>;
|
|
122
|
+
type?: string;
|
|
123
|
+
url?: string;
|
|
124
|
+
headers?: Record<string, string>;
|
|
125
|
+
}
|
|
95
126
|
>;
|
|
96
127
|
for (const [name, server] of Object.entries(servers)) {
|
|
97
128
|
const prefix = `mcp__${name}__`;
|
|
@@ -102,7 +133,16 @@ export function codexRunConfig(
|
|
|
102
133
|
if (allowed.some((tool) => tool.includes('*') && tool !== '*'))
|
|
103
134
|
throw new Error('Unsupported MCP tool pattern for Codex.');
|
|
104
135
|
serversConfig[name] = {
|
|
105
|
-
...server
|
|
136
|
+
...(server.url
|
|
137
|
+
? {
|
|
138
|
+
url: server.url,
|
|
139
|
+
...(server.headers ? { http_headers: server.headers } : {}),
|
|
140
|
+
}
|
|
141
|
+
: {
|
|
142
|
+
command: server.command!,
|
|
143
|
+
...(server.args ? { args: server.args } : {}),
|
|
144
|
+
...(server.env ? { env: server.env } : {}),
|
|
145
|
+
}),
|
|
106
146
|
enabled: true,
|
|
107
147
|
required: true,
|
|
108
148
|
default_tools_approval_mode: 'approve',
|
|
@@ -170,6 +210,51 @@ export class CodexExecutor implements AgentExecutor {
|
|
|
170
210
|
}
|
|
171
211
|
}
|
|
172
212
|
|
|
213
|
+
async commands(
|
|
214
|
+
input: Pick<ExecutorRunInput, 'cwd' | 'permissionMode'> = {},
|
|
215
|
+
): Promise<AgentCommandOption[]> {
|
|
216
|
+
return [
|
|
217
|
+
{
|
|
218
|
+
name: 'compact',
|
|
219
|
+
description: 'Summarize older messages to free up context.',
|
|
220
|
+
argumentHint: '',
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
name: 'new',
|
|
224
|
+
aliases: ['clear'],
|
|
225
|
+
description:
|
|
226
|
+
'Start fresh context while keeping earlier messages visible.',
|
|
227
|
+
argumentHint: '',
|
|
228
|
+
clearsContext: true,
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
name: 'status',
|
|
232
|
+
description: 'Show the model, workspace and account limits.',
|
|
233
|
+
argumentHint: '',
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
name: 'rename',
|
|
237
|
+
description: 'Rename the provider conversation.',
|
|
238
|
+
argumentHint: '<name>',
|
|
239
|
+
},
|
|
240
|
+
...(input.cwd && input.permissionMode
|
|
241
|
+
? [
|
|
242
|
+
{
|
|
243
|
+
name: 'review',
|
|
244
|
+
description:
|
|
245
|
+
'Review uncommitted changes or give review instructions.',
|
|
246
|
+
argumentHint: '[instructions]',
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
name: 'skills',
|
|
250
|
+
description: 'List skills available in this workspace.',
|
|
251
|
+
argumentHint: '',
|
|
252
|
+
},
|
|
253
|
+
]
|
|
254
|
+
: []),
|
|
255
|
+
];
|
|
256
|
+
}
|
|
257
|
+
|
|
173
258
|
async run(input: ExecutorRunInput): Promise<ExecutorResult> {
|
|
174
259
|
for await (const event of this.runStream(input))
|
|
175
260
|
if (event.type === 'done') return event;
|
|
@@ -179,6 +264,52 @@ export class CodexExecutor implements AgentExecutor {
|
|
|
179
264
|
async *runStream(
|
|
180
265
|
input: ExecutorRunInput,
|
|
181
266
|
): AsyncIterable<ExecutorStreamEvent> {
|
|
267
|
+
if (input.signal?.aborted) throw abortError();
|
|
268
|
+
let command = parseAgentCommand(input.userPrompt);
|
|
269
|
+
if (command) {
|
|
270
|
+
const supported = findAgentCommand(
|
|
271
|
+
await this.commands(input),
|
|
272
|
+
command.name,
|
|
273
|
+
);
|
|
274
|
+
if (!supported)
|
|
275
|
+
throw new Error(
|
|
276
|
+
`/${command.name} is not supported by Codex in Lucidity.`,
|
|
277
|
+
);
|
|
278
|
+
if (!input.resume)
|
|
279
|
+
throw new Error('Start a conversation before using commands.');
|
|
280
|
+
if (
|
|
281
|
+
(!supported.argumentHint && command.arguments) ||
|
|
282
|
+
input.images?.length
|
|
283
|
+
)
|
|
284
|
+
throw new Error(
|
|
285
|
+
`/${supported.name} does not accept ${input.images?.length ? 'images' : 'arguments'} with Codex.`,
|
|
286
|
+
);
|
|
287
|
+
if (supported.name === 'rename' && !command.arguments)
|
|
288
|
+
throw new Error('Enter a name after /rename.');
|
|
289
|
+
command = { ...command, name: supported.name };
|
|
290
|
+
}
|
|
291
|
+
if (command?.name === 'new') {
|
|
292
|
+
const sessionId = `${EMPTY_SESSION_PREFIX}${randomUUID()}`;
|
|
293
|
+
yield { type: 'session', sessionId };
|
|
294
|
+
yield {
|
|
295
|
+
type: 'done',
|
|
296
|
+
text: 'Context cleared. Earlier messages remain visible here.',
|
|
297
|
+
sessionId,
|
|
298
|
+
};
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
if (isEmptySession(input.resume) && command?.name === 'compact') {
|
|
302
|
+
yield {
|
|
303
|
+
type: 'done',
|
|
304
|
+
text: 'Not enough messages to compact.',
|
|
305
|
+
sessionId: input.resume,
|
|
306
|
+
};
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
if (isEmptySession(input.resume) && command?.name === 'rename')
|
|
310
|
+
throw new Error(
|
|
311
|
+
'Send a message in the new conversation before renaming it.',
|
|
312
|
+
);
|
|
182
313
|
let threadId = '';
|
|
183
314
|
let turnId = '';
|
|
184
315
|
let ended = false;
|
|
@@ -186,6 +317,10 @@ export class CodexExecutor implements AgentExecutor {
|
|
|
186
317
|
let owner: ReturnType<LiveTurns['open']>;
|
|
187
318
|
try {
|
|
188
319
|
owner = this.turns.open(input, async (text) => {
|
|
320
|
+
if (command)
|
|
321
|
+
throw new Error(
|
|
322
|
+
'Wait for the command to finish before sending a message.',
|
|
323
|
+
);
|
|
189
324
|
if (!turnId || ended)
|
|
190
325
|
throw new Error('Codex has no active turn to steer.');
|
|
191
326
|
const params: TurnSteerParams = {
|
|
@@ -268,7 +403,10 @@ export class CodexExecutor implements AgentExecutor {
|
|
|
268
403
|
: input.permissionMode && input.permissionMode !== 'plan'
|
|
269
404
|
? 'on-request'
|
|
270
405
|
: 'never',
|
|
271
|
-
|
|
406
|
+
// Apply the daemon's Auto mode on both new and resumed threads instead
|
|
407
|
+
// of overriding it with a human reviewer on every turn.
|
|
408
|
+
approvalsReviewer:
|
|
409
|
+
input.permissionMode === 'auto' ? 'auto_review' : 'user',
|
|
272
410
|
sandbox:
|
|
273
411
|
input.permissionMode === 'bypassPermissions'
|
|
274
412
|
? 'danger-full-access'
|
|
@@ -278,32 +416,128 @@ export class CodexExecutor implements AgentExecutor {
|
|
|
278
416
|
developerInstructions: input.systemPrompt,
|
|
279
417
|
config: codexRunConfig(input, inherited.config),
|
|
280
418
|
};
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
419
|
+
type ThreadInfo = {
|
|
420
|
+
thread: { id: string };
|
|
421
|
+
model?: string;
|
|
422
|
+
reasoningEffort?: string | null;
|
|
423
|
+
cwd?: string;
|
|
424
|
+
};
|
|
425
|
+
const thread =
|
|
426
|
+
input.resume && !isEmptySession(input.resume)
|
|
427
|
+
? await rpc.request<ThreadInfo>('thread/resume', {
|
|
428
|
+
...params,
|
|
429
|
+
threadId: input.resume,
|
|
430
|
+
} satisfies ThreadResumeParams)
|
|
431
|
+
: await rpc.request<ThreadInfo>('thread/start', params);
|
|
287
432
|
threadId = thread.thread.id;
|
|
433
|
+
const sessionId =
|
|
434
|
+
isEmptySession(input.resume) &&
|
|
435
|
+
command &&
|
|
436
|
+
['status', 'skills'].includes(command.name)
|
|
437
|
+
? input.resume!
|
|
438
|
+
: threadId;
|
|
288
439
|
// Publish affinity before tools run, so an interrupted first turn can resume safely.
|
|
289
|
-
yield { type: 'session', sessionId
|
|
440
|
+
yield { type: 'session', sessionId };
|
|
441
|
+
// These controls finish with their RPC response and never start an inference turn.
|
|
442
|
+
if (command && ['status', 'rename', 'skills'].includes(command.name)) {
|
|
443
|
+
yield { type: 'tool_call', name: `/${command.name}`, phase: 'start' };
|
|
444
|
+
let text = '';
|
|
445
|
+
if (command.name === 'rename') {
|
|
446
|
+
await rpc.request('thread/name/set', {
|
|
447
|
+
threadId,
|
|
448
|
+
name: command.arguments,
|
|
449
|
+
} satisfies ThreadSetNameParams);
|
|
450
|
+
text = `Conversation renamed to ${command.arguments}.`;
|
|
451
|
+
}
|
|
452
|
+
if (command.name === 'status') {
|
|
453
|
+
const limits = await rpc.request<GetAccountRateLimitsResponse>(
|
|
454
|
+
'account/rateLimits/read',
|
|
455
|
+
{},
|
|
456
|
+
);
|
|
457
|
+
const buckets = limits.rateLimitsByLimitId
|
|
458
|
+
? Object.values(limits.rateLimitsByLimitId).filter(Boolean)
|
|
459
|
+
: [limits.rateLimits];
|
|
460
|
+
text = [
|
|
461
|
+
`Model: ${thread.model ?? input.model ?? 'Provider default'}`,
|
|
462
|
+
`Effort: ${input.effort ?? thread.reasoningEffort ?? 'Provider default'}`,
|
|
463
|
+
`Workspace: ${thread.cwd ?? input.cwd ?? 'Default'}`,
|
|
464
|
+
...buckets.flatMap((bucket) =>
|
|
465
|
+
[bucket?.primary, bucket?.secondary].flatMap((window) =>
|
|
466
|
+
window
|
|
467
|
+
? [
|
|
468
|
+
`${bucket?.limitName ?? 'Usage'} (${window.windowDurationMins ? `${window.windowDurationMins} min` : 'window'}): ${window.usedPercent}% used${window.resetsAt ? `; resets ${new Date(window.resetsAt * 1000).toISOString()}` : ''}`,
|
|
469
|
+
]
|
|
470
|
+
: [],
|
|
471
|
+
),
|
|
472
|
+
),
|
|
473
|
+
].join('\n');
|
|
474
|
+
}
|
|
475
|
+
if (command.name === 'skills') {
|
|
476
|
+
const result = await rpc.request<SkillsListResponse>('skills/list', {
|
|
477
|
+
cwds: [input.cwd!],
|
|
478
|
+
forceReload: true,
|
|
479
|
+
});
|
|
480
|
+
text =
|
|
481
|
+
result.data
|
|
482
|
+
.flatMap((entry) => [
|
|
483
|
+
...entry.skills
|
|
484
|
+
.filter((skill) => skill.enabled)
|
|
485
|
+
.map((skill) => `- $${skill.name}: ${skill.description}`),
|
|
486
|
+
...entry.errors.map(
|
|
487
|
+
(error) => `Could not load skill: ${error.message}`,
|
|
488
|
+
),
|
|
489
|
+
])
|
|
490
|
+
.join('\n') || 'No skills are available in this workspace.';
|
|
491
|
+
}
|
|
492
|
+
owner.check();
|
|
493
|
+
ended = true;
|
|
494
|
+
yield { type: 'tool_call', name: `/${command.name}`, phase: 'end' };
|
|
495
|
+
yield { type: 'done', text, sessionId };
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
290
498
|
const start: TurnStartParams = {
|
|
291
499
|
threadId,
|
|
292
500
|
input: userInput(input),
|
|
293
501
|
model: input.model,
|
|
294
502
|
effort: input.effort as TurnStartParams['effort'],
|
|
295
503
|
};
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
504
|
+
if (command?.name === 'compact') {
|
|
505
|
+
yield {
|
|
506
|
+
type: 'tool_call',
|
|
507
|
+
name: 'Compact conversation',
|
|
508
|
+
phase: 'start',
|
|
509
|
+
};
|
|
510
|
+
await rpc.request('thread/compact/start', { threadId });
|
|
511
|
+
} else if (command?.name === 'review') {
|
|
512
|
+
yield { type: 'tool_call', name: '/review', phase: 'start' };
|
|
513
|
+
const review = await rpc.request<{ turn: { id: string } }>(
|
|
514
|
+
'review/start',
|
|
515
|
+
{
|
|
516
|
+
threadId,
|
|
517
|
+
delivery: 'inline',
|
|
518
|
+
target: command.arguments
|
|
519
|
+
? { type: 'custom', instructions: command.arguments }
|
|
520
|
+
: { type: 'uncommittedChanges' },
|
|
521
|
+
} satisfies ReviewStartParams,
|
|
522
|
+
);
|
|
523
|
+
turnId = review.turn.id;
|
|
524
|
+
} else {
|
|
525
|
+
const turn = await rpc.request<{ turn: { id: string } }>(
|
|
526
|
+
'turn/start',
|
|
527
|
+
start,
|
|
528
|
+
);
|
|
529
|
+
turnId = turn.turn.id;
|
|
530
|
+
}
|
|
301
531
|
let finalText = '';
|
|
302
532
|
let streamedText = '';
|
|
303
533
|
for await (const event of rpc.events) {
|
|
304
534
|
owner.check();
|
|
305
535
|
const p = event.params ?? {};
|
|
306
536
|
if (p.threadId !== threadId) continue;
|
|
537
|
+
if (command && event.method === 'turn/started' && !turnId) {
|
|
538
|
+
turnId = (p.turn as { id: string }).id;
|
|
539
|
+
continue;
|
|
540
|
+
}
|
|
307
541
|
if (p.turnId && p.turnId !== turnId) continue;
|
|
308
542
|
if (
|
|
309
543
|
event.method === 'item/agentMessage/delta' &&
|
|
@@ -321,7 +555,13 @@ export class CodexExecutor implements AgentExecutor {
|
|
|
321
555
|
phase?: string;
|
|
322
556
|
tool?: string;
|
|
323
557
|
server?: string;
|
|
558
|
+
review?: string;
|
|
324
559
|
};
|
|
560
|
+
if (
|
|
561
|
+
item.type === 'exitedReviewMode' &&
|
|
562
|
+
event.method === 'item/completed'
|
|
563
|
+
)
|
|
564
|
+
finalText = item.review ?? finalText;
|
|
325
565
|
if (
|
|
326
566
|
item.type === 'agentMessage' &&
|
|
327
567
|
event.method === 'item/completed' &&
|
|
@@ -335,7 +575,15 @@ export class CodexExecutor implements AgentExecutor {
|
|
|
335
575
|
? 'Edit files'
|
|
336
576
|
: item.type === 'mcpToolCall'
|
|
337
577
|
? `mcp__${item.server}__${item.tool}`
|
|
338
|
-
:
|
|
578
|
+
: item.type === 'webSearch'
|
|
579
|
+
? 'WebSearch'
|
|
580
|
+
: item.type === 'imageView'
|
|
581
|
+
? 'View image'
|
|
582
|
+
: item.type === 'imageGeneration'
|
|
583
|
+
? 'Generate image'
|
|
584
|
+
: item.type === 'dynamicToolCall'
|
|
585
|
+
? (item.tool ?? 'Dynamic tool')
|
|
586
|
+
: undefined;
|
|
339
587
|
if (name)
|
|
340
588
|
yield {
|
|
341
589
|
type: 'tool_call',
|
|
@@ -355,9 +603,21 @@ export class CodexExecutor implements AgentExecutor {
|
|
|
355
603
|
throw new Error(
|
|
356
604
|
completed.error?.message ?? `Codex turn ${completed.status}.`,
|
|
357
605
|
);
|
|
606
|
+
if (command)
|
|
607
|
+
yield {
|
|
608
|
+
type: 'tool_call',
|
|
609
|
+
name:
|
|
610
|
+
command.name === 'compact'
|
|
611
|
+
? 'Compact conversation'
|
|
612
|
+
: `/${command.name}`,
|
|
613
|
+
phase: 'end',
|
|
614
|
+
};
|
|
358
615
|
yield {
|
|
359
616
|
type: 'done',
|
|
360
|
-
text:
|
|
617
|
+
text:
|
|
618
|
+
command?.name === 'compact'
|
|
619
|
+
? 'Conversation compacted. You can continue here.'
|
|
620
|
+
: (finalText || streamedText).trim(),
|
|
361
621
|
sessionId: threadId,
|
|
362
622
|
};
|
|
363
623
|
return;
|