@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,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* read 图片结果与模型 UserMessage 的桥接。
|
|
3
|
+
*
|
|
4
|
+
* 关键点(中文)
|
|
5
|
+
* - Shell read 只负责把图片读取为 data URL。
|
|
6
|
+
* - Agent 在当前 turn 的下一 step 注入临时 user file part,不写入长期历史。
|
|
7
|
+
* - 注入后从普通 tool result 移除 data URL,避免图片同时作为 JSON 内容传给模型。
|
|
8
|
+
*/
|
|
9
|
+
import path from "node:path";
|
|
10
|
+
import { generateId } from "../../../utils/Id.js";
|
|
11
|
+
/** 把普通对象归一为可检查的记录。 */
|
|
12
|
+
function to_record(value) {
|
|
13
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
14
|
+
return null;
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 在 read 返回图片时注入下一 step,并返回不含 data URL 的 tool result。
|
|
19
|
+
*/
|
|
20
|
+
export function inject_read_image_user_message(params) {
|
|
21
|
+
if (params.tool_name !== "read")
|
|
22
|
+
return params.output;
|
|
23
|
+
const output = to_record(params.output);
|
|
24
|
+
if (!output || output.success !== true || output.type !== "image") {
|
|
25
|
+
return params.output;
|
|
26
|
+
}
|
|
27
|
+
const data_url = String(output.data_url || "").trim();
|
|
28
|
+
const media_type = String(output.mime_type || "").trim();
|
|
29
|
+
const file_path = String(output.file_path || "").trim();
|
|
30
|
+
if (!data_url.startsWith("data:image/") || !media_type.startsWith("image/")) {
|
|
31
|
+
return params.output;
|
|
32
|
+
}
|
|
33
|
+
params.run_context.injectedUserMessages.push({
|
|
34
|
+
id: `read-image:${generateId()}`,
|
|
35
|
+
role: "user",
|
|
36
|
+
metadata: {
|
|
37
|
+
v: 1,
|
|
38
|
+
ts: Date.now(),
|
|
39
|
+
sessionId: params.run_context.sessionId,
|
|
40
|
+
...(params.run_context.turnId
|
|
41
|
+
? { turnId: params.run_context.turnId }
|
|
42
|
+
: {}),
|
|
43
|
+
source: "ingress",
|
|
44
|
+
kind: "normal",
|
|
45
|
+
extra: {
|
|
46
|
+
internal: "read_image",
|
|
47
|
+
file_path,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
parts: [
|
|
51
|
+
{
|
|
52
|
+
type: "text",
|
|
53
|
+
text: `Image read from ${file_path || "project file"}.`,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
type: "file",
|
|
57
|
+
mediaType: media_type,
|
|
58
|
+
url: data_url,
|
|
59
|
+
...(file_path ? { filename: path.basename(file_path) } : {}),
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
});
|
|
63
|
+
const { data_url: _data_url, ...result } = output;
|
|
64
|
+
return {
|
|
65
|
+
...result,
|
|
66
|
+
image_attached: true,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=ReadImageToolBridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReadImageToolBridge.js","sourceRoot":"","sources":["../../../../src/executor/tools/file/ReadImageToolBridge.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,sBAAsB;AACtB,SAAS,SAAS,CAAC,KAAc;IAC/B,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7E,OAAO,KAAgC,CAAC;AAC1C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,8BAA8B,CAAC,MAO9C;IACC,IAAI,MAAM,CAAC,SAAS,KAAK,MAAM;QAAE,OAAO,MAAM,CAAC,MAAM,CAAC;IACtD,MAAM,MAAM,GAAG,SAAS,CAAC,M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mB,SAAS,IAAI,cAAc,GAAG;aACxD;YACD;gBACE,IAAI,EAAE,MAAM;gBACZ,SAAS,EAAE,UAAU;gBACrB,GAAG,EAAE,QAAQ;gBACb,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC7D;SACF;KACF,CAAC,CAAC;IAEH,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC;IAClD,OAAO;QACL,GAAG,MAAM;QACT,cAAc,EAAE,IAAI;KACrB,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginToolBridge.d.ts","sourceRoot":"","sources":["../../../../src/executor/tools/plugin/PluginToolBridge.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,KAAK,EAGV,oBAAoB,EAEpB,oBAAoB,EACrB,MAAM,6CAA6C,CAAC;AACrD,OAAO,KAAK,EACV,2BAA2B,EAC3B,2BAA2B,EAC5B,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"PluginToolBridge.d.ts","sourceRoot":"","sources":["../../../../src/executor/tools/plugin/PluginToolBridge.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,KAAK,EAGV,oBAAoB,EAEpB,oBAAoB,EACrB,MAAM,6CAA6C,CAAC;AACrD,OAAO,KAAK,EACV,2BAA2B,EAC3B,2BAA2B,EAC5B,MAAM,qCAAqC,CAAC;AAkF7C;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,2BAA2B,GAClC,OAAO,CAAC,oBAAoB,CAAC,CAyE/B;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,2BAA2B,GAClC,OAAO,CAAC,oBAAoB,CAAC,CAsB/B"}
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import path from "node:path";
|
|
10
10
|
import { materializeAssistantFileParts, resolveAgentFilePath, } from "../../messages/AssistantFileResource.js";
|
|
11
|
-
import { enqueueAssistantFileParts, getSessionRunContext, } from "../../SessionRunScope.js";
|
|
12
11
|
/**
|
|
13
12
|
* 判断值是否为普通对象。
|
|
14
13
|
*/
|
|
@@ -106,13 +105,15 @@ export async function invokePluginCallTool(params) {
|
|
|
106
105
|
};
|
|
107
106
|
}
|
|
108
107
|
try {
|
|
109
|
-
const
|
|
108
|
+
const run_context = params.run_context;
|
|
109
|
+
const plugins = run_context.agentPlugins || params.plugins;
|
|
110
110
|
const result = await plugins.runAction({
|
|
111
111
|
plugin,
|
|
112
112
|
action,
|
|
113
113
|
payload,
|
|
114
|
+
run_context,
|
|
114
115
|
});
|
|
115
|
-
const project_root = resolve_project_root(
|
|
116
|
+
const project_root = resolve_project_root(run_context.projectRoot);
|
|
116
117
|
const raw_file_parts = result.success
|
|
117
118
|
? extract_assistant_file_parts(result.data)
|
|
118
119
|
: [];
|
|
@@ -124,7 +125,7 @@ export async function invokePluginCallTool(params) {
|
|
|
124
125
|
: [];
|
|
125
126
|
const files = summarize_materialized_files(file_parts, project_root);
|
|
126
127
|
if (file_parts.length > 0) {
|
|
127
|
-
|
|
128
|
+
run_context.pendingAssistantFileParts.push(...file_parts);
|
|
128
129
|
}
|
|
129
130
|
const data = summarize_action_data(result.data);
|
|
130
131
|
return {
|
|
@@ -156,7 +157,7 @@ export async function invokePluginCallTool(params) {
|
|
|
156
157
|
export async function invokePluginReadTool(params) {
|
|
157
158
|
const input = params.input;
|
|
158
159
|
try {
|
|
159
|
-
const plugins =
|
|
160
|
+
const plugins = params.run_context.agentPlugins || params.plugins;
|
|
160
161
|
const data = plugins.read({
|
|
161
162
|
plugin: typeof input.plugin === "string" ? input.plugin : undefined,
|
|
162
163
|
action: typeof input.action === "string" ? input.action : undefined,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginToolBridge.js","sourceRoot":"","sources":["../../../../src/executor/tools/plugin/PluginToolBridge.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAc7B,OAAO,EACL,6BAA6B,EAC7B,oBAAoB,GACrB,MAAM,6CAA6C,CAAC;
|
|
1
|
+
{"version":3,"file":"PluginToolBridge.js","sourceRoot":"","sources":["../../../../src/executor/tools/plugin/PluginToolBridge.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAc7B,OAAO,EACL,6BAA6B,EAC7B,oBAAoB,GACrB,MAAM,6CAA6C,CAAC;AAErD;;GAEG;AACH,SAAS,cAAc,CAAC,KAAc;IACpC,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7E,OAAO,KAAmB,CAAC;AAC7B,CAAC;AAED;;GAEG;AACH,SAAS,YAAY,CAAC,KAAc;IAClC,MAAM,MAAM,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IACrC,IAAI,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAC1B,OAAO,CACL,MAAM,CAAC,IAAI,KAAK,MAAM;QACtB,OAAO,MAAM,CAAC,SAAS,KAAK,QAAQ;QACpC,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ,CAC/B,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,4BAA4B,CAAC,IAA2B;IAC/D,MAAM,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IACrC,MAAM,KAAK,GAAc,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5E,OAAO,KAAK,CAAC,MAAM,CAAC,YAAY,CAA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AM;YACN,MAAM;YACN,oBAAoB,EAAE,CAAC;YACvB,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC;YACtB,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC;SACrB,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,MAAmC;IAEnC,MAAM,KAAK,GAAoB,MAAM,CAAC,KAAK,CAAC;IAC5C,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,CAAC,YAAY,IAAI,MAAM,CAAC,OAAO,CAAC;QAClE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;YACxB,MAAM,EAAE,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;YACnE,MAAM,EAAE,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;SACpE,CAAC,CAAC;QACH,OAAO;YACL,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,sBAAsB;YAC/B,IAAI,EAAE,IAA6B;SACpC,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC;YACtB,IAAI,EAAE;gBACJ,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC;aACrB;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginToolDefinition.d.ts","sourceRoot":"","sources":["../../../../src/executor/tools/plugin/PluginToolDefinition.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH,OAAO,KAAK,EACV,gBAAgB,EAChB,wBAAwB,EACzB,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"PluginToolDefinition.d.ts","sourceRoot":"","sources":["../../../../src/executor/tools/plugin/PluginToolDefinition.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH,OAAO,KAAK,EACV,gBAAgB,EAChB,wBAAwB,EACzB,MAAM,qCAAqC,CAAC;AA4B7C;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,wBAAwB,0GAYrE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,wBAAwB;;;+EAYrE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,wBAAwB,GAChC,gBAAgB,CAKlB"}
|
|
@@ -9,6 +9,17 @@
|
|
|
9
9
|
import { tool } from "ai";
|
|
10
10
|
import { invokePluginCallTool, invokePluginReadTool, } from "./PluginToolBridge.js";
|
|
11
11
|
import { plugin_call_input_schema, plugin_read_input_schema, } from "./PluginToolSchemas.js";
|
|
12
|
+
/**
|
|
13
|
+
* 要求当前 plugin tool 具有 Executor 显式绑定的 Session 上下文。
|
|
14
|
+
*/
|
|
15
|
+
function require_run_context(options) {
|
|
16
|
+
const execution_context = options.experimental_context;
|
|
17
|
+
const run_context = execution_context?.session_run_context;
|
|
18
|
+
if (!run_context) {
|
|
19
|
+
throw new Error("plugin tool requires an explicit session run context");
|
|
20
|
+
}
|
|
21
|
+
return run_context;
|
|
22
|
+
}
|
|
12
23
|
/**
|
|
13
24
|
* 创建 `plugin_call`:调用当前 Agent 已注册 plugin action。
|
|
14
25
|
*/
|
|
@@ -16,8 +27,9 @@ export function createPluginCallTool(options) {
|
|
|
16
27
|
return tool({
|
|
17
28
|
description: "Call a registered agent plugin action. Use plugin_read first when you need the action list, input schema, or examples. Generated files may be attached to the final assistant message automatically.",
|
|
18
29
|
inputSchema: plugin_call_input_schema,
|
|
19
|
-
execute: async (input) => await invokePluginCallTool({
|
|
30
|
+
execute: async (input, execution_options) => await invokePluginCallTool({
|
|
20
31
|
plugins: options.plugins,
|
|
32
|
+
run_context: require_run_context(execution_options),
|
|
21
33
|
input: input,
|
|
22
34
|
}),
|
|
23
35
|
});
|
|
@@ -29,8 +41,9 @@ export function createPluginReadTool(options) {
|
|
|
29
41
|
return tool({
|
|
30
42
|
description: "Read registered agent plugin metadata, including action names, descriptions, input schemas, and examples. Use this before plugin_call when the payload shape is unclear.",
|
|
31
43
|
inputSchema: plugin_read_input_schema,
|
|
32
|
-
execute: async (input) => await invokePluginReadTool({
|
|
44
|
+
execute: async (input, execution_options) => await invokePluginReadTool({
|
|
33
45
|
plugins: options.plugins,
|
|
46
|
+
run_context: require_run_context(execution_options),
|
|
34
47
|
input: input,
|
|
35
48
|
}),
|
|
36
49
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginToolDefinition.js","sourceRoot":"","sources":["../../../../src/executor/tools/plugin/PluginToolDefinition.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"PluginToolDefinition.js","sourceRoot":"","sources":["../../../../src/executor/tools/plugin/PluginToolDefinition.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,IAAI,EAA6B,MAAM,IAAI,CAAC;AASrD,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAIhC;;GAEG;AACH,SAAS,mBAAmB,CAC1B,OAA6B;IAE7B,MAAM,iBAAiB,GAAG,OAAO,CAAC,oBAErB,CAAC;IACd,MAAM,WAAW,GAAG,iBAAiB,EAAE,mBAAmB,CAAC;IAC3D,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAiC;IACpE,OAAO,IAAI,CAAC;QACV,WAAW,EACT,sMAAsM;QACxM,WAAW,EAAE,wBAAwB;QACrC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,iBAAiB,EAAE,EAAE,CAC1C,MAAM,oBAAoB,CAAC;YACzB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,WAAW,EAAE,mBAAmB,CAAC,iBAAiB,CAAC;YACnD,KAAK,EAAE,KAAwB;SAChC,CAAC;KACL,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAiC;IACpE,OAAO,IAAI,CAAC;QACV,WAAW,EACT,0KAA0K;QAC5K,WAAW,EAAE,wBAAwB;QACrC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,iBAAiB,EAAE,EAAE,CAC1C,MAAM,oBAAoB,CAAC;YACzB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,WAAW,EAAE,mBAAmB,CAAC,iBAAiB,CAAC;YACnD,KAAK,EAAE,KAAwB;SAChC,CAAC;KACL,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAC/B,OAAiC;IAEjC,OAAO;QACL,WAAW,EAAE,oBAAoB,CAAC,OAAO,CAAC;QAC1C,WAAW,EAAE,oBAAoB,CAAC,OAAO,CAAC;KAC3C,CAAC;AACJ,CAAC"}
|
|
@@ -22,8 +22,6 @@ export type SessionHistoryMetaV1 = {
|
|
|
22
22
|
title?: string;
|
|
23
23
|
/** 当前 session 绑定模型的可读标签。 */
|
|
24
24
|
modelLabel?: string;
|
|
25
|
-
/** 当前 session 绑定模型的稳定 ID,用于进程重启后恢复模型实例。 */
|
|
26
|
-
modelId?: string;
|
|
27
25
|
/** 当前 session 已持久化记录数量,用于列表查询避免扫描完整历史。 */
|
|
28
26
|
messageCount?: number;
|
|
29
27
|
/** 当前 session 最后一条记录的用户可见摘要,用于列表预览。 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionHistoryMeta.d.ts","sourceRoot":"","sources":["../../../src/executor/types/SessionHistoryMeta.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,oBAAoB,GAAG;IACjC,iBAAiB;IACjB,CAAC,EAAE,CAAC,CAAC;IACL,0BAA0B;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,8BAA8B;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,wBAAwB;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4BAA4B;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,
|
|
1
|
+
{"version":3,"file":"SessionHistoryMeta.d.ts","sourceRoot":"","sources":["../../../src/executor/types/SessionHistoryMeta.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,oBAAoB,GAAG;IACjC,iBAAiB;IACjB,CAAC,EAAE,CAAC,CAAC;IACL,0BAA0B;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,8BAA8B;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,wBAAwB;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4BAA4B;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0CAA0C;IAC1C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iDAAiD;IACjD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC"}
|
package/bin/index.d.ts
CHANGED
|
@@ -6,17 +6,17 @@
|
|
|
6
6
|
* - 只导出 Agent、plugin 作者 API、city 运行集成 API 与跨包协议类型。
|
|
7
7
|
* - HTTP router、sandbox runner、内部 plugin runtime runner 等实现细节不从根入口暴露。
|
|
8
8
|
*/
|
|
9
|
-
export { Agent } from "./agent/
|
|
10
|
-
export { RemoteAgent } from "./
|
|
9
|
+
export { Agent } from "./agent/Agent.js";
|
|
10
|
+
export { RemoteAgent } from "./remote/RemoteAgent.js";
|
|
11
11
|
export { Session } from "./session/Session.js";
|
|
12
12
|
export type { SessionOptions } from "./types/session/SessionOptions.js";
|
|
13
|
-
export { inferAgentModelLabel, normalizeAgentModel, read_agent_model_context_window, } from "./
|
|
14
|
-
export type { AgentModel } from "./
|
|
13
|
+
export { inferAgentModelLabel, normalizeAgentModel, read_agent_model_context_window, } from "./agent/AgentModel.js";
|
|
14
|
+
export type { AgentModel } from "./agent/AgentModel.js";
|
|
15
15
|
export type { AgentArchiveSessionInput, AgentArchiveSessionsInput, AgentArchiveSessionResult, AgentArchiveSessionsResult, AgentCleanArchiveResult, AgentCreateSessionInput, AgentListSessionsInput, AgentSessionConfigSnapshot, AgentSessionForkInput, AgentSessionInfo, AgentSessionSetInput, AgentSessionSummary, AgentSessionSummaryPage, AgentSessionSystemBlock, AgentSessionSystemBlockSource, AgentSessionSystemSessionInfo, AgentSessionSystemSnapshot, } from "./types/agent/SessionTypes.js";
|
|
16
16
|
export type { ListSessionMessagesInput, SessionActionMessage, SessionAssistantMessage, SessionAssistantMessagePart, SessionAssistantToolPart, SessionErrorMessage, SessionMessage, SessionMessagePage, SessionUserMessage, SessionUserMessagePart, } from "./types/session/SessionMessage.js";
|
|
17
17
|
export type { SessionContextSnapshot, SessionMessageStorageStats, SessionSegmentRange, SessionSegmentSnapshot, SessionSegmentSummary, } from "./types/session/SessionSegment.js";
|
|
18
18
|
export { is_session_mutation, } from "./types/session/SessionMutation.js";
|
|
19
|
-
export type { SessionDeltaMutation, SessionMessageMutation, SessionMutation,
|
|
19
|
+
export type { SessionDeltaMutation, SessionMessageMutation, SessionMutation, SessionMutationSubscriber, SessionMutationUnsubscribe, SessionPartMutation, SessionStateMutation, SessionTurnMutation, } from "./types/session/SessionMutation.js";
|
|
20
20
|
export type { ResolveSessionApprovalInput, SessionApproval, SessionApprovalDecision, SessionApprovalMode, SessionApprovalModeSnapshot, SessionApprovalResult, SetSessionApprovalModeInput, } from "./types/session/SessionApproval.js";
|
|
21
21
|
export type { AgentOptions, AgentSessionConstructor, } from "./types/agent/AgentOptions.js";
|
|
22
22
|
export type { AgentSession, AgentSessionActor, AgentSessions, RemoteAgentSession, } from "./types/agent/SessionActor.js";
|
|
@@ -27,31 +27,28 @@ export type { AgentSessionActionCallback, AgentSessionActionEvent, AgentSessionA
|
|
|
27
27
|
export type { AgentSessionPromptInput } from "./types/sdk/AgentSessionPrompt.js";
|
|
28
28
|
export type { AgentSessionStopResult } from "./types/sdk/AgentSessionStop.js";
|
|
29
29
|
export type { AgentSessionTurnHandle, AgentSessionTurnResult, } from "./types/sdk/AgentSessionTurn.js";
|
|
30
|
-
export { AgentContext } from "./
|
|
31
|
-
export type {
|
|
30
|
+
export { AgentContext } from "./agent/AgentContext.js";
|
|
31
|
+
export type { SessionPort } from "./types/session/SessionPort.js";
|
|
32
|
+
export type { StructuredConfig } from "./types/plugin/PluginConfig.js";
|
|
32
33
|
export { BasePlugin } from "./plugin/core/BasePlugin.js";
|
|
33
34
|
export { createAction, createPlugin, } from "./plugin/core/PluginActionFactory.js";
|
|
34
35
|
export type { CreatePluginActionOptions, CreatePluginOptions, } from "./plugin/core/PluginActionFactory.js";
|
|
35
36
|
export { Executor } from "./executor/Executor.js";
|
|
36
|
-
export {
|
|
37
|
-
export {
|
|
38
|
-
export {
|
|
39
|
-
export {
|
|
40
|
-
export {
|
|
41
|
-
export type { SessionCompactionComposer, SessionCompactionInput, } from "./executor/composer/compaction/SessionCompactionComposer.js";
|
|
42
|
-
export type { SessionContextComposer, SessionContextComposeResult, } from "./executor/composer/context/SessionContextComposer.js";
|
|
43
|
-
export type { SessionHistoryComposer, SessionHistoryPrepareInput, } from "./executor/composer/history/SessionHistoryComposer.js";
|
|
44
|
-
export type { SessionSystemComposer } from "./executor/composer/system/SessionSystemComposer.js";
|
|
37
|
+
export { DefaultSessionComposer } from "./session/DefaultSessionComposer.js";
|
|
38
|
+
export { SessionMessages } from "./session/SessionMessages.js";
|
|
39
|
+
export { JsonlSessionMessageStore } from "./session/messages/JsonlSessionMessageStore.js";
|
|
40
|
+
export type { AppendCompletedAssistantMessageInput, AppendExternalSessionAssistantMessageInput, AppendExternalSessionUserMessageInput, AppendSessionErrorMessageInput, AppendSessionPromptMessageInput, AppendSessionUserMessageInput, OpenSessionActionMessageInput, OpenSessionAssistantMessageInput, SessionMessagesOptions, } from "./types/session/SessionMessages.js";
|
|
41
|
+
export type { SessionComposer, SessionCompactionInput, SessionCompactionPlan, SessionComposeIdentity, SessionComposeInput, SessionComposeState, SessionComposeTurn, SessionStepInput, } from "./types/session/SessionComposer.js";
|
|
45
42
|
export { DefaultSessionSystemComposer } from "./executor/composer/system/default/DefaultSessionSystemComposer.js";
|
|
46
43
|
export { resolveSessionSystemMessages } from "./executor/composer/system/default/SystemDomain.js";
|
|
47
|
-
export type { SessionHistoryStore } from "./executor/store/history/SessionHistoryStore.js";
|
|
48
44
|
export type { SessionExecutor } from "./executor/types/SessionExecutor.js";
|
|
49
45
|
export type { SessionAssistantStepCallback, SessionRunResult, } from "./executor/types/SessionRun.js";
|
|
50
46
|
export type { SessionRunContext } from "./types/executor/SessionRunContext.js";
|
|
47
|
+
export type { SessionToolExecutionContext } from "./types/executor/SessionToolExecutionContext.js";
|
|
48
|
+
export type { PluginRunContext } from "./types/plugin/PluginRunContext.js";
|
|
51
49
|
export type { SessionActionRecordV1, SessionMessageRecordV1, SessionMetadataV1, SessionRecordV1, SessionUserMessageV1, } from "./executor/types/SessionRecords.js";
|
|
52
50
|
export { is_session_action_record, is_session_message_record, } from "./executor/types/SessionRecords.js";
|
|
53
51
|
export type { SessionSystemMessage } from "./executor/types/SessionPrompts.js";
|
|
54
|
-
export type { SessionComposerFactoryContext, SessionComposerInput, SessionComposerOptions, } from "./types/session/SessionComposerOptions.js";
|
|
55
52
|
export { transformPromptsIntoSystemMessages } from "./executor/composer/system/default/PromptRenderer.js";
|
|
56
53
|
export { buildStaticPluginAvailability, findPluginByName, hasPluginLifecycle, listPluginViews, listPluginsWithLifecycle, listPluginsWithoutLifecycle, resolvePluginAvailability, toPluginView, } from "./plugin/core/PluginCatalog.js";
|
|
57
54
|
export { listPluginAuthPolicies, registerPluginHttpRoutes, } from "./plugin/core/PluginHttpRoutes.js";
|
|
@@ -65,14 +62,13 @@ export { buildChatMessageText, parseChatMessageMarkup, renderChatMessageFileTag,
|
|
|
65
62
|
export type { ChatMessageFileTag, ChatMessageFileType, ChatMessageSegment, ChatMessageSendOptions, } from "./executor/messages/ChatMessageMarkupTypes.js";
|
|
66
63
|
export { initializeAgentProject, normalizeDefaultAgentId, } from "./config/AgentInitializer.js";
|
|
67
64
|
export { load_project_dotenv, resolve_agent_env, } from "./config/AgentEnv.js";
|
|
68
|
-
export {
|
|
65
|
+
export { getDowncitySessionMessagesPath } from "./config/Paths.js";
|
|
69
66
|
export { getPlatformStoreDbPath, getPlatformStoreKeyPath, } from "./config/PlatformPaths.js";
|
|
70
|
-
export { ensureRuntimeProjectReady, } from "./
|
|
67
|
+
export { ensureRuntimeProjectReady, } from "./config/ProjectSetup.js";
|
|
71
68
|
export { assertProjectExecutionTarget } from "./config/ExecutionBinding.js";
|
|
72
69
|
export { getLogger, type Logger } from "./utils/logger/Logger.js";
|
|
73
70
|
export { generateId } from "./utils/Id.js";
|
|
74
71
|
export { formatDateTimeInTimezone, resolveRuntimeTimezone, } from "./utils/Time.js";
|
|
75
|
-
export type { AgentPathRuntime, AgentPluginConfigRuntime, } from "./types/agent/AgentRuntimeAssembly.js";
|
|
76
72
|
export type { AgentProjectChannel, AgentProjectInitializationInput, AgentProjectInitializationResult, } from "./types/config/AgentProject.js";
|
|
77
73
|
export type { ExecutionBindingConfig } from "./types/config/ExecutionBinding.js";
|
|
78
74
|
export type { DowncityChatChannelConfig, DowncityChatPluginChannelsConfig, DowncityChatPluginConfig, DowncityChatPluginQueueConfig, DowncityConfig, DowncityPluginConfigMap, } from "./types/config/DowncityConfig.js";
|
package/bin/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,YAAY,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,+BAA+B,GAChC,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,YAAY,EACV,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,EACzB,0BAA0B,EAC1B,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,0BAA0B,EAC1B,qBAAqB,EACrB,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,6BAA6B,EAC7B,6BAA6B,EAC7B,0BAA0B,GAC3B,MAAM,+BAA+B,CAAC;AACvC,YAAY,EACV,wBAAwB,EACxB,oBAAoB,EACpB,uBAAuB,E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B,EAAE,MAAM,oCAAoC,CAAC;AAGtE,YAAY,EACV,oBAAoB,EACpB,2BAA2B,EAC3B,cAAc,EACd,oBAAoB,EACpB,yBAAyB,EACzB,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,4BAA4B,EAC5B,oBAAoB,GACrB,MAAM,wCAAwC,CAAC;AAChD,YAAY,EACV,yBAAyB,EACzB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,wCAAwC,CAAC;AAChD,YAAY,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACzE,YAAY,EACV,eAAe,EACf,gBAAgB,GACjB,MAAM,mCAAmC,CAAC;AAC3C,YAAY,EACV,YAAY,EACZ,cAAc,EACd,aAAa,EACb,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,cAAc,GACf,MAAM,mCAAmC,CAAC"}
|
package/bin/index.js
CHANGED
|
@@ -7,22 +7,20 @@
|
|
|
7
7
|
* - HTTP router、sandbox runner、内部 plugin runtime runner 等实现细节不从根入口暴露。
|
|
8
8
|
*/
|
|
9
9
|
// Agent 入口
|
|
10
|
-
export { Agent } from "./agent/
|
|
11
|
-
export { RemoteAgent } from "./
|
|
10
|
+
export { Agent } from "./agent/Agent.js";
|
|
11
|
+
export { RemoteAgent } from "./remote/RemoteAgent.js";
|
|
12
12
|
export { Session } from "./session/Session.js";
|
|
13
|
-
export { inferAgentModelLabel, normalizeAgentModel, read_agent_model_context_window, } from "./
|
|
13
|
+
export { inferAgentModelLabel, normalizeAgentModel, read_agent_model_context_window, } from "./agent/AgentModel.js";
|
|
14
14
|
export { is_session_mutation, } from "./types/session/SessionMutation.js";
|
|
15
|
-
export { AgentContext } from "./
|
|
15
|
+
export { AgentContext } from "./agent/AgentContext.js";
|
|
16
16
|
// Plugin 作者 API
|
|
17
17
|
export { BasePlugin } from "./plugin/core/BasePlugin.js";
|
|
18
18
|
export { createAction, createPlugin, } from "./plugin/core/PluginActionFactory.js";
|
|
19
19
|
// Session 与即时执行集成
|
|
20
20
|
export { Executor } from "./executor/Executor.js";
|
|
21
|
-
export {
|
|
22
|
-
export {
|
|
23
|
-
export {
|
|
24
|
-
export { JsonlSessionHistoryStore } from "./executor/store/history/jsonl/JsonlSessionHistoryStore.js";
|
|
25
|
-
export { JsonlSessionCompactionComposer } from "./executor/composer/compaction/jsonl/JsonlSessionCompactionComposer.js";
|
|
21
|
+
export { DefaultSessionComposer } from "./session/DefaultSessionComposer.js";
|
|
22
|
+
export { SessionMessages } from "./session/SessionMessages.js";
|
|
23
|
+
export { JsonlSessionMessageStore } from "./session/messages/JsonlSessionMessageStore.js";
|
|
26
24
|
export { DefaultSessionSystemComposer } from "./executor/composer/system/default/DefaultSessionSystemComposer.js";
|
|
27
25
|
export { resolveSessionSystemMessages } from "./executor/composer/system/default/SystemDomain.js";
|
|
28
26
|
export { is_session_action_record, is_session_message_record, } from "./executor/types/SessionRecords.js";
|
|
@@ -41,9 +39,9 @@ export { buildChatMessageText, parseChatMessageMarkup, renderChatMessageFileTag,
|
|
|
41
39
|
// 项目与配置集成
|
|
42
40
|
export { initializeAgentProject, normalizeDefaultAgentId, } from "./config/AgentInitializer.js";
|
|
43
41
|
export { load_project_dotenv, resolve_agent_env, } from "./config/AgentEnv.js";
|
|
44
|
-
export {
|
|
42
|
+
export { getDowncitySessionMessagesPath } from "./config/Paths.js";
|
|
45
43
|
export { getPlatformStoreDbPath, getPlatformStoreKeyPath, } from "./config/PlatformPaths.js";
|
|
46
|
-
export { ensureRuntimeProjectReady, } from "./
|
|
44
|
+
export { ensureRuntimeProjectReady, } from "./config/ProjectSetup.js";
|
|
47
45
|
export { assertProjectExecutionTarget } from "./config/ExecutionBinding.js";
|
|
48
46
|
// 日志
|
|
49
47
|
export { getLogger } from "./utils/logger/Logger.js";
|
package/bin/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,WAAW;AACX,OAAO,EAAE,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,WAAW;AACX,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,+BAA+B,GAChC,MAAM,uBAAuB,CAAC;AAwC/B,OAAO,EACL,mBAAmB,GACpB,MAAM,oCAAoC,CAAC;AAgD5C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAIvD,gBAAgB;AAChB,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EACL,YAAY,EACZ,YAAY,GACb,MAAM,sCAAsC,CAAC;AAM9C,kBAAkB;AAClB,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAsB1F,OAAO,EAAE,4BAA4B,EAAE,MAAM,oEAAoE,CAAC;AAClH,OAAO,EAAE,4BAA4B,EAAE,MAAM,oDAAoD,CAAC;AAgBlG,OAAO,EACL,wBAAwB,EACxB,yBAAyB,GAC1B,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,kCAAkC,EAAE,MAAM,sDAAsD,CAAC;AAC1G,iBAAiB;AACjB,OAAO,EACL,6BAA6B,EAC7B,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,wBAAwB,EACxB,2BAA2B,EA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,qCAAqC,CAAC;AACvE,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AAQtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAatE,iBAAiB;AACjB,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,4BAA4B,EAC5B,oBAAoB,GACrB,MAAM,wCAAwC,CAAC"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* - 不负责调度入口、持久化初始化和轮询生命周期管理。
|
|
7
7
|
* - 到期后重新走 `runPluginCommand`,复用 plugin action 的统一执行规则。
|
|
8
8
|
*/
|
|
9
|
-
import type { AgentContext } from "../../
|
|
9
|
+
import type { AgentContext } from "../../agent/AgentContext.js";
|
|
10
10
|
import type { ActionScheduleStore } from "../../plugin/core/ActionScheduleStore.js";
|
|
11
11
|
/**
|
|
12
12
|
* 执行当前已到点的 pending 任务。
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionScheduleExecutor.d.ts","sourceRoot":"","sources":["../../../src/plugin/core/ActionScheduleExecutor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"ActionScheduleExecutor.d.ts","sourceRoot":"","sources":["../../../src/plugin/core/ActionScheduleExecutor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAGhF;;GAEG;AACH,wBAAsB,wBAAwB,CAAC,MAAM,EAAE;IACrD,OAAO,EAAE,YAAY,CAAC;IACtB,KAAK,EAAE,mBAAmB,CAAC;CAC5B,GAAG,OAAO,CAAC,IAAI,CAAC,CAsChB"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* - 这里只跟随 Agent 长期运行生命周期启动,用于消费持久化的 action schedule 任务。
|
|
7
7
|
* - 普通 plugin 先启动,ActionSchedule 再开始轮询,避免到期 action 执行到未启动的 plugin。
|
|
8
8
|
*/
|
|
9
|
-
import type { AgentContext } from "../../
|
|
9
|
+
import type { AgentContext } from "../../agent/AgentContext.js";
|
|
10
10
|
/**
|
|
11
11
|
* ActionSchedule runtime 停止句柄。
|
|
12
12
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionScheduleRuntime.d.ts","sourceRoot":"","sources":["../../../src/plugin/core/ActionScheduleRuntime.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"ActionScheduleRuntime.d.ts","sourceRoot":"","sources":["../../../src/plugin/core/ActionScheduleRuntime.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAW5D;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,IAAI,IAAI,IAAI,CAAC;CACd;AAED;;GAEG;AACH,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,2BAA2B,CAAC,CA8CtC"}
|
|
@@ -6,14 +6,15 @@
|
|
|
6
6
|
* - plugin 的长期状态归属于实例本身,而不是模块级单例。
|
|
7
7
|
* - Agent 注册 plugin 时自动启动 lifecycle;卸载时自动停止 lifecycle。
|
|
8
8
|
*/
|
|
9
|
-
import type { AgentContext } from "../../
|
|
9
|
+
import type { AgentContext } from "../../agent/AgentContext.js";
|
|
10
10
|
import type { Plugin } from "../../types/plugin/PluginDefinition.js";
|
|
11
11
|
import type { PluginActions } from "../../types/plugin/PluginAction.js";
|
|
12
12
|
import type { PluginCommandContext, PluginLifecycle } from "../../types/plugin/PluginCommand.js";
|
|
13
13
|
import type { PluginAvailability, PluginConfigDefinition, PluginHooks, PluginResolves } from "../../types/plugin/PluginRuntime.js";
|
|
14
14
|
import type { PluginHttpDefinition } from "../../types/plugin/PluginHttp.js";
|
|
15
15
|
import type { PluginSetupDefinition, PluginUsageDefinition } from "../../types/plugin/PluginSetup.js";
|
|
16
|
-
import type { StructuredConfig } from "../../types/
|
|
16
|
+
import type { StructuredConfig } from "../../types/plugin/PluginConfig.js";
|
|
17
|
+
import type { PluginRunContext } from "../../types/plugin/PluginRunContext.js";
|
|
17
18
|
/**
|
|
18
19
|
* BasePlugin 抽象基类。
|
|
19
20
|
*/
|
|
@@ -67,6 +68,6 @@ export declare abstract class BasePlugin implements Plugin {
|
|
|
67
68
|
/**
|
|
68
69
|
* Plugin system 文本提供器。
|
|
69
70
|
*/
|
|
70
|
-
system?(context: AgentContext): Promise<string> | string;
|
|
71
|
+
system?(context: AgentContext, run_context?: PluginRunContext): Promise<string> | string;
|
|
71
72
|
}
|
|
72
73
|
//# sourceMappingURL=BasePlugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BasePlugin.d.ts","sourceRoot":"","sources":["../../../src/plugin/core/BasePlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"BasePlugin.d.ts","sourceRoot":"","sources":["../../../src/plugin/core/BasePlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAC7F,OAAO,KAAK,EACV,kBAAkB,EAClB,sBAAsB,EACtB,WAAW,EACX,cAAc,EACf,MAAM,iCAAiC,CAAC;AACzC,OAAO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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BasePlugin.js","sourceRoot":"","sources":["../../../src/plugin/core/BasePlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"BasePlugin.js","sourceRoot":"","sources":["../../../src/plugin/core/BasePlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAoBH;;GAEG;AACH,MAAM,OAAgB,UAAU;IAM9B;;OAEG;IACM,KAAK,GAAW,EAAE,CAAC;IAE5B;;OAEG;IACM,WAAW,GAAW,EAAE,CAAC;IAElC;;OAEG;IACM,MAAM,CAA4C;IAE3D;;OAEG;IACM,KAAK,CAAyB;IAEvC;;OAEG;IACM,KAAK,CAAyB;IAEvC;;OAEG;IACM,OAAO,GAAkB,EAAE,CAAC;IAErC;;OAEG;IACM,KAAK,CAAe;IAE7B;;OAEG;IACM,QAAQ,CAAkB;IAEnC;;OAEG;IACM,IAAI,CAAwB;IAErC,qBAAqB;IACrB,SAAS,CAAmB;CAiB7B"}
|
|
@@ -7,22 +7,20 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { JsonValue } from "../../types/common/Json.js";
|
|
9
9
|
import type { PluginEffectHook, PluginGuardHook, PluginPipelineHook, PluginResolveHook } from "../../types/plugin/PluginRuntime.js";
|
|
10
|
-
import type { AgentContext } from "../../
|
|
11
|
-
type ContextResolver = () => AgentContext;
|
|
12
|
-
type PluginEnabledChecker = (pluginName: string, context: AgentContext) => boolean;
|
|
10
|
+
import type { AgentContext } from "../../agent/AgentContext.js";
|
|
13
11
|
/**
|
|
14
12
|
* HookRegistry:plugin 点注册与执行实现。
|
|
15
13
|
*/
|
|
16
14
|
export declare class HookRegistry {
|
|
17
|
-
private readonly
|
|
18
|
-
private readonly
|
|
15
|
+
private readonly get_context;
|
|
16
|
+
private readonly is_plugin_ready;
|
|
19
17
|
private readonly pipelineHooks;
|
|
20
18
|
private readonly guardHooks;
|
|
21
19
|
private readonly effectHooks;
|
|
22
20
|
private readonly resolveHooks;
|
|
23
21
|
constructor(params: {
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
get_context: () => AgentContext;
|
|
23
|
+
is_plugin_ready: (plugin_name: string) => boolean;
|
|
26
24
|
});
|
|
27
25
|
/**
|
|
28
26
|
* 注册 pipeline 扩展点。
|
|
@@ -68,5 +66,4 @@ export declare class HookRegistry {
|
|
|
68
66
|
*/
|
|
69
67
|
resolveValue<TInput = JsonValue, TOutput = JsonValue>(pointName: string, value: TInput): Promise<TOutput>;
|
|
70
68
|
}
|
|
71
|
-
export {};
|
|
72
69
|
//# sourceMappingURL=HookRegistry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HookRegistry.d.ts","sourceRoot":"","sources":["../../../src/plugin/core/HookRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"HookRegistry.d.ts","sourceRoot":"","sources":["../../../src/plugin/core/HookRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAsB5D;;GAEG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAqB;IACjD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAmC;IAEnE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAuC;I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,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAiB5E;;OAEG;IACG,YAAY,CAAC,MAAM,GAAG,SAAS,EAAE,OAAO,GAAG,SAAS,EACxD,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,OAAO,CAAC;CAoBpB"}
|
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
* HookRegistry:plugin 点注册与执行实现。
|
|
10
10
|
*/
|
|
11
11
|
export class HookRegistry {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
get_context;
|
|
13
|
+
is_plugin_ready;
|
|
14
14
|
pipelineHooks = new Map();
|
|
15
15
|
guardHooks = new Map();
|
|
16
16
|
effectHooks = new Map();
|
|
17
17
|
resolveHooks = new Map();
|
|
18
18
|
constructor(params) {
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
19
|
+
this.get_context = params.get_context;
|
|
20
|
+
this.is_plugin_ready = params.is_plugin_ready;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* 注册 pipeline 扩展点。
|
|
@@ -145,10 +145,10 @@ export class HookRegistry {
|
|
|
145
145
|
const bucket = this.pipelineHooks.get(key) || [];
|
|
146
146
|
if (bucket.length === 0)
|
|
147
147
|
return value;
|
|
148
|
-
const context = this.
|
|
148
|
+
const context = this.get_context();
|
|
149
149
|
let current = value;
|
|
150
150
|
for (const item of bucket) {
|
|
151
|
-
if (!this.
|
|
151
|
+
if (!this.is_plugin_ready(item.pluginName))
|
|
152
152
|
continue;
|
|
153
153
|
current = await item.handler({
|
|
154
154
|
context,
|
|
@@ -168,9 +168,9 @@ export class HookRegistry {
|
|
|
168
168
|
const bucket = this.guardHooks.get(key) || [];
|
|
169
169
|
if (bucket.length === 0)
|
|
170
170
|
return;
|
|
171
|
-
const context = this.
|
|
171
|
+
const context = this.get_context();
|
|
172
172
|
for (const item of bucket) {
|
|
173
|
-
if (!this.
|
|
173
|
+
if (!this.is_plugin_ready(item.pluginName))
|
|
174
174
|
continue;
|
|
175
175
|
await item.handler({
|
|
176
176
|
context,
|
|
@@ -189,9 +189,9 @@ export class HookRegistry {
|
|
|
189
189
|
const bucket = this.effectHooks.get(key) || [];
|
|
190
190
|
if (bucket.length === 0)
|
|
191
191
|
return;
|
|
192
|
-
const context = this.
|
|
192
|
+
const context = this.get_context();
|
|
193
193
|
for (const item of bucket) {
|
|
194
|
-
if (!this.
|
|
194
|
+
if (!this.is_plugin_ready(item.pluginName))
|
|
195
195
|
continue;
|
|
196
196
|
await item.handler({
|
|
197
197
|
context,
|
|
@@ -212,8 +212,8 @@ export class HookRegistry {
|
|
|
212
212
|
if (!record) {
|
|
213
213
|
throw new Error(`No plugin resolver registered for point: ${key}`);
|
|
214
214
|
}
|
|
215
|
-
const context = this.
|
|
216
|
-
if (!this.
|
|
215
|
+
const context = this.get_context();
|
|
216
|
+
if (!this.is_plugin_ready(record.pluginName)) {
|
|
217
217
|
throw new Error(`No active plugin resolver registered for point: ${key}`);
|
|
218
218
|
}
|
|
219
219
|
return await record.handler({
|