@downcity/agent 1.1.74 → 1.1.81
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 +15 -18
- package/bin/agent/local/Agent.d.ts +82 -0
- package/bin/agent/local/Agent.d.ts.map +1 -0
- package/bin/agent/local/Agent.js +154 -0
- 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 +73 -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/local/services/AgentAssemblyService.d.ts +112 -0
- package/bin/agent/local/services/AgentAssemblyService.d.ts.map +1 -0
- package/bin/agent/local/services/AgentAssemblyService.js +135 -0
- package/bin/agent/local/services/AgentAssemblyService.js.map +1 -0
- package/bin/agent/local/services/AgentLifecycleService.d.ts +59 -0
- package/bin/agent/local/services/AgentLifecycleService.d.ts.map +1 -0
- package/bin/agent/local/services/AgentLifecycleService.js +136 -0
- package/bin/agent/local/services/AgentLifecycleService.js.map +1 -0
- package/bin/agent/local/services/AgentSessionManager.d.ts +106 -0
- package/bin/agent/local/services/AgentSessionManager.d.ts.map +1 -0
- package/bin/agent/local/services/AgentSessionManager.js +182 -0
- package/bin/agent/local/services/AgentSessionManager.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/executor/Executor.d.ts +7 -20
- package/bin/executor/Executor.d.ts.map +1 -1
- package/bin/executor/Executor.js +77 -348
- package/bin/executor/Executor.js.map +1 -1
- package/bin/executor/SessionRunScope.d.ts +18 -34
- package/bin/executor/SessionRunScope.d.ts.map +1 -1
- package/bin/executor/SessionRunScope.js +42 -28
- package/bin/executor/SessionRunScope.js.map +1 -1
- package/bin/executor/composer/context/LocalSessionContextComposer.d.ts +5 -3
- package/bin/executor/composer/context/LocalSessionContextComposer.d.ts.map +1 -1
- package/bin/executor/composer/context/LocalSessionContextComposer.js +11 -18
- package/bin/executor/composer/context/LocalSessionContextComposer.js.map +1 -1
- package/bin/executor/composer/context/SessionContextComposer.d.ts +8 -3
- package/bin/executor/composer/context/SessionContextComposer.d.ts.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/SessionSystemComposer.d.ts +2 -1
- package/bin/executor/composer/system/SessionSystemComposer.d.ts.map +1 -1
- package/bin/executor/composer/system/default/DefaultSessionSystemComposer.d.ts +2 -1
- package/bin/executor/composer/system/default/DefaultSessionSystemComposer.d.ts.map +1 -1
- package/bin/executor/composer/system/default/DefaultSessionSystemComposer.js +2 -4
- package/bin/executor/composer/system/default/DefaultSessionSystemComposer.js.map +1 -1
- package/bin/executor/core-engine/CoreEngineRunner.d.ts +62 -0
- package/bin/executor/core-engine/CoreEngineRunner.d.ts.map +1 -0
- package/bin/executor/core-engine/CoreEngineRunner.js +309 -0
- package/bin/executor/core-engine/CoreEngineRunner.js.map +1 -0
- package/bin/executor/core-engine/CoreEngineUiStreamCollector.d.ts +5 -0
- package/bin/executor/core-engine/CoreEngineUiStreamCollector.d.ts.map +1 -1
- package/bin/executor/core-engine/CoreEngineUiStreamCollector.js +2 -4
- package/bin/executor/core-engine/CoreEngineUiStreamCollector.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/services/ExecutorInflightService.d.ts +39 -0
- package/bin/executor/services/ExecutorInflightService.d.ts.map +1 -0
- package/bin/executor/services/ExecutorInflightService.js +75 -0
- package/bin/executor/services/ExecutorInflightService.js.map +1 -0
- package/bin/executor/services/ExecutorRecoveryPolicy.d.ts +103 -0
- package/bin/executor/services/ExecutorRecoveryPolicy.d.ts.map +1 -0
- package/bin/executor/services/ExecutorRecoveryPolicy.js +87 -0
- package/bin/executor/services/ExecutorRecoveryPolicy.js.map +1 -0
- 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/plugin/PluginToolBridge.d.ts +19 -0
- package/bin/executor/tools/plugin/PluginToolBridge.d.ts.map +1 -0
- package/bin/executor/tools/plugin/PluginToolBridge.js +143 -0
- package/bin/executor/tools/plugin/PluginToolBridge.js.map +1 -0
- package/bin/executor/tools/plugin/PluginToolDefinition.d.ts +32 -0
- package/bin/executor/tools/plugin/PluginToolDefinition.d.ts.map +1 -0
- package/bin/executor/tools/plugin/PluginToolDefinition.js +27 -0
- package/bin/executor/tools/plugin/PluginToolDefinition.js.map +1 -0
- package/bin/executor/tools/plugin/PluginToolSchemas.d.ts +14 -0
- package/bin/executor/tools/plugin/PluginToolSchemas.d.ts.map +1 -0
- package/bin/executor/tools/plugin/PluginToolSchemas.js +19 -0
- package/bin/executor/tools/plugin/PluginToolSchemas.js.map +1 -0
- package/bin/executor/tools/plugin/types/PluginTool.d.ts +39 -0
- package/bin/executor/tools/plugin/types/PluginTool.d.ts.map +1 -0
- package/bin/executor/tools/plugin/types/PluginTool.js +9 -0
- package/bin/executor/tools/plugin/types/PluginTool.js.map +1 -0
- package/bin/executor/tools/shell/ShellToolBridge.js +3 -3
- package/bin/executor/tools/shell/ShellToolBridge.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/executor/types/SessionRun.d.ts +18 -0
- package/bin/executor/types/SessionRun.d.ts.map +1 -1
- package/bin/index.d.ts +15 -6
- package/bin/index.d.ts.map +1 -1
- package/bin/index.js +6 -3
- package/bin/index.js.map +1 -1
- package/bin/plugin/core/BasePlugin.d.ts +2 -2
- package/bin/plugin/core/BasePlugin.d.ts.map +1 -1
- package/bin/plugin/core/BasePlugin.js.map +1 -1
- package/bin/plugin/core/ImagePlugin.d.ts +56 -0
- package/bin/plugin/core/ImagePlugin.d.ts.map +1 -0
- package/bin/plugin/core/ImagePlugin.js +109 -0
- package/bin/plugin/core/ImagePlugin.js.map +1 -0
- 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/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 +14 -83
- package/bin/session/Session.d.ts.map +1 -1
- package/bin/session/Session.js +140 -362
- package/bin/session/Session.js.map +1 -1
- package/bin/session/SessionSystemBuilder.d.ts +2 -1
- package/bin/session/SessionSystemBuilder.d.ts.map +1 -1
- package/bin/session/SessionSystemBuilder.js +2 -3
- package/bin/session/SessionSystemBuilder.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/services/SessionStateService.d.ts +132 -0
- package/bin/session/services/SessionStateService.d.ts.map +1 -0
- package/bin/session/services/SessionStateService.js +242 -0
- package/bin/session/services/SessionStateService.js.map +1 -0
- package/bin/session/services/SessionTurnService.d.ts +66 -0
- package/bin/session/services/SessionTurnService.d.ts.map +1 -0
- package/bin/session/services/SessionTurnService.js +137 -0
- package/bin/session/services/SessionTurnService.js.map +1 -0
- package/bin/session/services/SessionViewService.d.ts +105 -0
- package/bin/session/services/SessionViewService.d.ts.map +1 -0
- package/bin/session/services/SessionViewService.js +184 -0
- package/bin/session/services/SessionViewService.js.map +1 -0
- 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 +152 -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 +10 -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/executor/SessionRunContext.d.ts +66 -0
- package/bin/types/executor/SessionRunContext.d.ts.map +1 -0
- package/bin/types/executor/SessionRunContext.js +10 -0
- package/bin/types/executor/SessionRunContext.js.map +1 -0
- 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/ImagePlugin.d.ts +94 -0
- package/bin/types/plugin/ImagePlugin.d.ts.map +1 -0
- package/bin/types/plugin/ImagePlugin.js +10 -0
- package/bin/types/plugin/ImagePlugin.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/session/SessionComposerOptions.d.ts +90 -0
- package/bin/types/session/SessionComposerOptions.d.ts.map +1 -0
- package/bin/types/session/SessionComposerOptions.js +10 -0
- package/bin/types/session/SessionComposerOptions.js.map +1 -0
- package/bin/types/session/SessionLocalState.d.ts +35 -0
- package/bin/types/session/SessionLocalState.d.ts.map +1 -0
- package/bin/types/session/SessionLocalState.js +10 -0
- package/bin/types/session/SessionLocalState.js.map +1 -0
- package/bin/types/session/SessionOptions.d.ts +85 -0
- package/bin/types/session/SessionOptions.d.ts.map +1 -0
- package/bin/types/session/SessionOptions.js +10 -0
- package/bin/types/session/SessionOptions.js.map +1 -0
- package/package.json +2 -2
- package/scripts/session-history-inflight.test.mjs +146 -0
- package/src/agent/local/Agent.ts +197 -0
- 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 +152 -0
- package/src/{runtime/host → agent/local}/ProjectSetup.ts +1 -1
- package/src/agent/local/services/AgentAssemblyService.ts +268 -0
- package/src/agent/local/services/AgentLifecycleService.ts +187 -0
- package/src/agent/local/services/AgentSessionManager.ts +291 -0
- 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/executor/Executor.ts +107 -426
- package/src/executor/README.md +4 -4
- package/src/executor/SessionRunScope.ts +47 -71
- package/src/executor/composer/context/LocalSessionContextComposer.ts +24 -20
- package/src/executor/composer/context/SessionContextComposer.ts +13 -3
- package/src/executor/composer/history/SessionHistoryWriter.ts +2 -2
- package/src/executor/composer/system/SessionSystemComposer.ts +2 -1
- package/src/executor/composer/system/default/DefaultSessionSystemComposer.ts +3 -4
- package/src/executor/core-engine/CoreEngineRunner.ts +433 -0
- package/src/executor/core-engine/CoreEngineUiStreamCollector.ts +7 -5
- 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/services/ExecutorInflightService.ts +101 -0
- package/src/executor/services/ExecutorRecoveryPolicy.ts +213 -0
- package/src/executor/store/history/SessionHistoryStore.ts +15 -0
- package/src/executor/store/history/jsonl/JsonlSessionHistoryStore.ts +164 -11
- package/src/executor/tools/plugin/PluginToolBridge.ts +161 -0
- package/src/executor/tools/plugin/PluginToolDefinition.ts +32 -0
- package/src/executor/tools/plugin/PluginToolSchemas.ts +20 -0
- package/src/executor/tools/plugin/types/PluginTool.ts +41 -0
- package/src/executor/tools/shell/ShellToolBridge.ts +3 -3
- package/src/executor/tools/shell/ShellToolFormatting.ts +1 -50
- package/src/executor/types/SessionHistoryPaths.ts +5 -0
- package/src/executor/types/SessionRun.ts +20 -0
- package/src/index.ts +38 -5
- package/src/plugin/core/BasePlugin.ts +2 -2
- package/src/plugin/core/ImagePlugin.ts +128 -0
- 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/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 +184 -485
- package/src/session/SessionSystemBuilder.ts +3 -3
- package/src/session/browse/Browse.ts +29 -10
- package/src/session/index.ts +1 -0
- package/src/session/services/SessionStateService.ts +341 -0
- package/src/session/services/SessionTurnService.ts +202 -0
- package/src/session/services/SessionViewService.ts +301 -0
- package/src/session/storage/Paths.ts +19 -0
- package/src/types/agent/AgentOptions.ts +172 -0
- package/src/types/{runtime/host/AgentHost.ts → agent/AgentRuntimeAssembly.ts} +2 -2
- package/src/types/agent/AgentTypes.ts +47 -709
- package/src/types/agent/RemoteAgentOptions.ts +29 -0
- package/src/types/agent/SessionActor.ts +88 -0
- package/src/types/agent/SessionTypes.ts +335 -0
- package/src/types/config/DowncityConfig.ts +1 -1
- package/src/types/executor/SessionRunContext.ts +76 -0
- package/src/types/{runtime/host → platform}/Store.ts +1 -1
- package/src/types/plugin/ImagePlugin.ts +103 -0
- 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/session/SessionComposerOptions.ts +107 -0
- package/src/types/session/SessionLocalState.ts +40 -0
- package/src/types/session/SessionOptions.ts +99 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/bin/agent/Agent.d.ts +0 -223
- package/bin/agent/Agent.d.ts.map +0 -1
- package/bin/agent/Agent.js +0 -627
- 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/Agent.ts +0 -734
- 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,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin tool 类型定义。
|
|
3
|
+
*
|
|
4
|
+
* 关键点(中文)
|
|
5
|
+
* - 这里描述模型通过 plugin_call 提交的最低层调用协议。
|
|
6
|
+
* - payload 保持 JSON 对象,避免 tool 层理解具体 plugin 的业务字段。
|
|
7
|
+
*/
|
|
8
|
+
import type { JsonObject } from "../../../../types/common/Json.js";
|
|
9
|
+
/**
|
|
10
|
+
* plugin_call 输入。
|
|
11
|
+
*/
|
|
12
|
+
export interface PluginCallInput {
|
|
13
|
+
/** 目标 plugin 名称。 */
|
|
14
|
+
plugin: string;
|
|
15
|
+
/** 目标 action 名称。 */
|
|
16
|
+
action: string;
|
|
17
|
+
/** 传给 plugin action 的 JSON payload。 */
|
|
18
|
+
payload?: JsonObject;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* plugin_call 返回给模型的摘要结果。
|
|
22
|
+
*/
|
|
23
|
+
export interface PluginCallToolResult {
|
|
24
|
+
/** 调用是否成功。 */
|
|
25
|
+
success: boolean;
|
|
26
|
+
/** 目标 plugin 名称。 */
|
|
27
|
+
plugin: string;
|
|
28
|
+
/** 目标 action 名称。 */
|
|
29
|
+
action: string;
|
|
30
|
+
/** 本次 action 产生并写入 assistant 消息的 file part 数量。 */
|
|
31
|
+
assistant_file_count: number;
|
|
32
|
+
/** 人类可读消息。 */
|
|
33
|
+
message: string;
|
|
34
|
+
/** 错误信息。 */
|
|
35
|
+
error?: string;
|
|
36
|
+
/** 返回给模型读取的短摘要数据。 */
|
|
37
|
+
data?: JsonObject;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=PluginTool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PluginTool.d.ts","sourceRoot":"","sources":["../../../../../src/executor/tools/plugin/types/PluginTool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,oBAAoB;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,oBAAoB;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,OAAO,CAAC,EAAE,UAAU,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,cAAc;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,oBAAoB;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,oBAAoB;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,kDAAkD;IAClD,oBAAoB,EAAE,MAAM,CAAC;IAC7B,cAAc;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB;IACrB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PluginTool.js","sourceRoot":"","sources":["../../../../../src/executor/tools/plugin/types/PluginTool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* - runtime 注入、桥接协议解析、输出扁平化都收敛在这里,避免 `Tool.ts` 继续膨胀。
|
|
7
7
|
*/
|
|
8
8
|
import { generateId } from "../../../utils/Id.js";
|
|
9
|
-
import { enqueueDeferredPersistedUserMessage, enqueueInjectedUserMessage,
|
|
9
|
+
import { enqueueDeferredPersistedUserMessage, enqueueInjectedUserMessage, getSessionRunContext, } from "../../SessionRunScope.js";
|
|
10
10
|
let shellToolRuntime = null;
|
|
11
11
|
/**
|
|
12
12
|
* 通用命令桥接状态表(按 shell_id)。
|
|
@@ -55,8 +55,8 @@ function shouldEnableCommandBridge(command) {
|
|
|
55
55
|
return /(?:^|\s)(?:city|town)(?:\s|$)/i.test(raw);
|
|
56
56
|
}
|
|
57
57
|
async function injectUserTextMessage(params) {
|
|
58
|
-
const
|
|
59
|
-
const sessionId = String(
|
|
58
|
+
const run_context = getSessionRunContext();
|
|
59
|
+
const sessionId = String(run_context?.sessionId || "").trim();
|
|
60
60
|
const text = String(params.text || "").trim();
|
|
61
61
|
if (!sessionId || !text)
|
|
62
62
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShellToolBridge.js","sourceRoot":"","sources":["../../../../src/executor/tools/shell/ShellToolBridge.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAO3C,OAAO,EACL,mCAAmC,EACnC,0BAA0B,EAC1B,
|
|
1
|
+
{"version":3,"file":"ShellToolBridge.js","sourceRoot":"","sources":["../../../../src/executor/tools/shell/ShellToolBridge.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAO3C,OAAO,EACL,mCAAmC,EACnC,0BAA0B,EAC1B,oBAAoB,GACrB,MAAM,8BAA8B,CAAC;AAYtC,IAAI,gBAAgB,GAA4B,IAAI,CAAC;AAErD;;GAEG;AACH,MAAM,mBAAmB,GAAG,IAAI,GAAG,EAA8B,CAAC;AAElE,MAAM,UAAU,mBAAmB,CAAC,IAAsB;IACxD,gBAAgB,GAAG,IAAI,CAAC;AAC1B,CAAC;AAED,SAAS,uBAAuB;IAC9B,IAAI,gBAAgB;QAAE,OAAO,gBAAgB,CAAC;IAC9C,MAAM,IAAI,KAAK,CACb,uGAAuG,CACxG,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,KAAc;IAClC,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,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AAI,KAAK,CAAC,SAAS,MAAM,CAAC,MAAM,wBAAwB,CAAC,CAAC;IAClE,CAAC;IACD,MAAM,QAAQ,GAAG,IAAsC,CAAC;IACxD,IAAI,CAAC,QAAQ,CAAC,KAAK,IAAI,OAAO,QAAQ,CAAC,KAAK,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QAClE,MAAM,IAAI,KAAK,CAAC,SAAS,MAAM,CAAC,MAAM,iCAAiC,CAAC,CAAC;IAC3E,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAC7B,MAAc,EACd,KAAc;IAEd,OAAO;QACL,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,GAAG,MAAM,KAAK,MAAM,CAAC,KAAK,CAAC,EAAE;KACrC,CAAC;AACJ,CAAC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
5
|
* - shell 会话生命周期已经统一收敛到 shell plugin runtime。
|
|
6
|
-
* - 这里仅保留当前仍被 tool
|
|
6
|
+
* - 这里仅保留当前仍被 tool 与测试复用的最小能力:命令安全校验。
|
|
7
7
|
*/
|
|
8
8
|
/**
|
|
9
9
|
* 对 `town chat send` 命令做前置安全校验。
|
|
@@ -14,13 +14,4 @@
|
|
|
14
14
|
* - 默认建议多行正文通过 `--stdin`、`--text-file` 或显式 `--text` 传入。
|
|
15
15
|
*/
|
|
16
16
|
export declare function validateChatSendCommand(cmd: string): string | null;
|
|
17
|
-
/**
|
|
18
|
-
* 构建 shell 子进程环境变量。
|
|
19
|
-
*
|
|
20
|
-
* 关键点(中文)
|
|
21
|
-
* - 当前仍用于 shell tool / shell runtime 与相关测试。
|
|
22
|
-
* - 优先级:显式注入 > 当前请求上下文变量 > 宿主进程环境。
|
|
23
|
-
* - 默认剥离 Bearer Token,避免通用 shell 隐式走本地 HTTP。
|
|
24
|
-
*/
|
|
25
|
-
export declare function buildShellContextEnv(injected?: Record<string, string>): NodeJS.ProcessEnv;
|
|
26
17
|
//# sourceMappingURL=ShellToolFormatting.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShellToolFormatting.d.ts","sourceRoot":"","sources":["../../../../src/executor/tools/shell/ShellToolFormatting.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"ShellToolFormatting.d.ts","sourceRoot":"","sources":["../../../../src/executor/tools/shell/ShellToolFormatting.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAiBlE"}
|
|
@@ -3,28 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
5
|
* - shell 会话生命周期已经统一收敛到 shell plugin runtime。
|
|
6
|
-
* - 这里仅保留当前仍被 tool
|
|
6
|
+
* - 这里仅保留当前仍被 tool 与测试复用的最小能力:命令安全校验。
|
|
7
7
|
*/
|
|
8
|
-
import { stripInvocationAuthEnv } from "../../../runtime/auth/AuthEnv.js";
|
|
9
|
-
import { getSessionRunScope } from "../../SessionRunScope.js";
|
|
10
|
-
function setEnvString(env, key, value) {
|
|
11
|
-
if (typeof value !== "string")
|
|
12
|
-
return;
|
|
13
|
-
const trimmed = value.trim();
|
|
14
|
-
if (!trimmed)
|
|
15
|
-
return;
|
|
16
|
-
env[key] = trimmed;
|
|
17
|
-
}
|
|
18
|
-
function applyEnvMap(env, entries) {
|
|
19
|
-
if (!entries)
|
|
20
|
-
return;
|
|
21
|
-
for (const [rawKey, rawValue] of Object.entries(entries)) {
|
|
22
|
-
const key = String(rawKey || "").trim();
|
|
23
|
-
if (!key)
|
|
24
|
-
continue;
|
|
25
|
-
setEnvString(env, key, rawValue);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
8
|
/**
|
|
29
9
|
* 对 `town chat send` 命令做前置安全校验。
|
|
30
10
|
*
|
|
@@ -53,22 +33,4 @@ export function validateChatSendCommand(cmd) {
|
|
|
53
33
|
"If your message is multi-line, use `town chat send --stdin` (with heredoc/pipe), `--text-file`, or explicit `--text`.",
|
|
54
34
|
].join(" ");
|
|
55
35
|
}
|
|
56
|
-
/**
|
|
57
|
-
* 构建 shell 子进程环境变量。
|
|
58
|
-
*
|
|
59
|
-
* 关键点(中文)
|
|
60
|
-
* - 当前仍用于 shell tool / shell runtime 与相关测试。
|
|
61
|
-
* - 优先级:显式注入 > 当前请求上下文变量 > 宿主进程环境。
|
|
62
|
-
* - 默认剥离 Bearer Token,避免通用 shell 隐式走本地 HTTP。
|
|
63
|
-
*/
|
|
64
|
-
export function buildShellContextEnv(injected) {
|
|
65
|
-
const env = { ...process.env };
|
|
66
|
-
const contextCtx = getSessionRunScope();
|
|
67
|
-
applyEnvMap(env, injected);
|
|
68
|
-
setEnvString(env, "DC_SESSION_ID", contextCtx?.sessionId);
|
|
69
|
-
setEnvString(env, "DC_CITY_HOST", process.env.DC_CITY_HOST);
|
|
70
|
-
setEnvString(env, "DC_CITY_PORT", process.env.DC_CITY_PORT);
|
|
71
|
-
stripInvocationAuthEnv(env);
|
|
72
|
-
return env;
|
|
73
|
-
}
|
|
74
36
|
//# sourceMappingURL=ShellToolFormatting.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShellToolFormatting.js","sourceRoot":"","sources":["../../../../src/executor/tools/shell/ShellToolFormatting.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH
|
|
1
|
+
{"version":3,"file":"ShellToolFormatting.js","sourceRoot":"","sources":["../../../../src/executor/tools/shell/ShellToolFormatting.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;GAOG;AACH,MAAM,UAAU,uBAAuB,CAAC,GAAW;IACjD,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC;IACjC,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,MAAM,CAAC;QAAE,OAAO,IAAI,CAAC;IACvD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC;QAAE,OAAO,IAAI,CAAC;IACxC,IAAI,+CAA+C,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACjE,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,8CAA8C,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QAChE,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,mDAAmD,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACrE,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO;QACL,iEAAiE;QACjE,uHAAuH;KACxH,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACd,CAAC"}
|
|
@@ -26,5 +26,9 @@ export type SessionHistoryPathOverrides = {
|
|
|
26
26
|
* 历史归档目录(通常是 `.../messages/archive`)。
|
|
27
27
|
*/
|
|
28
28
|
archiveDirPath?: string;
|
|
29
|
+
/**
|
|
30
|
+
* 运行中 assistant 快照路径(通常是 `.../messages/inflight.json`)。
|
|
31
|
+
*/
|
|
32
|
+
inflightFilePath?: string;
|
|
29
33
|
};
|
|
30
34
|
//# sourceMappingURL=SessionHistoryPaths.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionHistoryPaths.d.ts","sourceRoot":"","sources":["../../../src/executor/types/SessionHistoryPaths.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"SessionHistoryPaths.d.ts","sourceRoot":"","sources":["../../../src/executor/types/SessionHistoryPaths.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC"}
|
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import type { Tool, UIMessageChunk } from "ai";
|
|
10
10
|
import type { SessionMessageV1 } from "../../executor/types/SessionMessages.js";
|
|
11
|
+
import type { SessionUserMessageV1 } from "../../executor/types/SessionMessages.js";
|
|
11
12
|
import type { SessionSystemMessage } from "../../executor/types/SessionPrompts.js";
|
|
13
|
+
import type { SessionRunContext } from "../../types/executor/SessionRunContext.js";
|
|
12
14
|
/**
|
|
13
15
|
* Assistant step 可见性。
|
|
14
16
|
*
|
|
@@ -78,6 +80,14 @@ export interface SessionRunResult {
|
|
|
78
80
|
* 最终 assistant 消息。
|
|
79
81
|
*/
|
|
80
82
|
assistantMessage: SessionMessageV1;
|
|
83
|
+
/**
|
|
84
|
+
* 本轮执行结束后待写入长期历史的 user 消息。
|
|
85
|
+
*
|
|
86
|
+
* 关键点(中文)
|
|
87
|
+
* - 这些消息通常由 tool 运行时在执行过程中动态注入。
|
|
88
|
+
* - 为保证消息顺序稳定,统一在 assistant 结果落盘后再由外层 Session 持久化。
|
|
89
|
+
*/
|
|
90
|
+
deferredPersistedUserMessages?: SessionUserMessageV1[];
|
|
81
91
|
}
|
|
82
92
|
/**
|
|
83
93
|
* Session 运行入口输入。
|
|
@@ -87,6 +97,14 @@ export interface SessionRunInput {
|
|
|
87
97
|
* 本轮用户输入查询文本。
|
|
88
98
|
*/
|
|
89
99
|
query: string;
|
|
100
|
+
/**
|
|
101
|
+
* 本轮显式运行上下文。
|
|
102
|
+
*
|
|
103
|
+
* 关键点(中文)
|
|
104
|
+
* - 这里承载 step 合并、UI chunk 回调等跨组件运行期数据。
|
|
105
|
+
* - 若未传入,则由执行器按最小默认值兜底创建。
|
|
106
|
+
*/
|
|
107
|
+
runContext?: SessionRunContext;
|
|
90
108
|
}
|
|
91
109
|
/**
|
|
92
110
|
* Executor 通过 Composer 装配后的中间运行态。
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionRun.d.ts","sourceRoot":"","sources":["../../../src/executor/types/SessionRun.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE/E;;;;;;GAMG;AACH,MAAM,MAAM,8BAA8B,GAAG,SAAS,GAAG,UAAU,CAAC;AAEpE;;GAEG;AACH,MAAM,WAAW,iCAAiC;IAChD;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,8BAA8B,CAAC;IAE5C;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG,CACzC,KAAK,EAAE,iCAAiC,KACrC,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnB;;;;;;GAMG;AACH,MAAM,MAAM,qBAAqB,GAAG,cAAc,CAAC;AAEn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1C,KAAK,EAAE,qBAAqB,KACzB,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnB;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,gBAAgB,EAAE,gBAAgB,CAAC;IAEnC;;;;;;OAMG;IACH,6BAA6B,CAAC,EAAE,oBAAoB,EAAE,CAAC;CACxD;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,iBAAiB,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,MAAM,EAAE,oBAAoB,EAAE,CAAC;IAE/B;;OAEG;IACH,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAE7B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;CAC7B"}
|
package/bin/index.d.ts
CHANGED
|
@@ -6,22 +6,30 @@
|
|
|
6
6
|
* - 只导出 Agent、plugin 作者 API、city 运行集成 API 与跨包协议类型。
|
|
7
7
|
* - HTTP router、sandbox runner、内部 plugin runtime runner 等实现细节不从根入口暴露。
|
|
8
8
|
*/
|
|
9
|
-
export { Agent } from "./agent/Agent.js";
|
|
10
|
-
export { RemoteAgent } from "./agent/RemoteAgent.js";
|
|
9
|
+
export { Agent } from "./agent/local/Agent.js";
|
|
10
|
+
export { RemoteAgent } from "./agent/remote/RemoteAgent.js";
|
|
11
|
+
export { Session } from "./session/Session.js";
|
|
12
|
+
export type { SessionOptions } from "./types/session/SessionOptions.js";
|
|
11
13
|
export { inferAgentModelLabel, normalizeAgentModel, } from "./model/CityModelAdapter.js";
|
|
12
|
-
export type { AgentSessionCollection, AgentModel, AgentSessionActor, AgentSession, AgentCreateSessionInput, AgentListSessionsInput, AgentOptions, AgentRpcBinding, AgentRpcStartOptions, AgentStartOptions, AgentStartResult, AgentStopResult, RemoteAgentOptions, AgentSessionConfigSnapshot, AgentSessionForkInput, AgentSessionHistoryInput, AgentSessionHistoryPage, AgentSessionHistoryView, AgentSessionInfo, AgentSessionSetInput, AgentSessionSummary, AgentSessionSummaryPage, AgentSessionSystemBlock, AgentSessionSystemBlockSource, AgentSessionSystemSessionInfo, AgentSessionSystemSnapshot, AgentSessionTimelineEvent, RemoteAgentSession, } from "./types/agent/AgentTypes.js";
|
|
14
|
+
export type { AgentSessionCollection, AgentModel, AgentManagedSession, AgentSessionActor, AgentSession, AgentSessionConstructor, AgentCreateSessionInput, AgentListSessionsInput, AgentOptions, AgentRpcBinding, AgentRpcStartOptions, AgentStartOptions, AgentStartResult, AgentStopResult, RemoteAgentOptions, AgentSessionConfigSnapshot, AgentSessionForkInput, AgentSessionHistoryInput, AgentSessionHistoryPage, AgentSessionHistoryView, AgentSessionInfo, AgentSessionSetInput, AgentSessionSummary, AgentSessionSummaryPage, AgentSessionSystemBlock, AgentSessionSystemBlockSource, AgentSessionSystemSessionInfo, AgentSessionSystemSnapshot, AgentSessionTimelineEvent, RemoteAgentSession, } from "./types/agent/AgentTypes.js";
|
|
13
15
|
export type { AgentSessionEvent, AgentSessionSubscriber, AgentSessionUnsubscribe, } from "./types/sdk/AgentSessionEvent.js";
|
|
14
16
|
export type { AgentSessionPromptInput } from "./types/sdk/AgentSessionPrompt.js";
|
|
15
17
|
export type { AgentSessionTurnHandle, AgentSessionTurnResult, } from "./types/sdk/AgentSessionTurn.js";
|
|
16
18
|
export type { AgentRuntime, AgentRuntimeBase } from "./types/runtime/agent/AgentRuntime.js";
|
|
17
19
|
export type { AgentContext, InvokePluginPort, SessionCollectionPort, SessionPort, StructuredConfig, } from "./types/runtime/agent/AgentContext.js";
|
|
18
20
|
export { BasePlugin } from "./plugin/core/BasePlugin.js";
|
|
21
|
+
export { ImagePlugin } from "./plugin/core/ImagePlugin.js";
|
|
19
22
|
export { Executor } from "./executor/Executor.js";
|
|
20
23
|
export { drainDeferredPersistedUserMessages, getSessionRunScope, } from "./executor/SessionRunScope.js";
|
|
21
24
|
export { JsonlSessionHistoryComposer } from "./executor/composer/history/jsonl/JsonlSessionHistoryComposer.js";
|
|
25
|
+
export { LocalSessionContextComposer } from "./executor/composer/context/LocalSessionContextComposer.js";
|
|
22
26
|
export { JsonlSessionHistoryStore } from "./executor/store/history/jsonl/JsonlSessionHistoryStore.js";
|
|
23
27
|
export { JsonlSessionCompactionComposer } from "./executor/composer/compaction/jsonl/JsonlSessionCompactionComposer.js";
|
|
28
|
+
export type { SessionCompactionComposer, SessionCompactionInput, } from "./executor/composer/compaction/SessionCompactionComposer.js";
|
|
29
|
+
export type { SessionContextComposer, SessionContextComposeResult, } from "./executor/composer/context/SessionContextComposer.js";
|
|
30
|
+
export type { SessionHistoryComposer, SessionHistoryPrepareInput, } from "./executor/composer/history/SessionHistoryComposer.js";
|
|
24
31
|
export type { SessionSystemComposer } from "./executor/composer/system/SessionSystemComposer.js";
|
|
32
|
+
export type { SessionComposerFactoryContext, SessionComposerInput, SessionComposerOptions, } from "./types/session/SessionComposerOptions.js";
|
|
25
33
|
export { transformPromptsIntoSystemMessages } from "./executor/composer/system/default/PromptRenderer.js";
|
|
26
34
|
export { loadStaticSystemPrompts, StaticPromptCatalog, } from "./executor/composer/system/default/StaticPromptCatalog.js";
|
|
27
35
|
export { shellTools } from "./executor/tools/shell/ShellToolDefinition.js";
|
|
@@ -37,10 +45,10 @@ export { pickLastSuccessfulChatSendText, resolveAssistantMessageForPersistence,
|
|
|
37
45
|
export { persistProjectPluginConfig } from "./plugin/core/ProjectConfigStore.js";
|
|
38
46
|
export { initializeAgentProject, isAgentProjectInitialized, normalizeDefaultAgentId, } from "./config/AgentInitializer.js";
|
|
39
47
|
export { loadDowncityConfig } from "./config/Config.js";
|
|
40
|
-
export { ensureRuntimeProjectReady, } from "./
|
|
48
|
+
export { ensureRuntimeProjectReady, } from "./agent/local/ProjectSetup.js";
|
|
41
49
|
export { assertProjectExecutionTarget } from "./config/ExecutionBinding.js";
|
|
42
50
|
export { getLogger, logger, type Logger } from "./utils/logger/Logger.js";
|
|
43
|
-
export type { AgentPathRuntime, AgentPluginConfigRuntime, } from "./types/
|
|
51
|
+
export type { AgentPathRuntime, AgentPluginConfigRuntime, } from "./types/agent/AgentRuntimeAssembly.js";
|
|
44
52
|
export type { AgentProjectChannel, AgentProjectInitializationInput, AgentProjectInitializationResult, } from "./types/config/AgentProject.js";
|
|
45
53
|
export type { ExecutionBindingConfig } from "./types/config/ExecutionBinding.js";
|
|
46
54
|
export type { DowncityConfig } from "./types/config/DowncityConfig.js";
|
|
@@ -49,13 +57,14 @@ export type { JsonObject, JsonPrimitive, JsonValue } from "./types/common/Json.j
|
|
|
49
57
|
export type { ControlPlaneRuntimeMeta, ControlPlaneRuntimeStatus, ManagedAgentProcessView, ManagedAgentRegistryEntry, ManagedAgentRegistryV1, PlatformAgentDirectoryInspection, PlatformAgentOption, PlatformAgentsResponse, PlatformConfigFileStatusItem, PlatformConfigStatusResponse, PlatformLocalModelsResponse, } from "./types/runtime/platform/Platform.js";
|
|
50
58
|
export type { PlatformAgentChatChannelStatus, PlatformAgentShipChatChannelsConfig, PlatformAgentShipChatPluginConfig, PlatformAgentShipExecutionAgentConfig, PlatformAgentShipExecutionConfig, PlatformAgentShipJson, PlatformAgentShipPluginsConfig, PlatformAgentShipSingleChannelConfig, PlatformAgentShipStartConfig, } from "./types/runtime/platform/PlatformGateway.js";
|
|
51
59
|
export type { InlineInstantExecutorType, PlatformInlineInstantRunInput, PlatformInlineInstantRunResult, PlatformInlineInstantRunner, } from "./types/runtime/http/InlineInstant.js";
|
|
60
|
+
export type { ImagePluginContent, ImagePluginFileContent, ImagePluginInput, ImagePluginMessage, ImagePluginOptions, ImagePluginResult, ImagePluginTextContent, } from "./types/plugin/ImagePlugin.js";
|
|
52
61
|
export type { Plugin, PluginAction, PluginActionApi, PluginActionCommand, PluginActionCommandInput, PluginActionResult, PluginActions, PluginAvailability, PluginConfigDefinition, PluginEffectHook, PluginGuardHook, PluginHooks, PluginHttpDefinition, PluginPipelineHook, PluginPort, PluginResolveHook, PluginHttpRegistration, PluginActionInvokeParams, PluginActionInvokePort, PluginActionInvokeResult, PluginSetupDefinition, PluginSetupField, PluginSetupFieldOption, PluginUsageDefinition, PluginUsageField, PluginUsageFieldOption, PluginView, } from "./plugin/types/Plugin.js";
|
|
53
62
|
export type { PluginActionResponse, PluginCatalogResponse, PluginAvailabilityResponse, PluginAvailabilityView, } from "./plugin/types/PluginApi.js";
|
|
54
63
|
export type { PluginCommandResult, PluginLifecycle, PluginState, } from "./plugin/types/Plugin.js";
|
|
55
64
|
export type { ActionScheduleJobRecord, ActionScheduleJobStatus, CreateActionScheduleJobInput, PluginActionScheduleInput, } from "./plugin/types/ActionSchedule.js";
|
|
56
65
|
export type { PluginCliBaseOptions, PluginCommandResponse, PluginControlAction, PluginControlResponse, PluginStateListResponse, PluginStateView, } from "./plugin/types/Plugins.js";
|
|
57
66
|
export type { PluginStateControlAction, PluginStateControlResult, PluginStateSnapshot, } from "./plugin/core/Manager.js";
|
|
58
|
-
export type { StoredChannelAccount, StoredChannelAccountChannel, StoredEnvEntry, StoredGlobalEnvEntry, UpsertChannelAccountInput, UpsertEnvEntryInput, UpsertGlobalEnvEntryInput, } from "./types/
|
|
67
|
+
export type { StoredChannelAccount, StoredChannelAccountChannel, StoredEnvEntry, StoredGlobalEnvEntry, UpsertChannelAccountInput, UpsertEnvEntryInput, UpsertGlobalEnvEntryInput, } from "./types/platform/Store.js";
|
|
59
68
|
export { AUTH_DEFAULT_ROLE_NAMES, AUTH_DEFAULT_ROLES, AUTH_PERMISSION_DESCRIPTIONS, AUTH_PERMISSION_KEYS, } from "./types/runtime/auth/AuthPermission.js";
|
|
60
69
|
export type { AuthDefaultRoleDefinition, AuthDefaultRoleName, AuthPermissionKey, } from "./types/runtime/auth/AuthPermission.js";
|
|
61
70
|
export type { AuthRoutePolicy } from "./types/runtime/auth/AuthRoute.js";
|
package/bin/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,YAAY,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EACL,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,6BAA6B,CAAC;AACrC,YAAY,EACV,sBAAsB,EACtB,UAAU,EACV,mBAAmB,EACnB,iBAAiB,EACjB,YAAY,EACZ,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,0BAA0B,EAC1B,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,6BAA6B,EAC7B,6BAA6B,EAC7B,0BAA0B,EAC1B,yBAAyB,EACzB,kBAAkB,GACnB,MAAM,6BAA6B,CAAC;AACrC,YAAY,EACV,iBAAiB,EACjB,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,kCAAkC,CAAC;AAC1C,YAAY,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,C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B,GACvB,MAAM,6BAA6B,CAAC;AAGrC,YAAY,EACV,mBAAmB,EACnB,eAAe,EACf,WAAW,GACZ,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACV,uBAAuB,EACvB,uBAAuB,EACvB,4BAA4B,EAC5B,yBAAyB,GAC1B,MAAM,kCAAkC,CAAC;AAC1C,YAAY,EACV,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,uBAAuB,EACvB,eAAe,GAChB,MAAM,2BAA2B,CAAC;AACnC,YAAY,EACV,wBAAwB,EACxB,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAGlC,YAAY,EACV,oBAAoB,EACpB,2BAA2B,EAC3B,cAAc,EACd,oBAAoB,EACpB,yBAAyB,EACzB,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,4BAA4B,EAC5B,oBAAoB,GACrB,MAAM,wCAAwC,CAAC;AAChD,YAAY,EACV,yBAAyB,EACzB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,wCAAwC,CAAC;AAChD,YAAY,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACzE,YAAY,EACV,eAAe,EACf,gBAAgB,GACjB,MAAM,mCAAmC,CAAC;AAC3C,YAAY,EACV,YAAY,EACZ,cAAc,EACd,aAAa,EACb,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,cAAc,GACf,MAAM,mCAAmC,CAAC"}
|
package/bin/index.js
CHANGED
|
@@ -7,15 +7,18 @@
|
|
|
7
7
|
* - HTTP router、sandbox runner、内部 plugin runtime runner 等实现细节不从根入口暴露。
|
|
8
8
|
*/
|
|
9
9
|
// Agent 入口
|
|
10
|
-
export { Agent } from "./agent/Agent.js";
|
|
11
|
-
export { RemoteAgent } from "./agent/RemoteAgent.js";
|
|
10
|
+
export { Agent } from "./agent/local/Agent.js";
|
|
11
|
+
export { RemoteAgent } from "./agent/remote/RemoteAgent.js";
|
|
12
|
+
export { Session } from "./session/Session.js";
|
|
12
13
|
export { inferAgentModelLabel, normalizeAgentModel, } from "./model/CityModelAdapter.js";
|
|
13
14
|
// Plugin 作者 API
|
|
14
15
|
export { BasePlugin } from "./plugin/core/BasePlugin.js";
|
|
16
|
+
export { ImagePlugin } from "./plugin/core/ImagePlugin.js";
|
|
15
17
|
// Session 与即时执行集成
|
|
16
18
|
export { Executor } from "./executor/Executor.js";
|
|
17
19
|
export { drainDeferredPersistedUserMessages, getSessionRunScope, } from "./executor/SessionRunScope.js";
|
|
18
20
|
export { JsonlSessionHistoryComposer } from "./executor/composer/history/jsonl/JsonlSessionHistoryComposer.js";
|
|
21
|
+
export { LocalSessionContextComposer } from "./executor/composer/context/LocalSessionContextComposer.js";
|
|
19
22
|
export { JsonlSessionHistoryStore } from "./executor/store/history/jsonl/JsonlSessionHistoryStore.js";
|
|
20
23
|
export { JsonlSessionCompactionComposer } from "./executor/composer/compaction/jsonl/JsonlSessionCompactionComposer.js";
|
|
21
24
|
export { transformPromptsIntoSystemMessages } from "./executor/composer/system/default/PromptRenderer.js";
|
|
@@ -38,7 +41,7 @@ export { persistProjectPluginConfig } from "./plugin/core/ProjectConfigStore.js"
|
|
|
38
41
|
// 项目与配置集成
|
|
39
42
|
export { initializeAgentProject, isAgentProjectInitialized, normalizeDefaultAgentId, } from "./config/AgentInitializer.js";
|
|
40
43
|
export { loadDowncityConfig } from "./config/Config.js";
|
|
41
|
-
export { ensureRuntimeProjectReady, } from "./
|
|
44
|
+
export { ensureRuntimeProjectReady, } from "./agent/local/ProjectSetup.js";
|
|
42
45
|
export { assertProjectExecutionTarget } from "./config/ExecutionBinding.js";
|
|
43
46
|
// 日志
|
|
44
47
|
export { getLogger, logger } from "./utils/logger/Logger.js";
|
package/bin/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"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B,GACzB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,+BAA+B,EAC/B,0BAA0B,EAC1B,oBAAoB,GACrB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,kCAAkC,GACnC,MAAM,gCAAgC,CAAC;AAExC,eAAe;AACf,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,sBAAsB;AACtB,OAAO,EACL,eAAe,EACf,cAAc,GACf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC;AACxF,OAAO,EACL,8BAA8B,EAC9B,qCAAqC,GACtC,MAAM,wCAAwC,CAAC;AAEhD,iBAAiB;AACjB,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAEjF,UAAU;AACV,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EACL,yBAAyB,GAC1B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AAE5E,KAAK;AACL,OAAO,EAAE,SAAS,EAAE,MAAM,EAAe,MAAM,0BAA0B,CAAC;AAmJ1E,iBAAiB;AACjB,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,4BAA4B,EAC5B,oBAAoB,GACrB,MAAM,wCAAwC,CAAC"}
|
|
@@ -30,11 +30,11 @@ export declare abstract class BasePlugin implements Plugin {
|
|
|
30
30
|
/**
|
|
31
31
|
* 插件标题。
|
|
32
32
|
*/
|
|
33
|
-
readonly title
|
|
33
|
+
readonly title: string;
|
|
34
34
|
/**
|
|
35
35
|
* 插件说明。
|
|
36
36
|
*/
|
|
37
|
-
readonly description
|
|
37
|
+
readonly description: string;
|
|
38
38
|
/**
|
|
39
39
|
* 插件配置定义。
|
|
40
40
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BasePlugin.d.ts","sourceRoot":"","sources":["../../../src/plugin/core/BasePlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,KAAK,EACV,MAAM,EACN,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACtB,WAAW,EACX,oBAAoB,EACpB,eAAe,EACf,cAAc,EACd,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAE9E;;GAEG;AACH,8BAAsB,UAAW,YAAW,MAAM;IAChD;;OAEG;IACH,SAAgB,iBAAiB,EAAE,iBAAiB,CAIlD;IAEF;;OAEG;IACH,SAAS,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;gBAEzB,KAAK,GAAE,YAAY,GAAG,IAAW;IAI7C;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,QAAQ,CAAC,KAAK,MAAM;
|
|
1
|
+
{"version":3,"file":"BasePlugin.d.ts","sourceRoot":"","sources":["../../../src/plugin/core/BasePlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,KAAK,EACV,MAAM,EACN,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACtB,WAAW,EACX,oBAAoB,EACpB,eAAe,EACf,cA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AAG,MAAM;IAExD;;OAEG;IACH,SAAS,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,GAAG,IAAI;IAK3C;;OAEG;IACH,SAAS,CAAC,YAAY,IAAI,YAAY;CAMvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BasePlugin.js","sourceRoot":"","sources":["../../../src/plugin/core/BasePlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAoBH;;GAEG;AACH,MAAM,OAAgB,UAAU;IAC9B;;OAEG;IACa,iBAAiB,GAAsB;QACrD,KAAK,EAAE,SAAS;QAChB,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;QACrB,KAAK,EAAE,OAAO,CAAC,OAAO,EAAE;KACzB,CAAC;IAEF;;OAEG;IACO,KAAK,CAAsB;IAErC,YAAY,QAA6B,IAAI;QAC3C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAOD;;OAEG;IACM,KAAK,
|
|
1
|
+
{"version":3,"file":"BasePlugin.js","sourceRoot":"","sources":["../../../src/plugin/core/BasePlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAoBH;;GAEG;AACH,MAAM,OAAgB,UAAU;IAC9B;;OAEG;IACa,iBAAiB,GAAsB;QACrD,KAAK,EAAE,SAAS;QAChB,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;QACrB,KAAK,EAAE,OAAO,CAAC,OAAO,EAAE;KACzB,CAAC;IAEF;;OAEG;IACO,KAAK,CAAsB;IAErC,YAAY,QAA6B,IAAI;QAC3C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAOD;;OAEG;IACM,KAAK,GAAW,EAAE,CAAC;IAE5B;;OAEG;IACM,WAAW,GAAW,EAAE,CAAC;IAElC;;OAEG;IACM,MAAM,CAA4C;IAE3D;;OAEG;IACM,KAAK,CAAyB;IAEvC;;OAEG;IACM,KAAK,CAAyB;IAEvC;;OAEG;IACM,OAAO,GAAkB,EAAE,CAAC;IAErC;;OAEG;IACM,KAAK,CAAe;IAE7B;;OAEG;IACM,QAAQ,CAAkB;IAEnC;;OAEG;IACM,IAAI,CAAwB;IAErC;;OAEG;IACH,SAAS,CAAmB;IAc5B;;OAEG;IACH,SAAS,CAAC,KAA0B;QAClC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACO,YAAY;QACpB,IAAI,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC,KAAK,CAAC;QAClC,MAAM,IAAI,KAAK,CACb,WAAW,IAAI,CAAC,IAAI,sCAAsC,CAC3D,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ImagePlugin:Agent 内置图片生成插件。
|
|
3
|
+
*
|
|
4
|
+
* 关键点(中文)
|
|
5
|
+
* - 插件只负责把外部 image 函数暴露为 agent 可调用 action。
|
|
6
|
+
* - 具体模型、Provider、鉴权与上游协议由调用方传入的 image 函数处理。
|
|
7
|
+
* - action 返回 AI SDK UIMessage,后续由 plugin tool bridge 抽取 file parts 写回 assistant 消息。
|
|
8
|
+
*/
|
|
9
|
+
import type { AgentContext } from "../../types/runtime/agent/AgentContext.js";
|
|
10
|
+
import type { JsonObject, JsonValue } from "../../types/common/Json.js";
|
|
11
|
+
import type { ImagePluginOptions } from "../../types/plugin/ImagePlugin.js";
|
|
12
|
+
import { BasePlugin } from "../../plugin/core/BasePlugin.js";
|
|
13
|
+
/**
|
|
14
|
+
* Agent 图片生成插件。
|
|
15
|
+
*/
|
|
16
|
+
export declare class ImagePlugin extends BasePlugin {
|
|
17
|
+
/**
|
|
18
|
+
* 当前 plugin 稳定名称。
|
|
19
|
+
*/
|
|
20
|
+
readonly name: string;
|
|
21
|
+
/**
|
|
22
|
+
* 插件标题。
|
|
23
|
+
*/
|
|
24
|
+
readonly title: string;
|
|
25
|
+
/**
|
|
26
|
+
* 插件说明。
|
|
27
|
+
*/
|
|
28
|
+
readonly description: string;
|
|
29
|
+
private readonly image;
|
|
30
|
+
constructor(options: ImagePluginOptions);
|
|
31
|
+
/**
|
|
32
|
+
* 图片插件给模型的最小使用说明。
|
|
33
|
+
*/
|
|
34
|
+
system(_context: AgentContext): string;
|
|
35
|
+
/**
|
|
36
|
+
* 显式 action 集合。
|
|
37
|
+
*/
|
|
38
|
+
readonly actions: {
|
|
39
|
+
generate: {
|
|
40
|
+
execute: ({ payload }: {
|
|
41
|
+
payload: JsonValue;
|
|
42
|
+
}) => Promise<{
|
|
43
|
+
success: boolean;
|
|
44
|
+
data: JsonObject;
|
|
45
|
+
message: string;
|
|
46
|
+
error?: undefined;
|
|
47
|
+
} | {
|
|
48
|
+
success: boolean;
|
|
49
|
+
error: string;
|
|
50
|
+
message: string;
|
|
51
|
+
data?: undefined;
|
|
52
|
+
}>;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=ImagePlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImagePlugin.d.ts","sourceRoot":"","sources":["../../../src/plugin/core/ImagePlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,KAAK,EAEV,kBAAkB,EAEnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAqCzD;;GAEG;AACH,qBAAa,WAAY,SAAQ,UAAU;IACzC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA8B;gBAExC,OAAO,EAAE,kBAAkB;IAiBvC;;OAEG;IACH,MAAM,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM;IAStC;;OAEG;IACH,QAAQ,CAAC,OAAO;;mCAEiB;gBAAE,OAAO,EAAE,SAAS,CAAA;aAAE;;sBAMjB,UAAU;;;;;;;;;;MAY9C;CACH"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ImagePlugin:Agent 内置图片生成插件。
|
|
3
|
+
*
|
|
4
|
+
* 关键点(中文)
|
|
5
|
+
* - 插件只负责把外部 image 函数暴露为 agent 可调用 action。
|
|
6
|
+
* - 具体模型、Provider、鉴权与上游协议由调用方传入的 image 函数处理。
|
|
7
|
+
* - action 返回 AI SDK UIMessage,后续由 plugin tool bridge 抽取 file parts 写回 assistant 消息。
|
|
8
|
+
*/
|
|
9
|
+
import { BasePlugin } from "../../plugin/core/BasePlugin.js";
|
|
10
|
+
const DEFAULT_IMAGE_PLUGIN_NAME = "image";
|
|
11
|
+
const DEFAULT_IMAGE_PLUGIN_TITLE = "Image";
|
|
12
|
+
const DEFAULT_IMAGE_PLUGIN_DESCRIPTION = "Generate images and return them as assistant file parts.";
|
|
13
|
+
/**
|
|
14
|
+
* 判断值是否为普通对象。
|
|
15
|
+
*/
|
|
16
|
+
function to_record(value) {
|
|
17
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
18
|
+
return null;
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 归一化模型传入的图片生成 payload。
|
|
23
|
+
*/
|
|
24
|
+
function normalize_image_payload(payload) {
|
|
25
|
+
const record = to_record(payload ?? {});
|
|
26
|
+
if (!record) {
|
|
27
|
+
throw new TypeError("ImagePlugin.generate payload must be an object");
|
|
28
|
+
}
|
|
29
|
+
return { ...record };
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* 校验 image 函数返回的 UIMessage。
|
|
33
|
+
*/
|
|
34
|
+
function normalize_image_result(result) {
|
|
35
|
+
const record = to_record(result);
|
|
36
|
+
if (!record || !Array.isArray(record.parts)) {
|
|
37
|
+
throw new TypeError("ImagePlugin image function must return an AI SDK UIMessage");
|
|
38
|
+
}
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Agent 图片生成插件。
|
|
43
|
+
*/
|
|
44
|
+
export class ImagePlugin extends BasePlugin {
|
|
45
|
+
/**
|
|
46
|
+
* 当前 plugin 稳定名称。
|
|
47
|
+
*/
|
|
48
|
+
name;
|
|
49
|
+
/**
|
|
50
|
+
* 插件标题。
|
|
51
|
+
*/
|
|
52
|
+
title;
|
|
53
|
+
/**
|
|
54
|
+
* 插件说明。
|
|
55
|
+
*/
|
|
56
|
+
description;
|
|
57
|
+
image;
|
|
58
|
+
constructor(options) {
|
|
59
|
+
super();
|
|
60
|
+
const name = String(options.name || DEFAULT_IMAGE_PLUGIN_NAME).trim();
|
|
61
|
+
if (!name) {
|
|
62
|
+
throw new Error("ImagePlugin requires a non-empty name");
|
|
63
|
+
}
|
|
64
|
+
if (typeof options.image !== "function") {
|
|
65
|
+
throw new Error("ImagePlugin requires an image(input) function");
|
|
66
|
+
}
|
|
67
|
+
this.name = name;
|
|
68
|
+
this.title = String(options.title || DEFAULT_IMAGE_PLUGIN_TITLE).trim();
|
|
69
|
+
this.description = String(options.description || DEFAULT_IMAGE_PLUGIN_DESCRIPTION).trim();
|
|
70
|
+
this.image = options.image;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* 图片插件给模型的最小使用说明。
|
|
74
|
+
*/
|
|
75
|
+
system(_context) {
|
|
76
|
+
return [
|
|
77
|
+
"Image generation is available through the plugin_call tool.",
|
|
78
|
+
`Call plugin "${this.name}" action "generate" when the user asks to create, render, draw, or edit an image.`,
|
|
79
|
+
"Pass a JSON payload with prompt, optional size/aspect_ratio/quality/n, and optional provider_options.",
|
|
80
|
+
"The generated image files will be attached to the final assistant message automatically.",
|
|
81
|
+
].join("\n");
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* 显式 action 集合。
|
|
85
|
+
*/
|
|
86
|
+
actions = {
|
|
87
|
+
generate: {
|
|
88
|
+
execute: async ({ payload }) => {
|
|
89
|
+
try {
|
|
90
|
+
const input = normalize_image_payload(payload);
|
|
91
|
+
const message = normalize_image_result(await this.image(input));
|
|
92
|
+
return {
|
|
93
|
+
success: true,
|
|
94
|
+
data: message,
|
|
95
|
+
message: "image generated",
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
return {
|
|
100
|
+
success: false,
|
|
101
|
+
error: String(error),
|
|
102
|
+
message: String(error),
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=ImagePlugin.js.map
|