@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,40 +0,0 @@
1
- /**
2
- * ask_user 常驻会话服务 — 单轨 middleware、排队、命令 bypass、Prompt/私聊统一。
3
- */
4
- import { type Adapter, type Message, type Plugin } from '@zhin.js/core';
5
- export type AskUserSessionKind = 'prompt' | 'sensitive_dm';
6
- export interface AskUserOpenSpec {
7
- sessionId: string;
8
- kind: AskUserSessionKind;
9
- message: Message;
10
- questionType: string;
11
- args: Record<string, unknown>;
12
- timeoutMs: number;
13
- botMaster?: string;
14
- adapter?: Adapter;
15
- groupOrigin?: Message;
16
- }
17
- export declare class AskUserSessionService {
18
- private readonly plugin;
19
- private readonly ownerQueues;
20
- private readonly promptWaits;
21
- private readonly disposeMiddleware;
22
- constructor(plugin: Plugin);
23
- static install(plugin: Plugin): AskUserSessionService;
24
- static resetForTests(): void;
25
- static get(): AskUserSessionService | undefined;
26
- matchInbound(message: Message, root?: Plugin): 'consume' | 'bypass' | 'ignore';
27
- isPendingReply(message: Message, root?: Plugin): boolean;
28
- open(spec: AskUserOpenSpec): Promise<string>;
29
- private hasPendingForMessage;
30
- private tryMatchPrompt;
31
- private tryMatchSensitiveDm;
32
- private openPrompt;
33
- private openSensitiveDm;
34
- private sendSensitiveQuestion;
35
- private timeoutFallback;
36
- private finishOwnerEntry;
37
- private resolveEndpointMaster;
38
- private middleware;
39
- }
40
- //# sourceMappingURL=ask-user-session-service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ask-user-session-service.d.ts","sourceRoot":"","sources":["../../src/builtin/ask-user-session-service.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAEL,KAAK,OAAO,EACZ,KAAK,OAAO,EAEZ,KAAK,MAAM,EAEZ,MAAM,eAAe,CAAC;AAQvB,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,cAAc,CAAC;AAE3D,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,kBAAkB,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AA4BD,qBAAa,qBAAqB;IAKpB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAJnC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAiC;IAC7D,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAmC;IAC/D,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAa;gBAElB,MAAM,EAAE,MAAM;IAI3C,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,qBAAqB;IAOrD,MAAM,CAAC,aAAa,IAAI,IAAI;IAI5B,MAAM,CAAC,GAAG,IAAI,qBAAqB,GAAG,SAAS;IAI/C,YAAY,CACV,OAAO,EAAE,OAAO,EAChB,IAAI,CAAC,EAAE,MAAM,GACZ,SAAS,GAAG,QAAQ,GAAG,QAAQ;IASlC,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO;IAIlD,IAAI,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;IAOlD,OAAO,CAAC,oBAAoB;IAgB5B,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,mBAAmB;YAcb,UAAU;IA0DxB,OAAO,CAAC,eAAe;YA4BT,qBAAqB;IAgCnC,OAAO,CAAC,eAAe;IAKvB,OAAO,CAAC,gBAAgB;IAoBxB,OAAO,CAAC,qBAAqB;IAkB7B,OAAO,CAAC,UAAU,CAkChB;CACH"}
@@ -1,258 +0,0 @@
1
- /**
2
- * ask_user 常驻会话服务 — 单轨 middleware、排队、命令 bypass、Prompt/私聊统一。
3
- */
4
- import { Prompt, } from '@zhin.js/core';
5
- import { errMsg } from '../discovery/utils.js';
6
- import { notifyGroupOwnerAskUserResolved, buildGroupAskUserFollowUp } from '../collaboration/ask-user-bridge.js';
7
- import { buildSensitiveOwnerQuestionText, formatOwnerResponse, } from './ask-user-tool.js';
8
- function ownerKey(endpointId, masterId) {
9
- return `${endpointId}:${masterId}`;
10
- }
11
- function promptKey(message) {
12
- return `${message.$adapter}-${message.$endpoint}-${message.$channel?.type}:${message.$channel?.id}-${message.$sender?.id}`;
13
- }
14
- function isSlashCommand(message) {
15
- const raw = String(message.$raw ?? '').trim();
16
- return raw.startsWith('/');
17
- }
18
- let serviceInstance;
19
- export class AskUserSessionService {
20
- plugin;
21
- ownerQueues = new Map();
22
- promptWaits = new Map();
23
- disposeMiddleware;
24
- constructor(plugin) {
25
- this.plugin = plugin;
26
- this.disposeMiddleware = (plugin.root ?? plugin).addMiddleware(this.middleware.bind(this));
27
- }
28
- static install(plugin) {
29
- if (!serviceInstance) {
30
- serviceInstance = new AskUserSessionService(plugin);
31
- }
32
- return serviceInstance;
33
- }
34
- static resetForTests() {
35
- serviceInstance = undefined;
36
- }
37
- static get() {
38
- return serviceInstance;
39
- }
40
- matchInbound(message, root) {
41
- if (isSlashCommand(message) && this.hasPendingForMessage(message, root)) {
42
- return 'bypass';
43
- }
44
- if (this.tryMatchPrompt(message))
45
- return 'consume';
46
- if (this.tryMatchSensitiveDm(message, root))
47
- return 'consume';
48
- return 'ignore';
49
- }
50
- isPendingReply(message, root) {
51
- return this.matchInbound(message, root) === 'consume';
52
- }
53
- async open(spec) {
54
- if (spec.kind === 'prompt') {
55
- return this.openPrompt(spec);
56
- }
57
- return this.openSensitiveDm(spec);
58
- }
59
- hasPendingForMessage(message, root) {
60
- if (this.promptWaits.has(promptKey(message)))
61
- return true;
62
- const endpointId = String(message.$endpoint ?? '');
63
- const senderId = String(message.$sender?.id ?? '');
64
- if (endpointId && senderId) {
65
- const direct = this.ownerQueues.get(ownerKey(endpointId, senderId));
66
- if (direct?.active || direct?.waiting.length)
67
- return true;
68
- }
69
- const ids = this.resolveEndpointMaster(message, root);
70
- if (!ids)
71
- return false;
72
- const queue = this.ownerQueues.get(ownerKey(ids.endpointId, ids.masterId));
73
- return Boolean(queue?.active || queue?.waiting.length);
74
- }
75
- tryMatchPrompt(message) {
76
- return this.promptWaits.has(promptKey(message));
77
- }
78
- tryMatchSensitiveDm(message, root) {
79
- if (message.$channel?.type !== 'private')
80
- return false;
81
- const senderId = String(message.$sender?.id ?? '');
82
- const endpointId = String(message.$endpoint ?? '');
83
- if (!senderId || !endpointId)
84
- return false;
85
- const direct = this.ownerQueues.get(ownerKey(endpointId, senderId));
86
- if (direct?.active)
87
- return true;
88
- const ids = this.resolveEndpointMaster(message, root);
89
- if (!ids || senderId !== ids.masterId)
90
- return false;
91
- return Boolean(this.ownerQueues.get(ownerKey(ids.endpointId, ids.masterId))?.active);
92
- }
93
- async openPrompt(spec) {
94
- const host = this.plugin.root ?? this.plugin;
95
- const prompt = new Prompt(host, spec.message);
96
- const questionType = spec.questionType;
97
- const args = spec.args;
98
- const timeoutMs = spec.timeoutMs;
99
- try {
100
- switch (questionType) {
101
- case 'number': {
102
- const defaultNum = args.default_value != null ? Number(args.default_value) : undefined;
103
- const result = await prompt.number(String(args.question ?? ''), timeoutMs, defaultNum, '输入超时,已取消');
104
- return String(result);
105
- }
106
- case 'confirm': {
107
- const result = await prompt.confirm(String(args.question ?? ''), 'yes', timeoutMs, false, '确认超时,已取消');
108
- return result ? 'yes' : 'no';
109
- }
110
- case 'pick': {
111
- const options = args.options;
112
- if (!options?.length) {
113
- return 'Error: type=pick 时必须提供 options 选项列表';
114
- }
115
- const pickOptions = options.map((o) => ({ label: o, value: o }));
116
- const result = await prompt.pick(String(args.question ?? ''), {
117
- type: 'text',
118
- options: pickOptions,
119
- timeout: timeoutMs,
120
- }, '选择超时,已取消');
121
- return String(result);
122
- }
123
- case 'text':
124
- default: {
125
- const result = await prompt.text(String(args.question ?? ''), timeoutMs, String(args.default_value ?? ''), '输入超时,已取消');
126
- return result;
127
- }
128
- }
129
- }
130
- catch (e) {
131
- return `Owner 未响应或输入错误: ${errMsg(e)}`;
132
- }
133
- }
134
- openSensitiveDm(spec) {
135
- const masterId = String(spec.botMaster ?? '');
136
- const endpointId = String(spec.message.$endpoint ?? '');
137
- const key = ownerKey(endpointId, masterId);
138
- return new Promise((resolve) => {
139
- const entry = {
140
- spec,
141
- resolve,
142
- timer: setTimeout(() => { }, spec.timeoutMs),
143
- };
144
- entry.timer = setTimeout(() => {
145
- this.finishOwnerEntry(key, entry, this.timeoutFallback(spec));
146
- }, spec.timeoutMs);
147
- const queue = this.ownerQueues.get(key) ?? { waiting: [] };
148
- if (queue.active) {
149
- queue.waiting.push(entry);
150
- this.ownerQueues.set(key, queue);
151
- return;
152
- }
153
- queue.active = entry;
154
- this.ownerQueues.set(key, queue);
155
- void this.sendSensitiveQuestion(spec);
156
- });
157
- }
158
- async sendSensitiveQuestion(spec) {
159
- const { message, args, questionType, botMaster, adapter } = spec;
160
- if (!botMaster || !adapter)
161
- return;
162
- const sceneId = String(message.$channel?.id ?? '');
163
- const parentType = message.$channel?.type === 'channel' ? 'channel' : 'group';
164
- const questionText = buildSensitiveOwnerQuestionText(message, String(args.question ?? ''), questionType, args.options);
165
- try {
166
- await adapter.sendMessage({
167
- context: message.$adapter,
168
- endpoint: message.$endpoint,
169
- id: botMaster,
170
- type: 'private',
171
- parent: { type: parentType, id: sceneId },
172
- content: questionText,
173
- });
174
- }
175
- catch (e) {
176
- const key = ownerKey(String(message.$endpoint), botMaster);
177
- const queue = this.ownerQueues.get(key);
178
- const active = queue?.active;
179
- if (active?.spec.sessionId === spec.sessionId) {
180
- this.finishOwnerEntry(key, active, `Error: 无法向 Owner 发送私聊消息: ${errMsg(e)}`);
181
- }
182
- }
183
- }
184
- timeoutFallback(spec) {
185
- if (spec.args.default_value != null)
186
- return String(spec.args.default_value);
187
- return 'Owner 未在规定时间内响应,操作已取消。';
188
- }
189
- finishOwnerEntry(key, entry, answer) {
190
- clearTimeout(entry.timer);
191
- const queue = this.ownerQueues.get(key);
192
- if (!queue || queue.active !== entry)
193
- return;
194
- queue.active = undefined;
195
- const groupOrigin = entry.spec.groupOrigin ?? entry.spec.message;
196
- void notifyGroupOwnerAskUserResolved(groupOrigin, answer).catch(() => { });
197
- entry.resolve(answer);
198
- const next = queue.waiting.shift();
199
- if (next) {
200
- queue.active = next;
201
- this.ownerQueues.set(key, queue);
202
- void this.sendSensitiveQuestion(next.spec);
203
- return;
204
- }
205
- this.ownerQueues.delete(key);
206
- }
207
- resolveEndpointMaster(message, root) {
208
- const endpointId = String(message.$endpoint ?? '');
209
- if (!endpointId || !root)
210
- return undefined;
211
- try {
212
- const adapter = root.inject(message.$adapter);
213
- const master = adapter?.endpoints?.get(endpointId)?.$config?.master;
214
- if (master == null)
215
- return undefined;
216
- return { endpointId, masterId: String(master) };
217
- }
218
- catch {
219
- return undefined;
220
- }
221
- }
222
- middleware = async (message, next) => {
223
- const match = this.matchInbound(message, this.plugin.root ?? this.plugin);
224
- if (match === 'ignore')
225
- return next();
226
- if (match === 'bypass')
227
- return next();
228
- const promptWait = this.promptWaits.get(promptKey(message));
229
- if (promptWait) {
230
- clearTimeout(promptWait.timer);
231
- this.promptWaits.delete(promptKey(message));
232
- const raw = String(message.$raw ?? '');
233
- promptWait.resolve(formatOwnerResponse(raw, promptWait.spec.questionType, promptWait.spec.args));
234
- return;
235
- }
236
- const senderId = String(message.$sender?.id ?? '');
237
- const endpointId = String(message.$endpoint ?? '');
238
- let key = ownerKey(endpointId, senderId);
239
- let queue = this.ownerQueues.get(key);
240
- if (!queue?.active) {
241
- const ids = this.resolveEndpointMaster(message, this.plugin.root ?? this.plugin);
242
- if (ids) {
243
- key = ownerKey(ids.endpointId, ids.masterId);
244
- queue = this.ownerQueues.get(key);
245
- }
246
- }
247
- const active = queue?.active;
248
- if (!active)
249
- return next();
250
- const raw = String(message.$raw ?? '');
251
- const formatted = formatOwnerResponse(raw, active.spec.questionType, active.spec.args);
252
- const answer = active.spec.groupOrigin
253
- ? buildGroupAskUserFollowUp(active.spec.groupOrigin, formatted)
254
- : formatted;
255
- this.finishOwnerEntry(key, active, answer);
256
- };
257
- }
258
- //# sourceMappingURL=ask-user-session-service.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ask-user-session-service.js","sourceRoot":"","sources":["../../src/builtin/ask-user-session-service.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EACL,MAAM,GAMP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,+BAA+B,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AACjH,OAAO,EACL,+BAA+B,EAC/B,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AA2B5B,SAAS,QAAQ,CAAC,UAAkB,EAAE,QAAgB;IACpD,OAAO,GAAG,UAAU,IAAI,QAAQ,EAAE,CAAC;AACrC,CAAC;AAED,SAAS,SAAS,C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CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QACzC,IAAI,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACtC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;YACnB,MAAM,GAAG,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC;YACjF,IAAI,GAAG,EAAE,CAAC;gBACR,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;gBAC7C,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACpC,CAAC;QACH,CAAC;QACD,MAAM,MAAM,GAAG,KAAK,EAAE,MAAM,CAAC;QAC7B,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,EAAE,CAAC;QAE3B,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;QACvC,MAAM,SAAS,GAAG,mBAAmB,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvF,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW;YACpC,CAAC,CAAC,yBAAyB,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC;YAC/D,CAAC,CAAC,SAAS,CAAC;QACd,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7C,CAAC,CAAC;CACH"}
@@ -1,18 +0,0 @@
1
- /**
2
- * ask_user 挂起会话注册表 — 委托 AskUserSessionService(常驻 middleware)。
3
- */
4
- import type { Message, Plugin } from '@zhin.js/core';
5
- import { AskUserSessionService } from './ask-user-session-service.js';
6
- export interface PendingAskUserSession {
7
- endpointId: string;
8
- masterId: string;
9
- groupOrigin?: Message;
10
- registeredAt: number;
11
- }
12
- export declare function registerPendingAskUser(_session: PendingAskUserSession): void;
13
- export declare function clearPendingAskUser(_endpointId: string, _masterId: string): void;
14
- export declare function getPendingAskUser(_endpointId: string, _masterId: string): PendingAskUserSession | undefined;
15
- /** 该私聊消息是否应作为 ask_user 回复消费(勿再触发 AI Handler)。 */
16
- export declare function isAskUserPendingReply(message: Message, root?: Plugin): boolean;
17
- export declare function ensureAskUserSessionService(plugin: Plugin): AskUserSessionService;
18
- //# sourceMappingURL=ask-user-session.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ask-user-session.d.ts","sourceRoot":"","sources":["../../src/builtin/ask-user-session.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,qBAAqB,GAAG,IAAI,CAE5E;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAEhF;AAED,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,qBAAqB,GAAG,SAAS,CAE3G;AAED,iDAAiD;AACjD,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,OAAO,EAChB,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAIT;AAED,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,qBAAqB,CAEjF"}
@@ -1,21 +0,0 @@
1
- import { AskUserSessionService } from './ask-user-session-service.js';
2
- export function registerPendingAskUser(_session) {
3
- // legacy no-op:排队与会话状态由 AskUserSessionService 管理
4
- }
5
- export function clearPendingAskUser(_endpointId, _masterId) {
6
- // legacy no-op
7
- }
8
- export function getPendingAskUser(_endpointId, _masterId) {
9
- return undefined;
10
- }
11
- /** 该私聊消息是否应作为 ask_user 回复消费(勿再触发 AI Handler)。 */
12
- export function isAskUserPendingReply(message, root) {
13
- const service = AskUserSessionService.get();
14
- if (!service)
15
- return false;
16
- return service.isPendingReply(message, root);
17
- }
18
- export function ensureAskUserSessionService(plugin) {
19
- return AskUserSessionService.install(plugin);
20
- }
21
- //# sourceMappingURL=ask-user-session.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ask-user-session.js","sourceRoot":"","sources":["../../src/builtin/ask-user-session.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAStE,MAAM,UAAU,sBAAsB,CAAC,QAA+B;IACpE,iDAAiD;AACnD,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,WAAmB,EAAE,SAAiB;IACxE,eAAe;AACjB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,WAAmB,EAAE,SAAiB;IACtE,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,iDAAiD;AACjD,MAAM,UAAU,qBAAqB,CACnC,OAAgB,EAChB,IAAa;IAEb,MAAM,OAAO,GAAG,qBAAqB,CAAC,GAAG,EAAE,CAAC;IAC5C,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IAC3B,OAAO,OAAO,CAAC,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,MAAc;IACxD,OAAO,qBAAqB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC/C,CAAC"}
@@ -1,22 +0,0 @@
1
- /**
2
- * ask_user — 默认在当前会话(群/频道/私聊)Prompt 提问;敏感确认走私聊 master(群来源带 parent)。
3
- */
4
- import { type Plugin, type Message, type Tool, type ToolParametersSchema, type ToolResult, type Adapter } from '@zhin.js/core';
5
- import { BuiltinBaseTool } from './builtin-base-tool.js';
6
- export declare function askViaPrompt(plugin: Plugin, message: Message, args: Record<string, unknown>, questionType: string, timeoutMs: number): Promise<string>;
7
- export declare function formatOwnerResponse(raw: string, questionType: string, args: Record<string, unknown>): string;
8
- export declare function buildSensitiveOwnerQuestionText(commMessage: Message, question: string, questionType: string, options?: string[]): string;
9
- export declare function askOwnerViaPrivateWithParent(plugin: Plugin, commMessage: Message, args: Record<string, unknown>, questionType: string, timeoutMs: number, botMaster: string, adapter: Adapter): Promise<string>;
10
- export declare const ASK_USER_PARAMETERS: ToolParametersSchema;
11
- export declare function createAskUserTool(plugin: Plugin): Tool;
12
- export declare class AskUserBuiltinTool extends BuiltinBaseTool {
13
- private readonly plugin;
14
- readonly name = "ask_user";
15
- readonly description = "Ask the user and wait for a reply. Default: prompt in the current session (group/channel/private) to the triggering user. Set sensitive=true only to confirm with the Endpoint Owner via private DM (group origin uses parent; no group-visible trace). Owner private chat: /approve always bash, /approve rule <regex>, /approve list, /approve revoke. write_file / edit_file / web_fetch hard-orchestration still requires per-action Owner confirm.";
16
- readonly parameters: ToolParametersSchema<Record<string, any>>;
17
- readonly kind = "interaction";
18
- readonly executionTimeoutMs = 150000;
19
- constructor(plugin: Plugin);
20
- run(args: Record<string, unknown>, commMessage?: Message): Promise<ToolResult>;
21
- }
22
- //# sourceMappingURL=ask-user-tool.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ask-user-tool.d.ts","sourceRoot":"","sources":["../../src/builtin/ask-user-tool.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EACL,KAAK,MAAM,EACX,KAAK,OAAO,EACZ,KAAK,IAAI,EACT,KAAK,oBAAoB,EACzB,KAAK,UAAU,EACf,KAAK,OAAO,EACb,MA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,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;CAiDrF"}
@@ -1,148 +0,0 @@
1
- import { randomUUID } from 'node:crypto';
2
- import { BuiltinBaseTool } from './builtin-base-tool.js';
3
- import { shouldBlockDelegationAskUser } from '../collaboration/ask-user-bridge.js';
4
- import { ensureAskUserSessionService } from './ask-user-session.js';
5
- // ============================================================================
6
- // Prompt / Owner 回复格式化
7
- // ============================================================================
8
- export async function askViaPrompt(plugin, message, args, questionType, timeoutMs) {
9
- const service = ensureAskUserSessionService(plugin);
10
- return service.open({
11
- sessionId: randomUUID(),
12
- kind: 'prompt',
13
- message,
14
- questionType,
15
- args,
16
- timeoutMs,
17
- });
18
- }
19
- export function formatOwnerResponse(raw, questionType, args) {
20
- switch (questionType) {
21
- case 'confirm':
22
- return raw.trim().toLowerCase() === 'yes' ? 'yes' : 'no';
23
- case 'number':
24
- return String(Number(raw) || 0);
25
- case 'pick': {
26
- const idx = Number(raw.trim());
27
- const options = args.options || [];
28
- if (idx >= 1 && idx <= options.length)
29
- return options[idx - 1];
30
- return raw;
31
- }
32
- case 'text':
33
- default:
34
- return raw;
35
- }
36
- }
37
- export function buildSensitiveOwnerQuestionText(commMessage, question, questionType, options) {
38
- const sourceInfo = commMessage.$channel?.type !== 'private'
39
- ? `来源: ${commMessage.$channel?.type}(${commMessage.$channel?.id}) 用户: ${commMessage.$sender.id}`
40
- : `来源: 私聊 用户: ${commMessage.$sender.id}`;
41
- let questionText = `请求确认:\n${sourceInfo}\n\n${question}`;
42
- if (questionType === 'confirm') {
43
- questionText += '\n输入"yes"以确认';
44
- }
45
- else if (questionType === 'pick' && options?.length) {
46
- questionText += '\n' + options.map((o, i) => `${i + 1}.${o}`).join('\n');
47
- }
48
- else if (questionType === 'number') {
49
- questionText += '\n(请输入数字)';
50
- }
51
- return questionText;
52
- }
53
- function isGroupOrChannelScope(message) {
54
- const scope = message.$channel?.type;
55
- return scope === 'group' || scope === 'channel';
56
- }
57
- export async function askOwnerViaPrivateWithParent(plugin, commMessage, args, questionType, timeoutMs, botMaster, adapter) {
58
- const service = ensureAskUserSessionService(plugin);
59
- return service.open({
60
- sessionId: randomUUID(),
61
- kind: 'sensitive_dm',
62
- message: commMessage,
63
- questionType,
64
- args,
65
- timeoutMs,
66
- botMaster,
67
- adapter,
68
- groupOrigin: commMessage,
69
- });
70
- }
71
- export const ASK_USER_PARAMETERS = {
72
- type: 'object',
73
- properties: {
74
- question: { type: 'string', description: 'Question text to ask the user or Endpoint Owner' },
75
- type: {
76
- type: 'string',
77
- enum: ['text', 'number', 'confirm', 'pick'],
78
- description: 'Response type: text, number, confirm (yes/no), or pick (numbered options). Default: text',
79
- },
80
- options: {
81
- type: 'array',
82
- items: { type: 'string' },
83
- description: 'Option labels when type=pick (required), e.g. ["Option A","Option B"]',
84
- },
85
- default_value: { type: 'string', description: 'Fallback value if the user does not reply before timeout' },
86
- timeout: { type: 'number', description: 'Wait timeout in seconds. Default: 120' },
87
- sensitive: {
88
- type: 'boolean',
89
- description: 'When true, send a private confirmation to the Endpoint Owner (group/channel origin includes parent scene). Use for exec approval, secrets, or other sensitive confirms. Do not set for ordinary clarification.',
90
- },
91
- },
92
- required: ['question'],
93
- };
94
- export function createAskUserTool(plugin) {
95
- ensureAskUserSessionService(plugin);
96
- return new AskUserBuiltinTool(plugin).toTool();
97
- }
98
- export class AskUserBuiltinTool extends BuiltinBaseTool {
99
- plugin;
100
- name = 'ask_user';
101
- description = 'Ask the user and wait for a reply. Default: prompt in the current session (group/channel/private) to the triggering user. Set sensitive=true only to confirm with the Endpoint Owner via private DM (group origin uses parent; no group-visible trace). Owner private chat: /approve always bash, /approve rule <regex>, /approve list, /approve revoke. write_file / edit_file / web_fetch hard-orchestration still requires per-action Owner confirm.';
102
- parameters = ASK_USER_PARAMETERS;
103
- kind = 'interaction';
104
- executionTimeoutMs = 150_000;
105
- constructor(plugin) {
106
- super();
107
- this.plugin = plugin;
108
- this.tags.push('interaction', 'prompt');
109
- this.keywords.push('询问', '确认', '提问', '用户输入', 'ask', 'confirm', 'prompt', '选择', '请问');
110
- }
111
- async run(args, commMessage) {
112
- if (!commMessage) {
113
- return 'Error: 当前上下文没有消息来源,无法提问。请改为在回复中直接询问。';
114
- }
115
- if (!this.plugin) {
116
- return 'Error: 插件实例不可用,无法创建交互式提问。请改为在回复中直接询问。';
117
- }
118
- const timeoutMs = (args.timeout ?? 120) * 1000;
119
- const questionType = args.type || 'text';
120
- const recordArgs = args;
121
- const question = String(args.question ?? '');
122
- const platform = commMessage.$adapter;
123
- const endpointId = commMessage.$endpoint;
124
- const adapter = this.plugin.inject(platform);
125
- const bot = adapter?.endpoints?.get(endpointId);
126
- const botMaster = bot?.$config?.master;
127
- const isPrivateMaster = commMessage.$channel?.type === 'private'
128
- && botMaster != null && String(commMessage.$sender.id) === String(botMaster);
129
- if (isPrivateMaster) {
130
- return askViaPrompt(this.plugin, commMessage, recordArgs, questionType, timeoutMs);
131
- }
132
- const delegationBlock = shouldBlockDelegationAskUser(commMessage, question, questionType);
133
- if (delegationBlock)
134
- return delegationBlock;
135
- const sensitive = args.sensitive === true;
136
- if (sensitive && isGroupOrChannelScope(commMessage)) {
137
- if (!botMaster) {
138
- return 'Error: 当前 Endpoint 未配置 master,无法进行敏感确认。请在 endpoints 配置中设置 master 字段。';
139
- }
140
- if (!adapter || typeof adapter.sendMessage !== 'function') {
141
- return `Error: 无法获取适配器 ${platform},无法向 Owner 发送私聊确认。`;
142
- }
143
- return askOwnerViaPrivateWithParent(this.plugin, commMessage, recordArgs, questionType, timeoutMs, botMaster, adapter);
144
- }
145
- return askViaPrompt(this.plugin, commMessage, recordArgs, questionType, timeoutMs);
146
- }
147
- }
148
- //# sourceMappingURL=ask-user-tool.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ask-user-tool.js","sourceRoot":"","sources":["../../src/builtin/ask-user-tool.ts"],"names":[],"mappings":"AAW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QACpF,MAAM,eAAe,GAAG,WAAW,CAAC,QAAQ,EAAE,IAAI,KAAK,SAAS;eAC3D,SAAS,IAAI,IAAI,IAAI,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,MAAM,CAAC,SAAS,CAAC,CAAC;QAE/E,IAAI,eAAe,EAAE,CAAC;YACpB,OAAO,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;QACrF,CAAC;QAED,MAAM,eAAe,GAAG,4BAA4B,CAAC,WAAW,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;QAC1F,IAAI,eAAe;YAAE,OAAO,eAAe,CAAC;QAE5C,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,KAAK,IAAI,CAAC;QAC1C,IAAI,SAAS,IAAI,qBAAqB,CAAC,WAAW,CAAC,EAAE,CAAC;YACpD,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,OAAO,sEAAsE,CAAC;YAChF,CAAC;YACD,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,CAAC,WAAW,KAAK,UAAU,EAAE,CAAC;gBAC1D,OAAO,kBAAkB,QAAQ,oBAAoB,CAAC;YACxD,CAAC;YACD,OAAO,4BAA4B,CACjC,IAAI,CAAC,MAAM,EACX,WAAW,EACX,UAAU,EACV,YAAY,EACZ,SAAS,EACT,SAAS,EACT,OAAO,CACR,CAAC;QACJ,CAAC;QAED,OAAO,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;IACrF,CAAC;CACF"}
@@ -1,51 +0,0 @@
1
- /**
2
- * Deferred schema meta tools: discover, load_tool, load_skill
3
- */
4
- import { type DeferredToolSessionSnapshot } from '@zhin.js/ai';
5
- import type { Message, Tool, ToolParametersSchema, ToolResult } from '@zhin.js/core';
6
- import type { SkillRegistry } from '../orchestrator/skill-registry.js';
7
- import type { ToolCatalogItem } from '../tool-catalog/types.js';
8
- import { type LoadSkillToolOptions } from './load-skill-tool.js';
9
- import { BuiltinBaseTool } from './builtin-base-tool.js';
10
- export declare const TOOLS_MUTATED_MARKER = "__zhin_tools_mutated__";
11
- export interface DeferredToolRuntime {
12
- sessionId: string;
13
- catalog: ToolCatalogItem[];
14
- skillRegistry: SkillRegistry | null;
15
- snapshot: DeferredToolSessionSnapshot;
16
- maxLoadedPerSession: number;
17
- discoverTopK: number;
18
- persistSnapshot: (snapshot: DeferredToolSessionSnapshot) => Promise<void>;
19
- onSkillLoaded?: (name: string, instructions: string, toolNames: string[]) => void;
20
- skillLoadOpts: LoadSkillToolOptions;
21
- }
22
- /**
23
- * 在独立 deferred runtime 下执行:load_tool / discover 的 snapshot 变更只影响本上下文,
24
- * 不会污染父会话(此前 subagent 的 load_tool 会写父会话 snapshot)。
25
- */
26
- export declare function runWithDeferredToolRuntime<T>(runtime: DeferredToolRuntime, fn: () => Promise<T>): Promise<T>;
27
- export declare function bindDeferredToolRuntime(message: Message, runtime: DeferredToolRuntime): void;
28
- export declare function getDeferredToolRuntime(message?: Message): DeferredToolRuntime | undefined;
29
- export declare class DiscoverBuiltinTool extends BuiltinBaseTool {
30
- readonly name = "discover";
31
- readonly description = "Search deferred tools and skills by query. kind: tool|skill|all (default all). Empty query returns platform-matched skills.";
32
- readonly parameters: ToolParametersSchema;
33
- run(args: Record<string, unknown>, commMessage?: Message): Promise<ToolResult>;
34
- }
35
- export declare class LoadToolBuiltinTool extends BuiltinBaseTool {
36
- readonly name = "load_tool";
37
- readonly description = "Load a deferred tool schema into the session so it can be called.";
38
- readonly parameters: ToolParametersSchema;
39
- run(args: Record<string, unknown>, commMessage?: Message): Promise<ToolResult>;
40
- }
41
- export declare class LoadSkillBuiltinToolMeta extends BuiltinBaseTool {
42
- private readonly skillOpts;
43
- readonly name = "load_skill";
44
- readonly description = "Load full skill instructions and unlock associated tools for this session.";
45
- readonly parameters: ToolParametersSchema;
46
- constructor(skillOpts: LoadSkillToolOptions);
47
- run(args: Record<string, unknown>, commMessage?: Message): Promise<ToolResult>;
48
- }
49
- export declare function createDeferredMetaTools(skillOpts: LoadSkillToolOptions): Tool[];
50
- export declare function isToolsMutatedResult(result: ToolResult): boolean;
51
- //# sourceMappingURL=deferred-tool-meta.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deferred-tool-meta.d.ts","sourceRoot":"","sources":["../../src/builtin/deferred-tool-meta.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAkB,KAAK,2BAA2B,EAAiE,MAAM,aAAa,CAAC;AAC9I,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAMvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAyB,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,eAAO,MAAM,oBAAoB,2BAA2B,CAAC;AAE7D,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,aAAa,EAAE,aAAa,GAAG,IAAI,CAAC;IACpC,QAAQ,EAAE,2BAA2B,CAAC;IACtC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,CAAC,QAAQ,EAAE,2BAA2B,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1E,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAClF,aAAa,EAAE,oBAAoB,CAAC;CACrC;AAQD;;;G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