@zhin.js/agent 1.1.3 → 1.1.6

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 (1055) hide show
  1. package/README.md +52 -52
  2. package/lib/activity-feedback/adapter-integration.d.ts +8 -9
  3. package/lib/activity-feedback/adapter-integration.d.ts.map +1 -1
  4. package/lib/activity-feedback/adapter-integration.js +22 -18
  5. package/lib/activity-feedback/adapter-integration.js.map +1 -1
  6. package/lib/activity-feedback/ai-bus.d.ts.map +1 -1
  7. package/lib/activity-feedback/ai-bus.js +7 -1
  8. package/lib/activity-feedback/ai-bus.js.map +1 -1
  9. package/lib/activity-feedback/event-context.d.ts +1 -1
  10. package/lib/activity-feedback/event-context.d.ts.map +1 -1
  11. package/lib/activity-feedback/event-context.js +9 -6
  12. package/lib/activity-feedback/event-context.js.map +1 -1
  13. package/lib/activity-feedback/index.d.ts +3 -2
  14. package/lib/activity-feedback/index.d.ts.map +1 -1
  15. package/lib/activity-feedback/index.js +3 -2
  16. package/lib/activity-feedback/index.js.map +1 -1
  17. package/lib/activity-feedback/manager.d.ts +4 -1
  18. package/lib/activity-feedback/manager.d.ts.map +1 -1
  19. package/lib/activity-feedback/manager.js +10 -8
  20. package/lib/activity-feedback/manager.js.map +1 -1
  21. package/lib/activity-feedback/subagent-prefix.d.ts +17 -0
  22. package/lib/activity-feedback/subagent-prefix.d.ts.map +1 -0
  23. package/lib/activity-feedback/subagent-prefix.js +54 -0
  24. package/lib/activity-feedback/subagent-prefix.js.map +1 -0
  25. package/lib/agent-prompt/registry.js +1 -1
  26. package/lib/agent-prompt/registry.js.map +1 -1
  27. package/lib/agent-prompt/resolver.d.ts.map +1 -1
  28. package/lib/agent-prompt/resolver.js +5 -7
  29. package/lib/agent-prompt/resolver.js.map +1 -1
  30. package/lib/ai-event-bus.js +2 -2
  31. package/lib/ai-event-bus.js.map +1 -1
  32. package/lib/ai-event-subscriber.d.ts +1 -1
  33. package/lib/ai-event-subscriber.d.ts.map +1 -1
  34. package/lib/ai-event-subscriber.js +1 -1
  35. package/lib/ai-event-subscriber.js.map +1 -1
  36. package/lib/aop/index.d.ts +1 -1
  37. package/lib/aop/index.d.ts.map +1 -1
  38. package/lib/aop/index.js +1 -1
  39. package/lib/aop/index.js.map +1 -1
  40. package/lib/aop/pipeline/pipeline-service.d.ts +2 -0
  41. package/lib/aop/pipeline/pipeline-service.d.ts.map +1 -1
  42. package/lib/aop/pipeline/pipeline-service.js +26 -14
  43. package/lib/aop/pipeline/pipeline-service.js.map +1 -1
  44. package/lib/assistant/bootstrap-assistant-home.d.ts +31 -0
  45. package/lib/assistant/bootstrap-assistant-home.d.ts.map +1 -0
  46. package/lib/assistant/bootstrap-assistant-home.js +97 -0
  47. package/lib/assistant/bootstrap-assistant-home.js.map +1 -0
  48. package/lib/assistant/deliver-schedule-to-adapter.d.ts +3 -3
  49. package/lib/assistant/deliver-schedule-to-adapter.d.ts.map +1 -1
  50. package/lib/assistant/deliver-schedule-to-adapter.js +2 -6
  51. package/lib/assistant/deliver-schedule-to-adapter.js.map +1 -1
  52. package/lib/assistant/domains/{home-assistant.d.ts → ha-home-backend.d.ts} +16 -13
  53. package/lib/assistant/domains/ha-home-backend.d.ts.map +1 -0
  54. package/lib/assistant/domains/{home-assistant.js → ha-home-backend.js} +32 -7
  55. package/lib/assistant/domains/ha-home-backend.js.map +1 -0
  56. package/lib/assistant/domains/ha-ws-transport.d.ts +59 -0
  57. package/lib/assistant/domains/ha-ws-transport.d.ts.map +1 -0
  58. package/lib/assistant/domains/ha-ws-transport.js +135 -0
  59. package/lib/assistant/domains/ha-ws-transport.js.map +1 -0
  60. package/lib/assistant/domains/home-entity.d.ts +5 -0
  61. package/lib/assistant/domains/home-entity.d.ts.map +1 -0
  62. package/lib/assistant/domains/home-entity.js +8 -0
  63. package/lib/assistant/domains/home-entity.js.map +1 -0
  64. package/lib/assistant/domains/home-state-watch.d.ts +40 -0
  65. package/lib/assistant/domains/home-state-watch.d.ts.map +1 -0
  66. package/lib/assistant/domains/home-state-watch.js +118 -0
  67. package/lib/assistant/domains/home-state-watch.js.map +1 -0
  68. package/lib/assistant/home-config.d.ts +21 -7
  69. package/lib/assistant/home-config.d.ts.map +1 -1
  70. package/lib/assistant/home-config.js +5 -0
  71. package/lib/assistant/home-config.js.map +1 -1
  72. package/lib/assistant/home-facade.d.ts +73 -0
  73. package/lib/assistant/home-facade.d.ts.map +1 -0
  74. package/lib/assistant/home-facade.js +144 -0
  75. package/lib/assistant/home-facade.js.map +1 -0
  76. package/lib/assistant/home-policy.d.ts +3 -2
  77. package/lib/assistant/home-policy.d.ts.map +1 -1
  78. package/lib/assistant/home-policy.js +8 -36
  79. package/lib/assistant/home-policy.js.map +1 -1
  80. package/lib/assistant/home-tools.d.ts +9 -12
  81. package/lib/assistant/home-tools.d.ts.map +1 -1
  82. package/lib/assistant/home-tools.js +94 -135
  83. package/lib/assistant/home-tools.js.map +1 -1
  84. package/lib/assistant/index.d.ts +18 -11
  85. package/lib/assistant/index.d.ts.map +1 -1
  86. package/lib/assistant/index.js +10 -7
  87. package/lib/assistant/index.js.map +1 -1
  88. package/lib/assistant/job-creator.d.ts +3 -3
  89. package/lib/assistant/job-creator.d.ts.map +1 -1
  90. package/lib/assistant/job-creator.js +6 -11
  91. package/lib/assistant/job-creator.js.map +1 -1
  92. package/lib/assistant/job-engine.d.ts +1 -1
  93. package/lib/assistant/job-engine.d.ts.map +1 -1
  94. package/lib/assistant/job-engine.js +11 -22
  95. package/lib/assistant/job-engine.js.map +1 -1
  96. package/lib/assistant/job-scheduler.d.ts +0 -3
  97. package/lib/assistant/job-scheduler.d.ts.map +1 -1
  98. package/lib/assistant/job-scheduler.js +5 -3
  99. package/lib/assistant/job-scheduler.js.map +1 -1
  100. package/lib/assistant/job-store.d.ts.map +1 -1
  101. package/lib/assistant/job-store.js +31 -3
  102. package/lib/assistant/job-store.js.map +1 -1
  103. package/lib/assistant/job-worker.d.ts +2 -9
  104. package/lib/assistant/job-worker.d.ts.map +1 -1
  105. package/lib/assistant/job-worker.js +42 -36
  106. package/lib/assistant/job-worker.js.map +1 -1
  107. package/lib/assistant/notification-router.d.ts +2 -1
  108. package/lib/assistant/notification-router.d.ts.map +1 -1
  109. package/lib/assistant/notification-router.js +18 -9
  110. package/lib/assistant/notification-router.js.map +1 -1
  111. package/lib/assistant/runtime-registry.d.ts +4 -3
  112. package/lib/assistant/runtime-registry.d.ts.map +1 -1
  113. package/lib/assistant/runtime-registry.js +7 -16
  114. package/lib/assistant/runtime-registry.js.map +1 -1
  115. package/lib/assistant/schedule-execution.d.ts +0 -17
  116. package/lib/assistant/schedule-execution.d.ts.map +1 -1
  117. package/lib/assistant/schedule-execution.js +0 -41
  118. package/lib/assistant/schedule-execution.js.map +1 -1
  119. package/lib/assistant/schedule-job-service.d.ts +4 -2
  120. package/lib/assistant/schedule-job-service.d.ts.map +1 -1
  121. package/lib/assistant/schedule-job-service.js +38 -8
  122. package/lib/assistant/schedule-job-service.js.map +1 -1
  123. package/lib/assistant/types.d.ts +3 -0
  124. package/lib/assistant/types.d.ts.map +1 -1
  125. package/lib/assistant/types.js.map +1 -1
  126. package/lib/authoring/entries/tools.d.ts +1 -1
  127. package/lib/authoring/entries/tools.d.ts.map +1 -1
  128. package/lib/authoring/entries/tools.js +1 -1
  129. package/lib/authoring/entries/tools.js.map +1 -1
  130. package/lib/authoring/index.d.ts +1 -1
  131. package/lib/authoring/index.d.ts.map +1 -1
  132. package/lib/authoring/index.js +1 -1
  133. package/lib/authoring/index.js.map +1 -1
  134. package/lib/authoring/tool-policy.d.ts +1 -1
  135. package/lib/authoring/tool-policy.d.ts.map +1 -1
  136. package/lib/authoring/tool-policy.js +1 -1
  137. package/lib/authoring/tool-policy.js.map +1 -1
  138. package/lib/bootstrap.d.ts +2 -3
  139. package/lib/bootstrap.d.ts.map +1 -1
  140. package/lib/bootstrap.js +1 -12
  141. package/lib/bootstrap.js.map +1 -1
  142. package/lib/builtin/analyze-media-tool.d.ts.map +1 -1
  143. package/lib/builtin/analyze-media-tool.js +0 -12
  144. package/lib/builtin/analyze-media-tool.js.map +1 -1
  145. package/lib/builtin/bash-tool.d.ts.map +1 -1
  146. package/lib/builtin/bash-tool.js +0 -6
  147. package/lib/builtin/bash-tool.js.map +1 -1
  148. package/lib/builtin/bing-search-html.d.ts +1 -17
  149. package/lib/builtin/bing-search-html.d.ts.map +1 -1
  150. package/lib/builtin/bing-search-html.js +12 -10
  151. package/lib/builtin/bing-search-html.js.map +1 -1
  152. package/lib/builtin/edit-file-tool.d.ts.map +1 -1
  153. package/lib/builtin/edit-file-tool.js +0 -7
  154. package/lib/builtin/edit-file-tool.js.map +1 -1
  155. package/lib/builtin/glob-tool.d.ts.map +1 -1
  156. package/lib/builtin/glob-tool.js +0 -5
  157. package/lib/builtin/glob-tool.js.map +1 -1
  158. package/lib/builtin/grep-tool.d.ts.map +1 -1
  159. package/lib/builtin/grep-tool.js +0 -5
  160. package/lib/builtin/grep-tool.js.map +1 -1
  161. package/lib/builtin/list-dir-tool.d.ts.map +1 -1
  162. package/lib/builtin/list-dir-tool.js +0 -5
  163. package/lib/builtin/list-dir-tool.js.map +1 -1
  164. package/lib/builtin/memory-search-tool.js +1 -1
  165. package/lib/builtin/memory-search-tool.js.map +1 -1
  166. package/lib/builtin/memory-upsert-tool.js +1 -1
  167. package/lib/builtin/memory-upsert-tool.js.map +1 -1
  168. package/lib/builtin/read-file-tool.d.ts.map +1 -1
  169. package/lib/builtin/read-file-tool.js +0 -13
  170. package/lib/builtin/read-file-tool.js.map +1 -1
  171. package/lib/builtin/spawn-task-tool.d.ts.map +1 -1
  172. package/lib/builtin/spawn-task-tool.js +8 -10
  173. package/lib/builtin/spawn-task-tool.js.map +1 -1
  174. package/lib/builtin/web-fetch-tool.d.ts.map +1 -1
  175. package/lib/builtin/web-fetch-tool.js +9 -28
  176. package/lib/builtin/web-fetch-tool.js.map +1 -1
  177. package/lib/builtin/web-search-tool.d.ts.map +1 -1
  178. package/lib/builtin/web-search-tool.js +10 -0
  179. package/lib/builtin/web-search-tool.js.map +1 -1
  180. package/lib/builtin/write-file-tool.d.ts.map +1 -1
  181. package/lib/builtin/write-file-tool.js +0 -7
  182. package/lib/builtin/write-file-tool.js.map +1 -1
  183. package/lib/builtin-tools.d.ts +3 -14
  184. package/lib/builtin-tools.d.ts.map +1 -1
  185. package/lib/builtin-tools.js +3 -14
  186. package/lib/builtin-tools.js.map +1 -1
  187. package/lib/collaboration/collab-admin-gate.d.ts +1 -1
  188. package/lib/collaboration/collab-admin-gate.d.ts.map +1 -1
  189. package/lib/collaboration/collab-admin-gate.js +8 -8
  190. package/lib/collaboration/collab-admin-gate.js.map +1 -1
  191. package/lib/collaboration/collab-utils.d.ts +15 -0
  192. package/lib/collaboration/collab-utils.d.ts.map +1 -0
  193. package/lib/collaboration/collab-utils.js +37 -0
  194. package/lib/collaboration/collab-utils.js.map +1 -0
  195. package/lib/collaboration/collaboration-artifact-repository.d.ts +2 -0
  196. package/lib/collaboration/collaboration-artifact-repository.d.ts.map +1 -1
  197. package/lib/collaboration/collaboration-artifact-repository.js +17 -5
  198. package/lib/collaboration/collaboration-artifact-repository.js.map +1 -1
  199. package/lib/collaboration/collaboration-commands.d.ts +3 -3
  200. package/lib/collaboration/collaboration-commands.d.ts.map +1 -1
  201. package/lib/collaboration/collaboration-commands.js +25 -156
  202. package/lib/collaboration/collaboration-commands.js.map +1 -1
  203. package/lib/collaboration/collaboration-config.d.ts +5 -5
  204. package/lib/collaboration/collaboration-config.d.ts.map +1 -1
  205. package/lib/collaboration/collaboration-config.js +19 -19
  206. package/lib/collaboration/collaboration-config.js.map +1 -1
  207. package/lib/collaboration/collaboration-context.d.ts +5 -2
  208. package/lib/collaboration/collaboration-context.d.ts.map +1 -1
  209. package/lib/collaboration/collaboration-context.js +39 -27
  210. package/lib/collaboration/collaboration-context.js.map +1 -1
  211. package/lib/collaboration/collaboration-db-model.d.ts +2 -2
  212. package/lib/collaboration/collaboration-db-model.d.ts.map +1 -1
  213. package/lib/collaboration/collaboration-db-model.js +2 -2
  214. package/lib/collaboration/collaboration-db-model.js.map +1 -1
  215. package/lib/collaboration/collaboration-delegation.d.ts +2 -2
  216. package/lib/collaboration/collaboration-delegation.d.ts.map +1 -1
  217. package/lib/collaboration/collaboration-delegation.js +4 -6
  218. package/lib/collaboration/collaboration-delegation.js.map +1 -1
  219. package/lib/collaboration/collaboration-dispatch.d.ts +4 -4
  220. package/lib/collaboration/collaboration-dispatch.d.ts.map +1 -1
  221. package/lib/collaboration/collaboration-dispatch.js +12 -12
  222. package/lib/collaboration/collaboration-dispatch.js.map +1 -1
  223. package/lib/collaboration/collaboration-kernel-bridge.d.ts +3 -3
  224. package/lib/collaboration/collaboration-kernel-bridge.d.ts.map +1 -1
  225. package/lib/collaboration/collaboration-kernel-bridge.js +15 -16
  226. package/lib/collaboration/collaboration-kernel-bridge.js.map +1 -1
  227. package/lib/collaboration/collaboration-outbound.d.ts +7 -7
  228. package/lib/collaboration/collaboration-outbound.d.ts.map +1 -1
  229. package/lib/collaboration/collaboration-outbound.js +38 -41
  230. package/lib/collaboration/collaboration-outbound.js.map +1 -1
  231. package/lib/collaboration/collaboration-scene-repository.d.ts +17 -15
  232. package/lib/collaboration/collaboration-scene-repository.d.ts.map +1 -1
  233. package/lib/collaboration/collaboration-scene-repository.js +43 -32
  234. package/lib/collaboration/collaboration-scene-repository.js.map +1 -1
  235. package/lib/collaboration/collaboration-turn-snapshot.d.ts +3 -3
  236. package/lib/collaboration/collaboration-turn-snapshot.d.ts.map +1 -1
  237. package/lib/collaboration/collaboration-turn-snapshot.js +6 -6
  238. package/lib/collaboration/collaboration-turn-snapshot.js.map +1 -1
  239. package/lib/collaboration/delegation-state.d.ts +6 -6
  240. package/lib/collaboration/delegation-state.d.ts.map +1 -1
  241. package/lib/collaboration/delegation-state.js +17 -17
  242. package/lib/collaboration/delegation-state.js.map +1 -1
  243. package/lib/collaboration/endpoint-identity.d.ts +4 -4
  244. package/lib/collaboration/endpoint-identity.d.ts.map +1 -1
  245. package/lib/collaboration/endpoint-identity.js +17 -25
  246. package/lib/collaboration/endpoint-identity.js.map +1 -1
  247. package/lib/collaboration/group-message.d.ts +5 -5
  248. package/lib/collaboration/group-message.d.ts.map +1 -1
  249. package/lib/collaboration/group-message.js +10 -71
  250. package/lib/collaboration/group-message.js.map +1 -1
  251. package/lib/collaboration/im-mention-delegate.d.ts +1 -1
  252. package/lib/collaboration/im-mention-delegate.d.ts.map +1 -1
  253. package/lib/collaboration/im-mention-delegate.js +2 -2
  254. package/lib/collaboration/im-mention-delegate.js.map +1 -1
  255. package/lib/collaboration/inbound-peer-handback.d.ts +1 -1
  256. package/lib/collaboration/inbound-peer-handback.d.ts.map +1 -1
  257. package/lib/collaboration/inbound-peer-handback.js +13 -17
  258. package/lib/collaboration/inbound-peer-handback.js.map +1 -1
  259. package/lib/collaboration/inbound-spawn-task.d.ts.map +1 -1
  260. package/lib/collaboration/inbound-spawn-task.js +7 -8
  261. package/lib/collaboration/inbound-spawn-task.js.map +1 -1
  262. package/lib/collaboration/inbound-turn-tools.d.ts +1 -1
  263. package/lib/collaboration/inbound-turn-tools.d.ts.map +1 -1
  264. package/lib/collaboration/inbound-turn-tools.js +8 -3
  265. package/lib/collaboration/inbound-turn-tools.js.map +1 -1
  266. package/lib/collaboration/index.d.ts +1 -5
  267. package/lib/collaboration/index.d.ts.map +1 -1
  268. package/lib/collaboration/index.js +1 -4
  269. package/lib/collaboration/index.js.map +1 -1
  270. package/lib/collaboration/init-observe-hook.d.ts +8 -11
  271. package/lib/collaboration/init-observe-hook.d.ts.map +1 -1
  272. package/lib/collaboration/init-observe-hook.js +18 -40
  273. package/lib/collaboration/init-observe-hook.js.map +1 -1
  274. package/lib/collaboration/init-wizard-service.d.ts +2 -2
  275. package/lib/collaboration/init-wizard-service.d.ts.map +1 -1
  276. package/lib/collaboration/init-wizard-service.js +9 -11
  277. package/lib/collaboration/init-wizard-service.js.map +1 -1
  278. package/lib/collaboration/outbound-resolver.d.ts +3 -3
  279. package/lib/collaboration/outbound-resolver.d.ts.map +1 -1
  280. package/lib/collaboration/outbound-resolver.js +18 -18
  281. package/lib/collaboration/outbound-resolver.js.map +1 -1
  282. package/lib/collaboration/peer-policy.d.ts +7 -7
  283. package/lib/collaboration/peer-policy.d.ts.map +1 -1
  284. package/lib/collaboration/peer-policy.js +19 -19
  285. package/lib/collaboration/peer-policy.js.map +1 -1
  286. package/lib/collaboration/resolve-agent-session-key.js +2 -2
  287. package/lib/collaboration/resolve-agent-session-key.js.map +1 -1
  288. package/lib/collaboration/runtime-inbound-gate.d.ts.map +1 -1
  289. package/lib/collaboration/runtime-inbound-gate.js +26 -32
  290. package/lib/collaboration/runtime-inbound-gate.js.map +1 -1
  291. package/lib/collaboration/scene-identity-service.d.ts +13 -11
  292. package/lib/collaboration/scene-identity-service.d.ts.map +1 -1
  293. package/lib/collaboration/scene-identity-service.js +33 -22
  294. package/lib/collaboration/scene-identity-service.js.map +1 -1
  295. package/lib/collaboration/scene-service.d.ts +5 -3
  296. package/lib/collaboration/scene-service.d.ts.map +1 -1
  297. package/lib/collaboration/scene-service.js +17 -12
  298. package/lib/collaboration/scene-service.js.map +1 -1
  299. package/lib/collaboration/structured-ai-outbound.d.ts +1 -1
  300. package/lib/collaboration/structured-ai-outbound.d.ts.map +1 -1
  301. package/lib/collaboration/structured-ai-outbound.js +8 -9
  302. package/lib/collaboration/structured-ai-outbound.js.map +1 -1
  303. package/lib/collaboration/turn-plan-resolver.d.ts +2 -2
  304. package/lib/collaboration/turn-plan-resolver.d.ts.map +1 -1
  305. package/lib/collaboration/turn-plan-resolver.js +12 -12
  306. package/lib/collaboration/turn-plan-resolver.js.map +1 -1
  307. package/lib/collaboration/types.d.ts +6 -6
  308. package/lib/collaboration/types.d.ts.map +1 -1
  309. package/lib/collaboration/wire-collaboration-storage.d.ts.map +1 -1
  310. package/lib/collaboration/wire-collaboration-storage.js +0 -2
  311. package/lib/collaboration/wire-collaboration-storage.js.map +1 -1
  312. package/lib/common-adapter-tools.js +1 -1
  313. package/lib/common-adapter-tools.js.map +1 -1
  314. package/lib/config/agent-interfaces.d.ts +1 -2
  315. package/lib/config/agent-interfaces.d.ts.map +1 -1
  316. package/lib/config/fix-ai-config.d.ts.map +1 -1
  317. package/lib/config/fix-ai-config.js +52 -3
  318. package/lib/config/fix-ai-config.js.map +1 -1
  319. package/lib/config/index.d.ts +1 -1
  320. package/lib/config/index.d.ts.map +1 -1
  321. package/lib/config/index.js.map +1 -1
  322. package/lib/config/normalize-ai-config.d.ts +4 -2
  323. package/lib/config/normalize-ai-config.d.ts.map +1 -1
  324. package/lib/config/normalize-ai-config.js +29 -81
  325. package/lib/config/normalize-ai-config.js.map +1 -1
  326. package/lib/config/validate-ai-config.d.ts.map +1 -1
  327. package/lib/config/validate-ai-config.js +10 -0
  328. package/lib/config/validate-ai-config.js.map +1 -1
  329. package/lib/config/zhin-agent-config.d.ts +14 -0
  330. package/lib/config/zhin-agent-config.d.ts.map +1 -1
  331. package/lib/config/zhin-agent-defaults.d.ts.map +1 -1
  332. package/lib/config/zhin-agent-defaults.js +11 -0
  333. package/lib/config/zhin-agent-defaults.js.map +1 -1
  334. package/lib/context/context-system.d.ts +4 -2
  335. package/lib/context/context-system.d.ts.map +1 -1
  336. package/lib/context/context-system.js +15 -12
  337. package/lib/context/context-system.js.map +1 -1
  338. package/lib/context/contracts.d.ts +3 -3
  339. package/lib/context/contracts.d.ts.map +1 -1
  340. package/lib/context/default-builders.js +3 -3
  341. package/lib/context/default-builders.js.map +1 -1
  342. package/lib/context/im-turn-context-adapter.d.ts +9 -0
  343. package/lib/context/im-turn-context-adapter.d.ts.map +1 -0
  344. package/lib/context/im-turn-context-adapter.js +54 -0
  345. package/lib/context/im-turn-context-adapter.js.map +1 -0
  346. package/lib/context/index.d.ts +2 -2
  347. package/lib/context/index.d.ts.map +1 -1
  348. package/lib/context/index.js +1 -1
  349. package/lib/context/index.js.map +1 -1
  350. package/lib/context/turn-envelope.d.ts +5 -4
  351. package/lib/context/turn-envelope.d.ts.map +1 -1
  352. package/lib/context/turn-envelope.js +43 -50
  353. package/lib/context/turn-envelope.js.map +1 -1
  354. package/lib/core/agent-core-run.d.ts +37 -14
  355. package/lib/core/agent-core-run.d.ts.map +1 -1
  356. package/lib/core/agent-core-run.js +79 -182
  357. package/lib/core/agent-core-run.js.map +1 -1
  358. package/lib/core/agent-loop-standalone.d.ts.map +1 -1
  359. package/lib/core/agent-loop-standalone.js +35 -34
  360. package/lib/core/agent-loop-standalone.js.map +1 -1
  361. package/lib/core/agent-run-shared.d.ts +4 -0
  362. package/lib/core/agent-run-shared.d.ts.map +1 -0
  363. package/lib/core/agent-run-shared.js +8 -0
  364. package/lib/core/agent-run-shared.js.map +1 -0
  365. package/lib/core/compose-deps.d.ts.map +1 -1
  366. package/lib/core/compose-deps.js +1 -2
  367. package/lib/core/compose-deps.js.map +1 -1
  368. package/lib/core/spawn-delegation.d.ts +23 -0
  369. package/lib/core/spawn-delegation.d.ts.map +1 -0
  370. package/lib/core/spawn-delegation.js +64 -0
  371. package/lib/core/spawn-delegation.js.map +1 -0
  372. package/lib/core/tool-execution-authority.d.ts +21 -0
  373. package/lib/core/tool-execution-authority.d.ts.map +1 -0
  374. package/lib/core/tool-execution-authority.js +2 -0
  375. package/lib/core/tool-execution-authority.js.map +1 -0
  376. package/lib/core/turn-event-mapper.d.ts.map +1 -1
  377. package/lib/core/turn-event-mapper.js +13 -0
  378. package/lib/core/turn-event-mapper.js.map +1 -1
  379. package/lib/deferred-worker-runner.d.ts.map +1 -1
  380. package/lib/deferred-worker-runner.js +9 -23
  381. package/lib/deferred-worker-runner.js.map +1 -1
  382. package/lib/discovery/agent-surface-info.d.ts.map +1 -1
  383. package/lib/discovery/agent-surface-info.js +7 -2
  384. package/lib/discovery/agent-surface-info.js.map +1 -1
  385. package/lib/discovery/tools.js +2 -2
  386. package/lib/discovery/tools.js.map +1 -1
  387. package/lib/event/event-emitter.d.ts.map +1 -1
  388. package/lib/event/event-emitter.js +2 -13
  389. package/lib/event/event-emitter.js.map +1 -1
  390. package/lib/event/turn-event.d.ts +35 -2
  391. package/lib/event/turn-event.d.ts.map +1 -1
  392. package/lib/event/turn-event.js +4 -1
  393. package/lib/event/turn-event.js.map +1 -1
  394. package/lib/event/turn-to-agent-stream.js +20 -0
  395. package/lib/event/turn-to-agent-stream.js.map +1 -1
  396. package/lib/hooks.d.ts +1 -1
  397. package/lib/hooks.d.ts.map +1 -1
  398. package/lib/index.d.ts +34 -27
  399. package/lib/index.d.ts.map +1 -1
  400. package/lib/index.js +26 -21
  401. package/lib/index.js.map +1 -1
  402. package/lib/ingress/capability-ingress.d.ts +3 -1
  403. package/lib/ingress/capability-ingress.d.ts.map +1 -1
  404. package/lib/ingress/capability-ingress.js +10 -6
  405. package/lib/ingress/capability-ingress.js.map +1 -1
  406. package/lib/init/configure-zhin-agent.d.ts +7 -35
  407. package/lib/init/configure-zhin-agent.d.ts.map +1 -1
  408. package/lib/init/configure-zhin-agent.js +1 -1
  409. package/lib/init/configure-zhin-agent.js.map +1 -1
  410. package/lib/init/create-zhin-agent.d.ts.map +1 -1
  411. package/lib/init/create-zhin-agent.js +64 -78
  412. package/lib/init/create-zhin-agent.js.map +1 -1
  413. package/lib/init/dispose-zhin-agent.d.ts +6 -22
  414. package/lib/init/dispose-zhin-agent.d.ts.map +1 -1
  415. package/lib/init/dispose-zhin-agent.js +1 -2
  416. package/lib/init/dispose-zhin-agent.js.map +1 -1
  417. package/lib/init/introspection-collectors.js +2 -2
  418. package/lib/init/introspection-collectors.js.map +1 -1
  419. package/lib/init/register-ai-service.d.ts.map +1 -1
  420. package/lib/init/register-ai-service.js +3 -4
  421. package/lib/init/register-ai-service.js.map +1 -1
  422. package/lib/init/register-builtin-tools.d.ts.map +1 -1
  423. package/lib/init/register-builtin-tools.js +12 -30
  424. package/lib/init/register-builtin-tools.js.map +1 -1
  425. package/lib/init/register-db-upgrade.d.ts.map +1 -1
  426. package/lib/init/register-db-upgrade.js +5 -9
  427. package/lib/init/register-db-upgrade.js.map +1 -1
  428. package/lib/init/register-group-session-passive.d.ts.map +1 -1
  429. package/lib/init/register-group-session-passive.js +15 -10
  430. package/lib/init/register-group-session-passive.js.map +1 -1
  431. package/lib/init/register-init-wizard-guardrail.d.ts.map +1 -1
  432. package/lib/init/register-init-wizard-guardrail.js +6 -11
  433. package/lib/init/register-init-wizard-guardrail.js.map +1 -1
  434. package/lib/init/register-introspection-commands.d.ts.map +1 -1
  435. package/lib/init/register-introspection-commands.js +20 -1
  436. package/lib/init/register-introspection-commands.js.map +1 -1
  437. package/lib/init/register-mcp-from-config.js +4 -4
  438. package/lib/init/register-mcp-from-config.js.map +1 -1
  439. package/lib/init/upgrade-endpoint-id-schema.d.ts +2 -2
  440. package/lib/init/upgrade-endpoint-id-schema.d.ts.map +1 -1
  441. package/lib/init/upgrade-endpoint-id-schema.js +3 -3
  442. package/lib/init/upgrade-endpoint-id-schema.js.map +1 -1
  443. package/lib/init.d.ts +4 -22
  444. package/lib/init.d.ts.map +1 -1
  445. package/lib/init.js +6 -57
  446. package/lib/init.js.map +1 -1
  447. package/lib/interaction/index.d.ts +2 -0
  448. package/lib/interaction/index.d.ts.map +1 -0
  449. package/lib/interaction/index.js +2 -0
  450. package/lib/interaction/index.js.map +1 -0
  451. package/lib/interaction/interaction-router.d.ts +20 -0
  452. package/lib/interaction/interaction-router.d.ts.map +1 -0
  453. package/lib/interaction/interaction-router.js +146 -0
  454. package/lib/interaction/interaction-router.js.map +1 -0
  455. package/lib/internal/agent-host.d.ts +58 -64
  456. package/lib/internal/agent-host.d.ts.map +1 -1
  457. package/lib/internal/ai-service-refs.d.ts +8 -0
  458. package/lib/internal/ai-service-refs.d.ts.map +1 -0
  459. package/lib/internal/ai-service-refs.js +7 -0
  460. package/lib/internal/ai-service-refs.js.map +1 -0
  461. package/lib/internal/as-private.d.ts +3 -6
  462. package/lib/internal/as-private.d.ts.map +1 -1
  463. package/lib/internal/as-private.js.map +1 -1
  464. package/lib/internal/host-types.d.ts +26 -3
  465. package/lib/internal/host-types.d.ts.map +1 -1
  466. package/lib/internal/prompt-trace.d.ts.map +1 -1
  467. package/lib/internal/prompt-trace.js +4 -15
  468. package/lib/internal/prompt-trace.js.map +1 -1
  469. package/lib/internal/turn-context.d.ts +1 -6
  470. package/lib/internal/turn-context.d.ts.map +1 -1
  471. package/lib/internal/turn-context.js +0 -9
  472. package/lib/internal/turn-context.js.map +1 -1
  473. package/lib/journal/file-journal-store.d.ts +21 -0
  474. package/lib/journal/file-journal-store.d.ts.map +1 -0
  475. package/lib/journal/file-journal-store.js +200 -0
  476. package/lib/journal/file-journal-store.js.map +1 -0
  477. package/lib/journal/index.d.ts +3 -0
  478. package/lib/journal/index.d.ts.map +1 -0
  479. package/lib/journal/index.js +3 -0
  480. package/lib/journal/index.js.map +1 -0
  481. package/lib/journal/persistent-turn-journal.d.ts +13 -0
  482. package/lib/journal/persistent-turn-journal.d.ts.map +1 -0
  483. package/lib/journal/persistent-turn-journal.js +72 -0
  484. package/lib/journal/persistent-turn-journal.js.map +1 -0
  485. package/lib/media/index.d.ts +0 -1
  486. package/lib/media/index.d.ts.map +1 -1
  487. package/lib/media/index.js +0 -1
  488. package/lib/media/index.js.map +1 -1
  489. package/lib/media/media-capabilities.d.ts.map +1 -1
  490. package/lib/media/media-capabilities.js +0 -6
  491. package/lib/media/media-capabilities.js.map +1 -1
  492. package/lib/media/media-normalize.d.ts +1 -12
  493. package/lib/media/media-normalize.d.ts.map +1 -1
  494. package/lib/media/media-normalize.js +0 -71
  495. package/lib/media/media-normalize.js.map +1 -1
  496. package/lib/media/media-router.d.ts +1 -2
  497. package/lib/media/media-router.d.ts.map +1 -1
  498. package/lib/media/media-router.js +2 -10
  499. package/lib/media/media-router.js.map +1 -1
  500. package/lib/media/resolve-config.d.ts.map +1 -1
  501. package/lib/media/resolve-config.js +1 -28
  502. package/lib/media/resolve-config.js.map +1 -1
  503. package/lib/media/subagent-inbound.d.ts +2 -2
  504. package/lib/media/subagent-inbound.d.ts.map +1 -1
  505. package/lib/media/subagent-inbound.js +2 -7
  506. package/lib/media/subagent-inbound.js.map +1 -1
  507. package/lib/media/vision-capability.d.ts +1 -3
  508. package/lib/media/vision-capability.d.ts.map +1 -1
  509. package/lib/media/vision-capability.js +0 -15
  510. package/lib/media/vision-capability.js.map +1 -1
  511. package/lib/memory/compaction-runtime.d.ts +3 -4
  512. package/lib/memory/compaction-runtime.d.ts.map +1 -1
  513. package/lib/memory/compaction-runtime.js +0 -10
  514. package/lib/memory/compaction-runtime.js.map +1 -1
  515. package/lib/memory/memory-system.d.ts.map +1 -1
  516. package/lib/memory/memory-system.js +1 -2
  517. package/lib/memory/memory-system.js.map +1 -1
  518. package/lib/memory-entry-registry.d.ts +6 -0
  519. package/lib/memory-entry-registry.d.ts.map +1 -1
  520. package/lib/memory-entry-registry.js +19 -3
  521. package/lib/memory-entry-registry.js.map +1 -1
  522. package/lib/memory-layers.d.ts +2 -2
  523. package/lib/memory-layers.d.ts.map +1 -1
  524. package/lib/memory-layers.js +11 -22
  525. package/lib/memory-layers.js.map +1 -1
  526. package/lib/orchestration-runtime-registry.d.ts +3 -1
  527. package/lib/orchestration-runtime-registry.d.ts.map +1 -1
  528. package/lib/orchestration-runtime-registry.js +9 -4
  529. package/lib/orchestration-runtime-registry.js.map +1 -1
  530. package/lib/orchestrator/agent-dispatcher.d.ts +3 -38
  531. package/lib/orchestrator/agent-dispatcher.d.ts.map +1 -1
  532. package/lib/orchestrator/agent-dispatcher.js +2 -155
  533. package/lib/orchestrator/agent-dispatcher.js.map +1 -1
  534. package/lib/orchestrator/bootstrap-executors.d.ts +5 -1
  535. package/lib/orchestrator/bootstrap-executors.d.ts.map +1 -1
  536. package/lib/orchestrator/bootstrap-executors.js +65 -36
  537. package/lib/orchestrator/bootstrap-executors.js.map +1 -1
  538. package/lib/orchestrator/index.d.ts +1 -1
  539. package/lib/orchestrator/index.d.ts.map +1 -1
  540. package/lib/orchestrator/index.js +1 -1
  541. package/lib/orchestrator/index.js.map +1 -1
  542. package/lib/orchestrator/orchestration-mappers.js +8 -8
  543. package/lib/orchestrator/orchestration-mappers.js.map +1 -1
  544. package/lib/orchestrator/orchestration-service.d.ts +18 -9
  545. package/lib/orchestrator/orchestration-service.d.ts.map +1 -1
  546. package/lib/orchestrator/orchestration-service.js +50 -47
  547. package/lib/orchestrator/orchestration-service.js.map +1 -1
  548. package/lib/orchestrator/remote-agent-registry.d.ts +3 -3
  549. package/lib/orchestrator/remote-agent-registry.d.ts.map +1 -1
  550. package/lib/orchestrator/remote-agent-registry.js +9 -13
  551. package/lib/orchestrator/remote-agent-registry.js.map +1 -1
  552. package/lib/orchestrator/remote-task-executor.d.ts.map +1 -1
  553. package/lib/orchestrator/remote-task-executor.js +12 -4
  554. package/lib/orchestrator/remote-task-executor.js.map +1 -1
  555. package/lib/orchestrator/remote-task-poller.d.ts +3 -2
  556. package/lib/orchestrator/remote-task-poller.d.ts.map +1 -1
  557. package/lib/orchestrator/remote-task-poller.js +18 -15
  558. package/lib/orchestrator/remote-task-poller.js.map +1 -1
  559. package/lib/orchestrator/role-configs.d.ts +30 -0
  560. package/lib/orchestrator/role-configs.d.ts.map +1 -0
  561. package/lib/orchestrator/role-configs.js +133 -0
  562. package/lib/orchestrator/role-configs.js.map +1 -0
  563. package/lib/orchestrator/task-queue.d.ts +3 -2
  564. package/lib/orchestrator/task-queue.d.ts.map +1 -1
  565. package/lib/orchestrator/task-queue.js +12 -11
  566. package/lib/orchestrator/task-queue.js.map +1 -1
  567. package/lib/orchestrator/tool-selection.d.ts +4 -3
  568. package/lib/orchestrator/tool-selection.d.ts.map +1 -1
  569. package/lib/orchestrator/tool-selection.js +17 -14
  570. package/lib/orchestrator/tool-selection.js.map +1 -1
  571. package/lib/orchestrator/types.d.ts +3 -2
  572. package/lib/orchestrator/types.d.ts.map +1 -1
  573. package/lib/outbound/send-proactive.js +1 -1
  574. package/lib/outbound/send-proactive.js.map +1 -1
  575. package/lib/plugin-ai-hook-bus.d.ts +3 -6
  576. package/lib/plugin-ai-hook-bus.d.ts.map +1 -1
  577. package/lib/plugin-ai-hook-bus.js +2 -20
  578. package/lib/plugin-ai-hook-bus.js.map +1 -1
  579. package/lib/plugin-runtime/agent-host-port.d.ts +25 -0
  580. package/lib/plugin-runtime/agent-host-port.d.ts.map +1 -1
  581. package/lib/plugin-runtime/agent-host-port.js.map +1 -1
  582. package/lib/plugin-runtime/agent-runtime.d.ts +61 -8
  583. package/lib/plugin-runtime/agent-runtime.d.ts.map +1 -1
  584. package/lib/plugin-runtime/agent-runtime.js +226 -11
  585. package/lib/plugin-runtime/agent-runtime.js.map +1 -1
  586. package/lib/plugin-runtime/capability-ingress.d.ts +4 -4
  587. package/lib/plugin-runtime/capability-ingress.d.ts.map +1 -1
  588. package/lib/plugin-runtime/capability-ingress.js +46 -20
  589. package/lib/plugin-runtime/capability-ingress.js.map +1 -1
  590. package/lib/plugin-runtime/capability-tools.d.ts +17 -0
  591. package/lib/plugin-runtime/capability-tools.d.ts.map +1 -0
  592. package/lib/plugin-runtime/capability-tools.js +55 -0
  593. package/lib/plugin-runtime/capability-tools.js.map +1 -0
  594. package/lib/plugin-runtime/deferred-capability-plan.d.ts +30 -0
  595. package/lib/plugin-runtime/deferred-capability-plan.d.ts.map +1 -0
  596. package/lib/plugin-runtime/deferred-capability-plan.js +152 -0
  597. package/lib/plugin-runtime/deferred-capability-plan.js.map +1 -0
  598. package/lib/plugin-runtime/full-agent-turn-engine.d.ts +17 -0
  599. package/lib/plugin-runtime/full-agent-turn-engine.d.ts.map +1 -0
  600. package/lib/plugin-runtime/full-agent-turn-engine.js +174 -0
  601. package/lib/plugin-runtime/full-agent-turn-engine.js.map +1 -0
  602. package/lib/plugin-runtime/host-mcp-projection.d.ts +10 -0
  603. package/lib/plugin-runtime/host-mcp-projection.d.ts.map +1 -0
  604. package/lib/plugin-runtime/host-mcp-projection.js +33 -0
  605. package/lib/plugin-runtime/host-mcp-projection.js.map +1 -0
  606. package/lib/plugin-runtime/host-tool-projection.d.ts +21 -0
  607. package/lib/plugin-runtime/host-tool-projection.d.ts.map +1 -0
  608. package/lib/plugin-runtime/host-tool-projection.js +22 -0
  609. package/lib/plugin-runtime/host-tool-projection.js.map +1 -0
  610. package/lib/plugin-runtime/index.d.ts +10 -0
  611. package/lib/plugin-runtime/index.d.ts.map +1 -1
  612. package/lib/plugin-runtime/index.js +10 -0
  613. package/lib/plugin-runtime/index.js.map +1 -1
  614. package/lib/plugin-runtime/native-file-tools.d.ts +9 -0
  615. package/lib/plugin-runtime/native-file-tools.d.ts.map +1 -0
  616. package/lib/plugin-runtime/native-file-tools.js +240 -0
  617. package/lib/plugin-runtime/native-file-tools.js.map +1 -0
  618. package/lib/plugin-runtime/native-interaction-tools.d.ts +8 -0
  619. package/lib/plugin-runtime/native-interaction-tools.d.ts.map +1 -0
  620. package/lib/plugin-runtime/native-interaction-tools.js +72 -0
  621. package/lib/plugin-runtime/native-interaction-tools.js.map +1 -0
  622. package/lib/plugin-runtime/native-todo-tools.d.ts +26 -0
  623. package/lib/plugin-runtime/native-todo-tools.d.ts.map +1 -0
  624. package/lib/plugin-runtime/native-todo-tools.js +152 -0
  625. package/lib/plugin-runtime/native-todo-tools.js.map +1 -0
  626. package/lib/plugin-runtime/native-web-tools.d.ts +10 -0
  627. package/lib/plugin-runtime/native-web-tools.d.ts.map +1 -0
  628. package/lib/plugin-runtime/native-web-tools.js +120 -0
  629. package/lib/plugin-runtime/native-web-tools.js.map +1 -0
  630. package/lib/prompt/assembly.d.ts +19 -9
  631. package/lib/prompt/assembly.d.ts.map +1 -1
  632. package/lib/prompt/assembly.js +54 -26
  633. package/lib/prompt/assembly.js.map +1 -1
  634. package/lib/prompt/index.d.ts +3 -2
  635. package/lib/prompt/index.d.ts.map +1 -1
  636. package/lib/prompt/index.js +2 -2
  637. package/lib/prompt/index.js.map +1 -1
  638. package/lib/prompt/model-aware-builder.d.ts.map +1 -1
  639. package/lib/prompt/model-aware-builder.js +13 -14
  640. package/lib/prompt/model-aware-builder.js.map +1 -1
  641. package/lib/prompt/model-prompt-strategy.d.ts.map +1 -1
  642. package/lib/prompt/model-prompt-strategy.js +79 -0
  643. package/lib/prompt/model-prompt-strategy.js.map +1 -1
  644. package/lib/prompt/rules/critical-rules.d.ts.map +1 -1
  645. package/lib/prompt/rules/critical-rules.js +10 -12
  646. package/lib/prompt/rules/critical-rules.js.map +1 -1
  647. package/lib/prompt/system-prompt.d.ts +4 -23
  648. package/lib/prompt/system-prompt.d.ts.map +1 -1
  649. package/lib/prompt/system-prompt.js +22 -348
  650. package/lib/prompt/system-prompt.js.map +1 -1
  651. package/lib/prompt/templates.d.ts +3 -6
  652. package/lib/prompt/templates.d.ts.map +1 -1
  653. package/lib/prompt/templates.js +17 -21
  654. package/lib/prompt/templates.js.map +1 -1
  655. package/lib/prompt/turn-prompt-profile.d.ts +16 -0
  656. package/lib/prompt/turn-prompt-profile.d.ts.map +1 -0
  657. package/lib/prompt/turn-prompt-profile.js +2 -0
  658. package/lib/prompt/turn-prompt-profile.js.map +1 -0
  659. package/lib/routing/route-matcher.d.ts +2 -2
  660. package/lib/routing/route-matcher.d.ts.map +1 -1
  661. package/lib/routing/route-matcher.js +1 -1
  662. package/lib/routing/route-matcher.js.map +1 -1
  663. package/lib/routing/subagent-summarize.d.ts.map +1 -1
  664. package/lib/routing/subagent-summarize.js +1 -6
  665. package/lib/routing/subagent-summarize.js.map +1 -1
  666. package/lib/schedule-domain/audit-logger.d.ts +38 -0
  667. package/lib/schedule-domain/audit-logger.d.ts.map +1 -0
  668. package/lib/schedule-domain/audit-logger.js +27 -0
  669. package/lib/schedule-domain/audit-logger.js.map +1 -0
  670. package/lib/schedule-domain/budget-guard.d.ts +27 -0
  671. package/lib/schedule-domain/budget-guard.d.ts.map +1 -0
  672. package/lib/schedule-domain/budget-guard.js +48 -0
  673. package/lib/schedule-domain/budget-guard.js.map +1 -0
  674. package/lib/schedule-domain/execution-domain.d.ts +49 -0
  675. package/lib/schedule-domain/execution-domain.d.ts.map +1 -0
  676. package/lib/schedule-domain/execution-domain.js +125 -0
  677. package/lib/schedule-domain/execution-domain.js.map +1 -0
  678. package/lib/schedule-domain/index.d.ts +8 -0
  679. package/lib/schedule-domain/index.d.ts.map +1 -0
  680. package/lib/schedule-domain/index.js +8 -0
  681. package/lib/schedule-domain/index.js.map +1 -0
  682. package/lib/schedule-domain/output-validator.d.ts +7 -0
  683. package/lib/schedule-domain/output-validator.d.ts.map +1 -0
  684. package/lib/schedule-domain/output-validator.js +36 -0
  685. package/lib/schedule-domain/output-validator.js.map +1 -0
  686. package/lib/schedule-domain/prompt-assembler.d.ts +22 -0
  687. package/lib/schedule-domain/prompt-assembler.d.ts.map +1 -0
  688. package/lib/schedule-domain/prompt-assembler.js +75 -0
  689. package/lib/schedule-domain/prompt-assembler.js.map +1 -0
  690. package/lib/schedule-domain/security-harness.d.ts +19 -0
  691. package/lib/schedule-domain/security-harness.d.ts.map +1 -0
  692. package/lib/schedule-domain/security-harness.js +89 -0
  693. package/lib/schedule-domain/security-harness.js.map +1 -0
  694. package/lib/schedule-domain/tool-resolver.d.ts +20 -0
  695. package/lib/schedule-domain/tool-resolver.d.ts.map +1 -0
  696. package/lib/schedule-domain/tool-resolver.js +80 -0
  697. package/lib/schedule-domain/tool-resolver.js.map +1 -0
  698. package/lib/schedule-domain/turn-context.d.ts +9 -0
  699. package/lib/schedule-domain/turn-context.d.ts.map +1 -0
  700. package/lib/schedule-domain/turn-context.js +36 -0
  701. package/lib/schedule-domain/turn-context.js.map +1 -0
  702. package/lib/schedule-manager.d.ts +12 -13
  703. package/lib/schedule-manager.d.ts.map +1 -1
  704. package/lib/schedule-manager.js +91 -155
  705. package/lib/schedule-manager.js.map +1 -1
  706. package/lib/security/anomaly-detection.d.ts +3 -6
  707. package/lib/security/anomaly-detection.d.ts.map +1 -1
  708. package/lib/security/anomaly-detection.js +24 -31
  709. package/lib/security/anomaly-detection.js.map +1 -1
  710. package/lib/security/audit-logger.d.ts +5 -4
  711. package/lib/security/audit-logger.d.ts.map +1 -1
  712. package/lib/security/audit-logger.js +17 -25
  713. package/lib/security/audit-logger.js.map +1 -1
  714. package/lib/security/dangerous-tool-policy.d.ts +1 -1
  715. package/lib/security/dangerous-tool-policy.d.ts.map +1 -1
  716. package/lib/security/dangerous-tool-policy.js +6 -25
  717. package/lib/security/dangerous-tool-policy.js.map +1 -1
  718. package/lib/security/exec-policy.d.ts +2 -1
  719. package/lib/security/exec-policy.d.ts.map +1 -1
  720. package/lib/security/exec-policy.js +6 -11
  721. package/lib/security/exec-policy.js.map +1 -1
  722. package/lib/security/file-policy.d.ts.map +1 -1
  723. package/lib/security/file-policy.js +1 -0
  724. package/lib/security/file-policy.js.map +1 -1
  725. package/lib/security/file-role-policy.d.ts.map +1 -1
  726. package/lib/security/file-role-policy.js +1 -4
  727. package/lib/security/file-role-policy.js.map +1 -1
  728. package/lib/security/index.d.ts +0 -2
  729. package/lib/security/index.d.ts.map +1 -1
  730. package/lib/security/index.js +0 -2
  731. package/lib/security/index.js.map +1 -1
  732. package/lib/security/network-policy-context.d.ts +7 -0
  733. package/lib/security/network-policy-context.d.ts.map +1 -0
  734. package/lib/security/network-policy-context.js +9 -0
  735. package/lib/security/network-policy-context.js.map +1 -0
  736. package/lib/security/network-policy.d.ts +14 -1
  737. package/lib/security/network-policy.d.ts.map +1 -1
  738. package/lib/security/network-policy.js +70 -3
  739. package/lib/security/network-policy.js.map +1 -1
  740. package/lib/security/owner-approve-always-store.d.ts +1 -1
  741. package/lib/security/owner-approve-always-store.d.ts.map +1 -1
  742. package/lib/security/owner-approve-always-store.js +12 -12
  743. package/lib/security/owner-approve-always-store.js.map +1 -1
  744. package/lib/security/policy-facade.d.ts +27 -0
  745. package/lib/security/policy-facade.d.ts.map +1 -1
  746. package/lib/security/policy-facade.js +190 -3
  747. package/lib/security/policy-facade.js.map +1 -1
  748. package/lib/security/sandbox.d.ts +2 -7
  749. package/lib/security/sandbox.d.ts.map +1 -1
  750. package/lib/security/sandbox.js +12 -21
  751. package/lib/security/sandbox.js.map +1 -1
  752. package/lib/security/turn-file-authority.d.ts +14 -0
  753. package/lib/security/turn-file-authority.d.ts.map +1 -0
  754. package/lib/security/turn-file-authority.js +101 -0
  755. package/lib/security/turn-file-authority.js.map +1 -0
  756. package/lib/security/turn-network-client.d.ts +30 -0
  757. package/lib/security/turn-network-client.d.ts.map +1 -0
  758. package/lib/security/turn-network-client.js +111 -0
  759. package/lib/security/turn-network-client.js.map +1 -0
  760. package/lib/service.d.ts +3 -13
  761. package/lib/service.d.ts.map +1 -1
  762. package/lib/service.js +3 -35
  763. package/lib/service.js.map +1 -1
  764. package/lib/session/{session-interaction-port.d.ts → approval-port.d.ts} +4 -7
  765. package/lib/session/approval-port.d.ts.map +1 -0
  766. package/lib/session/{session-interaction-port.js → approval-port.js} +1 -1
  767. package/lib/session/approval-port.js.map +1 -0
  768. package/lib/session/http-approval-adapter.d.ts +2 -2
  769. package/lib/session/http-approval-adapter.d.ts.map +1 -1
  770. package/lib/session/http-approval-adapter.js +1 -1
  771. package/lib/session/http-approval-adapter.js.map +1 -1
  772. package/lib/session/http-approval-waiter.d.ts +1 -1
  773. package/lib/session/http-approval-waiter.d.ts.map +1 -1
  774. package/lib/session/http-approval-waiter.js +25 -2
  775. package/lib/session/http-approval-waiter.js.map +1 -1
  776. package/lib/session/index.d.ts +6 -3
  777. package/lib/session/index.d.ts.map +1 -1
  778. package/lib/session/index.js +3 -2
  779. package/lib/session/index.js.map +1 -1
  780. package/lib/session/passive-group-session.d.ts +8 -10
  781. package/lib/session/passive-group-session.d.ts.map +1 -1
  782. package/lib/session/passive-group-session.js +23 -27
  783. package/lib/session/passive-group-session.js.map +1 -1
  784. package/lib/session/resolve-approval-port.d.ts +7 -0
  785. package/lib/session/resolve-approval-port.d.ts.map +1 -0
  786. package/lib/session/resolve-approval-port.js +13 -0
  787. package/lib/session/resolve-approval-port.js.map +1 -0
  788. package/lib/session/session-io.d.ts +3 -4
  789. package/lib/session/session-io.d.ts.map +1 -1
  790. package/lib/session/session-io.js +7 -15
  791. package/lib/session/session-io.js.map +1 -1
  792. package/lib/session/session-system.d.ts +16 -1
  793. package/lib/session/session-system.d.ts.map +1 -1
  794. package/lib/session/session-system.js +38 -10
  795. package/lib/session/session-system.js.map +1 -1
  796. package/lib/session/session-tree-commands.d.ts.map +1 -1
  797. package/lib/session/session-tree-commands.js +2 -4
  798. package/lib/session/session-tree-commands.js.map +1 -1
  799. package/lib/session/turn-ingress-session.d.ts +23 -0
  800. package/lib/session/turn-ingress-session.d.ts.map +1 -0
  801. package/lib/session/turn-ingress-session.js +89 -0
  802. package/lib/session/turn-ingress-session.js.map +1 -0
  803. package/lib/session-tree-runtime-registry.d.ts +3 -1
  804. package/lib/session-tree-runtime-registry.d.ts.map +1 -1
  805. package/lib/session-tree-runtime-registry.js +6 -4
  806. package/lib/session-tree-runtime-registry.js.map +1 -1
  807. package/lib/stability/memory-pressure.d.ts.map +1 -1
  808. package/lib/stability/memory-pressure.js +4 -21
  809. package/lib/stability/memory-pressure.js.map +1 -1
  810. package/lib/subagent/subagent-runtime.d.ts.map +1 -1
  811. package/lib/subagent/subagent-runtime.js +1 -5
  812. package/lib/subagent/subagent-runtime.js.map +1 -1
  813. package/lib/subagent/subagent-system-init.js +2 -2
  814. package/lib/subagent/subagent-system-init.js.map +1 -1
  815. package/lib/subagent-ai-events.d.ts +3 -0
  816. package/lib/subagent-ai-events.d.ts.map +1 -1
  817. package/lib/subagent-ai-events.js +4 -1
  818. package/lib/subagent-ai-events.js.map +1 -1
  819. package/lib/subagent-goal-notify.d.ts +1 -1
  820. package/lib/subagent-goal-notify.d.ts.map +1 -1
  821. package/lib/subagent-goal-notify.js +1 -1
  822. package/lib/subagent-goal-notify.js.map +1 -1
  823. package/lib/task-executor.d.ts +14 -25
  824. package/lib/task-executor.d.ts.map +1 -1
  825. package/lib/task-executor.js +106 -137
  826. package/lib/task-executor.js.map +1 -1
  827. package/lib/tool/builtin-policy-extractors.d.ts +2 -0
  828. package/lib/tool/builtin-policy-extractors.d.ts.map +1 -0
  829. package/lib/tool/builtin-policy-extractors.js +65 -0
  830. package/lib/tool/builtin-policy-extractors.js.map +1 -0
  831. package/lib/tool/classic-tool-execution-authority.d.ts +22 -0
  832. package/lib/tool/classic-tool-execution-authority.d.ts.map +1 -0
  833. package/lib/tool/classic-tool-execution-authority.js +79 -0
  834. package/lib/tool/classic-tool-execution-authority.js.map +1 -0
  835. package/lib/tool/contracts.d.ts +2 -2
  836. package/lib/tool/contracts.d.ts.map +1 -1
  837. package/lib/tool/contracts.js +1 -1
  838. package/lib/tool/deferred-resolution.d.ts +5 -3
  839. package/lib/tool/deferred-resolution.d.ts.map +1 -1
  840. package/lib/tool/deferred-resolution.js +31 -5
  841. package/lib/tool/deferred-resolution.js.map +1 -1
  842. package/lib/tool/index.d.ts +2 -0
  843. package/lib/tool/index.d.ts.map +1 -1
  844. package/lib/tool/index.js +1 -0
  845. package/lib/tool/index.js.map +1 -1
  846. package/lib/tool/prepare-turn-tools.d.ts +2 -0
  847. package/lib/tool/prepare-turn-tools.d.ts.map +1 -1
  848. package/lib/tool/prepare-turn-tools.js +62 -10
  849. package/lib/tool/prepare-turn-tools.js.map +1 -1
  850. package/lib/tool/runtime.d.ts +1 -1
  851. package/lib/tool/runtime.d.ts.map +1 -1
  852. package/lib/tool/runtime.js +1 -1
  853. package/lib/tool/runtime.js.map +1 -1
  854. package/lib/tool/sources.d.ts +5 -2
  855. package/lib/tool/sources.d.ts.map +1 -1
  856. package/lib/tool/sources.js +4 -4
  857. package/lib/tool/sources.js.map +1 -1
  858. package/lib/tool/tool-approval-gate.d.ts +3 -3
  859. package/lib/tool/tool-approval-gate.d.ts.map +1 -1
  860. package/lib/tool/tool-approval-gate.js +2 -1
  861. package/lib/tool/tool-approval-gate.js.map +1 -1
  862. package/lib/tool/tool-runtime.d.ts +52 -0
  863. package/lib/tool/tool-runtime.d.ts.map +1 -0
  864. package/lib/tool/tool-runtime.js +101 -0
  865. package/lib/tool/tool-runtime.js.map +1 -0
  866. package/lib/tool/tool-system.d.ts +7 -3
  867. package/lib/tool/tool-system.d.ts.map +1 -1
  868. package/lib/tool/tool-system.js +12 -6
  869. package/lib/tool/tool-system.js.map +1 -1
  870. package/lib/tool/turn-tool-runtime.d.ts +29 -0
  871. package/lib/tool/turn-tool-runtime.d.ts.map +1 -0
  872. package/lib/tool/turn-tool-runtime.js +89 -0
  873. package/lib/tool/turn-tool-runtime.js.map +1 -0
  874. package/lib/tool-catalog/deferred-turn-controller.d.ts +30 -0
  875. package/lib/tool-catalog/deferred-turn-controller.d.ts.map +1 -0
  876. package/lib/tool-catalog/deferred-turn-controller.js +126 -0
  877. package/lib/tool-catalog/deferred-turn-controller.js.map +1 -0
  878. package/lib/turn/auto-continue.d.ts +5 -4
  879. package/lib/turn/auto-continue.d.ts.map +1 -1
  880. package/lib/turn/auto-continue.js +43 -31
  881. package/lib/turn/auto-continue.js.map +1 -1
  882. package/lib/turn/deferred-turn-state.d.ts +29 -0
  883. package/lib/turn/deferred-turn-state.d.ts.map +1 -0
  884. package/lib/turn/deferred-turn-state.js +35 -0
  885. package/lib/turn/deferred-turn-state.js.map +1 -0
  886. package/lib/turn/execute-agent-turn.d.ts +14 -0
  887. package/lib/turn/execute-agent-turn.d.ts.map +1 -0
  888. package/lib/turn/execute-agent-turn.js +171 -0
  889. package/lib/turn/execute-agent-turn.js.map +1 -0
  890. package/lib/turn/inbound-media.d.ts +3 -3
  891. package/lib/turn/inbound-media.d.ts.map +1 -1
  892. package/lib/turn/inbound-media.js +11 -4
  893. package/lib/turn/inbound-media.js.map +1 -1
  894. package/lib/turn/index.d.ts +8 -1
  895. package/lib/turn/index.d.ts.map +1 -1
  896. package/lib/turn/index.js +5 -1
  897. package/lib/turn/index.js.map +1 -1
  898. package/lib/turn/journal-integrity.d.ts +5 -0
  899. package/lib/turn/journal-integrity.d.ts.map +1 -0
  900. package/lib/turn/journal-integrity.js +8 -0
  901. package/lib/turn/journal-integrity.js.map +1 -0
  902. package/lib/turn/process-stream.d.ts.map +1 -1
  903. package/lib/turn/process-stream.js +21 -55
  904. package/lib/turn/process-stream.js.map +1 -1
  905. package/lib/turn/prompt-controller.d.ts +7 -4
  906. package/lib/turn/prompt-controller.d.ts.map +1 -1
  907. package/lib/turn/prompt-controller.js +23 -11
  908. package/lib/turn/prompt-controller.js.map +1 -1
  909. package/lib/turn/subagent-auto-continue.d.ts +2 -0
  910. package/lib/turn/subagent-auto-continue.d.ts.map +1 -1
  911. package/lib/turn/subagent-auto-continue.js +17 -1
  912. package/lib/turn/subagent-auto-continue.js.map +1 -1
  913. package/lib/turn/task-continuation.d.ts +3 -6
  914. package/lib/turn/task-continuation.d.ts.map +1 -1
  915. package/lib/turn/task-continuation.js +10 -13
  916. package/lib/turn/task-continuation.js.map +1 -1
  917. package/lib/turn/turn-complete.d.ts +1 -0
  918. package/lib/turn/turn-complete.d.ts.map +1 -1
  919. package/lib/turn/turn-complete.js +3 -2
  920. package/lib/turn/turn-complete.js.map +1 -1
  921. package/lib/turn/turn-context-bridge.d.ts +0 -4
  922. package/lib/turn/turn-context-bridge.d.ts.map +1 -1
  923. package/lib/turn/turn-context-bridge.js +0 -10
  924. package/lib/turn/turn-context-bridge.js.map +1 -1
  925. package/lib/turn/turn-event-source.d.ts +15 -0
  926. package/lib/turn/turn-event-source.d.ts.map +1 -0
  927. package/lib/turn/turn-event-source.js +61 -0
  928. package/lib/turn/turn-event-source.js.map +1 -0
  929. package/lib/turn/turn-ingress.d.ts +157 -0
  930. package/lib/turn/turn-ingress.d.ts.map +1 -0
  931. package/lib/turn/turn-ingress.js +76 -0
  932. package/lib/turn/turn-ingress.js.map +1 -0
  933. package/lib/turn/turn-metrics.d.ts.map +1 -1
  934. package/lib/turn/turn-metrics.js +10 -9
  935. package/lib/turn/turn-metrics.js.map +1 -1
  936. package/lib/turn/turn-pipeline.d.ts +10 -3
  937. package/lib/turn/turn-pipeline.d.ts.map +1 -1
  938. package/lib/turn/turn-pipeline.js +73 -41
  939. package/lib/turn/turn-pipeline.js.map +1 -1
  940. package/lib/typing-indicator/adapter-integration.d.ts +3 -5
  941. package/lib/typing-indicator/adapter-integration.d.ts.map +1 -1
  942. package/lib/typing-indicator/adapter-integration.js.map +1 -1
  943. package/lib/typing-indicator/index.d.ts +4 -4
  944. package/lib/typing-indicator/index.d.ts.map +1 -1
  945. package/lib/typing-indicator/index.js +25 -29
  946. package/lib/typing-indicator/index.js.map +1 -1
  947. package/lib/typing-indicator/integration.d.ts +6 -8
  948. package/lib/typing-indicator/integration.d.ts.map +1 -1
  949. package/lib/typing-indicator/integration.js +12 -10
  950. package/lib/typing-indicator/integration.js.map +1 -1
  951. package/lib/utils/keyed-mutex.d.ts +10 -0
  952. package/lib/utils/keyed-mutex.d.ts.map +1 -0
  953. package/lib/utils/keyed-mutex.js +34 -0
  954. package/lib/utils/keyed-mutex.js.map +1 -0
  955. package/lib/zhin-agent/index.d.ts +57 -42
  956. package/lib/zhin-agent/index.d.ts.map +1 -1
  957. package/lib/zhin-agent/index.js +32 -46
  958. package/lib/zhin-agent/index.js.map +1 -1
  959. package/package.json +13 -11
  960. package/lib/assistant/domains/home-assistant.d.ts.map +0 -1
  961. package/lib/assistant/domains/home-assistant.js.map +0 -1
  962. package/lib/assistant/schedule-message.d.ts +0 -9
  963. package/lib/assistant/schedule-message.d.ts.map +0 -1
  964. package/lib/assistant/schedule-message.js +0 -23
  965. package/lib/assistant/schedule-message.js.map +0 -1
  966. package/lib/assistant/schedule-tool-runtime.d.ts +0 -7
  967. package/lib/assistant/schedule-tool-runtime.d.ts.map +0 -1
  968. package/lib/assistant/schedule-tool-runtime.js +0 -50
  969. package/lib/assistant/schedule-tool-runtime.js.map +0 -1
  970. package/lib/builtin/ask-user-session-service.d.ts +0 -40
  971. package/lib/builtin/ask-user-session-service.d.ts.map +0 -1
  972. package/lib/builtin/ask-user-session-service.js +0 -258
  973. package/lib/builtin/ask-user-session-service.js.map +0 -1
  974. package/lib/builtin/ask-user-session.d.ts +0 -18
  975. package/lib/builtin/ask-user-session.d.ts.map +0 -1
  976. package/lib/builtin/ask-user-session.js +0 -21
  977. package/lib/builtin/ask-user-session.js.map +0 -1
  978. package/lib/builtin/ask-user-tool.d.ts +0 -22
  979. package/lib/builtin/ask-user-tool.d.ts.map +0 -1
  980. package/lib/builtin/ask-user-tool.js +0 -148
  981. package/lib/builtin/ask-user-tool.js.map +0 -1
  982. package/lib/builtin/deferred-tool-meta.d.ts +0 -51
  983. package/lib/builtin/deferred-tool-meta.d.ts.map +0 -1
  984. package/lib/builtin/deferred-tool-meta.js +0 -143
  985. package/lib/builtin/deferred-tool-meta.js.map +0 -1
  986. package/lib/collaboration/ask-user-bridge.d.ts +0 -9
  987. package/lib/collaboration/ask-user-bridge.d.ts.map +0 -1
  988. package/lib/collaboration/ask-user-bridge.js +0 -73
  989. package/lib/collaboration/ask-user-bridge.js.map +0 -1
  990. package/lib/collaboration/bootstrap-agent-runtimes.d.ts +0 -22
  991. package/lib/collaboration/bootstrap-agent-runtimes.d.ts.map +0 -1
  992. package/lib/collaboration/bootstrap-agent-runtimes.js +0 -106
  993. package/lib/collaboration/bootstrap-agent-runtimes.js.map +0 -1
  994. package/lib/collaboration/inbound-turn-compat.d.ts +0 -32
  995. package/lib/collaboration/inbound-turn-compat.d.ts.map +0 -1
  996. package/lib/collaboration/inbound-turn-compat.js +0 -30
  997. package/lib/collaboration/inbound-turn-compat.js.map +0 -1
  998. package/lib/collaboration/runtime-registry.d.ts +0 -18
  999. package/lib/collaboration/runtime-registry.d.ts.map +0 -1
  1000. package/lib/collaboration/runtime-registry.js +0 -45
  1001. package/lib/collaboration/runtime-registry.js.map +0 -1
  1002. package/lib/init/management-command-guard.d.ts +0 -6
  1003. package/lib/init/management-command-guard.d.ts.map +0 -1
  1004. package/lib/init/management-command-guard.js +0 -6
  1005. package/lib/init/management-command-guard.js.map +0 -1
  1006. package/lib/init/output-renderer.d.ts +0 -7
  1007. package/lib/init/output-renderer.d.ts.map +0 -1
  1008. package/lib/init/output-renderer.js +0 -44
  1009. package/lib/init/output-renderer.js.map +0 -1
  1010. package/lib/init/register-home-tools.d.ts +0 -2
  1011. package/lib/init/register-home-tools.d.ts.map +0 -1
  1012. package/lib/init/register-home-tools.js +0 -51
  1013. package/lib/init/register-home-tools.js.map +0 -1
  1014. package/lib/init/register-owner-approve-commands.d.ts +0 -10
  1015. package/lib/init/register-owner-approve-commands.d.ts.map +0 -1
  1016. package/lib/init/register-owner-approve-commands.js +0 -12
  1017. package/lib/init/register-owner-approve-commands.js.map +0 -1
  1018. package/lib/media/constants.d.ts +0 -3
  1019. package/lib/media/constants.d.ts.map +0 -1
  1020. package/lib/media/constants.js +0 -3
  1021. package/lib/media/constants.js.map +0 -1
  1022. package/lib/orchestrator/owner-confirm-orchestration.d.ts +0 -39
  1023. package/lib/orchestrator/owner-confirm-orchestration.d.ts.map +0 -1
  1024. package/lib/orchestrator/owner-confirm-orchestration.js +0 -92
  1025. package/lib/orchestrator/owner-confirm-orchestration.js.map +0 -1
  1026. package/lib/orchestrator/owner-orchestration-constants.d.ts +0 -6
  1027. package/lib/orchestrator/owner-orchestration-constants.d.ts.map +0 -1
  1028. package/lib/orchestrator/owner-orchestration-constants.js +0 -10
  1029. package/lib/orchestrator/owner-orchestration-constants.js.map +0 -1
  1030. package/lib/security/dangerous-tool-policy-hook.d.ts +0 -6
  1031. package/lib/security/dangerous-tool-policy-hook.d.ts.map +0 -1
  1032. package/lib/security/dangerous-tool-policy-hook.js +0 -41
  1033. package/lib/security/dangerous-tool-policy-hook.js.map +0 -1
  1034. package/lib/security/exec-policy-hook.d.ts +0 -7
  1035. package/lib/security/exec-policy-hook.d.ts.map +0 -1
  1036. package/lib/security/exec-policy-hook.js +0 -29
  1037. package/lib/security/exec-policy-hook.js.map +0 -1
  1038. package/lib/security/file-policy-hook.d.ts +0 -6
  1039. package/lib/security/file-policy-hook.d.ts.map +0 -1
  1040. package/lib/security/file-policy-hook.js +0 -30
  1041. package/lib/security/file-policy-hook.js.map +0 -1
  1042. package/lib/security/sandbox-enhanced.d.ts +0 -173
  1043. package/lib/security/sandbox-enhanced.d.ts.map +0 -1
  1044. package/lib/security/sandbox-enhanced.js +0 -665
  1045. package/lib/security/sandbox-enhanced.js.map +0 -1
  1046. package/lib/session/im-approval-adapter.d.ts +0 -12
  1047. package/lib/session/im-approval-adapter.d.ts.map +0 -1
  1048. package/lib/session/im-approval-adapter.js +0 -24
  1049. package/lib/session/im-approval-adapter.js.map +0 -1
  1050. package/lib/session/resolve-session-interaction-port.d.ts +0 -9
  1051. package/lib/session/resolve-session-interaction-port.d.ts.map +0 -1
  1052. package/lib/session/resolve-session-interaction-port.js +0 -17
  1053. package/lib/session/resolve-session-interaction-port.js.map +0 -1
  1054. package/lib/session/session-interaction-port.d.ts.map +0 -1
  1055. package/lib/session/session-interaction-port.js.map +0 -1
