@zhin.js/agent 1.1.7 → 1.1.9

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 (590) hide show
  1. package/README.md +15 -23
  2. package/lib/activity-feedback/adapter-integration.d.ts +1 -2
  3. package/lib/activity-feedback/adapter-integration.d.ts.map +1 -1
  4. package/lib/activity-feedback/adapter-integration.js +43 -13
  5. package/lib/activity-feedback/adapter-integration.js.map +1 -1
  6. package/lib/assistant/index.d.ts +1 -1
  7. package/lib/assistant/index.d.ts.map +1 -1
  8. package/lib/assistant/index.js +1 -1
  9. package/lib/assistant/index.js.map +1 -1
  10. package/lib/assistant/job-creator.d.ts +0 -7
  11. package/lib/assistant/job-creator.d.ts.map +1 -1
  12. package/lib/assistant/job-creator.js +1 -12
  13. package/lib/assistant/job-creator.js.map +1 -1
  14. package/lib/builtin/five-agent/index.d.ts +6 -3
  15. package/lib/builtin/five-agent/index.d.ts.map +1 -1
  16. package/lib/builtin/five-agent/index.js +6 -4
  17. package/lib/builtin/five-agent/index.js.map +1 -1
  18. package/lib/builtin/five-agent/prompts.d.ts +3 -3
  19. package/lib/builtin/five-agent/prompts.d.ts.map +1 -1
  20. package/lib/builtin/five-agent/prompts.js +3 -3
  21. package/lib/builtin/five-agent/prompts.js.map +1 -1
  22. package/lib/builtin/five-agent/role-capability-policy.d.ts +9 -0
  23. package/lib/builtin/five-agent/role-capability-policy.d.ts.map +1 -0
  24. package/lib/builtin/five-agent/role-capability-policy.js +22 -0
  25. package/lib/builtin/five-agent/role-capability-policy.js.map +1 -0
  26. package/lib/builtin/five-agent/roles.d.ts +5 -0
  27. package/lib/builtin/five-agent/roles.d.ts.map +1 -0
  28. package/lib/builtin/five-agent/roles.js +12 -0
  29. package/lib/builtin/five-agent/roles.js.map +1 -0
  30. package/lib/builtin/orchestration-tools.d.ts.map +1 -1
  31. package/lib/builtin/orchestration-tools.js +12 -38
  32. package/lib/builtin/orchestration-tools.js.map +1 -1
  33. package/lib/builtin/spawn-task-tool.js +2 -2
  34. package/lib/builtin/spawn-task-tool.js.map +1 -1
  35. package/lib/config/agent-interfaces.d.ts +2 -2
  36. package/lib/config/agent-interfaces.d.ts.map +1 -1
  37. package/lib/config/fix-ai-config.d.ts.map +1 -1
  38. package/lib/config/fix-ai-config.js +1 -38
  39. package/lib/config/fix-ai-config.js.map +1 -1
  40. package/lib/config/index.d.ts +1 -1
  41. package/lib/config/index.d.ts.map +1 -1
  42. package/lib/config/index.js +1 -1
  43. package/lib/config/index.js.map +1 -1
  44. package/lib/config/resolve-five-agent-binding.d.ts +10 -0
  45. package/lib/config/resolve-five-agent-binding.d.ts.map +1 -0
  46. package/lib/config/resolve-five-agent-binding.js +31 -0
  47. package/lib/config/resolve-five-agent-binding.js.map +1 -0
  48. package/lib/context/context-system.d.ts +2 -2
  49. package/lib/context/context-system.d.ts.map +1 -1
  50. package/lib/context/context-system.js +2 -3
  51. package/lib/context/context-system.js.map +1 -1
  52. package/lib/context/context-tail-limit.d.ts +0 -2
  53. package/lib/context/context-tail-limit.d.ts.map +1 -1
  54. package/lib/context/context-tail-limit.js +1 -3
  55. package/lib/context/context-tail-limit.js.map +1 -1
  56. package/lib/context/default-builders.d.ts +0 -4
  57. package/lib/context/default-builders.d.ts.map +1 -1
  58. package/lib/context/default-builders.js +0 -14
  59. package/lib/context/default-builders.js.map +1 -1
  60. package/lib/context/envelope-parts.d.ts +0 -1
  61. package/lib/context/envelope-parts.d.ts.map +1 -1
  62. package/lib/context/index.d.ts +2 -2
  63. package/lib/context/index.d.ts.map +1 -1
  64. package/lib/context/index.js +2 -2
  65. package/lib/context/index.js.map +1 -1
  66. package/lib/context/turn-envelope.d.ts +0 -1
  67. package/lib/context/turn-envelope.d.ts.map +1 -1
  68. package/lib/context/turn-envelope.js +0 -2
  69. package/lib/context/turn-envelope.js.map +1 -1
  70. package/lib/core/agent-loop-standalone.d.ts +2 -1
  71. package/lib/core/agent-loop-standalone.d.ts.map +1 -1
  72. package/lib/core/agent-loop-standalone.js.map +1 -1
  73. package/lib/event/agent-stream-bus.d.ts +0 -1
  74. package/lib/event/agent-stream-bus.d.ts.map +1 -1
  75. package/lib/event/agent-stream-bus.js.map +1 -1
  76. package/lib/event/publish-agent-stream.js +2 -2
  77. package/lib/event/publish-agent-stream.js.map +1 -1
  78. package/lib/event/turn-event.d.ts +11 -1
  79. package/lib/event/turn-event.d.ts.map +1 -1
  80. package/lib/event/turn-event.js.map +1 -1
  81. package/lib/index.d.ts +13 -21
  82. package/lib/index.d.ts.map +1 -1
  83. package/lib/index.js +6 -15
  84. package/lib/index.js.map +1 -1
  85. package/lib/init/activate-ai-database-storage.d.ts +2 -2
  86. package/lib/init/activate-ai-database-storage.d.ts.map +1 -1
  87. package/lib/init/activate-ai-database-storage.js +1 -3
  88. package/lib/init/activate-ai-database-storage.js.map +1 -1
  89. package/lib/init/define-ai-database-models.d.ts +1 -1
  90. package/lib/init/define-ai-database-models.d.ts.map +1 -1
  91. package/lib/init/define-ai-database-models.js +1 -9
  92. package/lib/init/define-ai-database-models.js.map +1 -1
  93. package/lib/init/runtime-management-commands.d.ts +2 -3
  94. package/lib/init/runtime-management-commands.d.ts.map +1 -1
  95. package/lib/init/runtime-management-commands.js +6 -6
  96. package/lib/init/runtime-management-commands.js.map +1 -1
  97. package/lib/internal/agent-host.d.ts +2 -3
  98. package/lib/internal/agent-host.d.ts.map +1 -1
  99. package/lib/internal/host-types.d.ts +0 -28
  100. package/lib/internal/host-types.d.ts.map +1 -1
  101. package/lib/memory/context-repository-store.js +1 -1
  102. package/lib/memory/context-repository-store.js.map +1 -1
  103. package/lib/memory/memory-system.d.ts +1 -2
  104. package/lib/memory/memory-system.d.ts.map +1 -1
  105. package/lib/memory/memory-system.js +1 -3
  106. package/lib/memory/memory-system.js.map +1 -1
  107. package/lib/orchestrator/bootstrap-executors.d.ts +0 -4
  108. package/lib/orchestrator/bootstrap-executors.d.ts.map +1 -1
  109. package/lib/orchestrator/bootstrap-executors.js +11 -137
  110. package/lib/orchestrator/bootstrap-executors.js.map +1 -1
  111. package/lib/orchestrator/orchestration-mappers.d.ts +1 -1
  112. package/lib/orchestrator/orchestration-mappers.d.ts.map +1 -1
  113. package/lib/orchestrator/orchestration-mappers.js +4 -49
  114. package/lib/orchestrator/orchestration-mappers.js.map +1 -1
  115. package/lib/orchestrator/orchestration-service.d.ts.map +1 -1
  116. package/lib/orchestrator/orchestration-service.js +2 -5
  117. package/lib/orchestrator/orchestration-service.js.map +1 -1
  118. package/lib/orchestrator/orchestration-source.d.ts +5 -0
  119. package/lib/orchestrator/orchestration-source.d.ts.map +1 -0
  120. package/lib/orchestrator/orchestration-source.js +22 -0
  121. package/lib/orchestrator/orchestration-source.js.map +1 -0
  122. package/lib/outbound/send-proactive.d.ts +3 -13
  123. package/lib/outbound/send-proactive.d.ts.map +1 -1
  124. package/lib/outbound/send-proactive.js +1 -53
  125. package/lib/outbound/send-proactive.js.map +1 -1
  126. package/lib/plugin-runtime/agent-host-port.d.ts +12 -3
  127. package/lib/plugin-runtime/agent-host-port.d.ts.map +1 -1
  128. package/lib/plugin-runtime/agent-host-port.js +1 -1
  129. package/lib/plugin-runtime/agent-host-port.js.map +1 -1
  130. package/lib/plugin-runtime/agent-runtime.d.ts +7 -4
  131. package/lib/plugin-runtime/agent-runtime.d.ts.map +1 -1
  132. package/lib/plugin-runtime/agent-runtime.js +3 -2
  133. package/lib/plugin-runtime/agent-runtime.js.map +1 -1
  134. package/lib/plugin-runtime/capability-tools.d.ts.map +1 -1
  135. package/lib/plugin-runtime/capability-tools.js +3 -0
  136. package/lib/plugin-runtime/capability-tools.js.map +1 -1
  137. package/lib/plugin-runtime/deferred-capability-plan.d.ts +1 -0
  138. package/lib/plugin-runtime/deferred-capability-plan.d.ts.map +1 -1
  139. package/lib/plugin-runtime/deferred-capability-plan.js +1 -1
  140. package/lib/plugin-runtime/deferred-capability-plan.js.map +1 -1
  141. package/lib/plugin-runtime/full-agent-turn-engine.d.ts.map +1 -1
  142. package/lib/plugin-runtime/full-agent-turn-engine.js +102 -0
  143. package/lib/plugin-runtime/full-agent-turn-engine.js.map +1 -1
  144. package/lib/plugin-runtime/host-mcp-projection.d.ts.map +1 -1
  145. package/lib/plugin-runtime/host-mcp-projection.js +17 -2
  146. package/lib/plugin-runtime/host-mcp-projection.js.map +1 -1
  147. package/lib/plugin-runtime/schedule-capability-plan.d.ts +20 -0
  148. package/lib/plugin-runtime/schedule-capability-plan.d.ts.map +1 -0
  149. package/lib/plugin-runtime/schedule-capability-plan.js +88 -0
  150. package/lib/plugin-runtime/schedule-capability-plan.js.map +1 -0
  151. package/lib/prompt/assembly.d.ts.map +1 -1
  152. package/lib/prompt/assembly.js +2 -0
  153. package/lib/prompt/assembly.js.map +1 -1
  154. package/lib/prompt/index.d.ts +5 -1
  155. package/lib/prompt/index.d.ts.map +1 -1
  156. package/lib/prompt/index.js +3 -1
  157. package/lib/prompt/index.js.map +1 -1
  158. package/lib/prompt/prompt-assembly-registry.d.ts +25 -0
  159. package/lib/prompt/prompt-assembly-registry.d.ts.map +1 -0
  160. package/lib/prompt/prompt-assembly-registry.js +43 -0
  161. package/lib/prompt/prompt-assembly-registry.js.map +1 -0
  162. package/lib/prompt/prompt-budget.d.ts +9 -0
  163. package/lib/prompt/prompt-budget.d.ts.map +1 -0
  164. package/lib/prompt/prompt-budget.js +28 -0
  165. package/lib/prompt/prompt-budget.js.map +1 -0
  166. package/lib/prompt/prompt-builder.js +1 -1
  167. package/lib/prompt/prompt-builder.js.map +1 -1
  168. package/lib/prompt/system-prompt.d.ts +5 -8
  169. package/lib/prompt/system-prompt.d.ts.map +1 -1
  170. package/lib/prompt/system-prompt.js +159 -78
  171. package/lib/prompt/system-prompt.js.map +1 -1
  172. package/lib/prompt/tokens.d.ts +8 -0
  173. package/lib/prompt/tokens.d.ts.map +1 -0
  174. package/lib/prompt/tokens.js +2 -0
  175. package/lib/prompt/tokens.js.map +1 -0
  176. package/lib/prompt/turn-prompt-profile.d.ts +1 -2
  177. package/lib/prompt/turn-prompt-profile.d.ts.map +1 -1
  178. package/lib/schedule-domain/audit-logger.d.ts +2 -2
  179. package/lib/schedule-domain/audit-logger.d.ts.map +1 -1
  180. package/lib/schedule-domain/execution-domain.d.ts +21 -17
  181. package/lib/schedule-domain/execution-domain.d.ts.map +1 -1
  182. package/lib/schedule-domain/execution-domain.js +41 -23
  183. package/lib/schedule-domain/execution-domain.js.map +1 -1
  184. package/lib/schedule-domain/index.d.ts +0 -1
  185. package/lib/schedule-domain/index.d.ts.map +1 -1
  186. package/lib/schedule-domain/index.js +0 -1
  187. package/lib/schedule-domain/index.js.map +1 -1
  188. package/lib/schedule-domain/prompt-assembler.d.ts +3 -4
  189. package/lib/schedule-domain/prompt-assembler.d.ts.map +1 -1
  190. package/lib/schedule-domain/prompt-assembler.js +0 -16
  191. package/lib/schedule-domain/prompt-assembler.js.map +1 -1
  192. package/lib/schedule-domain/security-harness.d.ts +10 -15
  193. package/lib/schedule-domain/security-harness.d.ts.map +1 -1
  194. package/lib/schedule-domain/security-harness.js +5 -78
  195. package/lib/schedule-domain/security-harness.js.map +1 -1
  196. package/lib/security/exec-policy.d.ts +2 -0
  197. package/lib/security/exec-policy.d.ts.map +1 -1
  198. package/lib/security/exec-policy.js +21 -0
  199. package/lib/security/exec-policy.js.map +1 -1
  200. package/lib/security/owner-approve-always-store.d.ts +8 -3
  201. package/lib/security/owner-approve-always-store.d.ts.map +1 -1
  202. package/lib/security/owner-approve-always-store.js +160 -173
  203. package/lib/security/owner-approve-always-store.js.map +1 -1
  204. package/lib/security/policy-facade.d.ts.map +1 -1
  205. package/lib/security/policy-facade.js +11 -1
  206. package/lib/security/policy-facade.js.map +1 -1
  207. package/lib/service.d.ts.map +1 -1
  208. package/lib/service.js +0 -7
  209. package/lib/service.js.map +1 -1
  210. package/lib/session/index.d.ts +3 -3
  211. package/lib/session/index.d.ts.map +1 -1
  212. package/lib/session/index.js +3 -3
  213. package/lib/session/index.js.map +1 -1
  214. package/lib/session/passive-group-session.js +1 -1
  215. package/lib/session/session-key.d.ts +4 -0
  216. package/lib/session/session-key.d.ts.map +1 -0
  217. package/lib/session/session-key.js +6 -0
  218. package/lib/session/session-key.js.map +1 -0
  219. package/lib/session/session-system.d.ts.map +1 -1
  220. package/lib/session/session-system.js +4 -4
  221. package/lib/session/session-system.js.map +1 -1
  222. package/lib/session/session-tree-commands.d.ts +2 -3
  223. package/lib/session/session-tree-commands.d.ts.map +1 -1
  224. package/lib/session/session-tree-commands.js +2 -5
  225. package/lib/session/session-tree-commands.js.map +1 -1
  226. package/lib/session/strategies.d.ts +1 -1
  227. package/lib/session/strategies.d.ts.map +1 -1
  228. package/lib/session/strategies.js +2 -2
  229. package/lib/session/strategies.js.map +1 -1
  230. package/lib/subagent/im-result-sink.d.ts.map +1 -1
  231. package/lib/subagent/im-result-sink.js +0 -1
  232. package/lib/subagent/im-result-sink.js.map +1 -1
  233. package/lib/subagent-goal-notify.d.ts +0 -9
  234. package/lib/subagent-goal-notify.d.ts.map +1 -1
  235. package/lib/subagent-goal-notify.js +0 -13
  236. package/lib/subagent-goal-notify.js.map +1 -1
  237. package/lib/task-executor.d.ts +14 -3
  238. package/lib/task-executor.d.ts.map +1 -1
  239. package/lib/task-executor.js +48 -61
  240. package/lib/task-executor.js.map +1 -1
  241. package/lib/tool/classic-tool-execution-authority.d.ts.map +1 -1
  242. package/lib/tool/classic-tool-execution-authority.js +4 -3
  243. package/lib/tool/classic-tool-execution-authority.js.map +1 -1
  244. package/lib/tool/prepare-turn-tools.d.ts +0 -2
  245. package/lib/tool/prepare-turn-tools.d.ts.map +1 -1
  246. package/lib/tool/prepare-turn-tools.js +1 -55
  247. package/lib/tool/prepare-turn-tools.js.map +1 -1
  248. package/lib/tool/tool-runtime.d.ts +1 -1
  249. package/lib/tool/tool-runtime.d.ts.map +1 -1
  250. package/lib/turn/auto-continue.js +1 -1
  251. package/lib/turn/auto-continue.js.map +1 -1
  252. package/lib/turn/persist-deferred-context.js +1 -1
  253. package/lib/turn/persist-deferred-context.js.map +1 -1
  254. package/lib/turn/persist-subagent-context.js +1 -1
  255. package/lib/turn/persist-subagent-context.js.map +1 -1
  256. package/lib/turn/process-stream.d.ts.map +1 -1
  257. package/lib/turn/process-stream.js +0 -2
  258. package/lib/turn/process-stream.js.map +1 -1
  259. package/lib/turn/turn-ingress.d.ts +21 -1
  260. package/lib/turn/turn-ingress.d.ts.map +1 -1
  261. package/lib/turn/turn-ingress.js +29 -0
  262. package/lib/turn/turn-ingress.js.map +1 -1
  263. package/lib/turn/turn-pipeline.d.ts +0 -5
  264. package/lib/turn/turn-pipeline.d.ts.map +1 -1
  265. package/lib/turn/turn-pipeline.js +12 -32
  266. package/lib/turn/turn-pipeline.js.map +1 -1
  267. package/lib/typing-indicator/adapter-integration.d.ts +1 -2
  268. package/lib/typing-indicator/adapter-integration.d.ts.map +1 -1
  269. package/lib/typing-indicator/adapter-integration.js.map +1 -1
  270. package/lib/typing-indicator/integration.d.ts +2 -3
  271. package/lib/typing-indicator/integration.d.ts.map +1 -1
  272. package/lib/typing-indicator/integration.js +48 -11
  273. package/lib/typing-indicator/integration.js.map +1 -1
  274. package/lib/zhin-agent/index.d.ts +5 -8
  275. package/lib/zhin-agent/index.d.ts.map +1 -1
  276. package/lib/zhin-agent/index.js +13 -15
  277. package/lib/zhin-agent/index.js.map +1 -1
  278. package/package.json +9 -9
  279. package/lib/aop/index.d.ts +0 -11
  280. package/lib/aop/index.d.ts.map +0 -1
  281. package/lib/aop/index.js +0 -11
  282. package/lib/aop/index.js.map +0 -1
  283. package/lib/aop/pipeline/index.d.ts +0 -12
  284. package/lib/aop/pipeline/index.d.ts.map +0 -1
  285. package/lib/aop/pipeline/index.js +0 -12
  286. package/lib/aop/pipeline/index.js.map +0 -1
  287. package/lib/aop/pipeline/pipeline-flow.d.ts +0 -25
  288. package/lib/aop/pipeline/pipeline-flow.d.ts.map +0 -1
  289. package/lib/aop/pipeline/pipeline-flow.js +0 -115
  290. package/lib/aop/pipeline/pipeline-flow.js.map +0 -1
  291. package/lib/aop/pipeline/pipeline-mode.d.ts +0 -10
  292. package/lib/aop/pipeline/pipeline-mode.d.ts.map +0 -1
  293. package/lib/aop/pipeline/pipeline-mode.js +0 -16
  294. package/lib/aop/pipeline/pipeline-mode.js.map +0 -1
  295. package/lib/aop/pipeline/pipeline-service.d.ts +0 -123
  296. package/lib/aop/pipeline/pipeline-service.d.ts.map +0 -1
  297. package/lib/aop/pipeline/pipeline-service.js +0 -238
  298. package/lib/aop/pipeline/pipeline-service.js.map +0 -1
  299. package/lib/aop/pipeline/pipeline-transitions.d.ts +0 -14
  300. package/lib/aop/pipeline/pipeline-transitions.d.ts.map +0 -1
  301. package/lib/aop/pipeline/pipeline-transitions.js +0 -31
  302. package/lib/aop/pipeline/pipeline-transitions.js.map +0 -1
  303. package/lib/aop/pipeline/ports.d.ts +0 -16
  304. package/lib/aop/pipeline/ports.d.ts.map +0 -1
  305. package/lib/aop/pipeline/ports.js +0 -2
  306. package/lib/aop/pipeline/ports.js.map +0 -1
  307. package/lib/aop/pipeline/role-capability-policy.d.ts +0 -16
  308. package/lib/aop/pipeline/role-capability-policy.d.ts.map +0 -1
  309. package/lib/aop/pipeline/role-capability-policy.js +0 -29
  310. package/lib/aop/pipeline/role-capability-policy.js.map +0 -1
  311. package/lib/aop/runtime/index.d.ts +0 -9
  312. package/lib/aop/runtime/index.d.ts.map +0 -1
  313. package/lib/aop/runtime/index.js +0 -9
  314. package/lib/aop/runtime/index.js.map +0 -1
  315. package/lib/collaboration/collab-admin-gate.d.ts +0 -21
  316. package/lib/collaboration/collab-admin-gate.d.ts.map +0 -1
  317. package/lib/collaboration/collab-admin-gate.js +0 -74
  318. package/lib/collaboration/collab-admin-gate.js.map +0 -1
  319. package/lib/collaboration/collab-utils.d.ts +0 -15
  320. package/lib/collaboration/collab-utils.d.ts.map +0 -1
  321. package/lib/collaboration/collab-utils.js +0 -37
  322. package/lib/collaboration/collab-utils.js.map +0 -1
  323. package/lib/collaboration/collaboration-artifact-repository.d.ts +0 -48
  324. package/lib/collaboration/collaboration-artifact-repository.d.ts.map +0 -1
  325. package/lib/collaboration/collaboration-artifact-repository.js +0 -114
  326. package/lib/collaboration/collaboration-artifact-repository.js.map +0 -1
  327. package/lib/collaboration/collaboration-commands.d.ts +0 -38
  328. package/lib/collaboration/collaboration-commands.d.ts.map +0 -1
  329. package/lib/collaboration/collaboration-commands.js +0 -373
  330. package/lib/collaboration/collaboration-commands.js.map +0 -1
  331. package/lib/collaboration/collaboration-config.d.ts +0 -30
  332. package/lib/collaboration/collaboration-config.d.ts.map +0 -1
  333. package/lib/collaboration/collaboration-config.js +0 -170
  334. package/lib/collaboration/collaboration-config.js.map +0 -1
  335. package/lib/collaboration/collaboration-context.d.ts +0 -15
  336. package/lib/collaboration/collaboration-context.d.ts.map +0 -1
  337. package/lib/collaboration/collaboration-context.js +0 -101
  338. package/lib/collaboration/collaboration-context.js.map +0 -1
  339. package/lib/collaboration/collaboration-db-model.d.ts +0 -350
  340. package/lib/collaboration/collaboration-db-model.d.ts.map +0 -1
  341. package/lib/collaboration/collaboration-db-model.js +0 -112
  342. package/lib/collaboration/collaboration-db-model.js.map +0 -1
  343. package/lib/collaboration/collaboration-delegation.d.ts +0 -21
  344. package/lib/collaboration/collaboration-delegation.d.ts.map +0 -1
  345. package/lib/collaboration/collaboration-delegation.js +0 -221
  346. package/lib/collaboration/collaboration-delegation.js.map +0 -1
  347. package/lib/collaboration/collaboration-dispatch.d.ts +0 -32
  348. package/lib/collaboration/collaboration-dispatch.d.ts.map +0 -1
  349. package/lib/collaboration/collaboration-dispatch.js +0 -93
  350. package/lib/collaboration/collaboration-dispatch.js.map +0 -1
  351. package/lib/collaboration/collaboration-kernel-bridge.d.ts +0 -23
  352. package/lib/collaboration/collaboration-kernel-bridge.d.ts.map +0 -1
  353. package/lib/collaboration/collaboration-kernel-bridge.js +0 -105
  354. package/lib/collaboration/collaboration-kernel-bridge.js.map +0 -1
  355. package/lib/collaboration/collaboration-outbound.d.ts +0 -64
  356. package/lib/collaboration/collaboration-outbound.d.ts.map +0 -1
  357. package/lib/collaboration/collaboration-outbound.js +0 -312
  358. package/lib/collaboration/collaboration-outbound.js.map +0 -1
  359. package/lib/collaboration/collaboration-scene-repository.d.ts +0 -154
  360. package/lib/collaboration/collaboration-scene-repository.d.ts.map +0 -1
  361. package/lib/collaboration/collaboration-scene-repository.js +0 -451
  362. package/lib/collaboration/collaboration-scene-repository.js.map +0 -1
  363. package/lib/collaboration/collaboration-turn-snapshot.d.ts +0 -18
  364. package/lib/collaboration/collaboration-turn-snapshot.d.ts.map +0 -1
  365. package/lib/collaboration/collaboration-turn-snapshot.js +0 -35
  366. package/lib/collaboration/collaboration-turn-snapshot.js.map +0 -1
  367. package/lib/collaboration/delegation-state.d.ts +0 -30
  368. package/lib/collaboration/delegation-state.d.ts.map +0 -1
  369. package/lib/collaboration/delegation-state.js +0 -86
  370. package/lib/collaboration/delegation-state.js.map +0 -1
  371. package/lib/collaboration/endpoint-identity.d.ts +0 -28
  372. package/lib/collaboration/endpoint-identity.d.ts.map +0 -1
  373. package/lib/collaboration/endpoint-identity.js +0 -80
  374. package/lib/collaboration/endpoint-identity.js.map +0 -1
  375. package/lib/collaboration/group-feed.d.ts +0 -30
  376. package/lib/collaboration/group-feed.d.ts.map +0 -1
  377. package/lib/collaboration/group-feed.js +0 -150
  378. package/lib/collaboration/group-feed.js.map +0 -1
  379. package/lib/collaboration/group-message.d.ts +0 -53
  380. package/lib/collaboration/group-message.d.ts.map +0 -1
  381. package/lib/collaboration/group-message.js +0 -101
  382. package/lib/collaboration/group-message.js.map +0 -1
  383. package/lib/collaboration/im-mention-delegate.d.ts +0 -22
  384. package/lib/collaboration/im-mention-delegate.d.ts.map +0 -1
  385. package/lib/collaboration/im-mention-delegate.js +0 -15
  386. package/lib/collaboration/im-mention-delegate.js.map +0 -1
  387. package/lib/collaboration/inbound-peer-handback.d.ts +0 -18
  388. package/lib/collaboration/inbound-peer-handback.d.ts.map +0 -1
  389. package/lib/collaboration/inbound-peer-handback.js +0 -65
  390. package/lib/collaboration/inbound-peer-handback.js.map +0 -1
  391. package/lib/collaboration/inbound-spawn-task.d.ts +0 -29
  392. package/lib/collaboration/inbound-spawn-task.d.ts.map +0 -1
  393. package/lib/collaboration/inbound-spawn-task.js +0 -96
  394. package/lib/collaboration/inbound-spawn-task.js.map +0 -1
  395. package/lib/collaboration/inbound-turn-endpoint.d.ts +0 -16
  396. package/lib/collaboration/inbound-turn-endpoint.d.ts.map +0 -1
  397. package/lib/collaboration/inbound-turn-endpoint.js +0 -26
  398. package/lib/collaboration/inbound-turn-endpoint.js.map +0 -1
  399. package/lib/collaboration/inbound-turn-tools.d.ts +0 -13
  400. package/lib/collaboration/inbound-turn-tools.d.ts.map +0 -1
  401. package/lib/collaboration/inbound-turn-tools.js +0 -24
  402. package/lib/collaboration/inbound-turn-tools.js.map +0 -1
  403. package/lib/collaboration/index.d.ts +0 -21
  404. package/lib/collaboration/index.d.ts.map +0 -1
  405. package/lib/collaboration/index.js +0 -19
  406. package/lib/collaboration/index.js.map +0 -1
  407. package/lib/collaboration/init-observe-hook.d.ts +0 -56
  408. package/lib/collaboration/init-observe-hook.d.ts.map +0 -1
  409. package/lib/collaboration/init-observe-hook.js +0 -168
  410. package/lib/collaboration/init-observe-hook.js.map +0 -1
  411. package/lib/collaboration/init-wizard-service.d.ts +0 -57
  412. package/lib/collaboration/init-wizard-service.d.ts.map +0 -1
  413. package/lib/collaboration/init-wizard-service.js +0 -187
  414. package/lib/collaboration/init-wizard-service.js.map +0 -1
  415. package/lib/collaboration/outbound-resolver.d.ts +0 -37
  416. package/lib/collaboration/outbound-resolver.d.ts.map +0 -1
  417. package/lib/collaboration/outbound-resolver.js +0 -189
  418. package/lib/collaboration/outbound-resolver.js.map +0 -1
  419. package/lib/collaboration/peer-policy.d.ts +0 -29
  420. package/lib/collaboration/peer-policy.d.ts.map +0 -1
  421. package/lib/collaboration/peer-policy.js +0 -118
  422. package/lib/collaboration/peer-policy.js.map +0 -1
  423. package/lib/collaboration/resolve-agent-session-key.d.ts +0 -21
  424. package/lib/collaboration/resolve-agent-session-key.d.ts.map +0 -1
  425. package/lib/collaboration/resolve-agent-session-key.js +0 -61
  426. package/lib/collaboration/resolve-agent-session-key.js.map +0 -1
  427. package/lib/collaboration/runtime-inbound-gate.d.ts +0 -35
  428. package/lib/collaboration/runtime-inbound-gate.d.ts.map +0 -1
  429. package/lib/collaboration/runtime-inbound-gate.js +0 -105
  430. package/lib/collaboration/runtime-inbound-gate.js.map +0 -1
  431. package/lib/collaboration/scene-context.d.ts +0 -17
  432. package/lib/collaboration/scene-context.d.ts.map +0 -1
  433. package/lib/collaboration/scene-context.js +0 -22
  434. package/lib/collaboration/scene-context.js.map +0 -1
  435. package/lib/collaboration/scene-identity-service.d.ts +0 -169
  436. package/lib/collaboration/scene-identity-service.d.ts.map +0 -1
  437. package/lib/collaboration/scene-identity-service.js +0 -479
  438. package/lib/collaboration/scene-identity-service.js.map +0 -1
  439. package/lib/collaboration/scene-service.d.ts +0 -67
  440. package/lib/collaboration/scene-service.d.ts.map +0 -1
  441. package/lib/collaboration/scene-service.js +0 -157
  442. package/lib/collaboration/scene-service.js.map +0 -1
  443. package/lib/collaboration/structured-ai-outbound.d.ts +0 -25
  444. package/lib/collaboration/structured-ai-outbound.d.ts.map +0 -1
  445. package/lib/collaboration/structured-ai-outbound.js +0 -179
  446. package/lib/collaboration/structured-ai-outbound.js.map +0 -1
  447. package/lib/collaboration/turn-plan-resolver.d.ts +0 -17
  448. package/lib/collaboration/turn-plan-resolver.d.ts.map +0 -1
  449. package/lib/collaboration/turn-plan-resolver.js +0 -63
  450. package/lib/collaboration/turn-plan-resolver.js.map +0 -1
  451. package/lib/collaboration/types.d.ts +0 -147
  452. package/lib/collaboration/types.d.ts.map +0 -1
  453. package/lib/collaboration/types.js +0 -16
  454. package/lib/collaboration/types.js.map +0 -1
  455. package/lib/collaboration/wire-collaboration-storage.d.ts +0 -4
  456. package/lib/collaboration/wire-collaboration-storage.d.ts.map +0 -1
  457. package/lib/collaboration/wire-collaboration-storage.js +0 -26
  458. package/lib/collaboration/wire-collaboration-storage.js.map +0 -1
  459. package/lib/config/resolve-pipeline-binding.d.ts +0 -16
  460. package/lib/config/resolve-pipeline-binding.d.ts.map +0 -1
  461. package/lib/config/resolve-pipeline-binding.js +0 -35
  462. package/lib/config/resolve-pipeline-binding.js.map +0 -1
  463. package/lib/discovery/register-agent-surface.d.ts +0 -33
  464. package/lib/discovery/register-agent-surface.d.ts.map +0 -1
  465. package/lib/discovery/register-agent-surface.js +0 -170
  466. package/lib/discovery/register-agent-surface.js.map +0 -1
  467. package/lib/init/create-zhin-agent.d.ts +0 -3
  468. package/lib/init/create-zhin-agent.d.ts.map +0 -1
  469. package/lib/init/create-zhin-agent.js +0 -401
  470. package/lib/init/create-zhin-agent.js.map +0 -1
  471. package/lib/init/register-ai-service.d.ts +0 -7
  472. package/lib/init/register-ai-service.d.ts.map +0 -1
  473. package/lib/init/register-ai-service.js +0 -45
  474. package/lib/init/register-ai-service.js.map +0 -1
  475. package/lib/init/register-builtin-tools.d.ts +0 -3
  476. package/lib/init/register-builtin-tools.d.ts.map +0 -1
  477. package/lib/init/register-builtin-tools.js +0 -411
  478. package/lib/init/register-builtin-tools.js.map +0 -1
  479. package/lib/init/register-capability-features.d.ts +0 -2
  480. package/lib/init/register-capability-features.d.ts.map +0 -1
  481. package/lib/init/register-capability-features.js +0 -28
  482. package/lib/init/register-capability-features.js.map +0 -1
  483. package/lib/init/register-collaboration-commands.d.ts +0 -2
  484. package/lib/init/register-collaboration-commands.d.ts.map +0 -1
  485. package/lib/init/register-collaboration-commands.js +0 -110
  486. package/lib/init/register-collaboration-commands.js.map +0 -1
  487. package/lib/init/register-db-models.d.ts +0 -2
  488. package/lib/init/register-db-models.d.ts.map +0 -1
  489. package/lib/init/register-db-models.js +0 -18
  490. package/lib/init/register-db-models.js.map +0 -1
  491. package/lib/init/register-db-upgrade.d.ts +0 -7
  492. package/lib/init/register-db-upgrade.d.ts.map +0 -1
  493. package/lib/init/register-db-upgrade.js +0 -79
  494. package/lib/init/register-db-upgrade.js.map +0 -1
  495. package/lib/init/register-group-session-passive.d.ts +0 -3
  496. package/lib/init/register-group-session-passive.d.ts.map +0 -1
  497. package/lib/init/register-group-session-passive.js +0 -61
  498. package/lib/init/register-group-session-passive.js.map +0 -1
  499. package/lib/init/register-im-segment-filter.d.ts +0 -2
  500. package/lib/init/register-im-segment-filter.d.ts.map +0 -1
  501. package/lib/init/register-im-segment-filter.js +0 -23
  502. package/lib/init/register-im-segment-filter.js.map +0 -1
  503. package/lib/init/register-init-wizard-guardrail.d.ts +0 -2
  504. package/lib/init/register-init-wizard-guardrail.d.ts.map +0 -1
  505. package/lib/init/register-init-wizard-guardrail.js +0 -41
  506. package/lib/init/register-init-wizard-guardrail.js.map +0 -1
  507. package/lib/init/register-introspection-commands.d.ts +0 -3
  508. package/lib/init/register-introspection-commands.d.ts.map +0 -1
  509. package/lib/init/register-introspection-commands.js +0 -107
  510. package/lib/init/register-introspection-commands.js.map +0 -1
  511. package/lib/init/register-management-tools.d.ts +0 -10
  512. package/lib/init/register-management-tools.d.ts.map +0 -1
  513. package/lib/init/register-management-tools.js +0 -42
  514. package/lib/init/register-management-tools.js.map +0 -1
  515. package/lib/init/register-mcp-from-config.d.ts +0 -2
  516. package/lib/init/register-mcp-from-config.d.ts.map +0 -1
  517. package/lib/init/register-mcp-from-config.js +0 -87
  518. package/lib/init/register-mcp-from-config.js.map +0 -1
  519. package/lib/init/register-orchestrator.d.ts +0 -2
  520. package/lib/init/register-orchestrator.d.ts.map +0 -1
  521. package/lib/init/register-orchestrator.js +0 -15
  522. package/lib/init/register-orchestrator.js.map +0 -1
  523. package/lib/init/register-tool-service.d.ts +0 -2
  524. package/lib/init/register-tool-service.d.ts.map +0 -1
  525. package/lib/init/register-tool-service.js +0 -9
  526. package/lib/init/register-tool-service.js.map +0 -1
  527. package/lib/init/shared-refs.d.ts +0 -14
  528. package/lib/init/shared-refs.d.ts.map +0 -1
  529. package/lib/init/shared-refs.js +0 -7
  530. package/lib/init/shared-refs.js.map +0 -1
  531. package/lib/init/types.d.ts +0 -26
  532. package/lib/init/types.d.ts.map +0 -1
  533. package/lib/init/types.js +0 -7
  534. package/lib/init/types.js.map +0 -1
  535. package/lib/init.d.ts +0 -7
  536. package/lib/init.d.ts.map +0 -1
  537. package/lib/init.js +0 -11
  538. package/lib/init.js.map +0 -1
  539. package/lib/schedule-domain/tool-resolver.d.ts +0 -20
  540. package/lib/schedule-domain/tool-resolver.d.ts.map +0 -1
  541. package/lib/schedule-domain/tool-resolver.js +0 -80
  542. package/lib/schedule-domain/tool-resolver.js.map +0 -1
  543. package/lib/schedule-domain/turn-context.d.ts +0 -9
  544. package/lib/schedule-domain/turn-context.d.ts.map +0 -1
  545. package/lib/schedule-domain/turn-context.js +0 -36
  546. package/lib/schedule-domain/turn-context.js.map +0 -1
  547. package/lib/session/agent-session-host-port.d.ts +0 -23
  548. package/lib/session/agent-session-host-port.d.ts.map +0 -1
  549. package/lib/session/agent-session-host-port.js +0 -61
  550. package/lib/session/agent-session-host-port.js.map +0 -1
  551. package/lib/session/http-agent-session-store.d.ts +0 -76
  552. package/lib/session/http-agent-session-store.d.ts.map +0 -1
  553. package/lib/session/http-agent-session-store.js +0 -211
  554. package/lib/session/http-agent-session-store.js.map +0 -1
  555. package/lib/session/http-approval-adapter.d.ts +0 -11
  556. package/lib/session/http-approval-adapter.d.ts.map +0 -1
  557. package/lib/session/http-approval-adapter.js +0 -19
  558. package/lib/session/http-approval-adapter.js.map +0 -1
  559. package/lib/session/http-approval-waiter.d.ts +0 -11
  560. package/lib/session/http-approval-waiter.d.ts.map +0 -1
  561. package/lib/session/http-approval-waiter.js +0 -61
  562. package/lib/session/http-approval-waiter.js.map +0 -1
  563. package/lib/session/http-session-persistence.d.ts +0 -28
  564. package/lib/session/http-session-persistence.d.ts.map +0 -1
  565. package/lib/session/http-session-persistence.js +0 -60
  566. package/lib/session/http-session-persistence.js.map +0 -1
  567. package/lib/session/http-session-sink.d.ts +0 -11
  568. package/lib/session/http-session-sink.d.ts.map +0 -1
  569. package/lib/session/http-session-sink.js +0 -32
  570. package/lib/session/http-session-sink.js.map +0 -1
  571. package/lib/session/http-step-projector.d.ts +0 -16
  572. package/lib/session/http-step-projector.d.ts.map +0 -1
  573. package/lib/session/http-step-projector.js +0 -118
  574. package/lib/session/http-step-projector.js.map +0 -1
  575. package/lib/session/http-turn-runner.d.ts +0 -16
  576. package/lib/session/http-turn-runner.d.ts.map +0 -1
  577. package/lib/session/http-turn-runner.js +0 -57
  578. package/lib/session/http-turn-runner.js.map +0 -1
  579. package/lib/session/park-controller.d.ts +0 -24
  580. package/lib/session/park-controller.d.ts.map +0 -1
  581. package/lib/session/park-controller.js +0 -58
  582. package/lib/session/park-controller.js.map +0 -1
  583. package/lib/session/resolve-approval-port.d.ts +0 -7
  584. package/lib/session/resolve-approval-port.d.ts.map +0 -1
  585. package/lib/session/resolve-approval-port.js +0 -13
  586. package/lib/session/resolve-approval-port.js.map +0 -1
  587. package/lib/session/session-event-log.d.ts +0 -17
  588. package/lib/session/session-event-log.d.ts.map +0 -1
  589. package/lib/session/session-event-log.js +0 -56
  590. package/lib/session/session-event-log.js.map +0 -1
