@downcity/agent 1.1.12 → 1.1.14
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/bin/{runtime → core}/AgentContextTypes.d.ts +6 -6
- package/bin/core/AgentContextTypes.d.ts.map +1 -0
- package/bin/{runtime → core}/AgentContextTypes.js +2 -2
- package/bin/core/AgentContextTypes.js.map +1 -0
- package/bin/core/AgentCore.d.ts +87 -0
- package/bin/core/AgentCore.d.ts.map +1 -0
- package/bin/core/AgentCore.js +467 -0
- package/bin/core/AgentCore.js.map +1 -0
- package/bin/{runtime/AgentRuntimeTypes.d.ts → core/AgentCoreTypes.d.ts} +10 -10
- package/bin/core/AgentCoreTypes.d.ts.map +1 -0
- package/bin/core/AgentCoreTypes.js +10 -0
- package/bin/core/AgentCoreTypes.js.map +1 -0
- package/bin/host/runtime/PluginRuntime.d.ts +1 -1
- package/bin/host/runtime/PluginRuntime.d.ts.map +1 -1
- package/bin/index.d.ts +8 -10
- package/bin/index.d.ts.map +1 -1
- package/bin/index.js +4 -7
- package/bin/index.js.map +1 -1
- package/bin/plugin/builtins/asr/InboundAugment.d.ts +1 -1
- package/bin/plugin/builtins/asr/InboundAugment.d.ts.map +1 -1
- package/bin/plugin/builtins/auth/runtime/AuthorizationConfig.d.ts +1 -1
- package/bin/plugin/builtins/auth/runtime/AuthorizationConfig.d.ts.map +1 -1
- package/bin/plugin/builtins/auth/runtime/AuthorizationStore.d.ts +1 -1
- package/bin/plugin/builtins/auth/runtime/AuthorizationStore.d.ts.map +1 -1
- package/bin/plugin/builtins/voice/InboundAugment.d.ts +1 -1
- package/bin/plugin/builtins/voice/InboundAugment.d.ts.map +1 -1
- package/bin/plugin/builtins/workboard/runtime/Collector.d.ts +1 -1
- package/bin/plugin/builtins/workboard/runtime/Collector.d.ts.map +1 -1
- package/bin/plugin/builtins/workboard/runtime/Collector.js +1 -1
- package/bin/plugin/builtins/workboard/runtime/Collector.js.map +1 -1
- package/bin/plugin/builtins/workboard/runtime/Normalizer.d.ts +1 -1
- package/bin/plugin/builtins/workboard/runtime/Normalizer.d.ts.map +1 -1
- package/bin/plugin/builtins/workboard/runtime/Store.d.ts +1 -1
- package/bin/plugin/builtins/workboard/runtime/Store.d.ts.map +1 -1
- package/bin/plugin/core/Activation.d.ts +2 -2
- package/bin/plugin/core/Activation.d.ts.map +1 -1
- package/bin/plugin/core/HookRegistry.d.ts +1 -1
- package/bin/plugin/core/HookRegistry.d.ts.map +1 -1
- package/bin/plugin/core/HttpRoutes.d.ts +1 -1
- package/bin/plugin/core/HttpRoutes.d.ts.map +1 -1
- package/bin/plugin/core/LocalExecution.d.ts.map +1 -1
- package/bin/plugin/core/LocalExecution.js +18 -20
- package/bin/plugin/core/LocalExecution.js.map +1 -1
- package/bin/plugin/core/PluginRegistry.d.ts +1 -1
- package/bin/plugin/core/PluginRegistry.d.ts.map +1 -1
- package/bin/plugin/types/Plugin.d.ts +1 -1
- package/bin/plugin/types/Plugin.d.ts.map +1 -1
- package/bin/sandbox/SandboxConfigResolver.d.ts +1 -1
- package/bin/sandbox/SandboxConfigResolver.d.ts.map +1 -1
- package/bin/sandbox/SandboxRunner.d.ts +1 -1
- package/bin/sandbox/SandboxRunner.d.ts.map +1 -1
- package/bin/sdk/Agent.d.ts +27 -25
- package/bin/sdk/Agent.d.ts.map +1 -1
- package/bin/sdk/Agent.js +86 -365
- package/bin/sdk/Agent.js.map +1 -1
- package/bin/sdk/AgentSdkTypes.d.ts +138 -0
- package/bin/sdk/AgentSdkTypes.d.ts.map +1 -1
- package/bin/sdk/HttpServer.d.ts +9 -19
- package/bin/sdk/HttpServer.d.ts.map +1 -1
- package/bin/sdk/HttpServer.js +26 -156
- package/bin/sdk/HttpServer.js.map +1 -1
- package/bin/sdk/RpcServer.d.ts +9 -10
- package/bin/sdk/RpcServer.d.ts.map +1 -1
- package/bin/sdk/RpcServer.js +22 -178
- package/bin/sdk/RpcServer.js.map +1 -1
- package/bin/sdk/Session.d.ts +8 -8
- package/bin/sdk/Session.d.ts.map +1 -1
- package/bin/sdk/Session.js +48 -54
- package/bin/sdk/Session.js.map +1 -1
- package/bin/sdk/SessionMetadata.d.ts +3 -3
- package/bin/sdk/SessionMetadata.d.ts.map +1 -1
- package/bin/sdk/SessionMetadata.js +5 -5
- package/bin/sdk/SessionMetadata.js.map +1 -1
- package/bin/sdk/SessionPersistence.d.ts +6 -6
- package/bin/sdk/SessionPersistence.d.ts.map +1 -1
- package/bin/sdk/SessionPersistence.js +7 -7
- package/bin/sdk/SessionPersistence.js.map +1 -1
- package/bin/sdk/SessionServicePort.d.ts +6 -6
- package/bin/sdk/SessionServicePort.d.ts.map +1 -1
- package/bin/sdk/SessionServicePort.js +9 -9
- package/bin/sdk/SessionServicePort.js.map +1 -1
- package/bin/sdk/{SdkSessionSystemComposer.d.ts → SessionSystemBuilder.d.ts} +7 -7
- package/bin/sdk/SessionSystemBuilder.d.ts.map +1 -0
- package/bin/sdk/{SdkSessionSystemComposer.js → SessionSystemBuilder.js} +14 -14
- package/bin/sdk/SessionSystemBuilder.js.map +1 -0
- package/bin/server/http/Server.d.ts +10 -1
- package/bin/server/http/Server.d.ts.map +1 -1
- package/bin/server/http/Server.js +41 -15
- package/bin/server/http/Server.js.map +1 -1
- package/bin/server/http/control/AuthControlService.d.ts +1 -1
- package/bin/server/http/control/AuthControlService.d.ts.map +1 -1
- package/bin/server/http/control/ControlAuthorizationRoutes.d.ts +1 -1
- package/bin/server/http/control/ControlAuthorizationRoutes.d.ts.map +1 -1
- package/bin/server/http/control/ControlRouter.d.ts +18 -2
- package/bin/server/http/control/ControlRouter.d.ts.map +1 -1
- package/bin/server/http/control/ControlRouter.js +10 -8
- package/bin/server/http/control/ControlRouter.js.map +1 -1
- package/bin/server/http/control/ExecuteBySession.d.ts +2 -2
- package/bin/server/http/control/ExecuteBySession.d.ts.map +1 -1
- package/bin/server/http/control/OverviewRoutes.d.ts.map +1 -1
- package/bin/server/http/control/OverviewRoutes.js +6 -2
- package/bin/server/http/control/OverviewRoutes.js.map +1 -1
- package/bin/server/http/control/SessionSummaryStore.d.ts +1 -1
- package/bin/server/http/control/SessionSummaryStore.d.ts.map +1 -1
- package/bin/server/http/control/types/ControlRoutes.d.ts +2 -2
- package/bin/server/http/control/types/ControlRoutes.d.ts.map +1 -1
- package/bin/server/http/execute/execute.d.ts +13 -2
- package/bin/server/http/execute/execute.d.ts.map +1 -1
- package/bin/server/http/execute/execute.js +73 -71
- package/bin/server/http/execute/execute.js.map +1 -1
- package/bin/server/http/plugins/plugins.d.ts +13 -2
- package/bin/server/http/plugins/plugins.d.ts.map +1 -1
- package/bin/server/http/plugins/plugins.js +42 -40
- package/bin/server/http/plugins/plugins.js.map +1 -1
- package/bin/server/http/services/services.d.ts +12 -8
- package/bin/server/http/services/services.d.ts.map +1 -1
- package/bin/server/http/services/services.js +57 -64
- package/bin/server/http/services/services.js.map +1 -1
- package/bin/server/http/static/static.d.ts +13 -2
- package/bin/server/http/static/static.d.ts.map +1 -1
- package/bin/server/http/static/static.js +81 -79
- package/bin/server/http/static/static.js.map +1 -1
- package/bin/server/rpc/Server.d.ts +5 -3
- package/bin/server/rpc/Server.d.ts.map +1 -1
- package/bin/server/rpc/Server.js +22 -12
- package/bin/server/rpc/Server.js.map +1 -1
- package/bin/service/builtins/BaseService.d.ts +2 -2
- package/bin/service/builtins/BaseService.d.ts.map +1 -1
- package/bin/service/builtins/chat/Action.d.ts +1 -1
- package/bin/service/builtins/chat/Action.d.ts.map +1 -1
- package/bin/service/builtins/chat/ChatService.d.ts +2 -2
- package/bin/service/builtins/chat/ChatService.d.ts.map +1 -1
- package/bin/service/builtins/chat/ChatServiceTypes.d.ts +1 -1
- package/bin/service/builtins/chat/ChatServiceTypes.d.ts.map +1 -1
- package/bin/service/builtins/chat/channels/BaseChatChannel.d.ts +1 -1
- package/bin/service/builtins/chat/channels/BaseChatChannel.d.ts.map +1 -1
- package/bin/service/builtins/chat/channels/BaseChatChannelQueue.d.ts +1 -1
- package/bin/service/builtins/chat/channels/BaseChatChannelQueue.d.ts.map +1 -1
- package/bin/service/builtins/chat/channels/BaseChatChannelSupport.d.ts +1 -1
- package/bin/service/builtins/chat/channels/BaseChatChannelSupport.d.ts.map +1 -1
- package/bin/service/builtins/chat/channels/feishu/Feishu.d.ts +1 -1
- package/bin/service/builtins/chat/channels/feishu/Feishu.d.ts.map +1 -1
- package/bin/service/builtins/chat/channels/feishu/FeishuMessageHandler.d.ts +1 -1
- package/bin/service/builtins/chat/channels/feishu/FeishuMessageHandler.d.ts.map +1 -1
- package/bin/service/builtins/chat/channels/feishu/FeishuPlatformClient.d.ts +1 -1
- package/bin/service/builtins/chat/channels/feishu/FeishuPlatformClient.d.ts.map +1 -1
- package/bin/service/builtins/chat/channels/qq/QQ.d.ts +1 -1
- package/bin/service/builtins/chat/channels/qq/QQ.d.ts.map +1 -1
- package/bin/service/builtins/chat/channels/qq/QQMessageHandler.d.ts +1 -1
- package/bin/service/builtins/chat/channels/qq/QQMessageHandler.d.ts.map +1 -1
- package/bin/service/builtins/chat/channels/qq/QQSupport.d.ts +1 -1
- package/bin/service/builtins/chat/channels/qq/QQSupport.d.ts.map +1 -1
- package/bin/service/builtins/chat/channels/telegram/Bot.d.ts +1 -1
- package/bin/service/builtins/chat/channels/telegram/Bot.d.ts.map +1 -1
- package/bin/service/builtins/chat/channels/telegram/TelegramMessageHandler.d.ts +1 -1
- package/bin/service/builtins/chat/channels/telegram/TelegramMessageHandler.d.ts.map +1 -1
- package/bin/service/builtins/chat/channels/telegram/TelegramPlatformClient.d.ts +1 -1
- package/bin/service/builtins/chat/channels/telegram/TelegramPlatformClient.d.ts.map +1 -1
- package/bin/service/builtins/chat/runtime/ChannelContextStore.d.ts +1 -1
- package/bin/service/builtins/chat/runtime/ChannelContextStore.d.ts.map +1 -1
- package/bin/service/builtins/chat/runtime/ChatActionExecution.d.ts +1 -1
- package/bin/service/builtins/chat/runtime/ChatActionExecution.d.ts.map +1 -1
- package/bin/service/builtins/chat/runtime/ChatActionInput.d.ts +3 -36
- package/bin/service/builtins/chat/runtime/ChatActionInput.d.ts.map +1 -1
- package/bin/service/builtins/chat/runtime/ChatActionInput.js +3 -118
- package/bin/service/builtins/chat/runtime/ChatActionInput.js.map +1 -1
- package/bin/service/builtins/chat/runtime/ChatChannelActions.d.ts +1 -1
- package/bin/service/builtins/chat/runtime/ChatChannelActions.d.ts.map +1 -1
- package/bin/service/builtins/chat/runtime/ChatChannelConfig.d.ts +1 -1
- package/bin/service/builtins/chat/runtime/ChatChannelConfig.d.ts.map +1 -1
- package/bin/service/builtins/chat/runtime/ChatChannelCore.d.ts +1 -1
- package/bin/service/builtins/chat/runtime/ChatChannelCore.d.ts.map +1 -1
- package/bin/service/builtins/chat/runtime/ChatChannelLifecycle.d.ts +1 -1
- package/bin/service/builtins/chat/runtime/ChatChannelLifecycle.d.ts.map +1 -1
- package/bin/service/builtins/chat/runtime/ChatHistoryStore.d.ts +1 -1
- package/bin/service/builtins/chat/runtime/ChatHistoryStore.d.ts.map +1 -1
- package/bin/service/builtins/chat/runtime/ChatIngressStore.d.ts +1 -1
- package/bin/service/builtins/chat/runtime/ChatIngressStore.d.ts.map +1 -1
- package/bin/service/builtins/chat/runtime/ChatMetaStore.d.ts +1 -1
- package/bin/service/builtins/chat/runtime/ChatMetaStore.d.ts.map +1 -1
- package/bin/service/builtins/chat/runtime/ChatQueueReplyDispatch.d.ts +1 -1
- package/bin/service/builtins/chat/runtime/ChatQueueReplyDispatch.d.ts.map +1 -1
- package/bin/service/builtins/chat/runtime/ChatQueueSessionBridge.d.ts +1 -1
- package/bin/service/builtins/chat/runtime/ChatQueueSessionBridge.d.ts.map +1 -1
- package/bin/service/builtins/chat/runtime/ChatQueueStore.d.ts +1 -1
- package/bin/service/builtins/chat/runtime/ChatQueueStore.d.ts.map +1 -1
- package/bin/service/builtins/chat/runtime/ChatQueueWorker.d.ts +1 -1
- package/bin/service/builtins/chat/runtime/ChatQueueWorker.d.ts.map +1 -1
- package/bin/service/builtins/chat/runtime/ChatServiceActions.d.ts +1 -1
- package/bin/service/builtins/chat/runtime/ChatServiceActions.d.ts.map +1 -1
- package/bin/service/builtins/chat/runtime/ChatServiceActions.js +2 -109
- package/bin/service/builtins/chat/runtime/ChatServiceActions.js.map +1 -1
- package/bin/service/builtins/chat/runtime/ChatServiceSystem.d.ts +1 -1
- package/bin/service/builtins/chat/runtime/ChatServiceSystem.d.ts.map +1 -1
- package/bin/service/builtins/chat/runtime/ChatSession.d.ts +27 -8
- package/bin/service/builtins/chat/runtime/ChatSession.d.ts.map +1 -1
- package/bin/service/builtins/chat/runtime/ChatSession.js +9 -4
- package/bin/service/builtins/chat/runtime/ChatSession.js.map +1 -1
- package/bin/service/builtins/chat/runtime/ChatSessionDelete.d.ts +1 -1
- package/bin/service/builtins/chat/runtime/ChatSessionDelete.d.ts.map +1 -1
- package/bin/service/builtins/chat/runtime/ChatkeySend.d.ts +1 -1
- package/bin/service/builtins/chat/runtime/ChatkeySend.d.ts.map +1 -1
- package/bin/service/builtins/chat/runtime/EnqueueDispatch.d.ts +1 -1
- package/bin/service/builtins/chat/runtime/EnqueueDispatch.d.ts.map +1 -1
- package/bin/service/builtins/chat/runtime/InboundAugment.d.ts +1 -1
- package/bin/service/builtins/chat/runtime/InboundAugment.d.ts.map +1 -1
- package/bin/service/builtins/chat/runtime/PluginDispatch.d.ts +1 -1
- package/bin/service/builtins/chat/runtime/PluginDispatch.d.ts.map +1 -1
- package/bin/service/builtins/chat/runtime/ReplyDispatch.d.ts +1 -1
- package/bin/service/builtins/chat/runtime/ReplyDispatch.d.ts.map +1 -1
- package/bin/service/builtins/chat/runtime/SystemPrompt.d.ts +1 -1
- package/bin/service/builtins/chat/runtime/SystemPrompt.d.ts.map +1 -1
- package/bin/service/builtins/contact/Action.d.ts +2 -2
- package/bin/service/builtins/contact/Action.d.ts.map +1 -1
- package/bin/service/builtins/contact/Action.js +2 -58
- package/bin/service/builtins/contact/Action.js.map +1 -1
- package/bin/service/builtins/contact/ContactService.d.ts +1 -1
- package/bin/service/builtins/contact/ContactService.d.ts.map +1 -1
- package/bin/service/builtins/contact/runtime/ChatRuntime.d.ts +1 -1
- package/bin/service/builtins/contact/runtime/ChatRuntime.d.ts.map +1 -1
- package/bin/service/builtins/contact/runtime/ContactPayload.d.ts +0 -7
- package/bin/service/builtins/contact/runtime/ContactPayload.d.ts.map +1 -1
- package/bin/service/builtins/contact/runtime/ContactPayload.js +0 -9
- package/bin/service/builtins/contact/runtime/ContactPayload.js.map +1 -1
- package/bin/service/builtins/contact/runtime/RemoteClient.d.ts +1 -1
- package/bin/service/builtins/contact/runtime/RemoteClient.d.ts.map +1 -1
- package/bin/service/builtins/contact/runtime/RemoteClient.js +37 -19
- package/bin/service/builtins/contact/runtime/RemoteClient.js.map +1 -1
- package/bin/service/builtins/contact/runtime/ShareBundle.d.ts +1 -1
- package/bin/service/builtins/contact/runtime/ShareBundle.d.ts.map +1 -1
- package/bin/service/builtins/memory/Action.d.ts +1 -1
- package/bin/service/builtins/memory/Action.d.ts.map +1 -1
- package/bin/service/builtins/memory/MemoryService.d.ts +1 -1
- package/bin/service/builtins/memory/MemoryService.d.ts.map +1 -1
- package/bin/service/builtins/memory/MemoryService.js +0 -27
- package/bin/service/builtins/memory/MemoryService.js.map +1 -1
- package/bin/service/builtins/memory/runtime/Flush.d.ts +1 -1
- package/bin/service/builtins/memory/runtime/Flush.d.ts.map +1 -1
- package/bin/service/builtins/memory/runtime/Search.d.ts +1 -1
- package/bin/service/builtins/memory/runtime/Search.d.ts.map +1 -1
- package/bin/service/builtins/memory/runtime/Store.d.ts +1 -1
- package/bin/service/builtins/memory/runtime/Store.d.ts.map +1 -1
- package/bin/service/builtins/memory/runtime/SystemProvider.d.ts +1 -1
- package/bin/service/builtins/memory/runtime/SystemProvider.d.ts.map +1 -1
- package/bin/service/builtins/memory/runtime/Writer.d.ts +1 -1
- package/bin/service/builtins/memory/runtime/Writer.d.ts.map +1 -1
- package/bin/service/builtins/schedule/ScheduleService.d.ts +39 -0
- package/bin/service/builtins/schedule/ScheduleService.d.ts.map +1 -0
- package/bin/service/builtins/schedule/ScheduleService.js +106 -0
- package/bin/service/builtins/schedule/ScheduleService.js.map +1 -0
- package/bin/service/builtins/shell/ShellRuntimeTypes.d.ts +1 -1
- package/bin/service/builtins/shell/ShellRuntimeTypes.d.ts.map +1 -1
- package/bin/service/builtins/shell/ShellService.d.ts +2 -2
- package/bin/service/builtins/shell/ShellService.d.ts.map +1 -1
- package/bin/service/builtins/shell/runtime/ShellActionResponse.d.ts +1 -1
- package/bin/service/builtins/shell/runtime/ShellActionResponse.d.ts.map +1 -1
- package/bin/service/builtins/shell/runtime/ShellActionRuntime.d.ts +1 -1
- package/bin/service/builtins/shell/runtime/ShellActionRuntime.d.ts.map +1 -1
- package/bin/service/builtins/shell/runtime/ShellActionRuntimeSupport.d.ts +1 -1
- package/bin/service/builtins/shell/runtime/ShellActionRuntimeSupport.d.ts.map +1 -1
- package/bin/service/builtins/shell/runtime/ShellRuntimeEnvironment.d.ts +1 -1
- package/bin/service/builtins/shell/runtime/ShellRuntimeEnvironment.d.ts.map +1 -1
- package/bin/service/builtins/task/Action.d.ts +1 -1
- package/bin/service/builtins/task/Action.d.ts.map +1 -1
- package/bin/service/builtins/task/Scheduler.d.ts +1 -1
- package/bin/service/builtins/task/Scheduler.d.ts.map +1 -1
- package/bin/service/builtins/task/TaskService.d.ts +2 -2
- package/bin/service/builtins/task/TaskService.d.ts.map +1 -1
- package/bin/service/builtins/task/runtime/CronRuntime.d.ts +1 -1
- package/bin/service/builtins/task/runtime/CronRuntime.d.ts.map +1 -1
- package/bin/service/builtins/task/runtime/Runner.d.ts +2 -2
- package/bin/service/builtins/task/runtime/Runner.d.ts.map +1 -1
- package/bin/service/builtins/task/runtime/Runner.js +1 -1
- package/bin/service/builtins/task/runtime/TaskActionExecution.d.ts +1 -1
- package/bin/service/builtins/task/runtime/TaskActionExecution.d.ts.map +1 -1
- package/bin/service/builtins/task/runtime/TaskActionInput.d.ts +2 -31
- package/bin/service/builtins/task/runtime/TaskActionInput.d.ts.map +1 -1
- package/bin/service/builtins/task/runtime/TaskActionInput.js +2 -141
- package/bin/service/builtins/task/runtime/TaskActionInput.js.map +1 -1
- package/bin/service/builtins/task/runtime/TaskRunChatDispatch.d.ts +1 -1
- package/bin/service/builtins/task/runtime/TaskRunChatDispatch.d.ts.map +1 -1
- package/bin/service/builtins/task/runtime/TaskRunnerRound.d.ts +1 -1
- package/bin/service/builtins/task/runtime/TaskRunnerRound.d.ts.map +1 -1
- package/bin/service/builtins/task/runtime/TaskRunnerScript.d.ts +1 -1
- package/bin/service/builtins/task/runtime/TaskRunnerScript.d.ts.map +1 -1
- package/bin/service/builtins/task/runtime/TaskRunnerSession.d.ts +3 -3
- package/bin/service/builtins/task/runtime/TaskRunnerSession.d.ts.map +1 -1
- package/bin/service/builtins/task/runtime/TaskRunnerSession.js +4 -4
- package/bin/service/builtins/task/runtime/TaskRunnerSession.js.map +1 -1
- package/bin/service/builtins/task/runtime/TaskRunnerTypes.d.ts +1 -1
- package/bin/service/builtins/task/runtime/TaskServiceActions.d.ts +1 -1
- package/bin/service/builtins/task/runtime/TaskServiceActions.d.ts.map +1 -1
- package/bin/service/builtins/task/runtime/TaskServiceActions.js +2 -30
- package/bin/service/builtins/task/runtime/TaskServiceActions.js.map +1 -1
- package/bin/service/core/Manager.d.ts +0 -1
- package/bin/service/core/Manager.d.ts.map +1 -1
- package/bin/service/core/Manager.js +0 -1
- package/bin/service/core/Manager.js.map +1 -1
- package/bin/service/core/ServiceActionRunner.d.ts +1 -1
- package/bin/service/core/ServiceActionRunner.d.ts.map +1 -1
- package/bin/service/core/ServiceActionRunner.js +3 -1
- package/bin/service/core/ServiceActionRunner.js.map +1 -1
- package/bin/service/core/ServiceClassRegistry.d.ts +1 -1
- package/bin/service/core/ServiceClassRegistry.d.ts.map +1 -1
- package/bin/service/core/ServiceCommandRequest.d.ts +36 -0
- package/bin/service/core/ServiceCommandRequest.d.ts.map +1 -0
- package/bin/service/core/ServiceCommandRequest.js +53 -0
- package/bin/service/core/ServiceCommandRequest.js.map +1 -0
- package/bin/service/core/ServiceManager.d.ts +1 -1
- package/bin/service/core/ServiceManager.d.ts.map +1 -1
- package/bin/service/core/ServiceStateController.d.ts +20 -7
- package/bin/service/core/ServiceStateController.d.ts.map +1 -1
- package/bin/service/core/ServiceStateController.js +23 -20
- package/bin/service/core/ServiceStateController.js.map +1 -1
- package/bin/service/core/ServiceSystemProviders.d.ts +1 -1
- package/bin/service/core/ServiceSystemProviders.d.ts.map +1 -1
- package/bin/service/core/Services.d.ts +1 -1
- package/bin/service/core/Services.d.ts.map +1 -1
- package/bin/service/core/Services.js +2 -0
- package/bin/service/core/Services.js.map +1 -1
- package/bin/service/schedule/Executor.d.ts +1 -1
- package/bin/service/schedule/Executor.d.ts.map +1 -1
- package/bin/service/types/Service.d.ts +1 -23
- package/bin/service/types/Service.d.ts.map +1 -1
- package/bin/session/{Session.d.ts → Executor.d.ts} +54 -17
- package/bin/session/Executor.d.ts.map +1 -0
- package/bin/session/{Session.js → Executor.js} +60 -23
- package/bin/session/Executor.js.map +1 -0
- package/bin/session/composer/SessionComposer.d.ts +1 -1
- package/bin/session/composer/SessionComposer.js +1 -1
- package/bin/session/composer/compaction/SessionCompactionComposer.d.ts +2 -2
- package/bin/session/composer/execution/LocalSessionExecutionComposer.d.ts +1 -1
- package/bin/session/composer/execution/LocalSessionExecutionComposer.js +1 -1
- package/bin/session/composer/execution/SessionExecutionComposer.d.ts +1 -1
- package/bin/session/composer/history/SessionHistoryComposer.d.ts +1 -1
- package/bin/session/composer/system/SessionSystemComposer.d.ts +1 -1
- package/bin/session/composer/system/SessionSystemComposer.js +1 -1
- package/bin/session/composer/system/default/DefaultSessionSystemComposer.d.ts +1 -1
- package/bin/session/composer/system/default/DefaultSessionSystemComposer.d.ts.map +1 -1
- package/bin/session/composer/system/default/SystemDomain.d.ts +1 -1
- package/bin/session/composer/system/default/SystemDomain.d.ts.map +1 -1
- package/bin/session/executors/local/{LocalSessionCore.d.ts → Runner.d.ts} +10 -10
- package/bin/session/executors/local/Runner.d.ts.map +1 -0
- package/bin/session/executors/local/{LocalSessionCore.js → Runner.js} +11 -11
- package/bin/session/executors/local/Runner.js.map +1 -0
- package/bin/session/executors/local/SessionExecutionError.d.ts +1 -1
- package/bin/session/executors/local/SessionExecutionError.js +1 -1
- package/bin/session/executors/local/SessionLoopDecision.d.ts +3 -3
- package/bin/session/executors/local/SessionLoopDecision.js +3 -3
- package/bin/session/executors/local/SessionModelMessageState.d.ts +2 -2
- package/bin/session/executors/local/SessionModelMessageState.js +2 -2
- package/bin/session/executors/local/SessionSignals.d.ts +3 -3
- package/bin/session/executors/local/SessionSignals.js +3 -3
- package/bin/session/executors/local/SessionToolLoopRunner.d.ts +1 -1
- package/bin/session/executors/local/SessionToolLoopRunner.js +2 -2
- package/bin/session/executors/local/SessionToolLoopRunner.js.map +1 -1
- package/bin/session/tools/shell/ShellToolBridge.d.ts +1 -1
- package/bin/session/tools/shell/ShellToolBridge.d.ts.map +1 -1
- package/bin/session/types/SessionLoop.d.ts +1 -1
- package/bin/session/types/SessionLoop.js +1 -1
- package/bin/session/types/SessionRun.d.ts +2 -2
- package/bin/session/types/SessionRun.js +1 -1
- package/package.json +1 -1
- package/src/{runtime → core}/AgentContextTypes.ts +6 -7
- package/src/core/AgentCore.ts +527 -0
- package/src/{runtime/AgentRuntimeTypes.ts → core/AgentCoreTypes.ts} +9 -9
- package/src/host/runtime/PluginRuntime.ts +1 -1
- package/src/index.ts +26 -23
- package/src/plugin/builtins/asr/InboundAugment.ts +1 -1
- package/src/plugin/builtins/auth/runtime/AuthorizationConfig.ts +1 -1
- package/src/plugin/builtins/auth/runtime/AuthorizationStore.ts +1 -1
- package/src/plugin/builtins/voice/InboundAugment.ts +1 -1
- package/src/plugin/builtins/workboard/runtime/Collector.ts +2 -2
- package/src/plugin/builtins/workboard/runtime/Normalizer.ts +1 -1
- package/src/plugin/builtins/workboard/runtime/Store.ts +1 -1
- package/src/plugin/core/Activation.ts +2 -2
- package/src/plugin/core/HookRegistry.ts +1 -1
- package/src/plugin/core/HttpRoutes.ts +1 -1
- package/src/plugin/core/LocalExecution.ts +21 -20
- package/src/plugin/core/PluginRegistry.ts +1 -1
- package/src/plugin/types/Plugin.ts +1 -1
- package/src/sandbox/SandboxConfigResolver.ts +1 -1
- package/src/sandbox/SandboxRunner.ts +1 -1
- package/src/sdk/Agent.ts +101 -395
- package/src/sdk/AgentSdkTypes.ts +158 -0
- package/src/sdk/HttpServer.ts +27 -192
- package/src/sdk/RpcServer.ts +24 -211
- package/src/sdk/Session.ts +64 -68
- package/src/sdk/SessionMetadata.ts +5 -5
- package/src/sdk/SessionPersistence.ts +13 -13
- package/src/sdk/SessionServicePort.ts +14 -14
- package/src/sdk/{SdkSessionSystemComposer.ts → SessionSystemBuilder.ts} +24 -24
- package/src/server/http/Server.ts +63 -18
- package/src/server/http/control/AuthControlService.ts +1 -1
- package/src/server/http/control/ControlAuthorizationRoutes.ts +1 -1
- package/src/server/http/control/ControlRouter.ts +27 -11
- package/src/server/http/control/ExecuteBySession.ts +2 -2
- package/src/server/http/control/OverviewRoutes.ts +6 -2
- package/src/server/http/control/SessionSummaryStore.ts +1 -1
- package/src/server/http/control/types/ControlRoutes.ts +2 -2
- package/src/server/http/execute/execute.ts +107 -91
- package/src/server/http/plugins/plugins.ts +60 -44
- package/src/server/http/services/services.ts +68 -64
- package/src/server/http/static/static.ts +95 -79
- package/src/server/rpc/Server.ts +26 -15
- package/src/service/builtins/BaseService.ts +2 -2
- package/src/service/builtins/chat/Action.ts +1 -1
- package/src/service/builtins/chat/ChatService.ts +2 -2
- package/src/service/builtins/chat/ChatServiceTypes.ts +1 -1
- package/src/service/builtins/chat/channels/BaseChatChannel.ts +1 -1
- package/src/service/builtins/chat/channels/BaseChatChannelQueue.ts +1 -1
- package/src/service/builtins/chat/channels/BaseChatChannelSupport.ts +1 -1
- package/src/service/builtins/chat/channels/feishu/Feishu.ts +1 -1
- package/src/service/builtins/chat/channels/feishu/FeishuMessageHandler.ts +1 -1
- package/src/service/builtins/chat/channels/feishu/FeishuPlatformClient.ts +1 -1
- package/src/service/builtins/chat/channels/qq/QQ.ts +1 -1
- package/src/service/builtins/chat/channels/qq/QQMessageHandler.ts +1 -1
- package/src/service/builtins/chat/channels/qq/QQSupport.ts +1 -1
- package/src/service/builtins/chat/channels/telegram/Bot.ts +1 -1
- package/src/service/builtins/chat/channels/telegram/TelegramMessageHandler.ts +1 -1
- package/src/service/builtins/chat/channels/telegram/TelegramPlatformClient.ts +1 -1
- package/src/service/builtins/chat/runtime/ChannelContextStore.ts +1 -1
- package/src/service/builtins/chat/runtime/ChatActionExecution.ts +1 -1
- package/src/service/builtins/chat/runtime/ChatActionInput.ts +2 -158
- package/src/service/builtins/chat/runtime/ChatChannelActions.ts +1 -1
- package/src/service/builtins/chat/runtime/ChatChannelConfig.ts +1 -1
- package/src/service/builtins/chat/runtime/ChatChannelCore.ts +1 -1
- package/src/service/builtins/chat/runtime/ChatChannelLifecycle.ts +1 -1
- package/src/service/builtins/chat/runtime/ChatHistoryStore.ts +1 -1
- package/src/service/builtins/chat/runtime/ChatIngressStore.ts +1 -1
- package/src/service/builtins/chat/runtime/ChatMetaStore.ts +1 -1
- package/src/service/builtins/chat/runtime/ChatQueueReplyDispatch.ts +1 -1
- package/src/service/builtins/chat/runtime/ChatQueueSessionBridge.ts +1 -1
- package/src/service/builtins/chat/runtime/ChatQueueStore.ts +1 -1
- package/src/service/builtins/chat/runtime/ChatQueueWorker.ts +1 -1
- package/src/service/builtins/chat/runtime/ChatServiceActions.ts +1 -118
- package/src/service/builtins/chat/runtime/ChatServiceSystem.ts +1 -1
- package/src/service/builtins/chat/runtime/ChatSession.ts +37 -13
- package/src/service/builtins/chat/runtime/ChatSessionDelete.ts +1 -1
- package/src/service/builtins/chat/runtime/ChatkeySend.ts +1 -1
- package/src/service/builtins/chat/runtime/EnqueueDispatch.ts +1 -1
- package/src/service/builtins/chat/runtime/InboundAugment.ts +1 -1
- package/src/service/builtins/chat/runtime/PluginDispatch.ts +1 -1
- package/src/service/builtins/chat/runtime/ReplyDispatch.ts +1 -1
- package/src/service/builtins/chat/runtime/SystemPrompt.ts +1 -1
- package/src/service/builtins/contact/Action.ts +2 -59
- package/src/service/builtins/contact/ContactService.ts +2 -2
- package/src/service/builtins/contact/runtime/ChatRuntime.ts +1 -1
- package/src/service/builtins/contact/runtime/ContactPayload.ts +0 -12
- package/src/service/builtins/contact/runtime/RemoteClient.ts +40 -19
- package/src/service/builtins/contact/runtime/ShareBundle.ts +1 -1
- package/src/service/builtins/memory/Action.ts +1 -1
- package/src/service/builtins/memory/MemoryService.ts +1 -28
- package/src/service/builtins/memory/runtime/Flush.ts +1 -1
- package/src/service/builtins/memory/runtime/Search.ts +1 -1
- package/src/service/builtins/memory/runtime/Store.ts +1 -1
- package/src/service/builtins/memory/runtime/SystemProvider.ts +1 -1
- package/src/service/builtins/memory/runtime/Writer.ts +1 -1
- package/src/service/builtins/schedule/ScheduleService.ts +131 -0
- package/src/service/builtins/shell/ShellRuntimeTypes.ts +1 -1
- package/src/service/builtins/shell/ShellService.ts +2 -2
- package/src/service/builtins/shell/runtime/ShellActionResponse.ts +1 -1
- package/src/service/builtins/shell/runtime/ShellActionRuntime.ts +1 -1
- package/src/service/builtins/shell/runtime/ShellActionRuntimeSupport.ts +1 -1
- package/src/service/builtins/shell/runtime/ShellRuntimeEnvironment.ts +1 -1
- package/src/service/builtins/task/Action.ts +1 -1
- package/src/service/builtins/task/Scheduler.ts +1 -1
- package/src/service/builtins/task/TaskService.ts +2 -2
- package/src/service/builtins/task/runtime/CronRuntime.ts +1 -1
- package/src/service/builtins/task/runtime/Runner.ts +2 -2
- package/src/service/builtins/task/runtime/TaskActionExecution.ts +1 -1
- package/src/service/builtins/task/runtime/TaskActionInput.ts +3 -185
- package/src/service/builtins/task/runtime/TaskRunChatDispatch.ts +1 -1
- package/src/service/builtins/task/runtime/TaskRunnerRound.ts +1 -1
- package/src/service/builtins/task/runtime/TaskRunnerScript.ts +1 -1
- package/src/service/builtins/task/runtime/TaskRunnerSession.ts +5 -5
- package/src/service/builtins/task/runtime/TaskRunnerTypes.ts +1 -1
- package/src/service/builtins/task/runtime/TaskServiceActions.ts +1 -35
- package/src/service/core/Manager.ts +0 -1
- package/src/service/core/ServiceActionRunner.ts +4 -2
- package/src/service/core/ServiceClassRegistry.ts +1 -1
- package/src/service/core/ServiceCommandRequest.ts +93 -0
- package/src/service/core/ServiceManager.ts +0 -1
- package/src/service/core/ServiceStateController.ts +45 -20
- package/src/service/core/ServiceSystemProviders.ts +1 -1
- package/src/service/core/Services.ts +3 -1
- package/src/service/schedule/Executor.ts +1 -1
- package/src/service/types/Service.ts +1 -24
- package/src/session/{Session.ts → Executor.ts} +96 -26
- package/src/session/composer/SessionComposer.ts +1 -1
- package/src/session/composer/compaction/SessionCompactionComposer.ts +2 -2
- package/src/session/composer/execution/LocalSessionExecutionComposer.ts +1 -1
- package/src/session/composer/execution/SessionExecutionComposer.ts +1 -1
- package/src/session/composer/history/SessionHistoryComposer.ts +1 -1
- package/src/session/composer/system/SessionSystemComposer.ts +1 -1
- package/src/session/composer/system/default/DefaultSessionSystemComposer.ts +1 -1
- package/src/session/composer/system/default/SystemDomain.ts +1 -1
- package/src/session/executors/local/{LocalSessionCore.ts → Runner.ts} +13 -13
- package/src/session/executors/local/SessionExecutionError.ts +1 -1
- package/src/session/executors/local/SessionLoopDecision.ts +3 -3
- package/src/session/executors/local/SessionModelMessageState.ts +2 -2
- package/src/session/executors/local/SessionSignals.ts +3 -3
- package/src/session/executors/local/SessionToolLoopRunner.ts +2 -2
- package/src/session/tools/shell/ShellToolBridge.ts +1 -1
- package/src/session/types/SessionLoop.ts +1 -1
- package/src/session/types/SessionRun.ts +2 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/bin/runtime/AgentContext.d.ts +0 -23
- package/bin/runtime/AgentContext.d.ts.map +0 -1
- package/bin/runtime/AgentContext.js +0 -149
- package/bin/runtime/AgentContext.js.map +0 -1
- package/bin/runtime/AgentContextTypes.d.ts.map +0 -1
- package/bin/runtime/AgentContextTypes.js.map +0 -1
- package/bin/runtime/AgentRuntime.d.ts +0 -37
- package/bin/runtime/AgentRuntime.d.ts.map +0 -1
- package/bin/runtime/AgentRuntime.js +0 -296
- package/bin/runtime/AgentRuntime.js.map +0 -1
- package/bin/runtime/AgentRuntimeState.d.ts +0 -42
- package/bin/runtime/AgentRuntimeState.d.ts.map +0 -1
- package/bin/runtime/AgentRuntimeState.js +0 -172
- package/bin/runtime/AgentRuntimeState.js.map +0 -1
- package/bin/runtime/AgentRuntimeTypes.d.ts.map +0 -1
- package/bin/runtime/AgentRuntimeTypes.js +0 -10
- package/bin/runtime/AgentRuntimeTypes.js.map +0 -1
- package/bin/sdk/SdkSessionSystemComposer.d.ts.map +0 -1
- package/bin/sdk/SdkSessionSystemComposer.js.map +0 -1
- package/bin/service/core/ServiceActionApi.d.ts +0 -15
- package/bin/service/core/ServiceActionApi.d.ts.map +0 -1
- package/bin/service/core/ServiceActionApi.js +0 -234
- package/bin/service/core/ServiceActionApi.js.map +0 -1
- package/bin/service/schedule/Runtime.d.ts +0 -17
- package/bin/service/schedule/Runtime.d.ts.map +0 -1
- package/bin/service/schedule/Runtime.js +0 -64
- package/bin/service/schedule/Runtime.js.map +0 -1
- package/bin/session/Session.d.ts.map +0 -1
- package/bin/session/Session.js.map +0 -1
- package/bin/session/executors/local/LocalSessionCore.d.ts.map +0 -1
- package/bin/session/executors/local/LocalSessionCore.js.map +0 -1
- package/bin/session/executors/local/LocalSessionExecutor.d.ts +0 -61
- package/bin/session/executors/local/LocalSessionExecutor.d.ts.map +0 -1
- package/bin/session/executors/local/LocalSessionExecutor.js +0 -36
- package/bin/session/executors/local/LocalSessionExecutor.js.map +0 -1
- package/src/runtime/AgentContext.ts +0 -182
- package/src/runtime/AgentRuntime.ts +0 -376
- package/src/runtime/AgentRuntimeState.ts +0 -213
- package/src/service/core/ServiceActionApi.ts +0 -304
- package/src/service/schedule/Runtime.ts +0 -78
- package/src/session/executors/local/LocalSessionExecutor.ts +0 -89
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionToolLoopRunner.js","sourceRoot":"","sources":["../../../../src/session/executors/local/SessionToolLoopRunner.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAsB,MAAM,IAAI,CAAC;AASpD,OAAO,EACL,mCAAmC,GACpC,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,EACL,kCAAkC,EAClC,2BAA2B,EAC3B,mBAAmB,EACnB,oCAAoC,EACpC,8BAA8B,EAC9B,wBAAwB,EACxB,gCAAgC,EAChC,wBAAwB,EACxB,qBAAqB,EACrB,0BAA0B,EAC1B,eAAe,GAChB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EACL,2BAA2B,EAC3B,uCAAuC,GACxC,MAAM,iDAAiD,CAAC;AACzD,OAAO,EACL,8BAA8B,EAC9B,oBAAoB,GACrB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,wCAAwC,EAAE,MAAM,sDAAsD,CAAC;AAChH,OAAO,EAAE,wBAAwB,EAAE,MAAM,sDAAsD,CAAC;AAkBhG;;GAEG;AACH,MAAM,OAAO,qBAAqB;IACf,KAAK,CAAgB;IACrB,MAAM,CAAS;IACf,eAAe,CAAyB;IACxC,iBAAiB,CAA2B;IAC5C,oBAAoB,CAA8B;IAEnE,YAAY,OAAqC;QAC/C,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;QAC/C,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC,iB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AAC;YACf,IAAI,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,EAAE,CAAC;gBACrC,MAAM,KAAK,CAAC;YACd,CAAC;YAED,MAAM,QAAQ,GAAG,8BAA8B,CAAC;gBAC9C,KAAK;gBACL,WAAW,EAAE,uBAAuB;aACrC,CAAC,CAAC;YAEH,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"SessionToolLoopRunner.js","sourceRoot":"","sources":["../../../../src/session/executors/local/SessionToolLoopRunner.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAsB,MAAM,IAAI,CAAC;AASpD,OAAO,EACL,mCAAmC,GACpC,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,EACL,kCAAkC,EAClC,2BAA2B,EAC3B,mBAAmB,EACnB,oCAAoC,EACpC,8BAA8B,EAC9B,wBAAwB,EACxB,gCAAgC,EAChC,wBAAwB,EACxB,qBAAqB,EACrB,0BAA0B,EAC1B,eAAe,GAChB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EACL,2BAA2B,EAC3B,uCAAuC,GACxC,MAAM,iDAAiD,CAAC;AACzD,OAAO,EACL,8BAA8B,EAC9B,oBAAoB,GACrB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,wCAAwC,EAAE,MAAM,sDAAsD,CAAC;AAChH,OAAO,EAAE,wBAAwB,EAAE,MAAM,sDAAsD,CAAC;AAkBhG;;GAEG;AACH,MAAM,OAAO,qBAAqB;IACf,KAAK,CAAgB;IACrB,MAAM,CAAS;IACf,eAAe,CAAyB;IACxC,iBAAiB,CAA2B;IAC5C,oBAAoB,CAA8B;IAEnE,YAAY,OAAqC;QAC/C,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,OAAO,C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,CAAC;YAEH,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,gBAAgB,EAAE,YAAY;aAC/B,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,EAAE,CAAC;gBACrC,MAAM,KAAK,CAAC;YACd,CAAC;YAED,MAAM,QAAQ,GAAG,8BAA8B,CAAC;gBAC9C,KAAK;gBACL,WAAW,EAAE,uBAAuB;aACrC,CAAC,CAAC;YAEH,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,yBAAyB,EAAE;gBACxD,KAAK,EAAE,QAAQ;aAChB,CAAC,CAAC;YAEH,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,QAAQ;gBACf,gBAAgB,EAAE,IAAI,CAAC,iBAAiB,CAAC,6BAA6B,CACpE,qBAAqB,QAAQ,EAAE,CAChC;aACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* - runtime 注入、桥接协议解析、输出扁平化都收敛在这里,避免 `Tool.ts` 继续膨胀。
|
|
7
7
|
*/
|
|
8
8
|
import type { JsonObject, JsonValue } from "../../../types/common/Json.js";
|
|
9
|
-
import type { InvokeServicePort } from "../../../
|
|
9
|
+
import type { InvokeServicePort } from "../../../core/AgentContextTypes.js";
|
|
10
10
|
import type { ShellActionResponse } from "../../../service/builtins/shell/types/ShellService.js";
|
|
11
11
|
export declare function setShellToolRuntime(next: InvokeServicePort): void;
|
|
12
12
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShellToolBridge.d.ts","sourceRoot":"","sources":["../../../../src/session/tools/shell/ShellToolBridge.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,KAAK,EACV,iBAAiB,EAElB,MAAM,
|
|
1
|
+
{"version":3,"file":"ShellToolBridge.d.ts","sourceRoot":"","sources":["../../../../src/session/tools/shell/ShellToolBridge.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,KAAK,EACV,iBAAiB,EAElB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AAwB1F,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI,CAEjE;AAyID;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAG9E;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE7D;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE;IACjD;;OAEG;IACH,QAAQ,EAAE,mBAAmB,CAAC;IAC9B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,UAAU,CA+Bb;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE;IAC/C;;OAEG;IACH,QAAQ,EAAE,mBAAmB,CAAC;IAC9B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,UAAU,CAgBb;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,MAAM,EAAE;IAClD;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,QAAQ,EAAE,UAAU,CAAC;CACtB,GAAG,OAAO,CAAC,UAAU,CAAC,CAoDtB;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,QAAQ,SAAS,SAAS,GAAG,SAAS,EAAE,MAAM,EAAE;IACtF;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,OAAO,EAAE,QAAQ,CAAC;CACnB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAmB/B;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,OAAO,GACb;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAKnC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
5
|
* - `SessionRunInput` 表示上层会话入口输入(例如 context query)。
|
|
6
|
-
* - `SessionExecuteInput` 表示
|
|
6
|
+
* - `SessionExecuteInput` 表示 Runner 通过 Composer 装配后的中间运行态。
|
|
7
7
|
* - 输出仅暴露 assistantMessage(UIMessage)。
|
|
8
8
|
*/
|
|
9
9
|
import type { Tool, UIMessageChunk } from "ai";
|
|
@@ -89,7 +89,7 @@ export interface SessionRunInput {
|
|
|
89
89
|
query: string;
|
|
90
90
|
}
|
|
91
91
|
/**
|
|
92
|
-
*
|
|
92
|
+
* Runner 通过 Composer 装配后的中间运行态。
|
|
93
93
|
*/
|
|
94
94
|
export interface SessionExecuteInput {
|
|
95
95
|
/**
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* AgentCore 执行上下文类型定义。
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
5
|
* - 这里定义 service / plugin / prompt system 共用的统一执行上下文。
|
|
6
6
|
* - `AgentContext` 表达的是“当前一次执行可见的能力面”,不是宿主状态本体。
|
|
7
|
-
* - `AgentRuntime`
|
|
7
|
+
* - `AgentRuntime` 负责保存长期状态;`AgentContext` 负责把这些状态暴露成执行接口。
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import type { LanguageModel } from "ai";
|
|
11
11
|
import type { Logger } from "@/utils/logger/Logger.js";
|
|
12
|
-
import type { AgentRuntime } from "@/
|
|
12
|
+
import type { AgentRuntime } from "@/core/AgentCoreTypes.js";
|
|
13
13
|
import type {
|
|
14
14
|
AgentPathRuntime,
|
|
15
15
|
AgentPlatformRuntime,
|
|
@@ -168,10 +168,6 @@ export interface SessionExecutorPort {
|
|
|
168
168
|
*/
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
/**
|
|
172
|
-
* Session 集合入口。
|
|
173
|
-
*/
|
|
174
|
-
|
|
175
171
|
/**
|
|
176
172
|
* 单个 Session 实例端口。
|
|
177
173
|
*/
|
|
@@ -253,6 +249,9 @@ export interface SessionPort {
|
|
|
253
249
|
isExecuting(): boolean;
|
|
254
250
|
}
|
|
255
251
|
|
|
252
|
+
/**
|
|
253
|
+
* Session 集合入口。
|
|
254
|
+
*/
|
|
256
255
|
export interface SessionCollectionPort {
|
|
257
256
|
/**
|
|
258
257
|
* 获取指定 sessionId 对应的 Session 实例。
|
|
@@ -0,0 +1,527 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentCore:单个 Agent 实例的运行内核。
|
|
3
|
+
*
|
|
4
|
+
* 关键点(中文)
|
|
5
|
+
* - 一个 `AgentCore` 只服务一个 agent 实例,不依赖进程级 singleton runtime。
|
|
6
|
+
* - SDK `Agent`、实例绑定式 HTTP server、实例绑定式 local RPC 都应基于它工作。
|
|
7
|
+
* - 宿主若需要统一 session 默认配置,应通过 `configureSession` 注入,而不是把策略写死在 SDK 中。
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import fs from "fs-extra";
|
|
11
|
+
import { nanoid } from "nanoid";
|
|
12
|
+
import type { Tool } from "ai";
|
|
13
|
+
import { Logger } from "@/utils/logger/Logger.js";
|
|
14
|
+
import type { BaseService } from "@/service/builtins/BaseService.js";
|
|
15
|
+
import type { AgentContext } from "@/core/AgentContextTypes.js";
|
|
16
|
+
import type { AgentRuntime } from "@/core/AgentCoreTypes.js";
|
|
17
|
+
import type { DowncityConfig } from "@/types/config/DowncityConfig.js";
|
|
18
|
+
import type { JsonValue } from "@/types/common/Json.js";
|
|
19
|
+
import type { AgentPlatformRuntime } from "@/types/host/AgentHost.js";
|
|
20
|
+
import type {
|
|
21
|
+
Plugin,
|
|
22
|
+
PluginAvailability,
|
|
23
|
+
PluginPort,
|
|
24
|
+
PluginView,
|
|
25
|
+
} from "@/plugin/types/Plugin.js";
|
|
26
|
+
import type {
|
|
27
|
+
AgentOptions,
|
|
28
|
+
AgentSessionMetadata,
|
|
29
|
+
AgentSessionSystemBlock,
|
|
30
|
+
} from "@/sdk/AgentSdkTypes.js";
|
|
31
|
+
import { Session } from "@/sdk/Session.js";
|
|
32
|
+
import { DEFAULT_SHIP_PROMPTS } from "@session/composer/system/default/SystemDomain.js";
|
|
33
|
+
import { getSdkAgentSessionsRootDirPath } from "@/sdk/Paths.js";
|
|
34
|
+
import {
|
|
35
|
+
createAgentPathRuntime,
|
|
36
|
+
createAgentPluginConfigRuntime,
|
|
37
|
+
} from "@/host/runtime/AgentHostRuntime.js";
|
|
38
|
+
import { loadDowncityConfig } from "@/config/Config.js";
|
|
39
|
+
import { appendExecSessionMessage } from "@/service/builtins/chat/runtime/ChatIngressStore.js";
|
|
40
|
+
import { readChatMetaBySessionId } from "@/service/builtins/chat/runtime/ChatMetaStore.js";
|
|
41
|
+
import { resolveChatQueueStore } from "@/service/builtins/chat/runtime/ChatQueueStore.js";
|
|
42
|
+
import { HookRegistry } from "@/plugin/core/HookRegistry.js";
|
|
43
|
+
import { PluginRegistry } from "@/plugin/core/PluginRegistry.js";
|
|
44
|
+
import { isPluginEnabled } from "@/plugin/core/Activation.js";
|
|
45
|
+
import { PLUGINS } from "@/plugin/core/Plugins.js";
|
|
46
|
+
import { createRegisteredServiceInstances } from "@/service/core/ServiceClassRegistry.js";
|
|
47
|
+
import { setShellToolRuntime } from "@session/tools/shell/ShellToolDefinition.js";
|
|
48
|
+
|
|
49
|
+
const EMPTY_SDK_PLATFORM: AgentPlatformRuntime = {
|
|
50
|
+
getGlobalEnv: () => ({}),
|
|
51
|
+
getAgentEnv: () => ({}),
|
|
52
|
+
listModels: () => [],
|
|
53
|
+
listProviders: async () => [],
|
|
54
|
+
getModel: () => null,
|
|
55
|
+
getChannelAccount: () => null,
|
|
56
|
+
readChatAuthorizationConfig: () => ({
|
|
57
|
+
roles: {},
|
|
58
|
+
channels: {},
|
|
59
|
+
}),
|
|
60
|
+
writeChatAuthorizationConfig: async (_projectRoot, nextConfig) => nextConfig,
|
|
61
|
+
setChatAuthorizationUserRole: async () => ({
|
|
62
|
+
roles: {},
|
|
63
|
+
channels: {},
|
|
64
|
+
}),
|
|
65
|
+
isPluginEnabled: (pluginName) => pluginName === "auth",
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
function createFallbackSdkConfig(agentId: string): DowncityConfig {
|
|
69
|
+
return {
|
|
70
|
+
name: agentId,
|
|
71
|
+
version: "0.0.0",
|
|
72
|
+
} as DowncityConfig;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function normalizeInstructionInput(input: string | string[] | undefined): string[] {
|
|
76
|
+
const items = Array.isArray(input) ? input : typeof input === "string" ? [input] : [];
|
|
77
|
+
return items
|
|
78
|
+
.map((item) => String(item || "").trim())
|
|
79
|
+
.filter((item) => item.length > 0);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function createCoreInstructionContent(projectRoot: string): string {
|
|
83
|
+
const currentYear = String(new Date().getFullYear());
|
|
84
|
+
return DEFAULT_SHIP_PROMPTS
|
|
85
|
+
.replaceAll("{{project_path}}", projectRoot)
|
|
86
|
+
.replaceAll("{{project_root}}", projectRoot)
|
|
87
|
+
.replaceAll("{{current_year}}", currentYear);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function createInstructionSystemBlocks(
|
|
91
|
+
instruction: string[],
|
|
92
|
+
projectRoot: string,
|
|
93
|
+
): AgentSessionSystemBlock[] {
|
|
94
|
+
if (instruction.length === 0) {
|
|
95
|
+
return [
|
|
96
|
+
{
|
|
97
|
+
source: "core",
|
|
98
|
+
name: "default",
|
|
99
|
+
content: createCoreInstructionContent(projectRoot),
|
|
100
|
+
},
|
|
101
|
+
];
|
|
102
|
+
}
|
|
103
|
+
return instruction.map((content, index) => ({
|
|
104
|
+
source: "instruction" as const,
|
|
105
|
+
name: instruction.length === 1 ? "agent" : `agent:${index + 1}`,
|
|
106
|
+
content,
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* SDK / server 共用的实例级 Agent 内核。
|
|
112
|
+
*/
|
|
113
|
+
export class AgentCore {
|
|
114
|
+
readonly id: string;
|
|
115
|
+
readonly path: string;
|
|
116
|
+
readonly tools: Record<string, Tool>;
|
|
117
|
+
readonly services: Map<string, BaseService>;
|
|
118
|
+
readonly plugins: PluginPort;
|
|
119
|
+
|
|
120
|
+
private readonly logger: Logger;
|
|
121
|
+
private readonly sessionsById = new Map<string, Session>();
|
|
122
|
+
private readonly runtime: AgentRuntime;
|
|
123
|
+
private readonly serviceContext: AgentContext;
|
|
124
|
+
private readonly pluginRegistry: PluginRegistry;
|
|
125
|
+
private readonly pluginSystemProviders: Plugin[];
|
|
126
|
+
private readonly config: DowncityConfig;
|
|
127
|
+
private readonly platform: AgentPlatformRuntime;
|
|
128
|
+
private readonly env: Record<string, string>;
|
|
129
|
+
private readonly globalEnv: Record<string, string>;
|
|
130
|
+
private readonly configureSessionHook?: AgentOptions["configureSession"];
|
|
131
|
+
private instruction: string[];
|
|
132
|
+
private servicesStartPromise: Promise<void> | null = null;
|
|
133
|
+
private configuredSessionIds = new Set<string>();
|
|
134
|
+
|
|
135
|
+
constructor(options: AgentOptions) {
|
|
136
|
+
this.id = String(options.id || "").trim();
|
|
137
|
+
this.path = String(options.path || "").trim();
|
|
138
|
+
this.tools = options.tools && typeof options.tools === "object"
|
|
139
|
+
? { ...options.tools }
|
|
140
|
+
: {};
|
|
141
|
+
if (!this.id) {
|
|
142
|
+
throw new Error("Agent requires a non-empty id");
|
|
143
|
+
}
|
|
144
|
+
if (!this.path) {
|
|
145
|
+
throw new Error("Agent requires a non-empty path");
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
this.logger = new Logger();
|
|
149
|
+
this.logger.bindProjectRoot(this.path);
|
|
150
|
+
this.platform = options.platform || EMPTY_SDK_PLATFORM;
|
|
151
|
+
this.globalEnv = this.platform.getGlobalEnv?.() || {};
|
|
152
|
+
this.env = this.platform.getAgentEnv?.(this.path) || {};
|
|
153
|
+
this.instruction = normalizeInstructionInput(options.instruction);
|
|
154
|
+
this.configureSessionHook = options.configureSession;
|
|
155
|
+
this.config = this.loadConfig();
|
|
156
|
+
this.services = new Map<string, BaseService>();
|
|
157
|
+
this.runtime = this.createRuntime();
|
|
158
|
+
this.registerServices({
|
|
159
|
+
explicitServices: options.services || [],
|
|
160
|
+
useBuiltinServices: options.useBuiltinServices === true,
|
|
161
|
+
});
|
|
162
|
+
this.pluginSystemProviders = this.resolvePlugins({
|
|
163
|
+
explicitPlugins: options.plugins,
|
|
164
|
+
useBuiltinPlugins: options.useBuiltinPlugins === true,
|
|
165
|
+
});
|
|
166
|
+
this.pluginRegistry = this.createPluginRegistry(this.pluginSystemProviders);
|
|
167
|
+
this.plugins = this.createPluginPort();
|
|
168
|
+
this.serviceContext = this.createServiceContext();
|
|
169
|
+
setShellToolRuntime(this.serviceContext.invoke);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* 返回实例级 runtime 视图。
|
|
174
|
+
*/
|
|
175
|
+
getRuntime(): AgentRuntime {
|
|
176
|
+
return this.runtime;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* 返回实例级执行上下文。
|
|
181
|
+
*/
|
|
182
|
+
getContext(): AgentContext {
|
|
183
|
+
return this.serviceContext;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* 返回当前项目根目录解析后的配置快照。
|
|
188
|
+
*/
|
|
189
|
+
getConfig(): DowncityConfig {
|
|
190
|
+
return this.config;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* 返回统一日志器。
|
|
195
|
+
*/
|
|
196
|
+
getLogger(): Logger {
|
|
197
|
+
return this.logger;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* 获取或创建一个 session。
|
|
202
|
+
*/
|
|
203
|
+
async session(sessionId?: string): Promise<Session> {
|
|
204
|
+
const session = this.getOrCreateSession(sessionId);
|
|
205
|
+
await session.initialize();
|
|
206
|
+
await this.configureSession(session);
|
|
207
|
+
return session;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* 列出当前 agent 的全部 session 元数据。
|
|
212
|
+
*/
|
|
213
|
+
async sessions(): Promise<AgentSessionMetadata[]> {
|
|
214
|
+
const rootDir = getSdkAgentSessionsRootDirPath(this.path, this.id);
|
|
215
|
+
if (!(await fs.pathExists(rootDir))) return [];
|
|
216
|
+
const entries = await fs.readdir(rootDir, { withFileTypes: true });
|
|
217
|
+
const items: AgentSessionMetadata[] = [];
|
|
218
|
+
for (const entry of entries) {
|
|
219
|
+
if (!entry.isDirectory()) continue;
|
|
220
|
+
let sessionId = "";
|
|
221
|
+
try {
|
|
222
|
+
sessionId = decodeURIComponent(entry.name);
|
|
223
|
+
} catch {
|
|
224
|
+
sessionId = entry.name;
|
|
225
|
+
}
|
|
226
|
+
if (!sessionId) continue;
|
|
227
|
+
const session = await this.session(sessionId);
|
|
228
|
+
items.push(await session.toMetadata());
|
|
229
|
+
}
|
|
230
|
+
items.sort((a, b) => (b.updatedAt || 0) - (a.updatedAt || 0));
|
|
231
|
+
return items;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* 确保显式注入的 services 已启动。
|
|
236
|
+
*/
|
|
237
|
+
async ensureServicesStarted(): Promise<void> {
|
|
238
|
+
if (this.servicesStartPromise) {
|
|
239
|
+
await this.servicesStartPromise;
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
this.servicesStartPromise = (async () => {
|
|
243
|
+
for (const service of this.services.values()) {
|
|
244
|
+
await service.lifecycle?.start?.(this.serviceContext);
|
|
245
|
+
}
|
|
246
|
+
})();
|
|
247
|
+
await this.servicesStartPromise;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* 更新当前 Agent 的静态基础指令。
|
|
252
|
+
*/
|
|
253
|
+
setInstruction(input: string | string[]): void {
|
|
254
|
+
this.instruction = normalizeInstructionInput(input);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
private loadConfig(): DowncityConfig {
|
|
258
|
+
try {
|
|
259
|
+
return loadDowncityConfig(this.path, {
|
|
260
|
+
projectEnv: this.env,
|
|
261
|
+
agentEnv: this.env,
|
|
262
|
+
globalEnv: this.globalEnv,
|
|
263
|
+
});
|
|
264
|
+
} catch {
|
|
265
|
+
return createFallbackSdkConfig(this.id);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
private registerServices(input: {
|
|
270
|
+
explicitServices: BaseService[];
|
|
271
|
+
useBuiltinServices: boolean;
|
|
272
|
+
}): void {
|
|
273
|
+
const explicitServices = input.explicitServices;
|
|
274
|
+
const builtinServices = input.useBuiltinServices
|
|
275
|
+
? [...createRegisteredServiceInstances(this.runtime).values()]
|
|
276
|
+
: [];
|
|
277
|
+
for (const service of [...builtinServices, ...explicitServices]) {
|
|
278
|
+
const name = String(service?.name || "").trim();
|
|
279
|
+
if (!name) {
|
|
280
|
+
throw new Error("Agent received a service without a valid name");
|
|
281
|
+
}
|
|
282
|
+
if (this.services.has(name)) {
|
|
283
|
+
throw new Error(`Duplicate service registration: ${name}`);
|
|
284
|
+
}
|
|
285
|
+
service.bindAgent(this.runtime);
|
|
286
|
+
this.services.set(name, service);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
private resolvePlugins(input: {
|
|
291
|
+
explicitPlugins?: Plugin[];
|
|
292
|
+
useBuiltinPlugins: boolean;
|
|
293
|
+
}): Plugin[] {
|
|
294
|
+
const plugins = input.useBuiltinPlugins ? [...PLUGINS] : [];
|
|
295
|
+
if (Array.isArray(input.explicitPlugins)) {
|
|
296
|
+
plugins.push(...input.explicitPlugins);
|
|
297
|
+
}
|
|
298
|
+
return plugins;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
private createPluginRegistry(input: Plugin[]): PluginRegistry {
|
|
302
|
+
let pluginRegistryRef: PluginRegistry | null = null;
|
|
303
|
+
const hookRegistry = new HookRegistry({
|
|
304
|
+
contextResolver: () => this.serviceContext,
|
|
305
|
+
pluginEnabledChecker: (pluginName) => {
|
|
306
|
+
const plugin = pluginRegistryRef?.get(pluginName);
|
|
307
|
+
return plugin ? isPluginEnabled({ plugin, context: this.serviceContext }) : false;
|
|
308
|
+
},
|
|
309
|
+
});
|
|
310
|
+
const registry = new PluginRegistry({
|
|
311
|
+
contextResolver: () => this.serviceContext,
|
|
312
|
+
hookRegistry,
|
|
313
|
+
});
|
|
314
|
+
pluginRegistryRef = registry;
|
|
315
|
+
|
|
316
|
+
for (const plugin of input) {
|
|
317
|
+
registry.register(plugin);
|
|
318
|
+
}
|
|
319
|
+
return registry;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
private createPluginPort(): PluginPort {
|
|
323
|
+
return {
|
|
324
|
+
list: (): PluginView[] => this.pluginRegistry.list(),
|
|
325
|
+
availability: async (pluginName: string): Promise<PluginAvailability> =>
|
|
326
|
+
await this.pluginRegistry.availability(pluginName),
|
|
327
|
+
runAction: async (params) => await this.pluginRegistry.runAction(params),
|
|
328
|
+
pipeline: async <T>(pointName: string, value: T): Promise<T> =>
|
|
329
|
+
await this.pluginRegistry.pipeline(pointName, value),
|
|
330
|
+
guard: async <T>(pointName: string, value: T): Promise<void> => {
|
|
331
|
+
await this.pluginRegistry.guard(pointName, value);
|
|
332
|
+
},
|
|
333
|
+
effect: async <T>(pointName: string, value: T): Promise<void> => {
|
|
334
|
+
await this.pluginRegistry.effect(pointName, value);
|
|
335
|
+
},
|
|
336
|
+
resolve: async <TInput, TOutput>(
|
|
337
|
+
pointName: string,
|
|
338
|
+
value: TInput,
|
|
339
|
+
): Promise<TOutput> =>
|
|
340
|
+
await this.pluginRegistry.resolve<TInput, TOutput>(pointName, value),
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
private loadInstructionSystemBlocks(): AgentSessionSystemBlock[] {
|
|
345
|
+
return createInstructionSystemBlocks(this.instruction, this.path);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
private async loadPluginSystemBlocks(): Promise<AgentSessionSystemBlock[]> {
|
|
349
|
+
const out: AgentSessionSystemBlock[] = [];
|
|
350
|
+
for (const plugin of this.pluginSystemProviders) {
|
|
351
|
+
if (typeof plugin.system !== "function") continue;
|
|
352
|
+
try {
|
|
353
|
+
if (!isPluginEnabled({ plugin, context: this.serviceContext })) continue;
|
|
354
|
+
if (typeof plugin.availability === "function") {
|
|
355
|
+
const availability = await plugin.availability(this.serviceContext);
|
|
356
|
+
if (!availability.available) continue;
|
|
357
|
+
}
|
|
358
|
+
const text = String(await plugin.system(this.serviceContext)).trim();
|
|
359
|
+
if (!text) continue;
|
|
360
|
+
out.push({
|
|
361
|
+
source: "plugin",
|
|
362
|
+
name: plugin.name,
|
|
363
|
+
content: text,
|
|
364
|
+
});
|
|
365
|
+
} catch {
|
|
366
|
+
// 单个 plugin system 失败不应阻断 SDK session 主链路。
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
return out;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
private async loadServiceSystemBlocks(): Promise<AgentSessionSystemBlock[]> {
|
|
373
|
+
const out: AgentSessionSystemBlock[] = [];
|
|
374
|
+
for (const service of this.services.values()) {
|
|
375
|
+
if (typeof service.system !== "function") continue;
|
|
376
|
+
try {
|
|
377
|
+
const text = String(await service.system(this.serviceContext)).trim();
|
|
378
|
+
if (!text) continue;
|
|
379
|
+
out.push({
|
|
380
|
+
source: "service",
|
|
381
|
+
name: service.name,
|
|
382
|
+
content: text,
|
|
383
|
+
});
|
|
384
|
+
} catch {
|
|
385
|
+
// 单个 service system 失败不应阻断 SDK session 主链路。
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
return out;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
private createRuntime(): AgentRuntime {
|
|
392
|
+
const runtime = {
|
|
393
|
+
cwd: this.path,
|
|
394
|
+
rootPath: this.path,
|
|
395
|
+
logger: this.logger,
|
|
396
|
+
config: this.config,
|
|
397
|
+
env: this.env,
|
|
398
|
+
globalEnv: this.globalEnv,
|
|
399
|
+
systems: this.instruction,
|
|
400
|
+
paths: createAgentPathRuntime(this.path),
|
|
401
|
+
pluginConfig: createAgentPluginConfigRuntime(this.path),
|
|
402
|
+
platform: this.platform,
|
|
403
|
+
model: undefined,
|
|
404
|
+
getSession: (sessionId: string) => {
|
|
405
|
+
return this.getOrCreateSession(sessionId).getServicePort() as never;
|
|
406
|
+
},
|
|
407
|
+
listExecutingSessionIds: () =>
|
|
408
|
+
[...this.sessionsById.values()]
|
|
409
|
+
.filter((session) => session.isExecuting())
|
|
410
|
+
.map((session) => session.id),
|
|
411
|
+
getExecutingSessionCount: () =>
|
|
412
|
+
[...this.sessionsById.values()].filter((session) => session.isExecuting()).length,
|
|
413
|
+
services: this.services,
|
|
414
|
+
} satisfies Omit<AgentRuntime, "getSession"> & {
|
|
415
|
+
getSession(sessionId: string): never;
|
|
416
|
+
};
|
|
417
|
+
return runtime as unknown as AgentRuntime;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
private createServiceContext(): AgentContext {
|
|
421
|
+
let context!: AgentContext;
|
|
422
|
+
context = {
|
|
423
|
+
agent: this.runtime,
|
|
424
|
+
cwd: this.path,
|
|
425
|
+
rootPath: this.path,
|
|
426
|
+
logger: this.logger,
|
|
427
|
+
config: this.config,
|
|
428
|
+
env: this.env,
|
|
429
|
+
globalEnv: this.globalEnv,
|
|
430
|
+
systems: this.instruction,
|
|
431
|
+
paths: this.runtime.paths,
|
|
432
|
+
pluginConfig: this.runtime.pluginConfig,
|
|
433
|
+
platform: this.platform,
|
|
434
|
+
session: {
|
|
435
|
+
get: (sessionId) => this.getOrCreateSession(sessionId).getServicePort(),
|
|
436
|
+
listExecutingSessionIds: () => this.runtime.listExecutingSessionIds(),
|
|
437
|
+
getExecutingSessionCount: () => this.runtime.getExecutingSessionCount(),
|
|
438
|
+
},
|
|
439
|
+
invoke: {
|
|
440
|
+
invoke: async (params: {
|
|
441
|
+
service: string;
|
|
442
|
+
action: string;
|
|
443
|
+
payload?: JsonValue;
|
|
444
|
+
}) => {
|
|
445
|
+
const serviceName = String(params.service || "").trim();
|
|
446
|
+
const actionName = String(params.action || "").trim();
|
|
447
|
+
const service = this.services.get(serviceName);
|
|
448
|
+
if (!service) {
|
|
449
|
+
return {
|
|
450
|
+
success: false,
|
|
451
|
+
error: `Unknown service: ${serviceName}`,
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
const action = service.actions[actionName];
|
|
455
|
+
if (!action) {
|
|
456
|
+
return {
|
|
457
|
+
success: false,
|
|
458
|
+
error: `Unknown action: ${serviceName}.${actionName}`,
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
const result = await action.execute({
|
|
462
|
+
context,
|
|
463
|
+
payload: params.payload ?? null,
|
|
464
|
+
serviceName,
|
|
465
|
+
actionName,
|
|
466
|
+
});
|
|
467
|
+
if (!result.success) {
|
|
468
|
+
return {
|
|
469
|
+
success: false,
|
|
470
|
+
...(result.error ? { error: result.error } : {}),
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
return {
|
|
474
|
+
success: true,
|
|
475
|
+
...(result.data !== undefined ? { data: result.data } : {}),
|
|
476
|
+
};
|
|
477
|
+
},
|
|
478
|
+
},
|
|
479
|
+
chat: {
|
|
480
|
+
readMetaBySessionId: async (sessionId: string) => {
|
|
481
|
+
return await readChatMetaBySessionId({
|
|
482
|
+
context,
|
|
483
|
+
sessionId,
|
|
484
|
+
});
|
|
485
|
+
},
|
|
486
|
+
appendExecSessionMessage: async (params) => {
|
|
487
|
+
await appendExecSessionMessage({
|
|
488
|
+
context,
|
|
489
|
+
sessionId: params.sessionId,
|
|
490
|
+
text: params.text,
|
|
491
|
+
extra: params.extra,
|
|
492
|
+
});
|
|
493
|
+
},
|
|
494
|
+
enqueue: (params) => resolveChatQueueStore(context).enqueue(params),
|
|
495
|
+
},
|
|
496
|
+
plugins: this.plugins,
|
|
497
|
+
};
|
|
498
|
+
return context;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
private getOrCreateSession(sessionId?: string): Session {
|
|
502
|
+
const resolvedSessionId =
|
|
503
|
+
String(sessionId || "").trim() || `session-${Date.now()}-${nanoid(8)}`;
|
|
504
|
+
const cached = this.sessionsById.get(resolvedSessionId);
|
|
505
|
+
if (cached) return cached;
|
|
506
|
+
|
|
507
|
+
const created = new Session({
|
|
508
|
+
agentId: this.id,
|
|
509
|
+
projectRoot: this.path,
|
|
510
|
+
sessionId: resolvedSessionId,
|
|
511
|
+
tools: this.tools,
|
|
512
|
+
logger: this.logger,
|
|
513
|
+
getInstructionSystemBlocks: () => this.loadInstructionSystemBlocks(),
|
|
514
|
+
getServiceSystemBlocks: () => this.loadServiceSystemBlocks(),
|
|
515
|
+
getPluginSystemBlocks: () => this.loadPluginSystemBlocks(),
|
|
516
|
+
});
|
|
517
|
+
this.sessionsById.set(resolvedSessionId, created);
|
|
518
|
+
return created;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
private async configureSession(session: Session): Promise<void> {
|
|
522
|
+
if (!this.configureSessionHook) return;
|
|
523
|
+
if (this.configuredSessionIds.has(session.id)) return;
|
|
524
|
+
await this.configureSessionHook(session);
|
|
525
|
+
this.configuredSessionIds.add(session.id);
|
|
526
|
+
}
|
|
527
|
+
}
|