@downcity/agent 1.1.10 → 1.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +612 -139
- package/bin/config/Config.d.ts +1 -1
- package/bin/config/Config.d.ts.map +1 -1
- package/bin/config/Config.js +4 -5
- package/bin/config/Config.js.map +1 -1
- package/bin/config/DowncityDefault.d.ts +1 -1
- package/bin/config/DowncitySchema.d.ts +1 -1
- package/bin/config/DowncitySchema.d.ts.map +1 -1
- package/bin/config/Paths.d.ts +1 -1
- package/bin/config/Paths.js +2 -2
- package/bin/host/daemon/Api.d.ts +2 -2
- package/bin/host/daemon/Api.d.ts.map +1 -1
- package/bin/host/daemon/Api.js +1 -1
- package/bin/host/daemon/Client.js +2 -2
- package/bin/host/daemon/Client.js.map +1 -1
- package/bin/host/daemon/Paths.d.ts +20 -0
- package/bin/host/daemon/Paths.d.ts.map +1 -0
- package/bin/host/daemon/Paths.js +23 -0
- package/bin/host/daemon/Paths.js.map +1 -0
- package/bin/host/daemon/ProjectSetup.d.ts +1 -1
- package/bin/host/daemon/ProjectSetup.js +1 -1
- package/bin/host/daemon/ProjectSetup.js.map +1 -1
- package/bin/host/runtime/AgentHostRuntime.d.ts +1 -1
- package/bin/host/runtime/AgentHostRuntime.js +2 -2
- package/bin/host/runtime/PluginRuntime.d.ts +1 -1
- package/bin/host/runtime/PluginRuntime.d.ts.map +1 -1
- package/bin/index.d.ts +59 -77
- package/bin/index.d.ts.map +1 -1
- package/bin/index.js +42 -82
- package/bin/index.js.map +1 -1
- package/bin/model/CreateModel.d.ts +2 -2
- package/bin/model/CreateModel.js +1 -1
- package/bin/model/CreateModel.js.map +1 -1
- package/bin/model/ModelManager.d.ts +1 -1
- package/bin/plugin/builtins/asr/Config.d.ts +43 -0
- package/bin/plugin/builtins/asr/Config.d.ts.map +1 -0
- package/bin/plugin/builtins/asr/Config.js +107 -0
- package/bin/plugin/builtins/asr/Config.js.map +1 -0
- package/bin/plugin/builtins/asr/Dependency.d.ts +1 -1
- package/bin/plugin/builtins/asr/Dependency.d.ts.map +1 -1
- package/bin/plugin/builtins/asr/InboundAugment.d.ts +17 -0
- package/bin/plugin/builtins/asr/InboundAugment.d.ts.map +1 -0
- package/bin/plugin/builtins/asr/InboundAugment.js +47 -0
- package/bin/plugin/builtins/asr/InboundAugment.js.map +1 -0
- package/bin/plugin/builtins/asr/Plugin.d.ts.map +1 -1
- package/bin/plugin/builtins/asr/Plugin.js +3 -126
- package/bin/plugin/builtins/asr/Plugin.js.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/AuthorizationPolicy.d.ts +2 -2
- 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/skill/Config.d.ts +1 -1
- package/bin/plugin/builtins/skill/runtime/SystemProvider.d.ts +1 -1
- package/bin/plugin/builtins/skill/types/ClaudeSkill.d.ts +1 -1
- package/bin/plugin/builtins/skill/types/ClaudeSkill.d.ts.map +1 -1
- package/bin/plugin/builtins/tts/Dependency.d.ts +1 -1
- package/bin/plugin/builtins/tts/Dependency.d.ts.map +1 -1
- package/bin/plugin/builtins/tts/Plugin.d.ts.map +1 -1
- package/bin/plugin/builtins/tts/Plugin.js +1 -52
- package/bin/plugin/builtins/tts/Plugin.js.map +1 -1
- package/bin/plugin/builtins/tts/PluginSupport.d.ts +25 -0
- package/bin/plugin/builtins/tts/PluginSupport.d.ts.map +1 -0
- package/bin/plugin/builtins/tts/PluginSupport.js +72 -0
- package/bin/plugin/builtins/tts/PluginSupport.js.map +1 -0
- package/bin/plugin/builtins/tts/types/TtsPlugin.d.ts +1 -1
- package/bin/plugin/builtins/tts/types/TtsPlugin.d.ts.map +1 -1
- package/bin/plugin/builtins/voice/Config.d.ts +43 -0
- package/bin/plugin/builtins/voice/Config.d.ts.map +1 -0
- package/bin/plugin/builtins/voice/Config.js +104 -0
- package/bin/plugin/builtins/voice/Config.js.map +1 -0
- package/bin/plugin/builtins/voice/Dependency.d.ts +1 -1
- package/bin/plugin/builtins/voice/Dependency.d.ts.map +1 -1
- package/bin/plugin/builtins/voice/InboundAugment.d.ts +17 -0
- package/bin/plugin/builtins/voice/InboundAugment.d.ts.map +1 -0
- package/bin/plugin/builtins/voice/InboundAugment.js +47 -0
- package/bin/plugin/builtins/voice/InboundAugment.js.map +1 -0
- package/bin/plugin/builtins/voice/Plugin.d.ts.map +1 -1
- package/bin/plugin/builtins/voice/Plugin.js +3 -123
- package/bin/plugin/builtins/voice/Plugin.js.map +1 -1
- package/bin/plugin/builtins/voice/types/VoicePlugin.d.ts +1 -1
- package/bin/plugin/builtins/voice/types/VoicePlugin.d.ts.map +1 -1
- package/bin/plugin/builtins/web/runtime/Source.d.ts +1 -1
- package/bin/plugin/builtins/web/runtime/Source.d.ts.map +1 -1
- package/bin/plugin/builtins/web/types/WebPlugin.d.ts +1 -1
- package/bin/plugin/builtins/web/types/WebPlugin.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 +2 -2
- 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 +2 -2
- package/bin/plugin/core/HookRegistry.d.ts.map +1 -1
- package/bin/plugin/core/HttpRoutes.d.ts +2 -2
- package/bin/plugin/core/HttpRoutes.d.ts.map +1 -1
- package/bin/plugin/core/LocalExecution.d.ts +1 -1
- package/bin/plugin/core/LocalExecution.d.ts.map +1 -1
- package/bin/plugin/core/LocalExecution.js +1 -1
- package/bin/plugin/core/LocalExecution.js.map +1 -1
- package/bin/plugin/core/PluginManager.d.ts +2 -2
- package/bin/plugin/core/PluginManager.js +2 -2
- package/bin/plugin/core/PluginRegistry.d.ts +2 -2
- package/bin/plugin/core/PluginRegistry.d.ts.map +1 -1
- package/bin/plugin/core/ProjectConfigStore.d.ts +1 -1
- package/bin/plugin/types/Plugin.d.ts +5 -5
- package/bin/plugin/types/Plugin.d.ts.map +1 -1
- package/bin/plugin/types/PluginApi.d.ts +1 -1
- package/bin/plugin/types/PluginApi.d.ts.map +1 -1
- package/bin/{agent/project → project}/AgentInitializer.d.ts +2 -2
- package/bin/project/AgentInitializer.d.ts.map +1 -0
- package/bin/{agent/project → project}/AgentInitializer.js +7 -7
- package/bin/project/AgentInitializer.js.map +1 -0
- package/bin/{agent/project → project}/ProjectExecutionBinding.d.ts +2 -2
- package/bin/project/ProjectExecutionBinding.d.ts.map +1 -0
- package/bin/project/ProjectExecutionBinding.js.map +1 -0
- package/bin/{agent/project → project}/types/AgentProject.d.ts +2 -2
- package/bin/project/types/AgentProject.d.ts.map +1 -0
- package/bin/project/types/AgentProject.js.map +1 -0
- package/bin/{agent → runtime}/AgentContext.d.ts +2 -2
- package/bin/runtime/AgentContext.d.ts.map +1 -0
- package/bin/{agent → runtime}/AgentContext.js +1 -1
- package/bin/runtime/AgentContext.js.map +1 -0
- package/bin/{agent → runtime}/AgentContextTypes.d.ts +4 -4
- package/bin/runtime/AgentContextTypes.d.ts.map +1 -0
- package/bin/runtime/AgentContextTypes.js.map +1 -0
- package/bin/{agent → runtime}/AgentRuntime.d.ts +4 -4
- package/bin/runtime/AgentRuntime.d.ts.map +1 -0
- package/bin/{agent → runtime}/AgentRuntime.js +6 -6
- package/bin/runtime/AgentRuntime.js.map +1 -0
- package/bin/{agent → runtime}/AgentRuntimeState.d.ts +3 -3
- package/bin/runtime/AgentRuntimeState.d.ts.map +1 -0
- package/bin/runtime/AgentRuntimeState.js.map +1 -0
- package/bin/{agent → runtime}/AgentRuntimeTypes.d.ts +2 -2
- package/bin/runtime/AgentRuntimeTypes.d.ts.map +1 -0
- package/bin/runtime/AgentRuntimeTypes.js.map +1 -0
- 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/{host/sdk → sdk}/Agent.d.ts +17 -12
- package/bin/sdk/Agent.d.ts.map +1 -0
- package/bin/{host/sdk → sdk}/Agent.js +73 -29
- package/bin/sdk/Agent.js.map +1 -0
- package/bin/{host/sdk → sdk}/AgentSdkTypes.d.ts +100 -5
- package/bin/sdk/AgentSdkTypes.d.ts.map +1 -0
- package/bin/sdk/AgentSdkTypes.js.map +1 -0
- package/bin/sdk/AsyncQueue.d.ts.map +1 -0
- package/bin/sdk/AsyncQueue.js.map +1 -0
- package/bin/{host/sdk → sdk}/HttpServer.d.ts +1 -1
- package/bin/sdk/HttpServer.d.ts.map +1 -0
- package/bin/{host/sdk → sdk}/HttpServer.js +8 -0
- package/bin/sdk/HttpServer.js.map +1 -0
- package/bin/sdk/Paths.d.ts.map +1 -0
- package/bin/sdk/Paths.js.map +1 -0
- package/bin/{host/sdk → sdk}/RemoteAgent.d.ts +6 -2
- package/bin/sdk/RemoteAgent.d.ts.map +1 -0
- package/bin/{host/sdk → sdk}/RemoteAgent.js +14 -0
- package/bin/sdk/RemoteAgent.js.map +1 -0
- package/bin/{host/sdk → sdk}/RpcServer.d.ts +1 -1
- package/bin/sdk/RpcServer.d.ts.map +1 -0
- package/bin/{host/sdk → sdk}/RpcServer.js +15 -1
- package/bin/sdk/RpcServer.js.map +1 -0
- package/bin/sdk/SdkSessionSystemComposer.d.ts +106 -0
- package/bin/sdk/SdkSessionSystemComposer.d.ts.map +1 -0
- package/bin/sdk/SdkSessionSystemComposer.js +150 -0
- package/bin/sdk/SdkSessionSystemComposer.js.map +1 -0
- package/bin/{host/sdk → sdk}/Session.d.ts +23 -18
- package/bin/sdk/Session.d.ts.map +1 -0
- package/bin/{host/sdk → sdk}/Session.js +86 -165
- package/bin/sdk/Session.js.map +1 -0
- package/bin/{host/sdk → sdk}/SessionMetadata.d.ts +5 -1
- package/bin/sdk/SessionMetadata.d.ts.map +1 -0
- package/bin/{host/sdk → sdk}/SessionMetadata.js +17 -1
- package/bin/sdk/SessionMetadata.js.map +1 -0
- package/bin/sdk/SessionPersistence.d.ts +63 -0
- package/bin/sdk/SessionPersistence.d.ts.map +1 -0
- package/bin/sdk/SessionPersistence.js +52 -0
- package/bin/sdk/SessionPersistence.js.map +1 -0
- package/bin/sdk/SessionServicePort.d.ts +34 -0
- package/bin/sdk/SessionServicePort.d.ts.map +1 -0
- package/bin/sdk/SessionServicePort.js +36 -0
- package/bin/sdk/SessionServicePort.js.map +1 -0
- package/bin/sdk/StreamEvents.d.ts +36 -0
- package/bin/sdk/StreamEvents.d.ts.map +1 -0
- package/bin/{host/sdk → sdk}/StreamEvents.js +27 -0
- package/bin/sdk/StreamEvents.js.map +1 -0
- package/bin/server/http/Server.d.ts.map +1 -0
- package/bin/{host → server}/http/Server.js +7 -7
- package/bin/server/http/Server.js.map +1 -0
- package/bin/server/http/auth/AuthEnv.d.ts.map +1 -0
- package/bin/server/http/auth/AuthEnv.js.map +1 -0
- package/bin/server/http/auth/AuthError.d.ts.map +1 -0
- package/bin/server/http/auth/AuthError.js.map +1 -0
- package/bin/server/http/auth/CliAuthStateStore.d.ts.map +1 -0
- package/bin/server/http/auth/CliAuthStateStore.js.map +1 -0
- package/bin/server/http/auth/PasswordHasher.d.ts.map +1 -0
- package/bin/server/http/auth/PasswordHasher.js.map +1 -0
- package/bin/server/http/auth/TokenService.d.ts.map +1 -0
- package/bin/server/http/auth/TokenService.js.map +1 -0
- package/bin/{host → server}/http/control/AuthControlService.d.ts +2 -2
- package/bin/server/http/control/AuthControlService.d.ts.map +1 -0
- package/bin/server/http/control/AuthControlService.js.map +1 -0
- package/bin/server/http/control/CommonHelpers.d.ts.map +1 -0
- package/bin/server/http/control/CommonHelpers.js.map +1 -0
- package/bin/{host → server}/http/control/ControlApiRoutes.d.ts +1 -1
- package/bin/server/http/control/ControlApiRoutes.d.ts.map +1 -0
- package/bin/{host → server}/http/control/ControlApiRoutes.js +5 -5
- package/bin/server/http/control/ControlApiRoutes.js.map +1 -0
- package/bin/{host → server}/http/control/ControlAuthorizationRoutes.d.ts +1 -1
- package/bin/server/http/control/ControlAuthorizationRoutes.d.ts.map +1 -0
- package/bin/{host → server}/http/control/ControlAuthorizationRoutes.js +2 -2
- package/bin/server/http/control/ControlAuthorizationRoutes.js.map +1 -0
- package/bin/{host → server}/http/control/ControlRouter.d.ts +1 -1
- package/bin/server/http/control/ControlRouter.d.ts.map +1 -0
- package/bin/{host → server}/http/control/ControlRouter.js +3 -3
- package/bin/server/http/control/ControlRouter.js.map +1 -0
- package/bin/{host → server}/http/control/ExecuteBySession.d.ts +3 -3
- package/bin/server/http/control/ExecuteBySession.d.ts.map +1 -0
- package/bin/server/http/control/ExecuteBySession.js.map +1 -0
- package/bin/{host → server}/http/control/ExecuteInput.d.ts +1 -1
- package/bin/server/http/control/ExecuteInput.d.ts.map +1 -0
- package/bin/server/http/control/ExecuteInput.js.map +1 -0
- package/bin/server/http/control/Helpers.d.ts.map +1 -0
- package/bin/{host/http/control/Helpers.d.ts.map → server/http/control/Helpers.js.map} +1 -1
- package/bin/{host → server}/http/control/MessageTimeline.d.ts +1 -1
- package/bin/server/http/control/MessageTimeline.d.ts.map +1 -0
- package/bin/server/http/control/MessageTimeline.js.map +1 -0
- package/bin/{host → server}/http/control/ModelRoutes.d.ts +1 -1
- package/bin/server/http/control/ModelRoutes.d.ts.map +1 -0
- package/bin/{host → server}/http/control/ModelRoutes.js +1 -1
- package/bin/server/http/control/ModelRoutes.js.map +1 -0
- package/bin/{host → server}/http/control/OverviewRoutes.d.ts +1 -1
- package/bin/server/http/control/OverviewRoutes.d.ts.map +1 -0
- package/bin/server/http/control/OverviewRoutes.js.map +1 -0
- package/bin/{host → server}/http/control/SessionRoutes.d.ts +1 -1
- package/bin/server/http/control/SessionRoutes.d.ts.map +1 -0
- package/bin/server/http/control/SessionRoutes.js.map +1 -0
- package/bin/{host → server}/http/control/SessionSummaryStore.d.ts +2 -2
- package/bin/server/http/control/SessionSummaryStore.d.ts.map +1 -0
- package/bin/server/http/control/SessionSummaryStore.js.map +1 -0
- package/bin/{host → server}/http/control/TaskRoutes.d.ts +1 -1
- package/bin/server/http/control/TaskRoutes.d.ts.map +1 -0
- package/bin/server/http/control/TaskRoutes.js.map +1 -0
- package/bin/{host → server}/http/control/TaskStore.d.ts +1 -1
- package/bin/server/http/control/TaskStore.d.ts.map +1 -0
- package/bin/server/http/control/TaskStore.js.map +1 -0
- package/bin/server/http/control/types/AuthControl.d.ts.map +1 -0
- package/bin/server/http/control/types/AuthControl.js.map +1 -0
- package/bin/{host → server}/http/control/types/ControlRoutes.d.ts +2 -2
- package/bin/server/http/control/types/ControlRoutes.d.ts.map +1 -0
- package/bin/server/http/control/types/ControlRoutes.js.map +1 -0
- package/bin/server/http/control/types/ControlSessionExecute.d.ts.map +1 -0
- package/bin/server/http/control/types/ControlSessionExecute.js.map +1 -0
- package/bin/{host → server}/http/control/types/ControlViewData.d.ts +1 -1
- package/bin/server/http/control/types/ControlViewData.d.ts.map +1 -0
- package/bin/server/http/control/types/ControlViewData.js.map +1 -0
- package/bin/server/http/execute/execute.d.ts.map +1 -0
- package/bin/{host → server}/http/execute/execute.js +1 -1
- package/bin/server/http/execute/execute.js.map +1 -0
- package/bin/server/http/health/health.d.ts.map +1 -0
- package/bin/server/http/health/health.js.map +1 -0
- package/bin/server/http/plugins/plugins.d.ts.map +1 -0
- package/bin/{host → server}/http/plugins/plugins.js +1 -1
- package/bin/server/http/plugins/plugins.js.map +1 -0
- package/bin/server/http/services/services.d.ts.map +1 -0
- package/bin/{host → server}/http/services/services.js +1 -1
- package/bin/server/http/services/services.js.map +1 -0
- package/bin/server/http/static/static.d.ts.map +1 -0
- package/bin/{host → server}/http/static/static.js +1 -1
- package/bin/server/http/static/static.js.map +1 -0
- package/bin/{host → server}/rpc/Server.d.ts +3 -3
- package/bin/server/rpc/Server.d.ts.map +1 -0
- package/bin/{host → server}/rpc/Server.js +2 -2
- package/bin/server/rpc/Server.js.map +1 -0
- 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 +3 -3
- package/bin/service/builtins/chat/ChatService.d.ts.map +1 -1
- package/bin/service/builtins/chat/ChatServiceTypes.d.ts +2 -2
- package/bin/service/builtins/chat/ChatServiceTypes.d.ts.map +1 -1
- package/bin/service/builtins/chat/accounts/ChannelAccountService.d.ts +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 +2 -2
- 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/Feishu.js +39 -171
- package/bin/service/builtins/chat/channels/feishu/Feishu.js.map +1 -1
- package/bin/service/builtins/chat/channels/feishu/FeishuMessageHandler.d.ts +155 -0
- package/bin/service/builtins/chat/channels/feishu/FeishuMessageHandler.d.ts.map +1 -0
- package/bin/service/builtins/chat/channels/feishu/FeishuMessageHandler.js +247 -0
- package/bin/service/builtins/chat/channels/feishu/FeishuMessageHandler.js.map +1 -0
- 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/feishu/FeishuPlatformLookup.d.ts +1 -1
- package/bin/service/builtins/chat/channels/feishu/FeishuPlatformLookup.d.ts.map +1 -1
- package/bin/service/builtins/chat/channels/feishu/types/FeishuChannel.d.ts +1 -1
- package/bin/service/builtins/chat/channels/feishu/types/FeishuChannel.js +1 -1
- package/bin/service/builtins/chat/channels/qq/QQ.d.ts +5 -5
- package/bin/service/builtins/chat/channels/qq/QQ.d.ts.map +1 -1
- package/bin/service/builtins/chat/channels/qq/QQ.js +33 -231
- package/bin/service/builtins/chat/channels/qq/QQ.js.map +1 -1
- package/bin/service/builtins/chat/channels/qq/QQGatewayClient.d.ts +0 -24
- package/bin/service/builtins/chat/channels/qq/QQGatewayClient.d.ts.map +1 -1
- package/bin/service/builtins/chat/channels/qq/QQGatewayClient.js +68 -227
- package/bin/service/builtins/chat/channels/qq/QQGatewayClient.js.map +1 -1
- package/bin/service/builtins/chat/channels/qq/QQGatewayConnection.d.ts +65 -0
- package/bin/service/builtins/chat/channels/qq/QQGatewayConnection.d.ts.map +1 -0
- package/bin/service/builtins/chat/channels/qq/QQGatewayConnection.js +110 -0
- package/bin/service/builtins/chat/channels/qq/QQGatewayConnection.js.map +1 -0
- package/bin/service/builtins/chat/channels/qq/QQGatewayHeartbeat.d.ts +59 -0
- package/bin/service/builtins/chat/channels/qq/QQGatewayHeartbeat.d.ts.map +1 -0
- package/bin/service/builtins/chat/channels/qq/QQGatewayHeartbeat.js +58 -0
- package/bin/service/builtins/chat/channels/qq/QQGatewayHeartbeat.js.map +1 -0
- package/bin/service/builtins/chat/channels/qq/QQGatewayProtocol.d.ts +86 -0
- package/bin/service/builtins/chat/channels/qq/QQGatewayProtocol.d.ts.map +1 -0
- package/bin/service/builtins/chat/channels/qq/QQGatewayProtocol.js +93 -0
- package/bin/service/builtins/chat/channels/qq/QQGatewayProtocol.js.map +1 -0
- package/bin/service/builtins/chat/channels/qq/QQMessageHandler.d.ts +129 -0
- package/bin/service/builtins/chat/channels/qq/QQMessageHandler.d.ts.map +1 -0
- package/bin/service/builtins/chat/channels/qq/QQMessageHandler.js +284 -0
- package/bin/service/builtins/chat/channels/qq/QQMessageHandler.js.map +1 -0
- package/bin/service/builtins/chat/channels/qq/QQSupport.d.ts +2 -2
- package/bin/service/builtins/chat/channels/qq/QQSupport.d.ts.map +1 -1
- package/bin/service/builtins/chat/channels/qq/types/QqChannel.d.ts +2 -2
- package/bin/service/builtins/chat/channels/qq/types/QqChannel.d.ts.map +1 -1
- package/bin/service/builtins/chat/channels/qq/types/QqChannel.js +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/Bot.js +35 -293
- package/bin/service/builtins/chat/channels/telegram/Bot.js.map +1 -1
- package/bin/service/builtins/chat/channels/telegram/TelegramMessageHandler.d.ts +142 -0
- package/bin/service/builtins/chat/channels/telegram/TelegramMessageHandler.d.ts.map +1 -0
- package/bin/service/builtins/chat/channels/telegram/TelegramMessageHandler.js +267 -0
- package/bin/service/builtins/chat/channels/telegram/TelegramMessageHandler.js.map +1 -0
- package/bin/service/builtins/chat/channels/telegram/TelegramPendingUpdates.d.ts +55 -0
- package/bin/service/builtins/chat/channels/telegram/TelegramPendingUpdates.d.ts.map +1 -0
- package/bin/service/builtins/chat/channels/telegram/TelegramPendingUpdates.js +125 -0
- package/bin/service/builtins/chat/channels/telegram/TelegramPendingUpdates.js.map +1 -0
- 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 +2 -2
- package/bin/service/builtins/chat/runtime/ChatActionExecution.d.ts.map +1 -1
- package/bin/service/builtins/chat/runtime/ChatActionInput.d.ts +3 -11
- package/bin/service/builtins/chat/runtime/ChatActionInput.d.ts.map +1 -1
- package/bin/service/builtins/chat/runtime/ChatActionInput.js +3 -232
- package/bin/service/builtins/chat/runtime/ChatActionInput.js.map +1 -1
- package/bin/service/builtins/chat/runtime/ChatActionInputSupport.d.ts +33 -0
- package/bin/service/builtins/chat/runtime/ChatActionInputSupport.d.ts.map +1 -0
- package/bin/service/builtins/chat/runtime/ChatActionInputSupport.js +66 -0
- package/bin/service/builtins/chat/runtime/ChatActionInputSupport.js.map +1 -0
- 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 +3 -3
- package/bin/service/builtins/chat/runtime/ChatChannelConfig.d.ts.map +1 -1
- package/bin/service/builtins/chat/runtime/ChatChannelCore.d.ts +2 -2
- 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 +2 -2
- package/bin/service/builtins/chat/runtime/ChatHistoryStore.d.ts.map +1 -1
- package/bin/service/builtins/chat/runtime/ChatIngressStore.d.ts +2 -2
- package/bin/service/builtins/chat/runtime/ChatIngressStore.d.ts.map +1 -1
- package/bin/service/builtins/chat/runtime/ChatMetaStore.d.ts +3 -3
- package/bin/service/builtins/chat/runtime/ChatMetaStore.d.ts.map +1 -1
- package/bin/service/builtins/chat/runtime/ChatMetaStore.js +2 -2
- 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 +2 -2
- 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/ChatSendActionInput.d.ts +23 -0
- package/bin/service/builtins/chat/runtime/ChatSendActionInput.d.ts.map +1 -0
- package/bin/service/builtins/chat/runtime/ChatSendActionInput.js +205 -0
- package/bin/service/builtins/chat/runtime/ChatSendActionInput.js.map +1 -0
- 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 +2 -2
- package/bin/service/builtins/chat/runtime/ChatkeySend.d.ts.map +1 -1
- package/bin/service/builtins/chat/runtime/ChatkeySend.js +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/ReplyContextFormatter.d.ts +1 -1
- package/bin/service/builtins/chat/runtime/ReplyContextFormatter.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/chat/runtime/UIMessageTransformer.d.ts +1 -1
- package/bin/service/builtins/chat/runtime/UIMessageTransformer.d.ts.map +1 -1
- package/bin/service/builtins/chat/types/ChannelAccount.d.ts +1 -1
- package/bin/service/builtins/chat/types/ChatHistory.d.ts +1 -1
- package/bin/service/builtins/chat/types/ChatHistory.d.ts.map +1 -1
- package/bin/service/builtins/chat/types/ChatMeta.d.ts +1 -1
- package/bin/service/builtins/chat/types/ChatMeta.js +1 -1
- package/bin/service/builtins/chat/types/ChatQueue.d.ts +1 -1
- package/bin/service/builtins/chat/types/ChatQueue.d.ts.map +1 -1
- package/bin/service/builtins/chat/types/ChatService.d.ts +1 -1
- package/bin/service/builtins/chat/types/ChatService.d.ts.map +1 -1
- package/bin/service/builtins/contact/Action.d.ts +57 -4
- package/bin/service/builtins/contact/Action.d.ts.map +1 -1
- package/bin/service/builtins/contact/Action.js +272 -4
- 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/ContactService.js +19 -293
- package/bin/service/builtins/contact/ContactService.js.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 +24 -0
- package/bin/service/builtins/contact/runtime/ContactPayload.d.ts.map +1 -0
- package/bin/service/builtins/contact/runtime/ContactPayload.js +32 -0
- package/bin/service/builtins/contact/runtime/ContactPayload.js.map +1 -0
- 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/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 +2 -2
- 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/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/memory/types/Memory.d.ts +1 -1
- package/bin/service/builtins/memory/types/Memory.d.ts.map +1 -1
- 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 +52 -0
- package/bin/service/builtins/shell/runtime/ShellActionResponse.d.ts.map +1 -0
- package/bin/service/builtins/shell/runtime/ShellActionResponse.js +73 -0
- package/bin/service/builtins/shell/runtime/ShellActionResponse.js.map +1 -0
- 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/ShellActionRuntime.js +3 -26
- package/bin/service/builtins/shell/runtime/ShellActionRuntime.js.map +1 -1
- package/bin/service/builtins/shell/runtime/ShellActionRuntimeSupport.d.ts +4 -32
- package/bin/service/builtins/shell/runtime/ShellActionRuntimeSupport.d.ts.map +1 -1
- package/bin/service/builtins/shell/runtime/ShellActionRuntimeSupport.js +3 -131
- package/bin/service/builtins/shell/runtime/ShellActionRuntimeSupport.js.map +1 -1
- package/bin/service/builtins/shell/runtime/ShellProcessEvents.d.ts +22 -0
- package/bin/service/builtins/shell/runtime/ShellProcessEvents.d.ts.map +1 -0
- package/bin/service/builtins/shell/runtime/ShellProcessEvents.js +41 -0
- package/bin/service/builtins/shell/runtime/ShellProcessEvents.js.map +1 -0
- package/bin/service/builtins/shell/runtime/ShellRuntimeEnvironment.d.ts +21 -0
- package/bin/service/builtins/shell/runtime/ShellRuntimeEnvironment.d.ts.map +1 -0
- package/bin/service/builtins/shell/runtime/ShellRuntimeEnvironment.js +75 -0
- package/bin/service/builtins/shell/runtime/ShellRuntimeEnvironment.js.map +1 -0
- 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/Model.d.ts +1 -1
- package/bin/service/builtins/task/runtime/Model.d.ts.map +1 -1
- package/bin/service/builtins/task/runtime/Paths.d.ts +1 -1
- package/bin/service/builtins/task/runtime/Paths.js +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/Runner.js +17 -64
- package/bin/service/builtins/task/runtime/Runner.js.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 +1 -1
- package/bin/service/builtins/task/runtime/TaskActionInput.d.ts.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 +2 -2
- package/bin/service/builtins/task/runtime/TaskRunnerRound.d.ts.map +1 -1
- package/bin/service/builtins/task/runtime/TaskRunnerRound.js +1 -1
- package/bin/service/builtins/task/runtime/TaskRunnerRound.js.map +1 -1
- package/bin/service/builtins/task/runtime/TaskRunnerScript.d.ts +81 -0
- package/bin/service/builtins/task/runtime/TaskRunnerScript.d.ts.map +1 -0
- package/bin/service/builtins/task/runtime/TaskRunnerScript.js +96 -0
- package/bin/service/builtins/task/runtime/TaskRunnerScript.js.map +1 -0
- 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/core/Manager.d.ts +3 -3
- package/bin/service/core/Manager.js +3 -3
- package/bin/service/core/ServiceActionApi.d.ts +1 -1
- package/bin/service/core/ServiceActionApi.d.ts.map +1 -1
- package/bin/service/core/ServiceActionRunner.d.ts +2 -2
- package/bin/service/core/ServiceActionRunner.d.ts.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/ServiceManager.d.ts +2 -2
- package/bin/service/core/ServiceManager.js +2 -2
- package/bin/service/core/ServiceStateController.d.ts +1 -1
- package/bin/service/core/ServiceStateController.d.ts.map +1 -1
- package/bin/service/core/ServiceStateController.js +1 -1
- 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/schedule/Executor.d.ts +1 -1
- package/bin/service/schedule/Executor.d.ts.map +1 -1
- package/bin/service/schedule/Runtime.d.ts +1 -1
- package/bin/service/schedule/Runtime.d.ts.map +1 -1
- package/bin/service/types/Service.d.ts +2 -2
- package/bin/service/types/Service.d.ts.map +1 -1
- package/bin/service/types/ServiceSchedule.d.ts +1 -1
- package/bin/service/types/ServiceSchedule.d.ts.map +1 -1
- package/bin/service/types/ServiceState.d.ts +1 -1
- package/bin/service/types/ServiceState.js +1 -1
- package/bin/service/types/Services.d.ts +1 -1
- package/bin/service/types/Services.d.ts.map +1 -1
- package/bin/session/Session.d.ts +1 -1
- package/bin/session/Session.d.ts.map +1 -1
- package/bin/session/composer/history/SessionHistoryWriter.d.ts +1 -1
- package/bin/session/composer/history/SessionHistoryWriter.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/executors/local/LocalSessionCore.d.ts +1 -9
- package/bin/session/executors/local/LocalSessionCore.d.ts.map +1 -1
- package/bin/session/executors/local/LocalSessionCore.js +8 -392
- package/bin/session/executors/local/LocalSessionCore.js.map +1 -1
- package/bin/session/executors/local/SessionExecutionError.d.ts +26 -0
- package/bin/session/executors/local/SessionExecutionError.d.ts.map +1 -0
- package/bin/session/executors/local/SessionExecutionError.js +34 -0
- package/bin/session/executors/local/SessionExecutionError.js.map +1 -0
- package/bin/session/executors/local/SessionModelMessageState.d.ts +63 -0
- package/bin/session/executors/local/SessionModelMessageState.d.ts.map +1 -0
- package/bin/session/executors/local/SessionModelMessageState.js +90 -0
- package/bin/session/executors/local/SessionModelMessageState.js.map +1 -0
- package/bin/session/executors/local/SessionSignals.d.ts +1 -1
- package/bin/session/executors/local/SessionSignals.d.ts.map +1 -1
- package/bin/session/executors/local/SessionToolLoopRunner.d.ts +44 -0
- package/bin/session/executors/local/SessionToolLoopRunner.d.ts.map +1 -0
- package/bin/session/executors/local/SessionToolLoopRunner.js +261 -0
- package/bin/session/executors/local/SessionToolLoopRunner.js.map +1 -0
- package/bin/session/executors/local/SessionUiStreamCollector.d.ts +33 -0
- package/bin/session/executors/local/SessionUiStreamCollector.d.ts.map +1 -0
- package/bin/session/executors/local/SessionUiStreamCollector.js +64 -0
- package/bin/session/executors/local/SessionUiStreamCollector.js.map +1 -0
- package/bin/session/tools/shell/ShellToolBridge.d.ts +2 -2
- package/bin/session/tools/shell/ShellToolBridge.d.ts.map +1 -1
- package/bin/session/tools/shell/ShellToolDefinition.d.ts +1 -1
- package/bin/session/tools/shell/ShellToolDefinition.d.ts.map +1 -1
- package/bin/session/tools/shell/ShellToolFormatting.js +1 -1
- package/bin/session/tools/shell/ShellToolFormatting.js.map +1 -1
- package/bin/session/types/SessionHistoryMeta.d.ts +2 -0
- package/bin/session/types/SessionHistoryMeta.d.ts.map +1 -1
- package/bin/session/types/SessionMessages.d.ts +1 -1
- package/bin/session/types/SessionMessages.d.ts.map +1 -1
- package/bin/transport/rpc/Client.d.ts.map +1 -0
- package/bin/transport/rpc/Client.js.map +1 -0
- package/bin/transport/rpc/Paths.d.ts.map +1 -0
- package/bin/{host → transport}/rpc/Paths.js +21 -2
- package/bin/transport/rpc/Paths.js.map +1 -0
- package/bin/transport/rpc/Transport.d.ts.map +1 -0
- package/bin/transport/rpc/Transport.js.map +1 -0
- package/bin/types/auth/AuthPermission.d.ts.map +1 -0
- package/bin/types/auth/AuthPermission.js.map +1 -0
- package/bin/types/auth/AuthRoute.d.ts.map +1 -0
- package/bin/types/auth/AuthRoute.js.map +1 -0
- package/bin/types/auth/AuthToken.d.ts.map +1 -0
- package/bin/types/auth/AuthToken.js.map +1 -0
- package/bin/types/auth/AuthTypes.d.ts.map +1 -0
- package/bin/types/auth/AuthTypes.js.map +1 -0
- package/bin/types/common/Json.d.ts.map +1 -0
- package/bin/types/common/Json.js.map +1 -0
- package/bin/types/common/Template.d.ts.map +1 -0
- package/bin/types/common/Template.js.map +1 -0
- package/bin/{config/types → types/config}/DowncityConfig.d.ts +3 -3
- package/bin/{config/types → types/config}/DowncityConfig.d.ts.map +1 -1
- package/bin/types/config/DowncityConfig.js.map +1 -0
- package/bin/{config/types → types/config}/ExecutionBinding.d.ts.map +1 -1
- package/bin/types/config/ExecutionBinding.js.map +1 -0
- package/bin/{config/types → types/config}/LlmConfig.d.ts.map +1 -1
- package/bin/types/config/LlmConfig.js.map +1 -0
- package/bin/{config/types → types/config}/ModelBinding.d.ts.map +1 -1
- package/bin/types/config/ModelBinding.js.map +1 -0
- package/bin/{config/types → types/config}/Start.d.ts.map +1 -1
- package/bin/types/config/Start.js.map +1 -0
- package/bin/{host/daemon/types → types/daemon}/Daemon.d.ts +1 -1
- package/bin/types/daemon/Daemon.d.ts.map +1 -0
- package/bin/{host/daemon/types → types/daemon}/Daemon.js +1 -1
- package/bin/types/daemon/Daemon.js.map +1 -0
- package/bin/{host/types → types/host}/AgentHost.d.ts +6 -6
- package/bin/{host/types → types/host}/AgentHost.d.ts.map +1 -1
- package/bin/types/host/AgentHost.js +10 -0
- package/bin/types/host/AgentHost.js.map +1 -0
- package/bin/{host/types → types/host}/Store.d.ts +1 -1
- package/bin/{host/types → types/host}/Store.d.ts.map +1 -1
- package/bin/{host/types → types/host}/Store.js.map +1 -1
- package/bin/types/http/InlineInstant.d.ts.map +1 -0
- package/bin/types/http/InlineInstant.js.map +1 -0
- package/bin/types/platform/Platform.d.ts.map +1 -0
- package/bin/types/platform/Platform.js.map +1 -0
- package/bin/types/platform/PlatformGateway.d.ts.map +1 -0
- package/bin/types/platform/PlatformGateway.js.map +1 -0
- package/bin/{host/rpc/types → types/rpc}/LocalRpc.d.ts +2 -2
- package/bin/types/rpc/LocalRpc.d.ts.map +1 -0
- package/bin/types/rpc/LocalRpc.js.map +1 -0
- package/bin/utils/Template.d.ts +1 -1
- package/bin/utils/Template.d.ts.map +1 -1
- package/bin/utils/logger/Fetch.d.ts +1 -1
- package/bin/utils/logger/Fetch.d.ts.map +1 -1
- package/bin/utils/logger/FormatRequest.d.ts +1 -1
- package/bin/utils/logger/FormatRequest.d.ts.map +1 -1
- package/bin/utils/logger/FormatRequest.js +1 -1
- package/bin/utils/logger/FormatRequest.js.map +1 -1
- package/bin/utils/logger/FormatResponse.d.ts +1 -1
- package/bin/utils/logger/FormatResponse.d.ts.map +1 -1
- package/bin/utils/logger/FormatShared.d.ts +1 -1
- package/bin/utils/logger/FormatShared.d.ts.map +1 -1
- package/bin/utils/logger/Logger.d.ts +1 -1
- package/bin/utils/logger/Logger.d.ts.map +1 -1
- package/bin/utils/storage/index.d.ts +1 -1
- package/bin/utils/storage/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/config/Config.ts +6 -7
- package/src/config/DowncityDefault.ts +1 -1
- package/src/config/DowncitySchema.ts +1 -1
- package/src/config/Paths.ts +2 -2
- package/src/host/daemon/Api.ts +2 -2
- package/src/host/daemon/Client.ts +3 -3
- package/src/host/daemon/Paths.ts +33 -0
- package/src/host/daemon/ProjectSetup.ts +2 -2
- package/src/host/runtime/AgentHostRuntime.ts +4 -4
- package/src/host/runtime/PluginRuntime.ts +1 -1
- package/src/index.ts +280 -159
- package/src/model/CreateModel.ts +4 -4
- package/src/model/ModelManager.ts +1 -1
- package/src/plugin/builtins/asr/Config.ts +138 -0
- package/src/plugin/builtins/asr/Dependency.ts +1 -1
- package/src/plugin/builtins/asr/InboundAugment.ts +59 -0
- package/src/plugin/builtins/asr/Plugin.ts +9 -160
- package/src/plugin/builtins/auth/Plugin.ts +1 -1
- package/src/plugin/builtins/auth/runtime/AuthorizationConfig.ts +1 -1
- package/src/plugin/builtins/auth/runtime/AuthorizationPolicy.ts +2 -2
- package/src/plugin/builtins/auth/runtime/AuthorizationStore.ts +1 -1
- package/src/plugin/builtins/skill/Action.ts +1 -1
- package/src/plugin/builtins/skill/Config.ts +1 -1
- package/src/plugin/builtins/skill/Plugin.ts +1 -1
- package/src/plugin/builtins/skill/runtime/Discovery.ts +1 -1
- package/src/plugin/builtins/skill/runtime/SystemProvider.ts +1 -1
- package/src/plugin/builtins/skill/types/ClaudeSkill.ts +1 -1
- package/src/plugin/builtins/tts/Dependency.ts +1 -1
- package/src/plugin/builtins/tts/Plugin.ts +6 -63
- package/src/plugin/builtins/tts/PluginSupport.ts +85 -0
- package/src/plugin/builtins/tts/types/TtsPlugin.ts +1 -1
- package/src/plugin/builtins/voice/Config.ts +135 -0
- package/src/plugin/builtins/voice/Dependency.ts +1 -1
- package/src/plugin/builtins/voice/InboundAugment.ts +59 -0
- package/src/plugin/builtins/voice/Plugin.ts +9 -158
- package/src/plugin/builtins/voice/types/VoicePlugin.ts +1 -1
- package/src/plugin/builtins/web/Plugin.ts +1 -1
- package/src/plugin/builtins/web/runtime/Config.ts +1 -1
- package/src/plugin/builtins/web/runtime/Source.ts +1 -1
- package/src/plugin/builtins/web/types/WebPlugin.ts +1 -1
- package/src/plugin/builtins/workboard/runtime/Collector.ts +2 -2
- package/src/plugin/builtins/workboard/runtime/Normalizer.ts +2 -2
- package/src/plugin/builtins/workboard/runtime/Store.ts +1 -1
- package/src/plugin/core/Activation.ts +2 -2
- package/src/plugin/core/HookRegistry.ts +2 -2
- package/src/plugin/core/HttpRoutes.ts +2 -2
- package/src/plugin/core/LocalExecution.ts +2 -2
- package/src/plugin/core/PluginCommand.ts +1 -1
- package/src/plugin/core/PluginManager.ts +2 -2
- package/src/plugin/core/PluginRegistry.ts +2 -2
- package/src/plugin/core/ProjectConfigStore.ts +1 -1
- package/src/plugin/types/Plugin.ts +5 -5
- package/src/plugin/types/PluginApi.ts +1 -1
- package/src/{agent/project → project}/AgentInitializer.ts +4 -4
- package/src/{agent/project → project}/ProjectExecutionBinding.ts +2 -2
- package/src/{agent/project → project}/types/AgentProject.ts +2 -2
- package/src/{agent → runtime}/AgentContext.ts +4 -4
- package/src/{agent → runtime}/AgentContextTypes.ts +4 -4
- package/src/{agent → runtime}/AgentRuntime.ts +8 -8
- package/src/{agent → runtime}/AgentRuntimeState.ts +4 -4
- package/src/{agent → runtime}/AgentRuntimeTypes.ts +2 -2
- package/src/sandbox/SandboxConfigResolver.ts +1 -1
- package/src/sandbox/SandboxRunner.ts +1 -1
- package/src/{host/sdk → sdk}/Agent.ts +80 -28
- package/src/{host/sdk → sdk}/AgentSdkTypes.ts +115 -2
- package/src/{host/sdk → sdk}/HttpServer.ts +10 -1
- package/src/{host/sdk → sdk}/RemoteAgent.ts +25 -1
- package/src/{host/sdk → sdk}/RpcServer.ts +21 -3
- package/src/sdk/SdkSessionSystemComposer.ts +261 -0
- package/src/{host/sdk → sdk}/Session.ts +103 -178
- package/src/{host/sdk → sdk}/SessionMetadata.ts +19 -1
- package/src/sdk/SessionPersistence.ts +113 -0
- package/src/sdk/SessionServicePort.ts +62 -0
- package/src/{host/sdk → sdk}/StreamEvents.ts +45 -2
- package/src/{host → server}/http/Server.ts +7 -7
- package/src/{host → server}/http/control/AuthControlService.ts +3 -3
- package/src/{host → server}/http/control/ControlApiRoutes.ts +6 -6
- package/src/{host → server}/http/control/ControlAuthorizationRoutes.ts +3 -3
- package/src/{host → server}/http/control/ControlRouter.ts +3 -3
- package/src/{host → server}/http/control/ExecuteBySession.ts +4 -4
- package/src/{host → server}/http/control/ExecuteInput.ts +1 -1
- package/src/{host → server}/http/control/MessageTimeline.ts +1 -1
- package/src/{host → server}/http/control/ModelRoutes.ts +2 -2
- package/src/{host → server}/http/control/OverviewRoutes.ts +1 -1
- package/src/{host → server}/http/control/SessionRoutes.ts +2 -2
- package/src/{host → server}/http/control/SessionSummaryStore.ts +2 -2
- package/src/{host → server}/http/control/TaskRoutes.ts +1 -1
- package/src/{host → server}/http/control/TaskStore.ts +1 -1
- package/src/{host → server}/http/control/types/ControlRoutes.ts +2 -2
- package/src/{host → server}/http/control/types/ControlViewData.ts +1 -1
- package/src/{host → server}/http/execute/execute.ts +1 -1
- package/src/{host → server}/http/plugins/plugins.ts +1 -1
- package/src/{host → server}/http/services/services.ts +1 -1
- package/src/{host → server}/http/static/static.ts +1 -1
- package/src/{host → server}/rpc/Server.ts +7 -7
- package/src/service/builtins/BaseService.ts +2 -2
- package/src/service/builtins/README.md +32 -11
- package/src/service/builtins/chat/Action.ts +1 -1
- package/src/service/builtins/chat/ChatService.ts +3 -3
- package/src/service/builtins/chat/ChatServiceTypes.ts +2 -2
- package/src/service/builtins/chat/accounts/ChannelAccountService.ts +2 -2
- package/src/service/builtins/chat/channels/BaseChatChannel.ts +1 -1
- package/src/service/builtins/chat/channels/BaseChatChannelQueue.ts +2 -2
- package/src/service/builtins/chat/channels/BaseChatChannelSupport.ts +2 -2
- package/src/service/builtins/chat/channels/feishu/Feishu.ts +65 -232
- package/src/service/builtins/chat/channels/feishu/FeishuMessageHandler.ts +483 -0
- package/src/service/builtins/chat/channels/feishu/FeishuPlatformClient.ts +1 -1
- package/src/service/builtins/chat/channels/feishu/FeishuPlatformLookup.ts +1 -1
- package/src/service/builtins/chat/channels/feishu/types/FeishuChannel.ts +1 -1
- package/src/service/builtins/chat/channels/qq/QQ.ts +56 -291
- package/src/service/builtins/chat/channels/qq/QQGatewayClient.ts +76 -250
- package/src/service/builtins/chat/channels/qq/QQGatewayConnection.ts +175 -0
- package/src/service/builtins/chat/channels/qq/QQGatewayHeartbeat.ts +114 -0
- package/src/service/builtins/chat/channels/qq/QQGatewayProtocol.ts +176 -0
- package/src/service/builtins/chat/channels/qq/QQGatewaySupport.ts +1 -1
- package/src/service/builtins/chat/channels/qq/QQInbound.ts +1 -1
- package/src/service/builtins/chat/channels/qq/QQMessageHandler.ts +465 -0
- package/src/service/builtins/chat/channels/qq/QQSendSupport.ts +1 -1
- package/src/service/builtins/chat/channels/qq/QQSupport.ts +2 -2
- package/src/service/builtins/chat/channels/qq/types/QqChannel.ts +2 -2
- package/src/service/builtins/chat/channels/telegram/Bot.ts +57 -352
- package/src/service/builtins/chat/channels/telegram/StateStore.ts +1 -1
- package/src/service/builtins/chat/channels/telegram/TelegramMessageHandler.ts +485 -0
- package/src/service/builtins/chat/channels/telegram/TelegramPendingUpdates.ts +204 -0
- 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 +2 -2
- package/src/service/builtins/chat/runtime/ChatActionInput.ts +14 -281
- package/src/service/builtins/chat/runtime/ChatActionInputSupport.ts +85 -0
- package/src/service/builtins/chat/runtime/ChatChannelActions.ts +1 -1
- package/src/service/builtins/chat/runtime/ChatChannelConfig.ts +3 -3
- package/src/service/builtins/chat/runtime/ChatChannelCore.ts +2 -2
- package/src/service/builtins/chat/runtime/ChatChannelLifecycle.ts +1 -1
- package/src/service/builtins/chat/runtime/ChatHistoryStore.ts +2 -2
- package/src/service/builtins/chat/runtime/ChatIngressStore.ts +2 -2
- package/src/service/builtins/chat/runtime/ChatMetaStore.ts +3 -3
- package/src/service/builtins/chat/runtime/ChatQueueReplyDispatch.ts +1 -1
- package/src/service/builtins/chat/runtime/ChatQueueSessionBridge.ts +2 -2
- package/src/service/builtins/chat/runtime/ChatQueueStore.ts +1 -1
- package/src/service/builtins/chat/runtime/ChatQueueWorker.ts +2 -2
- package/src/service/builtins/chat/runtime/ChatSendActionInput.ts +255 -0
- package/src/service/builtins/chat/runtime/ChatServiceActions.ts +1 -1
- 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 +2 -2
- package/src/service/builtins/chat/runtime/EnqueueDispatch.ts +2 -2
- package/src/service/builtins/chat/runtime/InboundAugment.ts +2 -2
- package/src/service/builtins/chat/runtime/PluginDispatch.ts +2 -2
- package/src/service/builtins/chat/runtime/ReplyContextFormatter.ts +1 -1
- package/src/service/builtins/chat/runtime/ReplyDispatch.ts +2 -2
- package/src/service/builtins/chat/runtime/SystemPrompt.ts +1 -1
- package/src/service/builtins/chat/runtime/UIMessageTransformer.ts +1 -1
- package/src/service/builtins/chat/types/ChannelAccount.ts +1 -1
- package/src/service/builtins/chat/types/ChatHistory.ts +1 -1
- package/src/service/builtins/chat/types/ChatMeta.ts +1 -1
- package/src/service/builtins/chat/types/ChatQueue.ts +1 -1
- package/src/service/builtins/chat/types/ChatService.ts +1 -1
- package/src/service/builtins/contact/Action.ts +368 -4
- package/src/service/builtins/contact/ContactService.ts +30 -324
- package/src/service/builtins/contact/runtime/ChatRuntime.ts +1 -1
- package/src/service/builtins/contact/runtime/ContactPayload.ts +38 -0
- package/src/service/builtins/contact/runtime/RemoteClient.ts +1 -1
- package/src/service/builtins/contact/runtime/ShareBundle.ts +1 -1
- package/src/service/builtins/memory/Action.ts +2 -2
- package/src/service/builtins/memory/MemoryService.ts +2 -2
- 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/memory/types/Memory.ts +1 -1
- 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 +135 -0
- package/src/service/builtins/shell/runtime/ShellActionRuntime.ts +3 -38
- package/src/service/builtins/shell/runtime/ShellActionRuntimeSupport.ts +11 -165
- package/src/service/builtins/shell/runtime/ShellProcessEvents.ts +65 -0
- package/src/service/builtins/shell/runtime/ShellRuntimeEnvironment.ts +75 -0
- package/src/service/builtins/task/Action.ts +2 -2
- 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/Model.ts +1 -1
- package/src/service/builtins/task/runtime/Paths.ts +1 -1
- package/src/service/builtins/task/runtime/Runner.ts +17 -63
- package/src/service/builtins/task/runtime/TaskActionExecution.ts +1 -1
- package/src/service/builtins/task/runtime/TaskActionInput.ts +1 -1
- package/src/service/builtins/task/runtime/TaskRunChatDispatch.ts +1 -1
- package/src/service/builtins/task/runtime/TaskRunnerRound.ts +3 -3
- package/src/service/builtins/task/runtime/TaskRunnerScript.ts +175 -0
- package/src/service/builtins/task/runtime/TaskRunnerSession.ts +1 -1
- package/src/service/core/Manager.ts +3 -3
- package/src/service/core/ServiceActionApi.ts +2 -2
- package/src/service/core/ServiceActionRunner.ts +2 -2
- package/src/service/core/ServiceClassRegistry.ts +1 -1
- package/src/service/core/ServiceManager.ts +2 -2
- package/src/service/core/ServiceStateController.ts +2 -2
- package/src/service/core/ServiceSystemProviders.ts +1 -1
- package/src/service/core/Services.ts +1 -1
- package/src/service/schedule/Executor.ts +1 -1
- package/src/service/schedule/Runtime.ts +1 -1
- package/src/service/schedule/Store.ts +1 -1
- package/src/service/types/Service.ts +2 -2
- package/src/service/types/ServiceSchedule.ts +1 -1
- package/src/service/types/ServiceState.ts +1 -1
- package/src/service/types/Services.ts +1 -1
- package/src/session/Session.ts +1 -1
- package/src/session/composer/history/SessionHistoryWriter.ts +1 -1
- package/src/session/composer/system/default/DefaultSessionSystemComposer.ts +1 -1
- package/src/session/composer/system/default/SystemDomain.ts +1 -1
- package/src/session/executors/local/LocalSessionCore.ts +10 -498
- package/src/session/executors/local/SessionExecutionError.ts +47 -0
- package/src/session/executors/local/SessionModelMessageState.ts +133 -0
- package/src/session/executors/local/SessionSignals.ts +1 -1
- package/src/session/executors/local/SessionToolLoopRunner.ts +350 -0
- package/src/session/executors/local/SessionUiStreamCollector.ts +96 -0
- package/src/session/messages/SessionStepEventMapper.ts +1 -1
- package/src/session/tools/shell/ShellToolBridge.ts +2 -2
- package/src/session/tools/shell/ShellToolDefinition.ts +1 -1
- package/src/session/tools/shell/ShellToolFormatting.ts +1 -1
- package/src/session/types/SessionHistoryMeta.ts +2 -0
- package/src/session/types/SessionMessages.ts +1 -1
- package/src/{host → transport}/rpc/Client.ts +1 -1
- package/src/{host → transport}/rpc/Paths.ts +22 -2
- package/src/{config/types → types/config}/DowncityConfig.ts +3 -3
- package/src/{host/daemon/types → types/daemon}/Daemon.ts +1 -1
- package/src/{host/types → types/host}/AgentHost.ts +6 -6
- package/src/{host/types → types/host}/Store.ts +1 -1
- package/src/{host/rpc/types → types/rpc}/LocalRpc.ts +1 -1
- package/src/utils/Template.ts +1 -1
- package/src/utils/logger/Fetch.ts +1 -1
- package/src/utils/logger/FormatRequest.ts +2 -2
- package/src/utils/logger/FormatResponse.ts +1 -1
- package/src/utils/logger/FormatShared.ts +1 -1
- package/src/utils/logger/Logger.ts +1 -1
- package/src/utils/storage/index.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/bin/agent/AgentContext.d.ts.map +0 -1
- package/bin/agent/AgentContext.js.map +0 -1
- package/bin/agent/AgentContextTypes.d.ts.map +0 -1
- package/bin/agent/AgentContextTypes.js.map +0 -1
- package/bin/agent/AgentRuntime.d.ts.map +0 -1
- package/bin/agent/AgentRuntime.js.map +0 -1
- package/bin/agent/AgentRuntimeState.d.ts.map +0 -1
- package/bin/agent/AgentRuntimeState.js.map +0 -1
- package/bin/agent/AgentRuntimeTypes.d.ts.map +0 -1
- package/bin/agent/AgentRuntimeTypes.js.map +0 -1
- package/bin/agent/project/AgentInitializer.d.ts.map +0 -1
- package/bin/agent/project/AgentInitializer.js.map +0 -1
- package/bin/agent/project/ProjectExecutionBinding.d.ts.map +0 -1
- package/bin/agent/project/ProjectExecutionBinding.js.map +0 -1
- package/bin/agent/project/types/AgentProject.d.ts.map +0 -1
- package/bin/agent/project/types/AgentProject.js.map +0 -1
- package/bin/config/types/DowncityConfig.js.map +0 -1
- package/bin/config/types/ExecutionBinding.js.map +0 -1
- package/bin/config/types/LlmConfig.js.map +0 -1
- package/bin/config/types/ModelBinding.js.map +0 -1
- package/bin/config/types/Start.js.map +0 -1
- package/bin/host/daemon/Manager.d.ts +0 -92
- package/bin/host/daemon/Manager.d.ts.map +0 -1
- package/bin/host/daemon/Manager.js +0 -287
- package/bin/host/daemon/Manager.js.map +0 -1
- package/bin/host/daemon/types/Daemon.d.ts.map +0 -1
- package/bin/host/daemon/types/Daemon.js.map +0 -1
- package/bin/host/http/Server.d.ts.map +0 -1
- package/bin/host/http/Server.js.map +0 -1
- package/bin/host/http/auth/AuthEnv.d.ts.map +0 -1
- package/bin/host/http/auth/AuthEnv.js.map +0 -1
- package/bin/host/http/auth/AuthError.d.ts.map +0 -1
- package/bin/host/http/auth/AuthError.js.map +0 -1
- package/bin/host/http/auth/CliAuthStateStore.d.ts.map +0 -1
- package/bin/host/http/auth/CliAuthStateStore.js.map +0 -1
- package/bin/host/http/auth/PasswordHasher.d.ts.map +0 -1
- package/bin/host/http/auth/PasswordHasher.js.map +0 -1
- package/bin/host/http/auth/TokenService.d.ts.map +0 -1
- package/bin/host/http/auth/TokenService.js.map +0 -1
- package/bin/host/http/auth/types/AuthPermission.d.ts.map +0 -1
- package/bin/host/http/auth/types/AuthPermission.js.map +0 -1
- package/bin/host/http/auth/types/AuthRoute.d.ts.map +0 -1
- package/bin/host/http/auth/types/AuthRoute.js.map +0 -1
- package/bin/host/http/auth/types/AuthToken.d.ts.map +0 -1
- package/bin/host/http/auth/types/AuthToken.js.map +0 -1
- package/bin/host/http/auth/types/AuthTypes.d.ts.map +0 -1
- package/bin/host/http/auth/types/AuthTypes.js.map +0 -1
- package/bin/host/http/control/AuthControlService.d.ts.map +0 -1
- package/bin/host/http/control/AuthControlService.js.map +0 -1
- package/bin/host/http/control/CommonHelpers.d.ts.map +0 -1
- package/bin/host/http/control/CommonHelpers.js.map +0 -1
- package/bin/host/http/control/ControlApiRoutes.d.ts.map +0 -1
- package/bin/host/http/control/ControlApiRoutes.js.map +0 -1
- package/bin/host/http/control/ControlAuthorizationRoutes.d.ts.map +0 -1
- package/bin/host/http/control/ControlAuthorizationRoutes.js.map +0 -1
- package/bin/host/http/control/ControlRouter.d.ts.map +0 -1
- package/bin/host/http/control/ControlRouter.js.map +0 -1
- package/bin/host/http/control/ExecuteBySession.d.ts.map +0 -1
- package/bin/host/http/control/ExecuteBySession.js.map +0 -1
- package/bin/host/http/control/ExecuteInput.d.ts.map +0 -1
- package/bin/host/http/control/ExecuteInput.js.map +0 -1
- package/bin/host/http/control/Helpers.js.map +0 -1
- package/bin/host/http/control/MessageTimeline.d.ts.map +0 -1
- package/bin/host/http/control/MessageTimeline.js.map +0 -1
- package/bin/host/http/control/ModelRoutes.d.ts.map +0 -1
- package/bin/host/http/control/ModelRoutes.js.map +0 -1
- package/bin/host/http/control/OverviewRoutes.d.ts.map +0 -1
- package/bin/host/http/control/OverviewRoutes.js.map +0 -1
- package/bin/host/http/control/SessionRoutes.d.ts.map +0 -1
- package/bin/host/http/control/SessionRoutes.js.map +0 -1
- package/bin/host/http/control/SessionSummaryStore.d.ts.map +0 -1
- package/bin/host/http/control/SessionSummaryStore.js.map +0 -1
- package/bin/host/http/control/TaskRoutes.d.ts.map +0 -1
- package/bin/host/http/control/TaskRoutes.js.map +0 -1
- package/bin/host/http/control/TaskStore.d.ts.map +0 -1
- package/bin/host/http/control/TaskStore.js.map +0 -1
- package/bin/host/http/control/types/AuthControl.d.ts.map +0 -1
- package/bin/host/http/control/types/AuthControl.js.map +0 -1
- package/bin/host/http/control/types/ControlRoutes.d.ts.map +0 -1
- package/bin/host/http/control/types/ControlRoutes.js.map +0 -1
- package/bin/host/http/control/types/ControlSessionExecute.d.ts.map +0 -1
- package/bin/host/http/control/types/ControlSessionExecute.js.map +0 -1
- package/bin/host/http/control/types/ControlViewData.d.ts.map +0 -1
- package/bin/host/http/control/types/ControlViewData.js.map +0 -1
- package/bin/host/http/execute/execute.d.ts.map +0 -1
- package/bin/host/http/execute/execute.js.map +0 -1
- package/bin/host/http/execute/types/InlineInstant.d.ts.map +0 -1
- package/bin/host/http/execute/types/InlineInstant.js.map +0 -1
- package/bin/host/http/health/health.d.ts.map +0 -1
- package/bin/host/http/health/health.js.map +0 -1
- package/bin/host/http/plugins/plugins.d.ts.map +0 -1
- package/bin/host/http/plugins/plugins.js.map +0 -1
- package/bin/host/http/services/services.d.ts.map +0 -1
- package/bin/host/http/services/services.js.map +0 -1
- package/bin/host/http/static/static.d.ts.map +0 -1
- package/bin/host/http/static/static.js.map +0 -1
- package/bin/host/rpc/Client.d.ts.map +0 -1
- package/bin/host/rpc/Client.js.map +0 -1
- package/bin/host/rpc/Paths.d.ts.map +0 -1
- package/bin/host/rpc/Paths.js.map +0 -1
- package/bin/host/rpc/Server.d.ts.map +0 -1
- package/bin/host/rpc/Server.js.map +0 -1
- package/bin/host/rpc/Transport.d.ts.map +0 -1
- package/bin/host/rpc/Transport.js.map +0 -1
- package/bin/host/rpc/types/LocalRpc.d.ts.map +0 -1
- package/bin/host/rpc/types/LocalRpc.js.map +0 -1
- package/bin/host/runtime/CityPaths.d.ts +0 -50
- package/bin/host/runtime/CityPaths.d.ts.map +0 -1
- package/bin/host/runtime/CityPaths.js +0 -75
- package/bin/host/runtime/CityPaths.js.map +0 -1
- package/bin/host/runtime/CityRegistry.d.ts +0 -51
- package/bin/host/runtime/CityRegistry.d.ts.map +0 -1
- package/bin/host/runtime/CityRegistry.js +0 -217
- package/bin/host/runtime/CityRegistry.js.map +0 -1
- package/bin/host/runtime/CityRuntime.d.ts +0 -21
- package/bin/host/runtime/CityRuntime.d.ts.map +0 -1
- package/bin/host/runtime/CityRuntime.js +0 -45
- package/bin/host/runtime/CityRuntime.js.map +0 -1
- package/bin/host/runtime/ProcessSweep.d.ts +0 -76
- package/bin/host/runtime/ProcessSweep.d.ts.map +0 -1
- package/bin/host/runtime/ProcessSweep.js +0 -188
- package/bin/host/runtime/ProcessSweep.js.map +0 -1
- package/bin/host/runtime/types/Platform.d.ts.map +0 -1
- package/bin/host/runtime/types/Platform.js.map +0 -1
- package/bin/host/runtime/types/PlatformGateway.d.ts.map +0 -1
- package/bin/host/runtime/types/PlatformGateway.js.map +0 -1
- package/bin/host/sdk/Agent.d.ts.map +0 -1
- package/bin/host/sdk/Agent.js.map +0 -1
- package/bin/host/sdk/AgentSdkTypes.d.ts.map +0 -1
- package/bin/host/sdk/AgentSdkTypes.js.map +0 -1
- package/bin/host/sdk/AsyncQueue.d.ts.map +0 -1
- package/bin/host/sdk/AsyncQueue.js.map +0 -1
- package/bin/host/sdk/HttpServer.d.ts.map +0 -1
- package/bin/host/sdk/HttpServer.js.map +0 -1
- package/bin/host/sdk/Paths.d.ts.map +0 -1
- package/bin/host/sdk/Paths.js.map +0 -1
- package/bin/host/sdk/RemoteAgent.d.ts.map +0 -1
- package/bin/host/sdk/RemoteAgent.js.map +0 -1
- package/bin/host/sdk/RpcServer.d.ts.map +0 -1
- package/bin/host/sdk/RpcServer.js.map +0 -1
- package/bin/host/sdk/SdkSessionSystemComposer.d.ts +0 -43
- package/bin/host/sdk/SdkSessionSystemComposer.d.ts.map +0 -1
- package/bin/host/sdk/SdkSessionSystemComposer.js +0 -71
- package/bin/host/sdk/SdkSessionSystemComposer.js.map +0 -1
- package/bin/host/sdk/Session.d.ts.map +0 -1
- package/bin/host/sdk/Session.js.map +0 -1
- package/bin/host/sdk/SessionMetadata.d.ts.map +0 -1
- package/bin/host/sdk/SessionMetadata.js.map +0 -1
- package/bin/host/sdk/StreamEvents.d.ts +0 -14
- package/bin/host/sdk/StreamEvents.d.ts.map +0 -1
- package/bin/host/sdk/StreamEvents.js.map +0 -1
- package/bin/host/types/AgentHost.js +0 -10
- package/bin/host/types/AgentHost.js.map +0 -1
- package/bin/utils/types/Json.d.ts.map +0 -1
- package/bin/utils/types/Json.js.map +0 -1
- package/bin/utils/types/Template.d.ts.map +0 -1
- package/bin/utils/types/Template.js.map +0 -1
- package/src/host/daemon/Manager.ts +0 -344
- package/src/host/runtime/CityPaths.ts +0 -84
- package/src/host/runtime/CityRegistry.ts +0 -256
- package/src/host/runtime/CityRuntime.ts +0 -45
- package/src/host/runtime/ProcessSweep.ts +0 -239
- package/src/host/sdk/SdkSessionSystemComposer.ts +0 -113
- /package/bin/{agent/project → project}/ProjectExecutionBinding.js +0 -0
- /package/bin/{agent/project → project}/types/AgentProject.js +0 -0
- /package/bin/{agent → runtime}/AgentContextTypes.js +0 -0
- /package/bin/{agent → runtime}/AgentRuntimeState.js +0 -0
- /package/bin/{agent → runtime}/AgentRuntimeTypes.js +0 -0
- /package/bin/{host/sdk → sdk}/AgentSdkTypes.js +0 -0
- /package/bin/{host/sdk → sdk}/AsyncQueue.d.ts +0 -0
- /package/bin/{host/sdk → sdk}/AsyncQueue.js +0 -0
- /package/bin/{host/sdk → sdk}/Paths.d.ts +0 -0
- /package/bin/{host/sdk → sdk}/Paths.js +0 -0
- /package/bin/{host → server}/http/Server.d.ts +0 -0
- /package/bin/{host → server}/http/auth/AuthEnv.d.ts +0 -0
- /package/bin/{host → server}/http/auth/AuthEnv.js +0 -0
- /package/bin/{host → server}/http/auth/AuthError.d.ts +0 -0
- /package/bin/{host → server}/http/auth/AuthError.js +0 -0
- /package/bin/{host → server}/http/auth/CliAuthStateStore.d.ts +0 -0
- /package/bin/{host → server}/http/auth/CliAuthStateStore.js +0 -0
- /package/bin/{host → server}/http/auth/PasswordHasher.d.ts +0 -0
- /package/bin/{host → server}/http/auth/PasswordHasher.js +0 -0
- /package/bin/{host → server}/http/auth/TokenService.d.ts +0 -0
- /package/bin/{host → server}/http/auth/TokenService.js +0 -0
- /package/bin/{host → server}/http/control/AuthControlService.js +0 -0
- /package/bin/{host → server}/http/control/CommonHelpers.d.ts +0 -0
- /package/bin/{host → server}/http/control/CommonHelpers.js +0 -0
- /package/bin/{host → server}/http/control/ExecuteBySession.js +0 -0
- /package/bin/{host → server}/http/control/ExecuteInput.js +0 -0
- /package/bin/{host → server}/http/control/Helpers.d.ts +0 -0
- /package/bin/{host → server}/http/control/Helpers.js +0 -0
- /package/bin/{host → server}/http/control/MessageTimeline.js +0 -0
- /package/bin/{host → server}/http/control/OverviewRoutes.js +0 -0
- /package/bin/{host → server}/http/control/SessionRoutes.js +0 -0
- /package/bin/{host → server}/http/control/SessionSummaryStore.js +0 -0
- /package/bin/{host → server}/http/control/TaskRoutes.js +0 -0
- /package/bin/{host → server}/http/control/TaskStore.js +0 -0
- /package/bin/{host → server}/http/control/types/AuthControl.d.ts +0 -0
- /package/bin/{host → server}/http/control/types/AuthControl.js +0 -0
- /package/bin/{host → server}/http/control/types/ControlRoutes.js +0 -0
- /package/bin/{host → server}/http/control/types/ControlSessionExecute.d.ts +0 -0
- /package/bin/{host → server}/http/control/types/ControlSessionExecute.js +0 -0
- /package/bin/{host → server}/http/control/types/ControlViewData.js +0 -0
- /package/bin/{host → server}/http/execute/execute.d.ts +0 -0
- /package/bin/{host → server}/http/health/health.d.ts +0 -0
- /package/bin/{host → server}/http/health/health.js +0 -0
- /package/bin/{host → server}/http/plugins/plugins.d.ts +0 -0
- /package/bin/{host → server}/http/services/services.d.ts +0 -0
- /package/bin/{host → server}/http/static/static.d.ts +0 -0
- /package/bin/{host → transport}/rpc/Client.d.ts +0 -0
- /package/bin/{host → transport}/rpc/Client.js +0 -0
- /package/bin/{host → transport}/rpc/Paths.d.ts +0 -0
- /package/bin/{host → transport}/rpc/Transport.d.ts +0 -0
- /package/bin/{host → transport}/rpc/Transport.js +0 -0
- /package/bin/{host/http/auth/types → types/auth}/AuthPermission.d.ts +0 -0
- /package/bin/{host/http/auth/types → types/auth}/AuthPermission.js +0 -0
- /package/bin/{host/http/auth/types → types/auth}/AuthRoute.d.ts +0 -0
- /package/bin/{host/http/auth/types → types/auth}/AuthRoute.js +0 -0
- /package/bin/{host/http/auth/types → types/auth}/AuthToken.d.ts +0 -0
- /package/bin/{host/http/auth/types → types/auth}/AuthToken.js +0 -0
- /package/bin/{host/http/auth/types → types/auth}/AuthTypes.d.ts +0 -0
- /package/bin/{host/http/auth/types → types/auth}/AuthTypes.js +0 -0
- /package/bin/{utils/types → types/common}/Json.d.ts +0 -0
- /package/bin/{utils/types → types/common}/Json.js +0 -0
- /package/bin/{utils/types → types/common}/Template.d.ts +0 -0
- /package/bin/{utils/types → types/common}/Template.js +0 -0
- /package/bin/{config/types → types/config}/DowncityConfig.js +0 -0
- /package/bin/{config/types → types/config}/ExecutionBinding.d.ts +0 -0
- /package/bin/{config/types → types/config}/ExecutionBinding.js +0 -0
- /package/bin/{config/types → types/config}/LlmConfig.d.ts +0 -0
- /package/bin/{config/types → types/config}/LlmConfig.js +0 -0
- /package/bin/{config/types → types/config}/ModelBinding.d.ts +0 -0
- /package/bin/{config/types → types/config}/ModelBinding.js +0 -0
- /package/bin/{config/types → types/config}/Start.d.ts +0 -0
- /package/bin/{config/types → types/config}/Start.js +0 -0
- /package/bin/{host/types → types/host}/Store.js +0 -0
- /package/bin/{host/http/execute/types → types/http}/InlineInstant.d.ts +0 -0
- /package/bin/{host/http/execute/types → types/http}/InlineInstant.js +0 -0
- /package/bin/{host/runtime/types → types/platform}/Platform.d.ts +0 -0
- /package/bin/{host/runtime/types → types/platform}/Platform.js +0 -0
- /package/bin/{host/runtime/types → types/platform}/PlatformGateway.d.ts +0 -0
- /package/bin/{host/runtime/types → types/platform}/PlatformGateway.js +0 -0
- /package/bin/{host/rpc/types → types/rpc}/LocalRpc.js +0 -0
- /package/src/{host/sdk → sdk}/AsyncQueue.ts +0 -0
- /package/src/{host/sdk → sdk}/Paths.ts +0 -0
- /package/src/{host → server}/http/auth/AuthEnv.ts +0 -0
- /package/src/{host → server}/http/auth/AuthError.ts +0 -0
- /package/src/{host → server}/http/auth/CliAuthStateStore.ts +0 -0
- /package/src/{host → server}/http/auth/PasswordHasher.ts +0 -0
- /package/src/{host → server}/http/auth/TokenService.ts +0 -0
- /package/src/{host → server}/http/control/CommonHelpers.ts +0 -0
- /package/src/{host → server}/http/control/Helpers.ts +0 -0
- /package/src/{host → server}/http/control/types/AuthControl.ts +0 -0
- /package/src/{host → server}/http/control/types/ControlSessionExecute.ts +0 -0
- /package/src/{host → server}/http/health/health.ts +0 -0
- /package/src/{host → transport}/rpc/Transport.ts +0 -0
- /package/src/{host/http/auth/types → types/auth}/AuthPermission.ts +0 -0
- /package/src/{host/http/auth/types → types/auth}/AuthRoute.ts +0 -0
- /package/src/{host/http/auth/types → types/auth}/AuthToken.ts +0 -0
- /package/src/{host/http/auth/types → types/auth}/AuthTypes.ts +0 -0
- /package/src/{utils/types → types/common}/Json.ts +0 -0
- /package/src/{utils/types → types/common}/Template.ts +0 -0
- /package/src/{config/types → types/config}/ExecutionBinding.ts +0 -0
- /package/src/{config/types → types/config}/LlmConfig.ts +0 -0
- /package/src/{config/types → types/config}/ModelBinding.ts +0 -0
- /package/src/{config/types → types/config}/Start.ts +0 -0
- /package/src/{host/http/execute/types → types/http}/InlineInstant.ts +0 -0
- /package/src/{host/runtime/types → types/platform}/Platform.ts +0 -0
- /package/src/{host/runtime/types → types/platform}/PlatformGateway.ts +0 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session 执行错误归一化工具。
|
|
3
|
+
*
|
|
4
|
+
* 关键点(中文)
|
|
5
|
+
* - AI SDK 的最终错误有时只是兜底包装,底层 provider 错误会先从 stream `onError` 暴露。
|
|
6
|
+
* - LocalSessionCore 只需要消费这里输出的日志字段与最终错误文本。
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* 归一化 stream 错误日志字段。
|
|
10
|
+
*/
|
|
11
|
+
export function summarizeStreamError(error) {
|
|
12
|
+
const record = error && typeof error === "object" && !Array.isArray(error)
|
|
13
|
+
? error
|
|
14
|
+
: {};
|
|
15
|
+
const cause = record.cause;
|
|
16
|
+
return {
|
|
17
|
+
error: String(error),
|
|
18
|
+
name: typeof record.name === "string" ? record.name : null,
|
|
19
|
+
message: typeof record.message === "string" ? record.message : null,
|
|
20
|
+
cause: cause === undefined ? null : String(cause),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* 提取实际应返回给上层的错误文本。
|
|
25
|
+
*/
|
|
26
|
+
export function resolveEffectiveExecutionError(params) {
|
|
27
|
+
const outerError = String(params.error ?? "").trim();
|
|
28
|
+
const innerError = String(params.streamError ?? "").trim();
|
|
29
|
+
if (/AI_NoOutputGeneratedError|No output generated/i.test(outerError) && innerError) {
|
|
30
|
+
return innerError;
|
|
31
|
+
}
|
|
32
|
+
return outerError || innerError || "Unknown execution error";
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=SessionExecutionError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SessionExecutionError.js","sourceRoot":"","sources":["../../../../src/session/executors/local/SessionExecutionError.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAc;IACjD,MAAM,MAAM,GACV,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACzD,CAAC,CAAE,KAAiC;QACpC,CAAC,CAAC,EAAE,CAAC;IACT,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;IAC3B,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC;QACpB,IAAI,EAAE,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI;QAC1D,OAAO,EAAE,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI;QACnE,KAAK,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;KAClD,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,8BAA8B,CAAC,MAS9C;IACC,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACrD,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC3D,IAAI,gDAAgD,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,UAAU,EAAE,CAAC;QACpF,OAAO,UAAU,CAAC;IACpB,CAAC;IACD,OAAO,UAAU,IAAI,UAAU,IAAI,yBAAyB,CAAC;AAC/D,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session 模型消息运行态。
|
|
3
|
+
*
|
|
4
|
+
* 关键点(中文)
|
|
5
|
+
* - LocalSessionCore 同时维护 session 语义消息与模型消息。
|
|
6
|
+
* - 新增 user 消息可优先做增量转换,失败时再回退为全量重算。
|
|
7
|
+
* - assistant UI 消息只需要进入 session 语义基线;模型侧使用 SDK 返回的 response messages。
|
|
8
|
+
*/
|
|
9
|
+
import type { ModelMessage, Tool } from "ai";
|
|
10
|
+
import type { SessionMessageV1 } from "../../../session/types/SessionMessages.js";
|
|
11
|
+
/**
|
|
12
|
+
* LocalSessionCore 单轮执行期间的消息基线。
|
|
13
|
+
*/
|
|
14
|
+
export declare class SessionModelMessageState {
|
|
15
|
+
/**
|
|
16
|
+
* 当前运行时 session 语义消息。
|
|
17
|
+
*/
|
|
18
|
+
private sessionMessages;
|
|
19
|
+
/**
|
|
20
|
+
* 当前模型侧消息基线。
|
|
21
|
+
*/
|
|
22
|
+
private currentModelMessages;
|
|
23
|
+
/**
|
|
24
|
+
* 当前轮可用工具集合。
|
|
25
|
+
*/
|
|
26
|
+
private readonly tools;
|
|
27
|
+
private constructor();
|
|
28
|
+
/**
|
|
29
|
+
* 基于初始 session 消息创建运行态。
|
|
30
|
+
*/
|
|
31
|
+
static create(params: {
|
|
32
|
+
/**
|
|
33
|
+
* 初始 session 语义消息。
|
|
34
|
+
*/
|
|
35
|
+
messages: SessionMessageV1[];
|
|
36
|
+
/**
|
|
37
|
+
* 当前轮可用工具集合。
|
|
38
|
+
*/
|
|
39
|
+
tools: Record<string, Tool>;
|
|
40
|
+
}): Promise<SessionModelMessageState>;
|
|
41
|
+
/**
|
|
42
|
+
* 读取当前模型消息。
|
|
43
|
+
*/
|
|
44
|
+
get modelMessages(): ModelMessage[];
|
|
45
|
+
/**
|
|
46
|
+
* 把 step 间新增的 user 消息并入两份基线。
|
|
47
|
+
*/
|
|
48
|
+
appendMergedUserMessages(messages: SessionMessageV1[]): Promise<ModelMessage[]>;
|
|
49
|
+
/**
|
|
50
|
+
* 追加内部生成的 user nudge 消息。
|
|
51
|
+
*/
|
|
52
|
+
appendUserTextMessage(message: SessionMessageV1): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* 追加 assistant UI 消息到 session 语义基线。
|
|
55
|
+
*/
|
|
56
|
+
appendRuntimeSessionMessage(message: SessionMessageV1): void;
|
|
57
|
+
/**
|
|
58
|
+
* 追加 SDK 返回的模型 response messages。
|
|
59
|
+
*/
|
|
60
|
+
appendModelMessages(messages: ModelMessage[]): void;
|
|
61
|
+
private appendSessionMessagesAsModelMessages;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=SessionModelMessageState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SessionModelMessageState.d.ts","sourceRoot":"","sources":["../../../../src/session/executors/local/SessionModelMessageState.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAM3E;;GAEG;AACH,qBAAa,wBAAwB;IACnC;;OAEG;IACH,OAAO,CAAC,eAAe,CAAqB;IAE5C;;OAEG;IACH,OAAO,CAAC,oBAAoB,CAAiB;IAE7C;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAuB;IAE7C,OAAO;IAmBP;;OAEG;WACU,MAAM,CAAC,MAAM,EAAE;QAC1B;;WAEG;QACH,QAAQ,EAAE,gBAAgB,EAAE,CAAC;QAC7B;;WAEG;QACH,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;KAC7B,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAWrC;;OAEG;IACH,IAAI,aAAa,IAAI,YAAY,EAAE,CAElC;IAED;;OAEG;IACG,wBAAwB,CAC5B,QAAQ,EAAE,gBAAgB,EAAE,GAC3B,OAAO,CAAC,YAAY,EAAE,CAAC;IAM1B;;OAEG;IACG,qBAAqB,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrE;;OAEG;IACH,2BAA2B,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI;IAI5D;;OAEG;IACH,mBAAmB,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,IAAI;YAKrC,oCAAoC;CAenD"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session 模型消息运行态。
|
|
3
|
+
*
|
|
4
|
+
* 关键点(中文)
|
|
5
|
+
* - LocalSessionCore 同时维护 session 语义消息与模型消息。
|
|
6
|
+
* - 新增 user 消息可优先做增量转换,失败时再回退为全量重算。
|
|
7
|
+
* - assistant UI 消息只需要进入 session 语义基线;模型侧使用 SDK 返回的 response messages。
|
|
8
|
+
*/
|
|
9
|
+
import { pickMergedUserMessages, toModelMessages, } from "../../messages/SessionMessageCodec.js";
|
|
10
|
+
/**
|
|
11
|
+
* LocalSessionCore 单轮执行期间的消息基线。
|
|
12
|
+
*/
|
|
13
|
+
export class SessionModelMessageState {
|
|
14
|
+
/**
|
|
15
|
+
* 当前运行时 session 语义消息。
|
|
16
|
+
*/
|
|
17
|
+
sessionMessages;
|
|
18
|
+
/**
|
|
19
|
+
* 当前模型侧消息基线。
|
|
20
|
+
*/
|
|
21
|
+
currentModelMessages;
|
|
22
|
+
/**
|
|
23
|
+
* 当前轮可用工具集合。
|
|
24
|
+
*/
|
|
25
|
+
tools;
|
|
26
|
+
constructor(params) {
|
|
27
|
+
this.sessionMessages = params.sessionMessages;
|
|
28
|
+
this.currentModelMessages = params.modelMessages;
|
|
29
|
+
this.tools = params.tools;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* 基于初始 session 消息创建运行态。
|
|
33
|
+
*/
|
|
34
|
+
static async create(params) {
|
|
35
|
+
const sessionMessages = Array.isArray(params.messages)
|
|
36
|
+
? [...params.messages]
|
|
37
|
+
: [];
|
|
38
|
+
return new SessionModelMessageState({
|
|
39
|
+
sessionMessages,
|
|
40
|
+
modelMessages: await toModelMessages(sessionMessages, params.tools),
|
|
41
|
+
tools: params.tools,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* 读取当前模型消息。
|
|
46
|
+
*/
|
|
47
|
+
get modelMessages() {
|
|
48
|
+
return this.currentModelMessages;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* 把 step 间新增的 user 消息并入两份基线。
|
|
52
|
+
*/
|
|
53
|
+
async appendMergedUserMessages(messages) {
|
|
54
|
+
const mergedMessages = pickMergedUserMessages(messages);
|
|
55
|
+
if (mergedMessages.length === 0)
|
|
56
|
+
return [];
|
|
57
|
+
return await this.appendSessionMessagesAsModelMessages(mergedMessages);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* 追加内部生成的 user nudge 消息。
|
|
61
|
+
*/
|
|
62
|
+
async appendUserTextMessage(message) {
|
|
63
|
+
await this.appendSessionMessagesAsModelMessages([message]);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* 追加 assistant UI 消息到 session 语义基线。
|
|
67
|
+
*/
|
|
68
|
+
appendRuntimeSessionMessage(message) {
|
|
69
|
+
this.sessionMessages = [...this.sessionMessages, message];
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* 追加 SDK 返回的模型 response messages。
|
|
73
|
+
*/
|
|
74
|
+
appendModelMessages(messages) {
|
|
75
|
+
if (!Array.isArray(messages) || messages.length === 0)
|
|
76
|
+
return;
|
|
77
|
+
this.currentModelMessages = [...this.currentModelMessages, ...messages];
|
|
78
|
+
}
|
|
79
|
+
async appendSessionMessagesAsModelMessages(messages) {
|
|
80
|
+
this.sessionMessages = [...this.sessionMessages, ...messages];
|
|
81
|
+
const modelMessages = await toModelMessages(messages, this.tools);
|
|
82
|
+
if (modelMessages.length > 0) {
|
|
83
|
+
this.currentModelMessages = [...this.currentModelMessages, ...modelMessages];
|
|
84
|
+
return modelMessages;
|
|
85
|
+
}
|
|
86
|
+
this.currentModelMessages = await toModelMessages(this.sessionMessages, this.tools);
|
|
87
|
+
return [];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=SessionModelMessageState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SessionModelMessageState.js","sourceRoot":"","sources":["../../../../src/session/executors/local/SessionModelMessageState.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EACL,sBAAsB,EACtB,eAAe,GAChB,MAAM,0CAA0C,CAAC;AAElD;;GAEG;AACH,MAAM,OAAO,wBAAwB;IACnC;;OAEG;IACK,eAAe,CAAqB;IAE5C;;O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CAAC;IAC5D,CAAC;IAED;;OAEG;IACH,mBAAmB,CAAC,QAAwB;QAC1C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO;QAC9D,IAAI,CAAC,oBAAoB,GAAG,CAAC,GAAG,IAAI,CAAC,oBAAoB,EAAE,GAAG,QAAQ,CAAC,CAAC;IAC1E,CAAC;IAEO,KAAK,CAAC,oCAAoC,CAChD,QAA4B;QAE5B,IAAI,CAAC,eAAe,GAAG,CAAC,GAAG,IAAI,CAAC,eAAe,EAAE,GAAG,QAAQ,CAAC,CAAC;QAC9D,MAAM,aAAa,GAAG,MAAM,eAAe,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAClE,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC7B,IAAI,CAAC,oBAAoB,GAAG,CAAC,GAAG,IAAI,CAAC,oBAAoB,EAAE,GAAG,aAAa,CAAC,CAAC;YAC7E,OAAO,aAAa,CAAC;QACvB,CAAC;QACD,IAAI,CAAC,oBAAoB,GAAG,MAAM,eAAe,CAC/C,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,KAAK,CACX,CAAC;QACF,OAAO,EAAE,CAAC;IACZ,CAAC;CACF"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* - 目标是让 LocalSessionCore 保持“只看主链路就能理解”的结构。
|
|
8
8
|
*/
|
|
9
9
|
import type { SessionMessageV1 } from "../../../session/types/SessionMessages.js";
|
|
10
|
-
import type { JsonObject } from "../../../
|
|
10
|
+
import type { JsonObject } from "../../../types/common/Json.js";
|
|
11
11
|
/**
|
|
12
12
|
* 单次 tool-loop 允许的最大 step 数。
|
|
13
13
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionSignals.d.ts","sourceRoot":"","sources":["../../../../src/session/executors/local/SessionSignals.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"SessionSignals.d.ts","sourceRoot":"","sources":["../../../../src/session/executors/local/SessionSignals.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;GAEG;AACH,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAE7C;;;;;;GAMG;AACH,eAAO,MAAM,kCAAkC,IAAI,CAAC;AAqDpD;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAMtD;AAsDD;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,OAAO,GAAG,UAAU,CA+BrE;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,gBAAgB,GAAG,IAAI,GAAG,SAAS,GAC3C,UAAU,CA4BZ;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,gBAAgB,GAAG,IAAI,EAC7B,QAAQ,EAAE,gBAAgB,GACzB,gBAAgB,CAmBlB;AAiCD;;GAEG;AACH,wBAAgB,oCAAoC,CAClD,aAAa,EAAE,MAAM,GACpB,MAAM,CAQR;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE;IAC/C,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,EAAE,gBAAgB,GAAG,IAAI,GAAG,SAAS,CAAC;CACvD,GAAG;IACF,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,UAAU,CAAC;CACrB,GAAG,IAAI,CAmEP;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAC9C,UAAU,EAAE,OAAO,GAClB,MAAM,GAAG,IAAI,CAgBf;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAC5C,iBAAiB,EAAE,MAAM,GACxB,MAAM,CAQR"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session tool-loop runner。
|
|
3
|
+
*
|
|
4
|
+
* 关键点(中文)
|
|
5
|
+
* - 这里只负责已准备好的 `SessionExecuteInput` 如何进入 `streamText` 循环。
|
|
6
|
+
* - LocalSessionCore 保留入口、重试与输入准备职责,本模块负责 step 循环、续写、恢复和最终日志。
|
|
7
|
+
* - 运行过程中同时维护 UI assistant 消息、模型消息基线和 step 统计。
|
|
8
|
+
*/
|
|
9
|
+
import { type LanguageModel } from "ai";
|
|
10
|
+
import type { Logger } from "../../../utils/logger/Logger.js";
|
|
11
|
+
import type { SessionExecuteInput, SessionRunResult } from "../../../session/types/SessionRun.js";
|
|
12
|
+
import { SessionHistoryComposer } from "../../composer/history/SessionHistoryComposer.js";
|
|
13
|
+
import { SessionExecutionComposer } from "../../composer/execution/SessionExecutionComposer.js";
|
|
14
|
+
/**
|
|
15
|
+
* SessionToolLoopRunner 构造参数。
|
|
16
|
+
*/
|
|
17
|
+
export type SessionToolLoopRunnerOptions = {
|
|
18
|
+
/** 当前模型实例。 */
|
|
19
|
+
model: LanguageModel;
|
|
20
|
+
/** 统一日志器。 */
|
|
21
|
+
logger: Logger;
|
|
22
|
+
/** 当前会话历史存储。 */
|
|
23
|
+
historyComposer: SessionHistoryComposer;
|
|
24
|
+
/** 当前轮运行编排 Composer。 */
|
|
25
|
+
executionComposer: SessionExecutionComposer;
|
|
26
|
+
/** 判断错误是否应交给上层 compaction retry。 */
|
|
27
|
+
shouldCompactOnError: (error: unknown) => boolean;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* 已准备输入的模型/tool-loop 执行器。
|
|
31
|
+
*/
|
|
32
|
+
export declare class SessionToolLoopRunner {
|
|
33
|
+
private readonly model;
|
|
34
|
+
private readonly logger;
|
|
35
|
+
private readonly historyComposer;
|
|
36
|
+
private readonly executionComposer;
|
|
37
|
+
private readonly shouldCompactOnError;
|
|
38
|
+
constructor(options: SessionToolLoopRunnerOptions);
|
|
39
|
+
/**
|
|
40
|
+
* 执行一次已装配完成的运行材料。
|
|
41
|
+
*/
|
|
42
|
+
execute(input: SessionExecuteInput): Promise<SessionRunResult>;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=SessionToolLoopRunner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SessionToolLoopRunner.d.ts","sourceRoot":"","sources":["../../../../src/session/executors/local/SessionToolLoopRunner.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,IAAI,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,sBAAsB,EAAE,MAAM,qDAAqD,CAAC;AAC7F,OAAO,EAAE,wBAAwB,EAAE,MAAM,yDAAyD,CAAC;AA6BnG;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACzC,cAAc;IACd,KAAK,EAAE,aAAa,CAAC;IACrB,aAAa;IACb,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB;IAChB,eAAe,EAAE,sBAAsB,CAAC;IACxC,wBAAwB;IACxB,iBAAiB,EAAE,wBAAwB,CAAC;IAC5C,oCAAoC;IACpC,oBAAoB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;CACnD,CAAC;AAEF;;GAEG;AACH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;IACtC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAyB;IACzD,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAA2B;IAC7D,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAA8B;gBAEvD,OAAO,EAAE,4BAA4B;IAQjD;;OAEG;IACG,OAAO,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,gBAAgB,CAAC;CA0QrE"}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session tool-loop runner。
|
|
3
|
+
*
|
|
4
|
+
* 关键点(中文)
|
|
5
|
+
* - 这里只负责已准备好的 `SessionExecuteInput` 如何进入 `streamText` 循环。
|
|
6
|
+
* - LocalSessionCore 保留入口、重试与输入准备职责,本模块负责 step 循环、续写、恢复和最终日志。
|
|
7
|
+
* - 运行过程中同时维护 UI assistant 消息、模型消息基线和 step 统计。
|
|
8
|
+
*/
|
|
9
|
+
import { streamText } from "ai";
|
|
10
|
+
import { buildOpenAIResponsesProviderOptions, } from "../../messages/SessionMessageCodec.js";
|
|
11
|
+
import { logAssistantMessageNow } from "../../messages/SessionMessageLog.js";
|
|
12
|
+
import { MAX_INCOMPLETE_RESPONSE_RECOVERIES, MAX_TEXT_ONLY_CONTINUATIONS, MAX_TOOL_LOOP_STEPS, buildIncompleteResponseRecoveryNudge, buildTextOnlyContinuationNudge, detectIncompleteResponse, detectTextOnlyContinuationReason, mergeAssistantUiMessages, summarizeStepForDebug, summarizeUiMessageForDebug, toInlinePreview, } from "../../executors/local/SessionSignals.js";
|
|
13
|
+
import { evaluateSessionLoopDecision, shouldContinueForTailMergedUserMessages, } from "../../executors/local/SessionLoopDecision.js";
|
|
14
|
+
import { resolveEffectiveExecutionError, summarizeStreamError, } from "../../executors/local/SessionExecutionError.js";
|
|
15
|
+
import { collectFinalAssistantMessageFromUiStream } from "../../executors/local/SessionUiStreamCollector.js";
|
|
16
|
+
import { SessionModelMessageState } from "../../executors/local/SessionModelMessageState.js";
|
|
17
|
+
/**
|
|
18
|
+
* 已准备输入的模型/tool-loop 执行器。
|
|
19
|
+
*/
|
|
20
|
+
export class SessionToolLoopRunner {
|
|
21
|
+
model;
|
|
22
|
+
logger;
|
|
23
|
+
historyComposer;
|
|
24
|
+
executionComposer;
|
|
25
|
+
shouldCompactOnError;
|
|
26
|
+
constructor(options) {
|
|
27
|
+
this.model = options.model;
|
|
28
|
+
this.logger = options.logger;
|
|
29
|
+
this.historyComposer = options.historyComposer;
|
|
30
|
+
this.executionComposer = options.executionComposer;
|
|
31
|
+
this.shouldCompactOnError = options.shouldCompactOnError;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* 执行一次已装配完成的运行材料。
|
|
35
|
+
*/
|
|
36
|
+
async execute(input) {
|
|
37
|
+
const startTime = Date.now();
|
|
38
|
+
const sessionId = String(this.historyComposer.sessionId || "").trim();
|
|
39
|
+
const system = Array.isArray(input.system) ? input.system : [];
|
|
40
|
+
const tools = input.tools;
|
|
41
|
+
let lastObservedStreamError = undefined;
|
|
42
|
+
try {
|
|
43
|
+
const messageState = await SessionModelMessageState.create({
|
|
44
|
+
messages: input.messages,
|
|
45
|
+
tools,
|
|
46
|
+
});
|
|
47
|
+
const appendMergedUserMessages = (messages) => messageState.appendMergedUserMessages(messages);
|
|
48
|
+
const executionComposerOnStepFinish = this.executionComposer.createOnStepFinishHandler();
|
|
49
|
+
let stepCount = 0;
|
|
50
|
+
let totalToolCallCount = 0;
|
|
51
|
+
let totalToolResultCount = 0;
|
|
52
|
+
const onStepFinish = async (stepResult) => {
|
|
53
|
+
stepCount += 1;
|
|
54
|
+
const summary = summarizeStepForDebug(stepResult);
|
|
55
|
+
totalToolCallCount +=
|
|
56
|
+
typeof summary.toolCallCount === "number" ? summary.toolCallCount : 0;
|
|
57
|
+
totalToolResultCount +=
|
|
58
|
+
typeof summary.toolResultCount === "number"
|
|
59
|
+
? summary.toolResultCount
|
|
60
|
+
: 0;
|
|
61
|
+
await this.logger.log("info", "[agent] step.finish", {
|
|
62
|
+
sessionId,
|
|
63
|
+
stepIndex: stepCount,
|
|
64
|
+
...summary,
|
|
65
|
+
});
|
|
66
|
+
await executionComposerOnStepFinish(stepResult);
|
|
67
|
+
};
|
|
68
|
+
const prepareStep = this.executionComposer.createPrepareStepHandler({
|
|
69
|
+
system,
|
|
70
|
+
appendMergedUserMessages,
|
|
71
|
+
});
|
|
72
|
+
let finalAssistantUiMessage = null;
|
|
73
|
+
let textOnlyContinuationCount = 0;
|
|
74
|
+
let incompleteResponseRecoveryCount = 0;
|
|
75
|
+
while (stepCount < MAX_TOOL_LOOP_STEPS) {
|
|
76
|
+
const result = streamText({
|
|
77
|
+
model: this.model,
|
|
78
|
+
system,
|
|
79
|
+
onStepFinish,
|
|
80
|
+
prepareStep,
|
|
81
|
+
messages: messageState.modelMessages,
|
|
82
|
+
tools,
|
|
83
|
+
providerOptions: buildOpenAIResponsesProviderOptions(),
|
|
84
|
+
onError: async ({ error }) => {
|
|
85
|
+
lastObservedStreamError = error;
|
|
86
|
+
await this.logger.log("error", "[agent] stream.error", {
|
|
87
|
+
sessionId,
|
|
88
|
+
...summarizeStreamError(error),
|
|
89
|
+
});
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
const stepAssistantUiMessage = await collectFinalAssistantMessageFromUiStream({
|
|
93
|
+
result,
|
|
94
|
+
sessionId,
|
|
95
|
+
logger: this.logger,
|
|
96
|
+
buildFallbackAssistantMessage: (text) => this.executionComposer.buildFallbackAssistantMessage(text),
|
|
97
|
+
});
|
|
98
|
+
const executedSteps = await result.steps;
|
|
99
|
+
const lastStep = executedSteps[executedSteps.length - 1];
|
|
100
|
+
if (!lastStep)
|
|
101
|
+
break;
|
|
102
|
+
const incompleteResponse = detectIncompleteResponse({
|
|
103
|
+
stepResult: lastStep,
|
|
104
|
+
assistantMessage: stepAssistantUiMessage,
|
|
105
|
+
});
|
|
106
|
+
const textOnlyContinuationReason = detectTextOnlyContinuationReason(lastStep);
|
|
107
|
+
const loopDecision = evaluateSessionLoopDecision({
|
|
108
|
+
hasIncompleteResponse: incompleteResponse !== null,
|
|
109
|
+
incompleteRecoveryCount: incompleteResponseRecoveryCount,
|
|
110
|
+
maxIncompleteRecoveries: MAX_INCOMPLETE_RESPONSE_RECOVERIES,
|
|
111
|
+
textOnlyContinuationReason,
|
|
112
|
+
textOnlyContinuationCount,
|
|
113
|
+
maxTextOnlyContinuations: MAX_TEXT_ONLY_CONTINUATIONS,
|
|
114
|
+
hasTools: Object.keys(tools).length > 0,
|
|
115
|
+
toolCallCount: lastStep.toolCalls.length,
|
|
116
|
+
});
|
|
117
|
+
await this.logger.log("info", "[agent] loop.decision", {
|
|
118
|
+
sessionId,
|
|
119
|
+
stepIndex: stepCount,
|
|
120
|
+
continueForToolCalls: loopDecision.continueForToolCalls,
|
|
121
|
+
continueForTextOnly: loopDecision.continueForTextOnly,
|
|
122
|
+
continueForIncompleteRecovery: loopDecision.continueForIncompleteRecovery,
|
|
123
|
+
decisionKind: loopDecision.kind,
|
|
124
|
+
textOnlyContinuationReason,
|
|
125
|
+
textOnlyContinuationCount,
|
|
126
|
+
incompleteResponseReason: incompleteResponse?.reason ?? null,
|
|
127
|
+
incompleteResponseRecoveryCount,
|
|
128
|
+
toolCallCount: lastStep.toolCalls.length,
|
|
129
|
+
toolResultCount: lastStep.toolResults.length,
|
|
130
|
+
finishReason: lastStep.finishReason,
|
|
131
|
+
textPreview: toInlinePreview(lastStep.text),
|
|
132
|
+
});
|
|
133
|
+
if (loopDecision.continueForIncompleteRecovery && incompleteResponse) {
|
|
134
|
+
incompleteResponseRecoveryCount += 1;
|
|
135
|
+
await this.logger.log("warn", "[agent] incomplete_response.recover", {
|
|
136
|
+
sessionId,
|
|
137
|
+
stepIndex: stepCount,
|
|
138
|
+
recoveryCount: incompleteResponseRecoveryCount,
|
|
139
|
+
reason: incompleteResponse.reason,
|
|
140
|
+
...incompleteResponse.details,
|
|
141
|
+
});
|
|
142
|
+
const recoveryMessage = this.historyComposer.userText({
|
|
143
|
+
text: buildIncompleteResponseRecoveryNudge(incompleteResponseRecoveryCount),
|
|
144
|
+
metadata: {
|
|
145
|
+
sessionId,
|
|
146
|
+
extra: {
|
|
147
|
+
internal: "agent_incomplete_response_recover",
|
|
148
|
+
reason: incompleteResponse.reason,
|
|
149
|
+
stepIndex: stepCount,
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
});
|
|
153
|
+
await messageState.appendUserTextMessage(recoveryMessage);
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
if (incompleteResponse) {
|
|
157
|
+
await this.logger.log("error", "[agent] incomplete_response", {
|
|
158
|
+
sessionId,
|
|
159
|
+
stepIndex: stepCount,
|
|
160
|
+
reason: incompleteResponse.reason,
|
|
161
|
+
recoveryCount: incompleteResponseRecoveryCount,
|
|
162
|
+
...incompleteResponse.details,
|
|
163
|
+
});
|
|
164
|
+
throw new Error(`Agent received incomplete response (${incompleteResponse.reason})`);
|
|
165
|
+
}
|
|
166
|
+
const responseMessages = Array.isArray(lastStep.response?.messages)
|
|
167
|
+
? lastStep.response.messages
|
|
168
|
+
: [];
|
|
169
|
+
messageState.appendModelMessages(responseMessages);
|
|
170
|
+
finalAssistantUiMessage = mergeAssistantUiMessages(finalAssistantUiMessage, stepAssistantUiMessage);
|
|
171
|
+
// 关键点(中文):把本 step 的 assistant UI 消息并入运行时上下文,保证后续全量重算不丢历史。
|
|
172
|
+
messageState.appendRuntimeSessionMessage(stepAssistantUiMessage);
|
|
173
|
+
if (loopDecision.continueForToolCalls) {
|
|
174
|
+
textOnlyContinuationCount = 0;
|
|
175
|
+
incompleteResponseRecoveryCount = 0;
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
if (loopDecision.continueForTextOnly) {
|
|
179
|
+
textOnlyContinuationCount += 1;
|
|
180
|
+
incompleteResponseRecoveryCount = 0;
|
|
181
|
+
const continuationMessage = this.historyComposer.userText({
|
|
182
|
+
text: buildTextOnlyContinuationNudge(textOnlyContinuationCount),
|
|
183
|
+
metadata: {
|
|
184
|
+
sessionId,
|
|
185
|
+
extra: {
|
|
186
|
+
internal: "agent_loop_auto_continue",
|
|
187
|
+
reason: textOnlyContinuationReason,
|
|
188
|
+
stepIndex: stepCount,
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
});
|
|
192
|
+
await messageState.appendUserTextMessage(continuationMessage);
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
// 关键点(中文):stop 前做 tail merge,覆盖最后一个 step 后才入队的新 user 消息。
|
|
196
|
+
const tailPrepared = await prepareStep({ messages: [] });
|
|
197
|
+
const tailMergedMessageCount = Array.isArray(tailPrepared.messages)
|
|
198
|
+
? tailPrepared.messages.length
|
|
199
|
+
: 0;
|
|
200
|
+
if (shouldContinueForTailMergedUserMessages({
|
|
201
|
+
mergedUserMessageCount: tailMergedMessageCount,
|
|
202
|
+
})) {
|
|
203
|
+
textOnlyContinuationCount = 0;
|
|
204
|
+
incompleteResponseRecoveryCount = 0;
|
|
205
|
+
await this.logger.log("info", "[agent] loop.tail_merge_continue", {
|
|
206
|
+
sessionId,
|
|
207
|
+
stepIndex: stepCount,
|
|
208
|
+
mergedUserMessageCount: tailMergedMessageCount,
|
|
209
|
+
});
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
break;
|
|
213
|
+
}
|
|
214
|
+
if (stepCount >= MAX_TOOL_LOOP_STEPS) {
|
|
215
|
+
await this.logger.log("warn", "[agent] loop.max_steps_reached", {
|
|
216
|
+
sessionId,
|
|
217
|
+
stepCount,
|
|
218
|
+
totalToolCallCount,
|
|
219
|
+
totalToolResultCount,
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
const finalMessage = finalAssistantUiMessage ||
|
|
223
|
+
this.executionComposer.buildFallbackAssistantMessage("Execution completed");
|
|
224
|
+
await this.logger.log("info", "[agent] final.message", {
|
|
225
|
+
sessionId,
|
|
226
|
+
...summarizeUiMessageForDebug(finalMessage),
|
|
227
|
+
});
|
|
228
|
+
await logAssistantMessageNow(this.logger, finalMessage);
|
|
229
|
+
const duration = Date.now() - startTime;
|
|
230
|
+
await this.logger.log("info", "[agent] finish", {
|
|
231
|
+
sessionId,
|
|
232
|
+
duration,
|
|
233
|
+
stepCount,
|
|
234
|
+
totalToolCallCount,
|
|
235
|
+
totalToolResultCount,
|
|
236
|
+
});
|
|
237
|
+
return {
|
|
238
|
+
success: true,
|
|
239
|
+
assistantMessage: finalMessage,
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
catch (error) {
|
|
243
|
+
if (this.shouldCompactOnError(error)) {
|
|
244
|
+
throw error;
|
|
245
|
+
}
|
|
246
|
+
const errorMsg = resolveEffectiveExecutionError({
|
|
247
|
+
error,
|
|
248
|
+
streamError: lastObservedStreamError,
|
|
249
|
+
});
|
|
250
|
+
await this.logger.log("error", "LocalSessionCore execution failed", {
|
|
251
|
+
error: errorMsg,
|
|
252
|
+
});
|
|
253
|
+
return {
|
|
254
|
+
success: false,
|
|
255
|
+
error: errorMsg,
|
|
256
|
+
assistantMessage: this.executionComposer.buildFallbackAssistantMessage(`Execution failed: ${errorMsg}`),
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
//# sourceMappingURL=SessionToolLoopRunner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SessionToolLoopRunner.js","sourceRoot":"","sources":["../../../../src/session/executors/local/SessionToolLoopRunner.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAsB,MAAM,IAAI,CAAC;AASpD,OAAO,EACL,mCAAmC,GACpC,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,EACL,kCAAkC,EAClC,2BAA2B,EAC3B,mBAAmB,EACnB,oCAAoC,EACpC,8BAA8B,EAC9B,w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
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session UI stream 最终消息收敛器。
|
|
3
|
+
*
|
|
4
|
+
* 关键点(中文)
|
|
5
|
+
* - 必须完整消费 AI SDK UI stream,才能稳定触发 `onFinish`。
|
|
6
|
+
* - 优先使用结构化 `responseMessage`;缺失时才回退到纯文本。
|
|
7
|
+
* - UI chunk 回调是展示层副作用,失败不应阻断 session 执行。
|
|
8
|
+
*/
|
|
9
|
+
import type { streamText } from "ai";
|
|
10
|
+
import type { Logger } from "../../../utils/logger/Logger.js";
|
|
11
|
+
import type { SessionMessageV1 } from "../../../session/types/SessionMessages.js";
|
|
12
|
+
/**
|
|
13
|
+
* 收敛 UI stream 中的最终 assistant 消息。
|
|
14
|
+
*/
|
|
15
|
+
export declare function collectFinalAssistantMessageFromUiStream(params: {
|
|
16
|
+
/**
|
|
17
|
+
* 当前 `streamText` 执行结果。
|
|
18
|
+
*/
|
|
19
|
+
result: ReturnType<typeof streamText>;
|
|
20
|
+
/**
|
|
21
|
+
* 当前 sessionId,用于日志关联。
|
|
22
|
+
*/
|
|
23
|
+
sessionId: string;
|
|
24
|
+
/**
|
|
25
|
+
* 当前日志器。
|
|
26
|
+
*/
|
|
27
|
+
logger: Logger;
|
|
28
|
+
/**
|
|
29
|
+
* 构造 fallback assistant 消息的工厂函数。
|
|
30
|
+
*/
|
|
31
|
+
buildFallbackAssistantMessage: (text: string) => SessionMessageV1;
|
|
32
|
+
}): Promise<SessionMessageV1>;
|
|
33
|
+
//# sourceMappingURL=SessionUiStreamCollector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SessionUiStreamCollector.d.ts","sourceRoot":"","sources":["../../../../src/session/executors/local/SessionUiStreamCollector.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AACrC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAO3E;;GAEG;AACH,wBAAsB,wCAAwC,CAAC,MAAM,EAAE;IACrE;;OAEG;IACH,MAAM,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;IACtC;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,6BAA6B,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,gBAAgB,CAAC;CACnE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAwD5B"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session UI stream 最终消息收敛器。
|
|
3
|
+
*
|
|
4
|
+
* 关键点(中文)
|
|
5
|
+
* - 必须完整消费 AI SDK UI stream,才能稳定触发 `onFinish`。
|
|
6
|
+
* - 优先使用结构化 `responseMessage`;缺失时才回退到纯文本。
|
|
7
|
+
* - UI chunk 回调是展示层副作用,失败不应阻断 session 执行。
|
|
8
|
+
*/
|
|
9
|
+
import { getSessionRunScope } from "../../SessionRunScope.js";
|
|
10
|
+
import { summarizeUiMessageForDebug, toInlinePreview, } from "../../executors/local/SessionSignals.js";
|
|
11
|
+
/**
|
|
12
|
+
* 收敛 UI stream 中的最终 assistant 消息。
|
|
13
|
+
*/
|
|
14
|
+
export async function collectFinalAssistantMessageFromUiStream(params) {
|
|
15
|
+
let streamedAssistantMessage = null;
|
|
16
|
+
let uiFinishSummary = null;
|
|
17
|
+
const uiStream = params.result.toUIMessageStream({
|
|
18
|
+
// 关键点(中文):SDK stream 需要 reasoning 旁路事件时可直接消费;最终落盘仍由 responseMessage 收敛。
|
|
19
|
+
sendReasoning: true,
|
|
20
|
+
sendSources: false,
|
|
21
|
+
onFinish: (event) => {
|
|
22
|
+
streamedAssistantMessage = event.responseMessage ?? null;
|
|
23
|
+
uiFinishSummary = {
|
|
24
|
+
isContinuation: event.isContinuation,
|
|
25
|
+
isAborted: event.isAborted,
|
|
26
|
+
finishReason: typeof event.finishReason === "string" ? event.finishReason : null,
|
|
27
|
+
...summarizeUiMessageForDebug(event.responseMessage),
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
const onUiMessageChunkCallback = getSessionRunScope()?.onUiMessageChunkCallback;
|
|
32
|
+
for await (const chunk of uiStream) {
|
|
33
|
+
if (typeof onUiMessageChunkCallback !== "function")
|
|
34
|
+
continue;
|
|
35
|
+
try {
|
|
36
|
+
await onUiMessageChunkCallback(chunk);
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
// ignore UI stream callback failures
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
await params.logger.log("info", "[agent] ui.finish", {
|
|
43
|
+
sessionId: params.sessionId,
|
|
44
|
+
...(uiFinishSummary || {
|
|
45
|
+
responseMessageMissing: true,
|
|
46
|
+
}),
|
|
47
|
+
});
|
|
48
|
+
if (streamedAssistantMessage)
|
|
49
|
+
return streamedAssistantMessage;
|
|
50
|
+
let assistantText = "";
|
|
51
|
+
try {
|
|
52
|
+
assistantText = String((await params.result.text) ?? "").trim();
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
assistantText = "";
|
|
56
|
+
}
|
|
57
|
+
await params.logger.log("warn", "[agent] final.message.fallback", {
|
|
58
|
+
sessionId: params.sessionId,
|
|
59
|
+
assistantTextLength: assistantText.length,
|
|
60
|
+
assistantTextPreview: toInlinePreview(assistantText),
|
|
61
|
+
});
|
|
62
|
+
return params.buildFallbackAssistantMessage(assistantText || "Execution completed");
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=SessionUiStreamCollector.js.map
|