@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.
Files changed (1153) hide show
  1. package/README.md +612 -139
  2. package/bin/config/Config.d.ts +1 -1
  3. package/bin/config/Config.d.ts.map +1 -1
  4. package/bin/config/Config.js +4 -5
  5. package/bin/config/Config.js.map +1 -1
  6. package/bin/config/DowncityDefault.d.ts +1 -1
  7. package/bin/config/DowncitySchema.d.ts +1 -1
  8. package/bin/config/DowncitySchema.d.ts.map +1 -1
  9. package/bin/config/Paths.d.ts +1 -1
  10. package/bin/config/Paths.js +2 -2
  11. package/bin/host/daemon/Api.d.ts +2 -2
  12. package/bin/host/daemon/Api.d.ts.map +1 -1
  13. package/bin/host/daemon/Api.js +1 -1
  14. package/bin/host/daemon/Client.js +2 -2
  15. package/bin/host/daemon/Client.js.map +1 -1
  16. package/bin/host/daemon/Paths.d.ts +20 -0
  17. package/bin/host/daemon/Paths.d.ts.map +1 -0
  18. package/bin/host/daemon/Paths.js +23 -0
  19. package/bin/host/daemon/Paths.js.map +1 -0
  20. package/bin/host/daemon/ProjectSetup.d.ts +1 -1
  21. package/bin/host/daemon/ProjectSetup.js +1 -1
  22. package/bin/host/daemon/ProjectSetup.js.map +1 -1
  23. package/bin/host/runtime/AgentHostRuntime.d.ts +1 -1
  24. package/bin/host/runtime/AgentHostRuntime.js +2 -2
  25. package/bin/host/runtime/PluginRuntime.d.ts +1 -1
  26. package/bin/host/runtime/PluginRuntime.d.ts.map +1 -1
  27. package/bin/index.d.ts +59 -77
  28. package/bin/index.d.ts.map +1 -1
  29. package/bin/index.js +42 -82
  30. package/bin/index.js.map +1 -1
  31. package/bin/model/CreateModel.d.ts +2 -2
  32. package/bin/model/CreateModel.js +1 -1
  33. package/bin/model/CreateModel.js.map +1 -1
  34. package/bin/model/ModelManager.d.ts +1 -1
  35. package/bin/plugin/builtins/asr/Config.d.ts +43 -0
  36. package/bin/plugin/builtins/asr/Config.d.ts.map +1 -0
  37. package/bin/plugin/builtins/asr/Config.js +107 -0
  38. package/bin/plugin/builtins/asr/Config.js.map +1 -0
  39. package/bin/plugin/builtins/asr/Dependency.d.ts +1 -1
  40. package/bin/plugin/builtins/asr/Dependency.d.ts.map +1 -1
  41. package/bin/plugin/builtins/asr/InboundAugment.d.ts +17 -0
  42. package/bin/plugin/builtins/asr/InboundAugment.d.ts.map +1 -0
  43. package/bin/plugin/builtins/asr/InboundAugment.js +47 -0
  44. package/bin/plugin/builtins/asr/InboundAugment.js.map +1 -0
  45. package/bin/plugin/builtins/asr/Plugin.d.ts.map +1 -1
  46. package/bin/plugin/builtins/asr/Plugin.js +3 -126
  47. package/bin/plugin/builtins/asr/Plugin.js.map +1 -1
  48. package/bin/plugin/builtins/auth/runtime/AuthorizationConfig.d.ts +1 -1
  49. package/bin/plugin/builtins/auth/runtime/AuthorizationConfig.d.ts.map +1 -1
  50. package/bin/plugin/builtins/auth/runtime/AuthorizationPolicy.d.ts +2 -2
  51. package/bin/plugin/builtins/auth/runtime/AuthorizationStore.d.ts +1 -1
  52. package/bin/plugin/builtins/auth/runtime/AuthorizationStore.d.ts.map +1 -1
  53. package/bin/plugin/builtins/skill/Config.d.ts +1 -1
  54. package/bin/plugin/builtins/skill/runtime/SystemProvider.d.ts +1 -1
  55. package/bin/plugin/builtins/skill/types/ClaudeSkill.d.ts +1 -1
  56. package/bin/plugin/builtins/skill/types/ClaudeSkill.d.ts.map +1 -1
  57. package/bin/plugin/builtins/tts/Dependency.d.ts +1 -1
  58. package/bin/plugin/builtins/tts/Dependency.d.ts.map +1 -1
  59. package/bin/plugin/builtins/tts/Plugin.d.ts.map +1 -1
  60. package/bin/plugin/builtins/tts/Plugin.js +1 -52
  61. package/bin/plugin/builtins/tts/Plugin.js.map +1 -1
  62. package/bin/plugin/builtins/tts/PluginSupport.d.ts +25 -0
  63. package/bin/plugin/builtins/tts/PluginSupport.d.ts.map +1 -0
  64. package/bin/plugin/builtins/tts/PluginSupport.js +72 -0
  65. package/bin/plugin/builtins/tts/PluginSupport.js.map +1 -0
  66. package/bin/plugin/builtins/tts/types/TtsPlugin.d.ts +1 -1
  67. package/bin/plugin/builtins/tts/types/TtsPlugin.d.ts.map +1 -1
  68. package/bin/plugin/builtins/voice/Config.d.ts +43 -0
  69. package/bin/plugin/builtins/voice/Config.d.ts.map +1 -0
  70. package/bin/plugin/builtins/voice/Config.js +104 -0
  71. package/bin/plugin/builtins/voice/Config.js.map +1 -0
  72. package/bin/plugin/builtins/voice/Dependency.d.ts +1 -1
  73. package/bin/plugin/builtins/voice/Dependency.d.ts.map +1 -1
  74. package/bin/plugin/builtins/voice/InboundAugment.d.ts +17 -0
  75. package/bin/plugin/builtins/voice/InboundAugment.d.ts.map +1 -0
  76. package/bin/plugin/builtins/voice/InboundAugment.js +47 -0
  77. package/bin/plugin/builtins/voice/InboundAugment.js.map +1 -0
  78. package/bin/plugin/builtins/voice/Plugin.d.ts.map +1 -1
  79. package/bin/plugin/builtins/voice/Plugin.js +3 -123
  80. package/bin/plugin/builtins/voice/Plugin.js.map +1 -1
  81. package/bin/plugin/builtins/voice/types/VoicePlugin.d.ts +1 -1
  82. package/bin/plugin/builtins/voice/types/VoicePlugin.d.ts.map +1 -1
  83. package/bin/plugin/builtins/web/runtime/Source.d.ts +1 -1
  84. package/bin/plugin/builtins/web/runtime/Source.d.ts.map +1 -1
  85. package/bin/plugin/builtins/web/types/WebPlugin.d.ts +1 -1
  86. package/bin/plugin/builtins/web/types/WebPlugin.d.ts.map +1 -1
  87. package/bin/plugin/builtins/workboard/runtime/Collector.d.ts +1 -1
  88. package/bin/plugin/builtins/workboard/runtime/Collector.d.ts.map +1 -1
  89. package/bin/plugin/builtins/workboard/runtime/Collector.js +1 -1
  90. package/bin/plugin/builtins/workboard/runtime/Collector.js.map +1 -1
  91. package/bin/plugin/builtins/workboard/runtime/Normalizer.d.ts +2 -2
  92. package/bin/plugin/builtins/workboard/runtime/Normalizer.d.ts.map +1 -1
  93. package/bin/plugin/builtins/workboard/runtime/Store.d.ts +1 -1
  94. package/bin/plugin/builtins/workboard/runtime/Store.d.ts.map +1 -1
  95. package/bin/plugin/core/Activation.d.ts +2 -2
  96. package/bin/plugin/core/Activation.d.ts.map +1 -1
  97. package/bin/plugin/core/HookRegistry.d.ts +2 -2
  98. package/bin/plugin/core/HookRegistry.d.ts.map +1 -1
  99. package/bin/plugin/core/HttpRoutes.d.ts +2 -2
  100. package/bin/plugin/core/HttpRoutes.d.ts.map +1 -1
  101. package/bin/plugin/core/LocalExecution.d.ts +1 -1
  102. package/bin/plugin/core/LocalExecution.d.ts.map +1 -1
  103. package/bin/plugin/core/LocalExecution.js +1 -1
  104. package/bin/plugin/core/LocalExecution.js.map +1 -1
  105. package/bin/plugin/core/PluginManager.d.ts +2 -2
  106. package/bin/plugin/core/PluginManager.js +2 -2
  107. package/bin/plugin/core/PluginRegistry.d.ts +2 -2
  108. package/bin/plugin/core/PluginRegistry.d.ts.map +1 -1
  109. package/bin/plugin/core/ProjectConfigStore.d.ts +1 -1
  110. package/bin/plugin/types/Plugin.d.ts +5 -5
  111. package/bin/plugin/types/Plugin.d.ts.map +1 -1
  112. package/bin/plugin/types/PluginApi.d.ts +1 -1
  113. package/bin/plugin/types/PluginApi.d.ts.map +1 -1
  114. package/bin/{agent/project → project}/AgentInitializer.d.ts +2 -2
  115. package/bin/project/AgentInitializer.d.ts.map +1 -0
  116. package/bin/{agent/project → project}/AgentInitializer.js +7 -7
  117. package/bin/project/AgentInitializer.js.map +1 -0
  118. package/bin/{agent/project → project}/ProjectExecutionBinding.d.ts +2 -2
  119. package/bin/project/ProjectExecutionBinding.d.ts.map +1 -0
  120. package/bin/project/ProjectExecutionBinding.js.map +1 -0
  121. package/bin/{agent/project → project}/types/AgentProject.d.ts +2 -2
  122. package/bin/project/types/AgentProject.d.ts.map +1 -0
  123. package/bin/project/types/AgentProject.js.map +1 -0
  124. package/bin/{agent → runtime}/AgentContext.d.ts +2 -2
  125. package/bin/runtime/AgentContext.d.ts.map +1 -0
  126. package/bin/{agent → runtime}/AgentContext.js +1 -1
  127. package/bin/runtime/AgentContext.js.map +1 -0
  128. package/bin/{agent → runtime}/AgentContextTypes.d.ts +4 -4
  129. package/bin/runtime/AgentContextTypes.d.ts.map +1 -0
  130. package/bin/runtime/AgentContextTypes.js.map +1 -0
  131. package/bin/{agent → runtime}/AgentRuntime.d.ts +4 -4
  132. package/bin/runtime/AgentRuntime.d.ts.map +1 -0
  133. package/bin/{agent → runtime}/AgentRuntime.js +6 -6
  134. package/bin/runtime/AgentRuntime.js.map +1 -0
  135. package/bin/{agent → runtime}/AgentRuntimeState.d.ts +3 -3
  136. package/bin/runtime/AgentRuntimeState.d.ts.map +1 -0
  137. package/bin/runtime/AgentRuntimeState.js.map +1 -0
  138. package/bin/{agent → runtime}/AgentRuntimeTypes.d.ts +2 -2
  139. package/bin/runtime/AgentRuntimeTypes.d.ts.map +1 -0
  140. package/bin/runtime/AgentRuntimeTypes.js.map +1 -0
  141. package/bin/sandbox/SandboxConfigResolver.d.ts +1 -1
  142. package/bin/sandbox/SandboxConfigResolver.d.ts.map +1 -1
  143. package/bin/sandbox/SandboxRunner.d.ts +1 -1
  144. package/bin/sandbox/SandboxRunner.d.ts.map +1 -1
  145. package/bin/{host/sdk → sdk}/Agent.d.ts +17 -12
  146. package/bin/sdk/Agent.d.ts.map +1 -0
  147. package/bin/{host/sdk → sdk}/Agent.js +73 -29
  148. package/bin/sdk/Agent.js.map +1 -0
  149. package/bin/{host/sdk → sdk}/AgentSdkTypes.d.ts +100 -5
  150. package/bin/sdk/AgentSdkTypes.d.ts.map +1 -0
  151. package/bin/sdk/AgentSdkTypes.js.map +1 -0
  152. package/bin/sdk/AsyncQueue.d.ts.map +1 -0
  153. package/bin/sdk/AsyncQueue.js.map +1 -0
  154. package/bin/{host/sdk → sdk}/HttpServer.d.ts +1 -1
  155. package/bin/sdk/HttpServer.d.ts.map +1 -0
  156. package/bin/{host/sdk → sdk}/HttpServer.js +8 -0
  157. package/bin/sdk/HttpServer.js.map +1 -0
  158. package/bin/sdk/Paths.d.ts.map +1 -0
  159. package/bin/sdk/Paths.js.map +1 -0
  160. package/bin/{host/sdk → sdk}/RemoteAgent.d.ts +6 -2
  161. package/bin/sdk/RemoteAgent.d.ts.map +1 -0
  162. package/bin/{host/sdk → sdk}/RemoteAgent.js +14 -0
  163. package/bin/sdk/RemoteAgent.js.map +1 -0
  164. package/bin/{host/sdk → sdk}/RpcServer.d.ts +1 -1
  165. package/bin/sdk/RpcServer.d.ts.map +1 -0
  166. package/bin/{host/sdk → sdk}/RpcServer.js +15 -1
  167. package/bin/sdk/RpcServer.js.map +1 -0
  168. package/bin/sdk/SdkSessionSystemComposer.d.ts +106 -0
  169. package/bin/sdk/SdkSessionSystemComposer.d.ts.map +1 -0
  170. package/bin/sdk/SdkSessionSystemComposer.js +150 -0
  171. package/bin/sdk/SdkSessionSystemComposer.js.map +1 -0
  172. package/bin/{host/sdk → sdk}/Session.d.ts +23 -18
  173. package/bin/sdk/Session.d.ts.map +1 -0
  174. package/bin/{host/sdk → sdk}/Session.js +86 -165
  175. package/bin/sdk/Session.js.map +1 -0
  176. package/bin/{host/sdk → sdk}/SessionMetadata.d.ts +5 -1
  177. package/bin/sdk/SessionMetadata.d.ts.map +1 -0
  178. package/bin/{host/sdk → sdk}/SessionMetadata.js +17 -1
  179. package/bin/sdk/SessionMetadata.js.map +1 -0
  180. package/bin/sdk/SessionPersistence.d.ts +63 -0
  181. package/bin/sdk/SessionPersistence.d.ts.map +1 -0
  182. package/bin/sdk/SessionPersistence.js +52 -0
  183. package/bin/sdk/SessionPersistence.js.map +1 -0
  184. package/bin/sdk/SessionServicePort.d.ts +34 -0
  185. package/bin/sdk/SessionServicePort.d.ts.map +1 -0
  186. package/bin/sdk/SessionServicePort.js +36 -0
  187. package/bin/sdk/SessionServicePort.js.map +1 -0
  188. package/bin/sdk/StreamEvents.d.ts +36 -0
  189. package/bin/sdk/StreamEvents.d.ts.map +1 -0
  190. package/bin/{host/sdk → sdk}/StreamEvents.js +27 -0
  191. package/bin/sdk/StreamEvents.js.map +1 -0
  192. package/bin/server/http/Server.d.ts.map +1 -0
  193. package/bin/{host → server}/http/Server.js +7 -7
  194. package/bin/server/http/Server.js.map +1 -0
  195. package/bin/server/http/auth/AuthEnv.d.ts.map +1 -0
  196. package/bin/server/http/auth/AuthEnv.js.map +1 -0
  197. package/bin/server/http/auth/AuthError.d.ts.map +1 -0
  198. package/bin/server/http/auth/AuthError.js.map +1 -0
  199. package/bin/server/http/auth/CliAuthStateStore.d.ts.map +1 -0
  200. package/bin/server/http/auth/CliAuthStateStore.js.map +1 -0
  201. package/bin/server/http/auth/PasswordHasher.d.ts.map +1 -0
  202. package/bin/server/http/auth/PasswordHasher.js.map +1 -0
  203. package/bin/server/http/auth/TokenService.d.ts.map +1 -0
  204. package/bin/server/http/auth/TokenService.js.map +1 -0
  205. package/bin/{host → server}/http/control/AuthControlService.d.ts +2 -2
  206. package/bin/server/http/control/AuthControlService.d.ts.map +1 -0
  207. package/bin/server/http/control/AuthControlService.js.map +1 -0
  208. package/bin/server/http/control/CommonHelpers.d.ts.map +1 -0
  209. package/bin/server/http/control/CommonHelpers.js.map +1 -0
  210. package/bin/{host → server}/http/control/ControlApiRoutes.d.ts +1 -1
  211. package/bin/server/http/control/ControlApiRoutes.d.ts.map +1 -0
  212. package/bin/{host → server}/http/control/ControlApiRoutes.js +5 -5
  213. package/bin/server/http/control/ControlApiRoutes.js.map +1 -0
  214. package/bin/{host → server}/http/control/ControlAuthorizationRoutes.d.ts +1 -1
  215. package/bin/server/http/control/ControlAuthorizationRoutes.d.ts.map +1 -0
  216. package/bin/{host → server}/http/control/ControlAuthorizationRoutes.js +2 -2
  217. package/bin/server/http/control/ControlAuthorizationRoutes.js.map +1 -0
  218. package/bin/{host → server}/http/control/ControlRouter.d.ts +1 -1
  219. package/bin/server/http/control/ControlRouter.d.ts.map +1 -0
  220. package/bin/{host → server}/http/control/ControlRouter.js +3 -3
  221. package/bin/server/http/control/ControlRouter.js.map +1 -0
  222. package/bin/{host → server}/http/control/ExecuteBySession.d.ts +3 -3
  223. package/bin/server/http/control/ExecuteBySession.d.ts.map +1 -0
  224. package/bin/server/http/control/ExecuteBySession.js.map +1 -0
  225. package/bin/{host → server}/http/control/ExecuteInput.d.ts +1 -1
  226. package/bin/server/http/control/ExecuteInput.d.ts.map +1 -0
  227. package/bin/server/http/control/ExecuteInput.js.map +1 -0
  228. package/bin/server/http/control/Helpers.d.ts.map +1 -0
  229. package/bin/{host/http/control/Helpers.d.ts.map → server/http/control/Helpers.js.map} +1 -1
  230. package/bin/{host → server}/http/control/MessageTimeline.d.ts +1 -1
  231. package/bin/server/http/control/MessageTimeline.d.ts.map +1 -0
  232. package/bin/server/http/control/MessageTimeline.js.map +1 -0
  233. package/bin/{host → server}/http/control/ModelRoutes.d.ts +1 -1
  234. package/bin/server/http/control/ModelRoutes.d.ts.map +1 -0
  235. package/bin/{host → server}/http/control/ModelRoutes.js +1 -1
  236. package/bin/server/http/control/ModelRoutes.js.map +1 -0
  237. package/bin/{host → server}/http/control/OverviewRoutes.d.ts +1 -1
  238. package/bin/server/http/control/OverviewRoutes.d.ts.map +1 -0
  239. package/bin/server/http/control/OverviewRoutes.js.map +1 -0
  240. package/bin/{host → server}/http/control/SessionRoutes.d.ts +1 -1
  241. package/bin/server/http/control/SessionRoutes.d.ts.map +1 -0
  242. package/bin/server/http/control/SessionRoutes.js.map +1 -0
  243. package/bin/{host → server}/http/control/SessionSummaryStore.d.ts +2 -2
  244. package/bin/server/http/control/SessionSummaryStore.d.ts.map +1 -0
  245. package/bin/server/http/control/SessionSummaryStore.js.map +1 -0
  246. package/bin/{host → server}/http/control/TaskRoutes.d.ts +1 -1
  247. package/bin/server/http/control/TaskRoutes.d.ts.map +1 -0
  248. package/bin/server/http/control/TaskRoutes.js.map +1 -0
  249. package/bin/{host → server}/http/control/TaskStore.d.ts +1 -1
  250. package/bin/server/http/control/TaskStore.d.ts.map +1 -0
  251. package/bin/server/http/control/TaskStore.js.map +1 -0
  252. package/bin/server/http/control/types/AuthControl.d.ts.map +1 -0
  253. package/bin/server/http/control/types/AuthControl.js.map +1 -0
  254. package/bin/{host → server}/http/control/types/ControlRoutes.d.ts +2 -2
  255. package/bin/server/http/control/types/ControlRoutes.d.ts.map +1 -0
  256. package/bin/server/http/control/types/ControlRoutes.js.map +1 -0
  257. package/bin/server/http/control/types/ControlSessionExecute.d.ts.map +1 -0
  258. package/bin/server/http/control/types/ControlSessionExecute.js.map +1 -0
  259. package/bin/{host → server}/http/control/types/ControlViewData.d.ts +1 -1
  260. package/bin/server/http/control/types/ControlViewData.d.ts.map +1 -0
  261. package/bin/server/http/control/types/ControlViewData.js.map +1 -0
  262. package/bin/server/http/execute/execute.d.ts.map +1 -0
  263. package/bin/{host → server}/http/execute/execute.js +1 -1
  264. package/bin/server/http/execute/execute.js.map +1 -0
  265. package/bin/server/http/health/health.d.ts.map +1 -0
  266. package/bin/server/http/health/health.js.map +1 -0
  267. package/bin/server/http/plugins/plugins.d.ts.map +1 -0
  268. package/bin/{host → server}/http/plugins/plugins.js +1 -1
  269. package/bin/server/http/plugins/plugins.js.map +1 -0
  270. package/bin/server/http/services/services.d.ts.map +1 -0
  271. package/bin/{host → server}/http/services/services.js +1 -1
  272. package/bin/server/http/services/services.js.map +1 -0
  273. package/bin/server/http/static/static.d.ts.map +1 -0
  274. package/bin/{host → server}/http/static/static.js +1 -1
  275. package/bin/server/http/static/static.js.map +1 -0
  276. package/bin/{host → server}/rpc/Server.d.ts +3 -3
  277. package/bin/server/rpc/Server.d.ts.map +1 -0
  278. package/bin/{host → server}/rpc/Server.js +2 -2
  279. package/bin/server/rpc/Server.js.map +1 -0
  280. package/bin/service/builtins/BaseService.d.ts +2 -2
  281. package/bin/service/builtins/BaseService.d.ts.map +1 -1
  282. package/bin/service/builtins/chat/Action.d.ts +1 -1
  283. package/bin/service/builtins/chat/Action.d.ts.map +1 -1
  284. package/bin/service/builtins/chat/ChatService.d.ts +3 -3
  285. package/bin/service/builtins/chat/ChatService.d.ts.map +1 -1
  286. package/bin/service/builtins/chat/ChatServiceTypes.d.ts +2 -2
  287. package/bin/service/builtins/chat/ChatServiceTypes.d.ts.map +1 -1
  288. package/bin/service/builtins/chat/accounts/ChannelAccountService.d.ts +1 -1
  289. package/bin/service/builtins/chat/channels/BaseChatChannel.d.ts +1 -1
  290. package/bin/service/builtins/chat/channels/BaseChatChannel.d.ts.map +1 -1
  291. package/bin/service/builtins/chat/channels/BaseChatChannelQueue.d.ts +1 -1
  292. package/bin/service/builtins/chat/channels/BaseChatChannelQueue.d.ts.map +1 -1
  293. package/bin/service/builtins/chat/channels/BaseChatChannelSupport.d.ts +2 -2
  294. package/bin/service/builtins/chat/channels/BaseChatChannelSupport.d.ts.map +1 -1
  295. package/bin/service/builtins/chat/channels/feishu/Feishu.d.ts +1 -1
  296. package/bin/service/builtins/chat/channels/feishu/Feishu.d.ts.map +1 -1
  297. package/bin/service/builtins/chat/channels/feishu/Feishu.js +39 -171
  298. package/bin/service/builtins/chat/channels/feishu/Feishu.js.map +1 -1
  299. package/bin/service/builtins/chat/channels/feishu/FeishuMessageHandler.d.ts +155 -0
  300. package/bin/service/builtins/chat/channels/feishu/FeishuMessageHandler.d.ts.map +1 -0
  301. package/bin/service/builtins/chat/channels/feishu/FeishuMessageHandler.js +247 -0
  302. package/bin/service/builtins/chat/channels/feishu/FeishuMessageHandler.js.map +1 -0
  303. package/bin/service/builtins/chat/channels/feishu/FeishuPlatformClient.d.ts +1 -1
  304. package/bin/service/builtins/chat/channels/feishu/FeishuPlatformClient.d.ts.map +1 -1
  305. package/bin/service/builtins/chat/channels/feishu/FeishuPlatformLookup.d.ts +1 -1
  306. package/bin/service/builtins/chat/channels/feishu/FeishuPlatformLookup.d.ts.map +1 -1
  307. package/bin/service/builtins/chat/channels/feishu/types/FeishuChannel.d.ts +1 -1
  308. package/bin/service/builtins/chat/channels/feishu/types/FeishuChannel.js +1 -1
  309. package/bin/service/builtins/chat/channels/qq/QQ.d.ts +5 -5
  310. package/bin/service/builtins/chat/channels/qq/QQ.d.ts.map +1 -1
  311. package/bin/service/builtins/chat/channels/qq/QQ.js +33 -231
  312. package/bin/service/builtins/chat/channels/qq/QQ.js.map +1 -1
  313. package/bin/service/builtins/chat/channels/qq/QQGatewayClient.d.ts +0 -24
  314. package/bin/service/builtins/chat/channels/qq/QQGatewayClient.d.ts.map +1 -1
  315. package/bin/service/builtins/chat/channels/qq/QQGatewayClient.js +68 -227
  316. package/bin/service/builtins/chat/channels/qq/QQGatewayClient.js.map +1 -1
  317. package/bin/service/builtins/chat/channels/qq/QQGatewayConnection.d.ts +65 -0
  318. package/bin/service/builtins/chat/channels/qq/QQGatewayConnection.d.ts.map +1 -0
  319. package/bin/service/builtins/chat/channels/qq/QQGatewayConnection.js +110 -0
  320. package/bin/service/builtins/chat/channels/qq/QQGatewayConnection.js.map +1 -0
  321. package/bin/service/builtins/chat/channels/qq/QQGatewayHeartbeat.d.ts +59 -0
  322. package/bin/service/builtins/chat/channels/qq/QQGatewayHeartbeat.d.ts.map +1 -0
  323. package/bin/service/builtins/chat/channels/qq/QQGatewayHeartbeat.js +58 -0
  324. package/bin/service/builtins/chat/channels/qq/QQGatewayHeartbeat.js.map +1 -0
  325. package/bin/service/builtins/chat/channels/qq/QQGatewayProtocol.d.ts +86 -0
  326. package/bin/service/builtins/chat/channels/qq/QQGatewayProtocol.d.ts.map +1 -0
  327. package/bin/service/builtins/chat/channels/qq/QQGatewayProtocol.js +93 -0
  328. package/bin/service/builtins/chat/channels/qq/QQGatewayProtocol.js.map +1 -0
  329. package/bin/service/builtins/chat/channels/qq/QQMessageHandler.d.ts +129 -0
  330. package/bin/service/builtins/chat/channels/qq/QQMessageHandler.d.ts.map +1 -0
  331. package/bin/service/builtins/chat/channels/qq/QQMessageHandler.js +284 -0
  332. package/bin/service/builtins/chat/channels/qq/QQMessageHandler.js.map +1 -0
  333. package/bin/service/builtins/chat/channels/qq/QQSupport.d.ts +2 -2
  334. package/bin/service/builtins/chat/channels/qq/QQSupport.d.ts.map +1 -1
  335. package/bin/service/builtins/chat/channels/qq/types/QqChannel.d.ts +2 -2
  336. package/bin/service/builtins/chat/channels/qq/types/QqChannel.d.ts.map +1 -1
  337. package/bin/service/builtins/chat/channels/qq/types/QqChannel.js +1 -1
  338. package/bin/service/builtins/chat/channels/telegram/Bot.d.ts +1 -1
  339. package/bin/service/builtins/chat/channels/telegram/Bot.d.ts.map +1 -1
  340. package/bin/service/builtins/chat/channels/telegram/Bot.js +35 -293
  341. package/bin/service/builtins/chat/channels/telegram/Bot.js.map +1 -1
  342. package/bin/service/builtins/chat/channels/telegram/TelegramMessageHandler.d.ts +142 -0
  343. package/bin/service/builtins/chat/channels/telegram/TelegramMessageHandler.d.ts.map +1 -0
  344. package/bin/service/builtins/chat/channels/telegram/TelegramMessageHandler.js +267 -0
  345. package/bin/service/builtins/chat/channels/telegram/TelegramMessageHandler.js.map +1 -0
  346. package/bin/service/builtins/chat/channels/telegram/TelegramPendingUpdates.d.ts +55 -0
  347. package/bin/service/builtins/chat/channels/telegram/TelegramPendingUpdates.d.ts.map +1 -0
  348. package/bin/service/builtins/chat/channels/telegram/TelegramPendingUpdates.js +125 -0
  349. package/bin/service/builtins/chat/channels/telegram/TelegramPendingUpdates.js.map +1 -0
  350. package/bin/service/builtins/chat/channels/telegram/TelegramPlatformClient.d.ts +1 -1
  351. package/bin/service/builtins/chat/channels/telegram/TelegramPlatformClient.d.ts.map +1 -1
  352. package/bin/service/builtins/chat/runtime/ChannelContextStore.d.ts +1 -1
  353. package/bin/service/builtins/chat/runtime/ChannelContextStore.d.ts.map +1 -1
  354. package/bin/service/builtins/chat/runtime/ChatActionExecution.d.ts +2 -2
  355. package/bin/service/builtins/chat/runtime/ChatActionExecution.d.ts.map +1 -1
  356. package/bin/service/builtins/chat/runtime/ChatActionInput.d.ts +3 -11
  357. package/bin/service/builtins/chat/runtime/ChatActionInput.d.ts.map +1 -1
  358. package/bin/service/builtins/chat/runtime/ChatActionInput.js +3 -232
  359. package/bin/service/builtins/chat/runtime/ChatActionInput.js.map +1 -1
  360. package/bin/service/builtins/chat/runtime/ChatActionInputSupport.d.ts +33 -0
  361. package/bin/service/builtins/chat/runtime/ChatActionInputSupport.d.ts.map +1 -0
  362. package/bin/service/builtins/chat/runtime/ChatActionInputSupport.js +66 -0
  363. package/bin/service/builtins/chat/runtime/ChatActionInputSupport.js.map +1 -0
  364. package/bin/service/builtins/chat/runtime/ChatChannelActions.d.ts +1 -1
  365. package/bin/service/builtins/chat/runtime/ChatChannelActions.d.ts.map +1 -1
  366. package/bin/service/builtins/chat/runtime/ChatChannelConfig.d.ts +3 -3
  367. package/bin/service/builtins/chat/runtime/ChatChannelConfig.d.ts.map +1 -1
  368. package/bin/service/builtins/chat/runtime/ChatChannelCore.d.ts +2 -2
  369. package/bin/service/builtins/chat/runtime/ChatChannelCore.d.ts.map +1 -1
  370. package/bin/service/builtins/chat/runtime/ChatChannelLifecycle.d.ts +1 -1
  371. package/bin/service/builtins/chat/runtime/ChatChannelLifecycle.d.ts.map +1 -1
  372. package/bin/service/builtins/chat/runtime/ChatHistoryStore.d.ts +2 -2
  373. package/bin/service/builtins/chat/runtime/ChatHistoryStore.d.ts.map +1 -1
  374. package/bin/service/builtins/chat/runtime/ChatIngressStore.d.ts +2 -2
  375. package/bin/service/builtins/chat/runtime/ChatIngressStore.d.ts.map +1 -1
  376. package/bin/service/builtins/chat/runtime/ChatMetaStore.d.ts +3 -3
  377. package/bin/service/builtins/chat/runtime/ChatMetaStore.d.ts.map +1 -1
  378. package/bin/service/builtins/chat/runtime/ChatMetaStore.js +2 -2
  379. package/bin/service/builtins/chat/runtime/ChatQueueReplyDispatch.d.ts +1 -1
  380. package/bin/service/builtins/chat/runtime/ChatQueueReplyDispatch.d.ts.map +1 -1
  381. package/bin/service/builtins/chat/runtime/ChatQueueSessionBridge.d.ts +2 -2
  382. package/bin/service/builtins/chat/runtime/ChatQueueSessionBridge.d.ts.map +1 -1
  383. package/bin/service/builtins/chat/runtime/ChatQueueStore.d.ts +1 -1
  384. package/bin/service/builtins/chat/runtime/ChatQueueStore.d.ts.map +1 -1
  385. package/bin/service/builtins/chat/runtime/ChatQueueWorker.d.ts +1 -1
  386. package/bin/service/builtins/chat/runtime/ChatQueueWorker.d.ts.map +1 -1
  387. package/bin/service/builtins/chat/runtime/ChatSendActionInput.d.ts +23 -0
  388. package/bin/service/builtins/chat/runtime/ChatSendActionInput.d.ts.map +1 -0
  389. package/bin/service/builtins/chat/runtime/ChatSendActionInput.js +205 -0
  390. package/bin/service/builtins/chat/runtime/ChatSendActionInput.js.map +1 -0
  391. package/bin/service/builtins/chat/runtime/ChatServiceSystem.d.ts +1 -1
  392. package/bin/service/builtins/chat/runtime/ChatServiceSystem.d.ts.map +1 -1
  393. package/bin/service/builtins/chat/runtime/ChatSessionDelete.d.ts +1 -1
  394. package/bin/service/builtins/chat/runtime/ChatSessionDelete.d.ts.map +1 -1
  395. package/bin/service/builtins/chat/runtime/ChatkeySend.d.ts +2 -2
  396. package/bin/service/builtins/chat/runtime/ChatkeySend.d.ts.map +1 -1
  397. package/bin/service/builtins/chat/runtime/ChatkeySend.js +1 -1
  398. package/bin/service/builtins/chat/runtime/EnqueueDispatch.d.ts +1 -1
  399. package/bin/service/builtins/chat/runtime/EnqueueDispatch.d.ts.map +1 -1
  400. package/bin/service/builtins/chat/runtime/InboundAugment.d.ts +1 -1
  401. package/bin/service/builtins/chat/runtime/InboundAugment.d.ts.map +1 -1
  402. package/bin/service/builtins/chat/runtime/PluginDispatch.d.ts +1 -1
  403. package/bin/service/builtins/chat/runtime/PluginDispatch.d.ts.map +1 -1
  404. package/bin/service/builtins/chat/runtime/ReplyContextFormatter.d.ts +1 -1
  405. package/bin/service/builtins/chat/runtime/ReplyContextFormatter.d.ts.map +1 -1
  406. package/bin/service/builtins/chat/runtime/ReplyDispatch.d.ts +1 -1
  407. package/bin/service/builtins/chat/runtime/ReplyDispatch.d.ts.map +1 -1
  408. package/bin/service/builtins/chat/runtime/SystemPrompt.d.ts +1 -1
  409. package/bin/service/builtins/chat/runtime/SystemPrompt.d.ts.map +1 -1
  410. package/bin/service/builtins/chat/runtime/UIMessageTransformer.d.ts +1 -1
  411. package/bin/service/builtins/chat/runtime/UIMessageTransformer.d.ts.map +1 -1
  412. package/bin/service/builtins/chat/types/ChannelAccount.d.ts +1 -1
  413. package/bin/service/builtins/chat/types/ChatHistory.d.ts +1 -1
  414. package/bin/service/builtins/chat/types/ChatHistory.d.ts.map +1 -1
  415. package/bin/service/builtins/chat/types/ChatMeta.d.ts +1 -1
  416. package/bin/service/builtins/chat/types/ChatMeta.js +1 -1
  417. package/bin/service/builtins/chat/types/ChatQueue.d.ts +1 -1
  418. package/bin/service/builtins/chat/types/ChatQueue.d.ts.map +1 -1
  419. package/bin/service/builtins/chat/types/ChatService.d.ts +1 -1
  420. package/bin/service/builtins/chat/types/ChatService.d.ts.map +1 -1
  421. package/bin/service/builtins/contact/Action.d.ts +57 -4
  422. package/bin/service/builtins/contact/Action.d.ts.map +1 -1
  423. package/bin/service/builtins/contact/Action.js +272 -4
  424. package/bin/service/builtins/contact/Action.js.map +1 -1
  425. package/bin/service/builtins/contact/ContactService.d.ts +1 -1
  426. package/bin/service/builtins/contact/ContactService.d.ts.map +1 -1
  427. package/bin/service/builtins/contact/ContactService.js +19 -293
  428. package/bin/service/builtins/contact/ContactService.js.map +1 -1
  429. package/bin/service/builtins/contact/runtime/ChatRuntime.d.ts +1 -1
  430. package/bin/service/builtins/contact/runtime/ChatRuntime.d.ts.map +1 -1
  431. package/bin/service/builtins/contact/runtime/ContactPayload.d.ts +24 -0
  432. package/bin/service/builtins/contact/runtime/ContactPayload.d.ts.map +1 -0
  433. package/bin/service/builtins/contact/runtime/ContactPayload.js +32 -0
  434. package/bin/service/builtins/contact/runtime/ContactPayload.js.map +1 -0
  435. package/bin/service/builtins/contact/runtime/RemoteClient.d.ts +1 -1
  436. package/bin/service/builtins/contact/runtime/RemoteClient.d.ts.map +1 -1
  437. package/bin/service/builtins/contact/runtime/ShareBundle.d.ts +1 -1
  438. package/bin/service/builtins/contact/runtime/ShareBundle.d.ts.map +1 -1
  439. package/bin/service/builtins/memory/Action.d.ts +2 -2
  440. package/bin/service/builtins/memory/Action.d.ts.map +1 -1
  441. package/bin/service/builtins/memory/MemoryService.d.ts +1 -1
  442. package/bin/service/builtins/memory/MemoryService.d.ts.map +1 -1
  443. package/bin/service/builtins/memory/runtime/Flush.d.ts +1 -1
  444. package/bin/service/builtins/memory/runtime/Flush.d.ts.map +1 -1
  445. package/bin/service/builtins/memory/runtime/Search.d.ts +1 -1
  446. package/bin/service/builtins/memory/runtime/Search.d.ts.map +1 -1
  447. package/bin/service/builtins/memory/runtime/Store.d.ts +1 -1
  448. package/bin/service/builtins/memory/runtime/Store.d.ts.map +1 -1
  449. package/bin/service/builtins/memory/runtime/SystemProvider.d.ts +1 -1
  450. package/bin/service/builtins/memory/runtime/SystemProvider.d.ts.map +1 -1
  451. package/bin/service/builtins/memory/runtime/Writer.d.ts +1 -1
  452. package/bin/service/builtins/memory/runtime/Writer.d.ts.map +1 -1
  453. package/bin/service/builtins/memory/types/Memory.d.ts +1 -1
  454. package/bin/service/builtins/memory/types/Memory.d.ts.map +1 -1
  455. package/bin/service/builtins/shell/ShellRuntimeTypes.d.ts +1 -1
  456. package/bin/service/builtins/shell/ShellRuntimeTypes.d.ts.map +1 -1
  457. package/bin/service/builtins/shell/ShellService.d.ts +2 -2
  458. package/bin/service/builtins/shell/ShellService.d.ts.map +1 -1
  459. package/bin/service/builtins/shell/runtime/ShellActionResponse.d.ts +52 -0
  460. package/bin/service/builtins/shell/runtime/ShellActionResponse.d.ts.map +1 -0
  461. package/bin/service/builtins/shell/runtime/ShellActionResponse.js +73 -0
  462. package/bin/service/builtins/shell/runtime/ShellActionResponse.js.map +1 -0
  463. package/bin/service/builtins/shell/runtime/ShellActionRuntime.d.ts +1 -1
  464. package/bin/service/builtins/shell/runtime/ShellActionRuntime.d.ts.map +1 -1
  465. package/bin/service/builtins/shell/runtime/ShellActionRuntime.js +3 -26
  466. package/bin/service/builtins/shell/runtime/ShellActionRuntime.js.map +1 -1
  467. package/bin/service/builtins/shell/runtime/ShellActionRuntimeSupport.d.ts +4 -32
  468. package/bin/service/builtins/shell/runtime/ShellActionRuntimeSupport.d.ts.map +1 -1
  469. package/bin/service/builtins/shell/runtime/ShellActionRuntimeSupport.js +3 -131
  470. package/bin/service/builtins/shell/runtime/ShellActionRuntimeSupport.js.map +1 -1
  471. package/bin/service/builtins/shell/runtime/ShellProcessEvents.d.ts +22 -0
  472. package/bin/service/builtins/shell/runtime/ShellProcessEvents.d.ts.map +1 -0
  473. package/bin/service/builtins/shell/runtime/ShellProcessEvents.js +41 -0
  474. package/bin/service/builtins/shell/runtime/ShellProcessEvents.js.map +1 -0
  475. package/bin/service/builtins/shell/runtime/ShellRuntimeEnvironment.d.ts +21 -0
  476. package/bin/service/builtins/shell/runtime/ShellRuntimeEnvironment.d.ts.map +1 -0
  477. package/bin/service/builtins/shell/runtime/ShellRuntimeEnvironment.js +75 -0
  478. package/bin/service/builtins/shell/runtime/ShellRuntimeEnvironment.js.map +1 -0
  479. package/bin/service/builtins/task/Action.d.ts +1 -1
  480. package/bin/service/builtins/task/Action.d.ts.map +1 -1
  481. package/bin/service/builtins/task/Scheduler.d.ts +1 -1
  482. package/bin/service/builtins/task/Scheduler.d.ts.map +1 -1
  483. package/bin/service/builtins/task/TaskService.d.ts +2 -2
  484. package/bin/service/builtins/task/TaskService.d.ts.map +1 -1
  485. package/bin/service/builtins/task/runtime/CronRuntime.d.ts +1 -1
  486. package/bin/service/builtins/task/runtime/CronRuntime.d.ts.map +1 -1
  487. package/bin/service/builtins/task/runtime/Model.d.ts +1 -1
  488. package/bin/service/builtins/task/runtime/Model.d.ts.map +1 -1
  489. package/bin/service/builtins/task/runtime/Paths.d.ts +1 -1
  490. package/bin/service/builtins/task/runtime/Paths.js +1 -1
  491. package/bin/service/builtins/task/runtime/Runner.d.ts +1 -1
  492. package/bin/service/builtins/task/runtime/Runner.d.ts.map +1 -1
  493. package/bin/service/builtins/task/runtime/Runner.js +17 -64
  494. package/bin/service/builtins/task/runtime/Runner.js.map +1 -1
  495. package/bin/service/builtins/task/runtime/TaskActionExecution.d.ts +1 -1
  496. package/bin/service/builtins/task/runtime/TaskActionExecution.d.ts.map +1 -1
  497. package/bin/service/builtins/task/runtime/TaskActionInput.d.ts +1 -1
  498. package/bin/service/builtins/task/runtime/TaskActionInput.d.ts.map +1 -1
  499. package/bin/service/builtins/task/runtime/TaskRunChatDispatch.d.ts +1 -1
  500. package/bin/service/builtins/task/runtime/TaskRunChatDispatch.d.ts.map +1 -1
  501. package/bin/service/builtins/task/runtime/TaskRunnerRound.d.ts +2 -2
  502. package/bin/service/builtins/task/runtime/TaskRunnerRound.d.ts.map +1 -1
  503. package/bin/service/builtins/task/runtime/TaskRunnerRound.js +1 -1
  504. package/bin/service/builtins/task/runtime/TaskRunnerRound.js.map +1 -1
  505. package/bin/service/builtins/task/runtime/TaskRunnerScript.d.ts +81 -0
  506. package/bin/service/builtins/task/runtime/TaskRunnerScript.d.ts.map +1 -0
  507. package/bin/service/builtins/task/runtime/TaskRunnerScript.js +96 -0
  508. package/bin/service/builtins/task/runtime/TaskRunnerScript.js.map +1 -0
  509. package/bin/service/builtins/task/runtime/TaskRunnerSession.d.ts +1 -1
  510. package/bin/service/builtins/task/runtime/TaskRunnerSession.d.ts.map +1 -1
  511. package/bin/service/core/Manager.d.ts +3 -3
  512. package/bin/service/core/Manager.js +3 -3
  513. package/bin/service/core/ServiceActionApi.d.ts +1 -1
  514. package/bin/service/core/ServiceActionApi.d.ts.map +1 -1
  515. package/bin/service/core/ServiceActionRunner.d.ts +2 -2
  516. package/bin/service/core/ServiceActionRunner.d.ts.map +1 -1
  517. package/bin/service/core/ServiceClassRegistry.d.ts +1 -1
  518. package/bin/service/core/ServiceClassRegistry.d.ts.map +1 -1
  519. package/bin/service/core/ServiceManager.d.ts +2 -2
  520. package/bin/service/core/ServiceManager.js +2 -2
  521. package/bin/service/core/ServiceStateController.d.ts +1 -1
  522. package/bin/service/core/ServiceStateController.d.ts.map +1 -1
  523. package/bin/service/core/ServiceStateController.js +1 -1
  524. package/bin/service/core/ServiceStateController.js.map +1 -1
  525. package/bin/service/core/ServiceSystemProviders.d.ts +1 -1
  526. package/bin/service/core/ServiceSystemProviders.d.ts.map +1 -1
  527. package/bin/service/core/Services.d.ts +1 -1
  528. package/bin/service/core/Services.d.ts.map +1 -1
  529. package/bin/service/schedule/Executor.d.ts +1 -1
  530. package/bin/service/schedule/Executor.d.ts.map +1 -1
  531. package/bin/service/schedule/Runtime.d.ts +1 -1
  532. package/bin/service/schedule/Runtime.d.ts.map +1 -1
  533. package/bin/service/types/Service.d.ts +2 -2
  534. package/bin/service/types/Service.d.ts.map +1 -1
  535. package/bin/service/types/ServiceSchedule.d.ts +1 -1
  536. package/bin/service/types/ServiceSchedule.d.ts.map +1 -1
  537. package/bin/service/types/ServiceState.d.ts +1 -1
  538. package/bin/service/types/ServiceState.js +1 -1
  539. package/bin/service/types/Services.d.ts +1 -1
  540. package/bin/service/types/Services.d.ts.map +1 -1
  541. package/bin/session/Session.d.ts +1 -1
  542. package/bin/session/Session.d.ts.map +1 -1
  543. package/bin/session/composer/history/SessionHistoryWriter.d.ts +1 -1
  544. package/bin/session/composer/history/SessionHistoryWriter.d.ts.map +1 -1
  545. package/bin/session/composer/system/default/DefaultSessionSystemComposer.d.ts +1 -1
  546. package/bin/session/composer/system/default/DefaultSessionSystemComposer.d.ts.map +1 -1
  547. package/bin/session/composer/system/default/SystemDomain.d.ts +1 -1
  548. package/bin/session/composer/system/default/SystemDomain.d.ts.map +1 -1
  549. package/bin/session/executors/local/LocalSessionCore.d.ts +1 -9
  550. package/bin/session/executors/local/LocalSessionCore.d.ts.map +1 -1
  551. package/bin/session/executors/local/LocalSessionCore.js +8 -392
  552. package/bin/session/executors/local/LocalSessionCore.js.map +1 -1
  553. package/bin/session/executors/local/SessionExecutionError.d.ts +26 -0
  554. package/bin/session/executors/local/SessionExecutionError.d.ts.map +1 -0
  555. package/bin/session/executors/local/SessionExecutionError.js +34 -0
  556. package/bin/session/executors/local/SessionExecutionError.js.map +1 -0
  557. package/bin/session/executors/local/SessionModelMessageState.d.ts +63 -0
  558. package/bin/session/executors/local/SessionModelMessageState.d.ts.map +1 -0
  559. package/bin/session/executors/local/SessionModelMessageState.js +90 -0
  560. package/bin/session/executors/local/SessionModelMessageState.js.map +1 -0
  561. package/bin/session/executors/local/SessionSignals.d.ts +1 -1
  562. package/bin/session/executors/local/SessionSignals.d.ts.map +1 -1
  563. package/bin/session/executors/local/SessionToolLoopRunner.d.ts +44 -0
  564. package/bin/session/executors/local/SessionToolLoopRunner.d.ts.map +1 -0
  565. package/bin/session/executors/local/SessionToolLoopRunner.js +261 -0
  566. package/bin/session/executors/local/SessionToolLoopRunner.js.map +1 -0
  567. package/bin/session/executors/local/SessionUiStreamCollector.d.ts +33 -0
  568. package/bin/session/executors/local/SessionUiStreamCollector.d.ts.map +1 -0
  569. package/bin/session/executors/local/SessionUiStreamCollector.js +64 -0
  570. package/bin/session/executors/local/SessionUiStreamCollector.js.map +1 -0
  571. package/bin/session/tools/shell/ShellToolBridge.d.ts +2 -2
  572. package/bin/session/tools/shell/ShellToolBridge.d.ts.map +1 -1
  573. package/bin/session/tools/shell/ShellToolDefinition.d.ts +1 -1
  574. package/bin/session/tools/shell/ShellToolDefinition.d.ts.map +1 -1
  575. package/bin/session/tools/shell/ShellToolFormatting.js +1 -1
  576. package/bin/session/tools/shell/ShellToolFormatting.js.map +1 -1
  577. package/bin/session/types/SessionHistoryMeta.d.ts +2 -0
  578. package/bin/session/types/SessionHistoryMeta.d.ts.map +1 -1
  579. package/bin/session/types/SessionMessages.d.ts +1 -1
  580. package/bin/session/types/SessionMessages.d.ts.map +1 -1
  581. package/bin/transport/rpc/Client.d.ts.map +1 -0
  582. package/bin/transport/rpc/Client.js.map +1 -0
  583. package/bin/transport/rpc/Paths.d.ts.map +1 -0
  584. package/bin/{host → transport}/rpc/Paths.js +21 -2
  585. package/bin/transport/rpc/Paths.js.map +1 -0
  586. package/bin/transport/rpc/Transport.d.ts.map +1 -0
  587. package/bin/transport/rpc/Transport.js.map +1 -0
  588. package/bin/types/auth/AuthPermission.d.ts.map +1 -0
  589. package/bin/types/auth/AuthPermission.js.map +1 -0
  590. package/bin/types/auth/AuthRoute.d.ts.map +1 -0
  591. package/bin/types/auth/AuthRoute.js.map +1 -0
  592. package/bin/types/auth/AuthToken.d.ts.map +1 -0
  593. package/bin/types/auth/AuthToken.js.map +1 -0
  594. package/bin/types/auth/AuthTypes.d.ts.map +1 -0
  595. package/bin/types/auth/AuthTypes.js.map +1 -0
  596. package/bin/types/common/Json.d.ts.map +1 -0
  597. package/bin/types/common/Json.js.map +1 -0
  598. package/bin/types/common/Template.d.ts.map +1 -0
  599. package/bin/types/common/Template.js.map +1 -0
  600. package/bin/{config/types → types/config}/DowncityConfig.d.ts +3 -3
  601. package/bin/{config/types → types/config}/DowncityConfig.d.ts.map +1 -1
  602. package/bin/types/config/DowncityConfig.js.map +1 -0
  603. package/bin/{config/types → types/config}/ExecutionBinding.d.ts.map +1 -1
  604. package/bin/types/config/ExecutionBinding.js.map +1 -0
  605. package/bin/{config/types → types/config}/LlmConfig.d.ts.map +1 -1
  606. package/bin/types/config/LlmConfig.js.map +1 -0
  607. package/bin/{config/types → types/config}/ModelBinding.d.ts.map +1 -1
  608. package/bin/types/config/ModelBinding.js.map +1 -0
  609. package/bin/{config/types → types/config}/Start.d.ts.map +1 -1
  610. package/bin/types/config/Start.js.map +1 -0
  611. package/bin/{host/daemon/types → types/daemon}/Daemon.d.ts +1 -1
  612. package/bin/types/daemon/Daemon.d.ts.map +1 -0
  613. package/bin/{host/daemon/types → types/daemon}/Daemon.js +1 -1
  614. package/bin/types/daemon/Daemon.js.map +1 -0
  615. package/bin/{host/types → types/host}/AgentHost.d.ts +6 -6
  616. package/bin/{host/types → types/host}/AgentHost.d.ts.map +1 -1
  617. package/bin/types/host/AgentHost.js +10 -0
  618. package/bin/types/host/AgentHost.js.map +1 -0
  619. package/bin/{host/types → types/host}/Store.d.ts +1 -1
  620. package/bin/{host/types → types/host}/Store.d.ts.map +1 -1
  621. package/bin/{host/types → types/host}/Store.js.map +1 -1
  622. package/bin/types/http/InlineInstant.d.ts.map +1 -0
  623. package/bin/types/http/InlineInstant.js.map +1 -0
  624. package/bin/types/platform/Platform.d.ts.map +1 -0
  625. package/bin/types/platform/Platform.js.map +1 -0
  626. package/bin/types/platform/PlatformGateway.d.ts.map +1 -0
  627. package/bin/types/platform/PlatformGateway.js.map +1 -0
  628. package/bin/{host/rpc/types → types/rpc}/LocalRpc.d.ts +2 -2
  629. package/bin/types/rpc/LocalRpc.d.ts.map +1 -0
  630. package/bin/types/rpc/LocalRpc.js.map +1 -0
  631. package/bin/utils/Template.d.ts +1 -1
  632. package/bin/utils/Template.d.ts.map +1 -1
  633. package/bin/utils/logger/Fetch.d.ts +1 -1
  634. package/bin/utils/logger/Fetch.d.ts.map +1 -1
  635. package/bin/utils/logger/FormatRequest.d.ts +1 -1
  636. package/bin/utils/logger/FormatRequest.d.ts.map +1 -1
  637. package/bin/utils/logger/FormatRequest.js +1 -1
  638. package/bin/utils/logger/FormatRequest.js.map +1 -1
  639. package/bin/utils/logger/FormatResponse.d.ts +1 -1
  640. package/bin/utils/logger/FormatResponse.d.ts.map +1 -1
  641. package/bin/utils/logger/FormatShared.d.ts +1 -1
  642. package/bin/utils/logger/FormatShared.d.ts.map +1 -1
  643. package/bin/utils/logger/Logger.d.ts +1 -1
  644. package/bin/utils/logger/Logger.d.ts.map +1 -1
  645. package/bin/utils/storage/index.d.ts +1 -1
  646. package/bin/utils/storage/index.d.ts.map +1 -1
  647. package/package.json +1 -1
  648. package/src/config/Config.ts +6 -7
  649. package/src/config/DowncityDefault.ts +1 -1
  650. package/src/config/DowncitySchema.ts +1 -1
  651. package/src/config/Paths.ts +2 -2
  652. package/src/host/daemon/Api.ts +2 -2
  653. package/src/host/daemon/Client.ts +3 -3
  654. package/src/host/daemon/Paths.ts +33 -0
  655. package/src/host/daemon/ProjectSetup.ts +2 -2
  656. package/src/host/runtime/AgentHostRuntime.ts +4 -4
  657. package/src/host/runtime/PluginRuntime.ts +1 -1
  658. package/src/index.ts +280 -159
  659. package/src/model/CreateModel.ts +4 -4
  660. package/src/model/ModelManager.ts +1 -1
  661. package/src/plugin/builtins/asr/Config.ts +138 -0
  662. package/src/plugin/builtins/asr/Dependency.ts +1 -1
  663. package/src/plugin/builtins/asr/InboundAugment.ts +59 -0
  664. package/src/plugin/builtins/asr/Plugin.ts +9 -160
  665. package/src/plugin/builtins/auth/Plugin.ts +1 -1
  666. package/src/plugin/builtins/auth/runtime/AuthorizationConfig.ts +1 -1
  667. package/src/plugin/builtins/auth/runtime/AuthorizationPolicy.ts +2 -2
  668. package/src/plugin/builtins/auth/runtime/AuthorizationStore.ts +1 -1
  669. package/src/plugin/builtins/skill/Action.ts +1 -1
  670. package/src/plugin/builtins/skill/Config.ts +1 -1
  671. package/src/plugin/builtins/skill/Plugin.ts +1 -1
  672. package/src/plugin/builtins/skill/runtime/Discovery.ts +1 -1
  673. package/src/plugin/builtins/skill/runtime/SystemProvider.ts +1 -1
  674. package/src/plugin/builtins/skill/types/ClaudeSkill.ts +1 -1
  675. package/src/plugin/builtins/tts/Dependency.ts +1 -1
  676. package/src/plugin/builtins/tts/Plugin.ts +6 -63
  677. package/src/plugin/builtins/tts/PluginSupport.ts +85 -0
  678. package/src/plugin/builtins/tts/types/TtsPlugin.ts +1 -1
  679. package/src/plugin/builtins/voice/Config.ts +135 -0
  680. package/src/plugin/builtins/voice/Dependency.ts +1 -1
  681. package/src/plugin/builtins/voice/InboundAugment.ts +59 -0
  682. package/src/plugin/builtins/voice/Plugin.ts +9 -158
  683. package/src/plugin/builtins/voice/types/VoicePlugin.ts +1 -1
  684. package/src/plugin/builtins/web/Plugin.ts +1 -1
  685. package/src/plugin/builtins/web/runtime/Config.ts +1 -1
  686. package/src/plugin/builtins/web/runtime/Source.ts +1 -1
  687. package/src/plugin/builtins/web/types/WebPlugin.ts +1 -1
  688. package/src/plugin/builtins/workboard/runtime/Collector.ts +2 -2
  689. package/src/plugin/builtins/workboard/runtime/Normalizer.ts +2 -2
  690. package/src/plugin/builtins/workboard/runtime/Store.ts +1 -1
  691. package/src/plugin/core/Activation.ts +2 -2
  692. package/src/plugin/core/HookRegistry.ts +2 -2
  693. package/src/plugin/core/HttpRoutes.ts +2 -2
  694. package/src/plugin/core/LocalExecution.ts +2 -2
  695. package/src/plugin/core/PluginCommand.ts +1 -1
  696. package/src/plugin/core/PluginManager.ts +2 -2
  697. package/src/plugin/core/PluginRegistry.ts +2 -2
  698. package/src/plugin/core/ProjectConfigStore.ts +1 -1
  699. package/src/plugin/types/Plugin.ts +5 -5
  700. package/src/plugin/types/PluginApi.ts +1 -1
  701. package/src/{agent/project → project}/AgentInitializer.ts +4 -4
  702. package/src/{agent/project → project}/ProjectExecutionBinding.ts +2 -2
  703. package/src/{agent/project → project}/types/AgentProject.ts +2 -2
  704. package/src/{agent → runtime}/AgentContext.ts +4 -4
  705. package/src/{agent → runtime}/AgentContextTypes.ts +4 -4
  706. package/src/{agent → runtime}/AgentRuntime.ts +8 -8
  707. package/src/{agent → runtime}/AgentRuntimeState.ts +4 -4
  708. package/src/{agent → runtime}/AgentRuntimeTypes.ts +2 -2
  709. package/src/sandbox/SandboxConfigResolver.ts +1 -1
  710. package/src/sandbox/SandboxRunner.ts +1 -1
  711. package/src/{host/sdk → sdk}/Agent.ts +80 -28
  712. package/src/{host/sdk → sdk}/AgentSdkTypes.ts +115 -2
  713. package/src/{host/sdk → sdk}/HttpServer.ts +10 -1
  714. package/src/{host/sdk → sdk}/RemoteAgent.ts +25 -1
  715. package/src/{host/sdk → sdk}/RpcServer.ts +21 -3
  716. package/src/sdk/SdkSessionSystemComposer.ts +261 -0
  717. package/src/{host/sdk → sdk}/Session.ts +103 -178
  718. package/src/{host/sdk → sdk}/SessionMetadata.ts +19 -1
  719. package/src/sdk/SessionPersistence.ts +113 -0
  720. package/src/sdk/SessionServicePort.ts +62 -0
  721. package/src/{host/sdk → sdk}/StreamEvents.ts +45 -2
  722. package/src/{host → server}/http/Server.ts +7 -7
  723. package/src/{host → server}/http/control/AuthControlService.ts +3 -3
  724. package/src/{host → server}/http/control/ControlApiRoutes.ts +6 -6
  725. package/src/{host → server}/http/control/ControlAuthorizationRoutes.ts +3 -3
  726. package/src/{host → server}/http/control/ControlRouter.ts +3 -3
  727. package/src/{host → server}/http/control/ExecuteBySession.ts +4 -4
  728. package/src/{host → server}/http/control/ExecuteInput.ts +1 -1
  729. package/src/{host → server}/http/control/MessageTimeline.ts +1 -1
  730. package/src/{host → server}/http/control/ModelRoutes.ts +2 -2
  731. package/src/{host → server}/http/control/OverviewRoutes.ts +1 -1
  732. package/src/{host → server}/http/control/SessionRoutes.ts +2 -2
  733. package/src/{host → server}/http/control/SessionSummaryStore.ts +2 -2
  734. package/src/{host → server}/http/control/TaskRoutes.ts +1 -1
  735. package/src/{host → server}/http/control/TaskStore.ts +1 -1
  736. package/src/{host → server}/http/control/types/ControlRoutes.ts +2 -2
  737. package/src/{host → server}/http/control/types/ControlViewData.ts +1 -1
  738. package/src/{host → server}/http/execute/execute.ts +1 -1
  739. package/src/{host → server}/http/plugins/plugins.ts +1 -1
  740. package/src/{host → server}/http/services/services.ts +1 -1
  741. package/src/{host → server}/http/static/static.ts +1 -1
  742. package/src/{host → server}/rpc/Server.ts +7 -7
  743. package/src/service/builtins/BaseService.ts +2 -2
  744. package/src/service/builtins/README.md +32 -11
  745. package/src/service/builtins/chat/Action.ts +1 -1
  746. package/src/service/builtins/chat/ChatService.ts +3 -3
  747. package/src/service/builtins/chat/ChatServiceTypes.ts +2 -2
  748. package/src/service/builtins/chat/accounts/ChannelAccountService.ts +2 -2
  749. package/src/service/builtins/chat/channels/BaseChatChannel.ts +1 -1
  750. package/src/service/builtins/chat/channels/BaseChatChannelQueue.ts +2 -2
  751. package/src/service/builtins/chat/channels/BaseChatChannelSupport.ts +2 -2
  752. package/src/service/builtins/chat/channels/feishu/Feishu.ts +65 -232
  753. package/src/service/builtins/chat/channels/feishu/FeishuMessageHandler.ts +483 -0
  754. package/src/service/builtins/chat/channels/feishu/FeishuPlatformClient.ts +1 -1
  755. package/src/service/builtins/chat/channels/feishu/FeishuPlatformLookup.ts +1 -1
  756. package/src/service/builtins/chat/channels/feishu/types/FeishuChannel.ts +1 -1
  757. package/src/service/builtins/chat/channels/qq/QQ.ts +56 -291
  758. package/src/service/builtins/chat/channels/qq/QQGatewayClient.ts +76 -250
  759. package/src/service/builtins/chat/channels/qq/QQGatewayConnection.ts +175 -0
  760. package/src/service/builtins/chat/channels/qq/QQGatewayHeartbeat.ts +114 -0
  761. package/src/service/builtins/chat/channels/qq/QQGatewayProtocol.ts +176 -0
  762. package/src/service/builtins/chat/channels/qq/QQGatewaySupport.ts +1 -1
  763. package/src/service/builtins/chat/channels/qq/QQInbound.ts +1 -1
  764. package/src/service/builtins/chat/channels/qq/QQMessageHandler.ts +465 -0
  765. package/src/service/builtins/chat/channels/qq/QQSendSupport.ts +1 -1
  766. package/src/service/builtins/chat/channels/qq/QQSupport.ts +2 -2
  767. package/src/service/builtins/chat/channels/qq/types/QqChannel.ts +2 -2
  768. package/src/service/builtins/chat/channels/telegram/Bot.ts +57 -352
  769. package/src/service/builtins/chat/channels/telegram/StateStore.ts +1 -1
  770. package/src/service/builtins/chat/channels/telegram/TelegramMessageHandler.ts +485 -0
  771. package/src/service/builtins/chat/channels/telegram/TelegramPendingUpdates.ts +204 -0
  772. package/src/service/builtins/chat/channels/telegram/TelegramPlatformClient.ts +1 -1
  773. package/src/service/builtins/chat/runtime/ChannelContextStore.ts +1 -1
  774. package/src/service/builtins/chat/runtime/ChatActionExecution.ts +2 -2
  775. package/src/service/builtins/chat/runtime/ChatActionInput.ts +14 -281
  776. package/src/service/builtins/chat/runtime/ChatActionInputSupport.ts +85 -0
  777. package/src/service/builtins/chat/runtime/ChatChannelActions.ts +1 -1
  778. package/src/service/builtins/chat/runtime/ChatChannelConfig.ts +3 -3
  779. package/src/service/builtins/chat/runtime/ChatChannelCore.ts +2 -2
  780. package/src/service/builtins/chat/runtime/ChatChannelLifecycle.ts +1 -1
  781. package/src/service/builtins/chat/runtime/ChatHistoryStore.ts +2 -2
  782. package/src/service/builtins/chat/runtime/ChatIngressStore.ts +2 -2
  783. package/src/service/builtins/chat/runtime/ChatMetaStore.ts +3 -3
  784. package/src/service/builtins/chat/runtime/ChatQueueReplyDispatch.ts +1 -1
  785. package/src/service/builtins/chat/runtime/ChatQueueSessionBridge.ts +2 -2
  786. package/src/service/builtins/chat/runtime/ChatQueueStore.ts +1 -1
  787. package/src/service/builtins/chat/runtime/ChatQueueWorker.ts +2 -2
  788. package/src/service/builtins/chat/runtime/ChatSendActionInput.ts +255 -0
  789. package/src/service/builtins/chat/runtime/ChatServiceActions.ts +1 -1
  790. package/src/service/builtins/chat/runtime/ChatServiceSystem.ts +1 -1
  791. package/src/service/builtins/chat/runtime/ChatSessionDelete.ts +1 -1
  792. package/src/service/builtins/chat/runtime/ChatkeySend.ts +2 -2
  793. package/src/service/builtins/chat/runtime/EnqueueDispatch.ts +2 -2
  794. package/src/service/builtins/chat/runtime/InboundAugment.ts +2 -2
  795. package/src/service/builtins/chat/runtime/PluginDispatch.ts +2 -2
  796. package/src/service/builtins/chat/runtime/ReplyContextFormatter.ts +1 -1
  797. package/src/service/builtins/chat/runtime/ReplyDispatch.ts +2 -2
  798. package/src/service/builtins/chat/runtime/SystemPrompt.ts +1 -1
  799. package/src/service/builtins/chat/runtime/UIMessageTransformer.ts +1 -1
  800. package/src/service/builtins/chat/types/ChannelAccount.ts +1 -1
  801. package/src/service/builtins/chat/types/ChatHistory.ts +1 -1
  802. package/src/service/builtins/chat/types/ChatMeta.ts +1 -1
  803. package/src/service/builtins/chat/types/ChatQueue.ts +1 -1
  804. package/src/service/builtins/chat/types/ChatService.ts +1 -1
  805. package/src/service/builtins/contact/Action.ts +368 -4
  806. package/src/service/builtins/contact/ContactService.ts +30 -324
  807. package/src/service/builtins/contact/runtime/ChatRuntime.ts +1 -1
  808. package/src/service/builtins/contact/runtime/ContactPayload.ts +38 -0
  809. package/src/service/builtins/contact/runtime/RemoteClient.ts +1 -1
  810. package/src/service/builtins/contact/runtime/ShareBundle.ts +1 -1
  811. package/src/service/builtins/memory/Action.ts +2 -2
  812. package/src/service/builtins/memory/MemoryService.ts +2 -2
  813. package/src/service/builtins/memory/runtime/Flush.ts +1 -1
  814. package/src/service/builtins/memory/runtime/Search.ts +1 -1
  815. package/src/service/builtins/memory/runtime/Store.ts +1 -1
  816. package/src/service/builtins/memory/runtime/SystemProvider.ts +1 -1
  817. package/src/service/builtins/memory/runtime/Writer.ts +1 -1
  818. package/src/service/builtins/memory/types/Memory.ts +1 -1
  819. package/src/service/builtins/shell/ShellRuntimeTypes.ts +1 -1
  820. package/src/service/builtins/shell/ShellService.ts +2 -2
  821. package/src/service/builtins/shell/runtime/ShellActionResponse.ts +135 -0
  822. package/src/service/builtins/shell/runtime/ShellActionRuntime.ts +3 -38
  823. package/src/service/builtins/shell/runtime/ShellActionRuntimeSupport.ts +11 -165
  824. package/src/service/builtins/shell/runtime/ShellProcessEvents.ts +65 -0
  825. package/src/service/builtins/shell/runtime/ShellRuntimeEnvironment.ts +75 -0
  826. package/src/service/builtins/task/Action.ts +2 -2
  827. package/src/service/builtins/task/Scheduler.ts +1 -1
  828. package/src/service/builtins/task/TaskService.ts +2 -2
  829. package/src/service/builtins/task/runtime/CronRuntime.ts +1 -1
  830. package/src/service/builtins/task/runtime/Model.ts +1 -1
  831. package/src/service/builtins/task/runtime/Paths.ts +1 -1
  832. package/src/service/builtins/task/runtime/Runner.ts +17 -63
  833. package/src/service/builtins/task/runtime/TaskActionExecution.ts +1 -1
  834. package/src/service/builtins/task/runtime/TaskActionInput.ts +1 -1
  835. package/src/service/builtins/task/runtime/TaskRunChatDispatch.ts +1 -1
  836. package/src/service/builtins/task/runtime/TaskRunnerRound.ts +3 -3
  837. package/src/service/builtins/task/runtime/TaskRunnerScript.ts +175 -0
  838. package/src/service/builtins/task/runtime/TaskRunnerSession.ts +1 -1
  839. package/src/service/core/Manager.ts +3 -3
  840. package/src/service/core/ServiceActionApi.ts +2 -2
  841. package/src/service/core/ServiceActionRunner.ts +2 -2
  842. package/src/service/core/ServiceClassRegistry.ts +1 -1
  843. package/src/service/core/ServiceManager.ts +2 -2
  844. package/src/service/core/ServiceStateController.ts +2 -2
  845. package/src/service/core/ServiceSystemProviders.ts +1 -1
  846. package/src/service/core/Services.ts +1 -1
  847. package/src/service/schedule/Executor.ts +1 -1
  848. package/src/service/schedule/Runtime.ts +1 -1
  849. package/src/service/schedule/Store.ts +1 -1
  850. package/src/service/types/Service.ts +2 -2
  851. package/src/service/types/ServiceSchedule.ts +1 -1
  852. package/src/service/types/ServiceState.ts +1 -1
  853. package/src/service/types/Services.ts +1 -1
  854. package/src/session/Session.ts +1 -1
  855. package/src/session/composer/history/SessionHistoryWriter.ts +1 -1
  856. package/src/session/composer/system/default/DefaultSessionSystemComposer.ts +1 -1
  857. package/src/session/composer/system/default/SystemDomain.ts +1 -1
  858. package/src/session/executors/local/LocalSessionCore.ts +10 -498
  859. package/src/session/executors/local/SessionExecutionError.ts +47 -0
  860. package/src/session/executors/local/SessionModelMessageState.ts +133 -0
  861. package/src/session/executors/local/SessionSignals.ts +1 -1
  862. package/src/session/executors/local/SessionToolLoopRunner.ts +350 -0
  863. package/src/session/executors/local/SessionUiStreamCollector.ts +96 -0
  864. package/src/session/messages/SessionStepEventMapper.ts +1 -1
  865. package/src/session/tools/shell/ShellToolBridge.ts +2 -2
  866. package/src/session/tools/shell/ShellToolDefinition.ts +1 -1
  867. package/src/session/tools/shell/ShellToolFormatting.ts +1 -1
  868. package/src/session/types/SessionHistoryMeta.ts +2 -0
  869. package/src/session/types/SessionMessages.ts +1 -1
  870. package/src/{host → transport}/rpc/Client.ts +1 -1
  871. package/src/{host → transport}/rpc/Paths.ts +22 -2
  872. package/src/{config/types → types/config}/DowncityConfig.ts +3 -3
  873. package/src/{host/daemon/types → types/daemon}/Daemon.ts +1 -1
  874. package/src/{host/types → types/host}/AgentHost.ts +6 -6
  875. package/src/{host/types → types/host}/Store.ts +1 -1
  876. package/src/{host/rpc/types → types/rpc}/LocalRpc.ts +1 -1
  877. package/src/utils/Template.ts +1 -1
  878. package/src/utils/logger/Fetch.ts +1 -1
  879. package/src/utils/logger/FormatRequest.ts +2 -2
  880. package/src/utils/logger/FormatResponse.ts +1 -1
  881. package/src/utils/logger/FormatShared.ts +1 -1
  882. package/src/utils/logger/Logger.ts +1 -1
  883. package/src/utils/storage/index.ts +1 -1
  884. package/tsconfig.tsbuildinfo +1 -1
  885. package/bin/agent/AgentContext.d.ts.map +0 -1
  886. package/bin/agent/AgentContext.js.map +0 -1
  887. package/bin/agent/AgentContextTypes.d.ts.map +0 -1
  888. package/bin/agent/AgentContextTypes.js.map +0 -1
  889. package/bin/agent/AgentRuntime.d.ts.map +0 -1
  890. package/bin/agent/AgentRuntime.js.map +0 -1
  891. package/bin/agent/AgentRuntimeState.d.ts.map +0 -1
  892. package/bin/agent/AgentRuntimeState.js.map +0 -1
  893. package/bin/agent/AgentRuntimeTypes.d.ts.map +0 -1
  894. package/bin/agent/AgentRuntimeTypes.js.map +0 -1
  895. package/bin/agent/project/AgentInitializer.d.ts.map +0 -1
  896. package/bin/agent/project/AgentInitializer.js.map +0 -1
  897. package/bin/agent/project/ProjectExecutionBinding.d.ts.map +0 -1
  898. package/bin/agent/project/ProjectExecutionBinding.js.map +0 -1
  899. package/bin/agent/project/types/AgentProject.d.ts.map +0 -1
  900. package/bin/agent/project/types/AgentProject.js.map +0 -1
  901. package/bin/config/types/DowncityConfig.js.map +0 -1
  902. package/bin/config/types/ExecutionBinding.js.map +0 -1
  903. package/bin/config/types/LlmConfig.js.map +0 -1
  904. package/bin/config/types/ModelBinding.js.map +0 -1
  905. package/bin/config/types/Start.js.map +0 -1
  906. package/bin/host/daemon/Manager.d.ts +0 -92
  907. package/bin/host/daemon/Manager.d.ts.map +0 -1
  908. package/bin/host/daemon/Manager.js +0 -287
  909. package/bin/host/daemon/Manager.js.map +0 -1
  910. package/bin/host/daemon/types/Daemon.d.ts.map +0 -1
  911. package/bin/host/daemon/types/Daemon.js.map +0 -1
  912. package/bin/host/http/Server.d.ts.map +0 -1
  913. package/bin/host/http/Server.js.map +0 -1
  914. package/bin/host/http/auth/AuthEnv.d.ts.map +0 -1
  915. package/bin/host/http/auth/AuthEnv.js.map +0 -1
  916. package/bin/host/http/auth/AuthError.d.ts.map +0 -1
  917. package/bin/host/http/auth/AuthError.js.map +0 -1
  918. package/bin/host/http/auth/CliAuthStateStore.d.ts.map +0 -1
  919. package/bin/host/http/auth/CliAuthStateStore.js.map +0 -1
  920. package/bin/host/http/auth/PasswordHasher.d.ts.map +0 -1
  921. package/bin/host/http/auth/PasswordHasher.js.map +0 -1
  922. package/bin/host/http/auth/TokenService.d.ts.map +0 -1
  923. package/bin/host/http/auth/TokenService.js.map +0 -1
  924. package/bin/host/http/auth/types/AuthPermission.d.ts.map +0 -1
  925. package/bin/host/http/auth/types/AuthPermission.js.map +0 -1
  926. package/bin/host/http/auth/types/AuthRoute.d.ts.map +0 -1
  927. package/bin/host/http/auth/types/AuthRoute.js.map +0 -1
  928. package/bin/host/http/auth/types/AuthToken.d.ts.map +0 -1
  929. package/bin/host/http/auth/types/AuthToken.js.map +0 -1
  930. package/bin/host/http/auth/types/AuthTypes.d.ts.map +0 -1
  931. package/bin/host/http/auth/types/AuthTypes.js.map +0 -1
  932. package/bin/host/http/control/AuthControlService.d.ts.map +0 -1
  933. package/bin/host/http/control/AuthControlService.js.map +0 -1
  934. package/bin/host/http/control/CommonHelpers.d.ts.map +0 -1
  935. package/bin/host/http/control/CommonHelpers.js.map +0 -1
  936. package/bin/host/http/control/ControlApiRoutes.d.ts.map +0 -1
  937. package/bin/host/http/control/ControlApiRoutes.js.map +0 -1
  938. package/bin/host/http/control/ControlAuthorizationRoutes.d.ts.map +0 -1
  939. package/bin/host/http/control/ControlAuthorizationRoutes.js.map +0 -1
  940. package/bin/host/http/control/ControlRouter.d.ts.map +0 -1
  941. package/bin/host/http/control/ControlRouter.js.map +0 -1
  942. package/bin/host/http/control/ExecuteBySession.d.ts.map +0 -1
  943. package/bin/host/http/control/ExecuteBySession.js.map +0 -1
  944. package/bin/host/http/control/ExecuteInput.d.ts.map +0 -1
  945. package/bin/host/http/control/ExecuteInput.js.map +0 -1
  946. package/bin/host/http/control/Helpers.js.map +0 -1
  947. package/bin/host/http/control/MessageTimeline.d.ts.map +0 -1
  948. package/bin/host/http/control/MessageTimeline.js.map +0 -1
  949. package/bin/host/http/control/ModelRoutes.d.ts.map +0 -1
  950. package/bin/host/http/control/ModelRoutes.js.map +0 -1
  951. package/bin/host/http/control/OverviewRoutes.d.ts.map +0 -1
  952. package/bin/host/http/control/OverviewRoutes.js.map +0 -1
  953. package/bin/host/http/control/SessionRoutes.d.ts.map +0 -1
  954. package/bin/host/http/control/SessionRoutes.js.map +0 -1
  955. package/bin/host/http/control/SessionSummaryStore.d.ts.map +0 -1
  956. package/bin/host/http/control/SessionSummaryStore.js.map +0 -1
  957. package/bin/host/http/control/TaskRoutes.d.ts.map +0 -1
  958. package/bin/host/http/control/TaskRoutes.js.map +0 -1
  959. package/bin/host/http/control/TaskStore.d.ts.map +0 -1
  960. package/bin/host/http/control/TaskStore.js.map +0 -1
  961. package/bin/host/http/control/types/AuthControl.d.ts.map +0 -1
  962. package/bin/host/http/control/types/AuthControl.js.map +0 -1
  963. package/bin/host/http/control/types/ControlRoutes.d.ts.map +0 -1
  964. package/bin/host/http/control/types/ControlRoutes.js.map +0 -1
  965. package/bin/host/http/control/types/ControlSessionExecute.d.ts.map +0 -1
  966. package/bin/host/http/control/types/ControlSessionExecute.js.map +0 -1
  967. package/bin/host/http/control/types/ControlViewData.d.ts.map +0 -1
  968. package/bin/host/http/control/types/ControlViewData.js.map +0 -1
  969. package/bin/host/http/execute/execute.d.ts.map +0 -1
  970. package/bin/host/http/execute/execute.js.map +0 -1
  971. package/bin/host/http/execute/types/InlineInstant.d.ts.map +0 -1
  972. package/bin/host/http/execute/types/InlineInstant.js.map +0 -1
  973. package/bin/host/http/health/health.d.ts.map +0 -1
  974. package/bin/host/http/health/health.js.map +0 -1
  975. package/bin/host/http/plugins/plugins.d.ts.map +0 -1
  976. package/bin/host/http/plugins/plugins.js.map +0 -1
  977. package/bin/host/http/services/services.d.ts.map +0 -1
  978. package/bin/host/http/services/services.js.map +0 -1
  979. package/bin/host/http/static/static.d.ts.map +0 -1
  980. package/bin/host/http/static/static.js.map +0 -1
  981. package/bin/host/rpc/Client.d.ts.map +0 -1
  982. package/bin/host/rpc/Client.js.map +0 -1
  983. package/bin/host/rpc/Paths.d.ts.map +0 -1
  984. package/bin/host/rpc/Paths.js.map +0 -1
  985. package/bin/host/rpc/Server.d.ts.map +0 -1
  986. package/bin/host/rpc/Server.js.map +0 -1
  987. package/bin/host/rpc/Transport.d.ts.map +0 -1
  988. package/bin/host/rpc/Transport.js.map +0 -1
  989. package/bin/host/rpc/types/LocalRpc.d.ts.map +0 -1
  990. package/bin/host/rpc/types/LocalRpc.js.map +0 -1
  991. package/bin/host/runtime/CityPaths.d.ts +0 -50
  992. package/bin/host/runtime/CityPaths.d.ts.map +0 -1
  993. package/bin/host/runtime/CityPaths.js +0 -75
  994. package/bin/host/runtime/CityPaths.js.map +0 -1
  995. package/bin/host/runtime/CityRegistry.d.ts +0 -51
  996. package/bin/host/runtime/CityRegistry.d.ts.map +0 -1
  997. package/bin/host/runtime/CityRegistry.js +0 -217
  998. package/bin/host/runtime/CityRegistry.js.map +0 -1
  999. package/bin/host/runtime/CityRuntime.d.ts +0 -21
  1000. package/bin/host/runtime/CityRuntime.d.ts.map +0 -1
  1001. package/bin/host/runtime/CityRuntime.js +0 -45
  1002. package/bin/host/runtime/CityRuntime.js.map +0 -1
  1003. package/bin/host/runtime/ProcessSweep.d.ts +0 -76
  1004. package/bin/host/runtime/ProcessSweep.d.ts.map +0 -1
  1005. package/bin/host/runtime/ProcessSweep.js +0 -188
  1006. package/bin/host/runtime/ProcessSweep.js.map +0 -1
  1007. package/bin/host/runtime/types/Platform.d.ts.map +0 -1
  1008. package/bin/host/runtime/types/Platform.js.map +0 -1
  1009. package/bin/host/runtime/types/PlatformGateway.d.ts.map +0 -1
  1010. package/bin/host/runtime/types/PlatformGateway.js.map +0 -1
  1011. package/bin/host/sdk/Agent.d.ts.map +0 -1
  1012. package/bin/host/sdk/Agent.js.map +0 -1
  1013. package/bin/host/sdk/AgentSdkTypes.d.ts.map +0 -1
  1014. package/bin/host/sdk/AgentSdkTypes.js.map +0 -1
  1015. package/bin/host/sdk/AsyncQueue.d.ts.map +0 -1
  1016. package/bin/host/sdk/AsyncQueue.js.map +0 -1
  1017. package/bin/host/sdk/HttpServer.d.ts.map +0 -1
  1018. package/bin/host/sdk/HttpServer.js.map +0 -1
  1019. package/bin/host/sdk/Paths.d.ts.map +0 -1
  1020. package/bin/host/sdk/Paths.js.map +0 -1
  1021. package/bin/host/sdk/RemoteAgent.d.ts.map +0 -1
  1022. package/bin/host/sdk/RemoteAgent.js.map +0 -1
  1023. package/bin/host/sdk/RpcServer.d.ts.map +0 -1
  1024. package/bin/host/sdk/RpcServer.js.map +0 -1
  1025. package/bin/host/sdk/SdkSessionSystemComposer.d.ts +0 -43
  1026. package/bin/host/sdk/SdkSessionSystemComposer.d.ts.map +0 -1
  1027. package/bin/host/sdk/SdkSessionSystemComposer.js +0 -71
  1028. package/bin/host/sdk/SdkSessionSystemComposer.js.map +0 -1
  1029. package/bin/host/sdk/Session.d.ts.map +0 -1
  1030. package/bin/host/sdk/Session.js.map +0 -1
  1031. package/bin/host/sdk/SessionMetadata.d.ts.map +0 -1
  1032. package/bin/host/sdk/SessionMetadata.js.map +0 -1
  1033. package/bin/host/sdk/StreamEvents.d.ts +0 -14
  1034. package/bin/host/sdk/StreamEvents.d.ts.map +0 -1
  1035. package/bin/host/sdk/StreamEvents.js.map +0 -1
  1036. package/bin/host/types/AgentHost.js +0 -10
  1037. package/bin/host/types/AgentHost.js.map +0 -1
  1038. package/bin/utils/types/Json.d.ts.map +0 -1
  1039. package/bin/utils/types/Json.js.map +0 -1
  1040. package/bin/utils/types/Template.d.ts.map +0 -1
  1041. package/bin/utils/types/Template.js.map +0 -1
  1042. package/src/host/daemon/Manager.ts +0 -344
  1043. package/src/host/runtime/CityPaths.ts +0 -84
  1044. package/src/host/runtime/CityRegistry.ts +0 -256
  1045. package/src/host/runtime/CityRuntime.ts +0 -45
  1046. package/src/host/runtime/ProcessSweep.ts +0 -239
  1047. package/src/host/sdk/SdkSessionSystemComposer.ts +0 -113
  1048. /package/bin/{agent/project → project}/ProjectExecutionBinding.js +0 -0
  1049. /package/bin/{agent/project → project}/types/AgentProject.js +0 -0
  1050. /package/bin/{agent → runtime}/AgentContextTypes.js +0 -0
  1051. /package/bin/{agent → runtime}/AgentRuntimeState.js +0 -0
  1052. /package/bin/{agent → runtime}/AgentRuntimeTypes.js +0 -0
  1053. /package/bin/{host/sdk → sdk}/AgentSdkTypes.js +0 -0
  1054. /package/bin/{host/sdk → sdk}/AsyncQueue.d.ts +0 -0
  1055. /package/bin/{host/sdk → sdk}/AsyncQueue.js +0 -0
  1056. /package/bin/{host/sdk → sdk}/Paths.d.ts +0 -0
  1057. /package/bin/{host/sdk → sdk}/Paths.js +0 -0
  1058. /package/bin/{host → server}/http/Server.d.ts +0 -0
  1059. /package/bin/{host → server}/http/auth/AuthEnv.d.ts +0 -0
  1060. /package/bin/{host → server}/http/auth/AuthEnv.js +0 -0
  1061. /package/bin/{host → server}/http/auth/AuthError.d.ts +0 -0
  1062. /package/bin/{host → server}/http/auth/AuthError.js +0 -0
  1063. /package/bin/{host → server}/http/auth/CliAuthStateStore.d.ts +0 -0
  1064. /package/bin/{host → server}/http/auth/CliAuthStateStore.js +0 -0
  1065. /package/bin/{host → server}/http/auth/PasswordHasher.d.ts +0 -0
  1066. /package/bin/{host → server}/http/auth/PasswordHasher.js +0 -0
  1067. /package/bin/{host → server}/http/auth/TokenService.d.ts +0 -0
  1068. /package/bin/{host → server}/http/auth/TokenService.js +0 -0
  1069. /package/bin/{host → server}/http/control/AuthControlService.js +0 -0
  1070. /package/bin/{host → server}/http/control/CommonHelpers.d.ts +0 -0
  1071. /package/bin/{host → server}/http/control/CommonHelpers.js +0 -0
  1072. /package/bin/{host → server}/http/control/ExecuteBySession.js +0 -0
  1073. /package/bin/{host → server}/http/control/ExecuteInput.js +0 -0
  1074. /package/bin/{host → server}/http/control/Helpers.d.ts +0 -0
  1075. /package/bin/{host → server}/http/control/Helpers.js +0 -0
  1076. /package/bin/{host → server}/http/control/MessageTimeline.js +0 -0
  1077. /package/bin/{host → server}/http/control/OverviewRoutes.js +0 -0
  1078. /package/bin/{host → server}/http/control/SessionRoutes.js +0 -0
  1079. /package/bin/{host → server}/http/control/SessionSummaryStore.js +0 -0
  1080. /package/bin/{host → server}/http/control/TaskRoutes.js +0 -0
  1081. /package/bin/{host → server}/http/control/TaskStore.js +0 -0
  1082. /package/bin/{host → server}/http/control/types/AuthControl.d.ts +0 -0
  1083. /package/bin/{host → server}/http/control/types/AuthControl.js +0 -0
  1084. /package/bin/{host → server}/http/control/types/ControlRoutes.js +0 -0
  1085. /package/bin/{host → server}/http/control/types/ControlSessionExecute.d.ts +0 -0
  1086. /package/bin/{host → server}/http/control/types/ControlSessionExecute.js +0 -0
  1087. /package/bin/{host → server}/http/control/types/ControlViewData.js +0 -0
  1088. /package/bin/{host → server}/http/execute/execute.d.ts +0 -0
  1089. /package/bin/{host → server}/http/health/health.d.ts +0 -0
  1090. /package/bin/{host → server}/http/health/health.js +0 -0
  1091. /package/bin/{host → server}/http/plugins/plugins.d.ts +0 -0
  1092. /package/bin/{host → server}/http/services/services.d.ts +0 -0
  1093. /package/bin/{host → server}/http/static/static.d.ts +0 -0
  1094. /package/bin/{host → transport}/rpc/Client.d.ts +0 -0
  1095. /package/bin/{host → transport}/rpc/Client.js +0 -0
  1096. /package/bin/{host → transport}/rpc/Paths.d.ts +0 -0
  1097. /package/bin/{host → transport}/rpc/Transport.d.ts +0 -0
  1098. /package/bin/{host → transport}/rpc/Transport.js +0 -0
  1099. /package/bin/{host/http/auth/types → types/auth}/AuthPermission.d.ts +0 -0
  1100. /package/bin/{host/http/auth/types → types/auth}/AuthPermission.js +0 -0
  1101. /package/bin/{host/http/auth/types → types/auth}/AuthRoute.d.ts +0 -0
  1102. /package/bin/{host/http/auth/types → types/auth}/AuthRoute.js +0 -0
  1103. /package/bin/{host/http/auth/types → types/auth}/AuthToken.d.ts +0 -0
  1104. /package/bin/{host/http/auth/types → types/auth}/AuthToken.js +0 -0
  1105. /package/bin/{host/http/auth/types → types/auth}/AuthTypes.d.ts +0 -0
  1106. /package/bin/{host/http/auth/types → types/auth}/AuthTypes.js +0 -0
  1107. /package/bin/{utils/types → types/common}/Json.d.ts +0 -0
  1108. /package/bin/{utils/types → types/common}/Json.js +0 -0
  1109. /package/bin/{utils/types → types/common}/Template.d.ts +0 -0
  1110. /package/bin/{utils/types → types/common}/Template.js +0 -0
  1111. /package/bin/{config/types → types/config}/DowncityConfig.js +0 -0
  1112. /package/bin/{config/types → types/config}/ExecutionBinding.d.ts +0 -0
  1113. /package/bin/{config/types → types/config}/ExecutionBinding.js +0 -0
  1114. /package/bin/{config/types → types/config}/LlmConfig.d.ts +0 -0
  1115. /package/bin/{config/types → types/config}/LlmConfig.js +0 -0
  1116. /package/bin/{config/types → types/config}/ModelBinding.d.ts +0 -0
  1117. /package/bin/{config/types → types/config}/ModelBinding.js +0 -0
  1118. /package/bin/{config/types → types/config}/Start.d.ts +0 -0
  1119. /package/bin/{config/types → types/config}/Start.js +0 -0
  1120. /package/bin/{host/types → types/host}/Store.js +0 -0
  1121. /package/bin/{host/http/execute/types → types/http}/InlineInstant.d.ts +0 -0
  1122. /package/bin/{host/http/execute/types → types/http}/InlineInstant.js +0 -0
  1123. /package/bin/{host/runtime/types → types/platform}/Platform.d.ts +0 -0
  1124. /package/bin/{host/runtime/types → types/platform}/Platform.js +0 -0
  1125. /package/bin/{host/runtime/types → types/platform}/PlatformGateway.d.ts +0 -0
  1126. /package/bin/{host/runtime/types → types/platform}/PlatformGateway.js +0 -0
  1127. /package/bin/{host/rpc/types → types/rpc}/LocalRpc.js +0 -0
  1128. /package/src/{host/sdk → sdk}/AsyncQueue.ts +0 -0
  1129. /package/src/{host/sdk → sdk}/Paths.ts +0 -0
  1130. /package/src/{host → server}/http/auth/AuthEnv.ts +0 -0
  1131. /package/src/{host → server}/http/auth/AuthError.ts +0 -0
  1132. /package/src/{host → server}/http/auth/CliAuthStateStore.ts +0 -0
  1133. /package/src/{host → server}/http/auth/PasswordHasher.ts +0 -0
  1134. /package/src/{host → server}/http/auth/TokenService.ts +0 -0
  1135. /package/src/{host → server}/http/control/CommonHelpers.ts +0 -0
  1136. /package/src/{host → server}/http/control/Helpers.ts +0 -0
  1137. /package/src/{host → server}/http/control/types/AuthControl.ts +0 -0
  1138. /package/src/{host → server}/http/control/types/ControlSessionExecute.ts +0 -0
  1139. /package/src/{host → server}/http/health/health.ts +0 -0
  1140. /package/src/{host → transport}/rpc/Transport.ts +0 -0
  1141. /package/src/{host/http/auth/types → types/auth}/AuthPermission.ts +0 -0
  1142. /package/src/{host/http/auth/types → types/auth}/AuthRoute.ts +0 -0
  1143. /package/src/{host/http/auth/types → types/auth}/AuthToken.ts +0 -0
  1144. /package/src/{host/http/auth/types → types/auth}/AuthTypes.ts +0 -0
  1145. /package/src/{utils/types → types/common}/Json.ts +0 -0
  1146. /package/src/{utils/types → types/common}/Template.ts +0 -0
  1147. /package/src/{config/types → types/config}/ExecutionBinding.ts +0 -0
  1148. /package/src/{config/types → types/config}/LlmConfig.ts +0 -0
  1149. /package/src/{config/types → types/config}/ModelBinding.ts +0 -0
  1150. /package/src/{config/types → types/config}/Start.ts +0 -0
  1151. /package/src/{host/http/execute/types → types/http}/InlineInstant.ts +0 -0
  1152. /package/src/{host/runtime/types → types/platform}/Platform.ts +0 -0
  1153. /package/src/{host/runtime/types → types/platform}/PlatformGateway.ts +0 -0
