@downcity/agent 1.1.12 → 1.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (548) hide show
  1. package/bin/{runtime → core}/AgentContextTypes.d.ts +6 -6
  2. package/bin/core/AgentContextTypes.d.ts.map +1 -0
  3. package/bin/{runtime → core}/AgentContextTypes.js +2 -2
  4. package/bin/core/AgentContextTypes.js.map +1 -0
  5. package/bin/core/AgentCore.d.ts +87 -0
  6. package/bin/core/AgentCore.d.ts.map +1 -0
  7. package/bin/core/AgentCore.js +467 -0
  8. package/bin/core/AgentCore.js.map +1 -0
  9. package/bin/{runtime/AgentRuntimeTypes.d.ts → core/AgentCoreTypes.d.ts} +10 -10
  10. package/bin/core/AgentCoreTypes.d.ts.map +1 -0
  11. package/bin/core/AgentCoreTypes.js +10 -0
  12. package/bin/core/AgentCoreTypes.js.map +1 -0
  13. package/bin/host/runtime/PluginRuntime.d.ts +1 -1
  14. package/bin/host/runtime/PluginRuntime.d.ts.map +1 -1
  15. package/bin/index.d.ts +8 -10
  16. package/bin/index.d.ts.map +1 -1
  17. package/bin/index.js +4 -7
  18. package/bin/index.js.map +1 -1
  19. package/bin/plugin/builtins/asr/InboundAugment.d.ts +1 -1
  20. package/bin/plugin/builtins/asr/InboundAugment.d.ts.map +1 -1
  21. package/bin/plugin/builtins/auth/runtime/AuthorizationConfig.d.ts +1 -1
  22. package/bin/plugin/builtins/auth/runtime/AuthorizationConfig.d.ts.map +1 -1
  23. package/bin/plugin/builtins/auth/runtime/AuthorizationStore.d.ts +1 -1
  24. package/bin/plugin/builtins/auth/runtime/AuthorizationStore.d.ts.map +1 -1
  25. package/bin/plugin/builtins/voice/InboundAugment.d.ts +1 -1
  26. package/bin/plugin/builtins/voice/InboundAugment.d.ts.map +1 -1
  27. package/bin/plugin/builtins/workboard/runtime/Collector.d.ts +1 -1
  28. package/bin/plugin/builtins/workboard/runtime/Collector.d.ts.map +1 -1
  29. package/bin/plugin/builtins/workboard/runtime/Collector.js +1 -1
  30. package/bin/plugin/builtins/workboard/runtime/Collector.js.map +1 -1
  31. package/bin/plugin/builtins/workboard/runtime/Normalizer.d.ts +1 -1
  32. package/bin/plugin/builtins/workboard/runtime/Normalizer.d.ts.map +1 -1
  33. package/bin/plugin/builtins/workboard/runtime/Store.d.ts +1 -1
  34. package/bin/plugin/builtins/workboard/runtime/Store.d.ts.map +1 -1
  35. package/bin/plugin/core/Activation.d.ts +2 -2
  36. package/bin/plugin/core/Activation.d.ts.map +1 -1
  37. package/bin/plugin/core/HookRegistry.d.ts +1 -1
  38. package/bin/plugin/core/HookRegistry.d.ts.map +1 -1
  39. package/bin/plugin/core/HttpRoutes.d.ts +1 -1
  40. package/bin/plugin/core/HttpRoutes.d.ts.map +1 -1
  41. package/bin/plugin/core/LocalExecution.d.ts.map +1 -1
  42. package/bin/plugin/core/LocalExecution.js +18 -20
  43. package/bin/plugin/core/LocalExecution.js.map +1 -1
  44. package/bin/plugin/core/PluginRegistry.d.ts +1 -1
  45. package/bin/plugin/core/PluginRegistry.d.ts.map +1 -1
  46. package/bin/plugin/types/Plugin.d.ts +1 -1
  47. package/bin/plugin/types/Plugin.d.ts.map +1 -1
  48. package/bin/sandbox/SandboxConfigResolver.d.ts +1 -1
  49. package/bin/sandbox/SandboxConfigResolver.d.ts.map +1 -1
  50. package/bin/sandbox/SandboxRunner.d.ts +1 -1
  51. package/bin/sandbox/SandboxRunner.d.ts.map +1 -1
  52. package/bin/sdk/Agent.d.ts +27 -25
  53. package/bin/sdk/Agent.d.ts.map +1 -1
  54. package/bin/sdk/Agent.js +86 -365
  55. package/bin/sdk/Agent.js.map +1 -1
  56. package/bin/sdk/AgentSdkTypes.d.ts +138 -0
  57. package/bin/sdk/AgentSdkTypes.d.ts.map +1 -1
  58. package/bin/sdk/HttpServer.d.ts +9 -19
  59. package/bin/sdk/HttpServer.d.ts.map +1 -1
  60. package/bin/sdk/HttpServer.js +26 -156
  61. package/bin/sdk/HttpServer.js.map +1 -1
  62. package/bin/sdk/RpcServer.d.ts +9 -10
  63. package/bin/sdk/RpcServer.d.ts.map +1 -1
  64. package/bin/sdk/RpcServer.js +22 -178
  65. package/bin/sdk/RpcServer.js.map +1 -1
  66. package/bin/sdk/Session.d.ts +8 -8
  67. package/bin/sdk/Session.d.ts.map +1 -1
  68. package/bin/sdk/Session.js +48 -54
  69. package/bin/sdk/Session.js.map +1 -1
  70. package/bin/sdk/SessionMetadata.d.ts +3 -3
  71. package/bin/sdk/SessionMetadata.d.ts.map +1 -1
  72. package/bin/sdk/SessionMetadata.js +5 -5
  73. package/bin/sdk/SessionMetadata.js.map +1 -1
  74. package/bin/sdk/SessionPersistence.d.ts +6 -6
  75. package/bin/sdk/SessionPersistence.d.ts.map +1 -1
  76. package/bin/sdk/SessionPersistence.js +7 -7
  77. package/bin/sdk/SessionPersistence.js.map +1 -1
  78. package/bin/sdk/SessionServicePort.d.ts +6 -6
  79. package/bin/sdk/SessionServicePort.d.ts.map +1 -1
  80. package/bin/sdk/SessionServicePort.js +9 -9
  81. package/bin/sdk/SessionServicePort.js.map +1 -1
  82. package/bin/sdk/{SdkSessionSystemComposer.d.ts → SessionSystemBuilder.d.ts} +7 -7
  83. package/bin/sdk/SessionSystemBuilder.d.ts.map +1 -0
  84. package/bin/sdk/{SdkSessionSystemComposer.js → SessionSystemBuilder.js} +14 -14
  85. package/bin/sdk/SessionSystemBuilder.js.map +1 -0
  86. package/bin/server/http/Server.d.ts +10 -1
  87. package/bin/server/http/Server.d.ts.map +1 -1
  88. package/bin/server/http/Server.js +41 -15
  89. package/bin/server/http/Server.js.map +1 -1
  90. package/bin/server/http/control/AuthControlService.d.ts +1 -1
  91. package/bin/server/http/control/AuthControlService.d.ts.map +1 -1
  92. package/bin/server/http/control/ControlAuthorizationRoutes.d.ts +1 -1
  93. package/bin/server/http/control/ControlAuthorizationRoutes.d.ts.map +1 -1
  94. package/bin/server/http/control/ControlRouter.d.ts +18 -2
  95. package/bin/server/http/control/ControlRouter.d.ts.map +1 -1
  96. package/bin/server/http/control/ControlRouter.js +10 -8
  97. package/bin/server/http/control/ControlRouter.js.map +1 -1
  98. package/bin/server/http/control/ExecuteBySession.d.ts +2 -2
  99. package/bin/server/http/control/ExecuteBySession.d.ts.map +1 -1
  100. package/bin/server/http/control/OverviewRoutes.d.ts.map +1 -1
  101. package/bin/server/http/control/OverviewRoutes.js +6 -2
  102. package/bin/server/http/control/OverviewRoutes.js.map +1 -1
  103. package/bin/server/http/control/SessionSummaryStore.d.ts +1 -1
  104. package/bin/server/http/control/SessionSummaryStore.d.ts.map +1 -1
  105. package/bin/server/http/control/types/ControlRoutes.d.ts +2 -2
  106. package/bin/server/http/control/types/ControlRoutes.d.ts.map +1 -1
  107. package/bin/server/http/execute/execute.d.ts +13 -2
  108. package/bin/server/http/execute/execute.d.ts.map +1 -1
  109. package/bin/server/http/execute/execute.js +73 -71
  110. package/bin/server/http/execute/execute.js.map +1 -1
  111. package/bin/server/http/plugins/plugins.d.ts +13 -2
  112. package/bin/server/http/plugins/plugins.d.ts.map +1 -1
  113. package/bin/server/http/plugins/plugins.js +42 -40
  114. package/bin/server/http/plugins/plugins.js.map +1 -1
  115. package/bin/server/http/services/services.d.ts +12 -8
  116. package/bin/server/http/services/services.d.ts.map +1 -1
  117. package/bin/server/http/services/services.js +57 -64
  118. package/bin/server/http/services/services.js.map +1 -1
  119. package/bin/server/http/static/static.d.ts +13 -2
  120. package/bin/server/http/static/static.d.ts.map +1 -1
  121. package/bin/server/http/static/static.js +81 -79
  122. package/bin/server/http/static/static.js.map +1 -1
  123. package/bin/server/rpc/Server.d.ts +5 -3
  124. package/bin/server/rpc/Server.d.ts.map +1 -1
  125. package/bin/server/rpc/Server.js +22 -12
  126. package/bin/server/rpc/Server.js.map +1 -1
  127. package/bin/service/builtins/BaseService.d.ts +2 -2
  128. package/bin/service/builtins/BaseService.d.ts.map +1 -1
  129. package/bin/service/builtins/chat/Action.d.ts +1 -1
  130. package/bin/service/builtins/chat/Action.d.ts.map +1 -1
  131. package/bin/service/builtins/chat/ChatService.d.ts +2 -2
  132. package/bin/service/builtins/chat/ChatService.d.ts.map +1 -1
  133. package/bin/service/builtins/chat/ChatServiceTypes.d.ts +1 -1
  134. package/bin/service/builtins/chat/ChatServiceTypes.d.ts.map +1 -1
  135. package/bin/service/builtins/chat/channels/BaseChatChannel.d.ts +1 -1
  136. package/bin/service/builtins/chat/channels/BaseChatChannel.d.ts.map +1 -1
  137. package/bin/service/builtins/chat/channels/BaseChatChannelQueue.d.ts +1 -1
  138. package/bin/service/builtins/chat/channels/BaseChatChannelQueue.d.ts.map +1 -1
  139. package/bin/service/builtins/chat/channels/BaseChatChannelSupport.d.ts +1 -1
  140. package/bin/service/builtins/chat/channels/BaseChatChannelSupport.d.ts.map +1 -1
  141. package/bin/service/builtins/chat/channels/feishu/Feishu.d.ts +1 -1
  142. package/bin/service/builtins/chat/channels/feishu/Feishu.d.ts.map +1 -1
  143. package/bin/service/builtins/chat/channels/feishu/FeishuMessageHandler.d.ts +1 -1
  144. package/bin/service/builtins/chat/channels/feishu/FeishuMessageHandler.d.ts.map +1 -1
  145. package/bin/service/builtins/chat/channels/feishu/FeishuPlatformClient.d.ts +1 -1
  146. package/bin/service/builtins/chat/channels/feishu/FeishuPlatformClient.d.ts.map +1 -1
  147. package/bin/service/builtins/chat/channels/qq/QQ.d.ts +1 -1
  148. package/bin/service/builtins/chat/channels/qq/QQ.d.ts.map +1 -1
  149. package/bin/service/builtins/chat/channels/qq/QQMessageHandler.d.ts +1 -1
  150. package/bin/service/builtins/chat/channels/qq/QQMessageHandler.d.ts.map +1 -1
  151. package/bin/service/builtins/chat/channels/qq/QQSupport.d.ts +1 -1
  152. package/bin/service/builtins/chat/channels/qq/QQSupport.d.ts.map +1 -1
  153. package/bin/service/builtins/chat/channels/telegram/Bot.d.ts +1 -1
  154. package/bin/service/builtins/chat/channels/telegram/Bot.d.ts.map +1 -1
  155. package/bin/service/builtins/chat/channels/telegram/TelegramMessageHandler.d.ts +1 -1
  156. package/bin/service/builtins/chat/channels/telegram/TelegramMessageHandler.d.ts.map +1 -1
  157. package/bin/service/builtins/chat/channels/telegram/TelegramPlatformClient.d.ts +1 -1
  158. package/bin/service/builtins/chat/channels/telegram/TelegramPlatformClient.d.ts.map +1 -1
  159. package/bin/service/builtins/chat/runtime/ChannelContextStore.d.ts +1 -1
  160. package/bin/service/builtins/chat/runtime/ChannelContextStore.d.ts.map +1 -1
  161. package/bin/service/builtins/chat/runtime/ChatActionExecution.d.ts +1 -1
  162. package/bin/service/builtins/chat/runtime/ChatActionExecution.d.ts.map +1 -1
  163. package/bin/service/builtins/chat/runtime/ChatActionInput.d.ts +3 -36
  164. package/bin/service/builtins/chat/runtime/ChatActionInput.d.ts.map +1 -1
  165. package/bin/service/builtins/chat/runtime/ChatActionInput.js +3 -118
  166. package/bin/service/builtins/chat/runtime/ChatActionInput.js.map +1 -1
  167. package/bin/service/builtins/chat/runtime/ChatChannelActions.d.ts +1 -1
  168. package/bin/service/builtins/chat/runtime/ChatChannelActions.d.ts.map +1 -1
  169. package/bin/service/builtins/chat/runtime/ChatChannelConfig.d.ts +1 -1
  170. package/bin/service/builtins/chat/runtime/ChatChannelConfig.d.ts.map +1 -1
  171. package/bin/service/builtins/chat/runtime/ChatChannelCore.d.ts +1 -1
  172. package/bin/service/builtins/chat/runtime/ChatChannelCore.d.ts.map +1 -1
  173. package/bin/service/builtins/chat/runtime/ChatChannelLifecycle.d.ts +1 -1
  174. package/bin/service/builtins/chat/runtime/ChatChannelLifecycle.d.ts.map +1 -1
  175. package/bin/service/builtins/chat/runtime/ChatHistoryStore.d.ts +1 -1
  176. package/bin/service/builtins/chat/runtime/ChatHistoryStore.d.ts.map +1 -1
  177. package/bin/service/builtins/chat/runtime/ChatIngressStore.d.ts +1 -1
  178. package/bin/service/builtins/chat/runtime/ChatIngressStore.d.ts.map +1 -1
  179. package/bin/service/builtins/chat/runtime/ChatMetaStore.d.ts +1 -1
  180. package/bin/service/builtins/chat/runtime/ChatMetaStore.d.ts.map +1 -1
  181. package/bin/service/builtins/chat/runtime/ChatQueueReplyDispatch.d.ts +1 -1
  182. package/bin/service/builtins/chat/runtime/ChatQueueReplyDispatch.d.ts.map +1 -1
  183. package/bin/service/builtins/chat/runtime/ChatQueueSessionBridge.d.ts +1 -1
  184. package/bin/service/builtins/chat/runtime/ChatQueueSessionBridge.d.ts.map +1 -1
  185. package/bin/service/builtins/chat/runtime/ChatQueueStore.d.ts +1 -1
  186. package/bin/service/builtins/chat/runtime/ChatQueueStore.d.ts.map +1 -1
  187. package/bin/service/builtins/chat/runtime/ChatQueueWorker.d.ts +1 -1
  188. package/bin/service/builtins/chat/runtime/ChatQueueWorker.d.ts.map +1 -1
  189. package/bin/service/builtins/chat/runtime/ChatServiceActions.d.ts +1 -1
  190. package/bin/service/builtins/chat/runtime/ChatServiceActions.d.ts.map +1 -1
  191. package/bin/service/builtins/chat/runtime/ChatServiceActions.js +2 -109
  192. package/bin/service/builtins/chat/runtime/ChatServiceActions.js.map +1 -1
  193. package/bin/service/builtins/chat/runtime/ChatServiceSystem.d.ts +1 -1
  194. package/bin/service/builtins/chat/runtime/ChatServiceSystem.d.ts.map +1 -1
  195. package/bin/service/builtins/chat/runtime/ChatSession.d.ts +27 -8
  196. package/bin/service/builtins/chat/runtime/ChatSession.d.ts.map +1 -1
  197. package/bin/service/builtins/chat/runtime/ChatSession.js +9 -4
  198. package/bin/service/builtins/chat/runtime/ChatSession.js.map +1 -1
  199. package/bin/service/builtins/chat/runtime/ChatSessionDelete.d.ts +1 -1
  200. package/bin/service/builtins/chat/runtime/ChatSessionDelete.d.ts.map +1 -1
  201. package/bin/service/builtins/chat/runtime/ChatkeySend.d.ts +1 -1
  202. package/bin/service/builtins/chat/runtime/ChatkeySend.d.ts.map +1 -1
  203. package/bin/service/builtins/chat/runtime/EnqueueDispatch.d.ts +1 -1
  204. package/bin/service/builtins/chat/runtime/EnqueueDispatch.d.ts.map +1 -1
  205. package/bin/service/builtins/chat/runtime/InboundAugment.d.ts +1 -1
  206. package/bin/service/builtins/chat/runtime/InboundAugment.d.ts.map +1 -1
  207. package/bin/service/builtins/chat/runtime/PluginDispatch.d.ts +1 -1
  208. package/bin/service/builtins/chat/runtime/PluginDispatch.d.ts.map +1 -1
  209. package/bin/service/builtins/chat/runtime/ReplyDispatch.d.ts +1 -1
  210. package/bin/service/builtins/chat/runtime/ReplyDispatch.d.ts.map +1 -1
  211. package/bin/service/builtins/chat/runtime/SystemPrompt.d.ts +1 -1
  212. package/bin/service/builtins/chat/runtime/SystemPrompt.d.ts.map +1 -1
  213. package/bin/service/builtins/contact/Action.d.ts +2 -2
  214. package/bin/service/builtins/contact/Action.d.ts.map +1 -1
  215. package/bin/service/builtins/contact/Action.js +2 -58
  216. package/bin/service/builtins/contact/Action.js.map +1 -1
  217. package/bin/service/builtins/contact/ContactService.d.ts +1 -1
  218. package/bin/service/builtins/contact/ContactService.d.ts.map +1 -1
  219. package/bin/service/builtins/contact/runtime/ChatRuntime.d.ts +1 -1
  220. package/bin/service/builtins/contact/runtime/ChatRuntime.d.ts.map +1 -1
  221. package/bin/service/builtins/contact/runtime/ContactPayload.d.ts +0 -7
  222. package/bin/service/builtins/contact/runtime/ContactPayload.d.ts.map +1 -1
  223. package/bin/service/builtins/contact/runtime/ContactPayload.js +0 -9
  224. package/bin/service/builtins/contact/runtime/ContactPayload.js.map +1 -1
  225. package/bin/service/builtins/contact/runtime/RemoteClient.d.ts +1 -1
  226. package/bin/service/builtins/contact/runtime/RemoteClient.d.ts.map +1 -1
  227. package/bin/service/builtins/contact/runtime/RemoteClient.js +37 -19
  228. package/bin/service/builtins/contact/runtime/RemoteClient.js.map +1 -1
  229. package/bin/service/builtins/contact/runtime/ShareBundle.d.ts +1 -1
  230. package/bin/service/builtins/contact/runtime/ShareBundle.d.ts.map +1 -1
  231. package/bin/service/builtins/memory/Action.d.ts +1 -1
  232. package/bin/service/builtins/memory/Action.d.ts.map +1 -1
  233. package/bin/service/builtins/memory/MemoryService.d.ts +1 -1
  234. package/bin/service/builtins/memory/MemoryService.d.ts.map +1 -1
  235. package/bin/service/builtins/memory/MemoryService.js +0 -27
  236. package/bin/service/builtins/memory/MemoryService.js.map +1 -1
  237. package/bin/service/builtins/memory/runtime/Flush.d.ts +1 -1
  238. package/bin/service/builtins/memory/runtime/Flush.d.ts.map +1 -1
  239. package/bin/service/builtins/memory/runtime/Search.d.ts +1 -1
  240. package/bin/service/builtins/memory/runtime/Search.d.ts.map +1 -1
  241. package/bin/service/builtins/memory/runtime/Store.d.ts +1 -1
  242. package/bin/service/builtins/memory/runtime/Store.d.ts.map +1 -1
  243. package/bin/service/builtins/memory/runtime/SystemProvider.d.ts +1 -1
  244. package/bin/service/builtins/memory/runtime/SystemProvider.d.ts.map +1 -1
  245. package/bin/service/builtins/memory/runtime/Writer.d.ts +1 -1
  246. package/bin/service/builtins/memory/runtime/Writer.d.ts.map +1 -1
  247. package/bin/service/builtins/schedule/ScheduleService.d.ts +39 -0
  248. package/bin/service/builtins/schedule/ScheduleService.d.ts.map +1 -0
  249. package/bin/service/builtins/schedule/ScheduleService.js +106 -0
  250. package/bin/service/builtins/schedule/ScheduleService.js.map +1 -0
  251. package/bin/service/builtins/shell/ShellRuntimeTypes.d.ts +1 -1
  252. package/bin/service/builtins/shell/ShellRuntimeTypes.d.ts.map +1 -1
  253. package/bin/service/builtins/shell/ShellService.d.ts +2 -2
  254. package/bin/service/builtins/shell/ShellService.d.ts.map +1 -1
  255. package/bin/service/builtins/shell/runtime/ShellActionResponse.d.ts +1 -1
  256. package/bin/service/builtins/shell/runtime/ShellActionResponse.d.ts.map +1 -1
  257. package/bin/service/builtins/shell/runtime/ShellActionRuntime.d.ts +1 -1
  258. package/bin/service/builtins/shell/runtime/ShellActionRuntime.d.ts.map +1 -1
  259. package/bin/service/builtins/shell/runtime/ShellActionRuntimeSupport.d.ts +1 -1
  260. package/bin/service/builtins/shell/runtime/ShellActionRuntimeSupport.d.ts.map +1 -1
  261. package/bin/service/builtins/shell/runtime/ShellRuntimeEnvironment.d.ts +1 -1
  262. package/bin/service/builtins/shell/runtime/ShellRuntimeEnvironment.d.ts.map +1 -1
  263. package/bin/service/builtins/task/Action.d.ts +1 -1
  264. package/bin/service/builtins/task/Action.d.ts.map +1 -1
  265. package/bin/service/builtins/task/Scheduler.d.ts +1 -1
  266. package/bin/service/builtins/task/Scheduler.d.ts.map +1 -1
  267. package/bin/service/builtins/task/TaskService.d.ts +2 -2
  268. package/bin/service/builtins/task/TaskService.d.ts.map +1 -1
  269. package/bin/service/builtins/task/runtime/CronRuntime.d.ts +1 -1
  270. package/bin/service/builtins/task/runtime/CronRuntime.d.ts.map +1 -1
  271. package/bin/service/builtins/task/runtime/Runner.d.ts +2 -2
  272. package/bin/service/builtins/task/runtime/Runner.d.ts.map +1 -1
  273. package/bin/service/builtins/task/runtime/Runner.js +1 -1
  274. package/bin/service/builtins/task/runtime/TaskActionExecution.d.ts +1 -1
  275. package/bin/service/builtins/task/runtime/TaskActionExecution.d.ts.map +1 -1
  276. package/bin/service/builtins/task/runtime/TaskActionInput.d.ts +2 -31
  277. package/bin/service/builtins/task/runtime/TaskActionInput.d.ts.map +1 -1
  278. package/bin/service/builtins/task/runtime/TaskActionInput.js +2 -141
  279. package/bin/service/builtins/task/runtime/TaskActionInput.js.map +1 -1
  280. package/bin/service/builtins/task/runtime/TaskRunChatDispatch.d.ts +1 -1
  281. package/bin/service/builtins/task/runtime/TaskRunChatDispatch.d.ts.map +1 -1
  282. package/bin/service/builtins/task/runtime/TaskRunnerRound.d.ts +1 -1
  283. package/bin/service/builtins/task/runtime/TaskRunnerRound.d.ts.map +1 -1
  284. package/bin/service/builtins/task/runtime/TaskRunnerScript.d.ts +1 -1
  285. package/bin/service/builtins/task/runtime/TaskRunnerScript.d.ts.map +1 -1
  286. package/bin/service/builtins/task/runtime/TaskRunnerSession.d.ts +3 -3
  287. package/bin/service/builtins/task/runtime/TaskRunnerSession.d.ts.map +1 -1
  288. package/bin/service/builtins/task/runtime/TaskRunnerSession.js +4 -4
  289. package/bin/service/builtins/task/runtime/TaskRunnerSession.js.map +1 -1
  290. package/bin/service/builtins/task/runtime/TaskRunnerTypes.d.ts +1 -1
  291. package/bin/service/builtins/task/runtime/TaskServiceActions.d.ts +1 -1
  292. package/bin/service/builtins/task/runtime/TaskServiceActions.d.ts.map +1 -1
  293. package/bin/service/builtins/task/runtime/TaskServiceActions.js +2 -30
  294. package/bin/service/builtins/task/runtime/TaskServiceActions.js.map +1 -1
  295. package/bin/service/core/Manager.d.ts +0 -1
  296. package/bin/service/core/Manager.d.ts.map +1 -1
  297. package/bin/service/core/Manager.js +0 -1
  298. package/bin/service/core/Manager.js.map +1 -1
  299. package/bin/service/core/ServiceActionRunner.d.ts +1 -1
  300. package/bin/service/core/ServiceActionRunner.d.ts.map +1 -1
  301. package/bin/service/core/ServiceActionRunner.js +3 -1
  302. package/bin/service/core/ServiceActionRunner.js.map +1 -1
  303. package/bin/service/core/ServiceClassRegistry.d.ts +1 -1
  304. package/bin/service/core/ServiceClassRegistry.d.ts.map +1 -1
  305. package/bin/service/core/ServiceCommandRequest.d.ts +36 -0
  306. package/bin/service/core/ServiceCommandRequest.d.ts.map +1 -0
  307. package/bin/service/core/ServiceCommandRequest.js +53 -0
  308. package/bin/service/core/ServiceCommandRequest.js.map +1 -0
  309. package/bin/service/core/ServiceManager.d.ts +1 -1
  310. package/bin/service/core/ServiceManager.d.ts.map +1 -1
  311. package/bin/service/core/ServiceStateController.d.ts +20 -7
  312. package/bin/service/core/ServiceStateController.d.ts.map +1 -1
  313. package/bin/service/core/ServiceStateController.js +23 -20
  314. package/bin/service/core/ServiceStateController.js.map +1 -1
  315. package/bin/service/core/ServiceSystemProviders.d.ts +1 -1
  316. package/bin/service/core/ServiceSystemProviders.d.ts.map +1 -1
  317. package/bin/service/core/Services.d.ts +1 -1
  318. package/bin/service/core/Services.d.ts.map +1 -1
  319. package/bin/service/core/Services.js +2 -0
  320. package/bin/service/core/Services.js.map +1 -1
  321. package/bin/service/schedule/Executor.d.ts +1 -1
  322. package/bin/service/schedule/Executor.d.ts.map +1 -1
  323. package/bin/service/types/Service.d.ts +1 -23
  324. package/bin/service/types/Service.d.ts.map +1 -1
  325. package/bin/session/{Session.d.ts → Executor.d.ts} +54 -17
  326. package/bin/session/Executor.d.ts.map +1 -0
  327. package/bin/session/{Session.js → Executor.js} +60 -23
  328. package/bin/session/Executor.js.map +1 -0
  329. package/bin/session/composer/SessionComposer.d.ts +1 -1
  330. package/bin/session/composer/SessionComposer.js +1 -1
  331. package/bin/session/composer/compaction/SessionCompactionComposer.d.ts +2 -2
  332. package/bin/session/composer/execution/LocalSessionExecutionComposer.d.ts +1 -1
  333. package/bin/session/composer/execution/LocalSessionExecutionComposer.js +1 -1
  334. package/bin/session/composer/execution/SessionExecutionComposer.d.ts +1 -1
  335. package/bin/session/composer/history/SessionHistoryComposer.d.ts +1 -1
  336. package/bin/session/composer/system/SessionSystemComposer.d.ts +1 -1
  337. package/bin/session/composer/system/SessionSystemComposer.js +1 -1
  338. package/bin/session/composer/system/default/DefaultSessionSystemComposer.d.ts +1 -1
  339. package/bin/session/composer/system/default/DefaultSessionSystemComposer.d.ts.map +1 -1
  340. package/bin/session/composer/system/default/SystemDomain.d.ts +1 -1
  341. package/bin/session/composer/system/default/SystemDomain.d.ts.map +1 -1
  342. package/bin/session/executors/local/{LocalSessionCore.d.ts → Runner.d.ts} +10 -10
  343. package/bin/session/executors/local/Runner.d.ts.map +1 -0
  344. package/bin/session/executors/local/{LocalSessionCore.js → Runner.js} +11 -11
  345. package/bin/session/executors/local/Runner.js.map +1 -0
  346. package/bin/session/executors/local/SessionExecutionError.d.ts +1 -1
  347. package/bin/session/executors/local/SessionExecutionError.js +1 -1
  348. package/bin/session/executors/local/SessionLoopDecision.d.ts +3 -3
  349. package/bin/session/executors/local/SessionLoopDecision.js +3 -3
  350. package/bin/session/executors/local/SessionModelMessageState.d.ts +2 -2
  351. package/bin/session/executors/local/SessionModelMessageState.js +2 -2
  352. package/bin/session/executors/local/SessionSignals.d.ts +3 -3
  353. package/bin/session/executors/local/SessionSignals.js +3 -3
  354. package/bin/session/executors/local/SessionToolLoopRunner.d.ts +1 -1
  355. package/bin/session/executors/local/SessionToolLoopRunner.js +2 -2
  356. package/bin/session/executors/local/SessionToolLoopRunner.js.map +1 -1
  357. package/bin/session/tools/shell/ShellToolBridge.d.ts +1 -1
  358. package/bin/session/tools/shell/ShellToolBridge.d.ts.map +1 -1
  359. package/bin/session/types/SessionLoop.d.ts +1 -1
  360. package/bin/session/types/SessionLoop.js +1 -1
  361. package/bin/session/types/SessionRun.d.ts +2 -2
  362. package/bin/session/types/SessionRun.js +1 -1
  363. package/package.json +1 -1
  364. package/src/{runtime → core}/AgentContextTypes.ts +6 -7
  365. package/src/core/AgentCore.ts +527 -0
  366. package/src/{runtime/AgentRuntimeTypes.ts → core/AgentCoreTypes.ts} +9 -9
  367. package/src/host/runtime/PluginRuntime.ts +1 -1
  368. package/src/index.ts +26 -23
  369. package/src/plugin/builtins/asr/InboundAugment.ts +1 -1
  370. package/src/plugin/builtins/auth/runtime/AuthorizationConfig.ts +1 -1
  371. package/src/plugin/builtins/auth/runtime/AuthorizationStore.ts +1 -1
  372. package/src/plugin/builtins/voice/InboundAugment.ts +1 -1
  373. package/src/plugin/builtins/workboard/runtime/Collector.ts +2 -2
  374. package/src/plugin/builtins/workboard/runtime/Normalizer.ts +1 -1
  375. package/src/plugin/builtins/workboard/runtime/Store.ts +1 -1
  376. package/src/plugin/core/Activation.ts +2 -2
  377. package/src/plugin/core/HookRegistry.ts +1 -1
  378. package/src/plugin/core/HttpRoutes.ts +1 -1
  379. package/src/plugin/core/LocalExecution.ts +21 -20
  380. package/src/plugin/core/PluginRegistry.ts +1 -1
  381. package/src/plugin/types/Plugin.ts +1 -1
  382. package/src/sandbox/SandboxConfigResolver.ts +1 -1
  383. package/src/sandbox/SandboxRunner.ts +1 -1
  384. package/src/sdk/Agent.ts +101 -395
  385. package/src/sdk/AgentSdkTypes.ts +158 -0
  386. package/src/sdk/HttpServer.ts +27 -192
  387. package/src/sdk/RpcServer.ts +24 -211
  388. package/src/sdk/Session.ts +64 -68
  389. package/src/sdk/SessionMetadata.ts +5 -5
  390. package/src/sdk/SessionPersistence.ts +13 -13
  391. package/src/sdk/SessionServicePort.ts +14 -14
  392. package/src/sdk/{SdkSessionSystemComposer.ts → SessionSystemBuilder.ts} +24 -24
  393. package/src/server/http/Server.ts +63 -18
  394. package/src/server/http/control/AuthControlService.ts +1 -1
  395. package/src/server/http/control/ControlAuthorizationRoutes.ts +1 -1
  396. package/src/server/http/control/ControlRouter.ts +27 -11
  397. package/src/server/http/control/ExecuteBySession.ts +2 -2
  398. package/src/server/http/control/OverviewRoutes.ts +6 -2
  399. package/src/server/http/control/SessionSummaryStore.ts +1 -1
  400. package/src/server/http/control/types/ControlRoutes.ts +2 -2
  401. package/src/server/http/execute/execute.ts +107 -91
  402. package/src/server/http/plugins/plugins.ts +60 -44
  403. package/src/server/http/services/services.ts +68 -64
  404. package/src/server/http/static/static.ts +95 -79
  405. package/src/server/rpc/Server.ts +26 -15
  406. package/src/service/builtins/BaseService.ts +2 -2
  407. package/src/service/builtins/chat/Action.ts +1 -1
  408. package/src/service/builtins/chat/ChatService.ts +2 -2
  409. package/src/service/builtins/chat/ChatServiceTypes.ts +1 -1
  410. package/src/service/builtins/chat/channels/BaseChatChannel.ts +1 -1
  411. package/src/service/builtins/chat/channels/BaseChatChannelQueue.ts +1 -1
  412. package/src/service/builtins/chat/channels/BaseChatChannelSupport.ts +1 -1
  413. package/src/service/builtins/chat/channels/feishu/Feishu.ts +1 -1
  414. package/src/service/builtins/chat/channels/feishu/FeishuMessageHandler.ts +1 -1
  415. package/src/service/builtins/chat/channels/feishu/FeishuPlatformClient.ts +1 -1
  416. package/src/service/builtins/chat/channels/qq/QQ.ts +1 -1
  417. package/src/service/builtins/chat/channels/qq/QQMessageHandler.ts +1 -1
  418. package/src/service/builtins/chat/channels/qq/QQSupport.ts +1 -1
  419. package/src/service/builtins/chat/channels/telegram/Bot.ts +1 -1
  420. package/src/service/builtins/chat/channels/telegram/TelegramMessageHandler.ts +1 -1
  421. package/src/service/builtins/chat/channels/telegram/TelegramPlatformClient.ts +1 -1
  422. package/src/service/builtins/chat/runtime/ChannelContextStore.ts +1 -1
  423. package/src/service/builtins/chat/runtime/ChatActionExecution.ts +1 -1
  424. package/src/service/builtins/chat/runtime/ChatActionInput.ts +2 -158
  425. package/src/service/builtins/chat/runtime/ChatChannelActions.ts +1 -1
  426. package/src/service/builtins/chat/runtime/ChatChannelConfig.ts +1 -1
  427. package/src/service/builtins/chat/runtime/ChatChannelCore.ts +1 -1
  428. package/src/service/builtins/chat/runtime/ChatChannelLifecycle.ts +1 -1
  429. package/src/service/builtins/chat/runtime/ChatHistoryStore.ts +1 -1
  430. package/src/service/builtins/chat/runtime/ChatIngressStore.ts +1 -1
  431. package/src/service/builtins/chat/runtime/ChatMetaStore.ts +1 -1
  432. package/src/service/builtins/chat/runtime/ChatQueueReplyDispatch.ts +1 -1
  433. package/src/service/builtins/chat/runtime/ChatQueueSessionBridge.ts +1 -1
  434. package/src/service/builtins/chat/runtime/ChatQueueStore.ts +1 -1
  435. package/src/service/builtins/chat/runtime/ChatQueueWorker.ts +1 -1
  436. package/src/service/builtins/chat/runtime/ChatServiceActions.ts +1 -118
  437. package/src/service/builtins/chat/runtime/ChatServiceSystem.ts +1 -1
  438. package/src/service/builtins/chat/runtime/ChatSession.ts +37 -13
  439. package/src/service/builtins/chat/runtime/ChatSessionDelete.ts +1 -1
  440. package/src/service/builtins/chat/runtime/ChatkeySend.ts +1 -1
  441. package/src/service/builtins/chat/runtime/EnqueueDispatch.ts +1 -1
  442. package/src/service/builtins/chat/runtime/InboundAugment.ts +1 -1
  443. package/src/service/builtins/chat/runtime/PluginDispatch.ts +1 -1
  444. package/src/service/builtins/chat/runtime/ReplyDispatch.ts +1 -1
  445. package/src/service/builtins/chat/runtime/SystemPrompt.ts +1 -1
  446. package/src/service/builtins/contact/Action.ts +2 -59
  447. package/src/service/builtins/contact/ContactService.ts +2 -2
  448. package/src/service/builtins/contact/runtime/ChatRuntime.ts +1 -1
  449. package/src/service/builtins/contact/runtime/ContactPayload.ts +0 -12
  450. package/src/service/builtins/contact/runtime/RemoteClient.ts +40 -19
  451. package/src/service/builtins/contact/runtime/ShareBundle.ts +1 -1
  452. package/src/service/builtins/memory/Action.ts +1 -1
  453. package/src/service/builtins/memory/MemoryService.ts +1 -28
  454. package/src/service/builtins/memory/runtime/Flush.ts +1 -1
  455. package/src/service/builtins/memory/runtime/Search.ts +1 -1
  456. package/src/service/builtins/memory/runtime/Store.ts +1 -1
  457. package/src/service/builtins/memory/runtime/SystemProvider.ts +1 -1
  458. package/src/service/builtins/memory/runtime/Writer.ts +1 -1
  459. package/src/service/builtins/schedule/ScheduleService.ts +131 -0
  460. package/src/service/builtins/shell/ShellRuntimeTypes.ts +1 -1
  461. package/src/service/builtins/shell/ShellService.ts +2 -2
  462. package/src/service/builtins/shell/runtime/ShellActionResponse.ts +1 -1
  463. package/src/service/builtins/shell/runtime/ShellActionRuntime.ts +1 -1
  464. package/src/service/builtins/shell/runtime/ShellActionRuntimeSupport.ts +1 -1
  465. package/src/service/builtins/shell/runtime/ShellRuntimeEnvironment.ts +1 -1
  466. package/src/service/builtins/task/Action.ts +1 -1
  467. package/src/service/builtins/task/Scheduler.ts +1 -1
  468. package/src/service/builtins/task/TaskService.ts +2 -2
  469. package/src/service/builtins/task/runtime/CronRuntime.ts +1 -1
  470. package/src/service/builtins/task/runtime/Runner.ts +2 -2
  471. package/src/service/builtins/task/runtime/TaskActionExecution.ts +1 -1
  472. package/src/service/builtins/task/runtime/TaskActionInput.ts +3 -185
  473. package/src/service/builtins/task/runtime/TaskRunChatDispatch.ts +1 -1
  474. package/src/service/builtins/task/runtime/TaskRunnerRound.ts +1 -1
  475. package/src/service/builtins/task/runtime/TaskRunnerScript.ts +1 -1
  476. package/src/service/builtins/task/runtime/TaskRunnerSession.ts +5 -5
  477. package/src/service/builtins/task/runtime/TaskRunnerTypes.ts +1 -1
  478. package/src/service/builtins/task/runtime/TaskServiceActions.ts +1 -35
  479. package/src/service/core/Manager.ts +0 -1
  480. package/src/service/core/ServiceActionRunner.ts +4 -2
  481. package/src/service/core/ServiceClassRegistry.ts +1 -1
  482. package/src/service/core/ServiceCommandRequest.ts +93 -0
  483. package/src/service/core/ServiceManager.ts +0 -1
  484. package/src/service/core/ServiceStateController.ts +45 -20
  485. package/src/service/core/ServiceSystemProviders.ts +1 -1
  486. package/src/service/core/Services.ts +3 -1
  487. package/src/service/schedule/Executor.ts +1 -1
  488. package/src/service/types/Service.ts +1 -24
  489. package/src/session/{Session.ts → Executor.ts} +96 -26
  490. package/src/session/composer/SessionComposer.ts +1 -1
  491. package/src/session/composer/compaction/SessionCompactionComposer.ts +2 -2
  492. package/src/session/composer/execution/LocalSessionExecutionComposer.ts +1 -1
  493. package/src/session/composer/execution/SessionExecutionComposer.ts +1 -1
  494. package/src/session/composer/history/SessionHistoryComposer.ts +1 -1
  495. package/src/session/composer/system/SessionSystemComposer.ts +1 -1
  496. package/src/session/composer/system/default/DefaultSessionSystemComposer.ts +1 -1
  497. package/src/session/composer/system/default/SystemDomain.ts +1 -1
  498. package/src/session/executors/local/{LocalSessionCore.ts → Runner.ts} +13 -13
  499. package/src/session/executors/local/SessionExecutionError.ts +1 -1
  500. package/src/session/executors/local/SessionLoopDecision.ts +3 -3
  501. package/src/session/executors/local/SessionModelMessageState.ts +2 -2
  502. package/src/session/executors/local/SessionSignals.ts +3 -3
  503. package/src/session/executors/local/SessionToolLoopRunner.ts +2 -2
  504. package/src/session/tools/shell/ShellToolBridge.ts +1 -1
  505. package/src/session/types/SessionLoop.ts +1 -1
  506. package/src/session/types/SessionRun.ts +2 -2
  507. package/tsconfig.tsbuildinfo +1 -1
  508. package/bin/runtime/AgentContext.d.ts +0 -23
  509. package/bin/runtime/AgentContext.d.ts.map +0 -1
  510. package/bin/runtime/AgentContext.js +0 -149
  511. package/bin/runtime/AgentContext.js.map +0 -1
  512. package/bin/runtime/AgentContextTypes.d.ts.map +0 -1
  513. package/bin/runtime/AgentContextTypes.js.map +0 -1
  514. package/bin/runtime/AgentRuntime.d.ts +0 -37
  515. package/bin/runtime/AgentRuntime.d.ts.map +0 -1
  516. package/bin/runtime/AgentRuntime.js +0 -296
  517. package/bin/runtime/AgentRuntime.js.map +0 -1
  518. package/bin/runtime/AgentRuntimeState.d.ts +0 -42
  519. package/bin/runtime/AgentRuntimeState.d.ts.map +0 -1
  520. package/bin/runtime/AgentRuntimeState.js +0 -172
  521. package/bin/runtime/AgentRuntimeState.js.map +0 -1
  522. package/bin/runtime/AgentRuntimeTypes.d.ts.map +0 -1
  523. package/bin/runtime/AgentRuntimeTypes.js +0 -10
  524. package/bin/runtime/AgentRuntimeTypes.js.map +0 -1
  525. package/bin/sdk/SdkSessionSystemComposer.d.ts.map +0 -1
  526. package/bin/sdk/SdkSessionSystemComposer.js.map +0 -1
  527. package/bin/service/core/ServiceActionApi.d.ts +0 -15
  528. package/bin/service/core/ServiceActionApi.d.ts.map +0 -1
  529. package/bin/service/core/ServiceActionApi.js +0 -234
  530. package/bin/service/core/ServiceActionApi.js.map +0 -1
  531. package/bin/service/schedule/Runtime.d.ts +0 -17
  532. package/bin/service/schedule/Runtime.d.ts.map +0 -1
  533. package/bin/service/schedule/Runtime.js +0 -64
  534. package/bin/service/schedule/Runtime.js.map +0 -1
  535. package/bin/session/Session.d.ts.map +0 -1
  536. package/bin/session/Session.js.map +0 -1
  537. package/bin/session/executors/local/LocalSessionCore.d.ts.map +0 -1
  538. package/bin/session/executors/local/LocalSessionCore.js.map +0 -1
  539. package/bin/session/executors/local/LocalSessionExecutor.d.ts +0 -61
  540. package/bin/session/executors/local/LocalSessionExecutor.d.ts.map +0 -1
  541. package/bin/session/executors/local/LocalSessionExecutor.js +0 -36
  542. package/bin/session/executors/local/LocalSessionExecutor.js.map +0 -1
  543. package/src/runtime/AgentContext.ts +0 -182
  544. package/src/runtime/AgentRuntime.ts +0 -376
  545. package/src/runtime/AgentRuntimeState.ts +0 -213
  546. package/src/service/core/ServiceActionApi.ts +0 -304
  547. package/src/service/schedule/Runtime.ts +0 -78
  548. package/src/session/executors/local/LocalSessionExecutor.ts +0 -89
