@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,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session Composer 类型。
|
|
3
|
+
*
|
|
4
|
+
* Composer 是自定义 Session 的执行策略边界:它只读取 Session 的只读快照,
|
|
5
|
+
* 负责组装模型输入和生成压缩计划,不持久化 Message、Metadata 或事件。
|
|
6
|
+
*/
|
|
7
|
+
import type { LanguageModel, SystemModelMessage, Tool } from "ai";
|
|
8
|
+
import type { SessionRecordV1 } from "../../executor/types/SessionRecords.js";
|
|
9
|
+
import type { AgentSessionSystemBlock } from "../../types/agent/SessionTypes.js";
|
|
10
|
+
import type { SessionContextSnapshot, SessionSegmentSummary } from "../../types/session/SessionSegment.js";
|
|
11
|
+
/** Composer 可读取的 Session 身份快照。 */
|
|
12
|
+
export interface SessionComposeIdentity {
|
|
13
|
+
/** 当前 Agent 的稳定标识。 */
|
|
14
|
+
agent_id: string;
|
|
15
|
+
/** 当前 Session 的稳定标识。 */
|
|
16
|
+
session_id: string;
|
|
17
|
+
/** 当前 Agent 项目的绝对根目录。 */
|
|
18
|
+
project_root: string;
|
|
19
|
+
/** 当前 Session 的创建时间戳,单位为毫秒。 */
|
|
20
|
+
created_at: number;
|
|
21
|
+
/** 当前 Session 使用的参考时区。 */
|
|
22
|
+
timezone: string;
|
|
23
|
+
}
|
|
24
|
+
/** Composer 可读取的当前 Step 生效状态。 */
|
|
25
|
+
export interface SessionComposeState {
|
|
26
|
+
/** 当前 Step 使用的模型实例;只读查询允许为空。 */
|
|
27
|
+
model?: LanguageModel;
|
|
28
|
+
/** 当前模型声明的上下文窗口,单位为 token。 */
|
|
29
|
+
model_context_window?: number;
|
|
30
|
+
/** 当前 Step 生效的 Agent 环境变量快照。 */
|
|
31
|
+
env: Readonly<Record<string, string>>;
|
|
32
|
+
/** 当前 Step 生效的 Agent instruction 文本。 */
|
|
33
|
+
systems: readonly string[];
|
|
34
|
+
/** 当前 Step 可使用的工具集合。 */
|
|
35
|
+
tools: Readonly<Record<string, Tool>>;
|
|
36
|
+
/** 当前 Step 生效的 instruction system blocks。 */
|
|
37
|
+
instruction_system_blocks: readonly AgentSessionSystemBlock[];
|
|
38
|
+
/** 当前 Session 由宿主注入的 system blocks。 */
|
|
39
|
+
managed_plugin_system_blocks: readonly AgentSessionSystemBlock[];
|
|
40
|
+
/** 当前 Step 捕获的 Plugin system blocks。 */
|
|
41
|
+
plugin_system_blocks: readonly AgentSessionSystemBlock[];
|
|
42
|
+
}
|
|
43
|
+
/** Composer 可读取的当前 Turn 快照。 */
|
|
44
|
+
export interface SessionComposeTurn {
|
|
45
|
+
/** 当前 Turn 标识;只读查询场景允许为空。 */
|
|
46
|
+
turn_id?: string;
|
|
47
|
+
/** 当前执行因上下文超限而进行的重试次数。 */
|
|
48
|
+
retry_count: number;
|
|
49
|
+
}
|
|
50
|
+
/** 单次模型输入组装参数。 */
|
|
51
|
+
export interface SessionComposeInput {
|
|
52
|
+
/** 当前 Session 身份快照。 */
|
|
53
|
+
session: SessionComposeIdentity;
|
|
54
|
+
/** 当前 Step 已生效的运行状态。 */
|
|
55
|
+
state: SessionComposeState;
|
|
56
|
+
/** 当前 Session 的累计 Summary 与 Active Message 快照。 */
|
|
57
|
+
history: Readonly<SessionContextSnapshot>;
|
|
58
|
+
/** 当前 Turn 快照。 */
|
|
59
|
+
turn: SessionComposeTurn;
|
|
60
|
+
}
|
|
61
|
+
/** Composer 为一次模型 Step 生成的完整输入。 */
|
|
62
|
+
export interface SessionStepInput {
|
|
63
|
+
/** 当前 Step 的 system messages。 */
|
|
64
|
+
system: SystemModelMessage[];
|
|
65
|
+
/** 当前 Step 的可解释 system block;自定义 Composer 可以省略。 */
|
|
66
|
+
system_blocks?: AgentSessionSystemBlock[];
|
|
67
|
+
/** 当前 Step 的历史与用户消息。 */
|
|
68
|
+
messages: SessionRecordV1[];
|
|
69
|
+
/** 当前 Step 可调用的工具集合。 */
|
|
70
|
+
tools: Record<string, Tool>;
|
|
71
|
+
}
|
|
72
|
+
/** 持久化上下文压缩的组装参数。 */
|
|
73
|
+
export interface SessionCompactionInput extends SessionComposeInput {
|
|
74
|
+
/** 是否由调用方明确要求执行持久化压缩。 */
|
|
75
|
+
force: boolean;
|
|
76
|
+
}
|
|
77
|
+
/** Composer 生成、等待 SessionMessages 提交的压缩计划。 */
|
|
78
|
+
export interface SessionCompactionPlan {
|
|
79
|
+
/** Active 中最后一条需要移入 Segment 的 Message sequence。 */
|
|
80
|
+
through_sequence: number;
|
|
81
|
+
/** 新 Segment 使用的累计 Summary。 */
|
|
82
|
+
summary: SessionSegmentSummary;
|
|
83
|
+
/** 当前计划覆盖到的最后一条 Message 标识。 */
|
|
84
|
+
boundary_message_id: string;
|
|
85
|
+
/** Summary 是否因为模型失败而使用了确定性降级内容。 */
|
|
86
|
+
used_fallback: boolean;
|
|
87
|
+
}
|
|
88
|
+
/** Session 级可替换执行策略。 */
|
|
89
|
+
export interface SessionComposer {
|
|
90
|
+
/** Composer 的稳定可读名称。 */
|
|
91
|
+
readonly name: string;
|
|
92
|
+
/** 组装一次模型 Step 使用的 system、history 与 tools。 */
|
|
93
|
+
compose(input: SessionComposeInput): Promise<SessionStepInput>;
|
|
94
|
+
/** 根据只读历史生成压缩计划;无需压缩时返回空。 */
|
|
95
|
+
compact(input: SessionCompactionInput): Promise<SessionCompactionPlan | null>;
|
|
96
|
+
/** 判断给定错误是否应在持久化压缩后重试。 */
|
|
97
|
+
should_compact(error: unknown): boolean;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=SessionComposer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SessionComposer.d.ts","sourceRoot":"","sources":["../../../src/types/session/SessionComposer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,kBAAkB,EAClB,IAAI,EACL,MAAM,IAAI,CAAC;AAC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@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SessionComposer.js","sourceRoot":"","sources":["../../../src/types/session/SessionComposer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
5
|
* - 这里承载本地 Session 在内存中的可变运行态。
|
|
6
|
-
* -
|
|
6
|
+
* - `SessionState` 与 `Session` 共享该对象,避免重复维护配置状态。
|
|
7
7
|
* - 这里只保存运行态,不承载行为逻辑。
|
|
8
8
|
*/
|
|
9
9
|
import type { AgentSessionConfigSnapshot } from "../../types/agent/SessionTypes.js";
|
|
@@ -14,19 +14,19 @@ export interface SessionLocalState {
|
|
|
14
14
|
/**
|
|
15
15
|
* 当前 session 配置快照。
|
|
16
16
|
*/
|
|
17
|
-
|
|
17
|
+
session_config: AgentSessionConfigSnapshot;
|
|
18
18
|
/**
|
|
19
19
|
* 当前 Session step 实际使用的 Session 配置。
|
|
20
20
|
*
|
|
21
21
|
* 关键点(中文)
|
|
22
|
-
* - `
|
|
22
|
+
* - `session_config` 是配置 API 最近一次成功写入的 configured state。
|
|
23
23
|
* - 该字段只在 Session step 检查点由队列 mutation 更新。
|
|
24
24
|
*/
|
|
25
25
|
effective_session_config: AgentSessionConfigSnapshot;
|
|
26
26
|
/**
|
|
27
27
|
* 当前 session 创建时间(毫秒时间戳)。
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
created_at: number;
|
|
30
30
|
/**
|
|
31
31
|
* 当前 session 参考时区。
|
|
32
32
|
*/
|
|
@@ -34,10 +34,10 @@ export interface SessionLocalState {
|
|
|
34
34
|
/**
|
|
35
35
|
* initialize() 过程中的并发复用 Promise。
|
|
36
36
|
*/
|
|
37
|
-
|
|
37
|
+
initialize_promise: Promise<void> | null;
|
|
38
38
|
/**
|
|
39
39
|
* ensureReadyForExecution() 过程中的并发复用 Promise。
|
|
40
40
|
*/
|
|
41
|
-
|
|
41
|
+
ensure_configured_promise: Promise<void> | null;
|
|
42
42
|
}
|
|
43
43
|
//# sourceMappingURL=SessionLocalState.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionLocalState.d.ts","sourceRoot":"","sources":["../../../src/types/session/SessionLocalState.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAEhF;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,
|
|
1
|
+
{"version":3,"file":"SessionLocalState.d.ts","sourceRoot":"","sources":["../../../src/types/session/SessionLocalState.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAEhF;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,cAAc,EAAE,0BAA0B,CAAC;IAE3C;;;;;;OAMG;IACH,wBAAwB,EAAE,0BAA0B,CAAC;IAErD;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,kBAAkB,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAEzC;;OAEG;IACH,yBAAyB,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACjD"}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* 均为内部 part,不提升为顶层消息。
|
|
6
6
|
*/
|
|
7
7
|
import type { JsonObject, JsonValue } from "../../types/common/Json.js";
|
|
8
|
+
import type { SessionApproval } from "../../types/session/SessionApproval.js";
|
|
8
9
|
/** Message 默认展示范围。 */
|
|
9
10
|
export type SessionMessageVisibility = "visible" | "internal";
|
|
10
11
|
/** 从其他 Session 导入时保留的来源身份。 */
|
|
@@ -118,8 +119,8 @@ export interface SessionAssistantToolPart {
|
|
|
118
119
|
output?: JsonValue;
|
|
119
120
|
/** 工具失败信息。 */
|
|
120
121
|
error?: string;
|
|
121
|
-
/**
|
|
122
|
-
|
|
122
|
+
/** 当前 Tool 等待或已经处理过的完整审批快照。 */
|
|
123
|
+
approval?: SessionApproval;
|
|
123
124
|
}
|
|
124
125
|
/** Assistant 文件 part。 */
|
|
125
126
|
export interface SessionAssistantFilePart {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionMessage.d.ts","sourceRoot":"","sources":["../../../src/types/session/SessionMessage.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"SessionMessage.d.ts","sourceRoot":"","sources":["../../../src/types/session/SessionMessage.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAE1E,sBAAsB;AACtB,MAAM,MAAM,wBAAwB,GAAG,SAAS,GAAG,UAAU,CAAC;AAE9D,8BAA8B;AAC9B,MAAM,WAAW,oBAAoB;IACnC,qBAAqB;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,qBAAqB;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,4BAA4B;AAC5B,MAAM,WAAW,kBAAkB;IACjC,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,gCAAgC;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,yCAAyC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6BAA6B;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,4BAA4B;IAC5B,UAAU,EA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B;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,cAAc;IACd,KAAK,EAAE,SAAS,GAAG,MAAM,CAAC;IAC1B,aAAa;IACb,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,oBAAoB;IACpB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,iCAAiC;AACjC,MAAM,MAAM,cAAc,GACtB,kBAAkB,GAClB,uBAAuB,GACvB,oBAAoB,GACpB,mBAAmB,CAAC;AAExB,yCAAyC;AACzC,MAAM,WAAW,wBAAwB;IACvC;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,6BAA6B;IAC7B,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,qCAAqC;AACrC,MAAM,WAAW,kBAAkB;IACjC,qDAAqD;IACrD,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,MAAM,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC7B,qCAAqC;IACrC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,sCAAsC;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wCAAwC;IACxC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,4BAA4B;IAC5B,QAAQ,EAAE,OAAO,CAAC;CACnB"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SessionMessages 输入与构造类型。
|
|
3
|
+
*
|
|
4
|
+
* 这些类型只描述 canonical Message 领域入口的参数,不包含持久化行为。
|
|
5
|
+
*/
|
|
6
|
+
import type { JsonObject } from "../../types/common/Json.js";
|
|
7
|
+
import type { SessionRecordV1 } from "../../executor/types/SessionRecords.js";
|
|
8
|
+
import type { JsonlSessionMessageStore } from "../../session/messages/JsonlSessionMessageStore.js";
|
|
9
|
+
import type { AgentSessionPromptInput } from "../../types/sdk/AgentSessionPrompt.js";
|
|
10
|
+
import type { SessionAssistantMessagePart, SessionUserMessagePart } from "../../types/session/SessionMessage.js";
|
|
11
|
+
import type { SessionMutation } from "../../types/session/SessionMutation.js";
|
|
12
|
+
/** SessionMessages 构造参数。 */
|
|
13
|
+
export interface SessionMessagesOptions {
|
|
14
|
+
/** 当前 Session 标识。 */
|
|
15
|
+
session_id: string;
|
|
16
|
+
/** Message 快照持久化 Store。 */
|
|
17
|
+
store: JsonlSessionMessageStore;
|
|
18
|
+
/** 持久化成功后的实时 Mutation 发布函数。 */
|
|
19
|
+
publish: (mutation: SessionMutation) => void;
|
|
20
|
+
}
|
|
21
|
+
/** User Message 创建参数。 */
|
|
22
|
+
export interface AppendSessionUserMessageInput {
|
|
23
|
+
/** 当前输入所属 Turn。 */
|
|
24
|
+
turn_id: string;
|
|
25
|
+
/** 当前输入是普通 Prompt 还是 Steering 输入。 */
|
|
26
|
+
input_type: "prompt" | "steer";
|
|
27
|
+
/** User 结构化 Part。 */
|
|
28
|
+
parts: SessionUserMessagePart[];
|
|
29
|
+
/** 可选的稳定 Message 标识。 */
|
|
30
|
+
message_id?: string;
|
|
31
|
+
/** 当前 Message 的默认展示范围。 */
|
|
32
|
+
visibility?: "visible" | "internal";
|
|
33
|
+
}
|
|
34
|
+
/** Assistant Message 创建参数。 */
|
|
35
|
+
export interface OpenSessionAssistantMessageInput {
|
|
36
|
+
/** 当前 Assistant 所属 Turn。 */
|
|
37
|
+
turn_id: string;
|
|
38
|
+
/** 当前 Assistant 在 Turn 内的 Segment 序号。 */
|
|
39
|
+
segment_index: number;
|
|
40
|
+
/** 当前 Assistant 是普通回复还是压缩 Summary。 */
|
|
41
|
+
kind?: "normal" | "summary";
|
|
42
|
+
/** 当前 Message 的默认展示范围。 */
|
|
43
|
+
visibility?: "visible" | "internal";
|
|
44
|
+
/** 可选的稳定 Message 标识。 */
|
|
45
|
+
message_id?: string;
|
|
46
|
+
/** Summary 已覆盖到的来源 Message 标识。 */
|
|
47
|
+
summary_through_message_id?: string;
|
|
48
|
+
}
|
|
49
|
+
/** 已完成 Assistant Message 的直接写入参数。 */
|
|
50
|
+
export interface AppendCompletedAssistantMessageInput {
|
|
51
|
+
/** 当前 Assistant 所属 Turn。 */
|
|
52
|
+
turn_id?: string;
|
|
53
|
+
/** Assistant 完整结构化 Part。 */
|
|
54
|
+
parts: SessionAssistantMessagePart[];
|
|
55
|
+
/** 当前 Assistant 是普通回复还是压缩 Summary。 */
|
|
56
|
+
kind?: "normal" | "summary";
|
|
57
|
+
/** 当前 Message 的默认展示范围。 */
|
|
58
|
+
visibility?: "visible" | "internal";
|
|
59
|
+
/** Summary 已覆盖到的来源 Message 标识。 */
|
|
60
|
+
summary_through_message_id?: string;
|
|
61
|
+
}
|
|
62
|
+
/** Action Message 创建参数。 */
|
|
63
|
+
export interface OpenSessionActionMessageInput {
|
|
64
|
+
/** 可选的稳定 Message 标识,用于更新同一个 Action 生命周期。 */
|
|
65
|
+
message_id?: string;
|
|
66
|
+
/** 当前 Action 所属 Turn。 */
|
|
67
|
+
turn_id?: string;
|
|
68
|
+
/** 当前 Action 的业务类型。 */
|
|
69
|
+
action_type: string;
|
|
70
|
+
/** 当前 Action 标题。 */
|
|
71
|
+
title: string;
|
|
72
|
+
/** 当前 Action 描述。 */
|
|
73
|
+
description?: string;
|
|
74
|
+
/** 当前 Action 附加数据。 */
|
|
75
|
+
data?: JsonObject;
|
|
76
|
+
}
|
|
77
|
+
/** Error Message 创建参数。 */
|
|
78
|
+
export interface AppendSessionErrorMessageInput {
|
|
79
|
+
/** 当前错误影响 Session 还是单个 Turn。 */
|
|
80
|
+
scope: "session" | "turn";
|
|
81
|
+
/** 当前错误所属 Turn。 */
|
|
82
|
+
turn_id?: string;
|
|
83
|
+
/** 当前错误的稳定业务码。 */
|
|
84
|
+
code: string;
|
|
85
|
+
/** 当前错误的用户可见文本。 */
|
|
86
|
+
message: string;
|
|
87
|
+
/** 当前错误是否允许恢复。 */
|
|
88
|
+
recoverable: boolean;
|
|
89
|
+
}
|
|
90
|
+
/** 公开 Session API 追加 User Message 的输入。 */
|
|
91
|
+
export interface AppendExternalSessionUserMessageInput {
|
|
92
|
+
/** 可选的结构化 User Record。 */
|
|
93
|
+
message?: SessionRecordV1 | null;
|
|
94
|
+
/** 未提供结构化 Record 时使用的纯文本。 */
|
|
95
|
+
text?: string;
|
|
96
|
+
}
|
|
97
|
+
/** 公开 Session API 追加 Assistant Message 的输入。 */
|
|
98
|
+
export interface AppendExternalSessionAssistantMessageInput {
|
|
99
|
+
/** 可选的结构化 Assistant Record。 */
|
|
100
|
+
message?: SessionRecordV1 | null;
|
|
101
|
+
/** 未提供结构化 Record 时使用的纯文本。 */
|
|
102
|
+
fallback_text?: string;
|
|
103
|
+
}
|
|
104
|
+
/** Session Prompt 转换并持久化的输入。 */
|
|
105
|
+
export interface AppendSessionPromptMessageInput {
|
|
106
|
+
/** 当前 Agent 项目的绝对根目录,用于解析本地附件。 */
|
|
107
|
+
project_root: string;
|
|
108
|
+
/** 当前 Session Prompt 输入。 */
|
|
109
|
+
prompt: AgentSessionPromptInput;
|
|
110
|
+
/** 当前输入所属 Turn。 */
|
|
111
|
+
turn_id: string;
|
|
112
|
+
/** 当前输入是普通 Prompt 还是 Steering 输入。 */
|
|
113
|
+
input_type: "prompt" | "steer";
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=SessionMessages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SessionMessages.d.ts","sourceRoot":"","sources":["../../../src/types/session/SessionMessages.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAC/F,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CA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ChC,mBAAmB;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,qCAAqC;IACrC,UAAU,EAAE,QAAQ,GAAG,OAAO,CAAC;CAChC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SessionMessages.js","sourceRoot":"","sources":["../../../src/types/session/SessionMessages.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* Mutation 描述订阅之后发生的状态变化,不等同于 Active/Segment 持久化格式。
|
|
5
5
|
*/
|
|
6
6
|
import type { SessionAssistantMessagePart, SessionMessage } from "../../types/session/SessionMessage.js";
|
|
7
|
-
import type { ResolveSessionApprovalInput, SessionApprovalResult } from "../../types/session/SessionApproval.js";
|
|
8
7
|
/** 所有 Session Mutation 的公共字段。 */
|
|
9
8
|
export interface SessionMutationBase {
|
|
10
9
|
/** 当前 Mutation 的稳定唯一标识。 */
|
|
@@ -99,16 +98,8 @@ export type SessionStateMutation = SessionMutationBase & {
|
|
|
99
98
|
};
|
|
100
99
|
/** Session 对外唯一实时 Mutation 联合类型。 */
|
|
101
100
|
export type SessionMutation = SessionMessageMutation | SessionPartMutation | SessionDeltaMutation | SessionTurnMutation | SessionStateMutation;
|
|
102
|
-
/** 当前 Mutation 可用的命令回复入口。 */
|
|
103
|
-
export interface SessionMutationReply {
|
|
104
|
-
/**
|
|
105
|
-
* 回复当前 Tool Part 的审批请求。
|
|
106
|
-
* 只有 approval-required Tool Part Mutation 可以成功调用。
|
|
107
|
-
*/
|
|
108
|
-
approval(input: Pick<ResolveSessionApprovalInput, "decision">): Promise<SessionApprovalResult>;
|
|
109
|
-
}
|
|
110
101
|
/** Session Mutation 订阅回调。 */
|
|
111
|
-
export type SessionMutationSubscriber = (mutation: SessionMutation
|
|
102
|
+
export type SessionMutationSubscriber = (mutation: SessionMutation) => void | Promise<void>;
|
|
112
103
|
/** 取消 Session Mutation 订阅的函数。 */
|
|
113
104
|
export type SessionMutationUnsubscribe = () => void;
|
|
114
105
|
/** 判断未知事件是否为 Session Mutation。 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionMutation.d.ts","sourceRoot":"","sources":["../../../src/types/session/SessionMutation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,2BAA2B,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"SessionMutation.d.ts","sourceRoot":"","sources":["../../../src/types/session/SessionMutation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,2BAA2B,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAErG,iCAAiC;AACjC,MAAM,WAAW,mBAAmB;IAClC,2BAA2B;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,iCAAiC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,6BAA6B;IAC7B,UAAU,EAAE,MAAM,CAAC;CACpB;AACD,kCAAkC;AAClC,MAAM,MAAM,sBAAsB,GAAG;KAClC,KAAK,IAAI,cAAc,CAAC,MAAM,CAAC,GAAG,mBAAmB,GAAG;QACvD,8BAA8B;QAC9B,OAAO,EAAE,SAAS,CAAC;QACnB,uBAAuB;QACvB,IAAI,EAAE,KAAK,CAAC;QACZ,iCAAiC;QACjC,UAAU,EAAE,MAAM,CAAC;QACnB,8BAA8B;QAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,sCAAsC;QACtC,QAAQ,EAAE,MAAM,CAAC;QACjB,yCAAyC;QACzC,QAAQ,EAAE,MAAM,CAAC;QACjB,4BAA4B;QAC5B,OAAO,EAAE,OAAO,CAAC,cAAc,EAAE;YAAE,IAAI,EAAE,KAAK,CAAA;SAAE,CAAC,CAAC;KACnD;CACF,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;AAE1B,yCAAyC;AACzC,MAAM,MAAM,mBAAmB,GAAG;KAC/B,KAAK,IAAI,2BAA2B,CA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,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,+BAA+B;AAC/B,MAAM,MAAM,oBAAoB,GAAG,mBAAmB,GAAG;IACvD,8BAA8B;IAC9B,OAAO,EAAE,SAAS,CAAC;IACnB,yBAAyB;IACzB,IAAI,EAAE,OAAO,CAAC;IACd,uBAAuB;IACvB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,oCAAoC;AACpC,MAAM,MAAM,eAAe,GACvB,sBAAsB,GACtB,mBAAmB,GACnB,oBAAoB,GACpB,mBAAmB,GACnB,oBAAoB,CAAC;AAEzB,6BAA6B;AAC7B,MAAM,MAAM,yBAAyB,GAAG,CACtC,QAAQ,EAAE,eAAe,KACtB,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE1B,iCAAiC;AACjC,MAAM,MAAM,0BAA0B,GAAG,MAAM,IAAI,CAAC;AAEpD,kCAAkC;AAClC,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,eAAe,CAW5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionMutation.js","sourceRoot":"","sources":["../../../src/types/session/SessionMutation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"SessionMutation.js","sourceRoot":"","sources":["../../../src/types/session/SessionMutation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAiHH,kCAAkC;AAClC,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACtD,MAAM,SAAS,GAAG,KAAqE,CAAC;IACxF,IAAI,OAAO,SAAS,CAAC,WAAW,KAAK,QAAQ,IAAI,OAAO,SAAS,CAAC,IAAI,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAClG,OAAO,CACL,SAAS,CAAC,OAAO,KAAK,SAAS;QAC/B,SAAS,CAAC,OAAO,KAAK,MAAM;QAC5B,SAAS,CAAC,OAAO,KAAK,OAAO;QAC7B,SAAS,CAAC,OAAO,KAAK,MAAM;QAC5B,SAAS,CAAC,OAAO,KAAK,SAAS,CAChC,CAAC;AACJ,CAAC"}
|
|
@@ -7,15 +7,14 @@
|
|
|
7
7
|
* - Composer 仍然是 Session 级能力,不向 Agent 的执行策略层泄漏。
|
|
8
8
|
*/
|
|
9
9
|
import type { Tool } from "ai";
|
|
10
|
+
import type { AgentModel } from "../../agent/AgentModel.js";
|
|
10
11
|
import type { AgentSession } from "../../types/agent/SessionActor.js";
|
|
11
|
-
import type { SessionPort } from "../../types/
|
|
12
|
+
import type { SessionPort } from "../../types/session/SessionPort.js";
|
|
12
13
|
import type { AgentSessionSystemBlock } from "../../types/agent/SessionTypes.js";
|
|
13
14
|
import type { AgentPluginExecutionRuntime } from "../../types/plugin/PluginRuntime.js";
|
|
14
|
-
import type { AgentSessionCommand } from "../../types/session/
|
|
15
|
-
import type {
|
|
15
|
+
import type { AgentSessionCommand } from "../../types/session/SessionQueue.js";
|
|
16
|
+
import type { SessionComposer } from "../../types/session/SessionComposer.js";
|
|
16
17
|
import type { Logger } from "../../utils/logger/Logger.js";
|
|
17
|
-
import type { AgentModel } from "../../model/CityModelAdapter.js";
|
|
18
|
-
import type { ResolveSessionApprovalInput, SessionApproval, SessionApprovalModeSnapshot, SessionApprovalResult, SetSessionApprovalModeInput } from "../../types/session/SessionApproval.js";
|
|
19
18
|
/**
|
|
20
19
|
* Agent 可管理的本地 Session 实例。
|
|
21
20
|
*/
|
|
@@ -79,27 +78,13 @@ export interface SessionOptions {
|
|
|
79
78
|
* 读取当前 agent 显式注入的受托管 plugin system blocks。
|
|
80
79
|
*/
|
|
81
80
|
getManagedPluginSystemBlocks: () => Promise<AgentSessionSystemBlock[]>;
|
|
82
|
-
/**
|
|
83
|
-
* 读取当前 agent 显式注册 plugin 的 system blocks。
|
|
84
|
-
*/
|
|
85
|
-
getPluginSystemBlocks: () => Promise<AgentSessionSystemBlock[]>;
|
|
86
81
|
/**
|
|
87
82
|
* 在执行前确保当前 session 已完成宿主侧默认配置。
|
|
88
83
|
*/
|
|
89
84
|
ensureConfigured?: (session: AgentManagedSession) => Promise<void>;
|
|
90
|
-
/**
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
|
|
94
|
-
/** 读取当前 Session 的工具审批模式。 */
|
|
95
|
-
get_approval_mode: (session_id: string) => Promise<SessionApprovalModeSnapshot>;
|
|
96
|
-
/** 更新当前 Session 的工具审批模式。 */
|
|
97
|
-
set_approval_mode: (session_id: string, input: SetSessionApprovalModeInput) => Promise<SessionApprovalModeSnapshot>;
|
|
98
|
-
/** 处理当前 Session 的 pending 工具审批。 */
|
|
99
|
-
resolve_approval: (session_id: string, input: ResolveSessionApprovalInput) => Promise<SessionApprovalResult>;
|
|
100
|
-
/**
|
|
101
|
-
* 当前 session 的 Composer 覆盖项。
|
|
102
|
-
*/
|
|
103
|
-
composers?: SessionComposerOptions;
|
|
85
|
+
/** 读取 Agent 当前持有的运行时模型实例。 */
|
|
86
|
+
getAgentModel: () => AgentModel | undefined;
|
|
87
|
+
/** 当前 Session 使用的统一执行策略;省略时使用默认 Composer。 */
|
|
88
|
+
composer?: SessionComposer;
|
|
104
89
|
}
|
|
105
90
|
//# sourceMappingURL=SessionOptions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionOptions.d.ts","sourceRoot":"","sources":["../../../src/types/session/SessionOptions.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"SessionOptions.d.ts","sourceRoot":"","sources":["../../../src/types/session/SessionOptions.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,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xD,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;IAErD;;OAEG;IACH,4BAA4B,EAAE,MAAM,OAAO,CAAC,uBAAuB,EAAE,CAAC,CAAC;IAEvE;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnE,6BAA6B;IAC7B,aAAa,EAAE,MAAM,UAAU,GAAG,SAAS,CAAC;IAE5C,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,eAAe,CAAC;CAC5B"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session runtime 端口类型。
|
|
3
|
+
*
|
|
4
|
+
* 职责说明(中文)
|
|
5
|
+
* - 定义 Plugin、transport 与 Agent 内部运行时访问单个 Session 的稳定协议。
|
|
6
|
+
* - 不暴露具体 Session class,也不包含 Session 集合管理能力。
|
|
7
|
+
*/
|
|
8
|
+
import type { LanguageModel } from "ai";
|
|
9
|
+
import type { SessionMetadataV1, SessionRecordV1 } from "../../executor/types/SessionRecords.js";
|
|
10
|
+
import type { SessionRunInput, SessionRunResult } from "../../executor/types/SessionRun.js";
|
|
11
|
+
import type { AgentSessionPromptInput } from "../../types/sdk/AgentSessionPrompt.js";
|
|
12
|
+
import type { AgentSessionStopResult } from "../../types/sdk/AgentSessionStop.js";
|
|
13
|
+
import type { AgentSessionTurnHandle } from "../../types/sdk/AgentSessionTurn.js";
|
|
14
|
+
import type { SessionMutationSubscriber, SessionMutationUnsubscribe } from "../../types/session/SessionMutation.js";
|
|
15
|
+
import type { SessionContextSnapshot } from "../../types/session/SessionSegment.js";
|
|
16
|
+
/**
|
|
17
|
+
* 单个 Session 执行端口。
|
|
18
|
+
*/
|
|
19
|
+
export interface SessionExecutorPort {
|
|
20
|
+
/** 执行一次 Session run。 */
|
|
21
|
+
run(params: SessionRunInput): Promise<SessionRunResult>;
|
|
22
|
+
/**
|
|
23
|
+
* 请求取消当前正在执行的 turn。
|
|
24
|
+
*
|
|
25
|
+
* @returns `true` 表示已发出取消请求;`false` 表示当前没有可取消的执行。
|
|
26
|
+
*/
|
|
27
|
+
stop(): boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* 单个 Session 实例端口。
|
|
31
|
+
*/
|
|
32
|
+
export interface SessionPort {
|
|
33
|
+
/** 当前 Session 稳定标识。 */
|
|
34
|
+
readonly sessionId: string;
|
|
35
|
+
/** 获取当前 Session 优先解析后的运行时模型实例。 */
|
|
36
|
+
getModel(): LanguageModel | undefined;
|
|
37
|
+
/** 获取当前 Session 的执行端口。 */
|
|
38
|
+
getExecutor(): SessionExecutorPort;
|
|
39
|
+
/** 读取当前 Session 的累计 Summary 与 Active Message 快照。 */
|
|
40
|
+
context(): Promise<SessionContextSnapshot>;
|
|
41
|
+
/** 向当前 Session actor 追加一条新的 prompt。 */
|
|
42
|
+
prompt(input: AgentSessionPromptInput): Promise<AgentSessionTurnHandle>;
|
|
43
|
+
/** 停止当前 turn,并取消尚未被吸收的排队 prompt。 */
|
|
44
|
+
stop(): Promise<AgentSessionStopResult>;
|
|
45
|
+
/** 订阅当前 Session 后续产生的 future 事件。 */
|
|
46
|
+
subscribe(subscriber: SessionMutationSubscriber): SessionMutationUnsubscribe;
|
|
47
|
+
/**
|
|
48
|
+
* 追加一条 user 消息。
|
|
49
|
+
*/
|
|
50
|
+
append_user_message(params: {
|
|
51
|
+
/** 已构造好的完整消息。 */
|
|
52
|
+
message?: SessionRecordV1 | null;
|
|
53
|
+
/** 未传入完整消息时使用的兜底文本。 */
|
|
54
|
+
text?: string;
|
|
55
|
+
/** 当前消息附加元数据。 */
|
|
56
|
+
extra?: SessionMetadataV1["extra"];
|
|
57
|
+
}): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* 追加一条 assistant 消息。
|
|
60
|
+
*/
|
|
61
|
+
append_assistant_message(params: {
|
|
62
|
+
/** 已构造好的完整消息。 */
|
|
63
|
+
message?: SessionRecordV1 | null;
|
|
64
|
+
/** 未传入完整消息时使用的兜底文本。 */
|
|
65
|
+
fallbackText?: string;
|
|
66
|
+
/** 当前消息附加元数据。 */
|
|
67
|
+
extra?: SessionMetadataV1["extra"];
|
|
68
|
+
}): Promise<void>;
|
|
69
|
+
/** 返回当前 Session 是否正在执行。 */
|
|
70
|
+
isExecuting(): boolean;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=SessionPort.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SessionPort.d.ts","sourceRoot":"","sources":["../../../src/types/session/SessionPort.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACxC,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EAChB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EACjB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,KAAK,EACV,yBAAyB,EACzB,0BAA0B,EAC3B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAEhF;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,wBAAwB;IACxB,GAAG,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAExD;;;;OAIG;IACH,IAAI,IAAI,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,uBAAuB;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B,kCAAkC;IAClC,QAAQ,IAAI,aAAa,GA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