@downcity/agent 1.1.13 → 1.1.15
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/config/Config.js +1 -1
- package/bin/config/Config.js.map +1 -1
- package/bin/config/Defaults.d.ts +13 -0
- package/bin/config/Defaults.d.ts.map +1 -0
- package/bin/config/{DowncityDefault.js → Defaults.js} +11 -1
- package/bin/config/Defaults.js.map +1 -0
- package/bin/{project/ProjectExecutionBinding.d.ts → config/ExecutionBinding.d.ts} +2 -2
- package/bin/config/ExecutionBinding.d.ts.map +1 -0
- package/bin/{project/ProjectExecutionBinding.js → config/ExecutionBinding.js} +2 -2
- package/bin/config/ExecutionBinding.js.map +1 -0
- 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/daemon/ProjectSetup.d.ts.map +1 -1
- package/bin/host/daemon/ProjectSetup.js +1 -1
- package/bin/host/daemon/ProjectSetup.js.map +1 -1
- package/bin/host/runtime/PluginRuntime.d.ts +1 -1
- package/bin/host/runtime/PluginRuntime.d.ts.map +1 -1
- package/bin/index.d.ts +9 -11
- package/bin/index.d.ts.map +1 -1
- package/bin/index.js +5 -8
- package/bin/index.js.map +1 -1
- package/bin/model/CreateModel.js +1 -1
- package/bin/model/CreateModel.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/project/AgentInitializer.js +2 -2
- package/bin/project/AgentInitializer.js.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 +43 -27
- package/bin/sdk/Agent.d.ts.map +1 -1
- package/bin/sdk/Agent.js +143 -364
- 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/RemoteAgent.d.ts +1 -1
- package/bin/sdk/RemoteAgent.js +1 -1
- package/bin/sdk/Session.d.ts +2 -2
- package/bin/sdk/Session.d.ts.map +1 -1
- package/bin/sdk/Session.js +11 -5
- package/bin/sdk/Session.js.map +1 -1
- package/bin/sdk/{SessionMetadata.d.ts → session/Metadata.d.ts} +2 -2
- package/bin/sdk/session/Metadata.d.ts.map +1 -0
- package/bin/sdk/{SessionMetadata.js → session/Metadata.js} +2 -2
- package/bin/sdk/session/Metadata.js.map +1 -0
- package/bin/sdk/{Paths.d.ts → session/Paths.d.ts} +1 -1
- package/bin/sdk/session/Paths.d.ts.map +1 -0
- package/bin/sdk/{Paths.js → session/Paths.js} +1 -1
- package/bin/sdk/session/Paths.js.map +1 -0
- package/bin/sdk/{SessionPersistence.d.ts → session/Persistence.d.ts} +3 -3
- package/bin/sdk/session/Persistence.d.ts.map +1 -0
- package/bin/sdk/{SessionPersistence.js → session/Persistence.js} +4 -4
- package/bin/sdk/session/Persistence.js.map +1 -0
- package/bin/sdk/{SessionServicePort.d.ts → session/ServicePort.d.ts} +2 -2
- package/bin/sdk/session/ServicePort.d.ts.map +1 -0
- package/bin/sdk/{SessionServicePort.js → session/ServicePort.js} +1 -1
- package/bin/sdk/session/ServicePort.js.map +1 -0
- package/bin/sdk/session/index.d.ts +12 -0
- package/bin/sdk/session/index.d.ts.map +1 -0
- package/bin/sdk/session/index.js +12 -0
- package/bin/sdk/session/index.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/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 +5 -3
- 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/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 → core/schedule}/Executor.d.ts +2 -2
- package/bin/service/core/schedule/Executor.d.ts.map +1 -0
- package/bin/service/{schedule → core/schedule}/Executor.js +1 -1
- package/bin/service/core/schedule/Executor.js.map +1 -0
- package/bin/service/{schedule → core/schedule}/Store.d.ts +1 -1
- package/bin/service/core/schedule/Store.d.ts.map +1 -0
- package/bin/service/{schedule → core/schedule}/Store.js +2 -2
- package/bin/service/core/schedule/Store.js.map +1 -0
- package/bin/service/core/schedule/Time.d.ts.map +1 -0
- package/bin/service/core/schedule/Time.js.map +1 -0
- package/bin/service/types/Service.d.ts +2 -24
- package/bin/service/types/Service.d.ts.map +1 -1
- package/bin/service/types/Service.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/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/config/Config.ts +1 -1
- package/src/config/{DowncityDefault.ts → Defaults.ts} +11 -0
- package/src/{project/ProjectExecutionBinding.ts → config/ExecutionBinding.ts} +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/daemon/ProjectSetup.ts +2 -3
- package/src/host/runtime/PluginRuntime.ts +1 -1
- package/src/index.ts +27 -24
- package/src/model/CreateModel.ts +1 -1
- 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/project/AgentInitializer.ts +2 -2
- package/src/sandbox/SandboxConfigResolver.ts +1 -1
- package/src/sandbox/SandboxRunner.ts +1 -1
- package/src/sdk/Agent.ts +163 -391
- package/src/sdk/AgentSdkTypes.ts +158 -0
- package/src/sdk/RemoteAgent.ts +1 -1
- package/src/sdk/Session.ts +16 -6
- package/src/sdk/{SessionMetadata.ts → session/Metadata.ts} +1 -1
- package/src/sdk/{Paths.ts → session/Paths.ts} +1 -1
- package/src/sdk/{SessionPersistence.ts → session/Persistence.ts} +1 -1
- package/src/sdk/{SessionServicePort.ts → session/ServicePort.ts} +1 -1
- package/src/sdk/session/index.ts +34 -0
- 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 +6 -4
- package/src/service/core/ServiceClassRegistry.ts +1 -1
- package/src/service/core/ServiceCommandRequest.ts +93 -0
- 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 → core/schedule}/Executor.ts +2 -2
- package/src/service/{schedule → core/schedule}/Store.ts +4 -2
- package/src/service/types/Service.ts +2 -25
- 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/config/DowncityDefault.d.ts +0 -3
- package/bin/config/DowncityDefault.d.ts.map +0 -1
- package/bin/config/DowncityDefault.js.map +0 -1
- package/bin/project/ProjectExecutionBinding.d.ts.map +0 -1
- package/bin/project/ProjectExecutionBinding.js.map +0 -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/sdk/HttpServer.d.ts +0 -40
- package/bin/sdk/HttpServer.d.ts.map +0 -1
- package/bin/sdk/HttpServer.js +0 -189
- package/bin/sdk/HttpServer.js.map +0 -1
- package/bin/sdk/Paths.d.ts.map +0 -1
- package/bin/sdk/Paths.js.map +0 -1
- package/bin/sdk/RpcServer.d.ts +0 -31
- package/bin/sdk/RpcServer.d.ts.map +0 -1
- package/bin/sdk/RpcServer.js +0 -207
- package/bin/sdk/RpcServer.js.map +0 -1
- package/bin/sdk/SessionMetadata.d.ts.map +0 -1
- package/bin/sdk/SessionMetadata.js.map +0 -1
- package/bin/sdk/SessionPersistence.d.ts.map +0 -1
- package/bin/sdk/SessionPersistence.js.map +0 -1
- package/bin/sdk/SessionServicePort.d.ts.map +0 -1
- package/bin/sdk/SessionServicePort.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/core/ServiceManager.d.ts +0 -9
- package/bin/service/core/ServiceManager.d.ts.map +0 -1
- package/bin/service/core/ServiceManager.js +0 -9
- package/bin/service/core/ServiceManager.js.map +0 -1
- package/bin/service/schedule/Executor.d.ts.map +0 -1
- package/bin/service/schedule/Executor.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/service/schedule/Store.d.ts.map +0 -1
- package/bin/service/schedule/Store.js.map +0 -1
- package/bin/service/schedule/Time.d.ts.map +0 -1
- package/bin/service/schedule/Time.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/sdk/HttpServer.ts +0 -231
- package/src/sdk/RpcServer.ts +0 -244
- package/src/service/core/ServiceActionApi.ts +0 -304
- package/src/service/core/ServiceManager.ts +0 -20
- package/src/service/schedule/Runtime.ts +0 -78
- /package/bin/service/{schedule → core/schedule}/Time.d.ts +0 -0
- /package/bin/service/{schedule → core/schedule}/Time.js +0 -0
- /package/src/service/{schedule → core/schedule}/Time.ts +0 -0
|
@@ -1,304 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ServiceActionApi:service action 的 HTTP route 注册模块。
|
|
3
|
-
*
|
|
4
|
-
* 关键点(中文)
|
|
5
|
-
* - 专门负责 `/service/<service>/<action>` 路由注册。
|
|
6
|
-
* - 调度字段抽取、payload 清洗、mapInput 桥接都收敛在这里。
|
|
7
|
-
* - 真正执行仍然走 `runServiceCommand` / `invokeServiceAction`。
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import type { Context as HonoContext, Hono } from "hono";
|
|
11
|
-
import type { JsonObject, JsonValue } from "@/types/common/Json.js";
|
|
12
|
-
import type { AgentContext } from "@/runtime/AgentContextTypes.js";
|
|
13
|
-
import type { ServiceCommandScheduleInput } from "@/service/types/ServiceSchedule.js";
|
|
14
|
-
import type { BaseService } from "@/service/builtins/BaseService.js";
|
|
15
|
-
import { parseScheduledRunAtMsOrThrow } from "../schedule/Time.js";
|
|
16
|
-
import { normalizeRunAtMsOrThrow } from "../schedule/Time.js";
|
|
17
|
-
import type { ServiceAction } from "@/service/types/Service.js";
|
|
18
|
-
import {
|
|
19
|
-
ensureServiceStateRecord,
|
|
20
|
-
isServiceRunning,
|
|
21
|
-
listServiceInstances,
|
|
22
|
-
} from "./ServiceStateController.js";
|
|
23
|
-
import {
|
|
24
|
-
invokeServiceAction,
|
|
25
|
-
runServiceCommand,
|
|
26
|
-
} from "./ServiceActionRunner.js";
|
|
27
|
-
|
|
28
|
-
function wrapServiceRouteHandler(
|
|
29
|
-
serviceName: string,
|
|
30
|
-
handler: (ctx: HonoContext) => Promise<Response> | Response,
|
|
31
|
-
): (ctx: HonoContext) => Promise<Response> | Response {
|
|
32
|
-
return async (c) => {
|
|
33
|
-
if (!isServiceRunning(serviceName)) {
|
|
34
|
-
return c.json(
|
|
35
|
-
{
|
|
36
|
-
success: false,
|
|
37
|
-
error: `Service "${serviceName}" is stopped`,
|
|
38
|
-
serviceName,
|
|
39
|
-
},
|
|
40
|
-
503,
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
return await handler(c);
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function resolveServiceActionApiPath(params: {
|
|
48
|
-
serviceName: string;
|
|
49
|
-
actionName: string;
|
|
50
|
-
action: ServiceAction<JsonValue, JsonValue>;
|
|
51
|
-
}): string {
|
|
52
|
-
const customPath = String(params.action.api?.path || "").trim();
|
|
53
|
-
if (customPath) {
|
|
54
|
-
return customPath.startsWith("/") ? customPath : `/${customPath}`;
|
|
55
|
-
}
|
|
56
|
-
return `/service/${params.serviceName}/${params.actionName}`;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function resolveServiceActionApiMethod(
|
|
60
|
-
action: ServiceAction<JsonValue, JsonValue>,
|
|
61
|
-
): "GET" | "POST" | "PUT" | "DELETE" {
|
|
62
|
-
return action.api?.method || "POST";
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function toQueryPayload(c: HonoContext): JsonObject {
|
|
66
|
-
const query = c.req.query();
|
|
67
|
-
const payload: JsonObject = {};
|
|
68
|
-
for (const [key, value] of Object.entries(query)) {
|
|
69
|
-
if (typeof value !== "string") continue;
|
|
70
|
-
payload[key] = value;
|
|
71
|
-
}
|
|
72
|
-
return payload;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* 识别 API 层的通用调度参数。
|
|
77
|
-
*
|
|
78
|
-
* 关键点(中文)
|
|
79
|
-
* - 专用 action API 与统一 `/api/services/command` 共用同一套 delay/time 语义。
|
|
80
|
-
* - 一旦识别为调度参数,就会在传给 action.mapInput 前剥离,避免二次调度。
|
|
81
|
-
*/
|
|
82
|
-
function extractApiScheduleInputFromRawPayload(
|
|
83
|
-
rawPayload: JsonValue,
|
|
84
|
-
): ServiceCommandScheduleInput | undefined {
|
|
85
|
-
if (!rawPayload || typeof rawPayload !== "object" || Array.isArray(rawPayload)) {
|
|
86
|
-
return undefined;
|
|
87
|
-
}
|
|
88
|
-
const record = rawPayload as Record<string, unknown>;
|
|
89
|
-
const nestedSchedule =
|
|
90
|
-
record.schedule && typeof record.schedule === "object" && !Array.isArray(record.schedule)
|
|
91
|
-
? (record.schedule as Record<string, unknown>)
|
|
92
|
-
: undefined;
|
|
93
|
-
const nestedRunAtMs = nestedSchedule?.runAtMs;
|
|
94
|
-
const topLevelDelay = record.delayMs ?? record.delay;
|
|
95
|
-
const topLevelTime = record.sendAtMs ?? record.sendAt ?? record.time;
|
|
96
|
-
|
|
97
|
-
if (nestedRunAtMs !== undefined && (topLevelDelay !== undefined || topLevelTime !== undefined)) {
|
|
98
|
-
throw new Error("`schedule.runAtMs` cannot be used together with `delay/time`.");
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (nestedRunAtMs !== undefined) {
|
|
102
|
-
return {
|
|
103
|
-
runAtMs: normalizeRunAtMsOrThrow(
|
|
104
|
-
nestedRunAtMs as string | number | undefined,
|
|
105
|
-
"schedule.runAtMs",
|
|
106
|
-
),
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
const runAtMs = parseScheduledRunAtMsOrThrow({
|
|
111
|
-
delay: topLevelDelay as string | number | undefined,
|
|
112
|
-
time: topLevelTime as string | number | undefined,
|
|
113
|
-
});
|
|
114
|
-
if (typeof runAtMs !== "number") return undefined;
|
|
115
|
-
return { runAtMs };
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* 从原始 payload 中移除 API 层保留的通用调度字段。
|
|
120
|
-
*/
|
|
121
|
-
function stripApiScheduleFields(rawPayload: JsonValue): JsonValue {
|
|
122
|
-
if (!rawPayload || typeof rawPayload !== "object" || Array.isArray(rawPayload)) {
|
|
123
|
-
return rawPayload;
|
|
124
|
-
}
|
|
125
|
-
const record = rawPayload as Record<string, unknown>;
|
|
126
|
-
const next: Record<string, unknown> = {};
|
|
127
|
-
for (const [key, value] of Object.entries(record)) {
|
|
128
|
-
if (
|
|
129
|
-
key === "schedule" ||
|
|
130
|
-
key === "delay" ||
|
|
131
|
-
key === "delayMs" ||
|
|
132
|
-
key === "time" ||
|
|
133
|
-
key === "sendAt" ||
|
|
134
|
-
key === "sendAtMs"
|
|
135
|
-
) {
|
|
136
|
-
continue;
|
|
137
|
-
}
|
|
138
|
-
next[key] = value;
|
|
139
|
-
}
|
|
140
|
-
return next as JsonValue;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* 用预读取后的原始 payload 构造 mapInput 专用上下文。
|
|
145
|
-
*
|
|
146
|
-
* 关键点(中文)
|
|
147
|
-
* - 让 route 层可以先统一处理调度参数,再把“净化后的请求体/查询”交给 action 自己解析。
|
|
148
|
-
*/
|
|
149
|
-
function createApiMapInputContext(params: {
|
|
150
|
-
context: HonoContext;
|
|
151
|
-
rawPayload: JsonValue;
|
|
152
|
-
}): HonoContext {
|
|
153
|
-
const sanitizedPayload = stripApiScheduleFields(params.rawPayload);
|
|
154
|
-
const originalReq = params.context.req;
|
|
155
|
-
const sanitizedQuery =
|
|
156
|
-
sanitizedPayload && typeof sanitizedPayload === "object" && !Array.isArray(sanitizedPayload)
|
|
157
|
-
? (sanitizedPayload as Record<string, string>)
|
|
158
|
-
: {};
|
|
159
|
-
const requestShim = {
|
|
160
|
-
...originalReq,
|
|
161
|
-
async json() {
|
|
162
|
-
return sanitizedPayload;
|
|
163
|
-
},
|
|
164
|
-
query(key?: string) {
|
|
165
|
-
if (typeof key === "string") {
|
|
166
|
-
return sanitizedQuery[key];
|
|
167
|
-
}
|
|
168
|
-
return sanitizedQuery;
|
|
169
|
-
},
|
|
170
|
-
};
|
|
171
|
-
return {
|
|
172
|
-
...params.context,
|
|
173
|
-
req: requestShim as typeof params.context.req,
|
|
174
|
-
} as HonoContext;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
async function mapServiceActionApiPayload(params: {
|
|
178
|
-
action: ServiceAction<JsonValue, JsonValue>;
|
|
179
|
-
method: "GET" | "POST" | "PUT" | "DELETE";
|
|
180
|
-
context: HonoContext;
|
|
181
|
-
}): Promise<{
|
|
182
|
-
payload: JsonValue;
|
|
183
|
-
schedule?: ServiceCommandScheduleInput;
|
|
184
|
-
}> {
|
|
185
|
-
let rawPayload: JsonValue;
|
|
186
|
-
if (params.method === "GET") {
|
|
187
|
-
rawPayload = toQueryPayload(params.context);
|
|
188
|
-
} else {
|
|
189
|
-
try {
|
|
190
|
-
rawPayload = (await params.context.req.json()) as JsonValue;
|
|
191
|
-
} catch {
|
|
192
|
-
throw new Error("Invalid JSON body");
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
const schedule = extractApiScheduleInputFromRawPayload(rawPayload);
|
|
197
|
-
const mapInputContext = createApiMapInputContext({
|
|
198
|
-
context: params.context,
|
|
199
|
-
rawPayload,
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
if (params.action.api?.mapInput) {
|
|
203
|
-
return {
|
|
204
|
-
payload: await params.action.api.mapInput(mapInputContext),
|
|
205
|
-
...(schedule ? { schedule } : {}),
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
return {
|
|
210
|
-
payload: stripApiScheduleFields(rawPayload),
|
|
211
|
-
...(schedule ? { schedule } : {}),
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
function registerServiceActionApiRoute(params: {
|
|
216
|
-
app: Hono;
|
|
217
|
-
service: BaseService;
|
|
218
|
-
actionName: string;
|
|
219
|
-
action: ServiceAction<JsonValue, JsonValue>;
|
|
220
|
-
context: AgentContext;
|
|
221
|
-
}): void {
|
|
222
|
-
const api = params.action.api;
|
|
223
|
-
if (!api) return;
|
|
224
|
-
|
|
225
|
-
const method = resolveServiceActionApiMethod(params.action);
|
|
226
|
-
const routePath = resolveServiceActionApiPath({
|
|
227
|
-
serviceName: params.service.name,
|
|
228
|
-
actionName: params.actionName,
|
|
229
|
-
action: params.action,
|
|
230
|
-
});
|
|
231
|
-
|
|
232
|
-
const handler = wrapServiceRouteHandler(params.service.name, async (c) => {
|
|
233
|
-
let payload: JsonValue;
|
|
234
|
-
let schedule: ServiceCommandScheduleInput | undefined;
|
|
235
|
-
try {
|
|
236
|
-
const mapped = await mapServiceActionApiPayload({
|
|
237
|
-
action: params.action,
|
|
238
|
-
method,
|
|
239
|
-
context: c,
|
|
240
|
-
});
|
|
241
|
-
payload = mapped.payload;
|
|
242
|
-
schedule = mapped.schedule;
|
|
243
|
-
} catch (error) {
|
|
244
|
-
return c.json(
|
|
245
|
-
{
|
|
246
|
-
success: false,
|
|
247
|
-
error: String(error),
|
|
248
|
-
},
|
|
249
|
-
400,
|
|
250
|
-
);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
const result = schedule
|
|
254
|
-
? await runServiceCommand({
|
|
255
|
-
serviceName: params.service.name,
|
|
256
|
-
command: params.actionName,
|
|
257
|
-
payload,
|
|
258
|
-
schedule,
|
|
259
|
-
context: params.context,
|
|
260
|
-
})
|
|
261
|
-
: await invokeServiceAction({
|
|
262
|
-
service: params.service,
|
|
263
|
-
actionName: params.actionName,
|
|
264
|
-
payload,
|
|
265
|
-
context: params.context,
|
|
266
|
-
});
|
|
267
|
-
return c.json(result, result.success ? 200 : 400);
|
|
268
|
-
});
|
|
269
|
-
|
|
270
|
-
if (method === "GET") {
|
|
271
|
-
params.app.get(routePath, handler);
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
if (method === "POST") {
|
|
275
|
-
params.app.post(routePath, handler);
|
|
276
|
-
return;
|
|
277
|
-
}
|
|
278
|
-
if (method === "PUT") {
|
|
279
|
-
params.app.put(routePath, handler);
|
|
280
|
-
return;
|
|
281
|
-
}
|
|
282
|
-
params.app.delete(routePath, handler);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* 为服务端注册全部 service action API。
|
|
287
|
-
*/
|
|
288
|
-
export function registerAllServicesForServer(
|
|
289
|
-
app: Hono,
|
|
290
|
-
context: AgentContext,
|
|
291
|
-
): void {
|
|
292
|
-
for (const service of listServiceInstances()) {
|
|
293
|
-
ensureServiceStateRecord(service);
|
|
294
|
-
for (const [actionName, action] of Object.entries(service.actions)) {
|
|
295
|
-
registerServiceActionApiRoute({
|
|
296
|
-
app,
|
|
297
|
-
service,
|
|
298
|
-
actionName,
|
|
299
|
-
action,
|
|
300
|
-
context,
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ServiceManager 类型门面。
|
|
3
|
-
*
|
|
4
|
-
* 关键点(中文)
|
|
5
|
-
* - service 共享契约位于 `service/types/Service.ts`。
|
|
6
|
-
* - 这里保留旧入口,仅做 re-export,避免 service/core 内部路径继续持有类型定义。
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
export type {
|
|
10
|
-
Service,
|
|
11
|
-
ServiceAction,
|
|
12
|
-
ServiceActionApi,
|
|
13
|
-
ServiceActionCommand,
|
|
14
|
-
ServiceActionCommandInput,
|
|
15
|
-
ServiceActionResult,
|
|
16
|
-
ServiceActions,
|
|
17
|
-
ServiceCommandResult,
|
|
18
|
-
ServiceLifecycle,
|
|
19
|
-
ServiceState,
|
|
20
|
-
} from "@/service/types/Service.js";
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Service Schedule runtime。
|
|
3
|
-
*
|
|
4
|
-
* 关键点(中文)
|
|
5
|
-
* - 使用轻量轮询驱动到点执行,避免为 MVP 引入复杂定时器注册与恢复逻辑。
|
|
6
|
-
* - runtime 重启时会把遗留 `running` 任务回退成 `pending`,然后继续补执行。
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import type { AgentContext } from "@/runtime/AgentContextTypes.js";
|
|
10
|
-
import { ServiceScheduleStore } from "./Store.js";
|
|
11
|
-
import { runDueScheduledJobs } from "./Executor.js";
|
|
12
|
-
|
|
13
|
-
const SCHEDULE_POLL_INTERVAL_MS = 200;
|
|
14
|
-
|
|
15
|
-
type ServiceScheduleRuntimeState = {
|
|
16
|
-
timer: NodeJS.Timeout | null;
|
|
17
|
-
ticking: boolean;
|
|
18
|
-
store: ServiceScheduleStore;
|
|
19
|
-
context: AgentContext;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
let runtimeState: ServiceScheduleRuntimeState | null = null;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* 启动持久化调度 runtime。
|
|
26
|
-
*/
|
|
27
|
-
export async function startServiceScheduleRuntime(
|
|
28
|
-
context: AgentContext,
|
|
29
|
-
): Promise<void> {
|
|
30
|
-
if (runtimeState) return;
|
|
31
|
-
|
|
32
|
-
const store = new ServiceScheduleStore(context.rootPath);
|
|
33
|
-
const recovered = store.resetRunningJobsToPending();
|
|
34
|
-
if (recovered > 0) {
|
|
35
|
-
context.logger.warn("[schedule] recovered interrupted running jobs", {
|
|
36
|
-
recovered,
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
runtimeState = {
|
|
41
|
-
timer: null,
|
|
42
|
-
ticking: false,
|
|
43
|
-
store,
|
|
44
|
-
context,
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const tick = async () => {
|
|
48
|
-
if (!runtimeState || runtimeState.ticking) return;
|
|
49
|
-
runtimeState.ticking = true;
|
|
50
|
-
try {
|
|
51
|
-
await runDueScheduledJobs({
|
|
52
|
-
context: runtimeState.context,
|
|
53
|
-
store: runtimeState.store,
|
|
54
|
-
});
|
|
55
|
-
} finally {
|
|
56
|
-
if (runtimeState) {
|
|
57
|
-
runtimeState.ticking = false;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
await tick();
|
|
63
|
-
runtimeState.timer = setInterval(() => {
|
|
64
|
-
void tick();
|
|
65
|
-
}, SCHEDULE_POLL_INTERVAL_MS);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* 停止持久化调度 runtime。
|
|
70
|
-
*/
|
|
71
|
-
export async function stopServiceScheduleRuntime(): Promise<void> {
|
|
72
|
-
if (!runtimeState) return;
|
|
73
|
-
if (runtimeState.timer) {
|
|
74
|
-
clearInterval(runtimeState.timer);
|
|
75
|
-
}
|
|
76
|
-
runtimeState.store.close();
|
|
77
|
-
runtimeState = null;
|
|
78
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|