@@ -1,61 +0,0 @@
1
- /**
2
- * LocalSessionExecutor:Session 场景运行装配器。
3
- *
4
- * 关键点(中文)
5
- * - 负责在当前 `sessionId` 作用域内装配 Session 所需核心组件。
6
- * - 具体 run loop 仍由 `LocalSessionCore` 执行。
7
- */
8
- import type { LanguageModel, Tool } from "ai";
9
- import type { Logger } from "../../../utils/logger/Logger.js";
10
- import { SessionCompactionComposer } from "../../composer/compaction/SessionCompactionComposer.js";
11
- import { SessionExecutionComposer } from "../../composer/execution/SessionExecutionComposer.js";
12
- import { SessionHistoryComposer } from "../../composer/history/SessionHistoryComposer.js";
13
- import { SessionSystemComposer } from "../../composer/system/SessionSystemComposer.js";
14
- import type { SessionRunResult, SessionRunInput } from "../../../session/types/SessionRun.js";
15
- type LocalSessionExecutorOptions = {
16
- /**
17
- * 当前模型实例。
18
- */
19
- model: LanguageModel;
20
- /**
21
- * 统一日志器。
22
- */
23
- logger: Logger;
24
- /**
25
- * 当前 session 对应的历史存储。
26
- */
27
- historyComposer: SessionHistoryComposer;
28
- /**
29
- * 当前 session 对应的 compaction Composer。
30
- */
31
- compactionComposer: SessionCompactionComposer;
32
- /**
33
- * system 解析器。
34
- */
35
- systemComposer: SessionSystemComposer;
36
- /**
37
- * 获取当前可用工具集合。
38
- */
39
- getTools: () => Record<string, Tool>;
40
- /**
41
- * 可选自定义 execution composer。
42
- *
43
- * 关键点(中文)
44
- * - 允许 chat/task 等上层在实例化 Session 时注入专用 composer。
45
- * - 未提供时回退到默认 `LocalSessionExecutionComposer`。
46
- */
47
- executionComposer?: SessionExecutionComposer;
48
- };
49
- /**
50
- * LocalSessionExecutor 默认实现。
51
- */
52
- export declare class LocalSessionExecutor {
53
- private readonly core;
54
- constructor(options: LocalSessionExecutorOptions);
55
- /**
56
- * 运行当前 session 的一次请求。
57
- */
58
- run(input: SessionRunInput): Promise<SessionRunResult>;
59
- }
60
- export {};
61
- //# sourceMappingURL=LocalSessionExecutor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LocalSessionExecutor.d.ts","sourceRoot":"","sources":["../../../../src/session/executors/local/LocalSessionExecutor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,2DAA2D,CAAC;AACtG,OAAO,EAAE,wBAAwB,EAAE,MAAM,yDAAyD,CAAC;AACnG,OAAO,EAAE,sBAAsB,EAAE,MAAM,qDAAqD,CAAC;AAC7F,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAC;AAE1F,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEvF,KAAK,2BAA2B,GAAG;IACjC;;OAEG;IACH,KAAK,EAAE,aAAa,CAAC;IAErB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,eAAe,EAAE,sBAAsB,CAAC;IAExC;;OAEG;IACH,kBAAkB,EAAE,yBAAyB,CAAC;IAE9C;;OAEG;IACH,cAAc,EAAE,qBAAqB,CAAC;IAEtC;;OAEG;IACH,QAAQ,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAErC;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,wBAAwB,CAAC;CAE9C,CAAC;AAEF;;GAEG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAmB;gBAE5B,OAAO,EAAE,2BAA2B;IAgBhD;;OAEG;IACG,GAAG,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAG7D"}
@@ -1,36 +0,0 @@
1
- /**
2
- * LocalSessionExecutor:Session 场景运行装配器。
3
- *
4
- * 关键点(中文)
5
- * - 负责在当前 `sessionId` 作用域内装配 Session 所需核心组件。
6
- * - 具体 run loop 仍由 `LocalSessionCore` 执行。
7
- */
8
- import { LocalSessionCore } from "../../executors/local/LocalSessionCore.js";
9
- import { LocalSessionExecutionComposer } from "../../composer/execution/LocalSessionExecutionComposer.js";
10
- /**
11
- * LocalSessionExecutor 默认实现。
12
- */
13
- export class LocalSessionExecutor {
14
- core;
15
- constructor(options) {
16
- this.core = new LocalSessionCore({
17
- model: options.model,
18
- logger: options.logger,
19
- historyComposer: options.historyComposer,
20
- compactionComposer: options.compactionComposer,
21
- systemComposer: options.systemComposer,
22
- executionComposer: options.executionComposer ||
23
- new LocalSessionExecutionComposer({
24
- sessionId: options.historyComposer.sessionId,
25
- getTools: options.getTools,
26
- }),
27
- });
28
- }
29
- /**
30
- * 运行当前 session 的一次请求。
31
- */
32
- async run(input) {
33
- return await this.core.run(input);
34
- }
35
- }
36
- //# sourceMappingURL=LocalSessionExecutor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LocalSessionExecutor.js","sourceRoot":"","sources":["../../../../src/session/executors/local/LocalSessionExecutor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAKhF,OAAO,EAAE,6BAA6B,EAAE,MAAM,8DAA8D,CAAC;AA6C7G;;GAEG;AACH,MAAM,OAAO,oBAAoB;IACd,IAAI,CAAmB;IAExC,YAAY,OAAoC;QAC9C,IAAI,CAAC,IAAI,GAAG,IAAI,gBAAgB,CAAC;YAC/B,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,eAAe,EAAE,OAAO,CAAC,eAAe;YACxC,kBAAkB,EAAE,OAAO,CAAC,kBAAkB;YAC9C,cAAc,EAAE,OAAO,CAAC,cAAc;YACtC,iBAAiB,EACf,OAAO,CAAC,iBAAiB;gBACzB,IAAI,6BAA6B,CAAC;oBAChC,SAAS,EAAE,OAAO,CAAC,eAAe,CAAC,SAAS;oBAC5C,QAAQ,EAAE,OAAO,CAAC,QAAQ;iBAC3B,CAAC;SACL,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,GAAG,CAAC,KAAsB;QAC9B,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;CACF"}
@@ -1,182 +0,0 @@
1
- /**
2
- * AgentContext:agent 能力上下文构造模块。
3
- *
4
- * 关键点(中文)
5
- * - 这里负责从 `AgentRuntime` 派生统一执行上下文,供 service、plugin、session tool 复用。
6
- * - `AgentContext` 表达的是“执行期能力面”,不是宿主本体;真正的宿主状态仍由 `AgentRuntime` 持有。
7
- * - 该模块把 service invoke、plugin port、chat runtime port 收敛成稳定端口集合。
8
- */
9
-
10
- import type {
11
- ChatRuntimePort,
12
- AgentContext,
13
- InvokeServicePort,
14
- SessionCollectionPort,
15
- } from "@/runtime/AgentContextTypes.js";
16
- import type { JsonValue } from "@/types/common/Json.js";
17
- import type {
18
- PluginAvailability,
19
- PluginPort,
20
- PluginView,
21
- } from "@/plugin/types/Plugin.js";
22
- import type { AgentRuntime } from "@/runtime/AgentRuntimeTypes.js";
23
- import { runServiceCommand } from "@/service/core/Manager.js";
24
- import { getPluginManager } from "@/plugin/core/PluginManager.js";
25
- import { getAgentRuntime } from "@/runtime/AgentRuntimeState.js";
26
- import { appendExecSessionMessage } from "@/service/builtins/chat/runtime/ChatIngressStore.js";
27
- import { readChatMetaBySessionId } from "@/service/builtins/chat/runtime/ChatMetaStore.js";
28
- import { resolveChatQueueStore } from "@/service/builtins/chat/runtime/ChatQueue.js";
29
-
30
- /**
31
- * service 调用端口实现。
32
- */
33
- const serviceInvokePort: InvokeServicePort = {
34
- async invoke(params: {
35
- service: string;
36
- action: string;
37
- payload?: JsonValue;
38
- }) {
39
- const serviceName = String(params.service || "").trim();
40
- const action = String(params.action || "").trim();
41
- if (!serviceName) {
42
- return {
43
- success: false,
44
- error: "invoke.service is required",
45
- };
46
- }
47
- if (!action) {
48
- return {
49
- success: false,
50
- error: "invoke.action is required",
51
- };
52
- }
53
-
54
- const result = await runServiceCommand({
55
- serviceName,
56
- command: action,
57
- payload: params.payload,
58
- context: getAgentContext(),
59
- });
60
- if (!result.success) {
61
- return {
62
- success: false,
63
- error: result.message || "service invoke failed",
64
- };
65
- }
66
-
67
- return {
68
- success: true,
69
- ...(result.data !== undefined ? { data: result.data } : {}),
70
- };
71
- },
72
- };
73
-
74
- /**
75
- * 构建 session 端口。
76
- */
77
- function buildSessionPort(input: AgentRuntime): SessionCollectionPort {
78
- return {
79
- get: (sessionId) => input.getSession(sessionId),
80
- listExecutingSessionIds: () => input.listExecutingSessionIds(),
81
- getExecutingSessionCount: () => input.getExecutingSessionCount(),
82
- ...(input.model ? { model: input.model } : {}),
83
- };
84
- }
85
-
86
- /**
87
- * 构建 plugin 端口。
88
- */
89
- function buildPluginPort(input: AgentRuntime): PluginPort {
90
- return {
91
- list(): PluginView[] {
92
- return getPluginManager().list();
93
- },
94
- async availability(pluginName: string): Promise<PluginAvailability> {
95
- return getPluginManager().availability(pluginName);
96
- },
97
- async runAction(params: {
98
- plugin: string;
99
- action: string;
100
- payload?: JsonValue;
101
- }) {
102
- return getPluginManager().runAction(params);
103
- },
104
- async pipeline<T = JsonValue>(pointName: string, value: T): Promise<T> {
105
- return getPluginManager().pipeline(pointName, value);
106
- },
107
- async guard<T = JsonValue>(pointName: string, value: T): Promise<void> {
108
- return getPluginManager().guard(pointName, value);
109
- },
110
- async effect<T = JsonValue>(pointName: string, value: T): Promise<void> {
111
- return getPluginManager().effect(pointName, value);
112
- },
113
- async resolve<TInput = JsonValue, TOutput = JsonValue>(
114
- pointName: string,
115
- value: TInput,
116
- ): Promise<TOutput> {
117
- return getPluginManager().resolve<TInput, TOutput>(pointName, value);
118
- },
119
- };
120
- }
121
-
122
- /**
123
- * 构建 chat 运行时端口。
124
- */
125
- function buildChatPort(getContext: () => AgentContext): ChatRuntimePort {
126
- return {
127
- async readMetaBySessionId(sessionId: string) {
128
- return readChatMetaBySessionId({
129
- context: getContext(),
130
- sessionId,
131
- });
132
- },
133
- async appendExecSessionMessage(params) {
134
- await appendExecSessionMessage({
135
- context: getContext(),
136
- sessionId: params.sessionId,
137
- text: params.text,
138
- extra: params.extra,
139
- });
140
- },
141
- enqueue(params) {
142
- return resolveChatQueueStore(getContext()).enqueue(params);
143
- },
144
- };
145
- }
146
-
147
- /**
148
- * 从 agent 状态派生统一执行上下文。
149
- */
150
- export function createAgentContext(input: AgentRuntime): AgentContext {
151
- let context!: AgentContext;
152
- context = {
153
- agent: input,
154
- cwd: input.cwd,
155
- rootPath: input.rootPath,
156
- logger: input.logger,
157
- config: input.config,
158
- env: input.env,
159
- globalEnv: input.globalEnv,
160
- systems: input.systems,
161
- paths: input.paths,
162
- pluginConfig: input.pluginConfig,
163
- platform: input.platform,
164
- session: buildSessionPort(input),
165
- invoke: serviceInvokePort,
166
- chat: buildChatPort(() => context),
167
- plugins: buildPluginPort(input),
168
- };
169
- return context;
170
- }
171
-
172
- /**
173
- * 读取当前 agent 的统一执行上下文。
174
- */
175
- export function getAgentContext(): AgentContext {
176
- return createAgentContext(getAgentRuntime());
177
- }
178
-
179
- /**
180
- * 关键点(中文)
181
- * - 当前文件内的 service invoke port 既服务于 AgentContext,也可直接注入 shell tool。
182
- */
@@ -1,376 +0,0 @@
1
- /**
2
- * AgentRuntime:agent 宿主装配与导出模块。
3
- *
4
- * 关键点(中文)
5
- * - 这里是单 agent 宿主的主装配入口,负责把 config、model、session、service、plugin 串起来。
6
- * - 完整运行态类型仍由 `AgentRuntimeState.ts` 维护;本模块只负责装配与对外导出。
7
- * - 该模块同时负责热重载提示词系统与导出统一的 `getAgentContext()` 入口。
8
- * - 当前只有 `api` 执行模式:从 console 模型池取模型,走 LocalSessionCore。
9
- */
10
-
11
- import path from "path";
12
- import fs from "fs";
13
- import { logger as defaultLogger } from "@/utils/logger/Logger.js";
14
- import { LocalSessionExecutor } from "@session/executors/local/LocalSessionExecutor.js";
15
- import { ensureRuntimeProjectReady } from "@/host/daemon/ProjectSetup.js";
16
- import { createModel } from "@/model/CreateModel.js";
17
- import {
18
- loadGlobalEnvFromStore,
19
- loadAgentEnvSnapshot,
20
- loadDowncityConfig,
21
- } from "@/config/Config.js";
22
- import { getDowncityJsonPath } from "@/config/Paths.js";
23
- import {
24
- getTaskRunDir,
25
- parseTaskRunSessionId,
26
- } from "@/service/builtins/task/runtime/Paths.js";
27
- import { setShellToolRuntime, shellTools } from "@session/tools/shell/ShellToolDefinition.js";
28
- import { getSessionRunScope } from "@session/SessionRunScope.js";
29
- import { JsonlSessionHistoryComposer } from "@session/composer/history/jsonl/JsonlSessionHistoryComposer.js";
30
- import { JsonlSessionCompactionComposer } from "@session/composer/compaction/jsonl/JsonlSessionCompactionComposer.js";
31
- import { DefaultSessionSystemComposer } from "@session/composer/system/default/DefaultSessionSystemComposer.js";
32
- import type { SessionHistoryComposer } from "@session/composer/history/SessionHistoryComposer.js";
33
- import { ChatSession } from "@/service/builtins/chat/runtime/ChatSession.js";
34
- import { ChatSessionExecutionComposer } from "@/service/builtins/chat/runtime/ChatSessionExecutionComposer.js";
35
- import {
36
- loadStaticSystemPrompts,
37
- StaticPromptCatalog,
38
- } from "@session/composer/system/default/StaticPromptCatalog.js";
39
- import {
40
- getAgentContext,
41
- } from "@/runtime/AgentContext.js";
42
- import {
43
- getAgentRuntime,
44
- getAgentRuntimeBase,
45
- setAgentRuntime,
46
- setAgentRuntimeBase,
47
- type AgentRuntime,
48
- } from "@/runtime/AgentRuntimeState.js";
49
- import { createRegisteredServiceInstances } from "@/service/core/ServiceClassRegistry.js";
50
- import { readProjectPrimaryModelId } from "@/project/ProjectExecutionBinding.js";
51
- import { initializePluginManager, resetPluginManager } from "@/plugin/core/PluginManager.js";
52
- import {
53
- clearPluginRuntimeContextResolver,
54
- setPluginRuntimeContextResolver,
55
- } from "@/host/runtime/PluginRuntime.js";
56
- import {
57
- createAgentPathRuntime,
58
- createAgentPluginConfigRuntime,
59
- } from "@/host/runtime/AgentHostRuntime.js";
60
- import { updateAgentRuntimeConfig } from "@/runtime/AgentRuntimeState.js";
61
- import type { AgentPlatformRuntime } from "@/types/host/AgentHost.js";
62
-
63
- export type { AgentRuntimeBase, AgentRuntime } from "@/runtime/AgentRuntimeState.js";
64
- export {
65
- getAgentRuntime,
66
- getAgentRuntimeBase,
67
- setAgentRuntime,
68
- setAgentRuntimeBase,
69
- requireAgentModel,
70
- } from "@/runtime/AgentRuntimeState.js";
71
- export { getAgentContext } from "@/runtime/AgentContext.js";
72
-
73
- let staticPromptCatalog: StaticPromptCatalog | null = null;
74
- let configWatchPath: string | null = null;
75
-
76
- const EMPTY_RUNTIME_PLATFORM: AgentPlatformRuntime = {
77
- getGlobalEnv: () => ({}),
78
- getAgentEnv: () => ({}),
79
- listModels: () => [],
80
- listProviders: async () => [],
81
- getModel: () => null,
82
- getChannelAccount: () => null,
83
- readChatAuthorizationConfig: () => ({ roles: {}, channels: {} }),
84
- writeChatAuthorizationConfig: async (_projectRoot, nextConfig) => nextConfig,
85
- setChatAuthorizationUserRole: async () => ({ roles: {}, channels: {} }),
86
- isPluginEnabled: (pluginName) => pluginName === "auth",
87
- };
88
-
89
- /**
90
- * 原子更新 AgentRuntime.systems(同时覆盖 base + ready)。
91
- */
92
- function applyAgentSystems(nextSystems: string[]): void {
93
- const currentBase = getAgentRuntimeBase();
94
- const currentReady = (() => {
95
- try {
96
- return getAgentRuntime();
97
- } catch {
98
- return null;
99
- }
100
- })();
101
-
102
- setAgentRuntimeBase({
103
- ...currentBase,
104
- systems: nextSystems,
105
- });
106
-
107
- if (currentReady) {
108
- setAgentRuntime({
109
- ...currentReady,
110
- systems: nextSystems,
111
- });
112
- }
113
- }
114
-
115
- /**
116
- * 停止 agent 提示词文件热重载监听。
117
- */
118
- export function stopAgentHotReload(): void {
119
- if (staticPromptCatalog) {
120
- staticPromptCatalog.stop();
121
- staticPromptCatalog = null;
122
- }
123
- if (configWatchPath) {
124
- fs.unwatchFile(configWatchPath);
125
- configWatchPath = null;
126
- }
127
- clearPluginRuntimeContextResolver();
128
- }
129
-
130
- /**
131
- * 刷新当前 agent 的项目配置快照。
132
- *
133
- * 关键点(中文)
134
- * - 这里只更新 `AgentRuntime.config`,不尝试重建长期运行对象。
135
- * - 适用于 plugin 启用态、prompt 注入、轻量配置读取这类直接依赖 config 的链路。
136
- */
137
- export function refreshAgentProjectConfig(): boolean {
138
- const currentBase = getAgentRuntimeBase();
139
- const nextConfig = loadDowncityConfig(currentBase.rootPath, {
140
- projectEnv: currentBase.env,
141
- globalEnv: currentBase.globalEnv,
142
- });
143
- const prevSerialized = JSON.stringify(currentBase.config);
144
- const nextSerialized = JSON.stringify(nextConfig);
145
- if (prevSerialized === nextSerialized) {
146
- return false;
147
- }
148
- updateAgentRuntimeConfig(nextConfig);
149
- return true;
150
- }
151
-
152
- /**
153
- * 启动 agent 提示词文件热重载监听(PROFILE.md / SOUL.md)。
154
- */
155
- function startAgentHotReload(): void {
156
- stopAgentHotReload();
157
- const agent = getAgentRuntime();
158
- staticPromptCatalog = new StaticPromptCatalog({
159
- rootPath: agent.rootPath,
160
- logger: agent.logger,
161
- getCurrentSystems: () => getAgentRuntimeBase().systems,
162
- applySystems: (nextSystems) => {
163
- applyAgentSystems(nextSystems);
164
- },
165
- });
166
- staticPromptCatalog.start();
167
-
168
- const downcityJsonPath = getDowncityJsonPath(agent.rootPath);
169
- configWatchPath = downcityJsonPath;
170
- fs.watchFile(
171
- downcityJsonPath,
172
- {
173
- interval: 800,
174
- persistent: false,
175
- },
176
- () => {
177
- try {
178
- const changed = refreshAgentProjectConfig();
179
- if (changed) {
180
- agent.logger.info("Agent config reloaded", {
181
- rootPath: agent.rootPath,
182
- file: downcityJsonPath,
183
- });
184
- }
185
- } catch (error) {
186
- agent.logger.warn("Failed to reload agent config", {
187
- rootPath: agent.rootPath,
188
- file: downcityJsonPath,
189
- error: String(error),
190
- });
191
- }
192
- },
193
- );
194
- }
195
-
196
- /**
197
- * 创建 session history composer。
198
- */
199
- function createSessionHistoryComposer(
200
- rootPath: string,
201
- sessionId: string,
202
- ): JsonlSessionHistoryComposer {
203
- const parsedRun = parseTaskRunSessionId(sessionId);
204
- const paths = parsedRun
205
- ? (() => {
206
- const runDir = getTaskRunDir(
207
- rootPath,
208
- parsedRun.taskId,
209
- parsedRun.timestamp,
210
- );
211
- return {
212
- sessionDirPath: runDir,
213
- };
214
- })()
215
- : undefined;
216
- return new JsonlSessionHistoryComposer({
217
- sessionId,
218
- rootPath,
219
- ...(paths ? { paths } : {}),
220
- });
221
- }
222
-
223
- /**
224
- * 初始化入口。
225
- *
226
- * 关键点(中文)
227
- * - 只有 api 执行模式:从 console 模型池创建模型 → LocalSessionExecutor → LocalSessionCore。
228
- */
229
- export async function initAgentRuntime(
230
- cwd: string,
231
- options?: {
232
- platform?: AgentPlatformRuntime;
233
- globalEnv?: Record<string, string>;
234
- projectEnv?: Record<string, string>;
235
- },
236
- ): Promise<void> {
237
- stopAgentHotReload();
238
- resetPluginManager();
239
-
240
- const resolvedCwd = String(cwd || "").trim() || ".";
241
- const rootPath = path.resolve(resolvedCwd);
242
-
243
- defaultLogger.bindProjectRoot(rootPath);
244
- ensureRuntimeProjectReady(rootPath);
245
-
246
- const platform = options?.platform || EMPTY_RUNTIME_PLATFORM;
247
- const globalEnv = options?.globalEnv || platform?.getGlobalEnv() || loadGlobalEnvFromStore();
248
- const projectEnv =
249
- options?.projectEnv ||
250
- platform?.getAgentEnv(rootPath) ||
251
- loadAgentEnvSnapshot(rootPath);
252
- const config = loadDowncityConfig(rootPath, {
253
- projectEnv,
254
- globalEnv,
255
- });
256
-
257
- process.env.DC_AGENT_PATH = rootPath;
258
- process.env.DC_AGENT_NAME = String(config.name || path.basename(rootPath));
259
-
260
- setAgentRuntimeBase({
261
- cwd: resolvedCwd,
262
- rootPath,
263
- logger: defaultLogger,
264
- config,
265
- env: projectEnv,
266
- globalEnv,
267
- systems: [],
268
- paths: createAgentPathRuntime(rootPath),
269
- pluginConfig: createAgentPluginConfigRuntime(rootPath),
270
- platform: platform,
271
- });
272
-
273
- const systems = loadStaticSystemPrompts(rootPath);
274
- setAgentRuntimeBase({
275
- cwd: resolvedCwd,
276
- rootPath,
277
- logger: defaultLogger,
278
- config,
279
- env: projectEnv,
280
- globalEnv,
281
- systems,
282
- paths: createAgentPathRuntime(rootPath),
283
- pluginConfig: createAgentPluginConfigRuntime(rootPath),
284
- platform: platform,
285
- });
286
-
287
- const primaryModelId = readProjectPrimaryModelId(config);
288
- const model = await createModel({
289
- config,
290
- getSessionRunScope: getSessionRunScope,
291
- projectRoot: rootPath,
292
- platform,
293
- });
294
-
295
- const compactionComposer = new JsonlSessionCompactionComposer({
296
- keepLastMessages: config.context?.messages?.keepLastMessages,
297
- maxInputTokensApprox: config.context?.messages?.maxInputTokensApprox,
298
- archiveOnCompact: config.context?.messages?.archiveOnCompact,
299
- compactRatio: config.context?.messages?.compactRatio,
300
- });
301
-
302
- const systemComposer = new DefaultSessionSystemComposer({
303
- projectRoot: rootPath,
304
- getStaticSystemPrompts: () => getAgentRuntimeBase().systems,
305
- getContext: () => getAgentContext(),
306
- profile: "chat",
307
- });
308
-
309
- const sessionsById = new Map<string, ChatSession>();
310
- const getSession = (sessionId: string): ChatSession => {
311
- const key = String(sessionId || "").trim();
312
- if (!key) {
313
- throw new Error("AgentRuntime.getSession requires a non-empty sessionId");
314
- }
315
- const existing = sessionsById.get(key);
316
- if (existing) return existing;
317
-
318
- const historyComposer = createSessionHistoryComposer(rootPath, key);
319
- const executionComposer = new ChatSessionExecutionComposer({
320
- sessionId: key,
321
- getTools: () => shellTools,
322
- getTurnState: () => created.getTurnState(),
323
- });
324
- let created!: ChatSession;
325
- created = new ChatSession({
326
- sessionId: key,
327
- historyComposer,
328
- executionComposer,
329
- createExecutor: (
330
- sessionHistoryComposer: SessionHistoryComposer,
331
- chatExecutionComposer: ChatSessionExecutionComposer,
332
- ) =>
333
- new LocalSessionExecutor({
334
- model,
335
- logger: defaultLogger,
336
- historyComposer: sessionHistoryComposer,
337
- compactionComposer,
338
- systemComposer,
339
- getTools: () => shellTools,
340
- executionComposer: chatExecutionComposer,
341
- }),
342
- });
343
- sessionsById.set(key, created);
344
- return created;
345
- };
346
-
347
- const agentState: AgentRuntime = {
348
- cwd: resolvedCwd,
349
- rootPath,
350
- logger: defaultLogger,
351
- config,
352
- env: projectEnv,
353
- globalEnv,
354
- systems,
355
- paths: createAgentPathRuntime(rootPath),
356
- pluginConfig: createAgentPluginConfigRuntime(rootPath),
357
- platform: platform,
358
- model,
359
- getSession,
360
- listExecutingSessionIds: () =>
361
- [...sessionsById.entries()]
362
- .filter(([, session]) => session.isExecuting())
363
- .map(([sessionId]) => sessionId),
364
- getExecutingSessionCount: () =>
365
- [...sessionsById.values()].filter((session) => session.isExecuting())
366
- .length,
367
- services: new Map(),
368
- };
369
- agentState.services = createRegisteredServiceInstances(agentState);
370
-
371
- setAgentRuntime(agentState);
372
- setPluginRuntimeContextResolver(() => getAgentContext());
373
- initializePluginManager();
374
- setShellToolRuntime(getAgentContext().invoke);
375
- startAgentHotReload();
376
- }