@downcity/agent 1.1.237 → 1.1.258
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 +21 -20
- package/bin/agent/{local/Agent.d.ts → Agent.d.ts} +37 -27
- package/bin/agent/Agent.d.ts.map +1 -0
- package/bin/agent/Agent.js +211 -0
- package/bin/agent/Agent.js.map +1 -0
- package/bin/agent/AgentContext.d.ts +64 -0
- package/bin/agent/AgentContext.d.ts.map +1 -0
- package/bin/agent/AgentContext.js +53 -0
- package/bin/agent/AgentContext.js.map +1 -0
- package/bin/agent/{local/AgentInstructions.d.ts → AgentInstructions.d.ts} +1 -6
- package/bin/agent/AgentInstructions.d.ts.map +1 -0
- package/bin/agent/{local/AgentInstructions.js → AgentInstructions.js} +1 -10
- package/bin/agent/AgentInstructions.js.map +1 -0
- package/bin/{model/CityModelAdapter.d.ts → agent/AgentModel.d.ts} +3 -3
- package/bin/agent/AgentModel.d.ts.map +1 -0
- package/bin/{model/CityModelAdapter.js → agent/AgentModel.js} +11 -4
- package/bin/agent/AgentModel.js.map +1 -0
- package/bin/agent/{local/services/AgentSessions.d.ts → AgentSessions.d.ts} +30 -40
- package/bin/agent/AgentSessions.d.ts.map +1 -0
- package/bin/agent/{local/services/AgentSessions.js → AgentSessions.js} +62 -79
- package/bin/agent/AgentSessions.js.map +1 -0
- package/bin/agent/AgentState.d.ts +64 -0
- package/bin/agent/AgentState.d.ts.map +1 -0
- package/bin/agent/AgentState.js +118 -0
- package/bin/agent/AgentState.js.map +1 -0
- package/bin/config/Paths.d.ts +0 -43
- package/bin/config/Paths.d.ts.map +1 -1
- package/bin/config/Paths.js +0 -79
- package/bin/config/Paths.js.map +1 -1
- package/bin/config/ProjectSetup.d.ts.map +1 -0
- package/bin/{agent/local → config}/ProjectSetup.js +1 -1
- package/bin/config/ProjectSetup.js.map +1 -0
- package/bin/executor/Executor.d.ts +20 -86
- package/bin/executor/Executor.d.ts.map +1 -1
- package/bin/executor/Executor.js +109 -260
- package/bin/executor/Executor.js.map +1 -1
- package/bin/executor/composer/system/default/DefaultSessionSystemComposer.d.ts +1 -1
- package/bin/executor/composer/system/default/DefaultSessionSystemComposer.d.ts.map +1 -1
- package/bin/executor/composer/system/default/SystemDomain.d.ts +1 -1
- package/bin/executor/composer/system/default/SystemDomain.d.ts.map +1 -1
- package/bin/executor/composer/system/default/SystemDomain.js +4 -1
- package/bin/executor/composer/system/default/SystemDomain.js.map +1 -1
- package/bin/executor/composer/system/default/assets/core.prompt.d.ts +1 -1
- package/bin/executor/composer/system/default/assets/core.prompt.d.ts.map +1 -1
- package/bin/executor/composer/system/default/assets/core.prompt.js +1 -1
- package/bin/executor/composer/system/default/assets/core.prompt.js.map +1 -1
- package/bin/executor/core-engine/CoreEngineRunner.d.ts +7 -13
- package/bin/executor/core-engine/CoreEngineRunner.d.ts.map +1 -1
- package/bin/executor/core-engine/CoreEngineRunner.js +81 -34
- package/bin/executor/core-engine/CoreEngineRunner.js.map +1 -1
- package/bin/executor/services/ExecutorRecoveryPolicy.d.ts +6 -12
- package/bin/executor/services/ExecutorRecoveryPolicy.d.ts.map +1 -1
- package/bin/executor/services/ExecutorRecoveryPolicy.js +20 -6
- package/bin/executor/services/ExecutorRecoveryPolicy.js.map +1 -1
- package/bin/executor/tools/file/ReadImageToolBridge.d.ts +21 -0
- package/bin/executor/tools/file/ReadImageToolBridge.d.ts.map +1 -0
- package/bin/executor/tools/file/ReadImageToolBridge.js +69 -0
- package/bin/executor/tools/file/ReadImageToolBridge.js.map +1 -0
- package/bin/executor/tools/plugin/PluginToolBridge.d.ts.map +1 -1
- package/bin/executor/tools/plugin/PluginToolBridge.js +6 -5
- package/bin/executor/tools/plugin/PluginToolBridge.js.map +1 -1
- package/bin/executor/tools/plugin/PluginToolDefinition.d.ts.map +1 -1
- package/bin/executor/tools/plugin/PluginToolDefinition.js +15 -2
- package/bin/executor/tools/plugin/PluginToolDefinition.js.map +1 -1
- package/bin/executor/types/SessionHistoryMeta.d.ts +0 -2
- package/bin/executor/types/SessionHistoryMeta.d.ts.map +1 -1
- package/bin/index.d.ts +17 -21
- package/bin/index.d.ts.map +1 -1
- package/bin/index.js +9 -11
- package/bin/index.js.map +1 -1
- package/bin/plugin/core/ActionScheduleExecutor.d.ts +1 -1
- package/bin/plugin/core/ActionScheduleExecutor.d.ts.map +1 -1
- package/bin/plugin/core/ActionScheduleRuntime.d.ts +1 -1
- package/bin/plugin/core/ActionScheduleRuntime.d.ts.map +1 -1
- package/bin/plugin/core/BasePlugin.d.ts +4 -3
- package/bin/plugin/core/BasePlugin.d.ts.map +1 -1
- package/bin/plugin/core/BasePlugin.js.map +1 -1
- package/bin/plugin/core/HookRegistry.d.ts +5 -8
- package/bin/plugin/core/HookRegistry.d.ts.map +1 -1
- package/bin/plugin/core/HookRegistry.js +12 -12
- package/bin/plugin/core/HookRegistry.js.map +1 -1
- package/bin/plugin/core/PluginActionFactory.d.ts +6 -3
- package/bin/plugin/core/PluginActionFactory.d.ts.map +1 -1
- package/bin/plugin/core/PluginActionFactory.js.map +1 -1
- package/bin/plugin/core/PluginActionRunner.d.ts +1 -1
- package/bin/plugin/core/PluginActionRunner.d.ts.map +1 -1
- package/bin/plugin/core/PluginCatalog.d.ts +1 -1
- package/bin/plugin/core/PluginCatalog.d.ts.map +1 -1
- package/bin/plugin/core/PluginHttpRoutes.d.ts +1 -1
- package/bin/plugin/core/PluginHttpRoutes.d.ts.map +1 -1
- package/bin/plugin/core/PluginLocalExecution.d.ts +4 -5
- package/bin/plugin/core/PluginLocalExecution.d.ts.map +1 -1
- package/bin/plugin/core/PluginLocalExecution.js +4 -12
- package/bin/plugin/core/PluginLocalExecution.js.map +1 -1
- package/bin/plugin/core/PluginRegistry.d.ts +16 -12
- package/bin/plugin/core/PluginRegistry.d.ts.map +1 -1
- package/bin/plugin/core/PluginRegistry.js +43 -22
- package/bin/plugin/core/PluginRegistry.js.map +1 -1
- package/bin/plugin/core/PluginStateController.d.ts +1 -1
- package/bin/plugin/core/PluginStateController.d.ts.map +1 -1
- package/bin/{agent/remote → remote}/RemoteAgent.d.ts +4 -4
- package/bin/remote/RemoteAgent.d.ts.map +1 -0
- package/bin/{agent/remote → remote}/RemoteAgent.js +3 -3
- package/bin/remote/RemoteAgent.js.map +1 -0
- package/bin/{agent/remote → remote}/RemoteSession.d.ts +9 -11
- package/bin/remote/RemoteSession.d.ts.map +1 -0
- package/bin/{agent/remote → remote}/RemoteSession.js +3 -33
- package/bin/remote/RemoteSession.js.map +1 -0
- package/bin/{agent/remote → remote}/RemoteTransport.d.ts +7 -9
- package/bin/remote/RemoteTransport.d.ts.map +1 -0
- package/bin/remote/RemoteTransport.js.map +1 -0
- package/bin/{agent/remote → remote}/TransportFactory.d.ts +1 -1
- package/bin/remote/TransportFactory.d.ts.map +1 -0
- package/bin/{agent/remote → remote}/TransportFactory.js +2 -2
- package/bin/remote/TransportFactory.js.map +1 -0
- package/bin/{agent/remote → remote}/transports/HttpRemoteAgentTransport.d.ts +8 -9
- package/bin/remote/transports/HttpRemoteAgentTransport.d.ts.map +1 -0
- package/bin/{agent/remote → remote}/transports/HttpRemoteAgentTransport.js +0 -13
- package/bin/remote/transports/HttpRemoteAgentTransport.js.map +1 -0
- package/bin/{rpc/Client.d.ts → remote/transports/RpcClient.d.ts} +15 -22
- package/bin/remote/transports/RpcClient.d.ts.map +1 -0
- package/bin/{rpc/Client.js → remote/transports/RpcClient.js} +2 -13
- package/bin/remote/transports/RpcClient.js.map +1 -0
- package/bin/{agent/remote → remote}/transports/RpcRemoteAgentTransport.d.ts +8 -9
- package/bin/remote/transports/RpcRemoteAgentTransport.d.ts.map +1 -0
- package/bin/{agent/remote → remote}/transports/RpcRemoteAgentTransport.js +1 -4
- package/bin/remote/transports/RpcRemoteAgentTransport.js.map +1 -0
- package/bin/session/DefaultSessionComposer.d.ts +18 -0
- package/bin/session/DefaultSessionComposer.d.ts.map +1 -0
- package/bin/session/DefaultSessionComposer.js +62 -0
- package/bin/session/DefaultSessionComposer.js.map +1 -0
- package/bin/session/Session.d.ts +44 -33
- package/bin/session/Session.d.ts.map +1 -1
- package/bin/session/Session.js +440 -274
- package/bin/session/Session.js.map +1 -1
- package/bin/session/SessionMessages.d.ts +117 -0
- package/bin/session/SessionMessages.d.ts.map +1 -0
- package/bin/session/{recorder/SessionRecorder.js → SessionMessages.js} +194 -284
- package/bin/session/SessionMessages.js.map +1 -0
- package/bin/session/SessionQueue.d.ts +34 -0
- package/bin/session/SessionQueue.d.ts.map +1 -0
- package/bin/session/SessionQueue.js +60 -0
- package/bin/session/SessionQueue.js.map +1 -0
- package/bin/session/SessionState.d.ts +70 -0
- package/bin/session/SessionState.d.ts.map +1 -0
- package/bin/session/SessionState.js +267 -0
- package/bin/session/SessionState.js.map +1 -0
- package/bin/session/SessionSystem.d.ts +15 -0
- package/bin/session/SessionSystem.d.ts.map +1 -0
- package/bin/session/SessionSystem.js +95 -0
- package/bin/session/SessionSystem.js.map +1 -0
- package/bin/session/SessionTurn.d.ts +84 -0
- package/bin/session/SessionTurn.d.ts.map +1 -0
- package/bin/session/SessionTurn.js +588 -0
- package/bin/session/SessionTurn.js.map +1 -0
- package/bin/session/approval/SessionApprovalBroker.d.ts +48 -0
- package/bin/session/approval/SessionApprovalBroker.d.ts.map +1 -0
- package/bin/session/approval/SessionApprovalBroker.js +126 -0
- package/bin/session/approval/SessionApprovalBroker.js.map +1 -0
- package/bin/session/browse/Browse.d.ts.map +1 -1
- package/bin/session/browse/Browse.js +1 -4
- package/bin/session/browse/Browse.js.map +1 -1
- package/bin/session/{recorder → messages}/JsonlSessionMessageStore.d.ts.map +1 -1
- package/bin/session/{recorder → messages}/JsonlSessionMessageStore.js.map +1 -1
- package/bin/session/messages/SessionAssistantMessageWriter.d.ts +62 -0
- package/bin/session/messages/SessionAssistantMessageWriter.d.ts.map +1 -0
- package/bin/session/messages/SessionAssistantMessageWriter.js +287 -0
- package/bin/session/messages/SessionAssistantMessageWriter.js.map +1 -0
- package/bin/session/messages/SessionJsonValue.d.ts +10 -0
- package/bin/session/messages/SessionJsonValue.d.ts.map +1 -0
- package/bin/session/messages/SessionJsonValue.js +23 -0
- package/bin/session/messages/SessionJsonValue.js.map +1 -0
- package/bin/session/{recorder → messages}/SessionMessageCodec.d.ts +4 -1
- package/bin/session/messages/SessionMessageCodec.d.ts.map +1 -0
- package/bin/session/{recorder → messages}/SessionMessageCodec.js +33 -19
- package/bin/session/messages/SessionMessageCodec.js.map +1 -0
- package/bin/session/messages/SessionMessageCompaction.d.ts +22 -0
- package/bin/session/messages/SessionMessageCompaction.d.ts.map +1 -0
- package/bin/session/{recorder/SessionRecorderCompaction.js → messages/SessionMessageCompaction.js} +19 -51
- package/bin/session/messages/SessionMessageCompaction.js.map +1 -0
- package/bin/session/runtime/SessionEventHub.d.ts +1 -8
- package/bin/session/runtime/SessionEventHub.d.ts.map +1 -1
- package/bin/session/runtime/SessionEventHub.js +1 -6
- package/bin/session/runtime/SessionEventHub.js.map +1 -1
- package/bin/session/storage/Metadata.d.ts +23 -5
- package/bin/session/storage/Metadata.d.ts.map +1 -1
- package/bin/session/storage/Metadata.js +32 -29
- package/bin/session/storage/Metadata.js.map +1 -1
- package/bin/session/storage/RuntimeSessionPort.d.ts +5 -10
- package/bin/session/storage/RuntimeSessionPort.d.ts.map +1 -1
- package/bin/session/storage/RuntimeSessionPort.js +2 -4
- package/bin/session/storage/RuntimeSessionPort.js.map +1 -1
- package/bin/types/agent/AgentOptions.d.ts +6 -35
- package/bin/types/agent/AgentOptions.d.ts.map +1 -1
- package/bin/types/agent/AgentState.d.ts +28 -0
- package/bin/types/agent/AgentState.d.ts.map +1 -0
- package/bin/types/agent/AgentState.js +9 -0
- package/bin/types/agent/AgentState.js.map +1 -0
- package/bin/types/agent/SessionActor.d.ts +0 -2
- package/bin/types/agent/SessionActor.d.ts.map +1 -1
- package/bin/types/agent/SessionTypes.d.ts +5 -18
- package/bin/types/agent/SessionTypes.d.ts.map +1 -1
- package/bin/types/executor/SessionRunContext.d.ts +8 -2
- package/bin/types/executor/SessionRunContext.d.ts.map +1 -1
- package/bin/types/executor/SessionRunContext.js +1 -1
- package/bin/types/executor/SessionToolExecutionContext.d.ts +20 -0
- package/bin/types/executor/SessionToolExecutionContext.d.ts.map +1 -0
- package/bin/types/executor/SessionToolExecutionContext.js +10 -0
- package/bin/types/executor/SessionToolExecutionContext.js.map +1 -0
- package/bin/types/plugin/PluginAction.d.ts +10 -1
- package/bin/types/plugin/PluginAction.d.ts.map +1 -1
- package/bin/types/plugin/PluginCommand.d.ts +3 -11
- package/bin/types/plugin/PluginCommand.d.ts.map +1 -1
- package/bin/types/plugin/PluginConfig.d.ts +12 -0
- package/bin/types/plugin/PluginConfig.d.ts.map +1 -0
- package/bin/types/plugin/PluginConfig.js +5 -0
- package/bin/types/plugin/PluginConfig.js.map +1 -0
- package/bin/types/plugin/PluginDefinition.d.ts +10 -3
- package/bin/types/plugin/PluginDefinition.d.ts.map +1 -1
- package/bin/types/plugin/PluginHttp.d.ts +1 -1
- package/bin/types/plugin/PluginHttp.d.ts.map +1 -1
- package/bin/types/plugin/PluginRunContext.d.ts +26 -0
- package/bin/types/plugin/PluginRunContext.d.ts.map +1 -0
- package/bin/types/plugin/PluginRunContext.js +10 -0
- package/bin/types/plugin/PluginRunContext.js.map +1 -0
- package/bin/types/plugin/PluginRuntime.d.ts +9 -3
- package/bin/types/plugin/PluginRuntime.d.ts.map +1 -1
- package/bin/types/plugin/PluginToolRuntime.d.ts +11 -0
- package/bin/types/plugin/PluginToolRuntime.d.ts.map +1 -1
- package/bin/types/rpc/RpcProtocol.d.ts +1 -13
- package/bin/types/rpc/RpcProtocol.d.ts.map +1 -1
- package/bin/types/session/SessionApproval.d.ts +4 -38
- package/bin/types/session/SessionApproval.d.ts.map +1 -1
- package/bin/types/session/SessionApprovalBroker.d.ts +17 -0
- package/bin/types/session/SessionApprovalBroker.d.ts.map +1 -0
- package/bin/types/session/SessionApprovalBroker.js +7 -0
- package/bin/types/session/SessionApprovalBroker.js.map +1 -0
- package/bin/types/session/SessionComposer.d.ts +99 -0
- package/bin/types/session/SessionComposer.d.ts.map +1 -0
- package/bin/types/session/SessionComposer.js +8 -0
- package/bin/types/session/SessionComposer.js.map +1 -0
- package/bin/types/session/SessionLocalState.d.ts +6 -6
- package/bin/types/session/SessionLocalState.d.ts.map +1 -1
- package/bin/types/session/SessionLocalState.js +1 -1
- package/bin/types/session/SessionMessage.d.ts +3 -2
- package/bin/types/session/SessionMessage.d.ts.map +1 -1
- package/bin/types/session/SessionMessages.d.ts +115 -0
- package/bin/types/session/SessionMessages.d.ts.map +1 -0
- package/bin/types/session/SessionMessages.js +7 -0
- package/bin/types/session/SessionMessages.js.map +1 -0
- package/bin/types/session/SessionMutation.d.ts +1 -10
- package/bin/types/session/SessionMutation.d.ts.map +1 -1
- package/bin/types/session/SessionMutation.js.map +1 -1
- package/bin/types/session/SessionOptions.d.ts +8 -23
- package/bin/types/session/SessionOptions.d.ts.map +1 -1
- package/bin/types/session/SessionPort.d.ts +72 -0
- package/bin/types/session/SessionPort.d.ts.map +1 -0
- package/bin/types/session/SessionPort.js +9 -0
- package/bin/types/session/SessionPort.js.map +1 -0
- package/bin/types/session/SessionQueue.d.ts +104 -0
- package/bin/types/session/SessionQueue.d.ts.map +1 -0
- package/bin/types/session/SessionQueue.js +7 -0
- package/bin/types/session/SessionQueue.js.map +1 -0
- package/bin/types/session/SessionState.d.ts +43 -0
- package/bin/types/session/SessionState.d.ts.map +1 -0
- package/bin/types/session/SessionState.js +7 -0
- package/bin/types/session/SessionState.js.map +1 -0
- package/bin/types/session/SessionSystem.d.ts +26 -0
- package/bin/types/session/SessionSystem.d.ts.map +1 -0
- package/bin/types/session/SessionSystem.js +7 -0
- package/bin/types/session/SessionSystem.js.map +1 -0
- package/bin/types/session/SessionTool.d.ts +23 -0
- package/bin/types/session/SessionTool.d.ts.map +1 -0
- package/bin/types/session/SessionTool.js +7 -0
- package/bin/types/session/SessionTool.js.map +1 -0
- package/bin/types/session/SessionTurn.d.ts +52 -0
- package/bin/types/session/SessionTurn.d.ts.map +1 -0
- package/bin/types/session/SessionTurn.js +7 -0
- package/bin/types/session/SessionTurn.js.map +1 -0
- package/package.json +3 -3
- package/scripts/agent-env.test.mjs +4 -18
- package/scripts/agent-ready.test.mjs +33 -2
- package/scripts/agent-session-maintenance.test.mjs +52 -0
- package/scripts/city-model-tool-loop.test.mjs +3 -4
- package/scripts/core-engine-context-compaction.test.mjs +5 -22
- package/scripts/image-plugin-job.test.mjs +4 -6
- package/scripts/plugin-tool-bridge.test.mjs +44 -36
- package/scripts/read-image-tool-bridge.test.mjs +71 -0
- package/scripts/remote-session-reconnect.test.mjs +1 -34
- package/scripts/session-compaction-prompts.test.mjs +1 -49
- package/scripts/session-composer.test.mjs +163 -0
- package/scripts/session-config-turn-boundary.test.mjs +2 -5
- package/scripts/session-list-title.test.mjs +3 -2
- package/scripts/session-messages-error.test.mjs +57 -0
- package/scripts/{session-recorder.test.mjs → session-messages.test.mjs} +131 -90
- package/scripts/session-queue.test.mjs +64 -0
- package/scripts/session-shell-approval.test.mjs +171 -0
- package/scripts/session-system-blocks.test.mjs +10 -10
- package/scripts/session-title-event.test.mjs +1 -0
- package/src/agent/Agent.ts +241 -0
- package/src/agent/AgentContext.ts +92 -0
- package/src/agent/{local/AgentInstructions.ts → AgentInstructions.ts} +0 -11
- package/src/{model/CityModelAdapter.ts → agent/AgentModel.ts} +10 -3
- package/src/agent/{local/services/AgentSessions.ts → AgentSessions.ts} +81 -110
- package/src/agent/AgentState.ts +151 -0
- package/src/config/Paths.ts +0 -91
- package/src/executor/Executor.ts +180 -386
- package/src/executor/README.md +29 -89
- package/src/executor/composer/system/default/DefaultSessionSystemComposer.ts +1 -1
- package/src/executor/composer/system/default/SystemDomain.ts +4 -2
- package/src/executor/composer/system/default/assets/core.prompt.ts +1 -1
- package/src/executor/composer/system/default/assets/core.prompt.ts.txt +15 -2
- package/src/executor/core-engine/CoreEngineRunner.ts +95 -54
- package/src/executor/services/ExecutorRecoveryPolicy.ts +24 -19
- package/src/executor/tools/file/ReadImageToolBridge.ts +79 -0
- package/src/executor/tools/plugin/PluginToolBridge.ts +6 -8
- package/src/executor/tools/plugin/PluginToolDefinition.ts +23 -3
- package/src/executor/types/SessionHistoryMeta.ts +0 -2
- package/src/index.ts +34 -53
- package/src/plugin/core/ActionScheduleExecutor.ts +1 -1
- package/src/plugin/core/ActionScheduleRuntime.ts +1 -1
- package/src/plugin/core/BasePlugin.ts +7 -3
- package/src/plugin/core/HookRegistry.ts +15 -18
- package/src/plugin/core/PluginActionFactory.ts +9 -3
- package/src/plugin/core/PluginActionRunner.ts +1 -1
- package/src/plugin/core/PluginCatalog.ts +1 -1
- package/src/plugin/core/PluginHttpRoutes.ts +1 -1
- package/src/plugin/core/PluginLocalExecution.ts +11 -24
- package/src/plugin/core/PluginRegistry.ts +55 -32
- package/src/plugin/core/PluginStateController.ts +1 -1
- package/src/{agent/remote → remote}/RemoteAgent.ts +4 -4
- package/src/{agent/remote → remote}/RemoteSession.ts +2 -35
- package/src/{agent/remote → remote}/RemoteTransport.ts +0 -3
- package/src/{agent/remote → remote}/TransportFactory.ts +3 -3
- package/src/{agent/remote → remote}/transports/HttpRemoteAgentTransport.ts +1 -23
- package/src/{rpc/Client.ts → remote/transports/RpcClient.ts} +1 -19
- package/src/{agent/remote → remote}/transports/RpcRemoteAgentTransport.ts +2 -10
- package/src/session/DefaultSessionComposer.ts +79 -0
- package/src/session/Session.ts +496 -332
- package/src/session/{recorder/SessionRecorder.ts → SessionMessages.ts} +254 -428
- package/src/session/SessionQueue.ts +86 -0
- package/src/session/SessionState.ts +322 -0
- package/src/session/SessionSystem.ts +117 -0
- package/src/session/SessionTurn.ts +684 -0
- package/src/session/approval/SessionApprovalBroker.ts +164 -0
- package/src/session/browse/Browse.ts +1 -4
- package/src/session/messages/SessionAssistantMessageWriter.ts +345 -0
- package/src/session/messages/SessionJsonValue.ts +25 -0
- package/src/session/{recorder → messages}/SessionMessageCodec.ts +38 -20
- package/src/session/{recorder/SessionRecorderCompaction.ts → messages/SessionMessageCompaction.ts} +30 -69
- package/src/session/runtime/SessionEventHub.ts +1 -14
- package/src/session/storage/Metadata.ts +60 -34
- package/src/session/storage/RuntimeSessionPort.ts +7 -14
- package/src/types/agent/AgentOptions.ts +6 -38
- package/src/types/agent/AgentState.ts +33 -0
- package/src/types/agent/SessionActor.ts +0 -3
- package/src/types/agent/SessionTypes.ts +5 -18
- package/src/types/executor/SessionRunContext.ts +10 -2
- package/src/types/executor/SessionToolExecutionContext.ts +21 -0
- package/src/types/plugin/PluginAction.ts +10 -1
- package/src/types/plugin/PluginCommand.ts +3 -14
- package/src/types/plugin/PluginConfig.ts +13 -0
- package/src/types/plugin/PluginDefinition.ts +13 -6
- package/src/types/plugin/PluginHttp.ts +1 -1
- package/src/types/plugin/PluginRunContext.ts +31 -0
- package/src/types/plugin/PluginRuntime.ts +13 -6
- package/src/types/plugin/PluginToolRuntime.ts +13 -1
- package/src/types/rpc/RpcProtocol.ts +0 -14
- package/src/types/session/SessionApproval.ts +4 -43
- package/src/types/session/SessionApprovalBroker.ts +18 -0
- package/src/types/session/SessionComposer.ts +114 -0
- package/src/types/session/SessionLocalState.ts +6 -6
- package/src/types/session/SessionMessage.ts +3 -2
- package/src/types/session/SessionMessages.ts +127 -0
- package/src/types/session/SessionMutation.ts +0 -11
- package/src/types/session/SessionOptions.ts +8 -40
- package/src/types/session/SessionPort.ts +97 -0
- package/src/types/session/SessionQueue.ts +122 -0
- package/src/types/session/SessionState.ts +47 -0
- package/src/types/session/SessionSystem.ts +27 -0
- package/src/types/session/SessionTool.ts +25 -0
- package/src/types/session/SessionTurn.ts +56 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/bin/agent/local/Agent.d.ts.map +0 -1
- package/bin/agent/local/Agent.js +0 -216
- package/bin/agent/local/Agent.js.map +0 -1
- package/bin/agent/local/AgentInstructions.d.ts.map +0 -1
- package/bin/agent/local/AgentInstructions.js.map +0 -1
- package/bin/agent/local/AgentPluginFactory.d.ts +0 -26
- package/bin/agent/local/AgentPluginFactory.d.ts.map +0 -1
- package/bin/agent/local/AgentPluginFactory.js +0 -33
- package/bin/agent/local/AgentPluginFactory.js.map +0 -1
- package/bin/agent/local/AgentRuntimeAssembly.d.ts +0 -10
- package/bin/agent/local/AgentRuntimeAssembly.d.ts.map +0 -1
- package/bin/agent/local/AgentRuntimeAssembly.js +0 -43
- package/bin/agent/local/AgentRuntimeAssembly.js.map +0 -1
- package/bin/agent/local/ProjectSetup.d.ts.map +0 -1
- package/bin/agent/local/ProjectSetup.js.map +0 -1
- package/bin/agent/local/services/AgentAssemblyService.d.ts +0 -105
- package/bin/agent/local/services/AgentAssemblyService.d.ts.map +0 -1
- package/bin/agent/local/services/AgentAssemblyService.js +0 -184
- package/bin/agent/local/services/AgentAssemblyService.js.map +0 -1
- package/bin/agent/local/services/AgentBackgroundService.d.ts +0 -55
- package/bin/agent/local/services/AgentBackgroundService.d.ts.map +0 -1
- package/bin/agent/local/services/AgentBackgroundService.js +0 -85
- package/bin/agent/local/services/AgentBackgroundService.js.map +0 -1
- package/bin/agent/local/services/AgentSessions.d.ts.map +0 -1
- package/bin/agent/local/services/AgentSessions.js.map +0 -1
- package/bin/agent/remote/RemoteAgent.d.ts.map +0 -1
- package/bin/agent/remote/RemoteAgent.js.map +0 -1
- package/bin/agent/remote/RemoteSession.d.ts.map +0 -1
- package/bin/agent/remote/RemoteSession.js.map +0 -1
- package/bin/agent/remote/RemoteTransport.d.ts.map +0 -1
- package/bin/agent/remote/RemoteTransport.js.map +0 -1
- package/bin/agent/remote/TransportFactory.d.ts.map +0 -1
- package/bin/agent/remote/TransportFactory.js.map +0 -1
- package/bin/agent/remote/transports/HttpRemoteAgentTransport.d.ts.map +0 -1
- package/bin/agent/remote/transports/HttpRemoteAgentTransport.js.map +0 -1
- package/bin/agent/remote/transports/RpcRemoteAgentTransport.d.ts.map +0 -1
- package/bin/agent/remote/transports/RpcRemoteAgentTransport.js.map +0 -1
- package/bin/executor/SessionRunScope.d.ts +0 -68
- package/bin/executor/SessionRunScope.d.ts.map +0 -1
- package/bin/executor/SessionRunScope.js +0 -96
- package/bin/executor/SessionRunScope.js.map +0 -1
- package/bin/executor/composer/compaction/SessionCompactionComposer.d.ts +0 -74
- package/bin/executor/composer/compaction/SessionCompactionComposer.d.ts.map +0 -1
- package/bin/executor/composer/compaction/SessionCompactionComposer.js +0 -9
- package/bin/executor/composer/compaction/SessionCompactionComposer.js.map +0 -1
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionComposer.d.ts +0 -27
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionComposer.d.ts.map +0 -1
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionComposer.js +0 -39
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionComposer.js.map +0 -1
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.d.ts +0 -44
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.d.ts.map +0 -1
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.js +0 -218
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.js.map +0 -1
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionFileOperations.d.ts +0 -27
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionFileOperations.d.ts.map +0 -1
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionFileOperations.js +0 -181
- package/bin/executor/composer/compaction/jsonl/JsonlSessionCompactionFileOperations.js.map +0 -1
- package/bin/executor/composer/context/LocalSessionContextComposer.d.ts +0 -50
- package/bin/executor/composer/context/LocalSessionContextComposer.d.ts.map +0 -1
- package/bin/executor/composer/context/LocalSessionContextComposer.js +0 -108
- package/bin/executor/composer/context/LocalSessionContextComposer.js.map +0 -1
- package/bin/executor/composer/context/SessionContextComposer.d.ts +0 -67
- package/bin/executor/composer/context/SessionContextComposer.d.ts.map +0 -1
- package/bin/executor/composer/context/SessionContextComposer.js +0 -9
- package/bin/executor/composer/context/SessionContextComposer.js.map +0 -1
- package/bin/executor/composer/history/SessionHistoryComposer.d.ts +0 -54
- package/bin/executor/composer/history/SessionHistoryComposer.d.ts.map +0 -1
- package/bin/executor/composer/history/SessionHistoryComposer.js +0 -10
- package/bin/executor/composer/history/SessionHistoryComposer.js.map +0 -1
- package/bin/executor/composer/history/SessionHistoryWriter.d.ts +0 -46
- package/bin/executor/composer/history/SessionHistoryWriter.d.ts.map +0 -1
- package/bin/executor/composer/history/SessionHistoryWriter.js +0 -65
- package/bin/executor/composer/history/SessionHistoryWriter.js.map +0 -1
- package/bin/executor/composer/history/jsonl/JsonlSessionHistoryComposer.d.ts +0 -35
- package/bin/executor/composer/history/jsonl/JsonlSessionHistoryComposer.d.ts.map +0 -1
- package/bin/executor/composer/history/jsonl/JsonlSessionHistoryComposer.js +0 -105
- package/bin/executor/composer/history/jsonl/JsonlSessionHistoryComposer.js.map +0 -1
- package/bin/executor/messages/AssistantResultPersistence.d.ts +0 -66
- package/bin/executor/messages/AssistantResultPersistence.d.ts.map +0 -1
- package/bin/executor/messages/AssistantResultPersistence.js +0 -44
- package/bin/executor/messages/AssistantResultPersistence.js.map +0 -1
- package/bin/executor/services/ExecutorInflightService.d.ts +0 -34
- package/bin/executor/services/ExecutorInflightService.d.ts.map +0 -1
- package/bin/executor/services/ExecutorInflightService.js +0 -73
- package/bin/executor/services/ExecutorInflightService.js.map +0 -1
- package/bin/executor/store/history/SessionHistoryStore.d.ts +0 -140
- package/bin/executor/store/history/SessionHistoryStore.d.ts.map +0 -1
- package/bin/executor/store/history/SessionHistoryStore.js +0 -10
- package/bin/executor/store/history/SessionHistoryStore.js.map +0 -1
- package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.d.ts +0 -116
- package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.d.ts.map +0 -1
- package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.js +0 -709
- package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.js.map +0 -1
- package/bin/executor/types/SessionHistoryPaths.d.ts +0 -34
- package/bin/executor/types/SessionHistoryPaths.d.ts.map +0 -1
- package/bin/executor/types/SessionHistoryPaths.js +0 -2
- package/bin/executor/types/SessionHistoryPaths.js.map +0 -1
- package/bin/model/CityModelAdapter.d.ts.map +0 -1
- package/bin/model/CityModelAdapter.js.map +0 -1
- package/bin/rpc/Client.d.ts.map +0 -1
- package/bin/rpc/Client.js.map +0 -1
- package/bin/session/SessionSystemBuilder.d.ts +0 -107
- package/bin/session/SessionSystemBuilder.d.ts.map +0 -1
- package/bin/session/SessionSystemBuilder.js +0 -148
- package/bin/session/SessionSystemBuilder.js.map +0 -1
- package/bin/session/recorder/SessionMessageCodec.d.ts.map +0 -1
- package/bin/session/recorder/SessionMessageCodec.js.map +0 -1
- package/bin/session/recorder/SessionRecorder.d.ts +0 -217
- package/bin/session/recorder/SessionRecorder.d.ts.map +0 -1
- package/bin/session/recorder/SessionRecorder.js.map +0 -1
- package/bin/session/recorder/SessionRecorderCompaction.d.ts +0 -18
- package/bin/session/recorder/SessionRecorderCompaction.d.ts.map +0 -1
- package/bin/session/recorder/SessionRecorderCompaction.js.map +0 -1
- package/bin/session/recorder/SessionRecorderHistoryStore.d.ts +0 -66
- package/bin/session/recorder/SessionRecorderHistoryStore.d.ts.map +0 -1
- package/bin/session/recorder/SessionRecorderHistoryStore.js +0 -190
- package/bin/session/recorder/SessionRecorderHistoryStore.js.map +0 -1
- package/bin/session/runtime/SessionPromptRuntime.d.ts +0 -112
- package/bin/session/runtime/SessionPromptRuntime.d.ts.map +0 -1
- package/bin/session/runtime/SessionPromptRuntime.js +0 -357
- package/bin/session/runtime/SessionPromptRuntime.js.map +0 -1
- package/bin/session/services/SessionStateService.d.ts +0 -187
- package/bin/session/services/SessionStateService.d.ts.map +0 -1
- package/bin/session/services/SessionStateService.js +0 -467
- package/bin/session/services/SessionStateService.js.map +0 -1
- package/bin/session/services/SessionTurnService.d.ts +0 -90
- package/bin/session/services/SessionTurnService.d.ts.map +0 -1
- package/bin/session/services/SessionTurnService.js +0 -293
- package/bin/session/services/SessionTurnService.js.map +0 -1
- package/bin/session/services/SessionViewService.d.ts +0 -114
- package/bin/session/services/SessionViewService.d.ts.map +0 -1
- package/bin/session/services/SessionViewService.js +0 -204
- package/bin/session/services/SessionViewService.js.map +0 -1
- package/bin/session/storage/Persistence.d.ts +0 -73
- package/bin/session/storage/Persistence.d.ts.map +0 -1
- package/bin/session/storage/Persistence.js +0 -63
- package/bin/session/storage/Persistence.js.map +0 -1
- package/bin/types/agent/AgentRuntimeAssembly.d.ts +0 -72
- package/bin/types/agent/AgentRuntimeAssembly.d.ts.map +0 -1
- package/bin/types/agent/AgentRuntimeAssembly.js +0 -10
- package/bin/types/agent/AgentRuntimeAssembly.js.map +0 -1
- package/bin/types/runtime/agent/AgentContext.d.ts +0 -306
- package/bin/types/runtime/agent/AgentContext.d.ts.map +0 -1
- package/bin/types/runtime/agent/AgentContext.js +0 -128
- package/bin/types/runtime/agent/AgentContext.js.map +0 -1
- package/bin/types/session/SessionComposerOptions.d.ts +0 -90
- package/bin/types/session/SessionComposerOptions.d.ts.map +0 -1
- package/bin/types/session/SessionComposerOptions.js +0 -10
- package/bin/types/session/SessionComposerOptions.js.map +0 -1
- package/bin/types/session/SessionQueueCommand.d.ts +0 -68
- package/bin/types/session/SessionQueueCommand.d.ts.map +0 -1
- package/bin/types/session/SessionQueueCommand.js +0 -10
- package/bin/types/session/SessionQueueCommand.js.map +0 -1
- package/scripts/session-action-message.test.mjs +0 -410
- package/scripts/session-compaction-context-window.test.mjs +0 -96
- package/scripts/session-history-inflight.test.mjs +0 -146
- package/scripts/session-history-writer-error.test.mjs +0 -57
- package/scripts/session-prompt-runtime.test.mjs +0 -390
- package/src/agent/local/Agent.ts +0 -250
- package/src/agent/local/AgentPluginFactory.ts +0 -51
- package/src/agent/local/AgentRuntimeAssembly.ts +0 -65
- package/src/agent/local/services/AgentAssemblyService.ts +0 -307
- package/src/agent/local/services/AgentBackgroundService.ts +0 -115
- package/src/executor/SessionRunScope.ts +0 -122
- package/src/executor/composer/compaction/SessionCompactionComposer.ts +0 -84
- package/src/executor/composer/compaction/jsonl/JsonlSessionCompactionComposer.ts +0 -51
- package/src/executor/composer/compaction/jsonl/JsonlSessionCompactionExecutor.ts +0 -294
- package/src/executor/composer/compaction/jsonl/JsonlSessionCompactionFileOperations.ts +0 -197
- package/src/executor/composer/context/LocalSessionContextComposer.ts +0 -175
- package/src/executor/composer/context/SessionContextComposer.ts +0 -83
- package/src/executor/composer/history/SessionHistoryComposer.ts +0 -62
- package/src/executor/composer/history/SessionHistoryWriter.ts +0 -100
- package/src/executor/composer/history/jsonl/JsonlSessionHistoryComposer.ts +0 -133
- package/src/executor/messages/AssistantResultPersistence.ts +0 -106
- package/src/executor/services/ExecutorInflightService.ts +0 -95
- package/src/executor/store/history/SessionHistoryStore.ts +0 -172
- package/src/executor/store/history/jsonl/JsonlSessionHistoryStore.ts +0 -879
- package/src/executor/types/SessionHistoryPaths.ts +0 -38
- package/src/session/SessionSystemBuilder.ts +0 -262
- package/src/session/recorder/SessionRecorderHistoryStore.ts +0 -256
- package/src/session/runtime/SessionPromptRuntime.ts +0 -518
- package/src/session/services/SessionStateService.ts +0 -628
- package/src/session/services/SessionTurnService.ts +0 -368
- package/src/session/services/SessionViewService.ts +0 -335
- package/src/session/storage/Persistence.ts +0 -137
- package/src/types/agent/AgentRuntimeAssembly.ts +0 -74
- package/src/types/runtime/agent/AgentContext.ts +0 -387
- package/src/types/session/SessionComposerOptions.ts +0 -107
- package/src/types/session/SessionQueueCommand.ts +0 -78
- /package/bin/{agent/local → config}/ProjectSetup.d.ts +0 -0
- /package/bin/{agent/remote → remote}/RemoteTransport.js +0 -0
- /package/bin/session/{recorder → messages}/JsonlSessionMessageStore.d.ts +0 -0
- /package/bin/session/{recorder → messages}/JsonlSessionMessageStore.js +0 -0
- /package/src/{agent/local → config}/ProjectSetup.ts +0 -0
- /package/src/session/{recorder → messages}/JsonlSessionMessageStore.ts +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session tool 显式执行上下文。
|
|
3
|
+
*
|
|
4
|
+
* 关键点(中文)
|
|
5
|
+
* - 该对象由 Executor 在每个 Session step 绑定到 tool.execute。
|
|
6
|
+
* - Agent 工具读取 session_run_context,Shell 工具只读取 shell_run_context。
|
|
7
|
+
* - 上下文归属单次 run,不通过进程级或异步全局容器共享。
|
|
8
|
+
*/
|
|
9
|
+
import type { ShellToolRunContext } from "@downcity/shell/types/ShellRuntime.js";
|
|
10
|
+
import type { SessionRunContext } from "../../types/executor/SessionRunContext.js";
|
|
11
|
+
/**
|
|
12
|
+
* Agent 与 Shell 工具共用的单次执行上下文。
|
|
13
|
+
*/
|
|
14
|
+
export interface SessionToolExecutionContext {
|
|
15
|
+
/** 当前 Shell tool 调用的显式上下文。 */
|
|
16
|
+
shell_run_context: ShellToolRunContext;
|
|
17
|
+
/** 当前工具调用所属的完整 Session run 上下文。 */
|
|
18
|
+
session_run_context: SessionRunContext;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=SessionToolExecutionContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SessionToolExecutionContext.d.ts","sourceRoot":"","sources":["../../../src/types/executor/SessionToolExecutionContext.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAE/E;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,8BAA8B;IAC9B,iBAAiB,EAAE,mBAAmB,CAAC;IACvC,mCAAmC;IACnC,mBAAmB,EAAE,iBAAiB,CAAC;CACxC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session tool 显式执行上下文。
|
|
3
|
+
*
|
|
4
|
+
* 关键点(中文)
|
|
5
|
+
* - 该对象由 Executor 在每个 Session step 绑定到 tool.execute。
|
|
6
|
+
* - Agent 工具读取 session_run_context,Shell 工具只读取 shell_run_context。
|
|
7
|
+
* - 上下文归属单次 run,不通过进程级或异步全局容器共享。
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=SessionToolExecutionContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SessionToolExecutionContext.js","sourceRoot":"","sources":["../../../src/types/executor/SessionToolExecutionContext.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
import type { Command } from "commander";
|
|
9
9
|
import type { Context as HonoContext } from "hono";
|
|
10
10
|
import type { z } from "zod";
|
|
11
|
-
import type { AgentContext } from "../../
|
|
11
|
+
import type { AgentContext } from "../../agent/AgentContext.js";
|
|
12
|
+
import type { PluginRunContext } from "../../types/plugin/PluginRunContext.js";
|
|
12
13
|
import type { JsonObject, JsonValue } from "../../types/common/Json.js";
|
|
13
14
|
/**
|
|
14
15
|
* Plugin action 调用参数。
|
|
@@ -130,6 +131,14 @@ export interface PluginAction<P extends JsonValue = JsonValue, R extends JsonVal
|
|
|
130
131
|
execute: (params: {
|
|
131
132
|
/** 当前执行上下文。 */
|
|
132
133
|
context: AgentContext;
|
|
134
|
+
/**
|
|
135
|
+
* 当前 action 所属的 Session run 上下文。
|
|
136
|
+
*
|
|
137
|
+
* 关键点(中文)
|
|
138
|
+
* - 模型 tool 调用时必定提供。
|
|
139
|
+
* - CLI、HTTP 或定时任务等非 Session 入口可能不提供。
|
|
140
|
+
*/
|
|
141
|
+
run_context?: PluginRunContext;
|
|
133
142
|
/** 已通过 schema 校验后的输入。 */
|
|
134
143
|
input: P;
|
|
135
144
|
/** 当前插件名称。 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginAction.d.ts","sourceRoot":"","sources":["../../../src/types/plugin/PluginAction.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,MAAM,CAAC;AACnD,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"PluginAction.d.ts","sourceRoot":"","sources":["../../../src/types/plugin/PluginAction.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,MAAM,CAAC;AACnD,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEpE;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,oBAAoB;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,oBAAoB;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,sBAAsB;IACtB,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,cAAc;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,mBAAmB;IACnB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,gBAAgB;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,0BAA0B;IAC1B,MA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G,kBAAkB,CAAC,CAAC,CAAC,CAAC;CAC9D;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,CAAC,UAAU,EAAE,MAAM,GAAG,YAAY,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;CAC1D,CAAC"}
|
|
@@ -5,10 +5,8 @@
|
|
|
5
5
|
* - command 面向显式 CLI/control 调用。
|
|
6
6
|
* - lifecycle 面向 runtime 主动 start/stop 钩子。
|
|
7
7
|
*/
|
|
8
|
-
import type {
|
|
9
|
-
import type { AgentContext } from "../../types/runtime/agent/AgentContext.js";
|
|
8
|
+
import type { AgentContext } from "../../agent/AgentContext.js";
|
|
10
9
|
import type { Logger } from "../../utils/logger/Logger.js";
|
|
11
|
-
import type { DowncityConfig } from "../../types/config/DowncityConfig.js";
|
|
12
10
|
import type { JsonValue } from "../../types/common/Json.js";
|
|
13
11
|
/**
|
|
14
12
|
* Plugin 命令执行上下文。
|
|
@@ -19,14 +17,12 @@ import type { JsonValue } from "../../types/common/Json.js";
|
|
|
19
17
|
* - agent runtime 在需要复用 action 时,直接传入自身更完整的 AgentContext 即可。
|
|
20
18
|
*/
|
|
21
19
|
export interface PluginCommandContext {
|
|
22
|
-
/**
|
|
23
|
-
|
|
20
|
+
/** 当前 Agent 稳定标识。 */
|
|
21
|
+
agent_id: string;
|
|
24
22
|
/** 当前项目根目录。 */
|
|
25
23
|
rootPath: string;
|
|
26
24
|
/** 当前统一日志器。 */
|
|
27
25
|
logger: Logger;
|
|
28
|
-
/** 当前解析后的项目配置。 */
|
|
29
|
-
config: DowncityConfig;
|
|
30
26
|
/**
|
|
31
27
|
* 当前项目环境变量快照。
|
|
32
28
|
*
|
|
@@ -35,10 +31,6 @@ export interface PluginCommandContext {
|
|
|
35
31
|
* - plugin 不再区分 global env 与 agent env,避免上下文语义膨胀。
|
|
36
32
|
*/
|
|
37
33
|
env: Record<string, string>;
|
|
38
|
-
/** 当前可见的路径能力集合。 */
|
|
39
|
-
paths: AgentPathRuntime;
|
|
40
|
-
/** 当前可见的 plugin 配置持久化能力集合。 */
|
|
41
|
-
pluginConfig: AgentPluginConfigRuntime;
|
|
42
34
|
}
|
|
43
35
|
/**
|
|
44
36
|
* Plugin 非 action 命令执行参数。
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginCommand.d.ts","sourceRoot":"","sources":["../../../src/types/plugin/PluginCommand.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"PluginCommand.d.ts","sourceRoot":"","sources":["../../../src/types/plugin/PluginCommand.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB;IACnC,qBAAqB;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe;IACf,MAAM,EAAE,MAAM,CAAC;IACf;;;;;;OAMG;IACH,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,iBAAiB;IACjB,OAAO,EAAE,YAAY,CAAC;IACtB,cAAc;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,wBAAwB;IACxB,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,gBAAgB;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe;IACf,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,mBAAmB;IACnB,KAAK,CAAC,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACpD,mBAAmB;IACnB,IAAI,CAAC,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACnD,4BAA4B;IAC5B,OAAO,CAAC,CACN,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,mBAAmB,CAAC,GAAG,mBAAmB,CAAC;CACvD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin 配置协议类型。
|
|
3
|
+
*/
|
|
4
|
+
import type { JsonValue } from "../../types/common/Json.js";
|
|
5
|
+
/**
|
|
6
|
+
* 允许 optional 字段的结构化 Plugin 配置对象。
|
|
7
|
+
*/
|
|
8
|
+
export type StructuredConfig = {
|
|
9
|
+
/** 当前配置字段;省略或 `undefined` 表示未配置。 */
|
|
10
|
+
[key: string]: JsonValue | undefined;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=PluginConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PluginConfig.d.ts","sourceRoot":"","sources":["../../../src/types/plugin/PluginConfig.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,oCAAoC;IACpC,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;CACtC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PluginConfig.js","sourceRoot":"","sources":["../../../src/types/plugin/PluginConfig.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -5,12 +5,14 @@
|
|
|
5
5
|
* - 这里只组合 plugin 的各类能力,不展开每个能力的细节。
|
|
6
6
|
* - 细节类型分散在 State / Command / Action / Runtime / Setup / HTTP 模块。
|
|
7
7
|
*/
|
|
8
|
-
import type { AgentContext
|
|
8
|
+
import type { AgentContext } from "../../agent/AgentContext.js";
|
|
9
|
+
import type { StructuredConfig } from "../../types/plugin/PluginConfig.js";
|
|
9
10
|
import type { PluginActions } from "../../types/plugin/PluginAction.js";
|
|
10
11
|
import type { PluginAvailability, PluginConfigDefinition, PluginHooks, PluginResolves } from "../../types/plugin/PluginRuntime.js";
|
|
11
12
|
import type { PluginCommandContext, PluginLifecycle } from "../../types/plugin/PluginCommand.js";
|
|
12
13
|
import type { PluginSetupDefinition, PluginUsageDefinition } from "../../types/plugin/PluginSetup.js";
|
|
13
14
|
import type { PluginHttpDefinition } from "../../types/plugin/PluginHttp.js";
|
|
15
|
+
import type { PluginRunContext } from "../../types/plugin/PluginRunContext.js";
|
|
14
16
|
/**
|
|
15
17
|
* Plugin 定义。
|
|
16
18
|
*/
|
|
@@ -45,8 +47,13 @@ export interface Plugin {
|
|
|
45
47
|
hooks?: PluginHooks;
|
|
46
48
|
/** Plugin resolve 点集合(可选)。 */
|
|
47
49
|
resolves?: PluginResolves;
|
|
48
|
-
/**
|
|
49
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Plugin system 文本构建器(可选)。
|
|
52
|
+
*
|
|
53
|
+
* @param context Agent 稳定能力上下文。
|
|
54
|
+
* @param run_context 当前 Session run 上下文;非 Session 快照读取时可缺省。
|
|
55
|
+
*/
|
|
56
|
+
system?: (context: AgentContext, run_context?: PluginRunContext) => string | Promise<string>;
|
|
50
57
|
/** Plugin 生命周期定义(可选)。 */
|
|
51
58
|
lifecycle?: PluginLifecycle;
|
|
52
59
|
/** Plugin 可用性检查器(可选)。 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginDefinition.d.ts","sourceRoot":"","sources":["../../../src/types/plugin/PluginDefinition.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"PluginDefinition.d.ts","sourceRoot":"","sources":["../../../src/types/plugin/PluginDefinition.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,KAAK,EACV,kBAAkB,EAClB,sBAAsB,EACtB,WAAW,EACX,cAAc,EACf,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EACV,oBAAoB,EACpB,eAAe,EAChB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EACV,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAE3E;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,wBAAwB;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,uBAAuB;IACvB,MAAM,CAAC,EAAE,sBAAsB,CAAC,gBAAgB,CAAC,CAAC;IAClD,+BAA+B;IAC/B,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,qBAAqB,CAAC;IAC9B;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,qBAAqB,CAAC;IAC9B,0BAA0B;IAC1B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,8BAA8B;IAC9B,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,CACP,OAAO,EAAE,YAAY,EACrB,WAAW,CAAC,EAAE,gBAAgB,KAC3B,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9B,yBAAyB;IACzB,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,yBAAyB;IACzB,YAAY,CAAC,EAAE,CACb,OAAO,EAAE,oBAAoB,GAAG,YAAY,KACzC,OAAO,CAAC,kBAAkB,CAAC,GAAG,kBAAkB,CAAC;IACtD,4BAA4B;IAC5B,IAAI,CAAC,EAAE,oBAAoB,CAAC;CAC7B"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* - server 装配、代理和鉴权执行仍由宿主负责。
|
|
7
7
|
*/
|
|
8
8
|
import type { Hono } from "hono";
|
|
9
|
-
import type { AgentContext } from "../../
|
|
9
|
+
import type { AgentContext } from "../../agent/AgentContext.js";
|
|
10
10
|
import type { AuthRoutePolicy } from "../../types/runtime/auth/AuthRoute.js";
|
|
11
11
|
/**
|
|
12
12
|
* Plugin HTTP 注入参数。
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginHttp.d.ts","sourceRoot":"","sources":["../../../src/types/plugin/PluginHttp.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"PluginHttp.d.ts","sourceRoot":"","sources":["../../../src/types/plugin/PluginHttp.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,qBAAqB;IACrB,YAAY,CAAC,EAAE,eAAe,EAAE,CAAC;IACjC,6BAA6B;IAC7B,QAAQ,CAAC,MAAM,EAAE;QACf,oBAAoB;QACpB,GAAG,EAAE,IAAI,CAAC;QACV,mBAAmB;QACnB,UAAU,EAAE,MAAM,YAAY,CAAC;QAC/B,sBAAsB;QACtB,UAAU,EAAE,MAAM,CAAC;KACpB,GAAG,IAAI,CAAC;CACV;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,4BAA4B;IAC5B,MAAM,CAAC,EAAE,sBAAsB,CAAC;CACjC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin 单次调用的运行上下文。
|
|
3
|
+
*
|
|
4
|
+
* 关键点(中文)
|
|
5
|
+
* - 只暴露 plugin 业务需要的只读 Session 快照。
|
|
6
|
+
* - 不暴露 Executor 内部队列、callback 或 plugin lease。
|
|
7
|
+
* - CLI、HTTP 与 scheduler 等非 Session 调用可能不提供该对象。
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Plugin action 与 system provider 可读取的 Session 运行快照。
|
|
11
|
+
*/
|
|
12
|
+
export interface PluginRunContext {
|
|
13
|
+
/** 当前调用所属的 Session 标识。 */
|
|
14
|
+
readonly sessionId: string;
|
|
15
|
+
/** 当前调用所属的 turn 标识。 */
|
|
16
|
+
readonly turnId?: string;
|
|
17
|
+
/** 当前 Agent 绑定的项目根目录。 */
|
|
18
|
+
readonly projectRoot?: string;
|
|
19
|
+
/** 当前 Session step 已提交生效的 Agent env 快照。 */
|
|
20
|
+
readonly agentEnv?: Readonly<Record<string, string>>;
|
|
21
|
+
/** 当前 Session step 已提交生效的 instruction 快照。 */
|
|
22
|
+
readonly agentSystems?: readonly string[];
|
|
23
|
+
/** 当前 turn 的取消信号。 */
|
|
24
|
+
readonly abortSignal?: AbortSignal;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=PluginRunContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PluginRunContext.d.ts","sourceRoot":"","sources":["../../../src/types/plugin/PluginRunContext.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,0BAA0B;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B,uBAAuB;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAEzB,yBAAyB;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAE9B,2CAA2C;IAC3C,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAErD,6CAA6C;IAC7C,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAE1C,qBAAqB;IACrB,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;CACpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PluginRunContext.js","sourceRoot":"","sources":["../../../src/types/plugin/PluginRunContext.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
|
@@ -5,13 +5,15 @@
|
|
|
5
5
|
* - 这里描述 Agent runtime 如何查看、调用、检查 plugin。
|
|
6
6
|
* - setup/usage UI 协议与 action 输入适配不放在这里。
|
|
7
7
|
*/
|
|
8
|
-
import type { AgentContext
|
|
8
|
+
import type { AgentContext } from "../../agent/AgentContext.js";
|
|
9
|
+
import type { StructuredConfig } from "../../types/plugin/PluginConfig.js";
|
|
9
10
|
import type { JsonValue } from "../../types/common/Json.js";
|
|
10
11
|
import type { PluginActionResult } from "../../types/plugin/PluginAction.js";
|
|
11
12
|
import type { PluginActionExample } from "../../types/plugin/PluginAction.js";
|
|
12
13
|
import type { Plugin } from "../../types/plugin/PluginDefinition.js";
|
|
13
14
|
import type { AgentSessionSystemBlock } from "../../types/agent/SessionTypes.js";
|
|
14
15
|
import type { PluginSnapshot } from "../../types/plugin/PluginState.js";
|
|
16
|
+
import type { SessionRunContext } from "../../types/executor/SessionRunContext.js";
|
|
15
17
|
/**
|
|
16
18
|
* Plugin 概览视图。
|
|
17
19
|
*/
|
|
@@ -127,9 +129,11 @@ export interface AgentPlugins {
|
|
|
127
129
|
action: string;
|
|
128
130
|
/** Action Payload(可选)。 */
|
|
129
131
|
payload?: JsonValue;
|
|
132
|
+
/** 当前 action 所属的显式 Session run 上下文。 */
|
|
133
|
+
run_context?: SessionRunContext;
|
|
130
134
|
}): Promise<PluginActionResult<JsonValue>>;
|
|
131
135
|
/** 读取当前生效的 plugin system blocks。 */
|
|
132
|
-
systemBlocks(): Promise<AgentSessionSystemBlock[]>;
|
|
136
|
+
systemBlocks(run_context?: SessionRunContext): Promise<AgentSessionSystemBlock[]>;
|
|
133
137
|
/** 运行 pipeline 点,按顺序链式变换值。 */
|
|
134
138
|
pipeline<T = JsonValue>(pointName: string, value: T): Promise<T>;
|
|
135
139
|
/** 运行 guard 点;任一插件抛错即终止。 */
|
|
@@ -160,9 +164,11 @@ export interface AgentPluginExecutionView {
|
|
|
160
164
|
action: string;
|
|
161
165
|
/** Action Payload(可选)。 */
|
|
162
166
|
payload?: JsonValue;
|
|
167
|
+
/** 当前 action 所属的显式 Session run 上下文。 */
|
|
168
|
+
run_context?: SessionRunContext;
|
|
163
169
|
}): Promise<PluginActionResult<JsonValue>>;
|
|
164
170
|
/** 解析当前视图中捕获的 plugin system blocks。 */
|
|
165
|
-
systemBlocks(): Promise<AgentSessionSystemBlock[]>;
|
|
171
|
+
systemBlocks(run_context?: SessionRunContext): Promise<AgentSessionSystemBlock[]>;
|
|
166
172
|
}
|
|
167
173
|
/**
|
|
168
174
|
* 单次 Session step 持有的 Plugin 执行 lease。
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginRuntime.d.ts","sourceRoot":"","sources":["../../../src/types/plugin/PluginRuntime.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,
|
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GAAG,OAAO,CAAC;AAEjC;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,oBAAoB;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAC3D,iBAAiB;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IACrD,kBAAkB;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;CACxD;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,CAAC,SAAS,EAAE,MAAM,GAAG,iBAAiB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;CAC9D,CAAC"}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import type { Tool } from "ai";
|
|
9
9
|
import type { AgentPlugins } from "../../types/plugin/PluginRuntime.js";
|
|
10
10
|
import type { PluginCallInput, PluginReadInput } from "../../executor/tools/plugin/types/PluginTool.js";
|
|
11
|
+
import type { SessionRunContext } from "../../types/executor/SessionRunContext.js";
|
|
11
12
|
/**
|
|
12
13
|
* 创建 plugin tools 的参数。
|
|
13
14
|
*/
|
|
@@ -54,6 +55,14 @@ export interface InvokePluginCallToolOptions {
|
|
|
54
55
|
* - 不能在 bridge 内通过全局变量读取。
|
|
55
56
|
*/
|
|
56
57
|
plugins: AgentPlugins;
|
|
58
|
+
/**
|
|
59
|
+
* 当前 tool 调用所属的 Session run 上下文。
|
|
60
|
+
*
|
|
61
|
+
* 关键点(中文)
|
|
62
|
+
* - 由 Executor 在每个 step 显式绑定。
|
|
63
|
+
* - 用于选择当前 plugin lease、资源目录与 assistant file 队列。
|
|
64
|
+
*/
|
|
65
|
+
run_context: SessionRunContext;
|
|
57
66
|
/**
|
|
58
67
|
* 模型提交给 plugin_call 的结构化输入。
|
|
59
68
|
*/
|
|
@@ -67,6 +76,8 @@ export interface InvokePluginReadToolOptions {
|
|
|
67
76
|
* 当前 Agent 自己的 plugin 调用面。
|
|
68
77
|
*/
|
|
69
78
|
plugins: AgentPlugins;
|
|
79
|
+
/** 当前 tool 调用所属的 Session run 上下文。 */
|
|
80
|
+
run_context: SessionRunContext;
|
|
70
81
|
/**
|
|
71
82
|
* 模型提交给 plugin_read 的结构化输入。
|
|
72
83
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginToolRuntime.d.ts","sourceRoot":"","sources":["../../../src/types/plugin/PluginToolRuntime.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EAChB,MAAM,6CAA6C,CAAC;
|
|
1
|
+
{"version":3,"file":"PluginToolRuntime.d.ts","sourceRoot":"","sources":["../../../src/types/plugin/PluginToolRuntime.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EAChB,MAAM,6CAA6C,CAAC;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAE/E;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;;;;OAMG;IACH,OAAO,EAAE,YAAY,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;;OAMG;IACH,WAAW,EAAE,IAAI,CAAC;IAElB;;;;;;OAMG;IACH,WAAW,EAAE,IAAI,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;;;;OAMG;IACH,OAAO,EAAE,YAAY,CAAC;IAEtB;;;;;;OAMG;IACH,WAAW,EAAE,iBAAiB,CAAC;IAE/B;;OAEG;IACH,KAAK,EAAE,eAAe,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,OAAO,EAAE,YAAY,CAAC;IAEtB,qCAAqC;IACrC,WAAW,EAAE,iBAAiB,CAAC;IAE/B;;OAEG;IACH,KAAK,EAAE,eAAe,CAAC;CACxB"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* - Client 与 Server 共享同一份 request/frame 类型,避免协议两边漂移。
|
|
7
7
|
* - 字段名保持现有协议格式,兼容已发布的 downcity 托管 runtime 调用。
|
|
8
8
|
*/
|
|
9
|
-
import type { AgentCreateSessionInput, AgentListSessionsInput, AgentArchiveSessionsInput, AgentSessionSystemSnapshot
|
|
9
|
+
import type { AgentCreateSessionInput, AgentListSessionsInput, AgentArchiveSessionsInput, AgentSessionSystemSnapshot } from "../../types/agent/SessionTypes.js";
|
|
10
10
|
import type { SessionMutation } from "../../types/session/SessionMutation.js";
|
|
11
11
|
import type { ResolveSessionApprovalInput, SetSessionApprovalModeInput } from "../../types/session/SessionApproval.js";
|
|
12
12
|
import type { AgentSessionPromptInput } from "../../types/sdk/AgentSessionPrompt.js";
|
|
@@ -44,18 +44,6 @@ export type RpcRequest = {
|
|
|
44
44
|
/** 目标 session id。 */
|
|
45
45
|
sessionId: string;
|
|
46
46
|
};
|
|
47
|
-
} | {
|
|
48
|
-
/** 请求 id,用于匹配响应。 */
|
|
49
|
-
id: string;
|
|
50
|
-
/** 更新 session 模型。 */
|
|
51
|
-
method: "sdk.sessions.set";
|
|
52
|
-
/** Session 配置更新参数。 */
|
|
53
|
-
params: {
|
|
54
|
-
/** 目标 session id。 */
|
|
55
|
-
sessionId: string;
|
|
56
|
-
/** 仅包含稳定 modelId 的配置输入。 */
|
|
57
|
-
input: AgentSessionSetInput;
|
|
58
|
-
};
|
|
59
47
|
} | {
|
|
60
48
|
/** 请求 id,用于匹配响应。 */
|
|
61
49
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RpcProtocol.d.ts","sourceRoot":"","sources":["../../../src/types/rpc/RpcProtocol.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,uBAAuB,EACvB,sBAAsB,EAEtB,yBAAyB,EAIzB,0BAA0B,
|
|
1
|
+
{"version":3,"file":"RpcProtocol.d.ts","sourceRoot":"","sources":["../../../src/types/rpc/RpcProtocol.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,uBAAuB,EACvB,sBAAsB,EAEtB,yBAAyB,EAIzB,0BAA0B,EAC3B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EACV,2BAA2B,EAC3B,2BAA2B,EAC5B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAEjF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAClF,OAAO,KAAK,EAAc,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEzE;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAClB;IACE,oBAAoB;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,mBAAmB;IACnB,MAAM,EAAE,mBAAmB,CAAC;IAC5B,iBAAiB;IACjB,MAAM,CAAC,EAAE,sBAAsB,CAAC;CACjC,GACD;IACE,oBAAoB;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,kBAAkB;IAClB,MAAM,EAAE,qBAAqB,CAAC;IAC9B,YAAY;IACZ,MAAM,CAAC,EAAE,uBAAuB,CAAC;CAClC,GACD;IACE,oBAAo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BAAsB;IACrC,eAAe;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY;IACZ,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,YAAY;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,gBAAgB;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc;IACd,KAAK,EAAE,MAAM,CAAC;IACd,eAAe;IACf,KAAK,EAAE,0BAA0B,EAAE,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,cAAc;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,qBAAqB;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,yBAAyB;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,2BAA2B;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,yBAAyB;IACzB,QAAQ,EAAE,sBAAsB,EAAE,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,uBAAuB;IACvB,MAAM,EAAE,0BAA0B,CAAC;CACpC"}
|
|
@@ -14,9 +14,9 @@ export interface SessionApproval {
|
|
|
14
14
|
/** 当前审批所属 Session 标识。 */
|
|
15
15
|
session_id: string;
|
|
16
16
|
/** 当前审批所属 Turn 标识。 */
|
|
17
|
-
turn_id
|
|
17
|
+
turn_id: string;
|
|
18
18
|
/** 当前审批对应的工具调用标识。 */
|
|
19
|
-
tool_call_id
|
|
19
|
+
tool_call_id: string;
|
|
20
20
|
/** 当前审批对应的工具注册名称。 */
|
|
21
21
|
tool_name: string;
|
|
22
22
|
/** 请求执行的命令或输入文本。 */
|
|
@@ -29,6 +29,8 @@ export interface SessionApproval {
|
|
|
29
29
|
operation: "exec" | "start" | "write";
|
|
30
30
|
/** 当前审批创建时间戳(ms)。 */
|
|
31
31
|
created_at: number;
|
|
32
|
+
/** 当前审批自动过期时间戳(ms)。 */
|
|
33
|
+
expires_at: number;
|
|
32
34
|
}
|
|
33
35
|
/** 提交 Session 工具审批决策的参数。 */
|
|
34
36
|
export interface ResolveSessionApprovalInput {
|
|
@@ -58,40 +60,4 @@ export interface SetSessionApprovalModeInput {
|
|
|
58
60
|
/** 需要设置的新审批模式。 */
|
|
59
61
|
mode: SessionApprovalMode;
|
|
60
62
|
}
|
|
61
|
-
/** Shell Runtime 发给 Session 的工具审批请求。 */
|
|
62
|
-
export interface SessionToolApprovalRequest {
|
|
63
|
-
/** Runtime 事件类型固定为工具审批请求。 */
|
|
64
|
-
type: "tool-approval-request";
|
|
65
|
-
/** 当前审批所属 Turn 标识。 */
|
|
66
|
-
turn_id: string;
|
|
67
|
-
/** 当前审批对应的工具调用标识。 */
|
|
68
|
-
tool_call_id: string;
|
|
69
|
-
/** 当前审批对应的工具注册名称。 */
|
|
70
|
-
tool_name: string;
|
|
71
|
-
/** 当前审批请求的稳定唯一标识。 */
|
|
72
|
-
approval_id: string;
|
|
73
|
-
/** 请求执行的命令或输入文本。 */
|
|
74
|
-
command: string;
|
|
75
|
-
/** 当前工具执行工作目录。 */
|
|
76
|
-
cwd: string;
|
|
77
|
-
/** 工具申请 unrestricted 权限的原因。 */
|
|
78
|
-
reason: string;
|
|
79
|
-
/** 当前审批对应的工具操作类型。 */
|
|
80
|
-
operation: "exec" | "start" | "write";
|
|
81
|
-
}
|
|
82
|
-
/** Shell Runtime 发给 Session 的工具审批结果。 */
|
|
83
|
-
export interface SessionToolApprovalResult {
|
|
84
|
-
/** Runtime 事件类型固定为工具审批结果。 */
|
|
85
|
-
type: "tool-approval-result";
|
|
86
|
-
/** 当前审批所属 Turn 标识。 */
|
|
87
|
-
turn_id: string;
|
|
88
|
-
/** 当前审批对应的工具调用标识。 */
|
|
89
|
-
tool_call_id: string;
|
|
90
|
-
/** 当前审批请求的稳定唯一标识。 */
|
|
91
|
-
approval_id: string;
|
|
92
|
-
/** 当前审批的最终结果,超时由 Runtime 标记为 expired。 */
|
|
93
|
-
decision: SessionApprovalDecision | "expired";
|
|
94
|
-
}
|
|
95
|
-
/** Session 内部接收的工具审批 Runtime 事件。 */
|
|
96
|
-
export type SessionApprovalRuntimeEvent = SessionToolApprovalRequest | SessionToolApprovalResult;
|
|
97
63
|
//# sourceMappingURL=SessionApproval.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionApproval.d.ts","sourceRoot":"","sources":["../../../src/types/session/SessionApproval.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,2BAA2B;AAC3B,MAAM,MAAM,uBAAuB,GAAG,UAAU,GAAG,QAAQ,CAAC;AAE5D,sBAAsB;AACtB,MAAM,MAAM,mBAAmB,GAAG,KAAK,GAAG,cAAc,CAAC;AAEzD,2BAA2B;AAC3B,MAAM,WAAW,eAAe;IAC9B,qBAAqB;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,yBAAyB;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,sBAAsB;IACtB,OAAO,
|
|
1
|
+
{"version":3,"file":"SessionApproval.d.ts","sourceRoot":"","sources":["../../../src/types/session/SessionApproval.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,2BAA2B;AAC3B,MAAM,MAAM,uBAAuB,GAAG,UAAU,GAAG,QAAQ,CAAC;AAE5D,sBAAsB;AACtB,MAAM,MAAM,mBAAmB,GAAG,KAAK,GAAG,cAAc,CAAC;AAEzD,2BAA2B;AAC3B,MAAM,WAAW,eAAe;IAC9B,qBAAqB;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,yBAAyB;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,sBAAsB;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,qBAAqB;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,qBAAqB;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,oBAAoB;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,+BAA+B;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,qBAAqB;IACrB,SAAS,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;IACtC,qBAAqB;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,uBAAuB;IACvB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,4BAA4B;AAC5B,MAAM,WAAW,2BAA2B;IAC1C,mBAAmB;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,sBAAsB;IACtB,QAAQ,EAAE,uBAAuB,CAAC;CACnC;AAED,wBAAwB;AACxB,MAAM,WAAW,qBAAqB;IACpC,4BAA4B;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,oBAAoB;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB;IAClB,QAAQ,EAAE,uBAAuB,CAAC;CACnC;AAED,0BAA0B;AAC1B,MAAM,WAAW,2BAA2B;IAC1C,2BAA2B;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,0BAA0B;IAC1B,IAAI,EAAE,mBAAmB,CAAC;CAC3B;AAED,4BAA4B;AAC5B,MAAM,WAAW,2BAA2B;IAC1C,kBAAkB;IAClB,IAAI,EAAE,mBAAmB,CAAC;CAC3B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session Approval Broker 内部类型。
|
|
3
|
+
*
|
|
4
|
+
* Broker 是单个 Session 内 pending approval 与审批模式的唯一所有者。
|
|
5
|
+
*/
|
|
6
|
+
import type { SessionApproval } from "../../types/session/SessionApproval.js";
|
|
7
|
+
import type { ShellApprovalStatus } from "@downcity/shell";
|
|
8
|
+
/** Broker 内部保存的单个 pending approval。 */
|
|
9
|
+
export interface SessionPendingApproval {
|
|
10
|
+
/** 对外发布的完整审批快照。 */
|
|
11
|
+
approval: SessionApproval;
|
|
12
|
+
/** 兑现 Shell 等待 Promise 的回调。 */
|
|
13
|
+
resolve: (decision: ShellApprovalStatus) => void;
|
|
14
|
+
/** 审批自动过期定时器。 */
|
|
15
|
+
timer: ReturnType<typeof setTimeout>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=SessionApprovalBroker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SessionApprovalBroker.d.ts","sourceRoot":"","sources":["../../../src/types/session/SessionApprovalBroker.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE3D,uCAAuC;AACvC,MAAM,WAAW,sBAAsB;IACrC,mBAAmB;IACnB,QAAQ,EAAE,eAAe,CAAC;IAC1B,+BAA+B;IAC/B,OAAO,EAAE,CAAC,QAAQ,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACjD,iBAAiB;IACjB,KAAK,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;CACtC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SessionApprovalBroker.js","sourceRoot":"","sources":["../../../src/types/session/SessionApprovalBroker.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|