@@ -1,7 +0,0 @@
1
- /**
2
- * Upgrade AI components when DB becomes ready (agent_* + im_transcripts).
3
- */
4
- import './types.js';
5
- import type { AIServiceRefs } from './shared-refs.js';
6
- export declare function registerDbUpgrade(refs: AIServiceRefs): void;
7
- //# sourceMappingURL=register-db-upgrade.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register-db-upgrade.d.ts","sourceRoot":"","sources":["../../src/init/register-db-upgrade.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,YAAY,CAAC;AAGpB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAyCtD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI,CAiD3D"}
@@ -1,79 +0,0 @@
1
- /**
2
- * Upgrade AI components when DB becomes ready (agent_* + im_transcripts).
3
- */
4
- import './types.js';
5
- import { getPlugin } from '@zhin.js/core';
6
- import { activateAiDatabaseStorage } from './activate-ai-database-storage.js';
7
- import { wireCollaborationStorage } from '../collaboration/wire-collaboration-storage.js';
8
- import { upgradeAgentSessionTreeData, } from './upgrade-agent-db-schema.js';
9
- import { registerEndpointKeyColumnMigrationHook } from './upgrade-endpoint-id-schema.js';
10
- function logSessionTreeUpgrade(logger, result) {
11
- const changed = result.columns.length > 0
12
- || result.dropped.length > 0
13
- || result.idsBackfilled > 0
14
- || result.parentLinks > 0
15
- || result.activeLeaves > 0;
16
- const summary = `AI Session: session tree upgrade checked (columns=${result.columns.length}, dropped=${result.dropped.length}, ids=${result.idsBackfilled}, parent_links=${result.parentLinks}, active_leaves=${result.activeLeaves})`;
17
- if (!changed) {
18
- logger.debug(summary);
19
- return;
20
- }
21
- logger.info(summary);
22
- if (result.columns.length > 0) {
23
- logger.info(`AI Session: migrated agent_* columns: ${result.columns.join(', ')}`);
24
- }
25
- if (result.dropped.length > 0) {
26
- logger.info(`AI Session: dropped legacy agent_sessions columns: ${result.dropped.join(', ')}`);
27
- }
28
- if (result.idsBackfilled > 0 || result.parentLinks > 0 || result.activeLeaves > 0) {
29
- logger.info(`AI Session: repaired session tree (ids=${result.idsBackfilled}, parent_links=${result.parentLinks}, active_leaves=${result.activeLeaves})`);
30
- }
31
- }
32
- export function registerDbUpgrade(refs) {
33
- const plugin = getPlugin();
34
- const { useContext, root, logger } = plugin;
35
- registerEndpointKeyColumnMigrationHook(logger);
36
- useContext('ai', (ai) => {
37
- const configService = root.inject('config');
38
- const appConfig = configService?.getPrimary() || {};
39
- if (appConfig.ai?.sessions?.useDatabase === false) {
40
- refs.zhinAgent?.markMemoryPersistenceReady();
41
- void wireCollaborationStorage(undefined, appConfig.collaboration);
42
- return;
43
- }
44
- const db = root.inject('database');
45
- if (db && refs.zhinAgent) {
46
- void upgradeAgentSessionTreeData(db)
47
- .then(async (result) => {
48
- logSessionTreeUpgrade(logger, result);
49
- })
50
- .then(() => activateAiDatabaseStorage(db, refs, appConfig.ai || {}, appConfig.collaboration))
51
- .catch((e) => logger.error('AI Session: database setup failed:', e))
52
- .finally(() => {
53
- refs.zhinAgent?.markMemoryPersistenceReady();
54
- });
55
- }
56
- });
57
- useContext('database', 'ai', async (db, _ai) => {
58
- try {
59
- if (!refs.aiService)
60
- return;
61
- const configService = root.inject('config');
62
- const appConfig = configService?.getPrimary() || {};
63
- const config = appConfig.ai || {};
64
- if (config.sessions?.useDatabase === false)
65
- return;
66
- const result = await upgradeAgentSessionTreeData(db);
67
- logSessionTreeUpgrade(logger, result);
68
- await activateAiDatabaseStorage(db, refs, config, appConfig.collaboration);
69
- logger.debug('AI database storage activated (agent_sessions, agent_messages, im_transcripts)');
70
- }
71
- catch (e) {
72
- logger.error('AI Session: database setup failed:', e);
73
- }
74
- finally {
75
- refs.zhinAgent?.markMemoryPersistenceReady();
76
- }
77
- });
78
- }
79
- //# sourceMappingURL=register-db-upgrade.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register-db-upgrade.js","sourceRoot":"","sources":["../../src/init/register-db-upgrade.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,YAAY,CAAC;AACpB,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAC1F,OAAO,EACL,2BAA2B,GAE5B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,sCAAsC,EAAE,MAAM,iCAAiC,CAAC;AAIzF,SAAS,qBAAqB,CAC5B,MAAmF,EACnF,MAAgC;IAEhC,MAAM,OAAO,GACX,MAAM,CAAC,OAAO,CAAC,MAAM,GA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AI,EAAE,KAAK,EAAE,EAAO,EAAE,GAAG,EAAE,EAAE;QAClD,IAAI,CAAC;YACH,IAAI,CAAC,IAAI,CAAC,SAAS;gBAAE,OAAO;YAC5B,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC5C,MAAM,SAAS,GACb,aAAa,EAAE,UAAU,EAA8C,IAAI,EAAE,CAAC;YAChF,MAAM,MAAM,GAAG,SAAS,CAAC,EAAE,IAAI,EAAE,CAAC;YAClC,IAAI,MAAM,CAAC,QAAQ,EAAE,WAAW,KAAK,KAAK;gBAAE,OAAO;YAEnD,MAAM,MAAM,GAAG,MAAM,2BAA2B,CAAC,EAAsB,CAAC,CAAC;YACzE,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YACtC,MAAM,yBAAyB,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC;YAC3E,MAAM,CAAC,KAAK,CAAC,gFAAgF,CAAC,CAAC;QACjG,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,CAAC,KAAK,CAAC,oCAAoC,EAAE,CAAC,CAAC,CAAC;QACxD,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,SAAS,EAAE,0BAA0B,EAAE,CAAC;QAC/C,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { AIServiceRefs } from './shared-refs.js';
2
- export declare function registerGroupSessionPassive(refs: AIServiceRefs): void;
3
- //# sourceMappingURL=register-group-session-passive.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register-group-session-passive.d.ts","sourceRoot":"","sources":["../../src/init/register-group-session-passive.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAOtD,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI,CA4DrE"}
@@ -1,61 +0,0 @@
1
- /**
2
- * 群/频道共享 session:未 @ 机器人的消息写入 ContextRepository,供后续 @ 时带入上下文。
3
- * AI 回复仍仅由 shouldTriggerAI(群/频道下主要为 @)触发。
4
- */
5
- import { getPlugin, isActionMessage, mergeAITriggerConfig, resolveSenderRoles, extractTextContent } from '@zhin.js/core';
6
- import { findCellForInbound } from '../collaboration/collaboration-config.js';
7
- import { getCollaborationSceneService } from '../collaboration/scene-service.js';
8
- import { recordPassiveGroupObservation } from '../session/passive-group-session.js';
9
- import { resolveAgentTurnSessionKey } from '../collaboration/resolve-agent-session-key.js';
10
- import { asPrivate } from '../internal/as-private.js';
11
- function isBotSelfMessage(message) {
12
- const senderId = String(message.$sender?.id ?? '');
13
- const endpointKey = String(message.$endpoint ?? '');
14
- return senderId !== '' && endpointKey !== '' && senderId === endpointKey;
15
- }
16
- export function registerGroupSessionPassive(refs) {
17
- const plugin = getPlugin();
18
- const { root, logger } = plugin;
19
- plugin.useContext('ai', (ai) => {
20
- const dispatcher = root.inject('dispatcher');
21
- if (!dispatcher?.setGroupPassiveContextHandler) {
22
- logger.debug('Group passive context: dispatcher not available');
23
- return;
24
- }
25
- dispatcher.setGroupPassiveContextHandler(async (message) => {
26
- if (!refs.zhinAgent || isBotSelfMessage(message) || isActionMessage(message))
27
- return;
28
- const triggerConfig = mergeAITriggerConfig(ai.getTriggerConfig());
29
- const adapterInstance = root.inject(message.$adapter);
30
- const endpointConfig = adapterInstance?.endpoints?.get(message.$endpoint)?.$config;
31
- const { scope, roles } = resolveSenderRoles(message, triggerConfig, endpointConfig);
32
- void scope;
33
- void roles;
34
- const rawText = extractTextContent(message).trim();
35
- if (!rawText)
36
- return;
37
- const endpointKey = String(message.$endpoint ?? '');
38
- const channelScope = message.$channel?.type;
39
- const sceneId = message.$channel?.id ?? '';
40
- let cell = (channelScope === 'group' || channelScope === 'channel') && sceneId !== ''
41
- ? findCellForInbound(getCollaborationSceneService().listScenes(), String(message.$adapter), String(sceneId), endpointKey)
42
- : undefined;
43
- if (cell) {
44
- cell = (await getCollaborationSceneService().getSceneFresh(cell.id)) ?? cell;
45
- }
46
- const agent = asPrivate(refs.zhinAgent);
47
- await recordPassiveGroupObservation(agent, {
48
- sessionKey: resolveAgentTurnSessionKey(message, cell),
49
- senderId: String(message.$sender?.id ?? 'unknown'),
50
- senderName: String(message.$sender?.name ?? message.$sender?.id ?? 'unknown'),
51
- text: rawText,
52
- });
53
- });
54
- logger.debug('Group passive context handler registered');
55
- return () => {
56
- dispatcher.setGroupPassiveContextHandler?.(null);
57
- logger.debug('Group passive context handler removed');
58
- };
59
- });
60
- }
61
- //# sourceMappingURL=register-group-session-passive.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register-group-session-passive.js","sourceRoot":"","sources":["../../src/init/register-group-session-passive.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,kBAAkB,EAAgB,MAAM,eAAe,CAAC;AACvI,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAC9E,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAAE,6BAA6B,EAAE,MAAM,qCAAqC,CAAC;AACpF,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAC3F,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,SAAS,gBAAgB,CAAC,OAAgB;IACxC,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IACnD,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;IACpD,OAAO,QAAQ,KAAK,EAAE,IAAI,WAAW,KAAK,EAAE,IAAI,QAAQ,KAAK,WAAW,CAAC;AAC3E,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,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ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register-im-segment-filter.d.ts","sourceRoot":"","sources":["../../src/init/register-im-segment-filter.ts"],"names":[],"mappings":"AAOA,wBAAgB,uBAAuB,IAAI,IAAI,CAiB9C"}
@@ -1,23 +0,0 @@
1
- /**
2
- * AI 出站 IM 可见性过滤 — 经 dispatcher.addOutboundPolish 挂到 before.sendMessage。
3
- * thinking / tool_call 等 AI-only 段写入 agent_messages,但不过网到用户 IM。
4
- */
5
- import { getOutboundReplyStore, getPlugin } from '@zhin.js/core';
6
- import { filterImDeliveryContent } from '../segment/filter-im-delivery.js';
7
- export function registerImSegmentFilter() {
8
- const plugin = getPlugin();
9
- const dispatcher = plugin.root.inject('dispatcher');
10
- if (!dispatcher?.extensions?.addOutboundPolish)
11
- return;
12
- const dispose = dispatcher.extensions.addOutboundPolish((ctx) => {
13
- const store = getOutboundReplyStore();
14
- const shouldFilter = ctx.source === 'ai'
15
- || ctx.source === 'proactive'
16
- || store?.trigger === 'proactive';
17
- if (!shouldFilter)
18
- return;
19
- return filterImDeliveryContent(ctx.content);
20
- });
21
- plugin.onDispose(dispose);
22
- }
23
- //# sourceMappingURL=register-im-segment-filter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register-im-segment-filter.js","sourceRoot":"","sources":["../../src/init/register-im-segment-filter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAiC,MAAM,eAAe,CAAC;AAChG,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAE3E,MAAM,UAAU,uBAAuB;IACrC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAErC,CAAC;IAEd,IAAI,CAAC,UAAU,EAAE,UAAU,EAAE,iBAAiB;QAAE,OAAO;IAEvD,MAAM,OAAO,GAAG,UAAU,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,GAAG,EAAE,EAAE;QAC9D,MAAM,KAAK,GAAG,qBAAqB,EAAE,CAAC;QACtC,MAAM,YAAY,GAAG,GAAG,CAAC,MAAM,KAAK,IAAI;eACnC,GAAG,CAAC,MAAM,KAAK,WAAW;eAC1B,KAAK,EAAE,OAAO,KAAK,WAAW,CAAC;QACpC,IAAI,CAAC,YAAY;YAAE,OAAO;QAC1B,OAAO,uBAAuB,CAAC,GAAG,CAAC,OAAgB,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AAC5B,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare function registerInitWizardGuardrail(): void;
2
- //# sourceMappingURL=register-init-wizard-guardrail.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register-init-wizard-guardrail.d.ts","sourceRoot":"","sources":["../../src/init/register-init-wizard-guardrail.ts"],"names":[],"mappings":"AAUA,wBAAgB,2BAA2B,IAAI,IAAI,CAiClD"}
@@ -1,41 +0,0 @@
1
- /**
2
- * Init 向导 guardrail — 所有 bot 入站时 stash observation(不依赖 AI 触发)。
3
- *
4
- * 收集阶段:各 bot 写 init_observations;仅 Planner 回复下一步 prompt。
5
- * 提交阶段仍由 /collab inited 命令一次性创建 Cell。
6
- */
7
- import { getPlugin } from '@zhin.js/core';
8
- import { formatCompact } from '@zhin.js/logger';
9
- import { handleInitWizardInboundGate } from '../collaboration/init-observe-hook.js';
10
- export function registerInitWizardGuardrail() {
11
- const plugin = getPlugin();
12
- const { root, logger } = plugin;
13
- plugin.useContext('dispatcher', (dispatcher) => {
14
- if (!dispatcher?.addGuardrail)
15
- return;
16
- const dispose = dispatcher.addGuardrail(async (message, next) => {
17
- const scope = message.$channel?.type;
18
- if (scope !== 'group' && scope !== 'channel') {
19
- await next();
20
- return;
21
- }
22
- try {
23
- const endpointKey = String(message.$endpoint ?? '');
24
- const gate = await handleInitWizardInboundGate(message, endpointKey, root);
25
- if (gate.action === 'block') {
26
- if (gate.replied) {
27
- logger.info(formatCompact({ op: 'init_wizard_prompt', endpoint: endpointKey }));
28
- }
29
- return;
30
- }
31
- }
32
- catch (err) {
33
- logger.debug(formatCompact({ op: 'init_wizard_error', error: err instanceof Error ? err.message : String(err) }));
34
- }
35
- await next();
36
- });
37
- logger.debug('Init wizard guardrail enabled');
38
- return dispose;
39
- });
40
- }
41
- //# sourceMappingURL=register-init-wizard-guardrail.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register-init-wizard-guardrail.js","sourceRoot":"","sources":["../../src/init/register-init-wizard-guardrail.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,SAAS,EAAgB,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,2BAA2B,EAAE,MAAM,uCAAuC,CAAC;AAEpF,MAAM,UAAU,2BAA2B;IACzC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAEhC,MAAM,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,EAAE;QAC7C,IAAI,CAAC,UAAU,EAAE,YAAY;YAAE,OAAO;QAEtC,MAAM,OAAO,GAAG,UAAU,CAAC,YAAY,CAAC,KAAK,EAAE,OAAgB,EAAE,IAAI,EAAE,EAAE;YACvE,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC;YACrC,IAAI,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBAC7C,MAAM,IAAI,EAAE,CAAC;gBACb,OAAO;YACT,CAAC;YAED,IAAI,CAAC;gBACH,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;gBACpD,MAAM,IAAI,GAAG,MAAM,2BAA2B,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;gBAC3E,IAAI,IAAI,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC;oBAC5B,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;wBACjB,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,EAAE,EAAE,oBAAoB,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC;oBAClF,CAAC;oBACD,OAAO;gBACT,CAAC;YACH,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,EAAE,EAAE,mBAAmB,EAAE,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;YACpH,CAAC;YAED,MAAM,IAAI,EAAE,CAAC;QACf,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;QAC9C,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { AIServiceRefs } from './shared-refs.js';
2
- export declare function registerIntrospectionCommands(_refs: AIServiceRefs): void;
3
- //# sourceMappingURL=register-introspection-commands.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register-introspection-commands.d.ts","sourceRoot":"","sources":["../../src/init/register-introspection-commands.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAkEtD,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CA0FxE"}
@@ -1,107 +0,0 @@
1
- /**
2
- * IM 内省指令:/cmd、/bindings、/tools、/mcp(/endpoints 已迁入 @zhin.js/core)
3
- */
4
- import { getPlugin, MANAGEMENT_OPERATOR_PERMIT, MessageCommand, } from '@zhin.js/core';
5
- import { commandRowsFromService, formatAgentsList, formatCommandsList, formatMcpServersList, formatToolsList, introspectionHelpFooter, } from './introspection-commands-format.js';
6
- function registerIntrospectionCommand(commandService, pluginName, disposers, pattern, desc, handler) {
7
- const cmd = new MessageCommand(pattern)
8
- .desc(desc)
9
- .permit(MANAGEMENT_OPERATOR_PERMIT)
10
- .action(async (message) => handler(message));
11
- commandService.add(cmd, pluginName);
12
- disposers.push(() => commandService.remove(cmd));
13
- }
14
- async function visibleCommandItems(commandService, message, plugin) {
15
- // classic 轨:permission feature 经 plugin.inject 取(与 MessageCommand 旧行为一致,
16
- // fail-closed);runtime 轨的 PermissionHost 不流经这里。
17
- const auth = plugin.contextIsReady('permission')
18
- ? plugin.inject('permission')
19
- : null;
20
- const out = [];
21
- for (const cmd of commandService.items) {
22
- const permits = cmd.requiredPermits;
23
- if (!permits.length) {
24
- out.push(cmd);
25
- continue;
26
- }
27
- if (!auth)
28
- continue;
29
- let allowed = true;
30
- for (const permit of permits) {
31
- if (!(await auth.check(permit, message))) {
32
- allowed = false;
33
- break;
34
- }
35
- }
36
- if (allowed)
37
- out.push(cmd);
38
- }
39
- return out;
40
- }
41
- function collectMcpRows(orchestrator) {
42
- if (!orchestrator)
43
- return [];
44
- return orchestrator.mcps.getAll().map((entry) => ({
45
- name: entry.name,
46
- connected: orchestrator.mcps.isConnected(entry.name),
47
- toolCount: orchestrator.mcps.getToolsFromServer(entry.name).length,
48
- }));
49
- }
50
- export function registerIntrospectionCommands(_refs) {
51
- const plugin = getPlugin();
52
- const { useContext, root, logger } = plugin;
53
- useContext('command', (commandService) => {
54
- if (!commandService)
55
- return;
56
- const disposers = [];
57
- const listCommands = async (message) => {
58
- const rows = commandRowsFromService(await visibleCommandItems(commandService, message, root));
59
- return formatCommandsList(rows) + introspectionHelpFooter();
60
- };
61
- registerIntrospectionCommand(commandService, root.name, disposers, '/cmd', '列出已注册的 IM 命令', listCommands);
62
- registerIntrospectionCommand(commandService, root.name, disposers, '/bindings', '列出 ai.agents 绑定(provider / model / mcp)', () => {
63
- const ai = root.inject('ai');
64
- if (!ai?.isReady?.())
65
- return '❌ AI 未就绪';
66
- const registry = ai.getBindingRegistry();
67
- const agents = registry.listAgentNames().map((name) => {
68
- const b = registry.getBinding(name);
69
- return {
70
- name,
71
- provider: b?.providerAlias ?? '-',
72
- model: b?.model ?? '-',
73
- mcpServers: b?.mcpServers ?? [],
74
- hasAgentFile: registry.hasAgentFile(name),
75
- };
76
- });
77
- return formatAgentsList(agents);
78
- });
79
- registerIntrospectionCommand(commandService, root.name, disposers, '/tools', '列出 ToolFeature 已注册工具', () => {
80
- const toolService = root.inject('tool');
81
- if (!toolService)
82
- return '🛠 ToolFeature 不可用';
83
- const tools = toolService.getAll().map((t) => ({
84
- name: t.name,
85
- source: t.source,
86
- description: t.description ?? '',
87
- }));
88
- return formatToolsList(tools);
89
- });
90
- registerIntrospectionCommand(commandService, root.name, disposers, '/mcp', '列出已注册的 MCP Server 及连接状态', () => {
91
- const orchestrator = root.inject('agent');
92
- const configServers = root.inject('config')
93
- ?.getPrimary?.()?.ai?.mcpServers?.map((s) => s.name) ?? [];
94
- const rows = collectMcpRows(orchestrator);
95
- if (rows.length === 0 && configServers.length > 0) {
96
- return formatMcpServersList(configServers.map((name) => ({ name, connected: false, toolCount: 0 }))) + '\n\n(配置已加载,Orchestrator 尚未注册 — 等待 AI 初始化)';
97
- }
98
- return formatMcpServersList(rows);
99
- });
100
- logger.debug(`Registered introspection commands (${disposers.length} patterns)`);
101
- return () => {
102
- for (const d of disposers)
103
- d();
104
- };
105
- });
106
- }
107
- //# sourceMappingURL=register-introspection-commands.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register-introspection-commands.js","sourceRoot":"","sources":["../../src/init/register-introspection-commands.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EACL,SAAS,EACT,0BAA0B,EAC1B,cAAc,GAGf,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,sBAAs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ai_health).
3
- *
4
- * Chat 命令(/models /tree /reset…)已迁到 Plugin Runtime:
5
- * `handleRuntimeManagementCommand`(Agent Host)。本文件不再注册 MessageCommand。
6
- */
7
- import './types.js';
8
- import type { AIServiceRefs } from './shared-refs.js';
9
- export declare function registerManagementTools(refs: AIServiceRefs): void;
10
- //# sourceMappingURL=register-management-tools.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register-management-tools.d.ts","sourceRoot":"","sources":["../../src/init/register-management-tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI,CAmCjE"}
@@ -1,42 +0,0 @@
1
- /**
2
- * Register AI management tools (ai_models / ai_health).
3
- *
4
- * Chat 命令(/models /tree /reset…)已迁到 Plugin Runtime:
5
- * `handleRuntimeManagementCommand`(Agent Host)。本文件不再注册 MessageCommand。
6
- */
7
- import './types.js';
8
- import { getPlugin, ZhinTool } from '@zhin.js/core';
9
- export function registerManagementTools(refs) {
10
- void refs;
11
- const plugin = getPlugin();
12
- const { useContext, root, logger } = plugin;
13
- useContext('ai', 'tool', (ai, toolService) => {
14
- if (!ai || !toolService)
15
- return;
16
- const listModelsTool = new ZhinTool('ai_models')
17
- .desc('列出所有可用的 AI 模型')
18
- .keyword('模型', '可用模型', 'ai模型', 'model', 'models')
19
- .tag('ai', 'management')
20
- .permit('role(trusted)')
21
- .execute(async () => {
22
- const models = await ai.listModels();
23
- return { providers: models.map(({ provider, models: ml }) => ({ name: provider, models: ml.slice(0, 10), total: ml.length })) };
24
- });
25
- const healthCheckTool = new ZhinTool('ai_health')
26
- .desc('检查 AI 服务的健康状态')
27
- .keyword('健康', '状态', '检查', 'health', 'status')
28
- .tag('ai', 'management')
29
- .permit('role(trusted)')
30
- .execute(async () => {
31
- const h = await ai.healthCheck();
32
- return { providers: Object.entries(h).map(([n, ok]) => ({ name: n, healthy: ok })) };
33
- });
34
- const tools = [listModelsTool, healthCheckTool];
35
- const disposers = [];
36
- for (const tool of tools)
37
- disposers.push(toolService.addTool(tool, root.name));
38
- logger.debug(`Registered ${tools.length} AI management tools`);
39
- return () => disposers.forEach((d) => d());
40
- });
41
- }
42
- //# sourceMappingURL=register-management-tools.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register-management-tools.js","sourceRoot":"","sources":["../../src/init/register-management-tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,YAAY,CAAC;AACpB,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGpD,MAAM,UAAU,uBAAuB,CAAC,IAAmB;IACzD,KAAK,IAAI,CAAC;IACV,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAE5C,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,WAAW,EAAE,EAAE;QAC3C,IAAI,CAAC,EAAE,IAAI,CAAC,WAAW;YAAE,OAAO;QAEhC,MAAM,cAAc,GAAG,IAAI,QAAQ,CAAC,WAAW,CAAC;aAC7C,IAAI,CAAC,eAAe,CAAC;aACrB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC;aAChD,GAAG,CAAC,IAAI,EAAE,YAAY,CAAC;aACvB,MAAM,CAAC,eAAe,CAAC;aACvB,OAAO,CAAC,KAAK,IAAI,EAAE;YAClB,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,UAAU,EAAE,CAAC;YACrC,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE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declare function registerMcpFromConfig(): void;
2
- //# sourceMappingURL=register-mcp-from-config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register-mcp-from-config.d.ts","sourceRoot":"","sources":["../../src/init/register-mcp-from-config.ts"],"names":[],"mappings":"AAoDA,wBAAgB,qBAAqB,IAAI,IAAI,CAqC5C"}
@@ -1,87 +0,0 @@
1
- /**
2
- * Register MCP server declarations from zhin.config ai.mcpServers into MCPFeature (ADR 0042).
3
- * Orchestrator loading is deferred to Capability Ingress ensureForTurn.
4
- */
5
- import { getPlugin } from '@zhin.js/core';
6
- import { formatCompact } from '@zhin.js/logger';
7
- import { resolveConfigEnvString } from '../utils/config-env.js';
8
- function resolveHeaders(headers) {
9
- if (!headers)
10
- return undefined;
11
- const out = {};
12
- for (const [k, v] of Object.entries(headers)) {
13
- out[k] = resolveConfigEnvString(String(v)) ?? String(v);
14
- }
15
- return out;
16
- }
17
- function resolveEnvRecord(env) {
18
- if (!env)
19
- return undefined;
20
- const out = {};
21
- for (const [k, v] of Object.entries(env)) {
22
- out[k] = resolveConfigEnvString(String(v)) ?? String(v);
23
- }
24
- return out;
25
- }
26
- function validateMcpServerEntry(raw) {
27
- if (!raw || typeof raw.name !== 'string' || !raw.name.trim())
28
- return null;
29
- const transport = raw.transport;
30
- if (transport !== 'stdio' && transport !== 'streamable-http' && transport !== 'sse')
31
- return null;
32
- const url = resolveConfigEnvString(raw.url);
33
- const command = resolveConfigEnvString(raw.command);
34
- if (transport === 'stdio') {
35
- if (!command?.trim())
36
- return null;
37
- }
38
- else if (!url?.trim()) {
39
- return null;
40
- }
41
- return {
42
- name: raw.name.trim(),
43
- transport,
44
- url,
45
- command,
46
- args: raw.args?.map(a => resolveConfigEnvString(String(a)) ?? String(a)),
47
- env: resolveEnvRecord(raw.env),
48
- headers: resolveHeaders(raw.headers),
49
- };
50
- }
51
- export function registerMcpFromConfig() {
52
- const plugin = getPlugin();
53
- const { useContext, root, logger } = plugin;
54
- useContext('ai', (ai) => {
55
- if (!ai?.isReady?.())
56
- return;
57
- const mcpFeature = root.inject('mcpFeature');
58
- if (!mcpFeature) {
59
- logger.warn('MCP feature not available');
60
- return;
61
- }
62
- const configService = root.inject('config');
63
- const appConfig = configService?.getPrimary() || {};
64
- const servers = appConfig.ai?.mcpServers;
65
- if (!servers?.length)
66
- return;
67
- let registered = 0;
68
- for (const raw of servers) {
69
- const entry = validateMcpServerEntry(raw);
70
- if (!entry) {
71
- logger.warn(`Invalid MCP server config: ${JSON.stringify(raw)}`);
72
- continue;
73
- }
74
- if (mcpFeature.get(entry.name)) {
75
- logger.warn(`Duplicate MCP server: ${entry.name}`);
76
- continue;
77
- }
78
- mcpFeature.add(entry, 'config');
79
- registered++;
80
- }
81
- if (registered > 0) {
82
- root.inject('capabilityIngress')?.invalidate();
83
- logger.debug(formatCompact({ op: 'mcp_registered', count: registered }));
84
- }
85
- });
86
- }
87
- //# sourceMappingURL=register-mcp-from-config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register-mcp-from-config.js","sourceRoot":"","sources":["../../src/init/register-mcp-from-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAIhE,SAAS,cAAc,CAAC,OAA2C;IACjE,IAAI,CAAC,OAAO;QAAE,OAAO,SAAS,CAAC;IAC/B,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC7C,GAAG,CAAC,CAAC,CAAC,GAAG,sBAAsB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC;IAC1D,CAAC;IACD,OAAO,GAAG,CAAC;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G,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC/B,MAAM,CAAC,IAAI,CAAC,yBAAyB,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;gBACnD,SAAS;YACX,CAAC;YACD,UAAU,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;YAChC,UAAU,EAAE,CAAC;QACf,CAAC;QACD,IAAI,UAAU,GAAG,CAAC,EAAE,CAAC;YACnB,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE,UAAU,EAAE,CAAC;YAC/C,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,EAAE,EAAE,gBAAgB,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;QAC3E,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare function registerOrchestrator(): void;
2
- //# sourceMappingURL=register-orchestrator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register-orchestrator.d.ts","sourceRoot":"","sources":["../../src/init/register-orchestrator.ts"],"names":[],"mappings":"AAMA,wBAAgB,oBAAoB,IAAI,IAAI,CAQ3C"}
@@ -1,15 +0,0 @@
1
- /**
2
- * Register AgentOrchestrator as provide('agent').
3
- */
4
- import { getPlugin, defineContext } from '@zhin.js/core';
5
- import { AgentOrchestrator } from '../orchestrator/index.js';
6
- export function registerOrchestrator() {
7
- const plugin = getPlugin();
8
- plugin.provide(defineContext({
9
- name: 'agent',
10
- description: 'AI resource orchestrator',
11
- value: new AgentOrchestrator(),
12
- dispose: (orchestrator) => orchestrator.dispose(),
13
- }));
14
- }
15
- //# sourceMappingURL=register-orchestrator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register-orchestrator.js","sourceRoot":"","sources":["../../src/init/register-orchestrator.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,MAAM,UAAU,oBAAoB;IAClC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC;QAC3B,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,0BAA0B;QACvC,KAAK,EAAE,IAAI,iBAAiB,EAAE;QAC9B,OAAO,EAAE,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE;KAClD,CAAC,CAAC,CAAC;AACN,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare function registerToolService(): void;
2
- //# sourceMappingURL=register-tool-service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register-tool-service.d.ts","sourceRoot":"","sources":["../../src/init/register-tool-service.ts"],"names":[],"mappings":"AAKA,wBAAgB,mBAAmB,IAAI,IAAI,CAG1C"}
@@ -1,9 +0,0 @@
1
- /**
2
- * Register ToolFeature into the plugin system.
3
- */
4
- import { getPlugin, ToolFeature } from '@zhin.js/core';
5
- export function registerToolService() {
6
- const plugin = getPlugin();
7
- plugin.provide(new ToolFeature());
8
- }
9
- //# sourceMappingURL=register-tool-service.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register-tool-service.js","sourceRoot":"","sources":["../../src/init/register-tool-service.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEvD,MAAM,UAAU,mBAAmB;IACjC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,CAAC,OAAO,CAAC,IAAI,WAAW,EAAE,CAAC,CAAC;AACpC,CAAC"}