@downcity/agent 1.1.13 → 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} +7 -7
- 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 +6 -8
- package/bin/index.d.ts.map +1 -1
- package/bin/index.js +2 -5
- 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 +25 -23
- 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 +2 -2
- package/bin/sdk/Session.d.ts.map +1 -1
- package/bin/sdk/Session.js +7 -1
- package/bin/sdk/Session.js.map +1 -1
- package/bin/sdk/SessionServicePort.d.ts +1 -1
- package/bin/sdk/SessionServicePort.d.ts.map +1 -1
- 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/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 +1 -1
- package/bin/service/builtins/task/runtime/Runner.d.ts.map +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 +1 -1
- package/bin/service/builtins/task/runtime/TaskRunnerSession.d.ts.map +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/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/tools/shell/ShellToolBridge.d.ts +1 -1
- package/bin/session/tools/shell/ShellToolBridge.d.ts.map +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} +6 -6
- package/src/host/runtime/PluginRuntime.ts +1 -1
- package/src/index.ts +24 -21
- 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 +99 -393
- 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 +12 -2
- package/src/sdk/SessionServicePort.ts +1 -1
- 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/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 +1 -1
- 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 +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/composer/system/default/DefaultSessionSystemComposer.ts +1 -1
- package/src/session/composer/system/default/SystemDomain.ts +1 -1
- package/src/session/tools/shell/ShellToolBridge.ts +1 -1
- 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 -291
- 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/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/src/runtime/AgentContext.ts +0 -182
- package/src/runtime/AgentRuntime.ts +0 -366
- package/src/runtime/AgentRuntimeState.ts +0 -213
- package/src/service/core/ServiceActionApi.ts +0 -304
- package/src/service/schedule/Runtime.ts +0 -78
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* contact action 注册表。
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
|
-
* - 这里只负责 CLI
|
|
5
|
+
* - 这里只负责 CLI action 与内部远端 command action 映射,不承载 contact 业务实现。
|
|
6
6
|
* - 业务动作通过 handlers 注入,保持 `ContactService` 类本身更薄。
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type { AgentContext } from "@/
|
|
9
|
+
import type { AgentContext } from "@/core/AgentContextTypes.js";
|
|
10
10
|
import type { JsonObject, JsonValue } from "@/types/common/Json.js";
|
|
11
11
|
import type { ServiceActions } from "@/service/types/Service.js";
|
|
12
12
|
import type {
|
|
@@ -31,7 +31,6 @@ import { receiveContactChatMessage } from "./runtime/ChatRuntime.js";
|
|
|
31
31
|
import { listContactInboxShares } from "./runtime/InboxStore.js";
|
|
32
32
|
import { receiveShare } from "./runtime/ShareBundle.js";
|
|
33
33
|
import {
|
|
34
|
-
getContactHeaderToken,
|
|
35
34
|
readContactObject,
|
|
36
35
|
readContactString,
|
|
37
36
|
} from "./runtime/ContactPayload.js";
|
|
@@ -267,20 +266,6 @@ export function createContactActions(handlers: ContactActionHandlers): ServiceAc
|
|
|
267
266
|
}),
|
|
268
267
|
},
|
|
269
268
|
remoteping: {
|
|
270
|
-
api: {
|
|
271
|
-
method: "POST",
|
|
272
|
-
path: "/api/contact/ping",
|
|
273
|
-
async mapInput(ctx) {
|
|
274
|
-
const body = (await ctx.req.json().catch(() => ({}))) as JsonValue;
|
|
275
|
-
return {
|
|
276
|
-
body,
|
|
277
|
-
token: getContactHeaderToken({
|
|
278
|
-
headers: ctx.req.raw.headers,
|
|
279
|
-
body: readContactObject(body),
|
|
280
|
-
}),
|
|
281
|
-
} as unknown as JsonValue;
|
|
282
|
-
},
|
|
283
|
-
},
|
|
284
269
|
execute: async (params) => ({
|
|
285
270
|
success: true,
|
|
286
271
|
data: (await handlers.remotePing(
|
|
@@ -290,13 +275,6 @@ export function createContactActions(handlers: ContactActionHandlers): ServiceAc
|
|
|
290
275
|
}),
|
|
291
276
|
},
|
|
292
277
|
remoteapprove: {
|
|
293
|
-
api: {
|
|
294
|
-
method: "POST",
|
|
295
|
-
path: "/api/contact/approve",
|
|
296
|
-
async mapInput(ctx) {
|
|
297
|
-
return (await ctx.req.json()) as JsonValue;
|
|
298
|
-
},
|
|
299
|
-
},
|
|
300
278
|
execute: async (params) => ({
|
|
301
279
|
success: true,
|
|
302
280
|
data: (await handlers.remoteApprove(
|
|
@@ -306,13 +284,6 @@ export function createContactActions(handlers: ContactActionHandlers): ServiceAc
|
|
|
306
284
|
}),
|
|
307
285
|
},
|
|
308
286
|
remoteconfirm: {
|
|
309
|
-
api: {
|
|
310
|
-
method: "POST",
|
|
311
|
-
path: "/api/contact/confirm",
|
|
312
|
-
async mapInput(ctx) {
|
|
313
|
-
return (await ctx.req.json()) as JsonValue;
|
|
314
|
-
},
|
|
315
|
-
},
|
|
316
287
|
execute: async (params) => ({
|
|
317
288
|
success: true,
|
|
318
289
|
data: (await handlers.remoteConfirm(
|
|
@@ -322,20 +293,6 @@ export function createContactActions(handlers: ContactActionHandlers): ServiceAc
|
|
|
322
293
|
}),
|
|
323
294
|
},
|
|
324
295
|
remotechat: {
|
|
325
|
-
api: {
|
|
326
|
-
method: "POST",
|
|
327
|
-
path: "/api/contact/chat",
|
|
328
|
-
async mapInput(ctx) {
|
|
329
|
-
const body = (await ctx.req.json()) as JsonValue;
|
|
330
|
-
return {
|
|
331
|
-
body,
|
|
332
|
-
token: getContactHeaderToken({
|
|
333
|
-
headers: ctx.req.raw.headers,
|
|
334
|
-
body: readContactObject(body),
|
|
335
|
-
}),
|
|
336
|
-
} as unknown as JsonValue;
|
|
337
|
-
},
|
|
338
|
-
},
|
|
339
296
|
execute: async (params) => {
|
|
340
297
|
const payload = readContactObject(params.payload);
|
|
341
298
|
const body = readContactObject(payload.body);
|
|
@@ -350,20 +307,6 @@ export function createContactActions(handlers: ContactActionHandlers): ServiceAc
|
|
|
350
307
|
},
|
|
351
308
|
},
|
|
352
309
|
remoteshare: {
|
|
353
|
-
api: {
|
|
354
|
-
method: "POST",
|
|
355
|
-
path: "/api/contact/share",
|
|
356
|
-
async mapInput(ctx) {
|
|
357
|
-
const body = (await ctx.req.json()) as JsonValue;
|
|
358
|
-
return {
|
|
359
|
-
body,
|
|
360
|
-
token: getContactHeaderToken({
|
|
361
|
-
headers: ctx.req.raw.headers,
|
|
362
|
-
body: readContactObject(body),
|
|
363
|
-
}),
|
|
364
|
-
} as unknown as JsonValue;
|
|
365
|
-
},
|
|
366
|
-
},
|
|
367
310
|
execute: async (params) => ({
|
|
368
311
|
success: true,
|
|
369
312
|
data: (await handlers.remoteShare(params.context, params.payload)) as unknown as JsonValue,
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* - `share` 分享文本、链接、文件和目录,并进入对方 inbox。
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import type { AgentRuntime } from "@/
|
|
11
|
-
import type { AgentContext } from "@/
|
|
10
|
+
import type { AgentRuntime } from "@/core/AgentCoreTypes.js";
|
|
11
|
+
import type { AgentContext } from "@/core/AgentContextTypes.js";
|
|
12
12
|
import type { JsonValue } from "@/types/common/Json.js";
|
|
13
13
|
import type { ServiceActions } from "@/service/types/Service.js";
|
|
14
14
|
import { BaseService } from "@/service/builtins/BaseService.js";
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* - 远端收到 chat 后运行本地 agent session,并返回 assistant 文本。
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type { AgentContext } from "@/
|
|
9
|
+
import type { AgentContext } from "@/core/AgentContextTypes.js";
|
|
10
10
|
import type { ContactChatResponse } from "@/service/builtins/contact/types/ContactChat.js";
|
|
11
11
|
import type { SessionMessageV1 } from "@/session/types/SessionMessages.js";
|
|
12
12
|
import {
|
|
@@ -24,15 +24,3 @@ export function readContactString(body: JsonObject, key: string): string {
|
|
|
24
24
|
const value = body[key];
|
|
25
25
|
return typeof value === "string" ? value.trim() : "";
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* 从 contact HTTP header 或 body 中读取 contact token。
|
|
30
|
-
*/
|
|
31
|
-
export function getContactHeaderToken(params: {
|
|
32
|
-
headers?: Headers;
|
|
33
|
-
body?: JsonObject;
|
|
34
|
-
}): string {
|
|
35
|
-
const fromHeader = String(params.headers?.get("x-downcity-contact-token") || "").trim();
|
|
36
|
-
if (fromHeader) return fromHeader;
|
|
37
|
-
return params.body ? readContactString(params.body, "token") : "";
|
|
38
|
-
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* contact 远端 HTTP 客户端。
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
|
-
* - contact 的 agent-to-agent
|
|
5
|
+
* - contact 的 agent-to-agent 调用统一走 `/api/services/command`。
|
|
6
6
|
* - 已建联后的敏感调用必须携带 contact token。
|
|
7
7
|
*/
|
|
8
8
|
|
|
@@ -25,32 +25,51 @@ function normalizeEndpoint(endpoint: string): string {
|
|
|
25
25
|
return url.toString().replace(/\/$/, "");
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
function
|
|
28
|
+
function unwrapServiceCommandEnvelope<T>(value: T): T {
|
|
29
29
|
if (!isRecord(value)) return value;
|
|
30
30
|
const inner = value.data;
|
|
31
31
|
if (typeof value.success === "boolean" && isRecord(inner)) {
|
|
32
|
-
//
|
|
32
|
+
// 关键点(中文):统一 command 路由会包一层 `{ success, data }`。
|
|
33
33
|
return inner as T;
|
|
34
34
|
}
|
|
35
35
|
return value;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
async function
|
|
38
|
+
async function postServiceCommand<T>(params: {
|
|
39
39
|
endpoint: string;
|
|
40
|
-
|
|
40
|
+
command: string;
|
|
41
41
|
body?: JsonValue;
|
|
42
42
|
token?: string;
|
|
43
|
+
wrapBody?: boolean;
|
|
43
44
|
}): Promise<T> {
|
|
44
|
-
const url = new URL(
|
|
45
|
+
const url = new URL("/api/services/command", normalizeEndpoint(params.endpoint)).toString();
|
|
46
|
+
const payloadBody =
|
|
47
|
+
params.wrapBody
|
|
48
|
+
? {
|
|
49
|
+
...(params.body !== undefined ? { body: params.body } : {}),
|
|
50
|
+
...(params.token ? { token: params.token } : {}),
|
|
51
|
+
}
|
|
52
|
+
: params.body && isRecord(params.body)
|
|
53
|
+
? {
|
|
54
|
+
...params.body,
|
|
55
|
+
...(params.token ? { token: params.token } : {}),
|
|
56
|
+
}
|
|
57
|
+
: {
|
|
58
|
+
...(params.body !== undefined ? { body: params.body } : {}),
|
|
59
|
+
...(params.token ? { token: params.token } : {}),
|
|
60
|
+
};
|
|
45
61
|
const headers: Record<string, string> = {
|
|
46
62
|
"Content-Type": "application/json",
|
|
47
63
|
};
|
|
48
|
-
if (params.token) headers["X-Downcity-Contact-Token"] = params.token;
|
|
49
64
|
|
|
50
65
|
const response = await fetch(url, {
|
|
51
66
|
method: "POST",
|
|
52
67
|
headers,
|
|
53
|
-
body: JSON.stringify(
|
|
68
|
+
body: JSON.stringify({
|
|
69
|
+
serviceName: "contact",
|
|
70
|
+
command: params.command,
|
|
71
|
+
payload: payloadBody,
|
|
72
|
+
}),
|
|
54
73
|
});
|
|
55
74
|
const data = (await response.json().catch(() => null)) as T & {
|
|
56
75
|
error?: string;
|
|
@@ -59,7 +78,7 @@ async function postJson<T>(params: {
|
|
|
59
78
|
if (!response.ok) {
|
|
60
79
|
throw new Error(data?.error || data?.message || `HTTP ${response.status}`);
|
|
61
80
|
}
|
|
62
|
-
return
|
|
81
|
+
return unwrapServiceCommandEnvelope<T>(data);
|
|
63
82
|
}
|
|
64
83
|
|
|
65
84
|
/**
|
|
@@ -69,9 +88,9 @@ export async function callContactPing<T>(params: {
|
|
|
69
88
|
endpoint: string;
|
|
70
89
|
token?: string;
|
|
71
90
|
}): Promise<T> {
|
|
72
|
-
return await
|
|
91
|
+
return await postServiceCommand<T>({
|
|
73
92
|
endpoint: params.endpoint,
|
|
74
|
-
|
|
93
|
+
command: "remoteping",
|
|
75
94
|
token: params.token,
|
|
76
95
|
});
|
|
77
96
|
}
|
|
@@ -83,9 +102,9 @@ export async function callContactApprove<T>(params: {
|
|
|
83
102
|
endpoint: string;
|
|
84
103
|
body: JsonValue;
|
|
85
104
|
}): Promise<T> {
|
|
86
|
-
return await
|
|
105
|
+
return await postServiceCommand<T>({
|
|
87
106
|
endpoint: params.endpoint,
|
|
88
|
-
|
|
107
|
+
command: "remoteapprove",
|
|
89
108
|
body: params.body,
|
|
90
109
|
});
|
|
91
110
|
}
|
|
@@ -97,9 +116,9 @@ export async function callContactConfirm<T>(params: {
|
|
|
97
116
|
endpoint: string;
|
|
98
117
|
body: JsonValue;
|
|
99
118
|
}): Promise<T> {
|
|
100
|
-
return await
|
|
119
|
+
return await postServiceCommand<T>({
|
|
101
120
|
endpoint: params.endpoint,
|
|
102
|
-
|
|
121
|
+
command: "remoteconfirm",
|
|
103
122
|
body: params.body,
|
|
104
123
|
});
|
|
105
124
|
}
|
|
@@ -112,11 +131,12 @@ export async function callContactChat<T>(params: {
|
|
|
112
131
|
token: string;
|
|
113
132
|
body: JsonValue;
|
|
114
133
|
}): Promise<T> {
|
|
115
|
-
return await
|
|
134
|
+
return await postServiceCommand<T>({
|
|
116
135
|
endpoint: params.endpoint,
|
|
117
|
-
|
|
136
|
+
command: "remotechat",
|
|
118
137
|
token: params.token,
|
|
119
138
|
body: params.body,
|
|
139
|
+
wrapBody: true,
|
|
120
140
|
});
|
|
121
141
|
}
|
|
122
142
|
|
|
@@ -128,10 +148,11 @@ export async function callContactShare<T>(params: {
|
|
|
128
148
|
token: string;
|
|
129
149
|
body: JsonValue;
|
|
130
150
|
}): Promise<T> {
|
|
131
|
-
return await
|
|
151
|
+
return await postServiceCommand<T>({
|
|
132
152
|
endpoint: params.endpoint,
|
|
133
|
-
|
|
153
|
+
command: "remoteshare",
|
|
134
154
|
token: params.token,
|
|
135
155
|
body: params.body,
|
|
156
|
+
wrapBody: true,
|
|
136
157
|
});
|
|
137
158
|
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import crypto from "node:crypto";
|
|
10
10
|
import fs from "fs-extra";
|
|
11
11
|
import path from "node:path";
|
|
12
|
-
import type { AgentContext } from "@/
|
|
12
|
+
import type { AgentContext } from "@/core/AgentContextTypes.js";
|
|
13
13
|
import type {
|
|
14
14
|
ContactInboxShareFileInput,
|
|
15
15
|
ContactInboxShareMeta,
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import type { ServiceActionResult } from "@/service/types/Service.js";
|
|
10
|
-
import type { AgentContext } from "@/
|
|
10
|
+
import type { AgentContext } from "@/core/AgentContextTypes.js";
|
|
11
11
|
import type { JsonValue } from "@/types/common/Json.js";
|
|
12
12
|
import type {
|
|
13
13
|
MemoryFlushPayload,
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import type { Command } from "commander";
|
|
11
11
|
import type { JsonObject, JsonValue } from "@/types/common/Json.js";
|
|
12
|
-
import type { AgentContext } from "@/
|
|
12
|
+
import type { AgentContext } from "@/core/AgentContextTypes.js";
|
|
13
13
|
import type { ServiceActions } from "@/service/types/Service.js";
|
|
14
14
|
import { BaseService } from "@/service/builtins/BaseService.js";
|
|
15
15
|
import {
|
|
@@ -123,9 +123,6 @@ export class MemoryService extends BaseService {
|
|
|
123
123
|
return {};
|
|
124
124
|
},
|
|
125
125
|
},
|
|
126
|
-
api: {
|
|
127
|
-
method: "GET",
|
|
128
|
-
},
|
|
129
126
|
execute: async (params) => {
|
|
130
127
|
const state = this.getOrCreateRuntimeState(params.context);
|
|
131
128
|
return await statusMemoryAction(params.context, state);
|
|
@@ -153,12 +150,6 @@ export class MemoryService extends BaseService {
|
|
|
153
150
|
return payload;
|
|
154
151
|
},
|
|
155
152
|
},
|
|
156
|
-
api: {
|
|
157
|
-
method: "POST",
|
|
158
|
-
mapInput(ctx) {
|
|
159
|
-
return ctx.req.json();
|
|
160
|
-
},
|
|
161
|
-
},
|
|
162
153
|
execute: async (params) => {
|
|
163
154
|
const body = readBodyObject(params.payload);
|
|
164
155
|
const state = this.getOrCreateRuntimeState(params.context);
|
|
@@ -191,12 +182,6 @@ export class MemoryService extends BaseService {
|
|
|
191
182
|
return payload;
|
|
192
183
|
},
|
|
193
184
|
},
|
|
194
|
-
api: {
|
|
195
|
-
method: "POST",
|
|
196
|
-
mapInput(ctx) {
|
|
197
|
-
return ctx.req.json();
|
|
198
|
-
},
|
|
199
|
-
},
|
|
200
185
|
execute: async (params) => {
|
|
201
186
|
const body = readBodyObject(params.payload);
|
|
202
187
|
return await getMemoryAction(params.context, {
|
|
@@ -228,12 +213,6 @@ export class MemoryService extends BaseService {
|
|
|
228
213
|
return payload;
|
|
229
214
|
},
|
|
230
215
|
},
|
|
231
|
-
api: {
|
|
232
|
-
method: "POST",
|
|
233
|
-
mapInput(ctx) {
|
|
234
|
-
return ctx.req.json();
|
|
235
|
-
},
|
|
236
|
-
},
|
|
237
216
|
execute: async (params) => {
|
|
238
217
|
const body = readBodyObject(params.payload);
|
|
239
218
|
const target = readOptionalString(body, "target");
|
|
@@ -266,12 +245,6 @@ export class MemoryService extends BaseService {
|
|
|
266
245
|
return payload;
|
|
267
246
|
},
|
|
268
247
|
},
|
|
269
|
-
api: {
|
|
270
|
-
method: "POST",
|
|
271
|
-
mapInput(ctx) {
|
|
272
|
-
return ctx.req.json();
|
|
273
|
-
},
|
|
274
|
-
},
|
|
275
248
|
execute: async (params) => {
|
|
276
249
|
const body = readBodyObject(params.payload);
|
|
277
250
|
const state = this.getOrCreateRuntimeState(params.context);
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import type { UIDataTypes, UIMessagePart, UITools } from "ai";
|
|
10
10
|
import { isTextUIPart } from "ai";
|
|
11
|
-
import type { AgentContext } from "@/
|
|
11
|
+
import type { AgentContext } from "@/core/AgentContextTypes.js";
|
|
12
12
|
import type {
|
|
13
13
|
MemoryFlushPayload,
|
|
14
14
|
MemoryFlushResponse,
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
import type { Dirent } from "node:fs";
|
|
12
12
|
import fsp from "node:fs/promises";
|
|
13
13
|
import path from "node:path";
|
|
14
|
-
import type { AgentContext } from "@/
|
|
14
|
+
import type { AgentContext } from "@/core/AgentContextTypes.js";
|
|
15
15
|
import type {
|
|
16
16
|
MemoryDefaults,
|
|
17
17
|
MemorySourceType,
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import fs from "node:fs/promises";
|
|
10
10
|
import path from "node:path";
|
|
11
|
-
import type { AgentContext } from "@/
|
|
11
|
+
import type { AgentContext } from "@/core/AgentContextTypes.js";
|
|
12
12
|
import { isMemoryEnabled } from "./Store.js";
|
|
13
13
|
|
|
14
14
|
const MAX_SYSTEM_MEMORY_ITEMS = 6;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import fs from "node:fs/promises";
|
|
10
10
|
import path from "node:path";
|
|
11
|
-
import type { AgentContext } from "@/
|
|
11
|
+
import type { AgentContext } from "@/core/AgentContextTypes.js";
|
|
12
12
|
import type {
|
|
13
13
|
MemoryGetPayload,
|
|
14
14
|
MemoryGetResponse,
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ScheduleService:通用延迟/定时 service action 调度器。
|
|
3
|
+
*
|
|
4
|
+
* 关键点(中文)
|
|
5
|
+
* - 这是 service 系统内部的基础设施 service,不直接承载业务 action。
|
|
6
|
+
* - 它负责轮询 `ServiceScheduleStore`,把到点任务重新派发回对应 service action。
|
|
7
|
+
* - 这样调度能力就归属于 service lifecycle,而不是 Agent 顶层 lifecycle。
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { AgentRuntime } from "@/core/AgentCoreTypes.js";
|
|
11
|
+
import type { AgentContext } from "@/core/AgentContextTypes.js";
|
|
12
|
+
import { BaseService } from "@/service/builtins/BaseService.js";
|
|
13
|
+
import type { ServiceActions } from "@/service/types/Service.js";
|
|
14
|
+
import { ServiceScheduleStore } from "@/service/schedule/Store.js";
|
|
15
|
+
import { runDueScheduledJobs } from "@/service/schedule/Executor.js";
|
|
16
|
+
|
|
17
|
+
const SCHEDULE_POLL_INTERVAL_MS = 200;
|
|
18
|
+
const SCHEDULE_LOG_PREFIX = "[SCHEDULE]";
|
|
19
|
+
|
|
20
|
+
function formatScheduleLogMessage(message: string): string {
|
|
21
|
+
return `${SCHEDULE_LOG_PREFIX} ${message}`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
type ScheduleRuntimeState = {
|
|
25
|
+
timer: NodeJS.Timeout | null;
|
|
26
|
+
ticking: boolean;
|
|
27
|
+
store: ServiceScheduleStore;
|
|
28
|
+
context: AgentContext;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* 通用调度 service。
|
|
33
|
+
*/
|
|
34
|
+
export class ScheduleService extends BaseService {
|
|
35
|
+
/**
|
|
36
|
+
* 当前 service 名称。
|
|
37
|
+
*/
|
|
38
|
+
readonly name = "schedule";
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* 当前 service 不暴露业务 action。
|
|
42
|
+
*/
|
|
43
|
+
readonly actions: ServiceActions = {};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* 当前实例持有的调度 runtime 状态。
|
|
47
|
+
*/
|
|
48
|
+
private runtimeState: ScheduleRuntimeState | null = null;
|
|
49
|
+
|
|
50
|
+
constructor(agent: AgentRuntime | null) {
|
|
51
|
+
super(agent);
|
|
52
|
+
|
|
53
|
+
this.lifecycle = {
|
|
54
|
+
start: async (context) => {
|
|
55
|
+
const started = await this.startRuntime(context);
|
|
56
|
+
if (!started) return;
|
|
57
|
+
context.logger.info(
|
|
58
|
+
formatScheduleLogMessage("Service scheduler started"),
|
|
59
|
+
);
|
|
60
|
+
},
|
|
61
|
+
stop: async (context) => {
|
|
62
|
+
const stopped = await this.stopRuntime();
|
|
63
|
+
if (!stopped) return;
|
|
64
|
+
context.logger.info(
|
|
65
|
+
formatScheduleLogMessage("Service scheduler stopped"),
|
|
66
|
+
);
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* 启动当前实例的调度 runtime。
|
|
73
|
+
*/
|
|
74
|
+
async startRuntime(context: AgentContext): Promise<boolean> {
|
|
75
|
+
if (this.runtimeState) return false;
|
|
76
|
+
|
|
77
|
+
const store = new ServiceScheduleStore(context.rootPath);
|
|
78
|
+
const recovered = store.resetRunningJobsToPending();
|
|
79
|
+
if (recovered > 0) {
|
|
80
|
+
context.logger.warn(
|
|
81
|
+
formatScheduleLogMessage("Recovered interrupted running jobs"),
|
|
82
|
+
{ recovered },
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
this.runtimeState = {
|
|
87
|
+
timer: null,
|
|
88
|
+
ticking: false,
|
|
89
|
+
store,
|
|
90
|
+
context,
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const tick = async () => {
|
|
94
|
+
const state = this.runtimeState;
|
|
95
|
+
if (!state || state.ticking) return;
|
|
96
|
+
state.ticking = true;
|
|
97
|
+
try {
|
|
98
|
+
await runDueScheduledJobs({
|
|
99
|
+
context: state.context,
|
|
100
|
+
store: state.store,
|
|
101
|
+
});
|
|
102
|
+
} finally {
|
|
103
|
+
const current = this.runtimeState;
|
|
104
|
+
if (current) {
|
|
105
|
+
current.ticking = false;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
await tick();
|
|
111
|
+
this.runtimeState.timer = setInterval(() => {
|
|
112
|
+
void tick();
|
|
113
|
+
}, SCHEDULE_POLL_INTERVAL_MS);
|
|
114
|
+
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* 停止当前实例的调度 runtime。
|
|
120
|
+
*/
|
|
121
|
+
async stopRuntime(): Promise<boolean> {
|
|
122
|
+
if (!this.runtimeState) return false;
|
|
123
|
+
const current = this.runtimeState;
|
|
124
|
+
this.runtimeState = null;
|
|
125
|
+
if (current.timer) {
|
|
126
|
+
clearInterval(current.timer);
|
|
127
|
+
}
|
|
128
|
+
current.store.close();
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import type { ChildProcessWithoutNullStreams } from "node:child_process";
|
|
11
|
-
import type { AgentContext } from "@/
|
|
11
|
+
import type { AgentContext } from "@/core/AgentContextTypes.js";
|
|
12
12
|
import type { ShellSessionSnapshot } from "@/service/builtins/shell/types/ShellService.js";
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
* - ShellActionRuntime 只保留纯运行时流程,不再承载模块级单例状态。
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import type { AgentRuntime } from "@/
|
|
10
|
+
import type { AgentRuntime } from "@/core/AgentCoreTypes.js";
|
|
11
11
|
import { BaseService } from "@/service/builtins/BaseService.js";
|
|
12
12
|
import type { ServiceActions } from "@/service/types/Service.js";
|
|
13
|
-
import type { AgentContext } from "@/
|
|
13
|
+
import type { AgentContext } from "@/core/AgentContextTypes.js";
|
|
14
14
|
import type {
|
|
15
15
|
ShellServiceState,
|
|
16
16
|
ShellSessionRuntimeState,
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import fs from "fs-extra";
|
|
11
|
-
import type { AgentContext } from "@/
|
|
11
|
+
import type { AgentContext } from "@/core/AgentContextTypes.js";
|
|
12
12
|
import { spawnShellProcess } from "@/sandbox/SandboxRunner.js";
|
|
13
13
|
import type {
|
|
14
14
|
ShellServiceState,
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import path from "node:path";
|
|
10
10
|
import fs from "fs-extra";
|
|
11
|
-
import type { AgentContext } from "@/
|
|
11
|
+
import type { AgentContext } from "@/core/AgentContextTypes.js";
|
|
12
12
|
import type {
|
|
13
13
|
ShellServiceState,
|
|
14
14
|
ShellSessionRuntimeState,
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import path from "node:path";
|
|
10
|
-
import type { AgentContext } from "@/
|
|
10
|
+
import type { AgentContext } from "@/core/AgentContextTypes.js";
|
|
11
11
|
import { stripInvocationAuthEnv } from "@/server/http/auth/AuthEnv.js";
|
|
12
12
|
import { getSessionRunScope } from "@session/SessionRunScope.js";
|
|
13
13
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import path from "node:path";
|
|
10
10
|
import type { ShipTaskStatus } from "./types/Task.js";
|
|
11
|
-
import type { AgentContext } from "@/
|
|
11
|
+
import type { AgentContext } from "@/core/AgentContextTypes.js";
|
|
12
12
|
import type { JsonValue } from "@/types/common/Json.js";
|
|
13
13
|
import {
|
|
14
14
|
deriveTaskIdFromTitle,
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
* - 当前文件只保留实例骨架与 lifecycle,不再依赖旧的模块级 `taskService` 单例。
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import type { AgentRuntime } from "@/
|
|
10
|
+
import type { AgentRuntime } from "@/core/AgentCoreTypes.js";
|
|
11
11
|
import { BaseService } from "@/service/builtins/BaseService.js";
|
|
12
12
|
import type { ServiceActions } from "@/service/types/Service.js";
|
|
13
|
-
import type { AgentContext } from "@/
|
|
13
|
+
import type { AgentContext } from "@/core/AgentContextTypes.js";
|
|
14
14
|
import type {
|
|
15
15
|
TaskCronRegisterResult,
|
|
16
16
|
TaskSchedulerReloadResult,
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* - 该模块是 task service 内部实现细节,core 只通过 service lifecycle 间接调用。
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type { AgentContext } from "@/
|
|
9
|
+
import type { AgentContext } from "@/core/AgentContextTypes.js";
|
|
10
10
|
import { registerTaskCronJobs } from "@/service/builtins/task/Scheduler.js";
|
|
11
11
|
import { TaskCronTriggerEngine } from "./CronTrigger.js";
|
|
12
12
|
|