@@ -7,16 +7,18 @@
7
7
  * - 内部继续复用现有 `Session` / `JsonlSessionHistoryComposer` / `LocalSessionExecutor`。
8
8
  */
9
9
  import { nanoid } from "nanoid";
10
- import { Session as CoreSession } from "../../session/Session.js";
11
- import { JsonlSessionHistoryComposer } from "../../session/composer/history/jsonl/JsonlSessionHistoryComposer.js";
12
- import { JsonlSessionCompactionComposer } from "../../session/composer/compaction/jsonl/JsonlSessionCompactionComposer.js";
13
- import { LocalSessionExecutor } from "../../session/executors/local/LocalSessionExecutor.js";
14
- import { resolveAssistantMessageForPersistence } from "../../service/builtins/chat/runtime/UserVisibleText.js";
15
- import { extractTextFromUiMessage } from "../../service/builtins/chat/runtime/UIMessageTransformer.js";
16
- import { SdkSessionSystemComposer } from "../../host/sdk/SdkSessionSystemComposer.js";
17
- import { inferModelLabel, patchSdkSessionModelLabel, readSdkSessionMetadata, writeSdkSessionMetadata, } from "../../host/sdk/SessionMetadata.js";
18
- import { getSdkAgentSessionArchiveDirPath, getSdkAgentSessionDirPath, } from "../../host/sdk/Paths.js";
19
- import { AsyncQueue } from "../../host/sdk/AsyncQueue.js";
10
+ import { Session as CoreSession } from "../session/Session.js";
11
+ import { JsonlSessionHistoryComposer } from "../session/composer/history/jsonl/JsonlSessionHistoryComposer.js";
12
+ import { JsonlSessionCompactionComposer } from "../session/composer/compaction/jsonl/JsonlSessionCompactionComposer.js";
13
+ import { LocalSessionExecutor } from "../session/executors/local/LocalSessionExecutor.js";
14
+ import { extractTextFromUiMessage } from "../service/builtins/chat/runtime/UIMessageTransformer.js";
15
+ import { resolveSdkSessionSystemBlocks, SdkSessionSystemComposer, } from "../sdk/SdkSessionSystemComposer.js";
16
+ import { inferModelLabel, patchSdkSessionModelLabel, readSdkSessionMetadata, resolveSystemTimezone, writeSdkSessionMetadata, } from "../sdk/SessionMetadata.js";
17
+ import { getSdkAgentSessionArchiveDirPath, getSdkAgentSessionDirPath, } from "../sdk/Paths.js";
18
+ import { AsyncQueue } from "../sdk/AsyncQueue.js";
19
+ import { pushUiMessageChunkAsSdkEvent } from "../sdk/StreamEvents.js";
20
+ import { persistSdkAssistantResult, touchSdkSessionMetadata, } from "../sdk/SessionPersistence.js";
21
+ import { createSdkSessionServicePort } from "../sdk/SessionServicePort.js";
20
22
  /**
21
23
  * SDK 本地 Session。
22
24
  */