@@ -1,143 +0,0 @@
1
- /**
2
- * Deferred schema meta tools: discover, load_tool, load_skill
3
- */
4
- import { addSkillToSnapshot, touchToolInSnapshot, touchToolsInSnapshot } from '@zhin.js/ai';
5
- import { catalogToolByName, discoverInCatalog, } from '../tool-catalog/tool-catalog.js';
6
- import { readSkillInstructions } from './load-skill-tool.js';
7
- import { BuiltinBaseTool } from './builtin-base-tool.js';
8
- export const TOOLS_MUTATED_MARKER = '__zhin_tools_mutated__';
9
- const deferredRuntime = new WeakMap();
10
- /** 异步上下文级 runtime:优先于 WeakMap——subagent / standalone loop 的隔离通道 */
11
- import { AsyncLocalStorage } from 'node:async_hooks';
12
- const deferredRuntimeAls = new AsyncLocalStorage();
13
- /**
14
- * 在独立 deferred runtime 下执行:load_tool / discover 的 snapshot 变更只影响本上下文,
15
- * 不会污染父会话(此前 subagent 的 load_tool 会写父会话 snapshot)。
16
- */
17
- export function runWithDeferredToolRuntime(runtime, fn) {
18
- return deferredRuntimeAls.run(runtime, fn);
19
- }
20
- export function bindDeferredToolRuntime(message, runtime) {
21
- deferredRuntime.set(message, runtime);
22
- }
23
- export function getDeferredToolRuntime(message) {
24
- const scoped = deferredRuntimeAls.getStore();
25
- if (scoped)
26
- return scoped;
27
- if (!message)
28
- return undefined;
29
- return deferredRuntime.get(message);
30
- }
31
- function formatDiscoverResults(items) {
32
- if (items.length === 0)
33
- return 'No matches.';
34
- return items
35
- .map(i => `- [${i.kind}] ${i.name}: ${i.brief}`)
36
- .join('\n');
37
- }
38
- function schemaSummary(tool) {
39
- const params = tool.parameters;
40
- if (!params)
41
- return `Loaded tool "${tool.name}".`;
42
- return `Loaded tool "${tool.name}".\nParameters schema:\n${JSON.stringify(params, null, 2)}`;
43
- }
44
- export class DiscoverBuiltinTool extends BuiltinBaseTool {
45
- name = 'discover';
46
- description = 'Search deferred tools and skills by query. kind: tool|skill|all (default all). Empty query returns platform-matched skills.';
47
- parameters = {
48
- type: 'object',
49
- properties: {
50
- query: { type: 'string', description: 'Search query (user intent keywords)' },
51
- kind: { type: 'string', enum: ['tool', 'skill', 'all'], description: 'What to search (default all)' },
52
- mcp_server: { type: 'string', description: 'Filter tools by MCP server name' },
53
- },
54
- };
55
- async run(args, commMessage) {
56
- const runtime = getDeferredToolRuntime(commMessage);
57
- if (!runtime)
58
- return 'deferred runtime not available';
59
- const kind = (typeof args.kind === 'string' ? args.kind : 'all');
60
- const query = typeof args.query === 'string' ? args.query : '';
61
- const mcpServer = typeof args.mcp_server === 'string' ? args.mcp_server : undefined;
62
- const platform = commMessage ? String(commMessage.$adapter) : undefined;
63
- const items = discoverInCatalog({
64
- query,
65
- kind,
66
- topK: runtime.discoverTopK,
67
- platform,
68
- mcpServer,
69
- skillRegistry: runtime.skillRegistry,
70
- catalog: runtime.catalog,
71
- });
72
- return formatDiscoverResults(items);
73
- }
74
- }
75
- export class LoadToolBuiltinTool extends BuiltinBaseTool {
76
- name = 'load_tool';
77
- description = 'Load a deferred tool schema into the session so it can be called.';
78
- parameters = {
79
- type: 'object',
80
- properties: {
81
- name: { type: 'string', description: 'Tool name from discover results' },
82
- },
83
- required: ['name'],
84
- };
85
- async run(args, commMessage) {
86
- const runtime = getDeferredToolRuntime(commMessage);
87
- if (!runtime)
88
- return 'deferred runtime not available';
89
- const name = String(args.name);
90
- const item = catalogToolByName(runtime.catalog).get(name);
91
- if (!item)
92
- return `Tool "${name}" not found in catalog.`;
93
- runtime.snapshot = touchToolInSnapshot(runtime.snapshot, name, runtime.maxLoadedPerSession);
94
- await runtime.persistSnapshot(runtime.snapshot);
95
- return `${schemaSummary(item.fullTool)}\n${TOOLS_MUTATED_MARKER}`;
96
- }
97
- }
98
- export class LoadSkillBuiltinToolMeta extends BuiltinBaseTool {
99
- skillOpts;
100
- name = 'load_skill';
101
- description = 'Load full skill instructions and unlock associated tools for this session.';
102
- parameters = {
103
- type: 'object',
104
- properties: {
105
- name: { type: 'string', description: 'Skill name from discover results' },
106
- },
107
- required: ['name'],
108
- };
109
- constructor(skillOpts) {
110
- super();
111
- this.skillOpts = skillOpts;
112
- }
113
- async run(args, commMessage) {
114
- const runtime = getDeferredToolRuntime(commMessage);
115
- if (!runtime)
116
- return 'deferred runtime not available';
117
- const name = String(args.name);
118
- const instructions = await readSkillInstructions(name, this.skillOpts);
119
- if (instructions.startsWith(`Skill '${name}' not found`)) {
120
- return instructions;
121
- }
122
- runtime.snapshot = addSkillToSnapshot(runtime.snapshot, name);
123
- const skill = runtime.skillRegistry?.getByName(name);
124
- const toolNames = skill?.tools?.map(t => t.name) ?? [];
125
- runtime.snapshot = touchToolsInSnapshot(runtime.snapshot, toolNames, runtime.maxLoadedPerSession);
126
- await runtime.persistSnapshot(runtime.snapshot);
127
- runtime.onSkillLoaded?.(name, instructions, toolNames);
128
- const unlock = toolNames.length > 0 ? `\nUnlocked tools: ${toolNames.join(', ')}` : '';
129
- return `${instructions}${unlock}\n${TOOLS_MUTATED_MARKER}`;
130
- }
131
- }
132
- export function createDeferredMetaTools(skillOpts) {
133
- return [
134
- new DiscoverBuiltinTool().toTool(),
135
- new LoadToolBuiltinTool().toTool(),
136
- new LoadSkillBuiltinToolMeta(skillOpts).toTool(),
137
- ];
138
- }
139
- export function isToolsMutatedResult(result) {
140
- const text = typeof result === 'string' ? result : JSON.stringify(result);
141
- return text.includes(TOOLS_MUTATED_MARKER);
142
- }
143
- //# sourceMappingURL=deferred-tool-meta.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deferred-tool-meta.js","sourceRoot":"","sources":["../../src/builtin/deferred-tool-meta.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAoD,kBAAkB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAG9I,OAAO,EACL,iBAAiB,EACjB,iBAAiB,GAElB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,qBAAqB,EAA6B,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,MAAM,CAAC,MAAM,oBAAoB,GAAG,wBAAwB,CAAC;AAc7D,MAAM,eAAe,GAAG,IAAI,OAAO,EAAgC,CAAC;AAEpE,mEAAmE;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,MAAM,kBAAkB,GAAG,IAAI,iBAAiB,EAAuB,CAAC;AAExE;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CACxC,OAA4B,EAC5B,EAAoB;IAEpB,OAAO,kBAAkB,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,OAAgB,EAAE,OAA4B;IACpF,eAAe,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,OAAiB;IACtD,MAAM,MAAM,GAAG,kBAAkB,CAAC,QAAQ,EAAE,CAAC;IAC7C,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAC1B,IAAI,CAA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IAAI,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC1E,OAAO,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAAC;AAC7C,CAAC"}
@@ -1,9 +0,0 @@
1
- /**
2
- * 群协作场景下 ask_user 与 kernel 委派的衔接。
3
- */
4
- import type { Message } from '@zhin.js/core';
5
- /** 群内禁止用 ask_user 向 Owner 申请「委派授权」——应走 OrchestrationKernel / spawn_task。 */
6
- export declare function shouldBlockDelegationAskUser(commMessage: Message, question: string, questionType: string): string | undefined;
7
- export declare function buildGroupAskUserFollowUp(commMessage: Message, answer: string): string;
8
- export declare function notifyGroupOwnerAskUserResolved(commMessage: Message, answer: string): Promise<void>;
9
- //# sourceMappingURL=ask-user-bridge.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ask-user-bridge.d.ts","sourceRoot":"","sources":["../../src/collaboration/ask-user-bridge.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAO7C,4EAA4E;AAC5E,wBAAgB,4BAA4B,CAC1C,WAAW,EAAE,OAAO,EACpB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,GACnB,MAAM,GAAG,SAAS,CAmBpB;AAiBD,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAuBtF;AAED,wBAAsB,+BAA+B,CACnD,WAAW,EAAE,OAAO,EACpB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,CAUf"}
@@ -1,73 +0,0 @@
1
- import { resolveCellForScene } from './collaboration-config.js';
2
- import { publishCollaborationGroupFeed, resolveActorPipelineRole, } from './group-feed.js';
3
- /** 群内禁止用 ask_user 向 Owner 申请「委派授权」——应走 OrchestrationKernel / spawn_task。 */
4
- export function shouldBlockDelegationAskUser(commMessage, question, questionType) {
5
- const scope = commMessage.$channel?.type;
6
- if (scope !== 'group' && scope !== 'channel')
7
- return undefined;
8
- const sceneId = commMessage.$channel?.id;
9
- if (!sceneId)
10
- return undefined;
11
- const cell = resolveCellForScene(String(commMessage.$adapter ?? ''), sceneId);
12
- if (!cell || cell.members.length < 2)
13
- return undefined;
14
- const q = question.trim();
15
- if (questionType !== 'confirm')
16
- return undefined;
17
- if (looksLikeDelegationAuthorization(q)) {
18
- return 'Error: In group collaboration, do not ask_owner to authorize delegation. Use orchestration_add_task (internal_room) or spawn_task with the peer endpoint.';
19
- }
20
- if (mentionsPipelineRole(q) && containsAny(q.toLowerCase(), ['是否', 'authorize', '授权', '调用'])) {
21
- return 'Error: In group collaboration, dispatch peers via OrchestrationKernel (internal_room task) — do not ask_owner for role authorization.';
22
- }
23
- return undefined;
24
- }
25
- function looksLikeDelegationAuthorization(text) {
26
- const lower = text.toLowerCase();
27
- if (text.includes('授权') || lower.includes('authorize'))
28
- return true;
29
- if (text.includes('是否') && containsAny(text, ['调用', '使用', '委派', '派遣']))
30
- return true;
31
- return lower.includes('allow') && containsAny(lower, ['researcher', 'executor', 'delegate', 'agent']);
32
- }
33
- function mentionsPipelineRole(text) {
34
- return containsAny(text.toLowerCase(), ['researcher', 'evaluator', 'executor', 'reviewer']);
35
- }
36
- function containsAny(text, needles) {
37
- return needles.some((needle) => text.includes(needle));
38
- }
39
- export function buildGroupAskUserFollowUp(commMessage, answer) {
40
- const scope = commMessage.$channel?.type;
41
- if (scope !== 'group' && scope !== 'channel')
42
- return answer;
43
- const sceneId = commMessage.$channel?.id;
44
- if (!sceneId)
45
- return answer;
46
- const cell = resolveCellForScene(String(commMessage.$adapter ?? ''), sceneId);
47
- if (!cell || cell.members.length < 2)
48
- return answer;
49
- const peer = cell.members.find((m) => m.endpointId !== String(commMessage.$endpoint));
50
- const peerEp = peer?.endpointId ?? '<peerEndpoint>';
51
- const roleLabel = peer?.pipelineRole ?? peer?.primary ?? 'next peer';
52
- return [
53
- answer,
54
- '',
55
- `[Collaboration] Owner replied via private. Active scene: group ${sceneId}.`,
56
- `Next: orchestration_add_task with executor internal_room assigned_to ${peerEp}, or spawn_task for local work (${roleLabel}).`,
57
- 'Optional group visibility: project_to_im true or a separate im_projection task; #taskId is only required for im_projection handback.',
58
- 'Do NOT answer from memory or skip kernel task dispatch.',
59
- ].join('\n');
60
- }
61
- export async function notifyGroupOwnerAskUserResolved(commMessage, answer) {
62
- const scope = commMessage.$channel?.type;
63
- if (scope !== 'group' && scope !== 'channel')
64
- return;
65
- await publishCollaborationGroupFeed({
66
- message: commMessage,
67
- role: resolveActorPipelineRole(commMessage),
68
- emoji: '✅',
69
- headline: 'Owner 已确认',
70
- detail: answer,
71
- });
72
- }
73
- //# sourceMappingURL=ask-user-bridge.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ask-user-bridge.js","sourceRoot":"","sources":["../../src/collaboration/ask-user-bridge.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EACL,6BAA6B,EAC7B,wBAAwB,GACzB,MAAM,iBAAiB,CAAC;AAEzB,4EAA4E;AAC5E,MAAM,UAAU,4BAA4B,CAC1C,WAAoB,EACpB,QAAgB,EAChB,YAAoB;IAEpB,MAAM,KAAK,GAAG,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC;IACzC,IAAI,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC/D,MAAM,OAAO,GAAG,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC;IACzC,IAAI,CAAC,OAAO;QAAE,OAAO,SAAS,CAAC;IAC/B,MAAM,IAAI,GAAG,mBAAmB,CAC9B,MAAM,CAAC,WAAW,CAAC,QAAQ,IAAI,EAAE,CAAC,EAClC,OAAO,CACR,CAAC;IACF,IAAI,CAAC,IAAI,IAAI,IAA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,EAAE,IAAI,CAAC;IACzC,IAAI,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO;IACrD,MAAM,6BAA6B,CAAC;QAClC,OAAO,EAAE,WAAW;QACpB,IAAI,EAAE,wBAAwB,CAAC,WAAW,CAAC;QAC3C,KAAK,EAAE,GAAG;QACV,QAAQ,EAAE,WAAW;QACrB,MAAM,EAAE,MAAM;KACf,CAAC,CAAC;AACL,CAAC"}
@@ -1,22 +0,0 @@
1
- /**
2
- * Bootstrap per-endpoint ZhinAgent runtimes for multi-bot collaboration cells.
3
- */
4
- import type { Plugin } from '@zhin.js/core';
5
- import { ZhinAgent } from '../zhin-agent/index.js';
6
- import type { AIService } from '../service.js';
7
- import type { AIServiceRefs } from '../init/shared-refs.js';
8
- import type { ZhinAgentConfig } from '../config/index.js';
9
- export interface BootstrapRuntimesOptions {
10
- refs: AIServiceRefs;
11
- plugin: Plugin;
12
- ai: AIService;
13
- primaryAgent: ZhinAgent;
14
- agentConfig?: ZhinAgentConfig;
15
- }
16
- /** DB 就绪后,将持久化层同步到协作 Cell 内各 Endpoint Runtime */
17
- export declare function syncCollaborationRuntimePersistence(primary: ZhinAgent): void;
18
- export declare function markAllRuntimesPersistenceReady(primary: ZhinAgent): void;
19
- export declare function bootstrapEndpointRuntimes(options: BootstrapRuntimesOptions): void;
20
- /** DB 加载协作单元后重新绑定 Endpoint Runtime */
21
- export declare function rebootstrapEndpointRuntimes(): Promise<void>;
22
- //# sourceMappingURL=bootstrap-agent-runtimes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bootstrap-agent-runtimes.d.ts","sourceRoot":"","sources":["../../src/collaboration/bootstrap-agent-runtimes.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAO1D,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,SAAS,CAAC;IACd,YAAY,EAAE,SAAS,CAAC;IACxB,WAAW,CAAC,EAAE,eAAe,CAAC;CAC/B;AAyFD,iDAAiD;AACjD,wBAAgB,mCAAmC,CAAC,OAAO,EAAE,SAAS,GAAG,IAAI,CAQ5E;AAED,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,SAAS,GAAG,IAAI,CAGxE;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,wBAAwB,GAAG,IAAI,CAGjF;AAED,sCAAsC;AACtC,wBAAsB,2BAA2B,IAAI,OAAO,CAAC,IAAI,CAAC,CAGjE"}
@@ -1,106 +0,0 @@
1
- /**
2
- * Bootstrap per-endpoint ZhinAgent runtimes for multi-bot collaboration cells.
3
- */
4
- import { ZhinAgent } from '../zhin-agent/index.js';
5
- import { DEFAULT_ZHIN_AGENT_NAME } from '../config/types.js';
6
- import { getAgentRuntimeRegistry } from './runtime-registry.js';
7
- import { getCollaborationSceneService } from './scene-service.js';
8
- import { findCellMemberByEndpoint } from './collaboration-config.js';
9
- import { resolvePipelineRoleBinding } from '../config/resolve-pipeline-binding.js';
10
- import { isPipelineRole } from './types.js';
11
- import { COLLABORATION_CONTEXT_TAIL_MESSAGE_LIMIT } from '../context/context-tail-limit.js';
12
- let lastBootstrapOptions = null;
13
- function resolveMemberForEndpoint(cells, endpointId) {
14
- for (const cell of cells) {
15
- const member = findCellMemberByEndpoint(cell, endpointId);
16
- if (member)
17
- return { primary: member.primary, pipelineRole: member.pipelineRole };
18
- }
19
- return { primary: DEFAULT_ZHIN_AGENT_NAME };
20
- }
21
- /** 解析 Endpoint 绑定:优先 pipelineRole(继承 zhin),否则按 primary 名 / zhin 回退。 */
22
- function resolveEndpointBinding(ai, member) {
23
- if (isPipelineRole(member.pipelineRole)) {
24
- const routing = ai.getRoutingConfig();
25
- return resolvePipelineRoleBinding(member.pipelineRole, {
26
- agents: routing.agents,
27
- });
28
- }
29
- return (ai.getBindingRegistry().getBinding(member.primary)
30
- ?? ai.getBindingRegistry().requireZhinBinding());
31
- }
32
- function applyEndpointRuntimes(options) {
33
- const { refs, plugin, ai, primaryAgent, agentConfig } = options;
34
- const registry = getAgentRuntimeRegistry();
35
- registry.registerDefault(primaryAgent);
36
- refs.zhinAgent = primaryAgent;
37
- const cellList = getCollaborationSceneService().listScenes();
38
- if (cellList.length === 0)
39
- return;
40
- const endpointIds = [...new Set(cellList.flatMap((c) => c.members.map((m) => m.endpointId)))].sort();
41
- if (endpointIds.length === 1) {
42
- const endpointId = endpointIds[0];
43
- const member = resolveMemberForEndpoint(cellList, endpointId);
44
- const binding = resolveEndpointBinding(ai, member);
45
- primaryAgent.configure({ activeBinding: binding });
46
- registry.registerForEndpoint(endpointId, primaryAgent);
47
- return;
48
- }
49
- const orchestrator = plugin.root.inject('agent');
50
- const modelRegistry = ai.getModelRegistry();
51
- const primaryEndpointId = endpointIds[0];
52
- const collabTail = agentConfig?.contextTailMessageLimit ?? COLLABORATION_CONTEXT_TAIL_MESSAGE_LIMIT;
53
- const runtimeConfig = {
54
- ...(agentConfig ?? {}),
55
- contextTailMessageLimit: collabTail,
56
- };
57
- for (const endpointId of endpointIds) {
58
- const member = resolveMemberForEndpoint(cellList, endpointId);
59
- const binding = resolveEndpointBinding(ai, member);
60
- if (endpointId === primaryEndpointId) {
61
- primaryAgent.configure({ activeBinding: binding });
62
- registry.registerForEndpoint(endpointId, primaryAgent);
63
- continue;
64
- }
65
- const provider = ai.getProvider(binding.providerAlias);
66
- const runtime = new ZhinAgent(provider, {
67
- ...runtimeConfig,
68
- chatModel: binding.model,
69
- });
70
- runtime.configure({
71
- hostPlugin: plugin.root,
72
- providerResolver: (alias) => ai.getProvider(alias),
73
- activeBinding: binding,
74
- modelRegistry: modelRegistry ?? undefined,
75
- skillRegistry: orchestrator?.skills,
76
- orchestrator: orchestrator ?? undefined,
77
- });
78
- registry.registerForEndpoint(endpointId, runtime);
79
- primaryAgent.sharePersistenceWith(runtime);
80
- }
81
- }
82
- /** DB 就绪后,将持久化层同步到协作 Cell 内各 Endpoint Runtime */
83
- export function syncCollaborationRuntimePersistence(primary) {
84
- const registry = getAgentRuntimeRegistry();
85
- for (const endpointId of registry.listEndpointIds()) {
86
- const runtime = registry.getForEndpoint(endpointId);
87
- if (runtime && runtime !== primary) {
88
- primary.sharePersistenceWith(runtime);
89
- }
90
- }
91
- }
92
- export function markAllRuntimesPersistenceReady(primary) {
93
- primary.markMemoryPersistenceReady();
94
- syncCollaborationRuntimePersistence(primary);
95
- }
96
- export function bootstrapEndpointRuntimes(options) {
97
- lastBootstrapOptions = options;
98
- applyEndpointRuntimes(options);
99
- }
100
- /** DB 加载协作单元后重新绑定 Endpoint Runtime */
101
- export async function rebootstrapEndpointRuntimes() {
102
- if (!lastBootstrapOptions)
103
- return;
104
- applyEndpointRuntimes(lastBootstrapOptions);
105
- }
106
- //# sourceMappingURL=bootstrap-agent-runtimes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bootstrap-agent-runtimes.js","sourceRoot":"","sources":["../../src/collaboration/bootstrap-agent-runtimes.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGnD,OAAO,EAAE,uBAAuB,EAA6B,MAAM,oBAAoB,CAAC;AAExF,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC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CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,UAAU,+BAA+B,CAAC,OAAkB;IAChE,OAAO,CAAC,0BAA0B,EAAE,CAAC;IACrC,mCAAmC,CAAC,OAAO,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,OAAiC;IACzE,oBAAoB,GAAG,OAAO,CAAC;IAC/B,qBAAqB,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAED,sCAAsC;AACtC,MAAM,CAAC,KAAK,UAAU,2BAA2B;IAC/C,IAAI,CAAC,oBAAoB;QAAE,OAAO;IAClC,qBAAqB,CAAC,oBAAoB,CAAC,CAAC;AAC9C,CAAC"}
@@ -1,32 +0,0 @@
1
- /**
2
- * Compatibility facade for the pre-Plugin-Runtime inbound entry point.
3
- * New applications are assembled by the runtime host; this facade keeps the
4
- * public API usable without reviving the removed staged pipeline modules.
5
- */
6
- import type { AITriggerConfig, Message, Plugin } from '@zhin.js/core';
7
- import type { AIServiceRefs } from '../init/shared-refs.js';
8
- import type { AIService } from '../service.js';
9
- import type { PeerTriggerMode } from './types.js';
10
- export interface InboundTurnPipelineDeps {
11
- root: Plugin;
12
- ai: AIService;
13
- refs: AIServiceRefs;
14
- triggerConfig: AITriggerConfig;
15
- peerMode: PeerTriggerMode;
16
- logger: {
17
- debug: (...args: unknown[]) => void;
18
- info: (...args: unknown[]) => void;
19
- warn: (...args: unknown[]) => void;
20
- };
21
- replyOutbound: (payload: unknown, options?: {
22
- quote?: boolean;
23
- }) => Promise<unknown>;
24
- }
25
- export type InboundTurnPipeline = (message: Message, content: string) => Promise<void>;
26
- /**
27
- * Run the current Agent turn surface behind the former public factory.
28
- * Collaboration routing now belongs to the runtime host, so this adapter only
29
- * preserves the standalone local-turn contract.
30
- */
31
- export declare function createInboundTurnPipeline(deps: InboundTurnPipelineDeps): InboundTurnPipeline;
32
- //# sourceMappingURL=inbound-turn-compat.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inbound-turn-compat.d.ts","sourceRoot":"","sources":["../../src/collaboration/inbound-turn-compat.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,SAAS,CAAC;IACd,IAAI,EAAE,aAAa,CAAC;IACpB,aAAa,EAAE,eAAe,CAAC;IAC/B,QAAQ,EAAE,eAAe,CAAC;IAC1B,MAAM,EAAE;QAAE,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;QAAC,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;QAAC,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAA;KAAE,CAAC;IACxH,aAAa,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACtF;AAED,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAEvF;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,uBAAuB,GAAG,mBAAmB,CA0B5F"}
@@ -1,30 +0,0 @@
1
- /**
2
- * Run the current Agent turn surface behind the former public factory.
3
- * Collaboration routing now belongs to the runtime host, so this adapter only
4
- * preserves the standalone local-turn contract.
5
- */
6
- export function createInboundTurnPipeline(deps) {
7
- return async (message, content) => {
8
- if (!deps.ai.isReady()) {
9
- await deps.replyOutbound('AI 服务未就绪,请检查 zhin.config.yml 中的 providers 配置。');
10
- return;
11
- }
12
- const agent = deps.refs.zhinAgent;
13
- if (!agent) {
14
- await deps.replyOutbound('AI Agent 未初始化,请查看启动日志。');
15
- return;
16
- }
17
- try {
18
- agent.initInboundTurnContext?.();
19
- const tools = deps.ai.getResidentToolsAsTools?.() ?? [];
20
- const elements = await agent.process(content, message, tools);
21
- await deps.replyOutbound(elements);
22
- }
23
- catch (error) {
24
- const messageText = error instanceof Error ? error.message : String(error);
25
- deps.logger.warn('compat inbound Agent turn failed', messageText);
26
- await deps.replyOutbound((deps.triggerConfig.errorTemplate ?? '❌ AI 处理失败: {error}').replace('{error}', messageText));
27
- }
28
- };
29
- }
30
- //# sourceMappingURL=inbound-turn-compat.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inbound-turn-compat.js","sourceRoot":"","sources":["../../src/collaboration/inbound-turn-compat.ts"],"names":[],"mappings":"AAsBA;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,IAA6B;IACrE,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;QAChC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC;YACvB,MAAM,IAAI,CAAC,aAAa,CAAC,+CAA+C,CAAC,CAAC;YAC1E,OAAO;QACT,CAAC;QAED,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC;QAClC,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,CAAC,aAAa,CAAC,wBAAwB,CAAC,CAAC;YACnD,OAAO;QACT,CAAC;QAED,IAAI,CAAC;YACH,KAAK,CAAC,sBAAsB,EAAE,EAAE,CAAC;YACjC,MAAM,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC,uBAAuB,EAAE,EAAE,IAAI,EAAE,CAAC;YACxD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;YAC9D,MAAM,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QACrC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,WAAW,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC3E,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,kCAAkC,EAAE,WAAW,CAAC,CAAC;YAClE,MAAM,IAAI,CAAC,aAAa,CACtB,CAAC,IAAI,CAAC,aAAa,CAAC,aAAa,IAAI,oBAAoB,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,WAAW,CAAC,CAC3F,CAAC;QACJ,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
@@ -1,18 +0,0 @@
1
- /**
2
- * AgentRuntimeRegistry — endpoint-scoped ZhinAgent lookup.
3
- * Replaces direct refs.zhinAgent for inbound AI turns.
4
- */
5
- import type { ZhinAgent } from '../zhin-agent/index.js';
6
- export declare class AgentRuntimeRegistry {
7
- private defaultRuntimes;
8
- private byEndpoint;
9
- registerDefault(agent: ZhinAgent): () => void;
10
- registerForEndpoint(endpointId: string, agent: ZhinAgent): void;
11
- getDefault(): ZhinAgent | null;
12
- getForEndpoint(endpointId: string): ZhinAgent | null;
13
- listEndpointIds(): string[];
14
- clear(): void;
15
- }
16
- export declare function getAgentRuntimeRegistry(): AgentRuntimeRegistry;
17
- export declare function resetAgentRuntimeRegistry(): void;
18
- //# sourceMappingURL=runtime-registry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime-registry.d.ts","sourceRoot":"","sources":["../../src/collaboration/runtime-registry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,eAAe,CAAmB;IAC1C,OAAO,CAAC,UAAU,CAAgC;IAElD,eAAe,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,IAAI;IAQ7C,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI;IAK/D,UAAU,IAAI,SAAS,GAAG,IAAI;IAI9B,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAIpD,eAAe,IAAI,MAAM,EAAE;IAI3B,KAAK,IAAI,IAAI;CAId;AAID,wBAAgB,uBAAuB,IAAI,oBAAoB,CAG9D;AAED,wBAAgB,yBAAyB,IAAI,IAAI,CAGhD"}
@@ -1,45 +0,0 @@
1
- /**
2
- * AgentRuntimeRegistry — endpoint-scoped ZhinAgent lookup.
3
- * Replaces direct refs.zhinAgent for inbound AI turns.
4
- */
5
- export class AgentRuntimeRegistry {
6
- defaultRuntimes = [];
7
- byEndpoint = new Map();
8
- registerDefault(agent) {
9
- this.defaultRuntimes.push(agent);
10
- return () => {
11
- const index = this.defaultRuntimes.lastIndexOf(agent);
12
- if (index >= 0)
13
- this.defaultRuntimes.splice(index, 1);
14
- };
15
- }
16
- registerForEndpoint(endpointId, agent) {
17
- this.byEndpoint.set(endpointId, agent);
18
- if (this.defaultRuntimes.length === 0)
19
- this.defaultRuntimes.push(agent);
20
- }
21
- getDefault() {
22
- return this.defaultRuntimes[this.defaultRuntimes.length - 1] ?? null;
23
- }
24
- getForEndpoint(endpointId) {
25
- return this.byEndpoint.get(endpointId) ?? this.getDefault();
26
- }
27
- listEndpointIds() {
28
- return [...this.byEndpoint.keys()];
29
- }
30
- clear() {
31
- this.defaultRuntimes = [];
32
- this.byEndpoint.clear();
33
- }
34
- }
35
- let globalRegistry = null;
36
- export function getAgentRuntimeRegistry() {
37
- if (!globalRegistry)
38
- globalRegistry = new AgentRuntimeRegistry();
39
- return globalRegistry;
40
- }
41
- export function resetAgentRuntimeRegistry() {
42
- globalRegistry?.clear();
43
- globalRegistry = null;
44
- }
45
- //# sourceMappingURL=runtime-registry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime-registry.js","sourceRoot":"","sources":["../../src/collaboration/runtime-registry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,OAAO,oBAAoB;IACvB,eAAe,GAAgB,EAAE,CAAC;IAClC,UAAU,GAAG,IAAI,GAAG,EAAqB,CAAC;IAElD,eAAe,CAAC,KAAgB;QAC9B,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACjC,OAAO,GAAG,EAAE;YACV,MAAM,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;YACtD,IAAI,KAAK,IAAI,CAAC;gBAAE,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QACxD,CAAC,CAAC;IACJ,CAAC;IAED,mBAAmB,CAAC,UAAkB,EAAE,KAAgB;QACtD,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QACvC,IAAI,IAAI,CAAC,eAAe,CAAC,MAAM,KAAK,CAAC;YAAE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1E,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC;IACvE,CAAC;IAED,cAAc,CAAC,UAAkB;QAC/B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;IAC9D,CAAC;IAED,eAAe;QACb,OAAO,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;IACrC,CAAC;IAED,KAAK;QACH,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;QAC1B,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC;CACF;AAED,IAAI,cAAc,GAAgC,IAAI,CAAC;AAEvD,MAAM,UAAU,uBAAuB;IACrC,IAAI,CAAC,cAAc;QAAE,cAAc,GAAG,IAAI,oBAAoB,EAAE,CAAC;IACjE,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,yBAAyB;IACvC,cAAc,EAAE,KAAK,EAAE,CAAC;IACxB,cAAc,GAAG,IAAI,CAAC;AACxB,CAAC"}
@@ -1,6 +0,0 @@
1
- /**
2
- * IM 运维 / 内省斜杠命令:仅 master 或 trusted 可执行(与 docs/essentials/commands.md 一致)。
3
- * @deprecated 从 @zhin.js/core 导入
4
- */
5
- export { MANAGEMENT_COMMAND_DENIED, MANAGEMENT_OPERATOR_PERMIT, rejectUnlessManagementOperator, resolveManagementCommandRoles, } from '@zhin.js/core';
6
- //# sourceMappingURL=management-command-guard.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"management-command-guard.d.ts","sourceRoot":"","sources":["../../src/init/management-command-guard.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAC1B,8BAA8B,EAC9B,6BAA6B,GAC9B,MAAM,eAAe,CAAC"}
@@ -1,6 +0,0 @@
1
- /**
2
- * IM 运维 / 内省斜杠命令:仅 master 或 trusted 可执行(与 docs/essentials/commands.md 一致)。
3
- * @deprecated 从 @zhin.js/core 导入
4
- */
5
- export { MANAGEMENT_COMMAND_DENIED, MANAGEMENT_OPERATOR_PERMIT, rejectUnlessManagementOperator, resolveManagementCommandRoles, } from '@zhin.js/core';
6
- //# sourceMappingURL=management-command-guard.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"management-command-guard.js","sourceRoot":"","sources":["../../src/init/management-command-guard.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAC1B,8BAA8B,EAC9B,6BAA6B,GAC9B,MAAM,eAAe,CAAC"}
@@ -1,7 +0,0 @@
1
- import type { OutputElement } from '@zhin.js/ai';
2
- import type { Segment } from '@zhin.js/core';
3
- /** OutputElement[] → canonical Segment[](Adapter 能力降级) */
4
- export declare function elementsToMessageContent(elements: OutputElement[], platform?: string): Promise<Segment[]>;
5
- /** @deprecated 出站请用 publishOutboundElements;保留供日志/兼容 */
6
- export declare function renderOutput(elements: OutputElement[]): string;
7
- //# sourceMappingURL=output-renderer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"output-renderer.d.ts","sourceRoot":"","sources":["../../src/init/output-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,0DAA0D;AAC1D,wBAAsB,wBAAwB,CAC5C,QAAQ,EAAE,aAAa,EAAE,EACzB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,OAAO,EAAE,CAAC,CAEpB;AAED,wDAAwD;AACxD,wBAAgB,YAAY,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,MAAM,CAgC9D"}
@@ -1,44 +0,0 @@
1
- import { publishOutboundElements } from '../media/media-publisher.js';
2
- /** OutputElement[] → canonical Segment[](Adapter 能力降级) */
3
- export async function elementsToMessageContent(elements, platform) {
4
- return publishOutboundElements(elements, platform);
5
- }
6
- /** @deprecated 出站请用 publishOutboundElements;保留供日志/兼容 */
7
- export function renderOutput(elements) {
8
- const parts = [];
9
- for (const el of elements) {
10
- switch (el.type) {
11
- case 'text':
12
- if (el.content)
13
- parts.push(el.content);
14
- break;
15
- case 'image':
16
- parts.push(`<image url="${el.url}"/>`);
17
- break;
18
- case 'audio':
19
- parts.push(`<audio url="${el.url}"/>`);
20
- break;
21
- case 'video':
22
- parts.push(`<video url="${el.url}"/>`);
23
- break;
24
- case 'card': {
25
- const cp = [`📋 ${el.title}`];
26
- if (el.description)
27
- cp.push(el.description);
28
- if (el.fields?.length) {
29
- for (const f of el.fields)
30
- cp.push(` ${f.label}: ${f.value}`);
31
- }
32
- if (el.imageUrl)
33
- cp.push(`<image url="${el.imageUrl}"/>`);
34
- parts.push(cp.join('\n'));
35
- break;
36
- }
37
- case 'file':
38
- parts.push(`📎 ${el.name}: ${el.url}`);
39
- break;
40
- }
41
- }
42
- return parts.join('\n') || '';
43
- }
44
- //# sourceMappingURL=output-renderer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"output-renderer.js","sourceRoot":"","sources":["../../src/init/output-renderer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAGtE,0DAA0D;AAC1D,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,QAAyB,EACzB,QAAiB;IAEjB,OAAO,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AACrD,CAAC;AAED,wDAAwD;AACxD,MAAM,UAAU,YAAY,CAAC,QAAyB;IACpD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,EAAE,IAAI,QAAQ,EAAE,CAAC;QAC1B,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC;YAChB,KAAK,MAAM;gBACT,IAAI,EAAE,CAAC,OAAO;oBAAE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;gBACvC,MAAM;YACR,KAAK,OAAO;gBACV,KAAK,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC;gBACvC,MAAM;YACR,KAAK,OAAO;gBACV,KAAK,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC;gBACvC,MAAM;YACR,KAAK,OAAO;gBACV,KAAK,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC;gBACvC,MAAM;YACR,KAAK,MAAM,CAAC,CAAC,CAAC;gBACZ,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC;gBAC9B,IAAI,EAAE,CAAC,WAAW;oBAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC;gBAC5C,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;oBACtB,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM;wBAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;gBACjE,CAAC;gBACD,IAAI,EAAE,CAAC,QAAQ;oBAAE,EAAE,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,QAAQ,KAAK,CAAC,CAAC;gBAC1D,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;gBAC1B,MAAM;YACR,CAAC;YACD,KAAK,MAAM;gBACT,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;gBACvC,MAAM;QACV,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;AAChC,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare function registerHomeTools(): void;
2
- //# sourceMappingURL=register-home-tools.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register-home-tools.d.ts","sourceRoot":"","sources":["../../src/init/register-home-tools.ts"],"names":[],"mappings":"AAYA,wBAAgB,iBAAiB,IAAI,IAAI,CAyCxC"}