@opencorelabs/lucidity 0.7.0 → 0.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -2
- package/dist/assets/speech/lucidity-speech +0 -0
- package/dist/automations/agent.d.ts.map +1 -1
- package/dist/automations/agent.js +2 -0
- package/dist/automations/designer.d.ts +1 -1
- package/dist/automations/service.d.ts +4 -0
- package/dist/automations/service.d.ts.map +1 -1
- package/dist/automations/service.js +60 -22
- package/dist/automations/store.d.ts +9 -3
- package/dist/automations/store.d.ts.map +1 -1
- package/dist/automations/store.js +45 -32
- package/dist/automations/workflow.d.ts +14 -0
- package/dist/automations/workflow.d.ts.map +1 -0
- package/dist/automations/workflow.js +57 -0
- package/dist/chat/server.d.ts +1 -0
- package/dist/chat/server.d.ts.map +1 -1
- package/dist/chat/server.js +6 -1
- package/dist/coding/listPrs.d.ts +2 -0
- package/dist/coding/listPrs.d.ts.map +1 -1
- package/dist/coding/listPrs.js +10 -0
- package/dist/coding/runCodeTurn.d.ts +6 -30
- package/dist/coding/runCodeTurn.d.ts.map +1 -1
- package/dist/coding/runCodeTurn.js +145 -218
- package/dist/coding/runReview.d.ts +10 -0
- package/dist/coding/runReview.d.ts.map +1 -0
- package/dist/coding/runReview.js +87 -0
- package/dist/coding/workspaceRegistry.d.ts +72 -0
- package/dist/coding/workspaceRegistry.d.ts.map +1 -0
- package/dist/coding/workspaceRegistry.js +421 -0
- package/dist/coding/worktree.d.ts +72 -32
- package/dist/coding/worktree.d.ts.map +1 -1
- package/dist/coding/worktree.js +190 -38
- package/dist/coding/worktreeSetup.d.ts +7 -0
- package/dist/coding/worktreeSetup.d.ts.map +1 -0
- package/dist/coding/worktreeSetup.js +49 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/daemonLease.d.ts +12 -0
- package/dist/daemonLease.d.ts.map +1 -0
- package/dist/daemonLease.js +32 -0
- package/dist/goals/assessment.d.ts +115 -0
- package/dist/goals/assessment.d.ts.map +1 -0
- package/dist/goals/assessment.js +67 -0
- package/dist/goals/notes.d.ts +18 -0
- package/dist/goals/notes.d.ts.map +1 -0
- package/dist/goals/notes.js +72 -0
- package/dist/index.js +75 -40
- package/dist/jobs/briefing.d.ts +2 -16
- package/dist/jobs/briefing.d.ts.map +1 -1
- package/dist/jobs/briefing.js +65 -93
- package/dist/jobs/goals.d.ts +15 -0
- package/dist/jobs/goals.d.ts.map +1 -0
- package/dist/jobs/goals.js +286 -0
- package/dist/jobs/weeklyReview.d.ts.map +1 -1
- package/dist/jobs/weeklyReview.js +3 -2
- package/dist/logTimestamps.d.ts +10 -0
- package/dist/logTimestamps.d.ts.map +1 -0
- package/dist/logTimestamps.js +12 -0
- package/dist/providerRecovery.d.ts +48 -0
- package/dist/providerRecovery.d.ts.map +1 -0
- package/dist/providerRecovery.js +100 -0
- package/dist/queue.d.ts +1 -0
- package/dist/queue.d.ts.map +1 -1
- package/dist/queue.js +4 -0
- package/dist/room/client.d.ts +6 -19
- package/dist/room/client.d.ts.map +1 -1
- package/dist/room/client.js +127 -123
- package/dist/room/computer.js +1 -1
- package/dist/room/durablePublish.d.ts +6 -0
- package/dist/room/durablePublish.d.ts.map +1 -0
- package/dist/room/durablePublish.js +19 -0
- package/dist/room/incidents.d.ts +4 -1
- package/dist/room/incidents.d.ts.map +1 -1
- package/dist/room/incidents.js +15 -7
- package/dist/room/turnQueue.d.ts.map +1 -1
- package/dist/room/turnQueue.js +55 -46
- package/dist/runtimeStore.d.ts +46 -0
- package/dist/runtimeStore.d.ts.map +1 -0
- package/dist/runtimeStore.js +205 -0
- package/dist/setup/server.js +1 -1
- package/dist/turnLog.d.ts +10 -40
- package/dist/turnLog.d.ts.map +1 -1
- package/dist/turnLog.js +33 -56
- package/dist/vault.d.ts +6 -3
- package/dist/vault.d.ts.map +1 -1
- package/dist/vault.js +18 -4
- package/package.json +4 -4
- package/src/automations/agent.ts +2 -0
- package/src/automations/service.ts +47 -21
- package/src/automations/store.ts +41 -50
- package/src/automations/workflow.ts +49 -0
- package/src/chat/server.ts +7 -1
- package/src/coding/listPrs.ts +14 -0
- package/src/coding/runCodeTurn.ts +51 -139
- package/src/coding/runReview.ts +83 -0
- package/src/coding/workspaceRegistry.ts +380 -0
- package/src/coding/worktree.ts +205 -40
- package/src/coding/worktreeSetup.ts +50 -0
- package/src/config.ts +2 -0
- package/src/daemonLease.ts +33 -0
- package/src/goals/assessment.ts +106 -0
- package/src/goals/notes.ts +88 -0
- package/src/index.ts +76 -46
- package/src/jobs/briefing.ts +62 -109
- package/src/jobs/goals.ts +384 -0
- package/src/jobs/weeklyReview.ts +4 -3
- package/src/logTimestamps.ts +14 -0
- package/src/providerRecovery.ts +99 -0
- package/src/queue.ts +4 -0
- package/src/room/client.ts +84 -116
- package/src/room/computer.ts +1 -1
- package/src/room/durablePublish.ts +25 -0
- package/src/room/incidents.ts +20 -8
- package/src/room/turnQueue.ts +53 -56
- package/src/runtimeStore.ts +207 -0
- package/src/setup/server.ts +1 -1
- package/src/turnLog.ts +32 -75
- package/src/vault.ts +16 -7
- package/vendor/mcp-server/dist/index.js +2 -0
- package/vendor/mcp-server/dist/tools/goals.d.ts +4 -0
- package/vendor/mcp-server/dist/tools/goals.d.ts.map +1 -0
- package/vendor/mcp-server/dist/tools/goals.js +38 -0
- package/vendor/mcp-server/package.json +1 -1
- package/vendor/mcp-server/src/index.ts +2 -0
- package/vendor/mcp-server/src/tools/goals.ts +62 -0
- package/vendor/runtime/README.md +36 -2
- package/vendor/runtime/dist/executor/asyncQueue.d.ts +1 -0
- package/vendor/runtime/dist/executor/asyncQueue.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/asyncQueue.js +3 -0
- package/vendor/runtime/dist/executor/claudeAgent.d.ts +5 -1
- package/vendor/runtime/dist/executor/claudeAgent.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/claudeAgent.js +77 -13
- package/vendor/runtime/dist/executor/codex.d.ts +8 -2
- package/vendor/runtime/dist/executor/codex.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/codex.js +113 -38
- package/vendor/runtime/dist/executor/codexProtocol/AgentPath.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/AgentPath.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/AgentPath.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/FunctionCallOutputContentItem.d.ts +4 -1
- package/vendor/runtime/dist/executor/codexProtocol/FunctionCallOutputContentItem.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/codexProtocol/ImageGenerationFailure.d.ts +6 -0
- package/vendor/runtime/dist/executor/codexProtocol/ImageGenerationFailure.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/ImageGenerationFailure.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/ImageGenerationItem.d.ts +12 -0
- package/vendor/runtime/dist/executor/codexProtocol/ImageGenerationItem.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/ImageGenerationItem.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/LegacyAppPathString.d.ts +24 -0
- package/vendor/runtime/dist/executor/codexProtocol/LegacyAppPathString.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/LegacyAppPathString.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/MessagePhase.d.ts +8 -0
- package/vendor/runtime/dist/executor/codexProtocol/MessagePhase.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/MessagePhase.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/Personality.d.ts +3 -0
- package/vendor/runtime/dist/executor/codexProtocol/Personality.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/codexProtocol/PlanType.d.ts +1 -1
- package/vendor/runtime/dist/executor/codexProtocol/PlanType.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/codexProtocol/SleepItem.d.ts +8 -0
- package/vendor/runtime/dist/executor/codexProtocol/SleepItem.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/SleepItem.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/SubAgentSource.d.ts +14 -0
- package/vendor/runtime/dist/executor/codexProtocol/SubAgentSource.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/SubAgentSource.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/ThreadId.d.ts +7 -0
- package/vendor/runtime/dist/executor/codexProtocol/ThreadId.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/ThreadId.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/WebSearchItem.d.ts +15 -0
- package/vendor/runtime/dist/executor/codexProtocol/WebSearchItem.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/WebSearchItem.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/AgentMessageDelivery.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/AgentMessageDelivery.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/AgentMessageDelivery.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/AsyncUserInputQuestion.d.ts +5 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/AsyncUserInputQuestion.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/AsyncUserInputQuestion.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CodexErrorInfo.d.ts +29 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CodexErrorInfo.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CodexErrorInfo.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentState.d.ts +6 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentState.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentState.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentStatus.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentStatus.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentStatus.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentTool.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentTool.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentTool.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentToolCallStatus.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentToolCallStatus.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CollabAgentToolCallStatus.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CommandAction.d.ts +20 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CommandAction.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CommandAction.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CommandExecutionSource.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CommandExecutionSource.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CommandExecutionSource.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CommandExecutionStatus.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CommandExecutionStatus.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CommandExecutionStatus.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CyberAccessProgram.d.ts +6 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CyberAccessProgram.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/CyberAccessProgram.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/DynamicToolCallOutputContentItem.d.ts +11 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/DynamicToolCallOutputContentItem.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/DynamicToolCallOutputContentItem.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/DynamicToolCallStatus.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/DynamicToolCallStatus.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/DynamicToolCallStatus.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/FileUpdateChange.d.ts +7 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/FileUpdateChange.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/FileUpdateChange.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/GetAccountRateLimitsResponse.d.ts +5 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/GetAccountRateLimitsResponse.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/codexProtocol/v2/GitInfo.d.ts +6 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/GitInfo.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/GitInfo.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/HookPromptFragment.d.ts +5 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/HookPromptFragment.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/HookPromptFragment.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpAppDisplayMode.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpAppDisplayMode.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpAppDisplayMode.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpAppUi.d.ts +9 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpAppUi.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpAppUi.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallAppContext.d.ts +8 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallAppContext.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallAppContext.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallError.d.ts +4 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallError.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallError.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallResult.d.ts +7 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallResult.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallResult.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallStatus.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallStatus.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/McpToolCallStatus.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MemoryCitation.d.ts +6 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MemoryCitation.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MemoryCitation.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MemoryCitationEntry.d.ts +7 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MemoryCitationEntry.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MemoryCitationEntry.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MisalignmentErrorDetails.d.ts +16 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MisalignmentErrorDetails.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MisalignmentErrorDetails.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MisalignmentSteer.d.ts +4 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MisalignmentSteer.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/MisalignmentSteer.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/Model.d.ts +8 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/Model.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/codexProtocol/v2/ModelAccessPrograms.d.ts +11 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ModelAccessPrograms.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ModelAccessPrograms.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/NonSteerableTurnKind.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/NonSteerableTurnKind.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/NonSteerableTurnKind.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/PatchApplyStatus.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/PatchApplyStatus.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/PatchApplyStatus.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/PatchChangeKind.d.ts +9 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/PatchChangeKind.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/PatchChangeKind.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitSnapshot.d.ts +4 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/RateLimitSnapshot.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewStartParams.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ReviewStartParams.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/codexProtocol/v2/SessionSource.d.ts +7 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SessionSource.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SessionSource.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SubAgentActivityKind.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SubAgentActivityKind.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/SubAgentActivityKind.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/Thread.d.ts +100 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/Thread.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/Thread.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadActiveFlag.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadActiveFlag.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadActiveFlag.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadHistoryMode.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadHistoryMode.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadHistoryMode.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadItem.d.ts +216 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadItem.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadItem.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadReadParams.d.ts +11 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadReadParams.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadReadParams.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadReadResponse.d.ts +5 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadReadResponse.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadReadResponse.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadResumeParams.d.ts +4 -1
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadResumeParams.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSection.d.ts +19 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSection.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSection.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSectionAppearance.d.ts +8 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSectionAppearance.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadSectionAppearance.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadStartParams.d.ts +3 -1
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadStartParams.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadStatus.d.ts +12 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadStatus.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/ThreadStatus.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/Turn.d.ts +36 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/Turn.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/Turn.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/TurnError.d.ts +12 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/TurnError.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/TurnError.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/TurnItemsView.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/TurnItemsView.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/TurnItemsView.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/TurnStartParams.d.ts +7 -2
- package/vendor/runtime/dist/executor/codexProtocol/v2/TurnStartParams.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/codexProtocol/v2/TurnStatus.d.ts +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/TurnStatus.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/TurnStatus.js +2 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/UserInput.d.ts +3 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/UserInput.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/codexProtocol/v2/WebSearchAction.d.ts +15 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/WebSearchAction.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexProtocol/v2/WebSearchAction.js +2 -0
- package/vendor/runtime/dist/executor/codexRpc.d.ts +13 -4
- package/vendor/runtime/dist/executor/codexRpc.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/codexRpc.js +21 -5
- package/vendor/runtime/dist/executor/codexSessions.d.ts +30 -0
- package/vendor/runtime/dist/executor/codexSessions.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/codexSessions.js +88 -0
- package/vendor/runtime/dist/executor/health.d.ts +8 -2
- package/vendor/runtime/dist/executor/health.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/health.js +21 -5
- package/vendor/runtime/dist/executor/liveTurns.d.ts +2 -1
- package/vendor/runtime/dist/executor/liveTurns.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/liveTurns.js +12 -5
- package/vendor/runtime/dist/executor/ownership.d.ts +40 -0
- package/vendor/runtime/dist/executor/ownership.d.ts.map +1 -0
- package/vendor/runtime/dist/executor/ownership.js +106 -0
- package/vendor/runtime/dist/executor/providerRouter.d.ts +1 -0
- package/vendor/runtime/dist/executor/providerRouter.d.ts.map +1 -1
- package/vendor/runtime/dist/executor/providerRouter.js +5 -0
- package/vendor/runtime/dist/executor/types.d.ts +27 -0
- package/vendor/runtime/dist/executor/types.d.ts.map +1 -1
- package/vendor/runtime/dist/harness/index.d.ts.map +1 -1
- package/vendor/runtime/dist/harness/index.js +1 -0
- 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 +1 -0
- package/vendor/runtime/src/executor/asyncQueue.ts +3 -0
- package/vendor/runtime/src/executor/claudeAgent.ts +66 -13
- package/vendor/runtime/src/executor/codex.ts +124 -47
- package/vendor/runtime/src/executor/codexProtocol/AgentPath.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/FunctionCallOutputContentItem.ts +1 -1
- package/vendor/runtime/src/executor/codexProtocol/ImageGenerationFailure.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/ImageGenerationItem.ts +7 -0
- package/vendor/runtime/src/executor/codexProtocol/LegacyAppPathString.ts +27 -0
- package/vendor/runtime/src/executor/codexProtocol/MessagePhase.ts +11 -0
- package/vendor/runtime/src/executor/codexProtocol/Personality.ts +3 -0
- package/vendor/runtime/src/executor/codexProtocol/PlanType.ts +1 -1
- package/vendor/runtime/src/executor/codexProtocol/README.md +2 -2
- package/vendor/runtime/src/executor/codexProtocol/SleepItem.ts +8 -0
- package/vendor/runtime/src/executor/codexProtocol/SubAgentSource.ts +7 -0
- package/vendor/runtime/src/executor/codexProtocol/ThreadId.ts +10 -0
- package/vendor/runtime/src/executor/codexProtocol/WebSearchItem.ts +14 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/AgentMessageDelivery.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/AsyncUserInputQuestion.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/CodexErrorInfo.ts +12 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/CollabAgentState.ts +6 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/CollabAgentStatus.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/CollabAgentTool.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/CollabAgentToolCallStatus.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/CommandAction.ts +6 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/CommandExecutionSource.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/CommandExecutionStatus.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/CyberAccessProgram.ts +9 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/DynamicToolCallOutputContentItem.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/DynamicToolCallStatus.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/FileUpdateChange.ts +6 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/GetAccountRateLimitsResponse.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/GitInfo.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/HookPromptFragment.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/McpAppDisplayMode.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/McpAppUi.ts +9 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/McpToolCallAppContext.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/McpToolCallError.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/McpToolCallResult.ts +6 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/McpToolCallStatus.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/MemoryCitation.ts +6 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/MemoryCitationEntry.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/MisalignmentErrorDetails.ts +18 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/MisalignmentSteer.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/Model.ts +11 -2
- package/vendor/runtime/src/executor/codexProtocol/v2/ModelAccessPrograms.ts +13 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/NonSteerableTurnKind.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/PatchApplyStatus.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/PatchChangeKind.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/RateLimitSnapshot.ts +5 -1
- package/vendor/runtime/src/executor/codexProtocol/v2/ReviewStartParams.ts +2 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/SessionSource.ts +6 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/SubAgentActivityKind.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/Thread.ts +104 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/ThreadActiveFlag.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/ThreadHistoryMode.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/ThreadItem.ts +125 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/ThreadReadParams.ts +12 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/ThreadReadResponse.ts +6 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/ThreadResumeParams.ts +5 -1
- package/vendor/runtime/src/executor/codexProtocol/v2/ThreadSection.ts +21 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/ThreadSectionAppearance.ts +8 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/ThreadStartParams.ts +4 -1
- package/vendor/runtime/src/executor/codexProtocol/v2/ThreadStatus.ts +6 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/Turn.ts +37 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/TurnError.ts +11 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/TurnItemsView.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/TurnStartParams.ts +7 -2
- package/vendor/runtime/src/executor/codexProtocol/v2/TurnStatus.ts +5 -0
- package/vendor/runtime/src/executor/codexProtocol/v2/UserInput.ts +1 -1
- package/vendor/runtime/src/executor/codexProtocol/v2/WebSearchAction.ts +5 -0
- package/vendor/runtime/src/executor/codexRpc.ts +26 -6
- package/vendor/runtime/src/executor/codexSessions.ts +108 -0
- package/vendor/runtime/src/executor/health.ts +21 -7
- package/vendor/runtime/src/executor/liveTurns.ts +12 -5
- package/vendor/runtime/src/executor/ownership.ts +83 -0
- package/vendor/runtime/src/executor/providerRouter.ts +6 -0
- package/vendor/runtime/src/executor/types.ts +20 -1
- package/vendor/runtime/src/harness/index.ts +1 -0
- package/vendor/runtime/src/index.ts +2 -1
- package/vendor/shared/dist/agentCommands.d.ts +1 -0
- package/vendor/shared/dist/agentCommands.d.ts.map +1 -1
- package/vendor/shared/dist/automations.d.ts +34 -0
- package/vendor/shared/dist/automations.d.ts.map +1 -1
- package/vendor/shared/dist/automations.js +12 -0
- package/vendor/shared/dist/cardStudio.d.ts +41 -0
- package/vendor/shared/dist/cardStudio.d.ts.map +1 -1
- package/vendor/shared/dist/cardStudio.js +13 -3
- package/vendor/shared/dist/computer.d.ts +7 -1
- package/vendor/shared/dist/computer.d.ts.map +1 -1
- package/vendor/shared/dist/computer.js +13 -4
- 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 +8 -14
- package/vendor/shared/dist/goalNotes.d.ts +4 -0
- package/vendor/shared/dist/goalNotes.d.ts.map +1 -0
- package/vendor/shared/dist/goalNotes.js +23 -0
- package/vendor/shared/dist/goals.d.ts +835 -0
- package/vendor/shared/dist/goals.d.ts.map +1 -0
- package/vendor/shared/dist/goals.js +198 -0
- package/vendor/shared/dist/index.d.ts +7 -2
- package/vendor/shared/dist/index.d.ts.map +1 -1
- package/vendor/shared/dist/index.js +6 -1
- package/vendor/shared/dist/journal-vault.d.ts +1 -1
- package/vendor/shared/dist/messagingSafety.d.ts +21 -0
- package/vendor/shared/dist/messagingSafety.d.ts.map +1 -0
- package/vendor/shared/dist/messagingSafety.js +8 -0
- package/vendor/shared/dist/schemas/harness.d.ts +199 -169
- package/vendor/shared/dist/schemas/harness.d.ts.map +1 -1
- package/vendor/shared/dist/schemas/harness.js +25 -124
- package/vendor/shared/dist/smartCapture.d.ts +24 -0
- package/vendor/shared/dist/smartCapture.d.ts.map +1 -1
- package/vendor/shared/dist/smartCapture.js +15 -0
- package/vendor/shared/dist/taskSync.d.ts +342 -0
- package/vendor/shared/dist/taskSync.d.ts.map +1 -0
- package/vendor/shared/dist/taskSync.js +111 -0
- package/vendor/shared/dist/types.d.ts +1 -4
- package/vendor/shared/dist/types.d.ts.map +1 -1
- package/vendor/shared/dist/voiceCapture.d.ts +1 -1
- package/vendor/shared/dist/workspaces.d.ts +255 -0
- package/vendor/shared/dist/workspaces.d.ts.map +1 -0
- package/vendor/shared/dist/workspaces.js +89 -0
- package/vendor/shared/src/agentCommands.ts +1 -0
- package/vendor/shared/src/automations.ts +12 -0
- package/vendor/shared/src/cardStudio.ts +13 -3
- package/vendor/shared/src/computer.ts +19 -5
- package/vendor/shared/src/constants.ts +8 -14
- package/vendor/shared/src/goalNotes.ts +23 -0
- package/vendor/shared/src/goals.ts +237 -0
- package/vendor/shared/src/index.ts +7 -6
- package/vendor/shared/src/messagingSafety.ts +11 -0
- package/vendor/shared/src/schemas/harness.ts +24 -130
- package/vendor/shared/src/smartCapture.ts +27 -0
- package/vendor/shared/src/taskSync.ts +81 -0
- package/vendor/shared/src/types.ts +0 -6
- package/vendor/shared/src/workspaces.ts +103 -0
- package/dist/coding/conduct.d.ts +0 -69
- package/dist/coding/conduct.d.ts.map +0 -1
- package/dist/coding/conduct.js +0 -348
- package/dist/coding/fleetIntegrate.d.ts +0 -37
- package/dist/coding/fleetIntegrate.d.ts.map +0 -1
- package/dist/coding/fleetIntegrate.js +0 -64
- package/dist/coding/fleetPlan.d.ts +0 -20
- package/dist/coding/fleetPlan.d.ts.map +0 -1
- package/dist/coding/fleetPlan.js +0 -125
- package/dist/coding/fleetTasks.d.ts +0 -33
- package/dist/coding/fleetTasks.d.ts.map +0 -1
- package/dist/coding/fleetTasks.js +0 -75
- package/dist/coding/openFleetPr.d.ts +0 -41
- package/dist/coding/openFleetPr.d.ts.map +0 -1
- package/dist/coding/openFleetPr.js +0 -121
- package/src/coding/conduct.ts +0 -462
- package/src/coding/fleetIntegrate.ts +0 -95
- package/src/coding/fleetPlan.ts +0 -135
- package/src/coding/fleetTasks.ts +0 -109
- package/src/coding/openFleetPr.ts +0 -148
|
@@ -30,7 +30,11 @@ model?: string | null, modelProvider?: string | null, serviceTier?: string | nul
|
|
|
30
30
|
* Override where approval requests are routed for review on this thread
|
|
31
31
|
* and subsequent turns.
|
|
32
32
|
*/
|
|
33
|
-
approvalsReviewer?: ApprovalsReviewer | null, sandbox?: SandboxMode | null, config?: { [key in string]?: JsonValue } | null, baseInstructions?: string | null, developerInstructions?: string | null,
|
|
33
|
+
approvalsReviewer?: ApprovalsReviewer | null, sandbox?: SandboxMode | null, config?: { [key in string]?: JsonValue } | null, baseInstructions?: string | null, developerInstructions?: string | null, /**
|
|
34
|
+
* @deprecated `friendly` and `pragmatic` no longer select a style.
|
|
35
|
+
* Changing this does not rewrite the thread's existing instructions.
|
|
36
|
+
*/
|
|
37
|
+
personality?: Personality | null, /**
|
|
34
38
|
* When true, return only thread metadata and live-resume state without
|
|
35
39
|
* populating `thread.turns`. This is useful when the client plans to call
|
|
36
40
|
* `thread/turns/list` immediately after resuming. Full-history hydration
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
|
2
|
+
|
|
3
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
4
|
+
import type { ThreadSectionAppearance } from "./ThreadSectionAppearance.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* An independently persisted, user-visible thread section.
|
|
8
|
+
*/
|
|
9
|
+
export type ThreadSection = {
|
|
10
|
+
/**
|
|
11
|
+
* Opaque UUIDv7 identity that remains stable when the section is renamed.
|
|
12
|
+
*/
|
|
13
|
+
id: string,
|
|
14
|
+
/**
|
|
15
|
+
* The current user-visible section name.
|
|
16
|
+
*/
|
|
17
|
+
name: string,
|
|
18
|
+
/**
|
|
19
|
+
* Optional appearance synchronized across clients.
|
|
20
|
+
*/
|
|
21
|
+
appearance: ThreadSectionAppearance | null, };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
|
2
|
+
|
|
3
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Extensible visual presentation for a custom thread section.
|
|
7
|
+
*/
|
|
8
|
+
export type ThreadSectionAppearance = { icon: string | null, color: string | null, };
|
|
@@ -13,7 +13,10 @@ export type ThreadStartParams = {model?: string | null, modelProvider?: string |
|
|
|
13
13
|
* Override where approval requests are routed for review on this thread
|
|
14
14
|
* and subsequent turns.
|
|
15
15
|
*/
|
|
16
|
-
approvalsReviewer?: ApprovalsReviewer | null, sandbox?: SandboxMode | null, config?: { [key in string]?: JsonValue } | null, serviceName?: string | null, baseInstructions?: string | null, developerInstructions?: string | null,
|
|
16
|
+
approvalsReviewer?: ApprovalsReviewer | null, sandbox?: SandboxMode | null, config?: { [key in string]?: JsonValue } | null, serviceName?: string | null, baseInstructions?: string | null, developerInstructions?: string | null, /**
|
|
17
|
+
* @deprecated `friendly` and `pragmatic` no longer select a style.
|
|
18
|
+
*/
|
|
19
|
+
personality?: Personality | null, ephemeral?: boolean | null, sessionStartSource?: ThreadStartSource | null, /**
|
|
17
20
|
* Optional client-supplied analytics source classification for this thread.
|
|
18
21
|
*/
|
|
19
22
|
threadSource?: ThreadSource | null};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
|
2
|
+
|
|
3
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
4
|
+
import type { ThreadActiveFlag } from "./ThreadActiveFlag.js";
|
|
5
|
+
|
|
6
|
+
export type ThreadStatus = { "type": "notLoaded" } | { "type": "idle" } | { "type": "systemError" } | { "type": "active", activeFlags: Array<ThreadActiveFlag>, };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
|
2
|
+
|
|
3
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
4
|
+
import type { ThreadItem } from "./ThreadItem.js";
|
|
5
|
+
import type { TurnError } from "./TurnError.js";
|
|
6
|
+
import type { TurnItemsView } from "./TurnItemsView.js";
|
|
7
|
+
import type { TurnStatus } from "./TurnStatus.js";
|
|
8
|
+
|
|
9
|
+
export type Turn = {
|
|
10
|
+
/**
|
|
11
|
+
* Identifier for this turn. Codex-generated turn IDs are UUIDv7.
|
|
12
|
+
*/
|
|
13
|
+
id: string,
|
|
14
|
+
/**
|
|
15
|
+
* Thread items currently included in this turn payload.
|
|
16
|
+
*/
|
|
17
|
+
items: Array<ThreadItem>,
|
|
18
|
+
/**
|
|
19
|
+
* Describes how much of `items` has been loaded for this turn.
|
|
20
|
+
*/
|
|
21
|
+
itemsView: TurnItemsView, status: TurnStatus,
|
|
22
|
+
/**
|
|
23
|
+
* Error associated with a failed or interrupted turn.
|
|
24
|
+
*/
|
|
25
|
+
error: TurnError | null,
|
|
26
|
+
/**
|
|
27
|
+
* Unix timestamp (in seconds) when the turn started.
|
|
28
|
+
*/
|
|
29
|
+
startedAt: number | null,
|
|
30
|
+
/**
|
|
31
|
+
* Unix timestamp (in seconds) when the turn completed.
|
|
32
|
+
*/
|
|
33
|
+
completedAt: number | null,
|
|
34
|
+
/**
|
|
35
|
+
* Duration between turn start and completion in milliseconds, if known.
|
|
36
|
+
*/
|
|
37
|
+
durationMs: number | null, };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
|
2
|
+
|
|
3
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
4
|
+
import type { CodexErrorInfo } from "./CodexErrorInfo.js";
|
|
5
|
+
import type { MisalignmentErrorDetails } from "./MisalignmentErrorDetails.js";
|
|
6
|
+
|
|
7
|
+
export type TurnError = { message: string, codexErrorInfo: CodexErrorInfo | null, additionalDetails: string | null,
|
|
8
|
+
/**
|
|
9
|
+
* Optional public explanation and continuation instruction for a misalignment block.
|
|
10
|
+
*/
|
|
11
|
+
misalignment: MisalignmentErrorDetails | null, };
|
|
@@ -11,7 +11,11 @@ import type { SandboxPolicy } from "./SandboxPolicy.js";
|
|
|
11
11
|
import type { TurnToolOutput } from "./TurnToolOutput.js";
|
|
12
12
|
import type { UserInput } from "./UserInput.js";
|
|
13
13
|
|
|
14
|
-
export type TurnStartParams = {threadId: string,
|
|
14
|
+
export type TurnStartParams = {threadId: string, /**
|
|
15
|
+
* Replace this thread's disabled plugin IDs.
|
|
16
|
+
* Omitted/null preserves the list; [] clears it.
|
|
17
|
+
*/
|
|
18
|
+
disabledPluginIds?: Array<string> | null, clientUserMessageId?: string | null, input: Array<UserInput>, /**
|
|
15
19
|
* Optional source classification for the caller that starts this turn.
|
|
16
20
|
* Ignored when this request steers an already-active turn.
|
|
17
21
|
*/
|
|
@@ -46,7 +50,8 @@ effort?: ReasoningEffort | null, /**
|
|
|
46
50
|
* Override the reasoning summary for this turn and subsequent turns.
|
|
47
51
|
*/
|
|
48
52
|
summary?: ReasoningSummary | null, /**
|
|
49
|
-
*
|
|
53
|
+
* @deprecated `friendly` and `pragmatic` no longer select a style.
|
|
54
|
+
* Changing this does not rewrite the thread's existing instructions.
|
|
50
55
|
*/
|
|
51
56
|
personality?: Personality | null, /**
|
|
52
57
|
* Optional JSON Schema used to constrain the final assistant message for
|
|
@@ -8,4 +8,4 @@ export type UserInput = { "type": "text", text: string,
|
|
|
8
8
|
/**
|
|
9
9
|
* UI-defined spans within `text` used to render or persist special elements.
|
|
10
10
|
*/
|
|
11
|
-
text_elements: Array<TextElement>, } | { "type": "image", detail?: ImageDetail, url: string, } | { "type": "localImage", detail?: ImageDetail, path: string, } | { "type": "audio", url: string, } | { "type": "localAudio", path: string, } | { "type": "skill", name: string, path: string, } | { "type": "mention", name: string, path: string, };
|
|
11
|
+
text_elements: Array<TextElement>, } | { "type": "image", detail?: ImageDetail, } & ({ url: string, } | { fileId: string, }) | { "type": "localImage", detail?: ImageDetail, path: string, } | { "type": "audio", url: string, } | { "type": "localAudio", path: string, } | { "type": "skill", name: string, path: string, } | { "type": "mention", name: string, path: string, };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
|
2
|
+
|
|
3
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
4
|
+
|
|
5
|
+
export type WebSearchAction = { "type": "search", query: string | null, queries: Array<string> | null, } | { "type": "openPage", url: string | null, } | { "type": "findInPage", url: string | null, pattern: string | null, } | { "type": "other" };
|
|
@@ -9,7 +9,7 @@ const { version: lucidityVersion } = require('../../package.json') as {
|
|
|
9
9
|
version: string;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
export const CODEX_RUNTIME_VERSION = '0.
|
|
12
|
+
export const CODEX_RUNTIME_VERSION = '0.160.0';
|
|
13
13
|
export interface RpcMessage {
|
|
14
14
|
id?: number | string;
|
|
15
15
|
method?: string;
|
|
@@ -18,11 +18,15 @@ export interface RpcMessage {
|
|
|
18
18
|
error?: { message: string };
|
|
19
19
|
}
|
|
20
20
|
export interface CodexConnection {
|
|
21
|
+
readonly pid?: number;
|
|
22
|
+
readonly isConnected?: boolean;
|
|
21
23
|
events: AsyncIterable<RpcMessage>;
|
|
22
24
|
request<T>(method: string, params: unknown): Promise<T>;
|
|
23
25
|
respond(id: number | string, result: unknown): void;
|
|
24
26
|
onRequest?: (message: RpcMessage) => Promise<unknown>;
|
|
25
|
-
|
|
27
|
+
/** Completed turns may retain the transport while discarding idle notifications. */
|
|
28
|
+
setIdle?(idle: boolean): void;
|
|
29
|
+
close(): void | Promise<void>;
|
|
26
30
|
}
|
|
27
31
|
|
|
28
32
|
export function codexSubscriptionEnv(): NodeJS.ProcessEnv {
|
|
@@ -34,11 +38,17 @@ export function codexSubscriptionEnv(): NodeJS.ProcessEnv {
|
|
|
34
38
|
|
|
35
39
|
/** Bidirectional stdio JSON-RPC. Pending requests fail on timeout or child exit. */
|
|
36
40
|
export class CodexRpc implements CodexConnection {
|
|
41
|
+
get pid(): number | undefined { return this.child.pid; }
|
|
37
42
|
readonly events = new AsyncQueue<RpcMessage>();
|
|
38
43
|
onRequest?: (message: RpcMessage) => Promise<unknown>;
|
|
39
44
|
private child: ChildProcessWithoutNullStreams;
|
|
45
|
+
private readonly exited: Promise<void>;
|
|
40
46
|
private sequence = 0;
|
|
41
47
|
private closed = false;
|
|
48
|
+
private idle = false;
|
|
49
|
+
get isConnected(): boolean {
|
|
50
|
+
return !this.closed;
|
|
51
|
+
}
|
|
42
52
|
private pending = new Map<
|
|
43
53
|
number,
|
|
44
54
|
{
|
|
@@ -48,7 +58,7 @@ export class CodexRpc implements CodexConnection {
|
|
|
48
58
|
}
|
|
49
59
|
>();
|
|
50
60
|
|
|
51
|
-
constructor(command?: string, cwd?: string) {
|
|
61
|
+
constructor(command?: string, cwd?: string, env?: Record<string, string>) {
|
|
52
62
|
const prefix = command
|
|
53
63
|
? []
|
|
54
64
|
: [require.resolve('@openai/codex/bin/codex.js')];
|
|
@@ -66,10 +76,14 @@ export class CodexRpc implements CodexConnection {
|
|
|
66
76
|
],
|
|
67
77
|
{
|
|
68
78
|
cwd,
|
|
69
|
-
env: codexSubscriptionEnv(),
|
|
79
|
+
env: { ...codexSubscriptionEnv(), ...env },
|
|
70
80
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
71
81
|
},
|
|
72
82
|
);
|
|
83
|
+
this.exited = new Promise((resolve) => {
|
|
84
|
+
this.child.once('close', () => resolve());
|
|
85
|
+
this.child.once('error', () => resolve());
|
|
86
|
+
});
|
|
73
87
|
// Drain stderr without retaining potentially sensitive prompt/config diagnostics.
|
|
74
88
|
this.child.stderr.on('data', () => {});
|
|
75
89
|
this.child.stdin.on('error', () => {});
|
|
@@ -108,7 +122,8 @@ export class CodexRpc implements CodexConnection {
|
|
|
108
122
|
clearTimeout(pending.timer);
|
|
109
123
|
if (message.error) pending.reject(new Error(message.error.message));
|
|
110
124
|
else pending.resolve(message.result);
|
|
111
|
-
} else if (message.method && !this.closed
|
|
125
|
+
} else if (message.method && !this.closed && !this.idle)
|
|
126
|
+
this.events.push(message);
|
|
112
127
|
});
|
|
113
128
|
}
|
|
114
129
|
|
|
@@ -116,6 +131,10 @@ export class CodexRpc implements CodexConnection {
|
|
|
116
131
|
if (this.closed) throw new Error('Codex is disconnected.');
|
|
117
132
|
this.child.stdin.write(JSON.stringify(value) + '\n');
|
|
118
133
|
}
|
|
134
|
+
setIdle(idle: boolean): void {
|
|
135
|
+
this.idle = idle;
|
|
136
|
+
if (idle) this.events.discardPending();
|
|
137
|
+
}
|
|
119
138
|
notify(method: string, params?: unknown): void {
|
|
120
139
|
this.write({ method, params });
|
|
121
140
|
}
|
|
@@ -160,8 +179,9 @@ export class CodexRpc implements CodexConnection {
|
|
|
160
179
|
kill.unref();
|
|
161
180
|
this.child.once('close', () => clearTimeout(kill));
|
|
162
181
|
}
|
|
163
|
-
close(): void {
|
|
182
|
+
async close(): Promise<void> {
|
|
164
183
|
this.finish(new Error('Codex session closed.'));
|
|
184
|
+
await this.exited;
|
|
165
185
|
}
|
|
166
186
|
}
|
|
167
187
|
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { CodexConnection } from './codexRpc.js';
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
3
|
+
|
|
4
|
+
/** Rust maps may arrive in a different order; credentials never become a stored key. */
|
|
5
|
+
export function codexBindingFingerprint(value: unknown): string {
|
|
6
|
+
const ordered = (value: unknown): unknown =>
|
|
7
|
+
Array.isArray(value)
|
|
8
|
+
? value.map(ordered)
|
|
9
|
+
: value && typeof value === 'object'
|
|
10
|
+
? Object.fromEntries(
|
|
11
|
+
Object.entries(value)
|
|
12
|
+
.sort(([a], [b]) => a.localeCompare(b))
|
|
13
|
+
.map(([key, item]) => [key, ordered(item)]),
|
|
14
|
+
)
|
|
15
|
+
: value;
|
|
16
|
+
return createHash('sha256')
|
|
17
|
+
.update(JSON.stringify(ordered(value)))
|
|
18
|
+
.digest('hex');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface CodexThread {
|
|
22
|
+
thread: { id: string };
|
|
23
|
+
model?: string;
|
|
24
|
+
reasoningEffort?: string | null;
|
|
25
|
+
cwd?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface CodexSession {
|
|
28
|
+
rpc: CodexConnection;
|
|
29
|
+
thread: CodexThread;
|
|
30
|
+
fingerprint: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Completed threads retain one transport; idle eviction still awaits the native exit. */
|
|
34
|
+
export class CodexSessions {
|
|
35
|
+
private idle = new Map<
|
|
36
|
+
string,
|
|
37
|
+
CodexSession & { timer: ReturnType<typeof setTimeout> }
|
|
38
|
+
>();
|
|
39
|
+
private closing = new Map<string, Promise<void>>();
|
|
40
|
+
private disposed = false;
|
|
41
|
+
constructor(
|
|
42
|
+
private readonly limit = 2,
|
|
43
|
+
private readonly idleMs = 3 * 60_000,
|
|
44
|
+
) {}
|
|
45
|
+
|
|
46
|
+
async take(id?: string): Promise<CodexSession | undefined> {
|
|
47
|
+
if (!id) return;
|
|
48
|
+
await this.closing.get(id);
|
|
49
|
+
if (this.disposed) throw new Error('Codex is shutting down.');
|
|
50
|
+
const session = this.idle.get(id);
|
|
51
|
+
if (!session) return;
|
|
52
|
+
clearTimeout(session.timer);
|
|
53
|
+
this.idle.delete(id);
|
|
54
|
+
if (session.rpc.isConnected === false) {
|
|
55
|
+
await session.rpc.close();
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
session.rpc.setIdle?.(false);
|
|
59
|
+
return session;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private evict(id: string): Promise<void> {
|
|
63
|
+
const session = this.idle.get(id);
|
|
64
|
+
if (!session) return this.closing.get(id) ?? Promise.resolve();
|
|
65
|
+
clearTimeout(session.timer);
|
|
66
|
+
this.idle.delete(id);
|
|
67
|
+
const closing = Promise.resolve()
|
|
68
|
+
.then(() => session.rpc.close())
|
|
69
|
+
.finally(() => {
|
|
70
|
+
if (this.closing.get(id) === closing) this.closing.delete(id);
|
|
71
|
+
});
|
|
72
|
+
this.closing.set(id, closing);
|
|
73
|
+
return closing;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async keep(session: CodexSession): Promise<void> {
|
|
77
|
+
const id = session.thread.thread.id;
|
|
78
|
+
if (
|
|
79
|
+
this.disposed ||
|
|
80
|
+
session.rpc.isConnected === false ||
|
|
81
|
+
!session.rpc.setIdle ||
|
|
82
|
+
this.limit <= 0
|
|
83
|
+
) {
|
|
84
|
+
await session.rpc.close();
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
await this.evict(id);
|
|
88
|
+
if (this.disposed) {
|
|
89
|
+
await session.rpc.close();
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
session.rpc.onRequest = undefined;
|
|
93
|
+
session.rpc.setIdle(true);
|
|
94
|
+
const timer = setTimeout(() => {
|
|
95
|
+
void this.evict(id).catch(() => {});
|
|
96
|
+
}, this.idleMs);
|
|
97
|
+
timer.unref();
|
|
98
|
+
this.idle.set(id, { ...session, timer });
|
|
99
|
+
while (this.idle.size > this.limit)
|
|
100
|
+
await this.evict(this.idle.keys().next().value!);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
async dispose(): Promise<void> {
|
|
104
|
+
this.disposed = true;
|
|
105
|
+
await Promise.all([...this.idle.keys()].map((id) => this.evict(id)));
|
|
106
|
+
await Promise.all(this.closing.values());
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ProviderHealth } from '@lucidity/shared';
|
|
2
|
-
import type { AgentExecutor, ExecutorRunInput } from './types.js';
|
|
2
|
+
import type { AgentExecutor, ExecutorRunInput, ProviderRunRef, ProviderInspection } from './types.js';
|
|
3
3
|
|
|
4
4
|
export function providerFailure(
|
|
5
5
|
error: unknown,
|
|
6
|
-
): Pick<ProviderHealth, 'auth' | 'allowance' | 'problem'> {
|
|
6
|
+
): Pick<ProviderHealth, 'auth' | 'allowance' | 'problem'> | undefined {
|
|
7
7
|
const message = error instanceof Error ? error.message : String(error);
|
|
8
8
|
if (
|
|
9
9
|
/quota|rate.?limit|usage.?limit|allowance|insufficient.*credit|limit.*reached/i.test(
|
|
@@ -21,7 +21,8 @@ export function providerFailure(
|
|
|
21
21
|
)
|
|
22
22
|
)
|
|
23
23
|
return { auth: 'login_required', allowance: 'unknown', problem: 'login' };
|
|
24
|
-
|
|
24
|
+
// A failed thread, command, model, or workspace says nothing about account readiness.
|
|
25
|
+
return undefined;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
/** Observes the same adapter used by interactive and scheduled work. No probe inference. */
|
|
@@ -34,6 +35,10 @@ export class HealthAwareExecutor implements AgentExecutor {
|
|
|
34
35
|
get name() {
|
|
35
36
|
return this.executor.name;
|
|
36
37
|
}
|
|
38
|
+
get recoveryCapability() { return this.executor.recoveryCapability; }
|
|
39
|
+
inspect(ref: ProviderRunRef, options?: { cwd?: string; timeoutMs?: number }): Promise<ProviderInspection> {
|
|
40
|
+
return this.executor.inspect?.(ref, options) ?? Promise.resolve({ status: 'unsupported', reason: 'Provider history inspection is unavailable.' });
|
|
41
|
+
}
|
|
37
42
|
health(): ProviderHealth {
|
|
38
43
|
return { ...this.state };
|
|
39
44
|
}
|
|
@@ -51,12 +56,15 @@ export class HealthAwareExecutor implements AgentExecutor {
|
|
|
51
56
|
if (
|
|
52
57
|
!signal?.aborted &&
|
|
53
58
|
!(error instanceof Error && error.name === 'AbortError')
|
|
54
|
-
)
|
|
55
|
-
|
|
59
|
+
) {
|
|
60
|
+
const failure = providerFailure(error);
|
|
61
|
+
if (failure) this.update(failure);
|
|
62
|
+
}
|
|
56
63
|
}
|
|
57
64
|
async models() {
|
|
58
65
|
if (this.check) return this.check;
|
|
59
|
-
|
|
66
|
+
if (this.state.auth !== 'authenticated')
|
|
67
|
+
this.update({ ...this.state, auth: 'checking' });
|
|
60
68
|
this.check = (async () => {
|
|
61
69
|
try {
|
|
62
70
|
if (!this.executor.models)
|
|
@@ -67,7 +75,10 @@ export class HealthAwareExecutor implements AgentExecutor {
|
|
|
67
75
|
this.update({ auth: 'authenticated', allowance: 'unknown' });
|
|
68
76
|
return models;
|
|
69
77
|
} catch (error) {
|
|
70
|
-
|
|
78
|
+
const failure = providerFailure(error);
|
|
79
|
+
if (failure) this.update(failure);
|
|
80
|
+
else if (this.state.auth !== 'authenticated')
|
|
81
|
+
this.update({ auth: 'unknown', allowance: 'unknown', problem: 'unavailable' });
|
|
71
82
|
throw error;
|
|
72
83
|
} finally {
|
|
73
84
|
this.check = undefined;
|
|
@@ -78,6 +89,9 @@ export class HealthAwareExecutor implements AgentExecutor {
|
|
|
78
89
|
async commands(input?: Pick<ExecutorRunInput, 'cwd' | 'permissionMode' | 'mcp'>) {
|
|
79
90
|
return (await this.executor.commands?.(input)) ?? [];
|
|
80
91
|
}
|
|
92
|
+
withOwnership<T>(input: ExecutorRunInput, action: () => Promise<T>): Promise<T> {
|
|
93
|
+
return this.executor.withOwnership ? this.executor.withOwnership(input, action) : action();
|
|
94
|
+
}
|
|
81
95
|
async run(input: ExecutorRunInput) {
|
|
82
96
|
try {
|
|
83
97
|
const result = await this.executor.run(input);
|
|
@@ -10,12 +10,14 @@ export function abortError(): Error {
|
|
|
10
10
|
|
|
11
11
|
/** Request-scoped ownership. Control calls never wait behind the work queue. */
|
|
12
12
|
export class LiveTurns {
|
|
13
|
+
private disposed = false;
|
|
13
14
|
private turns = new Map<
|
|
14
15
|
string,
|
|
15
|
-
{ abort: () => void; steer: (text: string) => Promise<void> }
|
|
16
|
+
{ abort: () => void; steer: (text: string) => Promise<void>; settled: Promise<void> }
|
|
16
17
|
>();
|
|
17
18
|
|
|
18
19
|
open(input: ExecutorRunInput, steer: (text: string) => Promise<void>) {
|
|
20
|
+
if (this.disposed) throw new Error('The provider is shutting down.');
|
|
19
21
|
const id = input.requestId ?? randomUUID();
|
|
20
22
|
if (id && this.turns.has(id))
|
|
21
23
|
throw new Error('This request is already running.');
|
|
@@ -28,7 +30,9 @@ export class LiveTurns {
|
|
|
28
30
|
timedOut = true;
|
|
29
31
|
abort();
|
|
30
32
|
}, input.timeoutMs ?? 120_000);
|
|
31
|
-
|
|
33
|
+
let settle!: () => void;
|
|
34
|
+
const settled = new Promise<void>((resolve) => { settle = resolve; });
|
|
35
|
+
this.turns.set(id, { abort, steer, settled });
|
|
32
36
|
return {
|
|
33
37
|
controller,
|
|
34
38
|
check: () => {
|
|
@@ -40,6 +44,7 @@ export class LiveTurns {
|
|
|
40
44
|
input.signal?.removeEventListener('abort', abort);
|
|
41
45
|
if (id) this.turns.delete(id);
|
|
42
46
|
abort();
|
|
47
|
+
settle();
|
|
43
48
|
},
|
|
44
49
|
};
|
|
45
50
|
}
|
|
@@ -63,8 +68,10 @@ export class LiveTurns {
|
|
|
63
68
|
return true;
|
|
64
69
|
}
|
|
65
70
|
|
|
66
|
-
dispose(): void {
|
|
67
|
-
|
|
68
|
-
this.turns.
|
|
71
|
+
async dispose(): Promise<void> {
|
|
72
|
+
this.disposed = true;
|
|
73
|
+
const active = [...this.turns.values()];
|
|
74
|
+
for (const turn of active) turn.abort();
|
|
75
|
+
await Promise.all(active.map((turn) => turn.settled));
|
|
69
76
|
}
|
|
70
77
|
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
|
+
import { realpathSync } from 'node:fs';
|
|
3
|
+
import { resolve } from 'node:path';
|
|
4
|
+
import type { AgentExecutor, ExecutorRunInput, ProviderRunRef, ProviderInspection } from './types.js';
|
|
5
|
+
import { abortError } from './liveTurns.js';
|
|
6
|
+
|
|
7
|
+
/** Shared across providers and callers, including scheduled and local chat work. */
|
|
8
|
+
export class ExecutionOwnership {
|
|
9
|
+
private context = new AsyncLocalStorage<Set<string>>();
|
|
10
|
+
|
|
11
|
+
async run<T>(keys: string[], action: () => Promise<T>, signal?: AbortSignal): Promise<T> {
|
|
12
|
+
const held = this.context.getStore() ?? new Set<string>();
|
|
13
|
+
const release = await this.acquire(keys, signal);
|
|
14
|
+
try { return await this.context.run(new Set([...held, ...keys]), action); }
|
|
15
|
+
finally { release(); }
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
private owners = new Map<string, Promise<void>>();
|
|
19
|
+
|
|
20
|
+
async acquire(keys: string[], signal?: AbortSignal): Promise<() => void> {
|
|
21
|
+
keys = [...new Set(keys)].filter((key) => !this.context.getStore()?.has(key));
|
|
22
|
+
for (;;) {
|
|
23
|
+
if (signal?.aborted) throw abortError();
|
|
24
|
+
const blocked = keys.flatMap((key) => this.owners.get(key) ?? []);
|
|
25
|
+
if (!blocked.length) break;
|
|
26
|
+
await new Promise<void>((resolve, reject) => {
|
|
27
|
+
const abort = () => reject(abortError());
|
|
28
|
+
signal?.addEventListener('abort', abort, { once: true });
|
|
29
|
+
Promise.race(blocked).then(resolve, reject).finally(() => signal?.removeEventListener('abort', abort));
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
let release!: () => void;
|
|
33
|
+
const settled = new Promise<void>((resolve) => { release = resolve; });
|
|
34
|
+
for (const key of keys) this.owners.set(key, settled);
|
|
35
|
+
return () => {
|
|
36
|
+
for (const key of keys) if (this.owners.get(key) === settled) this.owners.delete(key);
|
|
37
|
+
release();
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function workspaceKey(path: string): string {
|
|
43
|
+
try { return realpathSync(path); } catch { return resolve(path); }
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export class OwnedExecutor implements AgentExecutor {
|
|
47
|
+
constructor(private readonly executor: AgentExecutor, private readonly provider: string, private readonly ownership: ExecutionOwnership) {}
|
|
48
|
+
get name() { return this.executor.name; }
|
|
49
|
+
get strictResume() { return this.executor.strictResume; }
|
|
50
|
+
get recoveryCapability() { return this.executor.recoveryCapability; }
|
|
51
|
+
inspect(ref: ProviderRunRef, options: { cwd?: string; timeoutMs?: number } = {}): Promise<ProviderInspection> {
|
|
52
|
+
return this.ownership.run([
|
|
53
|
+
...(ref.sessionId ? [`session:${this.provider}:${ref.sessionId}`] : []),
|
|
54
|
+
...(options.cwd ? [`workspace:${workspaceKey(options.cwd)}`] : []),
|
|
55
|
+
], () => this.executor.inspect?.(ref, options) ?? Promise.resolve({ status: 'unsupported', reason: 'Provider history inspection is unavailable.' }));
|
|
56
|
+
}
|
|
57
|
+
private keys(input: ExecutorRunInput): string[] {
|
|
58
|
+
const session = input.resume ?? input.sessionId;
|
|
59
|
+
return [
|
|
60
|
+
...(session ? [`session:${this.provider}:${session}`] : []),
|
|
61
|
+
...(input.cwd && input.permissionMode && !input.noTools ? [`workspace:${workspaceKey(input.cwd)}`] : []),
|
|
62
|
+
];
|
|
63
|
+
}
|
|
64
|
+
withOwnership<T>(input: ExecutorRunInput, action: () => Promise<T>): Promise<T> {
|
|
65
|
+
return this.ownership.run(this.keys(input), action, input.signal);
|
|
66
|
+
}
|
|
67
|
+
async run(input: ExecutorRunInput) {
|
|
68
|
+
const release = await this.ownership.acquire(this.keys(input), input.signal);
|
|
69
|
+
try { return await this.executor.run(input); } finally { release(); }
|
|
70
|
+
}
|
|
71
|
+
async *runStream(input: ExecutorRunInput) {
|
|
72
|
+
const release = await this.ownership.acquire(this.keys(input), input.signal);
|
|
73
|
+
try {
|
|
74
|
+
if (!this.executor.runStream) throw new Error('This provider cannot stream.');
|
|
75
|
+
yield* this.executor.runStream(input);
|
|
76
|
+
} finally { release(); }
|
|
77
|
+
}
|
|
78
|
+
models() { return this.executor.models?.() ?? Promise.resolve([]); }
|
|
79
|
+
commands(input?: Pick<ExecutorRunInput, 'cwd' | 'permissionMode' | 'mcp'>) { return this.executor.commands?.(input) ?? Promise.resolve([]); }
|
|
80
|
+
steer(id: string, text: string) { return this.executor.steer?.(id, text) ?? Promise.reject(new Error('Steering is unavailable.')); }
|
|
81
|
+
interrupt(id: string) { return this.executor.interrupt?.(id) ?? Promise.resolve(false); }
|
|
82
|
+
async dispose() { await this.executor.dispose?.(); }
|
|
83
|
+
}
|
|
@@ -76,6 +76,12 @@ export class ProviderRouter implements AgentExecutor {
|
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
withOwnership<T>(input: ExecutorRunInput, action: () => Promise<T>): Promise<T> {
|
|
80
|
+
const r = this.resolve(input);
|
|
81
|
+
const executor = this.providers[r.provider];
|
|
82
|
+
return executor.withOwnership ? executor.withOwnership(r.input, action) : action();
|
|
83
|
+
}
|
|
84
|
+
|
|
79
85
|
async run(input: ExecutorRunInput) {
|
|
80
86
|
const r = this.resolve(input);
|
|
81
87
|
const result = await this.providers[r.provider].run(r.input);
|
|
@@ -15,9 +15,22 @@ export interface ExecutorApproval {
|
|
|
15
15
|
}
|
|
16
16
|
export type ExecutorModel = import('@lucidity/shared').AgentModelOption;
|
|
17
17
|
|
|
18
|
+
export interface ProviderRunRef {
|
|
19
|
+
sessionId?: string;
|
|
20
|
+
turnId?: string;
|
|
21
|
+
pid?: number;
|
|
22
|
+
/** Commands do not necessarily have a native inference turn. */
|
|
23
|
+
inspectionDisabled?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export type ProviderInspection =
|
|
26
|
+
| { status: 'completed'; result: ExecutorResult }
|
|
27
|
+
| { status: 'unknown' | 'unsupported'; reason: string };
|
|
28
|
+
|
|
18
29
|
export interface ExecutorRunInput {
|
|
19
30
|
/** Lucidity request identity, used for live controls; unrelated to provider session IDs. */
|
|
20
31
|
requestId?: string;
|
|
32
|
+
/** Synchronous durable write. A failure must prevent further provider work. */
|
|
33
|
+
onRecovery?: (ref: ProviderRunRef) => void;
|
|
21
34
|
/** Interactive callers can provide a permission surface. Absent means deny. */
|
|
22
35
|
onApproval?: (approval: ExecutorApproval) => Promise<boolean>;
|
|
23
36
|
|
|
@@ -60,6 +73,8 @@ export interface ExecutorRunInput {
|
|
|
60
73
|
provider?: AgentProvider;
|
|
61
74
|
/** Working directory for the run (the target repo for a coding turn, M7). */
|
|
62
75
|
cwd?: string;
|
|
76
|
+
/** Extra variables for the agent's process, on top of the sanitised daemon environment. */
|
|
77
|
+
env?: Record<string, string>;
|
|
63
78
|
/** Compatibility policy names; each adapter maps them to native permissions. */
|
|
64
79
|
permissionMode?:
|
|
65
80
|
| 'default'
|
|
@@ -77,7 +92,7 @@ export interface ExecutorRunInput {
|
|
|
77
92
|
export type ExecutorStreamEvent =
|
|
78
93
|
| { type: 'session'; sessionId: string }
|
|
79
94
|
| { type: 'delta'; text: string }
|
|
80
|
-
| { type: 'tool_call'; name: string; phase: 'start' | 'end' }
|
|
95
|
+
| { type: 'tool_call'; name: string; phase: 'start' | 'end'; itemId?: string; outcome?: string }
|
|
81
96
|
| { type: 'done'; text: string; sessionId?: string; costUsd?: number };
|
|
82
97
|
|
|
83
98
|
export interface ExecutorResult {
|
|
@@ -95,6 +110,8 @@ export interface AgentExecutor {
|
|
|
95
110
|
readonly name: string;
|
|
96
111
|
/** Strict providers report resume failures instead of silently starting memoryless. */
|
|
97
112
|
readonly strictResume?: boolean;
|
|
113
|
+
readonly recoveryCapability?: 'native-turn' | 'completion-receipt';
|
|
114
|
+
inspect?(ref: ProviderRunRef, options?: { cwd?: string; timeoutMs?: number }): Promise<ProviderInspection>;
|
|
98
115
|
/** Resolves once input is accepted by the provider transport. */
|
|
99
116
|
steer?(requestId: string, text: string): Promise<void>;
|
|
100
117
|
/** Interrupt a turn owned by this adapter, including conductor workers. */
|
|
@@ -104,6 +121,8 @@ export interface AgentExecutor {
|
|
|
104
121
|
commands?(input?: Pick<ExecutorRunInput, 'cwd' | 'permissionMode' | 'mcp'>): Promise<import('@lucidity/shared').AgentCommandOption[]>;
|
|
105
122
|
dispose?(): Promise<void>;
|
|
106
123
|
|
|
124
|
+
/** Hold the same session and workspace through preparation and result collection. */
|
|
125
|
+
withOwnership?<T>(input: ExecutorRunInput, action: () => Promise<T>): Promise<T>;
|
|
107
126
|
run(input: ExecutorRunInput): Promise<ExecutorResult>;
|
|
108
127
|
/** Optional token-streaming variant for interactive chat. */
|
|
109
128
|
runStream?(input: ExecutorRunInput): AsyncIterable<ExecutorStreamEvent>;
|