@downcity/agent 1.1.73 → 1.1.79
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 +26 -28
- package/bin/agent/{Agent.d.ts → local/Agent.d.ts} +8 -36
- package/bin/agent/local/Agent.d.ts.map +1 -0
- package/bin/agent/{Agent.js → local/Agent.js} +45 -200
- package/bin/agent/local/Agent.js.map +1 -0
- package/bin/agent/local/AgentInstructions.d.ts +22 -0
- package/bin/agent/local/AgentInstructions.d.ts.map +1 -0
- package/bin/agent/local/AgentInstructions.js +57 -0
- package/bin/agent/local/AgentInstructions.js.map +1 -0
- package/bin/agent/local/AgentPluginFactory.d.ts +29 -0
- package/bin/agent/local/AgentPluginFactory.d.ts.map +1 -0
- package/bin/agent/local/AgentPluginFactory.js +53 -0
- package/bin/agent/local/AgentPluginFactory.js.map +1 -0
- package/bin/{runtime/host/AgentHostRuntime.d.ts → agent/local/AgentRuntimeAssembly.d.ts} +2 -2
- package/bin/agent/local/AgentRuntimeAssembly.d.ts.map +1 -0
- package/bin/{runtime/host/AgentHostRuntime.js → agent/local/AgentRuntimeAssembly.js} +2 -2
- package/bin/agent/local/AgentRuntimeAssembly.js.map +1 -0
- package/bin/agent/local/AgentRuntimeFactory.d.ts +72 -0
- package/bin/agent/local/AgentRuntimeFactory.d.ts.map +1 -0
- package/bin/agent/local/AgentRuntimeFactory.js +94 -0
- package/bin/agent/local/AgentRuntimeFactory.js.map +1 -0
- package/bin/{runtime/host → agent/local}/ProjectSetup.d.ts +1 -1
- package/bin/agent/local/ProjectSetup.d.ts.map +1 -0
- package/bin/{runtime/host → agent/local}/ProjectSetup.js +1 -1
- package/bin/agent/local/ProjectSetup.js.map +1 -0
- package/bin/agent/{RemoteAgent.d.ts → remote/RemoteAgent.d.ts} +3 -3
- package/bin/agent/remote/RemoteAgent.d.ts.map +1 -0
- package/bin/agent/remote/RemoteAgent.js +58 -0
- package/bin/agent/remote/RemoteAgent.js.map +1 -0
- package/bin/agent/remote/RemoteSession.d.ts +62 -0
- package/bin/agent/remote/RemoteSession.d.ts.map +1 -0
- package/bin/agent/remote/RemoteSession.js +225 -0
- package/bin/agent/remote/RemoteSession.js.map +1 -0
- package/bin/agent/remote/RemoteTransport.d.ts +52 -0
- package/bin/agent/remote/RemoteTransport.d.ts.map +1 -0
- package/bin/agent/remote/RemoteTransport.js +9 -0
- package/bin/agent/remote/RemoteTransport.js.map +1 -0
- package/bin/agent/remote/TransportFactory.d.ts +13 -0
- package/bin/agent/remote/TransportFactory.d.ts.map +1 -0
- package/bin/agent/remote/TransportFactory.js +22 -0
- package/bin/agent/remote/TransportFactory.js.map +1 -0
- package/bin/agent/remote/transports/HttpRemoteAgentTransport.d.ts +35 -0
- package/bin/agent/remote/transports/HttpRemoteAgentTransport.d.ts.map +1 -0
- package/bin/agent/remote/transports/HttpRemoteAgentTransport.js +259 -0
- package/bin/agent/remote/transports/HttpRemoteAgentTransport.js.map +1 -0
- package/bin/agent/remote/transports/RpcRemoteAgentTransport.d.ts +34 -0
- package/bin/agent/remote/transports/RpcRemoteAgentTransport.d.ts.map +1 -0
- package/bin/agent/remote/transports/RpcRemoteAgentTransport.js +66 -0
- package/bin/agent/remote/transports/RpcRemoteAgentTransport.js.map +1 -0
- package/bin/config/AgentInitializer.d.ts +1 -1
- package/bin/config/AgentInitializer.js +1 -1
- package/bin/executor/Executor.d.ts +4 -0
- package/bin/executor/Executor.d.ts.map +1 -1
- package/bin/executor/Executor.js +52 -35
- package/bin/executor/Executor.js.map +1 -1
- package/bin/executor/composer/history/SessionHistoryWriter.js +2 -2
- package/bin/executor/composer/history/SessionHistoryWriter.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/messages/AssistantResultPersistence.d.ts +3 -3
- package/bin/executor/messages/AssistantResultPersistence.d.ts.map +1 -1
- package/bin/executor/messages/AssistantResultPersistence.js +2 -6
- package/bin/executor/messages/AssistantResultPersistence.js.map +1 -1
- package/bin/executor/messages/SessionStepEventMapper.d.ts +7 -8
- package/bin/executor/messages/SessionStepEventMapper.d.ts.map +1 -1
- package/bin/executor/messages/SessionStepEventMapper.js +55 -86
- package/bin/executor/messages/SessionStepEventMapper.js.map +1 -1
- package/bin/executor/messages/UserVisibleText.d.ts +2 -10
- package/bin/executor/messages/UserVisibleText.d.ts.map +1 -1
- package/bin/executor/messages/UserVisibleText.js +3 -16
- package/bin/executor/messages/UserVisibleText.js.map +1 -1
- package/bin/executor/store/history/SessionHistoryStore.d.ts +12 -0
- package/bin/executor/store/history/SessionHistoryStore.d.ts.map +1 -1
- package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.d.ts +12 -0
- package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.d.ts.map +1 -1
- package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.js +145 -8
- package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.js.map +1 -1
- package/bin/executor/tools/shell/ShellToolFormatting.d.ts +1 -10
- package/bin/executor/tools/shell/ShellToolFormatting.d.ts.map +1 -1
- package/bin/executor/tools/shell/ShellToolFormatting.js +1 -39
- package/bin/executor/tools/shell/ShellToolFormatting.js.map +1 -1
- package/bin/executor/types/SessionHistoryPaths.d.ts +4 -0
- package/bin/executor/types/SessionHistoryPaths.d.ts.map +1 -1
- package/bin/index.d.ts +5 -5
- package/bin/index.d.ts.map +1 -1
- package/bin/index.js +3 -3
- package/bin/index.js.map +1 -1
- package/bin/plugin/core/PluginCommandRequest.d.ts +1 -1
- package/bin/plugin/core/PluginCommandRequest.js +1 -1
- package/bin/plugin/core/PluginLocalExecution.js +1 -1
- package/bin/plugin/core/PluginLocalExecution.js.map +1 -1
- package/bin/plugin/core/ProjectConfigStore.d.ts +3 -2
- package/bin/plugin/core/ProjectConfigStore.d.ts.map +1 -1
- package/bin/plugin/core/ProjectConfigStore.js +3 -4
- package/bin/plugin/core/ProjectConfigStore.js.map +1 -1
- package/bin/plugin/types/Plugin.d.ts +10 -842
- package/bin/plugin/types/Plugin.d.ts.map +1 -1
- package/bin/plugin/types/Plugin.js +3 -4
- package/bin/plugin/types/Plugin.js.map +1 -1
- package/bin/plugin/types/PluginApi.d.ts +1 -1
- package/bin/plugin/types/PluginApi.js +1 -1
- package/bin/plugin/types/PluginState.d.ts +1 -1
- package/bin/plugin/types/PluginState.d.ts.map +1 -1
- package/bin/rpc/Client.d.ts +2 -99
- package/bin/rpc/Client.d.ts.map +1 -1
- package/bin/rpc/Client.js +0 -46
- package/bin/rpc/Client.js.map +1 -1
- package/bin/rpc/Server.d.ts +5 -21
- package/bin/rpc/Server.d.ts.map +1 -1
- package/bin/rpc/Server.js +30 -315
- package/bin/rpc/Server.js.map +1 -1
- package/bin/rpc/server/InternalHandlers.d.ts +21 -0
- package/bin/rpc/server/InternalHandlers.d.ts.map +1 -0
- package/bin/rpc/server/InternalHandlers.js +190 -0
- package/bin/rpc/server/InternalHandlers.js.map +1 -0
- package/bin/rpc/server/RequestDispatcher.d.ts +27 -0
- package/bin/rpc/server/RequestDispatcher.d.ts.map +1 -0
- package/bin/rpc/server/RequestDispatcher.js +38 -0
- package/bin/rpc/server/RequestDispatcher.js.map +1 -0
- package/bin/rpc/server/SdkSessionHandlers.d.ts +25 -0
- package/bin/rpc/server/SdkSessionHandlers.d.ts.map +1 -0
- package/bin/rpc/server/SdkSessionHandlers.js +86 -0
- package/bin/rpc/server/SdkSessionHandlers.js.map +1 -0
- package/bin/rpc/server/ServerTypes.d.ts +59 -0
- package/bin/rpc/server/ServerTypes.d.ts.map +1 -0
- package/bin/rpc/server/ServerTypes.js +9 -0
- package/bin/rpc/server/ServerTypes.js.map +1 -0
- package/bin/{runtime/sandbox → sandbox}/MacOsSeatbeltSandbox.d.ts +1 -1
- package/bin/sandbox/MacOsSeatbeltSandbox.d.ts.map +1 -0
- package/bin/sandbox/MacOsSeatbeltSandbox.js.map +1 -0
- package/bin/{runtime/sandbox → sandbox}/SandboxConfigResolver.d.ts +2 -2
- package/bin/sandbox/SandboxConfigResolver.d.ts.map +1 -0
- package/bin/sandbox/SandboxConfigResolver.js.map +1 -0
- package/bin/{runtime/sandbox → sandbox}/SandboxRunner.d.ts +2 -2
- package/bin/sandbox/SandboxRunner.d.ts.map +1 -0
- package/bin/{runtime/sandbox → sandbox}/SandboxRunner.js +2 -2
- package/bin/sandbox/SandboxRunner.js.map +1 -0
- package/bin/sandbox/types/Sandbox.d.ts.map +1 -0
- package/bin/sandbox/types/Sandbox.js.map +1 -0
- package/bin/{runtime/sandbox → sandbox}/types/SandboxRuntime.d.ts +2 -2
- package/bin/sandbox/types/SandboxRuntime.d.ts.map +1 -0
- package/bin/sandbox/types/SandboxRuntime.js.map +1 -0
- package/bin/session/Session.d.ts.map +1 -1
- package/bin/session/Session.js +2 -1
- package/bin/session/Session.js.map +1 -1
- package/bin/session/browse/Browse.d.ts +1 -1
- package/bin/session/browse/Browse.d.ts.map +1 -1
- package/bin/session/browse/Browse.js +28 -13
- package/bin/session/browse/Browse.js.map +1 -1
- package/bin/session/index.d.ts +1 -1
- package/bin/session/index.d.ts.map +1 -1
- package/bin/session/index.js +1 -1
- package/bin/session/index.js.map +1 -1
- package/bin/session/storage/Paths.d.ts +9 -0
- package/bin/session/storage/Paths.d.ts.map +1 -1
- package/bin/session/storage/Paths.js +11 -0
- package/bin/session/storage/Paths.js.map +1 -1
- package/bin/types/agent/AgentOptions.d.ts +134 -0
- package/bin/types/agent/AgentOptions.d.ts.map +1 -0
- package/bin/types/agent/AgentOptions.js +9 -0
- package/bin/types/agent/AgentOptions.js.map +1 -0
- package/bin/types/{runtime/host/AgentHost.d.ts → agent/AgentRuntimeAssembly.d.ts} +4 -4
- package/bin/types/agent/AgentRuntimeAssembly.d.ts.map +1 -0
- package/bin/types/{runtime/host/AgentHost.js → agent/AgentRuntimeAssembly.js} +3 -3
- package/bin/types/agent/AgentRuntimeAssembly.js.map +1 -0
- package/bin/types/agent/AgentTypes.d.ts +8 -613
- package/bin/types/agent/AgentTypes.d.ts.map +1 -1
- package/bin/types/agent/AgentTypes.js +4 -4
- package/bin/types/agent/RemoteAgentOptions.d.ts +28 -0
- package/bin/types/agent/RemoteAgentOptions.d.ts.map +1 -0
- package/bin/types/agent/RemoteAgentOptions.js +9 -0
- package/bin/types/agent/RemoteAgentOptions.js.map +1 -0
- package/bin/types/agent/SessionActor.d.ts +60 -0
- package/bin/types/agent/SessionActor.d.ts.map +1 -0
- package/bin/types/agent/SessionActor.js +9 -0
- package/bin/types/agent/SessionActor.js.map +1 -0
- package/bin/types/agent/SessionTypes.d.ts +312 -0
- package/bin/types/agent/SessionTypes.d.ts.map +1 -0
- package/bin/types/agent/SessionTypes.js +9 -0
- package/bin/types/agent/SessionTypes.js.map +1 -0
- package/bin/types/config/DowncityConfig.d.ts +1 -1
- package/bin/types/config/DowncityConfig.d.ts.map +1 -1
- package/bin/types/{runtime/host → platform}/Store.d.ts +1 -1
- package/bin/types/platform/Store.d.ts.map +1 -0
- package/bin/types/{runtime/host → platform}/Store.js +1 -1
- package/bin/types/platform/Store.js.map +1 -0
- package/bin/types/plugin/PluginAction.d.ts +119 -0
- package/bin/types/plugin/PluginAction.d.ts.map +1 -0
- package/bin/types/plugin/PluginAction.js +9 -0
- package/bin/types/plugin/PluginAction.js.map +1 -0
- package/bin/types/plugin/PluginCommand.d.ts +80 -0
- package/bin/types/plugin/PluginCommand.d.ts.map +1 -0
- package/bin/types/plugin/PluginCommand.js +9 -0
- package/bin/types/plugin/PluginCommand.js.map +1 -0
- package/bin/types/plugin/PluginDefinition.d.ts +57 -0
- package/bin/types/plugin/PluginDefinition.d.ts.map +1 -0
- package/bin/types/plugin/PluginDefinition.js +9 -0
- package/bin/types/plugin/PluginDefinition.js.map +1 -0
- package/bin/types/plugin/PluginHttp.d.ts +34 -0
- package/bin/types/plugin/PluginHttp.d.ts.map +1 -0
- package/bin/types/plugin/PluginHttp.js +9 -0
- package/bin/types/plugin/PluginHttp.js.map +1 -0
- package/bin/types/plugin/PluginRuntime.d.ts +148 -0
- package/bin/types/plugin/PluginRuntime.d.ts.map +1 -0
- package/bin/types/plugin/PluginRuntime.js +9 -0
- package/bin/types/plugin/PluginRuntime.js.map +1 -0
- package/bin/types/plugin/PluginSetup.d.ts +133 -0
- package/bin/types/plugin/PluginSetup.d.ts.map +1 -0
- package/bin/types/plugin/PluginSetup.js +9 -0
- package/bin/types/plugin/PluginSetup.js.map +1 -0
- package/bin/types/plugin/PluginState.d.ts +69 -0
- package/bin/types/plugin/PluginState.d.ts.map +1 -0
- package/bin/types/plugin/PluginState.js +9 -0
- package/bin/types/plugin/PluginState.js.map +1 -0
- package/bin/types/rpc/RpcProtocol.d.ts +323 -0
- package/bin/types/rpc/RpcProtocol.d.ts.map +1 -0
- package/bin/types/rpc/RpcProtocol.js +10 -0
- package/bin/types/rpc/RpcProtocol.js.map +1 -0
- package/bin/types/runtime/agent/AgentContext.d.ts +1 -1
- package/bin/types/runtime/agent/AgentContext.d.ts.map +1 -1
- package/bin/types/runtime/agent/AgentRuntime.d.ts +1 -1
- package/bin/types/runtime/agent/AgentRuntime.d.ts.map +1 -1
- package/bin/types/runtime/platform/Platform.d.ts +7 -7
- package/bin/types/runtime/platform/PlatformGateway.d.ts +1 -1
- package/bin/types/runtime/platform/PlatformGateway.js +1 -1
- package/package.json +2 -2
- package/scripts/session-history-inflight.test.mjs +146 -0
- package/src/agent/{Agent.ts → local/Agent.ts} +50 -228
- package/src/agent/local/AgentInstructions.ts +68 -0
- package/src/agent/local/AgentPluginFactory.ts +83 -0
- package/src/{runtime/host/AgentHostRuntime.ts → agent/local/AgentRuntimeAssembly.ts} +2 -2
- package/src/agent/local/AgentRuntimeFactory.ts +173 -0
- package/src/{runtime/host → agent/local}/ProjectSetup.ts +1 -1
- package/src/agent/remote/RemoteAgent.ts +76 -0
- package/src/agent/remote/RemoteSession.ts +287 -0
- package/src/agent/remote/RemoteTransport.ts +71 -0
- package/src/agent/remote/TransportFactory.ts +29 -0
- package/src/agent/remote/transports/HttpRemoteAgentTransport.ts +347 -0
- package/src/agent/remote/transports/RpcRemoteAgentTransport.ts +107 -0
- package/src/config/AgentInitializer.ts +1 -1
- package/src/executor/Executor.ts +56 -37
- package/src/executor/composer/history/SessionHistoryWriter.ts +2 -2
- package/src/executor/composer/system/default/assets/core.prompt.ts +1 -1
- package/src/executor/composer/system/default/assets/core.prompt.ts.txt +1 -1
- package/src/executor/messages/AssistantResultPersistence.ts +4 -12
- package/src/executor/messages/SessionStepEventMapper.ts +59 -101
- package/src/executor/messages/UserVisibleText.ts +3 -18
- package/src/executor/store/history/SessionHistoryStore.ts +15 -0
- package/src/executor/store/history/jsonl/JsonlSessionHistoryStore.ts +164 -11
- package/src/executor/tools/shell/ShellToolFormatting.ts +1 -50
- package/src/executor/types/SessionHistoryPaths.ts +5 -0
- package/src/index.ts +5 -5
- package/src/plugin/core/PluginCommandRequest.ts +1 -1
- package/src/plugin/core/PluginLocalExecution.ts +1 -1
- package/src/plugin/core/ProjectConfigStore.ts +4 -4
- package/src/plugin/types/Plugin.ts +54 -913
- package/src/plugin/types/PluginApi.ts +1 -1
- package/src/plugin/types/PluginState.ts +1 -1
- package/src/rpc/Client.ts +16 -322
- package/src/rpc/Server.ts +39 -565
- package/src/rpc/server/InternalHandlers.ts +230 -0
- package/src/rpc/server/RequestDispatcher.ts +67 -0
- package/src/rpc/server/SdkSessionHandlers.ts +106 -0
- package/src/rpc/server/ServerTypes.ts +65 -0
- package/src/{runtime/sandbox → sandbox}/MacOsSeatbeltSandbox.ts +1 -1
- package/src/{runtime/sandbox → sandbox}/SandboxConfigResolver.ts +1 -1
- package/src/{runtime/sandbox → sandbox}/SandboxRunner.ts +3 -3
- package/src/{runtime/sandbox → sandbox}/types/SandboxRuntime.ts +2 -2
- package/src/session/Session.ts +6 -0
- package/src/session/browse/Browse.ts +29 -10
- package/src/session/index.ts +1 -0
- package/src/session/storage/Paths.ts +19 -0
- package/src/types/agent/AgentOptions.ts +147 -0
- package/src/types/{runtime/host/AgentHost.ts → agent/AgentRuntimeAssembly.ts} +2 -2
- package/src/types/agent/AgentTypes.ts +37 -709
- package/src/types/agent/RemoteAgentOptions.ts +29 -0
- package/src/types/agent/SessionActor.ts +88 -0
- package/src/types/agent/SessionTypes.ts +334 -0
- package/src/types/config/DowncityConfig.ts +1 -1
- package/src/types/{runtime/host → platform}/Store.ts +1 -1
- package/src/types/plugin/PluginAction.ts +133 -0
- package/src/types/plugin/PluginCommand.ts +89 -0
- package/src/types/plugin/PluginDefinition.ts +74 -0
- package/src/types/plugin/PluginHttp.ts +36 -0
- package/src/types/plugin/PluginRuntime.ts +169 -0
- package/src/types/plugin/PluginSetup.ts +138 -0
- package/src/types/plugin/PluginState.ts +82 -0
- package/src/types/rpc/RpcProtocol.ts +361 -0
- package/src/types/runtime/agent/AgentContext.ts +1 -1
- package/src/types/runtime/agent/AgentRuntime.ts +1 -1
- package/src/types/runtime/platform/Platform.ts +7 -7
- package/src/types/runtime/platform/PlatformGateway.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/bin/agent/Agent.d.ts.map +0 -1
- package/bin/agent/Agent.js.map +0 -1
- package/bin/agent/RemoteAgent.d.ts.map +0 -1
- package/bin/agent/RemoteAgent.js +0 -585
- package/bin/agent/RemoteAgent.js.map +0 -1
- package/bin/runtime/auth/AuthEnv.d.ts +0 -36
- package/bin/runtime/auth/AuthEnv.d.ts.map +0 -1
- package/bin/runtime/auth/AuthEnv.js +0 -54
- package/bin/runtime/auth/AuthEnv.js.map +0 -1
- package/bin/runtime/auth/CliAuthStateStore.d.ts +0 -29
- package/bin/runtime/auth/CliAuthStateStore.d.ts.map +0 -1
- package/bin/runtime/auth/CliAuthStateStore.js +0 -26
- package/bin/runtime/auth/CliAuthStateStore.js.map +0 -1
- package/bin/runtime/control/AuthControlService.d.ts +0 -34
- package/bin/runtime/control/AuthControlService.d.ts.map +0 -1
- package/bin/runtime/control/AuthControlService.js +0 -129
- package/bin/runtime/control/AuthControlService.js.map +0 -1
- package/bin/runtime/control/CommonHelpers.d.ts +0 -36
- package/bin/runtime/control/CommonHelpers.d.ts.map +0 -1
- package/bin/runtime/control/CommonHelpers.js +0 -63
- package/bin/runtime/control/CommonHelpers.js.map +0 -1
- package/bin/runtime/control/ExecuteBySession.d.ts +0 -30
- package/bin/runtime/control/ExecuteBySession.d.ts.map +0 -1
- package/bin/runtime/control/ExecuteBySession.js +0 -41
- package/bin/runtime/control/ExecuteBySession.js.map +0 -1
- package/bin/runtime/control/ExecuteInput.d.ts +0 -18
- package/bin/runtime/control/ExecuteInput.d.ts.map +0 -1
- package/bin/runtime/control/ExecuteInput.js +0 -201
- package/bin/runtime/control/ExecuteInput.js.map +0 -1
- package/bin/runtime/control/Helpers.d.ts +0 -13
- package/bin/runtime/control/Helpers.d.ts.map +0 -1
- package/bin/runtime/control/Helpers.js +0 -13
- package/bin/runtime/control/Helpers.js.map +0 -1
- package/bin/runtime/control/MessageTimeline.d.ts +0 -22
- package/bin/runtime/control/MessageTimeline.d.ts.map +0 -1
- package/bin/runtime/control/MessageTimeline.js +0 -226
- package/bin/runtime/control/MessageTimeline.js.map +0 -1
- package/bin/runtime/control/SessionSummaryStore.d.ts +0 -20
- package/bin/runtime/control/SessionSummaryStore.d.ts.map +0 -1
- package/bin/runtime/control/SessionSummaryStore.js +0 -50
- package/bin/runtime/control/SessionSummaryStore.js.map +0 -1
- package/bin/runtime/control/TaskStore.d.ts +0 -33
- package/bin/runtime/control/TaskStore.d.ts.map +0 -1
- package/bin/runtime/control/TaskStore.js +0 -175
- package/bin/runtime/control/TaskStore.js.map +0 -1
- package/bin/runtime/control/types/AuthControl.d.ts +0 -30
- package/bin/runtime/control/types/AuthControl.d.ts.map +0 -1
- package/bin/runtime/control/types/AuthControl.js +0 -9
- package/bin/runtime/control/types/AuthControl.js.map +0 -1
- package/bin/runtime/control/types/ControlSessionExecute.d.ts +0 -85
- package/bin/runtime/control/types/ControlSessionExecute.d.ts.map +0 -1
- package/bin/runtime/control/types/ControlSessionExecute.js +0 -9
- package/bin/runtime/control/types/ControlSessionExecute.js.map +0 -1
- package/bin/runtime/control/types/ControlViewData.d.ts +0 -320
- package/bin/runtime/control/types/ControlViewData.d.ts.map +0 -1
- package/bin/runtime/control/types/ControlViewData.js +0 -9
- package/bin/runtime/control/types/ControlViewData.js.map +0 -1
- package/bin/runtime/host/AgentHostRuntime.d.ts.map +0 -1
- package/bin/runtime/host/AgentHostRuntime.js.map +0 -1
- package/bin/runtime/host/ProjectSetup.d.ts.map +0 -1
- package/bin/runtime/host/ProjectSetup.js.map +0 -1
- package/bin/runtime/sandbox/MacOsSeatbeltSandbox.d.ts.map +0 -1
- package/bin/runtime/sandbox/MacOsSeatbeltSandbox.js.map +0 -1
- package/bin/runtime/sandbox/SandboxConfigResolver.d.ts.map +0 -1
- package/bin/runtime/sandbox/SandboxConfigResolver.js.map +0 -1
- package/bin/runtime/sandbox/SandboxRunner.d.ts.map +0 -1
- package/bin/runtime/sandbox/SandboxRunner.js.map +0 -1
- package/bin/runtime/sandbox/types/Sandbox.d.ts.map +0 -1
- package/bin/runtime/sandbox/types/Sandbox.js.map +0 -1
- package/bin/runtime/sandbox/types/SandboxRuntime.d.ts.map +0 -1
- package/bin/runtime/sandbox/types/SandboxRuntime.js.map +0 -1
- package/bin/types/runtime/host/AgentHost.d.ts.map +0 -1
- package/bin/types/runtime/host/AgentHost.js.map +0 -1
- package/bin/types/runtime/host/Store.d.ts.map +0 -1
- package/bin/types/runtime/host/Store.js.map +0 -1
- package/src/agent/RemoteAgent.ts +0 -834
- package/src/runtime/auth/AuthEnv.ts +0 -62
- package/src/runtime/auth/CliAuthStateStore.ts +0 -46
- package/src/runtime/control/AuthControlService.ts +0 -169
- package/src/runtime/control/CommonHelpers.ts +0 -69
- package/src/runtime/control/ExecuteBySession.ts +0 -52
- package/src/runtime/control/ExecuteInput.ts +0 -236
- package/src/runtime/control/Helpers.ts +0 -22
- package/src/runtime/control/MessageTimeline.ts +0 -269
- package/src/runtime/control/SessionSummaryStore.ts +0 -72
- package/src/runtime/control/TaskStore.ts +0 -242
- package/src/runtime/control/types/AuthControl.ts +0 -34
- package/src/runtime/control/types/ControlSessionExecute.ts +0 -99
- package/src/runtime/control/types/ControlViewData.ts +0 -392
- /package/bin/{runtime/sandbox → sandbox}/MacOsSeatbeltSandbox.js +0 -0
- /package/bin/{runtime/sandbox → sandbox}/SandboxConfigResolver.js +0 -0
- /package/bin/{runtime/sandbox → sandbox}/types/Sandbox.d.ts +0 -0
- /package/bin/{runtime/sandbox → sandbox}/types/Sandbox.js +0 -0
- /package/bin/{runtime/sandbox → sandbox}/types/SandboxRuntime.js +0 -0
- /package/src/{runtime/sandbox → sandbox}/types/Sandbox.ts +0 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RemoteAgent 构造类型。
|
|
3
|
+
*
|
|
4
|
+
* 关键点(中文)
|
|
5
|
+
* - RemoteAgent 只关心远程访问地址与可选鉴权 token。
|
|
6
|
+
* - HTTP 鉴权与 RPC 本机直连语义在 transport 层实现。
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* 远程 Agent 构造参数。
|
|
11
|
+
*/
|
|
12
|
+
export interface RemoteAgentOptions {
|
|
13
|
+
/**
|
|
14
|
+
* 远程 agent 访问地址。
|
|
15
|
+
*
|
|
16
|
+
* 例如:`https://city.example.com/agents/lucas`、`http://127.0.0.1:5314/agents/lucas`
|
|
17
|
+
* 或 `rpc://127.0.0.1:15314`
|
|
18
|
+
*/
|
|
19
|
+
url: string;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 访问远程 HTTP Agent 时使用的 Bearer token。
|
|
23
|
+
*
|
|
24
|
+
* 关键点(中文)
|
|
25
|
+
* - 仅 `http://` / `https://` transport 会携带该 token。
|
|
26
|
+
* - `rpc://` 是本机内部直连通道,不读取也不发送 token。
|
|
27
|
+
*/
|
|
28
|
+
token?: string;
|
|
29
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent session actor 接口类型。
|
|
3
|
+
*
|
|
4
|
+
* 关键点(中文)
|
|
5
|
+
* - 这里只描述 session 的可调用能力。
|
|
6
|
+
* - session 的数据结构、history/system payload 放在 `SessionTypes.ts`。
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type {
|
|
10
|
+
AgentCreateSessionInput,
|
|
11
|
+
AgentListSessionsInput,
|
|
12
|
+
AgentSessionConfigSnapshot,
|
|
13
|
+
AgentSessionForkInput,
|
|
14
|
+
AgentSessionHistoryInput,
|
|
15
|
+
AgentSessionHistoryPage,
|
|
16
|
+
AgentSessionInfo,
|
|
17
|
+
AgentSessionSetInput,
|
|
18
|
+
AgentSessionSummaryPage,
|
|
19
|
+
AgentSessionSystemSnapshot,
|
|
20
|
+
} from "@/types/agent/SessionTypes.js";
|
|
21
|
+
import type {
|
|
22
|
+
AgentSessionSubscriber,
|
|
23
|
+
AgentSessionUnsubscribe,
|
|
24
|
+
} from "@/types/sdk/AgentSessionEvent.js";
|
|
25
|
+
import type { AgentSessionPromptInput } from "@/types/sdk/AgentSessionPrompt.js";
|
|
26
|
+
import type { AgentSessionTurnHandle } from "@/types/sdk/AgentSessionTurn.js";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* SDK Session 集合绑定。
|
|
30
|
+
*/
|
|
31
|
+
export interface AgentSessionCollection {
|
|
32
|
+
/** 新建一个 session。 */
|
|
33
|
+
createSession(input?: AgentCreateSessionInput): Promise<AgentSession>;
|
|
34
|
+
|
|
35
|
+
/** 获取一个已存在的 session。 */
|
|
36
|
+
getSession(sessionId: string): Promise<AgentSession>;
|
|
37
|
+
|
|
38
|
+
/** 列出当前 agent 的 session 摘要页。 */
|
|
39
|
+
listSessions(input?: AgentListSessionsInput): Promise<AgentSessionSummaryPage>;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Session actor 公共能力。
|
|
44
|
+
*/
|
|
45
|
+
export interface AgentSessionActor {
|
|
46
|
+
/** 当前 session 稳定标识。 */
|
|
47
|
+
readonly id: string;
|
|
48
|
+
|
|
49
|
+
/** 读取当前 session 详情。 */
|
|
50
|
+
getInfo(): Promise<AgentSessionInfo>;
|
|
51
|
+
|
|
52
|
+
/** 追加一条新的 prompt。 */
|
|
53
|
+
prompt(input: AgentSessionPromptInput): Promise<AgentSessionTurnHandle>;
|
|
54
|
+
|
|
55
|
+
/** 订阅当前 session 的未来事件。 */
|
|
56
|
+
subscribe(subscriber: AgentSessionSubscriber): AgentSessionUnsubscribe;
|
|
57
|
+
|
|
58
|
+
/** 读取当前 session 历史分页。 */
|
|
59
|
+
history(input?: AgentSessionHistoryInput): Promise<AgentSessionHistoryPage>;
|
|
60
|
+
|
|
61
|
+
/** 读取当前 session 生效的 system 快照。 */
|
|
62
|
+
system(): Promise<AgentSessionSystemSnapshot>;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* 本地 Agent 返回的公开 session 接口。
|
|
67
|
+
*/
|
|
68
|
+
export interface AgentSession extends AgentSessionActor {
|
|
69
|
+
/** 当前 session 所属 agentId。 */
|
|
70
|
+
readonly agentId: string;
|
|
71
|
+
|
|
72
|
+
/** 当前 session 配置快照。 */
|
|
73
|
+
readonly config: AgentSessionConfigSnapshot;
|
|
74
|
+
|
|
75
|
+
/** 写入当前 session 默认配置。 */
|
|
76
|
+
set(input: AgentSessionSetInput): Promise<void>;
|
|
77
|
+
|
|
78
|
+
/** 从当前 session 创建一个分叉会话。 */
|
|
79
|
+
fork(input?: AgentSessionForkInput | string): Promise<AgentSession>;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* 远程 Agent 返回的公开 session 接口。
|
|
84
|
+
*/
|
|
85
|
+
export interface RemoteAgentSession extends AgentSessionActor {
|
|
86
|
+
/** 从当前远程 session 创建一个分叉会话。 */
|
|
87
|
+
fork(input?: AgentSessionForkInput | string): Promise<RemoteAgentSession>;
|
|
88
|
+
}
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent session 数据类型。
|
|
3
|
+
*
|
|
4
|
+
* 关键点(中文)
|
|
5
|
+
* - 只描述 session 的输入、摘要、历史、system snapshot 与配置快照。
|
|
6
|
+
* - session actor 方法接口拆到 `SessionActor.ts`。
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { LanguageModel } from "ai";
|
|
10
|
+
import type { AgentModel } from "@/model/CityModelAdapter.js";
|
|
11
|
+
import type { SessionMessageV1 } from "@/executor/types/SessionMessages.js";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* 新建 session 的输入参数。
|
|
15
|
+
*/
|
|
16
|
+
export interface AgentCreateSessionInput {
|
|
17
|
+
/**
|
|
18
|
+
* 可选显式 sessionId。
|
|
19
|
+
*
|
|
20
|
+
* 关键点(中文)
|
|
21
|
+
* - 传入时表达“创建意图”。
|
|
22
|
+
* - 若该 session 已存在,SDK 应直接报错,而不是静默复用。
|
|
23
|
+
* - 省略时由 SDK 自动生成稳定且不可推导的 sessionId。
|
|
24
|
+
*/
|
|
25
|
+
sessionId?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Session 列表查询输入。
|
|
30
|
+
*/
|
|
31
|
+
export interface AgentListSessionsInput {
|
|
32
|
+
/**
|
|
33
|
+
* 当前页返回上限。
|
|
34
|
+
*
|
|
35
|
+
* 说明(中文)
|
|
36
|
+
* - 省略时由 SDK 使用默认值。
|
|
37
|
+
* - 建议宿主 UI 明确传入,避免在大量 session 下拉取过多数据。
|
|
38
|
+
*/
|
|
39
|
+
limit?: number;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* 分页游标。
|
|
43
|
+
*
|
|
44
|
+
* 说明(中文)
|
|
45
|
+
* - 当前使用 SDK 自身生成的透明字符串游标。
|
|
46
|
+
* - 调用方只负责透传,不应自行解析其内部格式。
|
|
47
|
+
*/
|
|
48
|
+
cursor?: string;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* 关键词过滤。
|
|
52
|
+
*
|
|
53
|
+
* 说明(中文)
|
|
54
|
+
* - 推荐用于匹配 `sessionId`、标题与预览文本。
|
|
55
|
+
* - 属于轻量包含匹配,不承诺复杂搜索语义。
|
|
56
|
+
*/
|
|
57
|
+
query?: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Session 可变配置。
|
|
62
|
+
*/
|
|
63
|
+
export interface AgentSessionSetInput {
|
|
64
|
+
/**
|
|
65
|
+
* 当前 session 默认模型实例。
|
|
66
|
+
*
|
|
67
|
+
* 关键点(中文)
|
|
68
|
+
* - 这里接受运行中的模型实例,而不是模型 ID。
|
|
69
|
+
* - 由于模型实例通常不可序列化,落盘只保留轻量可读标签用于展示。
|
|
70
|
+
*/
|
|
71
|
+
model?: AgentModel;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Session 当前配置快照。
|
|
76
|
+
*/
|
|
77
|
+
export interface AgentSessionConfigSnapshot {
|
|
78
|
+
/** 当前 session 绑定的默认模型实例。 */
|
|
79
|
+
model?: LanguageModel;
|
|
80
|
+
/** 当前模型的轻量可读标签。 */
|
|
81
|
+
modelLabel?: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Session 历史视图类型。
|
|
86
|
+
*/
|
|
87
|
+
export type AgentSessionHistoryView = "message" | "timeline";
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Session 时间线事件。
|
|
91
|
+
*/
|
|
92
|
+
export interface AgentSessionTimelineEvent {
|
|
93
|
+
/** 当前事件唯一标识。 */
|
|
94
|
+
id: string;
|
|
95
|
+
/**
|
|
96
|
+
* 当前事件角色。
|
|
97
|
+
*
|
|
98
|
+
* 说明(中文)
|
|
99
|
+
* - `tool-call` / `tool-result` 用于把 assistant 内部工具过程平铺给 UI。
|
|
100
|
+
*/
|
|
101
|
+
role: "user" | "assistant" | "tool-call" | "tool-result";
|
|
102
|
+
/** 事件时间戳(毫秒)。 */
|
|
103
|
+
ts?: number;
|
|
104
|
+
/** 事件所属消息种类。 */
|
|
105
|
+
kind?: string;
|
|
106
|
+
/** 事件来源。 */
|
|
107
|
+
source?: string;
|
|
108
|
+
/** 当前事件展示文本。 */
|
|
109
|
+
text: string;
|
|
110
|
+
/**
|
|
111
|
+
* 当前事件对应工具名称。
|
|
112
|
+
*
|
|
113
|
+
* 说明(中文)
|
|
114
|
+
* - 仅 `tool-call` / `tool-result` 这类事件通常会携带该字段。
|
|
115
|
+
*/
|
|
116
|
+
toolName?: string;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Session system block 来源类型。
|
|
121
|
+
*/
|
|
122
|
+
export type AgentSessionSystemBlockSource =
|
|
123
|
+
| "core"
|
|
124
|
+
| "instruction"
|
|
125
|
+
| "plugin"
|
|
126
|
+
| "session";
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Session system prompt 的单个组成块。
|
|
130
|
+
*/
|
|
131
|
+
export interface AgentSessionSystemBlock {
|
|
132
|
+
/** 当前 block 的来源层级。 */
|
|
133
|
+
source: AgentSessionSystemBlockSource;
|
|
134
|
+
/**
|
|
135
|
+
* 当前 block 在来源层级内的名称。
|
|
136
|
+
*
|
|
137
|
+
* 说明(中文)
|
|
138
|
+
* - `instruction` 通常使用 `agent`。
|
|
139
|
+
* - `plugin` 使用对应 plugin 名称。
|
|
140
|
+
* - `core` 使用 `default`。
|
|
141
|
+
* - `session` 使用当前 session 上下文名称。
|
|
142
|
+
*/
|
|
143
|
+
name: string;
|
|
144
|
+
/**
|
|
145
|
+
* 已归一化后的 system 文本内容。
|
|
146
|
+
*
|
|
147
|
+
* 关键点(中文)
|
|
148
|
+
* - SDK 不对 instruction 做动态变量替换。
|
|
149
|
+
* - 动态上下文应由调用方放入 user message。
|
|
150
|
+
*/
|
|
151
|
+
content: string;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* 当前 session 的稳定上下文信息。
|
|
156
|
+
*/
|
|
157
|
+
export interface AgentSessionSystemSessionInfo {
|
|
158
|
+
/** 当前 session 所属 agentId。 */
|
|
159
|
+
agentId: string;
|
|
160
|
+
/** 当前 session 唯一标识。 */
|
|
161
|
+
sessionId: string;
|
|
162
|
+
/** 当前 agent 绑定的项目根目录。 */
|
|
163
|
+
projectRoot: string;
|
|
164
|
+
/**
|
|
165
|
+
* 当前 session 首次创建时间。
|
|
166
|
+
*
|
|
167
|
+
* 关键点(中文)
|
|
168
|
+
* - 这是 session 初始化时落盘的稳定参考时间,按 Date/ISO 字符串对外展示。
|
|
169
|
+
* - 它不是每轮运行的当前时间,不会随着后续 turn 执行而改变。
|
|
170
|
+
*/
|
|
171
|
+
createdAt: string;
|
|
172
|
+
/**
|
|
173
|
+
* 当前 session 初始化时解析到的系统时区。
|
|
174
|
+
*
|
|
175
|
+
* 关键点(中文)
|
|
176
|
+
* - 这是 session 级参考时区,随创建信息一起固定。
|
|
177
|
+
* - 它不是每轮运行重新解析的动态时区。
|
|
178
|
+
*/
|
|
179
|
+
timezone: string;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* 当前 session 生效的完整 system prompt 快照。
|
|
184
|
+
*/
|
|
185
|
+
export interface AgentSessionSystemSnapshot {
|
|
186
|
+
/** 当前 sessionId。 */
|
|
187
|
+
sessionId: string;
|
|
188
|
+
/**
|
|
189
|
+
* 当前 session 的稳定上下文信息。
|
|
190
|
+
*
|
|
191
|
+
* 关键点(中文)
|
|
192
|
+
* - 这里包含 session 创建时间这类稳定参考信息。
|
|
193
|
+
* - 这里不包含当前时间、轮次、用户输入等每轮变化的数据。
|
|
194
|
+
* - 每轮动态信息应由调用方放入 user message,避免破坏 instruction 缓存命中。
|
|
195
|
+
*/
|
|
196
|
+
session: AgentSessionSystemSessionInfo;
|
|
197
|
+
/** 当前生效的 system blocks,按进入模型的顺序排列。 */
|
|
198
|
+
blocks: AgentSessionSystemBlock[];
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Session 摘要。
|
|
203
|
+
*/
|
|
204
|
+
export interface AgentSessionSummary {
|
|
205
|
+
/** 当前 session 所属 agentId。 */
|
|
206
|
+
agentId: string;
|
|
207
|
+
/** 当前 session 唯一标识。 */
|
|
208
|
+
sessionId: string;
|
|
209
|
+
/**
|
|
210
|
+
* 当前 session 可读标题。
|
|
211
|
+
*
|
|
212
|
+
* 说明(中文)
|
|
213
|
+
* - 标题持久化在 session `meta.json` 顶层。
|
|
214
|
+
* - 首条用户消息出现后,SDK 会优先生成标题,失败时回退到首条用户消息截断。
|
|
215
|
+
* - 空 session 可能暂时没有标题,调用方可回退到 `sessionId`。
|
|
216
|
+
*/
|
|
217
|
+
title?: string;
|
|
218
|
+
/**
|
|
219
|
+
* 当前 session 的最近预览文本。
|
|
220
|
+
*
|
|
221
|
+
* 说明(中文)
|
|
222
|
+
* - 通常来自最后一条用户可见消息的裁剪文本。
|
|
223
|
+
* - 适合用于侧边栏、列表卡片或 session picker。
|
|
224
|
+
*/
|
|
225
|
+
previewText?: string;
|
|
226
|
+
/** 当前 session 首次创建时间(ms)。 */
|
|
227
|
+
createdAt?: number;
|
|
228
|
+
/** 当前 session 最近一次更新时间(ms)。 */
|
|
229
|
+
updatedAt?: number;
|
|
230
|
+
/** 当前 session 已落盘消息数。 */
|
|
231
|
+
messageCount: number;
|
|
232
|
+
/** 当前 session 绑定模型的可读标签。 */
|
|
233
|
+
modelLabel?: string;
|
|
234
|
+
/** 当前 session 是否处于执行中。 */
|
|
235
|
+
executing?: boolean;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Session 详情。
|
|
240
|
+
*/
|
|
241
|
+
export interface AgentSessionInfo extends AgentSessionSummary {
|
|
242
|
+
/** 当前 session 初始化时记录的时区。 */
|
|
243
|
+
timezone?: string;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Session 摘要分页结果。
|
|
248
|
+
*/
|
|
249
|
+
export interface AgentSessionSummaryPage {
|
|
250
|
+
/** 当前页 session 摘要列表。 */
|
|
251
|
+
items: AgentSessionSummary[];
|
|
252
|
+
/**
|
|
253
|
+
* 当前页所对应的总条数。
|
|
254
|
+
*
|
|
255
|
+
* 说明(中文)
|
|
256
|
+
* - 这里表示过滤后的总数,不是仅当前页数量。
|
|
257
|
+
* - 对分页 UI、结果统计和空态判断更友好。
|
|
258
|
+
*/
|
|
259
|
+
total: number;
|
|
260
|
+
/** 下一页游标。 */
|
|
261
|
+
nextCursor?: string;
|
|
262
|
+
/** 是否仍有更多结果。 */
|
|
263
|
+
hasMore: boolean;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Session 历史读取输入。
|
|
268
|
+
*/
|
|
269
|
+
export interface AgentSessionHistoryInput {
|
|
270
|
+
/** 当前页返回上限。 */
|
|
271
|
+
limit?: number;
|
|
272
|
+
/** 分页游标。 */
|
|
273
|
+
cursor?: string;
|
|
274
|
+
/**
|
|
275
|
+
* 返回顺序。
|
|
276
|
+
*
|
|
277
|
+
* 说明(中文)
|
|
278
|
+
* - `asc`:从旧到新
|
|
279
|
+
* - `desc`:从新到旧
|
|
280
|
+
*/
|
|
281
|
+
order?: "asc" | "desc";
|
|
282
|
+
/**
|
|
283
|
+
* 返回视图类型。
|
|
284
|
+
*
|
|
285
|
+
* 说明(中文)
|
|
286
|
+
* - `message`:原始 session 消息
|
|
287
|
+
* - `timeline`:适合直接渲染 UI 的平铺事件
|
|
288
|
+
*/
|
|
289
|
+
view?: AgentSessionHistoryView;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Session 历史分页结果。
|
|
294
|
+
*/
|
|
295
|
+
export interface AgentSessionHistoryPage {
|
|
296
|
+
/** 当前读取所对应的 session 信息。 */
|
|
297
|
+
session: AgentSessionInfo;
|
|
298
|
+
/** 当前页实际返回视图。 */
|
|
299
|
+
view: AgentSessionHistoryView;
|
|
300
|
+
/**
|
|
301
|
+
* 当前页数据列表。
|
|
302
|
+
*
|
|
303
|
+
* 说明(中文)
|
|
304
|
+
* - `view=message` 时返回 `SessionMessageV1[]`
|
|
305
|
+
* - `view=timeline` 时返回 `AgentSessionTimelineEvent[]`
|
|
306
|
+
*/
|
|
307
|
+
items: SessionMessageV1[] | AgentSessionTimelineEvent[];
|
|
308
|
+
/**
|
|
309
|
+
* 过滤前后的总条数。
|
|
310
|
+
*
|
|
311
|
+
* 说明(中文)
|
|
312
|
+
* - 对 `view=message` 表示消息条数。
|
|
313
|
+
* - 对 `view=timeline` 表示时间线事件条数。
|
|
314
|
+
*/
|
|
315
|
+
total: number;
|
|
316
|
+
/** 下一页游标。 */
|
|
317
|
+
nextCursor?: string;
|
|
318
|
+
/** 是否仍有更多数据。 */
|
|
319
|
+
hasMore: boolean;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Session fork 输入。
|
|
324
|
+
*/
|
|
325
|
+
export interface AgentSessionForkInput {
|
|
326
|
+
/**
|
|
327
|
+
* 可选分叉锚点消息 ID。
|
|
328
|
+
*
|
|
329
|
+
* 关键点(中文)
|
|
330
|
+
* - 省略时复制当前 session 的完整消息历史。
|
|
331
|
+
* - 传入时复制到该消息为止(包含该消息)。
|
|
332
|
+
*/
|
|
333
|
+
messageId?: string;
|
|
334
|
+
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import type { LlmConfig } from "@/types/config/LlmConfig.js";
|
|
9
9
|
import type { ExecutionBindingConfig } from "@/types/config/ExecutionBinding.js";
|
|
10
10
|
import type { JsonObject } from "@/types/common/Json.js";
|
|
11
|
-
import type { SandboxProjectConfig } from "@/
|
|
11
|
+
import type { SandboxProjectConfig } from "@/sandbox/types/Sandbox.js";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* 单个聊天渠道配置。
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin action 类型。
|
|
3
|
+
*
|
|
4
|
+
* 关键点(中文)
|
|
5
|
+
* - action 是 plugin 对外暴露的显式能力。
|
|
6
|
+
* - CLI / HTTP 只是 action 的输入适配层,真正执行器统一走 `execute`。
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { Command } from "commander";
|
|
10
|
+
import type { Context as HonoContext } from "hono";
|
|
11
|
+
import type { AgentContext } from "@/types/runtime/agent/AgentContext.js";
|
|
12
|
+
import type { JsonValue } from "@/types/common/Json.js";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Plugin action 调用参数。
|
|
16
|
+
*/
|
|
17
|
+
export interface PluginActionInvokeParams {
|
|
18
|
+
/** 目标 plugin 名称。 */
|
|
19
|
+
plugin: string;
|
|
20
|
+
/** 目标 action 名称。 */
|
|
21
|
+
action: string;
|
|
22
|
+
/** 调用 payload(可选)。 */
|
|
23
|
+
payload?: JsonValue;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Plugin action 调用结果。
|
|
28
|
+
*/
|
|
29
|
+
export interface PluginActionInvokeResult {
|
|
30
|
+
/** 调用是否成功。 */
|
|
31
|
+
success: boolean;
|
|
32
|
+
/** 结构化返回数据(可选)。 */
|
|
33
|
+
data?: JsonValue;
|
|
34
|
+
/** 错误信息(可选)。 */
|
|
35
|
+
error?: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Plugin action 调用端口。
|
|
40
|
+
*/
|
|
41
|
+
export interface PluginActionInvokePort {
|
|
42
|
+
/** 调用指定 plugin action。 */
|
|
43
|
+
invoke(
|
|
44
|
+
params: PluginActionInvokeParams,
|
|
45
|
+
): Promise<PluginActionInvokeResult>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Plugin Action 执行结果。
|
|
50
|
+
*/
|
|
51
|
+
export interface PluginActionResult<R extends JsonValue = JsonValue> {
|
|
52
|
+
/** Action 是否成功。 */
|
|
53
|
+
success: boolean;
|
|
54
|
+
/** 返回数据(可选)。 */
|
|
55
|
+
data?: R;
|
|
56
|
+
/** 错误信息(可选)。 */
|
|
57
|
+
error?: string;
|
|
58
|
+
/** 人类可读消息(可选)。 */
|
|
59
|
+
message?: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Plugin Action 命令输入。
|
|
64
|
+
*/
|
|
65
|
+
export interface PluginActionCommandInput {
|
|
66
|
+
/** 位置参数列表。 */
|
|
67
|
+
args: string[];
|
|
68
|
+
/** 选项参数对象。 */
|
|
69
|
+
opts: Record<string, JsonValue>;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Plugin Action CLI 定义。
|
|
74
|
+
*/
|
|
75
|
+
export interface PluginActionCommand<P extends JsonValue = JsonValue> {
|
|
76
|
+
/** 命令说明。 */
|
|
77
|
+
description: string;
|
|
78
|
+
/** 额外 commander 配置(可选)。 */
|
|
79
|
+
configure?: (command: Command) => void;
|
|
80
|
+
/** 将 CLI 输入映射为 payload。 */
|
|
81
|
+
mapInput: (input: PluginActionCommandInput) => P | Promise<P>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Plugin Action HTTP 定义。
|
|
86
|
+
*/
|
|
87
|
+
export interface PluginActionApi<P extends JsonValue = JsonValue> {
|
|
88
|
+
/** HTTP 方法。 */
|
|
89
|
+
method?: "GET" | "POST" | "PUT" | "DELETE";
|
|
90
|
+
/** HTTP 路径。 */
|
|
91
|
+
path?: string;
|
|
92
|
+
/** 将 HTTP 输入映射为 payload(可选)。 */
|
|
93
|
+
mapInput?: (ctx: HonoContext) => P | Promise<P>;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Plugin Action 定义。
|
|
98
|
+
*/
|
|
99
|
+
export interface PluginAction<
|
|
100
|
+
P extends JsonValue = JsonValue,
|
|
101
|
+
R extends JsonValue = JsonValue,
|
|
102
|
+
> {
|
|
103
|
+
/**
|
|
104
|
+
* disabled 状态下是否仍允许执行。
|
|
105
|
+
*
|
|
106
|
+
* 说明(中文)
|
|
107
|
+
* - 用于 `on` / `status` / `models` / `configure` / `install` 这类 setup 相关 action。
|
|
108
|
+
* - 默认 false,避免 disabled plugin 绕过 registry 保护执行普通业务 action。
|
|
109
|
+
*/
|
|
110
|
+
allowWhenDisabled?: boolean;
|
|
111
|
+
/** CLI 定义(可选)。 */
|
|
112
|
+
command?: PluginActionCommand<P>;
|
|
113
|
+
/** HTTP 定义(可选)。 */
|
|
114
|
+
api?: PluginActionApi<P>;
|
|
115
|
+
/** Action 执行器。 */
|
|
116
|
+
execute: (params: {
|
|
117
|
+
/** 当前执行上下文。 */
|
|
118
|
+
context: AgentContext;
|
|
119
|
+
/** 输入 payload。 */
|
|
120
|
+
payload: P;
|
|
121
|
+
/** 当前插件名称。 */
|
|
122
|
+
pluginName: string;
|
|
123
|
+
/** 当前 Action 名称。 */
|
|
124
|
+
actionName: string;
|
|
125
|
+
}) => Promise<PluginActionResult<R>> | PluginActionResult<R>;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Plugin Action 集合。
|
|
130
|
+
*/
|
|
131
|
+
export type PluginActions = {
|
|
132
|
+
[actionName: string]: PluginAction<JsonValue, JsonValue>;
|
|
133
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin command 与 lifecycle 类型。
|
|
3
|
+
*
|
|
4
|
+
* 关键点(中文)
|
|
5
|
+
* - command 面向显式 CLI/control 调用。
|
|
6
|
+
* - lifecycle 面向 runtime 主动 start/stop 钩子。
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type {
|
|
10
|
+
AgentPathRuntime,
|
|
11
|
+
AgentPluginConfigRuntime,
|
|
12
|
+
} from "@/types/agent/AgentRuntimeAssembly.js";
|
|
13
|
+
import type { AgentContext } from "@/types/runtime/agent/AgentContext.js";
|
|
14
|
+
import type { Logger } from "@/utils/logger/Logger.js";
|
|
15
|
+
import type { DowncityConfig } from "@/types/config/DowncityConfig.js";
|
|
16
|
+
import type { JsonValue } from "@/types/common/Json.js";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Plugin 命令执行上下文。
|
|
20
|
+
*
|
|
21
|
+
* 关键点(中文)
|
|
22
|
+
* - 这里表达的是“CLI 命令执行 plugin 时真正需要的最小上下文”。
|
|
23
|
+
* - plugin 命令不应依赖 session、plugin invoke、agent runtime 等长期宿主对象。
|
|
24
|
+
* - agent runtime 在需要复用 action 时,直接传入自身更完整的 AgentContext 即可。
|
|
25
|
+
*/
|
|
26
|
+
export interface PluginCommandContext {
|
|
27
|
+
/** 当前命令工作目录。 */
|
|
28
|
+
cwd: string;
|
|
29
|
+
/** 当前项目根目录。 */
|
|
30
|
+
rootPath: string;
|
|
31
|
+
/** 当前统一日志器。 */
|
|
32
|
+
logger: Logger;
|
|
33
|
+
/** 当前解析后的项目配置。 */
|
|
34
|
+
config: DowncityConfig;
|
|
35
|
+
/**
|
|
36
|
+
* 当前项目环境变量快照。
|
|
37
|
+
*
|
|
38
|
+
* 关键点(中文)
|
|
39
|
+
* - 这里约定为宿主已经整理好的最终可见 env 视图。
|
|
40
|
+
* - plugin 不再区分 global env 与 agent env,避免上下文语义膨胀。
|
|
41
|
+
*/
|
|
42
|
+
env: Record<string, string>;
|
|
43
|
+
/** 当前可见的路径能力集合。 */
|
|
44
|
+
paths: AgentPathRuntime;
|
|
45
|
+
/** 当前可见的 plugin 配置持久化能力集合。 */
|
|
46
|
+
pluginConfig: AgentPluginConfigRuntime;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Plugin 非 action 命令执行参数。
|
|
51
|
+
*/
|
|
52
|
+
export interface PluginCommandParams {
|
|
53
|
+
/** 当前统一执行上下文。 */
|
|
54
|
+
context: AgentContext;
|
|
55
|
+
/** 当前命令名称。 */
|
|
56
|
+
command: string;
|
|
57
|
+
/** 命令附带 payload(可选)。 */
|
|
58
|
+
payload?: JsonValue;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Plugin 非 action 命令执行结果。
|
|
63
|
+
*/
|
|
64
|
+
export interface PluginCommandResult {
|
|
65
|
+
/** 本次命令是否成功。 */
|
|
66
|
+
success: boolean;
|
|
67
|
+
/** 人类可读消息。 */
|
|
68
|
+
message?: string;
|
|
69
|
+
/** 结构化返回数据。 */
|
|
70
|
+
data?: JsonValue;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Plugin 生命周期兼容定义。
|
|
75
|
+
*
|
|
76
|
+
* 关键点(中文)
|
|
77
|
+
* - 这是从旧运行生命周期过渡过来的兼容层。
|
|
78
|
+
* - 新代码优先直接实现 `start/stop/command`。
|
|
79
|
+
*/
|
|
80
|
+
export interface PluginLifecycle {
|
|
81
|
+
/** plugin 启动钩子。 */
|
|
82
|
+
start?(context: AgentContext): Promise<void> | void;
|
|
83
|
+
/** plugin 停止钩子。 */
|
|
84
|
+
stop?(context: AgentContext): Promise<void> | void;
|
|
85
|
+
/** plugin 非 action 命令钩子。 */
|
|
86
|
+
command?(
|
|
87
|
+
params: PluginCommandParams,
|
|
88
|
+
): Promise<PluginCommandResult> | PluginCommandResult;
|
|
89
|
+
}
|