@@ -26,12 +28,14 @@ export class SdkSession {
26
28
  projectRoot;
27
29
  tools;
28
30
  logger;
29
- getStaticSystemPrompts;
30
- getServiceSystemPrompts;
31
- getPluginSystemPrompts;
31
+ getInstructionSystemBlocks;
32
+ getServiceSystemBlocks;
33
+ getPluginSystemBlocks;
32
34
  historyComposer;
33
35
  coreSession;
34
36
  sessionConfig = {};
37
+ createdAt = Date.now();
38
+ timezone = resolveSystemTimezone();
35
39
  initializePromise = null;
36
40
  servicePort = null;
37
41
  constructor(options) {
@@ -40,9 +44,9 @@ export class SdkSession {
40
44
  this.projectRoot = String(options.projectRoot || "").trim();
41
45
  this.tools = options.tools;
42
46
  this.logger = options.logger;
43
- this.getStaticSystemPrompts = options.getStaticSystemPrompts;
44
- this.getServiceSystemPrompts = options.getServiceSystemPrompts;
45
- this.getPluginSystemPrompts = options.getPluginSystemPrompts;
47
+ this.getInstructionSystemBlocks = options.getInstructionSystemBlocks;
48
+ this.getServiceSystemBlocks = options.getServiceSystemBlocks;
49
+ this.getPluginSystemBlocks = options.getPluginSystemBlocks;
46
50
  if (!this.id) {
47
51
  throw new Error("SdkSession requires a non-empty sessionId");
48
52
  }
@@ -79,10 +83,13 @@ export class SdkSession {
79
83
  historyComposer,
80
84
  compactionComposer: new JsonlSessionCompactionComposer(),
81
85
  systemComposer: new SdkSessionSystemComposer({
86
+ agentId: this.agentId,
82
87
  projectRoot: this.projectRoot,
83
- getStaticSystemPrompts: this.getStaticSystemPrompts,
84
- getServiceSystemPrompts: this.getServiceSystemPrompts,
85
- getPluginSystemPrompts: this.getPluginSystemPrompts,
88
+ getSessionCreatedAt: () => this.createdAt,
89
+ getSessionTimezone: () => this.timezone,
90
+ getInstructionSystemBlocks: this.getInstructionSystemBlocks,
91
+ getServiceSystemBlocks: this.getServiceSystemBlocks,
92
+ getPluginSystemBlocks: this.getPluginSystemBlocks,
86
93
  }),
87
94
  getTools: () => this.tools,
88
95
  });
@@ -102,6 +109,10 @@ export class SdkSession {
102
109
  agentId: this.agentId,
103
110
  sessionId: this.id,
104
111
  });
112
+ const createdAt = typeof metadata.createdAt === "number" ? metadata.createdAt : Date.now();
113
+ const timezone = typeof metadata.timezone === "string" && metadata.timezone.trim()
114
+ ? metadata.timezone.trim()
115
+ : resolveSystemTimezone();
105
116
  await writeSdkSessionMetadata({
106
117
  projectRoot: this.projectRoot,
107
118
  agentId: this.agentId,
@@ -109,9 +120,12 @@ export class SdkSession {
109
120
  meta: {
110
121
  ...metadata,
111
122
  agentId: this.agentId,
112
- createdAt: typeof metadata.createdAt === "number" ? metadata.createdAt : Date.now(),
123
+ createdAt,
124
+ timezone,
113
125
  },
114
126
  });
127
+ this.createdAt = createdAt;
128
+ this.timezone = timezone;
115
129
  this.sessionConfig = {
116
130
  ...(metadata.sdkConfig?.modelLabel
117
131
  ? { modelLabel: metadata.sdkConfig.modelLabel }
@@ -169,6 +183,37 @@ export class SdkSession {
169
183
  async history() {
170
184
  return await this.historyComposer.list();
171
185
  }
186
+ /**
187
+ * 读取当前 session 生效的 system prompt 文本集合。
188
+ *
189
+ * 关键点(中文)
190
+ * - 返回内容与实际 run 时使用的 SDK system composer 同源。
191
+ * - 包含 instruction/core、显式注入 service system、显式注册 plugin system 与 session 上下文。
192
+ * - 返回结构化快照,不把 system prompt 写入会话历史。
193
+ */
194
+ async system() {
195
+ const blocks = await resolveSdkSessionSystemBlocks({
196
+ agentId: this.agentId,
197
+ projectRoot: this.projectRoot,
198
+ sessionId: this.id,
199
+ createdAt: this.createdAt,
200
+ timezone: this.timezone,
201
+ getInstructionSystemBlocks: this.getInstructionSystemBlocks,
202
+ getServiceSystemBlocks: this.getServiceSystemBlocks,
203
+ getPluginSystemBlocks: this.getPluginSystemBlocks,
204
+ });
205
+ return {
206
+ sessionId: this.id,
207
+ session: {
208
+ agentId: this.agentId,
209
+ sessionId: this.id,
210
+ projectRoot: this.projectRoot,
211
+ createdAt: new Date(this.createdAt).toISOString(),
212
+ timezone: this.timezone,
213
+ },
214
+ blocks,
215
+ };
216
+ }
172
217
  /**
173
218
  * 返回当前 session 是否正在执行。
174
219
  */
@@ -217,7 +262,11 @@ export class SdkSession {
217
262
  const result = await this.coreSession.run({
218
263
  query,
219
264
  onUiMessageChunkCallback: async (chunk) => {
220
- this.pushChunkEvent(queue, chunk, toolNameByCallId);
265
+ pushUiMessageChunkAsSdkEvent({
266
+ queue,
267
+ chunk,
268
+ toolNameByCallId,
269
+ });
221
270
  },
222
271
  });
223
272
  await this.persistAssistantResult(result.assistantMessage);
@@ -258,9 +307,9 @@ export class SdkSession {
258
307
  sessionId: `fork-${Date.now()}-${nanoid(8)}`,
259
308
  tools: this.tools,
260
309
  logger: this.logger,
261
- getStaticSystemPrompts: this.getStaticSystemPrompts,
262
- getServiceSystemPrompts: this.getServiceSystemPrompts,
263
- getPluginSystemPrompts: this.getPluginSystemPrompts,
310
+ getInstructionSystemBlocks: this.getInstructionSystemBlocks,
311
+ getServiceSystemBlocks: this.getServiceSystemBlocks,
312
+ getPluginSystemBlocks: this.getPluginSystemBlocks,
264
313
  });
265
314
  await forked.initialize();
266
315
  if (this.sessionConfig.model) {
@@ -295,165 +344,37 @@ export class SdkSession {
295
344
  }
296
345
  /**
297
346
  * 返回供 chat service 使用的 session 端口。
298
- *
299
- * 关键点(中文)
300
- * - 这里不走 SDK `run()` 包装层,而是直接暴露底层 `CoreSession` 协议。
301
- * - 这样 chat queue worker 可以复用既有 `SessionPort` 契约,不会重复补写消息。
302
347
  */
303
348
  getServicePort() {
304
349
  if (this.servicePort)
305
350
  return this.servicePort;
306
- this.servicePort = {
351
+ this.servicePort = createSdkSessionServicePort({
307
352
  sessionId: this.id,
308
- getExecutor: () => this.coreSession.getExecutor(),
309
- getHistoryComposer: () => this.historyComposer,
310
- run: async (params) => {
311
- return await this.coreSession.run(params);
312
- },
313
- clearExecutor: () => {
314
- this.coreSession.clearExecutor();
315
- },
316
- afterSessionUpdatedAsync: async () => {
317
- await this.coreSession.afterSessionUpdatedAsync();
318
- },
319
- appendUserMessage: async (params) => {
320
- await this.coreSession.appendUserMessage(params);
321
- await this.touchMetadata();
322
- },
323
- appendAssistantMessage: async (params) => {
324
- await this.coreSession.appendAssistantMessage(params);
353
+ coreSession: this.coreSession,
354
+ historyComposer: this.historyComposer,
355
+ touchMetadata: async () => {
325
356
  await this.touchMetadata();
326
357
  },
327
- isExecuting: () => this.coreSession.isExecuting(),
328
- };
358
+ });
329
359
  return this.servicePort;
330
360
  }
331
361
  async touchMetadata() {
332
- const current = await readSdkSessionMetadata({
362
+ await touchSdkSessionMetadata({
333
363
  projectRoot: this.projectRoot,
334
364
  agentId: this.agentId,
335
365
  sessionId: this.id,
366
+ sessionConfig: this.sessionConfig,
336
367
  });
337
- const next = {
338
- ...current,
339
- agentId: this.agentId,
340
- createdAt: typeof current.createdAt === "number" ? current.createdAt : Date.now(),
341
- updatedAt: Date.now(),
342
- ...(this.sessionConfig.modelLabel
343
- ? {
344
- sdkConfig: {
345
- ...(current.sdkConfig || {}),
346
- modelLabel: this.sessionConfig.modelLabel,
347
- },
348
- }
349
- : {}),
350
- };
351
- await writeSdkSessionMetadata({
368
+ }
369
+ async persistAssistantResult(assistantMessage) {
370
+ await persistSdkAssistantResult({
352
371
  projectRoot: this.projectRoot,
353
372
  agentId: this.agentId,
354
373
  sessionId: this.id,
355
- meta: next,
374
+ sessionConfig: this.sessionConfig,
375
+ coreSession: this.coreSession,
376
+ assistantMessage,
356
377
  });
357
378
  }
358
- async persistAssistantResult(assistantMessage) {
359
- const persisted = resolveAssistantMessageForPersistence(assistantMessage);
360
- await this.coreSession.appendAssistantMessage({
361
- ...(persisted ? { message: persisted } : {}),
362
- fallbackText: extractTextFromUiMessage(assistantMessage),
363
- });
364
- await this.touchMetadata();
365
- }
366
- pushChunkEvent(queue, chunk, toolNameByCallId) {
367
- switch (chunk.type) {
368
- case "text-delta":
369
- queue.push({
370
- type: "text-delta",
371
- text: chunk.delta,
372
- });
373
- return;
374
- case "reasoning-delta":
375
- queue.push({
376
- type: "reasoning-delta",
377
- text: chunk.delta,
378
- });
379
- return;
380
- case "tool-input-start":
381
- toolNameByCallId.set(chunk.toolCallId, chunk.toolName);
382
- return;
383
- case "tool-input-available":
384
- toolNameByCallId.set(chunk.toolCallId, chunk.toolName);
385
- queue.push({
386
- type: "tool-call",
387
- toolCallId: chunk.toolCallId,
388
- toolName: chunk.toolName,
389
- args: this.toJsonValue(chunk.input),
390
- });
391
- return;
392
- case "tool-output-available":
393
- queue.push({
394
- type: "tool-result",
395
- toolCallId: chunk.toolCallId,
396
- toolName: toolNameByCallId.get(chunk.toolCallId) || "unknown",
397
- result: this.toJsonValue(chunk.output),
398
- });
399
- return;
400
- case "tool-output-error":
401
- queue.push({
402
- type: "tool-error",
403
- toolCallId: chunk.toolCallId,
404
- toolName: toolNameByCallId.get(chunk.toolCallId) || "unknown",
405
- error: chunk.errorText,
406
- });
407
- return;
408
- case "tool-input-error":
409
- toolNameByCallId.set(chunk.toolCallId, chunk.toolName);
410
- queue.push({
411
- type: "tool-error",
412
- toolCallId: chunk.toolCallId,
413
- toolName: chunk.toolName,
414
- error: chunk.errorText,
415
- });
416
- return;
417
- case "error":
418
- queue.push({
419
- type: "error",
420
- error: chunk.errorText,
421
- });
422
- return;
423
- case "abort":
424
- queue.push({
425
- type: "error",
426
- error: String(chunk.reason || "stream aborted"),
427
- });
428
- return;
429
- case "finish":
430
- queue.push({
431
- type: "finish",
432
- ...(typeof chunk.finishReason === "string"
433
- ? { finishReason: chunk.finishReason }
434
- : {}),
435
- });
436
- return;
437
- default:
438
- return;
439
- }
440
- }
441
- toJsonValue(value) {
442
- if (value === undefined)
443
- return null;
444
- if (value === null)
445
- return null;
446
- if (typeof value === "string" ||
447
- typeof value === "number" ||
448
- typeof value === "boolean") {
449
- return value;
450
- }
451
- try {
452
- return JSON.parse(JSON.stringify(value));
453
- }
454
- catch {
455
- return String(value);
456
- }
457
- }
458
379
  }
459
380
  //# sourceMappingURL=Session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Session.js","sourceRoot":"","sources":["../../src/sdk/Session.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,2BAA2B,EAAE,MAAM,gEAAgE,CAAC;AAC7G,OAAO,EAAE,8BAA8B,EAAE,MAAM,sEAAsE,CAAC;AACtH,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAC;AACxF,OAAO,EAAE,wBAAwB,EAAE,MAAM,yDAAyD,CAAC;AAanG,OAAO,EACL,6BAA6B,EAC7B,wBAAwB,GACzB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,eAAe,EACf,yBAAyB,EACzB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,gCAAgC,EAChC,yBAAyB,GAC1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EACL,yBAAyB,EACzB,uBA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AAG,2BAA2B,CAAC;YAC7C,SAAS,EAAE,IAAI,CAAC,EAAE;YAClB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,aAAa,EAAE,KAAK,IAAI,EAAE;gBACxB,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;YAC7B,CAAC;SACF,CAAC,CAAC;QACH,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAEO,KAAK,CAAC,aAAa;QACzB,MAAM,uBAAuB,CAAC;YAC5B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,SAAS,EAAE,IAAI,CAAC,EAAE;YAClB,aAAa,EAAE,IAAI,CAAC,aAAa;SAClC,CAAC,CAAC;IACL,CAAC;IAEO,KAAK,CAAC,sBAAsB,CAClC,gBAAkC;QAElC,MAAM,yBAAyB,CAAC;YAC9B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,SAAS,EAAE,IAAI,CAAC,EAAE;YAClB,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,gBAAgB;SACjB,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -6,7 +6,7 @@
6
6
  * - 仅处理轻量配置摘要与索引信息,不负责消息 JSONL 的读写。
7
7
  */
8
8
  import type { LanguageModel } from "ai";
9
- import type { SessionHistoryMetaV1 } from "../../session/types/SessionHistoryMeta.js";
9
+ import type { SessionHistoryMetaV1 } from "../session/types/SessionHistoryMeta.js";
10
10
  type ReadSessionMetadataInput = {
11
11
  /**
12
12
  * 项目根目录。
@@ -21,6 +21,10 @@ type ReadSessionMetadataInput = {
21
21
  */
22
22
  sessionId: string;
23
23
  };
24
+ /**
25
+ * 读取当前系统时区。
26
+ */
27
+ export declare function resolveSystemTimezone(): string;
24
28
  /**
25
29
  * 从模型实例推导轻量可读标签。
26
30
  */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SessionMetadata.d.ts","sourceRoot":"","sources":["../../src/sdk/SessionMetadata.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACxC,OAAO,KAAK,EACV,oBAAoB,EAErB,MAAM,uCAAuC,CAAC;AAG/C,KAAK,wBAAwB,GAAG;IAC9B;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAOF;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAK9C;AAOD;;GAEG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,aAAa,GAAG,SAAS,GAC/B,MAAM,GAAG,SAAS,CAmBpB;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,wBAAwB,GAC9B,OAAO,CAAC,oBAAoB,CAAC,CAuD/B;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,KAAK,EAAE,wBAAwB,GAAG;IAChC;;OAEG;IACH,IAAI,EAAE,oBAAoB,CAAC;CAC5B,GACA,OAAO,CAAC,IAAI,CAAC,CAQf;AAED;;GAEG;AACH,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,wBAAwB,GAAG;IAChC;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,GACA,OAAO,CAAC,oBAAoB,CAAC,CAwB/B"}
@@ -6,11 +6,24 @@
6
6
  * - 仅处理轻量配置摘要与索引信息,不负责消息 JSONL 的读写。
7
7
  */
8
8
  import fs from "fs-extra";
9
- import { getSdkAgentSessionMetaPath } from "../../host/sdk/Paths.js";
9
+ import { getSdkAgentSessionMetaPath } from "../sdk/Paths.js";
10
10
  function normalizeModelLabel(input) {
11
11
  const label = typeof input === "string" ? input.trim() : "";
12
12
  return label || undefined;
13
13
  }
14
+ /**
15
+ * 读取当前系统时区。
16
+ */
17
+ export function resolveSystemTimezone() {
18
+ const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
19
+ return typeof timezone === "string" && timezone.trim()
20
+ ? timezone.trim()
21
+ : "UTC";
22
+ }
23
+ function normalizeTimezone(input) {
24
+ const timezone = typeof input === "string" ? input.trim() : "";
25
+ return timezone || undefined;
26
+ }
14
27
  /**
15
28
  * 从模型实例推导轻量可读标签。
16
29
  */
@@ -49,6 +62,7 @@ export async function readSdkSessionMetadata(input) {
49
62
  createdAt: typeof raw.createdAt === "number" && Number.isFinite(raw.createdAt)
50
63
  ? raw.createdAt
51
64
  : Date.now(),
65
+ timezone: normalizeTimezone(raw.timezone) || resolveSystemTimezone(),
52
66
  updatedAt: typeof raw.updatedAt === "number" && Number.isFinite(raw.updatedAt)
53
67
  ? raw.updatedAt
54
68
  : 0,
@@ -82,6 +96,7 @@ export async function readSdkSessionMetadata(input) {
82
96
  sessionId: input.sessionId,
83
97
  agentId: input.agentId,
84
98
  createdAt: Date.now(),
99
+ timezone: resolveSystemTimezone(),
85
100
  updatedAt: 0,
86
101
  pinnedSkillIds: [],
87
102
  };
@@ -105,6 +120,7 @@ export async function patchSdkSessionModelLabel(input) {
105
120
  ...current,
106
121
  agentId: input.agentId,
107
122
  createdAt: typeof current.createdAt === "number" ? current.createdAt : Date.now(),
123
+ timezone: normalizeTimezone(current.timezone) || resolveSystemTimezone(),
108
124
  updatedAt: Date.now(),
109
125
  ...(modelLabel
110
126
  ? {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SessionMetadata.js","sourceRoot":"","sources":["../../src/sdk/SessionMetadata.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,UAAU,CAAC;AAM1B,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAmB5D,SAAS,mBAAmB,CAAC,KAAc;IACzC,MAAM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AC;QAC5B,GAAG,KAAK;QACR,IAAI,EAAE,IAAI;KACX,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * SDK Session 持久化辅助。
3
+ *
4
+ * 关键点(中文)
5
+ * - 集中处理 session meta 更新时间、模型展示标签与 assistant 消息落盘。
6
+ * - `SdkSession` 只负责调用这些能力,不直接拼装 meta 结构。
7
+ */
8
+ import type { SessionMessageV1 } from "../session/types/SessionMessages.js";
9
+ import type { AgentSessionConfigSnapshot } from "../sdk/AgentSdkTypes.js";
10
+ /**
11
+ * SDK Session 元数据写入参数。
12
+ */
13
+ export interface TouchSdkSessionMetadataParams {
14
+ /**
15
+ * 当前项目根目录。
16
+ */
17
+ projectRoot: string;
18
+ /**
19
+ * 当前 agent 稳定标识。
20
+ */
21
+ agentId: string;
22
+ /**
23
+ * 当前 sessionId。
24
+ */
25
+ sessionId: string;
26
+ /**
27
+ * 当前 session 内存配置快照。
28
+ */
29
+ sessionConfig: AgentSessionConfigSnapshot;
30
+ }
31
+ /**
32
+ * Assistant 结果落盘参数。
33
+ */
34
+ export interface PersistSdkAssistantResultParams extends TouchSdkSessionMetadataParams {
35
+ /**
36
+ * 追加 assistant 消息的底层 session 端口。
37
+ */
38
+ coreSession: {
39
+ appendAssistantMessage(params: {
40
+ /**
41
+ * 已构造好的完整消息。
42
+ */
43
+ message?: SessionMessageV1 | null;
44
+ /**
45
+ * 兜底文本内容。
46
+ */
47
+ fallbackText?: string;
48
+ }): Promise<void>;
49
+ };
50
+ /**
51
+ * 本轮执行得到的 assistant 消息。
52
+ */
53
+ assistantMessage: SessionMessageV1;
54
+ }
55
+ /**
56
+ * 刷新 SDK session 元数据。
57
+ */
58
+ export declare function touchSdkSessionMetadata(params: TouchSdkSessionMetadataParams): Promise<void>;
59
+ /**
60
+ * 持久化 assistant 结果并同步刷新 session meta。
61
+ */
62
+ export declare function persistSdkAssistantResult(params: PersistSdkAssistantResultParams): Promise<void>;
63
+ //# sourceMappingURL=SessionPersistence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SessionPersistence.d.ts","sourceRoot":"","sources":["../../src/sdk/SessionPersistence.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAMzE;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,aAAa,EAAE,0BAA0B,CAAC;CAC3C;AAED;;GAEG;AACH,MAAM,WAAW,+BACf,SAAQ,6BAA6B;IACrC;;OAEG;IACH,WAAW,EAAE;QACX,sBAAsB,CAAC,MAAM,EAAE;YAC7B;;eAEG;YACH,OAAO,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;YAClC;;eAEG;YACH,YAAY,CAAC,EAAE,MAAM,CAAC;SACvB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;KACnB,CAAC;IACF;;OAEG;IACH,gBAAgB,EAAE,gBAAgB,CAAC;CACpC;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,6BAA6B,GACpC,OAAO,CAAC,IAAI,CAAC,CA2Bf;AAED;;GAEG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,+BAA+B,GACtC,OAAO,CAAC,IAAI,CAAC,CAOf"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * SDK Session 持久化辅助。
3
+ *
4
+ * 关键点(中文)
5
+ * - 集中处理 session meta 更新时间、模型展示标签与 assistant 消息落盘。
6
+ * - `SdkSession` 只负责调用这些能力,不直接拼装 meta 结构。
7
+ */
8
+ import { resolveAssistantMessageForPersistence } from "../service/builtins/chat/runtime/UserVisibleText.js";
9
+ import { extractTextFromUiMessage } from "../service/builtins/chat/runtime/UIMessageTransformer.js";
10
+ import { readSdkSessionMetadata, writeSdkSessionMetadata, } from "../sdk/SessionMetadata.js";
11
+ /**
12
+ * 刷新 SDK session 元数据。
13
+ */
14
+ export async function touchSdkSessionMetadata(params) {
15
+ const current = await readSdkSessionMetadata({
16
+ projectRoot: params.projectRoot,
17
+ agentId: params.agentId,
18
+ sessionId: params.sessionId,
19
+ });
20
+ const next = {
21
+ ...current,
22
+ agentId: params.agentId,
23
+ createdAt: typeof current.createdAt === "number" ? current.createdAt : Date.now(),
24
+ updatedAt: Date.now(),
25
+ ...(params.sessionConfig.modelLabel
26
+ ? {
27
+ sdkConfig: {
28
+ ...(current.sdkConfig || {}),
29
+ modelLabel: params.sessionConfig.modelLabel,
30
+ },
31
+ }
32
+ : {}),
33
+ };
34
+ await writeSdkSessionMetadata({
35
+ projectRoot: params.projectRoot,
36
+ agentId: params.agentId,
37
+ sessionId: params.sessionId,
38
+ meta: next,
39
+ });
40
+ }
41
+ /**
42
+ * 持久化 assistant 结果并同步刷新 session meta。
43
+ */
44
+ export async function persistSdkAssistantResult(params) {
45
+ const persisted = resolveAssistantMessageForPersistence(params.assistantMessage);
46
+ await params.coreSession.appendAssistantMessage({
47
+ ...(persisted ? { message: persisted } : {}),
48
+ fallbackText: extractTextFromUiMessage(params.assistantMessage),
49
+ });
50
+ await touchSdkSessionMetadata(params);
51
+ }
52
+ //# sourceMappingURL=SessionPersistence.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SessionPersistence.js","sourceRoot":"","sources":["../../src/sdk/SessionPersistence.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,qCAAqC,EAAE,MAAM,oDAAoD,CAAC;AAC3G,OAAO,EAAE,wBAAwB,EAAE,MAAM,yDAAyD,CAAC;AAInG,OAAO,EACL,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,0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C,YAAY,EAAE,wBAAwB,CAAC,MAAM,CAAC,gBAAgB,CAAC;KAChE,CAAC,CAAC;IACH,MAAM,uBAAuB,CAAC,MAAM,CAAC,CAAC;AACxC,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * SDK Session service 端口构造器。
3
+ *
4
+ * 关键点(中文)
5
+ * - 把 SDK 本地 session 适配成 chat service 依赖的 `SessionPort`。
6
+ * - service 侧直接复用底层 `CoreSession` 协议,避免 SDK `run()` 包装层重复补写消息。
7
+ */
8
+ import type { SessionPort } from "../runtime/AgentContextTypes.js";
9
+ /**
10
+ * 构造 SDK SessionPort 的参数。
11
+ */
12
+ export interface CreateSdkSessionServicePortParams {
13
+ /**
14
+ * 当前 sessionId。
15
+ */
16
+ sessionId: string;
17
+ /**
18
+ * 底层 session 实例。
19
+ */
20
+ coreSession: Omit<SessionPort, "sessionId" | "getHistoryComposer">;
21
+ /**
22
+ * 当前 session 历史持久化端口。
23
+ */
24
+ historyComposer: ReturnType<SessionPort["getHistoryComposer"]>;
25
+ /**
26
+ * session 更新后需要同步执行的持久化回调。
27
+ */
28
+ touchMetadata: () => Promise<void>;
29
+ }
30
+ /**
31
+ * 创建供 service 使用的 session 端口。
32
+ */
33
+ export declare function createSdkSessionServicePort(params: CreateSdkSessionServicePortParams): SessionPort;
34
+ //# sourceMappingURL=SessionServicePort.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SessionServicePort.d.ts","sourceRoot":"","sources":["../../src/sdk/SessionServicePort.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,iCAAiC;IAChD;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,oBAAoB,CAAC,CAAC;IACnE;;OAEG;IACH,eAAe,EAAE,UAAU,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAC/D;;OAEG;IACH,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,iCAAiC,GACxC,WAAW,CAwBb"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * SDK Session service 端口构造器。
3
+ *
4
+ * 关键点(中文)
5
+ * - 把 SDK 本地 session 适配成 chat service 依赖的 `SessionPort`。
6
+ * - service 侧直接复用底层 `CoreSession` 协议,避免 SDK `run()` 包装层重复补写消息。
7
+ */
8
+ /**
9
+ * 创建供 service 使用的 session 端口。
10
+ */
11
+ export function createSdkSessionServicePort(params) {
12
+ return {
13
+ sessionId: params.sessionId,
14
+ getExecutor: () => params.coreSession.getExecutor(),
15
+ getHistoryComposer: () => params.historyComposer,
16
+ run: async (runParams) => {
17
+ return await params.coreSession.run(runParams);
18
+ },
19
+ clearExecutor: () => {
20
+ params.coreSession.clearExecutor();
21
+ },
22
+ afterSessionUpdatedAsync: async () => {
23
+ await params.coreSession.afterSessionUpdatedAsync();
24
+ },
25
+ appendUserMessage: async (messageParams) => {
26
+ await params.coreSession.appendUserMessage(messageParams);
27
+ await params.touchMetadata();
28
+ },
29
+ appendAssistantMessage: async (messageParams) => {
30
+ await params.coreSession.appendAssistantMessage(messageParams);
31
+ await params.touchMetadata();
32
+ },
33
+ isExecuting: () => params.coreSession.isExecuting(),
34
+ };
35
+ }
36
+ //# sourceMappingURL=SessionServicePort.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SessionServicePort.js","sourceRoot":"","sources":["../../src/sdk/SessionServicePort.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA0BH;;GAEG;AACH,MAAM,UAAU,2BAA2B,CACzC,MAAyC;IAEzC,OAAO;QACL,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,WAAW,EAAE;QACnD,kBAAkB,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,eAAe;QAChD,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE;YACvB,OAAO,MAAM,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACjD,CAAC;QACD,aAAa,EAAE,GAAG,EAAE;YAClB,MAAM,CAAC,WAAW,CAAC,aAAa,EAAE,CAAC;QACrC,CAAC;QACD,wBAAwB,EAAE,KAAK,IAAI,EAAE;YACnC,MAAM,MAAM,CAAC,WAAW,CAAC,wBAAwB,EAAE,CAAC;QACtD,CAAC;QACD,iBAAiB,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE;YACzC,MAAM,MAAM,CAAC,WAAW,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC;YAC1D,MAAM,MAAM,CAAC,aAAa,EAAE,CAAC;QAC/B,CAAC;QACD,sBAAsB,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE;YAC9C,MAAM,MAAM,CAAC,WAAW,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC;YAC/D,MAAM,MAAM,CAAC,aAAa,EAAE,CAAC;QAC/B,CAAC;QACD,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,WAAW,EAAE;KACpD,CAAC;AACJ,CAAC"}