@namzu/sdk 27.0.0 → 28.0.0

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 (1439) hide show
  1. package/CHANGELOG.md +1714 -0
  2. package/README.md +45 -42
  3. package/dist/advisory/executor.d.ts.map +1 -1
  4. package/dist/advisory/executor.js +14 -12
  5. package/dist/advisory/executor.js.map +1 -1
  6. package/dist/advisory/registry.d.ts +2 -2
  7. package/dist/advisory/registry.d.ts.map +1 -1
  8. package/dist/advisory/registry.js +2 -2
  9. package/dist/advisory/registry.js.map +1 -1
  10. package/dist/agents/AbstractAgent.d.ts +44 -2
  11. package/dist/agents/AbstractAgent.d.ts.map +1 -1
  12. package/dist/agents/AbstractAgent.js +62 -13
  13. package/dist/agents/AbstractAgent.js.map +1 -1
  14. package/dist/agents/PipelineAgent.d.ts +29 -1
  15. package/dist/agents/PipelineAgent.d.ts.map +1 -1
  16. package/dist/agents/PipelineAgent.js +33 -4
  17. package/dist/agents/PipelineAgent.js.map +1 -1
  18. package/dist/agents/ReactiveAgent.d.ts +2 -1
  19. package/dist/agents/ReactiveAgent.d.ts.map +1 -1
  20. package/dist/agents/ReactiveAgent.js +15 -5
  21. package/dist/agents/ReactiveAgent.js.map +1 -1
  22. package/dist/agents/RouterAgent.d.ts +2 -1
  23. package/dist/agents/RouterAgent.d.ts.map +1 -1
  24. package/dist/agents/RouterAgent.js +21 -13
  25. package/dist/agents/RouterAgent.js.map +1 -1
  26. package/dist/agents/SupervisorAgent.d.ts +3 -2
  27. package/dist/agents/SupervisorAgent.d.ts.map +1 -1
  28. package/dist/agents/SupervisorAgent.js +29 -14
  29. package/dist/agents/SupervisorAgent.js.map +1 -1
  30. package/dist/agents/handle.d.ts +85 -0
  31. package/dist/agents/handle.d.ts.map +1 -0
  32. package/dist/agents/handle.js +79 -0
  33. package/dist/agents/handle.js.map +1 -0
  34. package/dist/agents/runAgent.d.ts +10 -5
  35. package/dist/agents/runAgent.d.ts.map +1 -1
  36. package/dist/agents/runAgent.js +3 -2
  37. package/dist/agents/runAgent.js.map +1 -1
  38. package/dist/{verification → authorization}/gate.d.ts +4 -4
  39. package/dist/authorization/gate.d.ts.map +1 -0
  40. package/dist/{verification → authorization}/gate.js +31 -24
  41. package/dist/authorization/gate.js.map +1 -0
  42. package/dist/authorization/index.d.ts +6 -0
  43. package/dist/authorization/index.d.ts.map +1 -0
  44. package/dist/authorization/index.js +14 -0
  45. package/dist/authorization/index.js.map +1 -0
  46. package/dist/authorization/permission-presets.d.ts +119 -0
  47. package/dist/authorization/permission-presets.d.ts.map +1 -0
  48. package/dist/authorization/permission-presets.js +137 -0
  49. package/dist/authorization/permission-presets.js.map +1 -0
  50. package/dist/{verification → authorization}/presets.d.ts +3 -3
  51. package/dist/authorization/presets.d.ts.map +1 -0
  52. package/dist/{verification → authorization}/presets.js +12 -0
  53. package/dist/authorization/presets.js.map +1 -0
  54. package/dist/authorization/rules.d.ts +4 -0
  55. package/dist/authorization/rules.d.ts.map +1 -0
  56. package/dist/{verification → authorization}/rules.js +14 -1
  57. package/dist/authorization/rules.js.map +1 -0
  58. package/dist/bridge/a2a/client.d.ts +107 -0
  59. package/dist/bridge/a2a/client.d.ts.map +1 -0
  60. package/dist/bridge/a2a/client.js +275 -0
  61. package/dist/bridge/a2a/client.js.map +1 -0
  62. package/dist/bridge/a2a/mapper.d.ts.map +1 -1
  63. package/dist/bridge/a2a/mapper.js +16 -0
  64. package/dist/bridge/a2a/mapper.js.map +1 -1
  65. package/dist/bridge/acp/filesystem.d.ts +33 -0
  66. package/dist/bridge/acp/filesystem.d.ts.map +1 -0
  67. package/dist/bridge/acp/filesystem.js +30 -0
  68. package/dist/bridge/acp/filesystem.js.map +1 -0
  69. package/dist/bridge/acp/index.d.ts +8 -0
  70. package/dist/bridge/acp/index.d.ts.map +1 -0
  71. package/dist/bridge/acp/index.js +5 -0
  72. package/dist/bridge/acp/index.js.map +1 -0
  73. package/dist/bridge/acp/permission.d.ts +51 -0
  74. package/dist/bridge/acp/permission.d.ts.map +1 -0
  75. package/dist/bridge/acp/permission.js +37 -0
  76. package/dist/bridge/acp/permission.js.map +1 -0
  77. package/dist/bridge/acp/server.d.ts +163 -0
  78. package/dist/bridge/acp/server.d.ts.map +1 -0
  79. package/dist/bridge/acp/server.js +312 -0
  80. package/dist/bridge/acp/server.js.map +1 -0
  81. package/dist/bridge/acp/update.d.ts +13 -0
  82. package/dist/bridge/acp/update.d.ts.map +1 -0
  83. package/dist/bridge/acp/update.js +94 -0
  84. package/dist/bridge/acp/update.js.map +1 -0
  85. package/dist/bridge/mcp/connector/adapter.d.ts +2 -0
  86. package/dist/bridge/mcp/connector/adapter.d.ts.map +1 -1
  87. package/dist/bridge/mcp/connector/adapter.js +7 -3
  88. package/dist/bridge/mcp/connector/adapter.js.map +1 -1
  89. package/dist/bridge/sse/mapper.d.ts.map +1 -1
  90. package/dist/bridge/sse/mapper.js +27 -0
  91. package/dist/bridge/sse/mapper.js.map +1 -1
  92. package/dist/bus/breaker.d.ts.map +1 -1
  93. package/dist/bus/breaker.js +15 -10
  94. package/dist/bus/breaker.js.map +1 -1
  95. package/dist/bus/index.d.ts.map +1 -1
  96. package/dist/bus/index.js +10 -8
  97. package/dist/bus/index.js.map +1 -1
  98. package/dist/bus/lock.d.ts.map +1 -1
  99. package/dist/bus/lock.js +36 -19
  100. package/dist/bus/lock.js.map +1 -1
  101. package/dist/bus/ownership.d.ts.map +1 -1
  102. package/dist/bus/ownership.js +17 -9
  103. package/dist/bus/ownership.js.map +1 -1
  104. package/dist/compaction/context-window.d.ts +18 -2
  105. package/dist/compaction/context-window.d.ts.map +1 -1
  106. package/dist/compaction/context-window.js +15 -1
  107. package/dist/compaction/context-window.js.map +1 -1
  108. package/dist/compaction/index.d.ts +3 -0
  109. package/dist/compaction/index.d.ts.map +1 -1
  110. package/dist/compaction/index.js +4 -0
  111. package/dist/compaction/index.js.map +1 -1
  112. package/dist/compaction/manual.d.ts +58 -0
  113. package/dist/compaction/manual.d.ts.map +1 -0
  114. package/dist/compaction/manual.js +104 -0
  115. package/dist/compaction/manual.js.map +1 -0
  116. package/dist/compaction/plan.d.ts +92 -0
  117. package/dist/compaction/plan.d.ts.map +1 -0
  118. package/dist/compaction/plan.js +149 -0
  119. package/dist/compaction/plan.js.map +1 -0
  120. package/dist/compaction/summary.d.ts +23 -0
  121. package/dist/compaction/summary.d.ts.map +1 -0
  122. package/dist/compaction/summary.js +27 -0
  123. package/dist/compaction/summary.js.map +1 -0
  124. package/dist/compaction/verifier.js +2 -2
  125. package/dist/compaction/verifier.js.map +1 -1
  126. package/dist/config/registry.d.ts +104 -0
  127. package/dist/config/registry.d.ts.map +1 -0
  128. package/dist/config/registry.js +105 -0
  129. package/dist/config/registry.js.map +1 -0
  130. package/dist/config/runtime.d.ts +99 -28
  131. package/dist/config/runtime.d.ts.map +1 -1
  132. package/dist/config/runtime.js +27 -0
  133. package/dist/config/runtime.js.map +1 -1
  134. package/dist/connector/BaseConnector.d.ts +1 -1
  135. package/dist/connector/BaseConnector.d.ts.map +1 -1
  136. package/dist/connector/BaseConnector.js +8 -3
  137. package/dist/connector/BaseConnector.js.map +1 -1
  138. package/dist/connector/builtins/http.d.ts +1 -1
  139. package/dist/connector/builtins/http.d.ts.map +1 -1
  140. package/dist/connector/builtins/http.js +11 -2
  141. package/dist/connector/builtins/http.js.map +1 -1
  142. package/dist/connector/builtins/webhook.d.ts +1 -1
  143. package/dist/connector/builtins/webhook.d.ts.map +1 -1
  144. package/dist/connector/builtins/webhook.js +5 -2
  145. package/dist/connector/builtins/webhook.js.map +1 -1
  146. package/dist/connector/index.d.ts +4 -15
  147. package/dist/connector/index.d.ts.map +1 -1
  148. package/dist/connector/index.js +12 -12
  149. package/dist/connector/index.js.map +1 -1
  150. package/dist/connector/mcp/adapter.d.ts +30 -0
  151. package/dist/connector/mcp/adapter.d.ts.map +1 -1
  152. package/dist/connector/mcp/adapter.js +43 -1
  153. package/dist/connector/mcp/adapter.js.map +1 -1
  154. package/dist/connector/mcp/client.d.ts.map +1 -1
  155. package/dist/connector/mcp/client.js +31 -20
  156. package/dist/connector/mcp/client.js.map +1 -1
  157. package/dist/connector/mcp/discovery.d.ts.map +1 -1
  158. package/dist/connector/mcp/discovery.js +31 -20
  159. package/dist/connector/mcp/discovery.js.map +1 -1
  160. package/dist/connector/mcp/http-sse.d.ts +2 -1
  161. package/dist/connector/mcp/http-sse.d.ts.map +1 -1
  162. package/dist/connector/mcp/http-sse.js +9 -6
  163. package/dist/connector/mcp/http-sse.js.map +1 -1
  164. package/dist/connector/mcp/index.d.ts +2 -3
  165. package/dist/connector/mcp/index.d.ts.map +1 -1
  166. package/dist/connector/mcp/index.js +5 -4
  167. package/dist/connector/mcp/index.js.map +1 -1
  168. package/dist/connector/mcp/reconnect.d.ts +123 -0
  169. package/dist/connector/mcp/reconnect.d.ts.map +1 -0
  170. package/dist/connector/mcp/reconnect.js +121 -0
  171. package/dist/connector/mcp/reconnect.js.map +1 -0
  172. package/dist/connector/mcp/server/index.d.ts +28 -0
  173. package/dist/connector/mcp/server/index.d.ts.map +1 -0
  174. package/dist/connector/mcp/server/index.js +27 -0
  175. package/dist/connector/mcp/server/index.js.map +1 -0
  176. package/dist/connector/mcp/{server-stdio.d.ts → server/server-stdio.d.ts} +3 -2
  177. package/dist/connector/mcp/server/server-stdio.d.ts.map +1 -0
  178. package/dist/connector/mcp/{server-stdio.js → server/server-stdio.js} +4 -3
  179. package/dist/connector/mcp/server/server-stdio.js.map +1 -0
  180. package/dist/connector/mcp/{server.d.ts → server/server.d.ts} +5 -4
  181. package/dist/connector/mcp/server/server.d.ts.map +1 -0
  182. package/dist/connector/mcp/{server.js → server/server.js} +14 -9
  183. package/dist/connector/mcp/server/server.js.map +1 -0
  184. package/dist/connector/mcp/stdio.d.ts +2 -1
  185. package/dist/connector/mcp/stdio.d.ts.map +1 -1
  186. package/dist/connector/mcp/stdio.js +15 -7
  187. package/dist/connector/mcp/stdio.js.map +1 -1
  188. package/dist/connector/mcp/streamable-http.d.ts +2 -1
  189. package/dist/connector/mcp/streamable-http.d.ts.map +1 -1
  190. package/dist/connector/mcp/streamable-http.js +5 -4
  191. package/dist/connector/mcp/streamable-http.js.map +1 -1
  192. package/dist/{bridge/tools/connector → connector/tools}/adapter.d.ts +4 -4
  193. package/dist/connector/tools/adapter.d.ts.map +1 -0
  194. package/dist/{bridge/tools/connector → connector/tools}/adapter.js +1 -1
  195. package/dist/connector/tools/adapter.js.map +1 -0
  196. package/dist/{bridge/tools/connector → connector/tools}/definitions.d.ts +2 -2
  197. package/dist/connector/tools/definitions.d.ts.map +1 -0
  198. package/dist/{bridge/tools/connector → connector/tools}/definitions.js +2 -2
  199. package/dist/connector/tools/definitions.js.map +1 -0
  200. package/dist/connector/tools/index.d.ts.map +1 -0
  201. package/dist/connector/tools/index.js.map +1 -0
  202. package/dist/{bridge/tools/connector → connector/tools}/router.d.ts +4 -2
  203. package/dist/connector/tools/router.d.ts.map +1 -0
  204. package/dist/{bridge/tools/connector → connector/tools}/router.js +14 -7
  205. package/dist/connector/tools/router.js.map +1 -0
  206. package/dist/connector/web/guarded-fetch.d.ts +60 -0
  207. package/dist/connector/web/guarded-fetch.d.ts.map +1 -0
  208. package/dist/connector/web/guarded-fetch.js +233 -0
  209. package/dist/connector/web/guarded-fetch.js.map +1 -0
  210. package/dist/connector/web/index.d.ts +5 -0
  211. package/dist/connector/web/index.d.ts.map +1 -0
  212. package/dist/connector/web/index.js +7 -0
  213. package/dist/connector/web/index.js.map +1 -0
  214. package/dist/connector/web/types.d.ts +87 -0
  215. package/dist/connector/web/types.d.ts.map +1 -0
  216. package/dist/connector/web/types.js +25 -0
  217. package/dist/connector/web/types.js.map +1 -0
  218. package/dist/constants/acp/index.d.ts +97 -0
  219. package/dist/constants/acp/index.d.ts.map +1 -0
  220. package/dist/constants/acp/index.js +96 -0
  221. package/dist/constants/acp/index.js.map +1 -0
  222. package/dist/constants/authorization/index.d.ts.map +1 -0
  223. package/dist/constants/authorization/index.js.map +1 -0
  224. package/dist/constants/credential-env-keys.d.ts +36 -0
  225. package/dist/constants/credential-env-keys.d.ts.map +1 -0
  226. package/dist/constants/credential-env-keys.js +62 -0
  227. package/dist/constants/credential-env-keys.js.map +1 -0
  228. package/dist/constants/index.d.ts +3 -1
  229. package/dist/constants/index.d.ts.map +1 -1
  230. package/dist/constants/index.js +3 -1
  231. package/dist/constants/index.js.map +1 -1
  232. package/dist/constants/secret-patterns.d.ts +78 -0
  233. package/dist/constants/secret-patterns.d.ts.map +1 -0
  234. package/dist/constants/secret-patterns.js +99 -0
  235. package/dist/constants/secret-patterns.js.map +1 -0
  236. package/dist/constants/telemetry/index.d.ts +42 -0
  237. package/dist/constants/telemetry/index.d.ts.map +1 -1
  238. package/dist/constants/telemetry/index.js +87 -0
  239. package/dist/constants/telemetry/index.js.map +1 -1
  240. package/dist/contracts/a2a.d.ts +54 -54
  241. package/dist/contracts/api.d.ts +12 -1
  242. package/dist/contracts/api.d.ts.map +1 -1
  243. package/dist/contracts/schemas.d.ts +12 -12
  244. package/dist/deprecated-aliases.d.ts +80 -0
  245. package/dist/deprecated-aliases.d.ts.map +1 -0
  246. package/dist/deprecated-aliases.js +60 -0
  247. package/dist/deprecated-aliases.js.map +1 -0
  248. package/dist/eval/judge.js +2 -2
  249. package/dist/eval/judge.js.map +1 -1
  250. package/dist/execution/base.d.ts +1 -1
  251. package/dist/execution/base.d.ts.map +1 -1
  252. package/dist/execution/base.js +18 -7
  253. package/dist/execution/base.js.map +1 -1
  254. package/dist/execution/code-runtime/types.d.ts +114 -0
  255. package/dist/execution/code-runtime/types.d.ts.map +1 -0
  256. package/dist/execution/code-runtime/types.js +40 -0
  257. package/dist/execution/code-runtime/types.js.map +1 -0
  258. package/dist/execution/code-runtime/worker.d.ts +6 -0
  259. package/dist/execution/code-runtime/worker.d.ts.map +1 -0
  260. package/dist/execution/code-runtime/worker.js +248 -0
  261. package/dist/execution/code-runtime/worker.js.map +1 -0
  262. package/dist/{connector/execution → execution}/factory.d.ts +3 -3
  263. package/dist/execution/factory.d.ts.map +1 -0
  264. package/dist/{connector/execution → execution}/factory.js +1 -1
  265. package/dist/execution/factory.js.map +1 -0
  266. package/dist/{connector/execution → execution}/hybrid.d.ts +5 -3
  267. package/dist/execution/hybrid.d.ts.map +1 -0
  268. package/dist/{connector/execution → execution}/hybrid.js +10 -4
  269. package/dist/execution/hybrid.js.map +1 -0
  270. package/dist/execution/index.d.ts +23 -0
  271. package/dist/execution/index.d.ts.map +1 -1
  272. package/dist/execution/index.js +21 -0
  273. package/dist/execution/index.js.map +1 -1
  274. package/dist/execution/local.d.ts +2 -0
  275. package/dist/execution/local.d.ts.map +1 -1
  276. package/dist/execution/local.js +2 -2
  277. package/dist/execution/local.js.map +1 -1
  278. package/dist/{connector/execution → execution}/remote.d.ts +4 -2
  279. package/dist/execution/remote.d.ts.map +1 -0
  280. package/dist/{connector/execution → execution}/remote.js +12 -5
  281. package/dist/execution/remote.js.map +1 -0
  282. package/dist/index.d.ts +2 -0
  283. package/dist/index.d.ts.map +1 -1
  284. package/dist/index.js +4 -0
  285. package/dist/index.js.map +1 -1
  286. package/dist/invariants/index.d.ts +111 -0
  287. package/dist/invariants/index.d.ts.map +1 -0
  288. package/dist/invariants/index.js +138 -0
  289. package/dist/invariants/index.js.map +1 -0
  290. package/dist/manager/agent/lifecycle.d.ts +29 -7
  291. package/dist/manager/agent/lifecycle.d.ts.map +1 -1
  292. package/dist/manager/agent/lifecycle.js +140 -50
  293. package/dist/manager/agent/lifecycle.js.map +1 -1
  294. package/dist/manager/connector/environment.d.ts +2 -0
  295. package/dist/manager/connector/environment.d.ts.map +1 -1
  296. package/dist/manager/connector/environment.js +20 -9
  297. package/dist/manager/connector/environment.js.map +1 -1
  298. package/dist/manager/connector/lifecycle.d.ts +10 -0
  299. package/dist/manager/connector/lifecycle.d.ts.map +1 -1
  300. package/dist/manager/connector/lifecycle.js +21 -11
  301. package/dist/manager/connector/lifecycle.js.map +1 -1
  302. package/dist/manager/connector/tenant.d.ts +9 -0
  303. package/dist/manager/connector/tenant.d.ts.map +1 -1
  304. package/dist/manager/connector/tenant.js +24 -10
  305. package/dist/manager/connector/tenant.js.map +1 -1
  306. package/dist/manager/index.d.ts +6 -2
  307. package/dist/manager/index.d.ts.map +1 -1
  308. package/dist/manager/index.js +7 -1
  309. package/dist/manager/index.js.map +1 -1
  310. package/dist/manager/project/lifecycle.d.ts +1 -1
  311. package/dist/manager/project/lifecycle.js +1 -1
  312. package/dist/manager/run/emergency.d.ts.map +1 -1
  313. package/dist/manager/run/emergency.js +9 -7
  314. package/dist/manager/run/emergency.js.map +1 -1
  315. package/dist/manager/run/persistence.d.ts +46 -4
  316. package/dist/manager/run/persistence.d.ts.map +1 -1
  317. package/dist/manager/run/persistence.js +102 -7
  318. package/dist/manager/run/persistence.js.map +1 -1
  319. package/dist/manager/topic/lifecycle.d.ts +123 -0
  320. package/dist/manager/topic/lifecycle.d.ts.map +1 -0
  321. package/dist/manager/{thread → topic}/lifecycle.js +79 -61
  322. package/dist/manager/topic/lifecycle.js.map +1 -0
  323. package/dist/manager/topic/objective.d.ts +77 -0
  324. package/dist/manager/topic/objective.d.ts.map +1 -0
  325. package/dist/manager/topic/objective.js +133 -0
  326. package/dist/manager/topic/objective.js.map +1 -0
  327. package/dist/model-router/task-router.d.ts.map +1 -0
  328. package/dist/model-router/task-router.js.map +1 -0
  329. package/dist/persona/assembler.d.ts +1 -1
  330. package/dist/persona/assembler.d.ts.map +1 -1
  331. package/dist/persona/assembler.js +14 -2
  332. package/dist/persona/assembler.js.map +1 -1
  333. package/dist/plugin/lifecycle.d.ts +24 -0
  334. package/dist/plugin/lifecycle.d.ts.map +1 -1
  335. package/dist/plugin/lifecycle.js +112 -20
  336. package/dist/plugin/lifecycle.js.map +1 -1
  337. package/dist/plugin/loader.d.ts +17 -2
  338. package/dist/plugin/loader.d.ts.map +1 -1
  339. package/dist/plugin/loader.js +46 -26
  340. package/dist/plugin/loader.js.map +1 -1
  341. package/dist/probe/index.d.ts +1 -0
  342. package/dist/probe/index.d.ts.map +1 -1
  343. package/dist/probe/registry.d.ts +34 -1
  344. package/dist/probe/registry.d.ts.map +1 -1
  345. package/dist/probe/registry.js +5 -4
  346. package/dist/probe/registry.js.map +1 -1
  347. package/dist/process/kill-tree.d.ts +40 -0
  348. package/dist/process/kill-tree.d.ts.map +1 -0
  349. package/dist/process/kill-tree.js +54 -0
  350. package/dist/process/kill-tree.js.map +1 -0
  351. package/dist/prompt/contributions.d.ts +138 -0
  352. package/dist/prompt/contributions.d.ts.map +1 -0
  353. package/dist/prompt/contributions.js +78 -0
  354. package/dist/prompt/contributions.js.map +1 -0
  355. package/dist/prompt/index.d.ts +3 -0
  356. package/dist/prompt/index.d.ts.map +1 -0
  357. package/dist/prompt/index.js +6 -0
  358. package/dist/prompt/index.js.map +1 -0
  359. package/dist/provider/attribution.d.ts +45 -0
  360. package/dist/provider/attribution.d.ts.map +1 -0
  361. package/dist/provider/attribution.js +23 -0
  362. package/dist/provider/attribution.js.map +1 -0
  363. package/dist/provider/{collect.d.ts → collect-chat-completion.d.ts} +3 -3
  364. package/dist/provider/collect-chat-completion.d.ts.map +1 -0
  365. package/dist/provider/{collect.js → collect-chat-completion.js} +3 -3
  366. package/dist/provider/collect-chat-completion.js.map +1 -0
  367. package/dist/provider/conformance.d.ts +93 -0
  368. package/dist/provider/conformance.d.ts.map +1 -0
  369. package/dist/provider/conformance.js +124 -0
  370. package/dist/provider/conformance.js.map +1 -0
  371. package/dist/provider/errors.d.ts +29 -0
  372. package/dist/provider/errors.d.ts.map +1 -1
  373. package/dist/provider/errors.js +27 -10
  374. package/dist/provider/errors.js.map +1 -1
  375. package/dist/provider/fallback.d.ts +1 -1
  376. package/dist/provider/fallback.d.ts.map +1 -1
  377. package/dist/provider/fallback.js +27 -9
  378. package/dist/provider/fallback.js.map +1 -1
  379. package/dist/provider/idle-timeout.d.ts +47 -0
  380. package/dist/provider/idle-timeout.d.ts.map +1 -0
  381. package/dist/provider/idle-timeout.js +61 -0
  382. package/dist/provider/idle-timeout.js.map +1 -0
  383. package/dist/provider/instrumentation.d.ts +3 -2
  384. package/dist/provider/instrumentation.d.ts.map +1 -1
  385. package/dist/provider/instrumentation.js.map +1 -1
  386. package/dist/provider/retry.d.ts.map +1 -1
  387. package/dist/provider/retry.js +58 -21
  388. package/dist/provider/retry.js.map +1 -1
  389. package/dist/public-runtime.d.ts +79 -15
  390. package/dist/public-runtime.d.ts.map +1 -1
  391. package/dist/public-runtime.js +173 -17
  392. package/dist/public-runtime.js.map +1 -1
  393. package/dist/public-tools.d.ts +8 -1
  394. package/dist/public-tools.d.ts.map +1 -1
  395. package/dist/public-tools.js +29 -1
  396. package/dist/public-tools.js.map +1 -1
  397. package/dist/public-types.d.ts +21 -4
  398. package/dist/public-types.d.ts.map +1 -1
  399. package/dist/rag/rag-tool.d.ts.map +1 -1
  400. package/dist/rag/rag-tool.js +4 -1
  401. package/dist/rag/rag-tool.js.map +1 -1
  402. package/dist/read-model/index.d.ts +5 -0
  403. package/dist/read-model/index.d.ts.map +1 -0
  404. package/dist/read-model/index.js +7 -0
  405. package/dist/read-model/index.js.map +1 -0
  406. package/dist/read-model/registry.d.ts +112 -0
  407. package/dist/read-model/registry.d.ts.map +1 -0
  408. package/dist/read-model/registry.js +105 -0
  409. package/dist/read-model/registry.js.map +1 -0
  410. package/dist/read-model/run-status.d.ts +43 -0
  411. package/dist/read-model/run-status.d.ts.map +1 -0
  412. package/dist/read-model/run-status.js +89 -0
  413. package/dist/read-model/run-status.js.map +1 -0
  414. package/dist/registry/{Registry.d.ts → BaseRegistry.d.ts} +2 -2
  415. package/dist/registry/BaseRegistry.d.ts.map +1 -0
  416. package/dist/registry/{Registry.js → BaseRegistry.js} +2 -2
  417. package/dist/registry/BaseRegistry.js.map +1 -0
  418. package/dist/registry/ManagedRegistry.d.ts +2 -2
  419. package/dist/registry/ManagedRegistry.d.ts.map +1 -1
  420. package/dist/registry/ManagedRegistry.js +26 -9
  421. package/dist/registry/ManagedRegistry.js.map +1 -1
  422. package/dist/registry/command/index-exports.d.ts +3 -0
  423. package/dist/registry/command/index-exports.d.ts.map +1 -0
  424. package/dist/registry/command/index-exports.js +5 -0
  425. package/dist/registry/command/index-exports.js.map +1 -0
  426. package/dist/registry/command/index.d.ts +53 -0
  427. package/dist/registry/command/index.d.ts.map +1 -0
  428. package/dist/registry/command/index.js +87 -0
  429. package/dist/registry/command/index.js.map +1 -0
  430. package/dist/registry/command/kernel-commands.d.ts +32 -0
  431. package/dist/registry/command/kernel-commands.d.ts.map +1 -0
  432. package/dist/registry/command/kernel-commands.js +78 -0
  433. package/dist/registry/command/kernel-commands.js.map +1 -0
  434. package/dist/registry/connector/scoped.d.ts +2 -1
  435. package/dist/registry/connector/scoped.d.ts.map +1 -1
  436. package/dist/registry/connector/scoped.js +6 -5
  437. package/dist/registry/connector/scoped.js.map +1 -1
  438. package/dist/registry/index.d.ts +4 -1
  439. package/dist/registry/index.d.ts.map +1 -1
  440. package/dist/registry/index.js +5 -1
  441. package/dist/registry/index.js.map +1 -1
  442. package/dist/registry/tool/execute.d.ts +1 -0
  443. package/dist/registry/tool/execute.d.ts.map +1 -1
  444. package/dist/registry/tool/execute.js +46 -13
  445. package/dist/registry/tool/execute.js.map +1 -1
  446. package/dist/registry/tool/presentation.d.ts +32 -0
  447. package/dist/registry/tool/presentation.d.ts.map +1 -0
  448. package/dist/registry/tool/presentation.js +92 -0
  449. package/dist/registry/tool/presentation.js.map +1 -0
  450. package/dist/registry/tool/screen.d.ts +33 -0
  451. package/dist/registry/tool/screen.d.ts.map +1 -0
  452. package/dist/registry/tool/screen.js +103 -0
  453. package/dist/registry/tool/screen.js.map +1 -0
  454. package/dist/run/drain.d.ts +13 -3
  455. package/dist/run/drain.d.ts.map +1 -1
  456. package/dist/run/drain.js +10 -0
  457. package/dist/run/drain.js.map +1 -1
  458. package/dist/run/reporter.d.ts.map +1 -1
  459. package/dist/run/reporter.js +203 -149
  460. package/dist/run/reporter.js.map +1 -1
  461. package/dist/run-query/index.d.ts +74 -0
  462. package/dist/run-query/index.d.ts.map +1 -0
  463. package/dist/run-query/index.js +73 -0
  464. package/dist/run-query/index.js.map +1 -0
  465. package/dist/runtime/bidi/session.d.ts.map +1 -1
  466. package/dist/runtime/bidi/session.js +7 -2
  467. package/dist/runtime/bidi/session.js.map +1 -1
  468. package/dist/runtime/decision/fallback.d.ts.map +1 -1
  469. package/dist/runtime/decision/fallback.js +6 -3
  470. package/dist/runtime/decision/fallback.js.map +1 -1
  471. package/dist/runtime/decision/parser.d.ts.map +1 -1
  472. package/dist/runtime/decision/parser.js +10 -9
  473. package/dist/runtime/decision/parser.js.map +1 -1
  474. package/dist/runtime/jobs/registry.d.ts +147 -0
  475. package/dist/runtime/jobs/registry.d.ts.map +1 -0
  476. package/dist/runtime/jobs/registry.js +242 -0
  477. package/dist/runtime/jobs/registry.js.map +1 -0
  478. package/dist/runtime/query/approval-policy.d.ts +22 -0
  479. package/dist/runtime/query/approval-policy.d.ts.map +1 -0
  480. package/dist/runtime/query/approval-policy.js +61 -0
  481. package/dist/runtime/query/approval-policy.js.map +1 -0
  482. package/dist/runtime/query/checkpoint.d.ts +3 -3
  483. package/dist/runtime/query/checkpoint.d.ts.map +1 -1
  484. package/dist/runtime/query/checkpoint.js +2 -2
  485. package/dist/runtime/query/checkpoint.js.map +1 -1
  486. package/dist/runtime/query/context.d.ts +85 -15
  487. package/dist/runtime/query/context.d.ts.map +1 -1
  488. package/dist/runtime/query/context.js +57 -14
  489. package/dist/runtime/query/context.js.map +1 -1
  490. package/dist/runtime/query/events.d.ts +5 -4
  491. package/dist/runtime/query/events.d.ts.map +1 -1
  492. package/dist/runtime/query/events.js +9 -6
  493. package/dist/runtime/query/events.js.map +1 -1
  494. package/dist/runtime/query/executor.d.ts +113 -4
  495. package/dist/runtime/query/executor.d.ts.map +1 -1
  496. package/dist/runtime/query/executor.js +228 -62
  497. package/dist/runtime/query/executor.js.map +1 -1
  498. package/dist/runtime/query/guardrail-presets.d.ts +30 -1
  499. package/dist/runtime/query/guardrail-presets.d.ts.map +1 -1
  500. package/dist/runtime/query/guardrail-presets.js +59 -14
  501. package/dist/runtime/query/guardrail-presets.js.map +1 -1
  502. package/dist/runtime/query/guardrails.d.ts.map +1 -1
  503. package/dist/runtime/query/guardrails.js +16 -12
  504. package/dist/runtime/query/guardrails.js.map +1 -1
  505. package/dist/runtime/query/index.d.ts +140 -16
  506. package/dist/runtime/query/index.d.ts.map +1 -1
  507. package/dist/runtime/query/index.js +379 -76
  508. package/dist/runtime/query/index.js.map +1 -1
  509. package/dist/runtime/query/iteration/index.d.ts +32 -0
  510. package/dist/runtime/query/iteration/index.d.ts.map +1 -1
  511. package/dist/runtime/query/iteration/index.js +256 -88
  512. package/dist/runtime/query/iteration/index.js.map +1 -1
  513. package/dist/runtime/query/iteration/phases/advisory.d.ts.map +1 -1
  514. package/dist/runtime/query/iteration/phases/advisory.js +17 -16
  515. package/dist/runtime/query/iteration/phases/advisory.js.map +1 -1
  516. package/dist/runtime/query/iteration/phases/compaction.d.ts +1 -8
  517. package/dist/runtime/query/iteration/phases/compaction.d.ts.map +1 -1
  518. package/dist/runtime/query/iteration/phases/compaction.js +202 -178
  519. package/dist/runtime/query/iteration/phases/compaction.js.map +1 -1
  520. package/dist/runtime/query/iteration/phases/context.d.ts +52 -6
  521. package/dist/runtime/query/iteration/phases/context.d.ts.map +1 -1
  522. package/dist/runtime/query/iteration/phases/context.js +26 -17
  523. package/dist/runtime/query/iteration/phases/context.js.map +1 -1
  524. package/dist/runtime/query/iteration/phases/tool-review.d.ts +2 -2
  525. package/dist/runtime/query/iteration/phases/tool-review.d.ts.map +1 -1
  526. package/dist/runtime/query/iteration/phases/tool-review.js +27 -7
  527. package/dist/runtime/query/iteration/phases/tool-review.js.map +1 -1
  528. package/dist/runtime/query/iteration/phases/working-memory.d.ts.map +1 -1
  529. package/dist/runtime/query/iteration/phases/working-memory.js +3 -2
  530. package/dist/runtime/query/iteration/phases/working-memory.js.map +1 -1
  531. package/dist/runtime/query/iteration/stream-turn.js +14 -14
  532. package/dist/runtime/query/iteration/stream-turn.js.map +1 -1
  533. package/dist/runtime/query/{context-cache.d.ts → prompt-cache.d.ts} +6 -4
  534. package/dist/runtime/query/prompt-cache.d.ts.map +1 -0
  535. package/dist/runtime/query/{context-cache.js → prompt-cache.js} +20 -2
  536. package/dist/runtime/query/prompt-cache.js.map +1 -0
  537. package/dist/runtime/query/prompt.d.ts +50 -0
  538. package/dist/runtime/query/prompt.d.ts.map +1 -1
  539. package/dist/runtime/query/prompt.js +83 -4
  540. package/dist/runtime/query/prompt.js.map +1 -1
  541. package/dist/runtime/query/repeat-call.d.ts +42 -0
  542. package/dist/runtime/query/repeat-call.d.ts.map +1 -0
  543. package/dist/runtime/query/repeat-call.js +107 -0
  544. package/dist/runtime/query/repeat-call.js.map +1 -0
  545. package/dist/runtime/query/replay/mutate.js +8 -1
  546. package/dist/runtime/query/replay/mutate.js.map +1 -1
  547. package/dist/runtime/query/result.d.ts +7 -0
  548. package/dist/runtime/query/result.d.ts.map +1 -1
  549. package/dist/runtime/query/result.js +38 -10
  550. package/dist/runtime/query/result.js.map +1 -1
  551. package/dist/runtime/query/resume-pending.d.ts.map +1 -1
  552. package/dist/runtime/query/resume-pending.js +19 -17
  553. package/dist/runtime/query/resume-pending.js.map +1 -1
  554. package/dist/runtime/query/resume-run.d.ts +2 -2
  555. package/dist/runtime/query/resume-run.d.ts.map +1 -1
  556. package/dist/runtime/query/run-state.d.ts +3 -3
  557. package/dist/runtime/query/run-state.d.ts.map +1 -1
  558. package/dist/runtime/query/run-state.js +2 -2
  559. package/dist/runtime/query/run-state.js.map +1 -1
  560. package/dist/runtime/query/tool-grants.d.ts +7 -0
  561. package/dist/runtime/query/tool-grants.d.ts.map +1 -1
  562. package/dist/runtime/query/tool-grants.js +1 -1
  563. package/dist/runtime/query/tool-grants.js.map +1 -1
  564. package/dist/runtime/query/tool-output-budget.js +34 -3
  565. package/dist/runtime/query/tool-output-budget.js.map +1 -1
  566. package/dist/runtime/query/tool-pause.d.ts.map +1 -1
  567. package/dist/runtime/query/tool-pause.js +2 -1
  568. package/dist/runtime/query/tool-pause.js.map +1 -1
  569. package/dist/runtime/query/tooling.d.ts +10 -2
  570. package/dist/runtime/query/tooling.d.ts.map +1 -1
  571. package/dist/runtime/query/tooling.js +3 -0
  572. package/dist/runtime/query/tooling.js.map +1 -1
  573. package/dist/sandbox/provider/local.d.ts +10 -0
  574. package/dist/sandbox/provider/local.d.ts.map +1 -1
  575. package/dist/sandbox/provider/local.js +77 -23
  576. package/dist/sandbox/provider/local.js.map +1 -1
  577. package/dist/sandbox/terminal.d.ts +130 -0
  578. package/dist/sandbox/terminal.d.ts.map +1 -0
  579. package/dist/sandbox/terminal.js +119 -0
  580. package/dist/sandbox/terminal.js.map +1 -0
  581. package/dist/{gateway → scheduler}/completion-inbox.d.ts +12 -5
  582. package/dist/scheduler/completion-inbox.d.ts.map +1 -0
  583. package/dist/{gateway → scheduler}/completion-inbox.js +19 -7
  584. package/dist/scheduler/completion-inbox.js.map +1 -0
  585. package/dist/scheduler/delegating.d.ts +90 -0
  586. package/dist/scheduler/delegating.d.ts.map +1 -0
  587. package/dist/scheduler/delegating.js +230 -0
  588. package/dist/scheduler/delegating.js.map +1 -0
  589. package/dist/{gateway → scheduler}/local.d.ts +10 -2
  590. package/dist/scheduler/local.d.ts.map +1 -0
  591. package/dist/{gateway → scheduler}/local.js +20 -11
  592. package/dist/scheduler/local.js.map +1 -0
  593. package/dist/session/actor-scope.d.ts +52 -0
  594. package/dist/session/actor-scope.d.ts.map +1 -0
  595. package/dist/session/actor-scope.js +112 -0
  596. package/dist/session/actor-scope.js.map +1 -0
  597. package/dist/session/errors.d.ts +31 -8
  598. package/dist/session/errors.d.ts.map +1 -1
  599. package/dist/session/errors.js +21 -1
  600. package/dist/session/errors.js.map +1 -1
  601. package/dist/session/handoff/assignment.d.ts +5 -5
  602. package/dist/session/handoff/assignment.d.ts.map +1 -1
  603. package/dist/session/handoff/broadcast.d.ts +2 -2
  604. package/dist/session/handoff/broadcast.d.ts.map +1 -1
  605. package/dist/session/handoff/broadcast.js +7 -7
  606. package/dist/session/handoff/broadcast.js.map +1 -1
  607. package/dist/session/handoff/single.d.ts +4 -4
  608. package/dist/session/handoff/single.d.ts.map +1 -1
  609. package/dist/session/handoff/single.js +4 -4
  610. package/dist/session/handoff/single.js.map +1 -1
  611. package/dist/session/migration/filesystem.d.ts +28 -0
  612. package/dist/session/migration/filesystem.d.ts.map +1 -1
  613. package/dist/session/migration/filesystem.js +44 -2
  614. package/dist/session/migration/filesystem.js.map +1 -1
  615. package/dist/session/migration/id-prefix.d.ts +50 -19
  616. package/dist/session/migration/id-prefix.d.ts.map +1 -1
  617. package/dist/session/migration/id-prefix.js +54 -22
  618. package/dist/session/migration/id-prefix.js.map +1 -1
  619. package/dist/session/migration/index.d.ts +6 -2
  620. package/dist/session/migration/index.d.ts.map +1 -1
  621. package/dist/session/migration/index.js +6 -2
  622. package/dist/session/migration/index.js.map +1 -1
  623. package/dist/session/migration/marker.d.ts.map +1 -1
  624. package/dist/session/migration/marker.js +21 -4
  625. package/dist/session/migration/marker.js.map +1 -1
  626. package/dist/session/retention/archive.d.ts.map +1 -1
  627. package/dist/session/retention/archive.js +25 -11
  628. package/dist/session/retention/archive.js.map +1 -1
  629. package/dist/session/workspace/git-worktree.d.ts.map +1 -1
  630. package/dist/session/workspace/git-worktree.js +17 -8
  631. package/dist/session/workspace/git-worktree.js.map +1 -1
  632. package/dist/skills/loader.d.ts +4 -2
  633. package/dist/skills/loader.d.ts.map +1 -1
  634. package/dist/skills/loader.js +36 -9
  635. package/dist/skills/loader.js.map +1 -1
  636. package/dist/skills/registry.d.ts +59 -1
  637. package/dist/skills/registry.d.ts.map +1 -1
  638. package/dist/skills/registry.js +154 -20
  639. package/dist/skills/registry.js.map +1 -1
  640. package/dist/store/attachment/index.d.ts +111 -0
  641. package/dist/store/attachment/index.d.ts.map +1 -0
  642. package/dist/store/attachment/index.js +94 -0
  643. package/dist/store/attachment/index.js.map +1 -0
  644. package/dist/store/config/index.d.ts +43 -0
  645. package/dist/store/config/index.d.ts.map +1 -0
  646. package/dist/store/config/index.js +51 -0
  647. package/dist/store/config/index.js.map +1 -0
  648. package/dist/store/feedback/conformance.d.ts +44 -0
  649. package/dist/store/feedback/conformance.d.ts.map +1 -0
  650. package/dist/store/feedback/conformance.js +127 -0
  651. package/dist/store/feedback/conformance.js.map +1 -0
  652. package/dist/store/feedback/disk.d.ts +46 -0
  653. package/dist/store/feedback/disk.d.ts.map +1 -0
  654. package/dist/store/feedback/disk.js +141 -0
  655. package/dist/store/feedback/disk.js.map +1 -0
  656. package/dist/store/feedback/index.d.ts +9 -0
  657. package/dist/store/feedback/index.d.ts.map +1 -0
  658. package/dist/store/feedback/index.js +5 -0
  659. package/dist/store/feedback/index.js.map +1 -0
  660. package/dist/store/feedback/memory.d.ts +33 -0
  661. package/dist/store/feedback/memory.d.ts.map +1 -0
  662. package/dist/store/feedback/memory.js +0 -0
  663. package/dist/store/feedback/memory.js.map +1 -0
  664. package/dist/store/feedback/types.d.ts +95 -0
  665. package/dist/store/feedback/types.d.ts.map +1 -0
  666. package/dist/store/feedback/types.js +27 -0
  667. package/dist/store/feedback/types.js.map +1 -0
  668. package/dist/store/index.d.ts +1 -0
  669. package/dist/store/index.d.ts.map +1 -1
  670. package/dist/store/index.js +4 -0
  671. package/dist/store/index.js.map +1 -1
  672. package/dist/store/kv/record-store.d.ts +54 -0
  673. package/dist/store/kv/record-store.d.ts.map +1 -0
  674. package/dist/store/kv/record-store.js +94 -0
  675. package/dist/store/kv/record-store.js.map +1 -0
  676. package/dist/store/memory/disk.d.ts +2 -0
  677. package/dist/store/memory/disk.d.ts.map +1 -1
  678. package/dist/store/memory/disk.js +36 -30
  679. package/dist/store/memory/disk.js.map +1 -1
  680. package/dist/store/run/checkpoint-disk.d.ts +4 -4
  681. package/dist/store/run/checkpoint-disk.d.ts.map +1 -1
  682. package/dist/store/run/checkpoint-disk.js +22 -1
  683. package/dist/store/run/checkpoint-disk.js.map +1 -1
  684. package/dist/store/run/checkpoint-memory.d.ts +4 -4
  685. package/dist/store/run/checkpoint-memory.d.ts.map +1 -1
  686. package/dist/store/run/checkpoint-memory.js.map +1 -1
  687. package/dist/store/run/claim-disk.d.ts +5 -5
  688. package/dist/store/run/claim-disk.d.ts.map +1 -1
  689. package/dist/store/run/claim-disk.js +20 -0
  690. package/dist/store/run/claim-disk.js.map +1 -1
  691. package/dist/store/run/conformance.d.ts.map +1 -1
  692. package/dist/store/run/conformance.js +10 -9
  693. package/dist/store/run/conformance.js.map +1 -1
  694. package/dist/store/run/disk.d.ts +3 -1
  695. package/dist/store/run/disk.d.ts.map +1 -1
  696. package/dist/store/run/disk.js +73 -4
  697. package/dist/store/run/disk.js.map +1 -1
  698. package/dist/store/run/listing.d.ts +4 -4
  699. package/dist/store/run/listing.d.ts.map +1 -1
  700. package/dist/store/run/listing.js.map +1 -1
  701. package/dist/store/run/memory.d.ts +5 -0
  702. package/dist/store/run/memory.d.ts.map +1 -1
  703. package/dist/store/run/memory.js +20 -1
  704. package/dist/store/run/memory.js.map +1 -1
  705. package/dist/store/session/canonical-path.d.ts +32 -0
  706. package/dist/store/session/canonical-path.d.ts.map +1 -0
  707. package/dist/store/session/canonical-path.js +46 -0
  708. package/dist/store/session/canonical-path.js.map +1 -0
  709. package/dist/store/session/disk.d.ts +46 -2
  710. package/dist/store/session/disk.d.ts.map +1 -1
  711. package/dist/store/session/disk.js +191 -205
  712. package/dist/store/session/disk.js.map +1 -1
  713. package/dist/store/session/memory.d.ts +10 -2
  714. package/dist/store/session/memory.d.ts.map +1 -1
  715. package/dist/store/session/memory.js +36 -4
  716. package/dist/store/session/memory.js.map +1 -1
  717. package/dist/store/task/disk.d.ts.map +1 -1
  718. package/dist/store/task/disk.js +76 -68
  719. package/dist/store/task/disk.js.map +1 -1
  720. package/dist/store/topic/index.d.ts +6 -0
  721. package/dist/store/topic/index.d.ts.map +1 -0
  722. package/dist/store/topic/index.js +20 -0
  723. package/dist/store/topic/index.js.map +1 -0
  724. package/dist/store/topic/memory.d.ts +30 -0
  725. package/dist/store/topic/memory.d.ts.map +1 -0
  726. package/dist/store/topic/memory.js +97 -0
  727. package/dist/store/topic/memory.js.map +1 -0
  728. package/dist/store/topic/objective.d.ts +104 -0
  729. package/dist/store/topic/objective.d.ts.map +1 -0
  730. package/dist/store/topic/objective.js +195 -0
  731. package/dist/store/topic/objective.js.map +1 -0
  732. package/dist/store/topic/state.d.ts +60 -0
  733. package/dist/store/topic/state.d.ts.map +1 -0
  734. package/dist/store/topic/state.js +128 -0
  735. package/dist/store/topic/state.js.map +1 -0
  736. package/dist/streaming/coalesce.d.ts +19 -6
  737. package/dist/streaming/coalesce.d.ts.map +1 -1
  738. package/dist/streaming/coalesce.js +13 -4
  739. package/dist/streaming/coalesce.js.map +1 -1
  740. package/dist/telemetry/runtime-accessors.d.ts +27 -1
  741. package/dist/telemetry/runtime-accessors.d.ts.map +1 -1
  742. package/dist/telemetry/runtime-accessors.js +45 -1
  743. package/dist/telemetry/runtime-accessors.js.map +1 -1
  744. package/dist/test-support/ids.d.ts +68 -0
  745. package/dist/test-support/ids.d.ts.map +1 -0
  746. package/dist/test-support/ids.js +70 -0
  747. package/dist/test-support/ids.js.map +1 -0
  748. package/dist/testing.d.ts +24 -0
  749. package/dist/testing.d.ts.map +1 -0
  750. package/dist/testing.js +22 -0
  751. package/dist/testing.js.map +1 -0
  752. package/dist/tools/builtins/bash.d.ts +1 -0
  753. package/dist/tools/builtins/bash.d.ts.map +1 -1
  754. package/dist/tools/builtins/bash.js +77 -3
  755. package/dist/tools/builtins/bash.js.map +1 -1
  756. package/dist/tools/builtins/computer-use.d.ts +8 -8
  757. package/dist/tools/builtins/edit.d.ts +1 -1
  758. package/dist/tools/builtins/edit.d.ts.map +1 -1
  759. package/dist/tools/builtins/edit.js +34 -0
  760. package/dist/tools/builtins/edit.js.map +1 -1
  761. package/dist/tools/builtins/index.d.ts +6 -0
  762. package/dist/tools/builtins/index.d.ts.map +1 -1
  763. package/dist/tools/builtins/index.js +24 -1
  764. package/dist/tools/builtins/index.js.map +1 -1
  765. package/dist/tools/builtins/job.d.ts +6 -0
  766. package/dist/tools/builtins/job.d.ts.map +1 -0
  767. package/dist/tools/builtins/job.js +114 -0
  768. package/dist/tools/builtins/job.js.map +1 -0
  769. package/dist/tools/builtins/lsp.d.ts +21 -0
  770. package/dist/tools/builtins/lsp.d.ts.map +1 -0
  771. package/dist/tools/builtins/lsp.js +186 -0
  772. package/dist/tools/builtins/lsp.js.map +1 -0
  773. package/dist/tools/builtins/run-code.d.ts +13 -0
  774. package/dist/tools/builtins/run-code.d.ts.map +1 -0
  775. package/dist/tools/builtins/run-code.js +126 -0
  776. package/dist/tools/builtins/run-code.js.map +1 -0
  777. package/dist/tools/builtins/skill.d.ts +14 -0
  778. package/dist/tools/builtins/skill.d.ts.map +1 -0
  779. package/dist/tools/builtins/skill.js +120 -0
  780. package/dist/tools/builtins/skill.js.map +1 -0
  781. package/dist/tools/builtins/web-guidance.d.ts +31 -0
  782. package/dist/tools/builtins/web-guidance.d.ts.map +1 -0
  783. package/dist/tools/builtins/web-guidance.js +42 -0
  784. package/dist/tools/builtins/web-guidance.js.map +1 -0
  785. package/dist/tools/builtins/web.d.ts +10 -0
  786. package/dist/tools/builtins/web.d.ts.map +1 -0
  787. package/dist/tools/builtins/web.js +137 -0
  788. package/dist/tools/builtins/web.js.map +1 -0
  789. package/dist/tools/builtins/write-file.d.ts.map +1 -1
  790. package/dist/tools/builtins/write-file.js +35 -0
  791. package/dist/tools/builtins/write-file.js.map +1 -1
  792. package/dist/tools/coordinator/agent.d.ts +2 -2
  793. package/dist/tools/coordinator/agent.d.ts.map +1 -1
  794. package/dist/tools/coordinator/index.d.ts +13 -4
  795. package/dist/tools/coordinator/index.d.ts.map +1 -1
  796. package/dist/tools/coordinator/index.js +125 -38
  797. package/dist/tools/coordinator/index.js.map +1 -1
  798. package/dist/tools/coordinator/outcome.d.ts +2 -2
  799. package/dist/tools/coordinator/outcome.d.ts.map +1 -1
  800. package/dist/tools/coordinator/outcome.js +1 -1
  801. package/dist/tools/coordinator/wait-with-idle-bound.d.ts +3 -3
  802. package/dist/tools/coordinator/wait-with-idle-bound.d.ts.map +1 -1
  803. package/dist/tools/coordinator/wait-with-idle-bound.js.map +1 -1
  804. package/dist/tools/defineTool.d.ts +12 -0
  805. package/dist/tools/defineTool.d.ts.map +1 -1
  806. package/dist/tools/defineTool.js +2 -0
  807. package/dist/tools/defineTool.js.map +1 -1
  808. package/dist/tools/env-scrub.d.ts +66 -0
  809. package/dist/tools/env-scrub.d.ts.map +1 -0
  810. package/dist/tools/env-scrub.js +68 -0
  811. package/dist/tools/env-scrub.js.map +1 -0
  812. package/dist/tools/memory/read.d.ts.map +1 -1
  813. package/dist/tools/memory/read.js +5 -1
  814. package/dist/tools/memory/read.js.map +1 -1
  815. package/dist/tools/task/create.d.ts.map +1 -1
  816. package/dist/tools/task/create.js +2 -1
  817. package/dist/tools/task/create.js.map +1 -1
  818. package/dist/tools/task/update.d.ts.map +1 -1
  819. package/dist/tools/task/update.js +7 -3
  820. package/dist/tools/task/update.js.map +1 -1
  821. package/dist/types/acp/index.d.ts +161 -0
  822. package/dist/types/acp/index.d.ts.map +1 -0
  823. package/dist/types/acp/index.js +2 -0
  824. package/dist/types/acp/index.js.map +1 -0
  825. package/dist/types/agent/base.d.ts +62 -5
  826. package/dist/types/agent/base.d.ts.map +1 -1
  827. package/dist/types/agent/delegate.d.ts +102 -0
  828. package/dist/types/agent/delegate.d.ts.map +1 -0
  829. package/dist/types/agent/delegate.js +2 -0
  830. package/dist/types/agent/delegate.js.map +1 -0
  831. package/dist/types/agent/index.d.ts +1 -1
  832. package/dist/types/agent/index.d.ts.map +1 -1
  833. package/dist/types/agent/index.js +1 -1
  834. package/dist/types/agent/index.js.map +1 -1
  835. package/dist/types/agent/manager.d.ts +7 -1
  836. package/dist/types/agent/manager.d.ts.map +1 -1
  837. package/dist/types/agent/reactive.d.ts +24 -3
  838. package/dist/types/agent/reactive.d.ts.map +1 -1
  839. package/dist/types/agent/{gateway.d.ts → scheduler.d.ts} +41 -5
  840. package/dist/types/agent/scheduler.d.ts.map +1 -0
  841. package/dist/types/agent/scheduler.js +2 -0
  842. package/dist/types/agent/scheduler.js.map +1 -0
  843. package/dist/types/agent/supervisor.d.ts +23 -5
  844. package/dist/types/agent/supervisor.d.ts.map +1 -1
  845. package/dist/types/agent/task.d.ts +31 -9
  846. package/dist/types/agent/task.d.ts.map +1 -1
  847. package/dist/types/agent/working-memory.d.ts +1 -1
  848. package/dist/types/authorization/index.d.ts +634 -0
  849. package/dist/types/authorization/index.d.ts.map +1 -0
  850. package/dist/types/authorization/index.js +103 -0
  851. package/dist/types/authorization/index.js.map +1 -0
  852. package/dist/types/bus/index.d.ts +24 -1
  853. package/dist/types/bus/index.d.ts.map +1 -1
  854. package/dist/types/code-navigation/index.d.ts +112 -0
  855. package/dist/types/code-navigation/index.d.ts.map +1 -0
  856. package/dist/types/code-navigation/index.js +17 -0
  857. package/dist/types/code-navigation/index.js.map +1 -0
  858. package/dist/types/command/index.d.ts +74 -0
  859. package/dist/types/command/index.d.ts.map +1 -0
  860. package/dist/types/command/index.js +18 -0
  861. package/dist/types/command/index.js.map +1 -0
  862. package/dist/types/common/index.d.ts +19 -2
  863. package/dist/types/common/index.d.ts.map +1 -1
  864. package/dist/types/common/index.js.map +1 -1
  865. package/dist/types/connector/mcp.d.ts +8 -0
  866. package/dist/types/connector/mcp.d.ts.map +1 -1
  867. package/dist/types/guardrail/index.d.ts +74 -1
  868. package/dist/types/guardrail/index.d.ts.map +1 -1
  869. package/dist/types/hitl/policy.d.ts +79 -0
  870. package/dist/types/hitl/policy.d.ts.map +1 -0
  871. package/dist/types/hitl/policy.js +2 -0
  872. package/dist/types/hitl/policy.js.map +1 -0
  873. package/dist/types/ids/brand.d.ts +55 -0
  874. package/dist/types/ids/brand.d.ts.map +1 -0
  875. package/dist/types/ids/brand.js +45 -0
  876. package/dist/types/ids/brand.js.map +1 -0
  877. package/dist/types/ids/index.d.ts +98 -39
  878. package/dist/types/ids/index.d.ts.map +1 -1
  879. package/dist/types/ids/index.js +5 -1
  880. package/dist/types/ids/index.js.map +1 -1
  881. package/dist/types/message/index.d.ts +24 -1
  882. package/dist/types/message/index.d.ts.map +1 -1
  883. package/dist/types/message/index.js.map +1 -1
  884. package/dist/types/plugin/index.d.ts +2 -2
  885. package/dist/types/project/entity.d.ts +22 -2
  886. package/dist/types/project/entity.d.ts.map +1 -1
  887. package/dist/types/provider/interface.d.ts +43 -2
  888. package/dist/types/provider/interface.d.ts.map +1 -1
  889. package/dist/types/provider/model.d.ts +16 -2
  890. package/dist/types/provider/model.d.ts.map +1 -1
  891. package/dist/types/run/audit.d.ts +150 -0
  892. package/dist/types/run/audit.d.ts.map +1 -0
  893. package/dist/types/run/audit.js +39 -0
  894. package/dist/types/run/audit.js.map +1 -0
  895. package/dist/types/run/cancel-cause.d.ts +49 -0
  896. package/dist/types/run/cancel-cause.d.ts.map +1 -0
  897. package/dist/types/run/cancel-cause.js +39 -0
  898. package/dist/types/run/cancel-cause.js.map +1 -0
  899. package/dist/types/run/checkpoint-store.d.ts +29 -11
  900. package/dist/types/run/checkpoint-store.d.ts.map +1 -1
  901. package/dist/types/run/config.d.ts +24 -4
  902. package/dist/types/run/config.d.ts.map +1 -1
  903. package/dist/types/run/derive-status.d.ts +3 -3
  904. package/dist/types/run/derive-status.d.ts.map +1 -1
  905. package/dist/types/run/derive-status.js +1 -1
  906. package/dist/types/run/entity.d.ts +2 -3
  907. package/dist/types/run/entity.d.ts.map +1 -1
  908. package/dist/types/run/event-cursor.d.ts +3 -3
  909. package/dist/types/run/event-cursor.d.ts.map +1 -1
  910. package/dist/types/run/events.d.ts +159 -4
  911. package/dist/types/run/events.d.ts.map +1 -1
  912. package/dist/types/run/events.js.map +1 -1
  913. package/dist/types/run/index.d.ts +2 -0
  914. package/dist/types/run/index.d.ts.map +1 -1
  915. package/dist/types/run/index.js +2 -0
  916. package/dist/types/run/index.js.map +1 -1
  917. package/dist/types/run/metadata.d.ts +2 -2
  918. package/dist/types/run/metadata.d.ts.map +1 -1
  919. package/dist/types/run/prepare-step.d.ts +29 -0
  920. package/dist/types/run/prepare-step.d.ts.map +1 -1
  921. package/dist/types/run/state.d.ts +33 -10
  922. package/dist/types/run/state.d.ts.map +1 -1
  923. package/dist/types/run/state.js +60 -3
  924. package/dist/types/run/state.js.map +1 -1
  925. package/dist/types/run/stop-reason.d.ts +9 -0
  926. package/dist/types/run/stop-reason.d.ts.map +1 -1
  927. package/dist/types/run/store.d.ts +38 -0
  928. package/dist/types/run/store.d.ts.map +1 -1
  929. package/dist/types/sandbox/index.d.ts +38 -0
  930. package/dist/types/sandbox/index.d.ts.map +1 -1
  931. package/dist/types/sandbox/index.js +21 -0
  932. package/dist/types/sandbox/index.js.map +1 -1
  933. package/dist/types/session/actor.d.ts +2 -2
  934. package/dist/types/session/actor.d.ts.map +1 -1
  935. package/dist/types/session/entity.d.ts +9 -7
  936. package/dist/types/session/entity.d.ts.map +1 -1
  937. package/dist/types/session/ids.d.ts +3 -1
  938. package/dist/types/session/ids.d.ts.map +1 -1
  939. package/dist/types/session/index.d.ts +4 -2
  940. package/dist/types/session/index.d.ts.map +1 -1
  941. package/dist/types/session/store.d.ts +51 -22
  942. package/dist/types/session/store.d.ts.map +1 -1
  943. package/dist/types/session/sub-session.d.ts +55 -5
  944. package/dist/types/session/sub-session.d.ts.map +1 -1
  945. package/dist/types/skills/index.d.ts +41 -0
  946. package/dist/types/skills/index.d.ts.map +1 -1
  947. package/dist/types/skills/index.js +17 -1
  948. package/dist/types/skills/index.js.map +1 -1
  949. package/dist/types/tool/index.d.ts +186 -1
  950. package/dist/types/tool/index.d.ts.map +1 -1
  951. package/dist/types/tool/index.js.map +1 -1
  952. package/dist/types/tool/presentation.d.ts +53 -0
  953. package/dist/types/tool/presentation.d.ts.map +1 -0
  954. package/dist/types/tool/presentation.js +2 -0
  955. package/dist/types/tool/presentation.js.map +1 -0
  956. package/dist/types/{thread → topic}/entity.d.ts +34 -26
  957. package/dist/types/topic/entity.d.ts.map +1 -0
  958. package/dist/types/{thread → topic}/entity.js.map +1 -1
  959. package/dist/types/topic/index.d.ts +5 -0
  960. package/dist/types/topic/index.d.ts.map +1 -0
  961. package/dist/types/topic/index.js +11 -0
  962. package/dist/types/topic/index.js.map +1 -0
  963. package/dist/types/topic/objective.d.ts +86 -0
  964. package/dist/types/topic/objective.d.ts.map +1 -0
  965. package/dist/types/topic/objective.js +10 -0
  966. package/dist/types/topic/objective.js.map +1 -0
  967. package/dist/types/topic/state.d.ts +56 -0
  968. package/dist/types/topic/state.d.ts.map +1 -0
  969. package/dist/types/topic/state.js +10 -0
  970. package/dist/types/topic/state.js.map +1 -0
  971. package/dist/types/topic/store.d.ts +95 -0
  972. package/dist/types/topic/store.d.ts.map +1 -0
  973. package/dist/types/topic/store.js +29 -0
  974. package/dist/types/topic/store.js.map +1 -0
  975. package/dist/types/workspace/ref.d.ts +7 -0
  976. package/dist/types/workspace/ref.d.ts.map +1 -1
  977. package/dist/utils/abort.d.ts.map +1 -1
  978. package/dist/utils/abort.js +13 -1
  979. package/dist/utils/abort.js.map +1 -1
  980. package/dist/utils/hash.d.ts +10 -0
  981. package/dist/utils/hash.d.ts.map +1 -1
  982. package/dist/utils/hash.js +15 -0
  983. package/dist/utils/hash.js.map +1 -1
  984. package/dist/utils/id.d.ts +90 -2
  985. package/dist/utils/id.d.ts.map +1 -1
  986. package/dist/utils/id.js +113 -5
  987. package/dist/utils/id.js.map +1 -1
  988. package/dist/utils/log/attributes.d.ts +17 -0
  989. package/dist/utils/log/attributes.d.ts.map +1 -0
  990. package/dist/utils/log/attributes.js +2 -0
  991. package/dist/utils/log/attributes.js.map +1 -0
  992. package/dist/utils/log/caps.d.ts +27 -0
  993. package/dist/utils/log/caps.d.ts.map +1 -0
  994. package/dist/utils/log/caps.js +107 -0
  995. package/dist/utils/log/caps.js.map +1 -0
  996. package/dist/utils/log/create-logger.d.ts +28 -0
  997. package/dist/utils/log/create-logger.d.ts.map +1 -0
  998. package/dist/utils/log/create-logger.js +168 -0
  999. package/dist/utils/log/create-logger.js.map +1 -0
  1000. package/dist/utils/log/exception.d.ts +11 -0
  1001. package/dist/utils/log/exception.d.ts.map +1 -0
  1002. package/dist/utils/log/exception.js +108 -0
  1003. package/dist/utils/log/exception.js.map +1 -0
  1004. package/dist/utils/log/index.d.ts +7 -0
  1005. package/dist/utils/log/index.d.ts.map +1 -0
  1006. package/dist/utils/log/index.js +15 -0
  1007. package/dist/utils/log/index.js.map +1 -0
  1008. package/dist/utils/log/process-sink.d.ts +28 -0
  1009. package/dist/utils/log/process-sink.d.ts.map +1 -0
  1010. package/dist/utils/log/process-sink.js +56 -0
  1011. package/dist/utils/log/process-sink.js.map +1 -0
  1012. package/dist/utils/log/redact.d.ts +3 -0
  1013. package/dist/utils/log/redact.d.ts.map +1 -0
  1014. package/dist/utils/log/redact.js +71 -0
  1015. package/dist/utils/log/redact.js.map +1 -0
  1016. package/dist/utils/log/sinks.d.ts +43 -0
  1017. package/dist/utils/log/sinks.d.ts.map +1 -0
  1018. package/dist/utils/log/sinks.js +184 -0
  1019. package/dist/utils/log/sinks.js.map +1 -0
  1020. package/dist/utils/log/templates.d.ts +63 -0
  1021. package/dist/utils/log/templates.d.ts.map +1 -0
  1022. package/dist/utils/log/templates.js +119 -0
  1023. package/dist/utils/log/templates.js.map +1 -0
  1024. package/dist/utils/log/types.d.ts +183 -0
  1025. package/dist/utils/log/types.d.ts.map +1 -0
  1026. package/dist/utils/log/types.js +55 -0
  1027. package/dist/utils/log/types.js.map +1 -0
  1028. package/dist/utils/logger.d.ts +44 -0
  1029. package/dist/utils/logger.d.ts.map +1 -1
  1030. package/dist/utils/logger.js +102 -2
  1031. package/dist/utils/logger.js.map +1 -1
  1032. package/dist/utils/renamed-field.d.ts +19 -0
  1033. package/dist/utils/renamed-field.d.ts.map +1 -0
  1034. package/dist/utils/renamed-field.js +29 -0
  1035. package/dist/utils/renamed-field.js.map +1 -0
  1036. package/dist/vault/CredentialProvider.d.ts +89 -0
  1037. package/dist/vault/CredentialProvider.d.ts.map +1 -0
  1038. package/dist/vault/CredentialProvider.js +64 -0
  1039. package/dist/vault/CredentialProvider.js.map +1 -0
  1040. package/dist/vault/InMemoryCredentialVault.d.ts +2 -1
  1041. package/dist/vault/InMemoryCredentialVault.d.ts.map +1 -1
  1042. package/dist/vault/InMemoryCredentialVault.js +15 -5
  1043. package/dist/vault/InMemoryCredentialVault.js.map +1 -1
  1044. package/dist/vault/index.d.ts +3 -0
  1045. package/dist/vault/index.d.ts.map +1 -1
  1046. package/dist/vault/index.js +5 -0
  1047. package/dist/vault/index.js.map +1 -1
  1048. package/dist/vault/instrumentation.d.ts +18 -2
  1049. package/dist/vault/instrumentation.d.ts.map +1 -1
  1050. package/dist/vault/instrumentation.js +47 -0
  1051. package/dist/vault/instrumentation.js.map +1 -1
  1052. package/package.json +4 -4
  1053. package/src/advisory/executor.ts +14 -12
  1054. package/src/advisory/registry.ts +2 -2
  1055. package/src/agents/AGENTS.md +91 -0
  1056. package/src/agents/AbstractAgent.ts +67 -14
  1057. package/src/agents/PipelineAgent.ts +46 -12
  1058. package/src/agents/ReactiveAgent.ts +27 -13
  1059. package/src/agents/RouterAgent.ts +33 -21
  1060. package/src/agents/SupervisorAgent.ts +51 -26
  1061. package/src/agents/handle.ts +149 -0
  1062. package/src/agents/runAgent.ts +14 -7
  1063. package/src/{verification → authorization}/gate.ts +39 -32
  1064. package/src/authorization/index.ts +26 -0
  1065. package/src/authorization/permission-presets.ts +215 -0
  1066. package/src/{verification → authorization}/presets.ts +15 -3
  1067. package/src/{verification → authorization}/rules.ts +16 -3
  1068. package/src/bridge/a2a/client.ts +369 -0
  1069. package/src/bridge/a2a/mapper.ts +17 -0
  1070. package/src/bridge/acp/filesystem.ts +63 -0
  1071. package/src/bridge/acp/index.ts +11 -0
  1072. package/src/bridge/acp/permission.ts +71 -0
  1073. package/src/bridge/acp/server.ts +500 -0
  1074. package/src/bridge/acp/update.ts +109 -0
  1075. package/src/bridge/mcp/connector/adapter.ts +8 -4
  1076. package/src/bridge/sse/mapper.ts +30 -0
  1077. package/src/bus/breaker.ts +15 -10
  1078. package/src/bus/index.ts +10 -8
  1079. package/src/bus/lock.ts +36 -19
  1080. package/src/bus/ownership.ts +17 -9
  1081. package/src/compaction/context-window.ts +23 -1
  1082. package/src/compaction/index.ts +6 -0
  1083. package/src/compaction/manual.ts +177 -0
  1084. package/src/compaction/plan.ts +226 -0
  1085. package/src/compaction/summary.ts +31 -0
  1086. package/src/compaction/verifier.ts +2 -2
  1087. package/src/config/registry.ts +208 -0
  1088. package/src/config/runtime.ts +27 -0
  1089. package/src/connector/BaseConnector.ts +8 -3
  1090. package/src/connector/builtins/http.ts +12 -2
  1091. package/src/connector/builtins/webhook.ts +6 -2
  1092. package/src/connector/index.ts +45 -29
  1093. package/src/connector/mcp/adapter.ts +51 -1
  1094. package/src/connector/mcp/client.ts +32 -20
  1095. package/src/connector/mcp/discovery.ts +31 -20
  1096. package/src/connector/mcp/http-sse.ts +12 -6
  1097. package/src/connector/mcp/index.ts +8 -7
  1098. package/src/connector/mcp/reconnect.ts +194 -0
  1099. package/src/connector/mcp/server/index.ts +32 -0
  1100. package/src/connector/mcp/{server-stdio.ts → server/server-stdio.ts} +5 -4
  1101. package/src/connector/mcp/{server.ts → server/server.ts} +17 -11
  1102. package/src/connector/mcp/stdio.ts +18 -9
  1103. package/src/connector/mcp/streamable-http.ts +8 -4
  1104. package/src/{bridge/tools/connector → connector/tools}/adapter.ts +5 -5
  1105. package/src/{bridge/tools/connector → connector/tools}/definitions.ts +4 -4
  1106. package/src/{bridge/tools/connector → connector/tools}/router.ts +17 -9
  1107. package/src/connector/web/guarded-fetch.ts +288 -0
  1108. package/src/connector/web/index.ts +17 -0
  1109. package/src/connector/web/types.ts +99 -0
  1110. package/src/constants/acp/index.ts +104 -0
  1111. package/src/constants/credential-env-keys.ts +63 -0
  1112. package/src/constants/index.ts +3 -1
  1113. package/src/constants/secret-patterns.ts +102 -0
  1114. package/src/constants/telemetry/index.ts +98 -0
  1115. package/src/contracts/api.ts +11 -0
  1116. package/src/deprecated-aliases.ts +86 -0
  1117. package/src/eval/judge.ts +2 -2
  1118. package/src/execution/base.ts +18 -7
  1119. package/src/execution/code-runtime/types.ts +116 -0
  1120. package/src/execution/code-runtime/worker.ts +266 -0
  1121. package/src/{connector/execution → execution}/factory.ts +3 -3
  1122. package/src/{connector/execution → execution}/hybrid.ts +13 -7
  1123. package/src/execution/index.ts +24 -0
  1124. package/src/execution/local.ts +4 -2
  1125. package/src/{connector/execution → execution}/remote.ts +15 -8
  1126. package/src/index.ts +17 -0
  1127. package/src/invariants/index.ts +201 -0
  1128. package/src/manager/agent/lifecycle.ts +172 -58
  1129. package/src/manager/connector/environment.ts +22 -11
  1130. package/src/manager/connector/lifecycle.ts +30 -11
  1131. package/src/manager/connector/tenant.ts +33 -14
  1132. package/src/manager/index.ts +16 -2
  1133. package/src/manager/project/lifecycle.ts +1 -1
  1134. package/src/manager/run/emergency.ts +9 -7
  1135. package/src/manager/run/persistence.ts +110 -8
  1136. package/src/manager/topic/lifecycle.ts +235 -0
  1137. package/src/manager/topic/objective.ts +203 -0
  1138. package/src/persona/assembler.ts +14 -3
  1139. package/src/plugin/lifecycle.ts +156 -20
  1140. package/src/plugin/loader.ts +67 -16
  1141. package/src/probe/index.ts +1 -0
  1142. package/src/probe/registry.ts +41 -5
  1143. package/src/process/kill-tree.ts +52 -0
  1144. package/src/prompt/contributions.ts +173 -0
  1145. package/src/prompt/index.ts +15 -0
  1146. package/src/provider/attribution.ts +57 -0
  1147. package/src/provider/{collect.ts → collect-chat-completion.ts} +4 -2
  1148. package/src/provider/conformance.ts +189 -0
  1149. package/src/provider/errors.ts +27 -12
  1150. package/src/provider/fallback.ts +32 -10
  1151. package/src/provider/idle-timeout.ts +112 -0
  1152. package/src/provider/instrumentation.ts +4 -2
  1153. package/src/provider/retry.ts +63 -21
  1154. package/src/public-runtime.ts +378 -14
  1155. package/src/public-tools.ts +41 -1
  1156. package/src/public-types.ts +101 -4
  1157. package/src/rag/rag-tool.ts +4 -2
  1158. package/src/read-model/index.ts +14 -0
  1159. package/src/read-model/registry.ts +152 -0
  1160. package/src/read-model/run-status.ts +127 -0
  1161. package/src/registry/{Registry.ts → BaseRegistry.ts} +1 -1
  1162. package/src/registry/ManagedRegistry.ts +26 -9
  1163. package/src/registry/command/index-exports.ts +4 -0
  1164. package/src/registry/command/index.ts +105 -0
  1165. package/src/registry/command/kernel-commands.ts +110 -0
  1166. package/src/registry/connector/scoped.ts +6 -5
  1167. package/src/registry/index.ts +7 -1
  1168. package/src/registry/tool/execute.ts +52 -13
  1169. package/src/registry/tool/presentation.ts +116 -0
  1170. package/src/registry/tool/screen.ts +132 -0
  1171. package/src/run/drain.ts +13 -3
  1172. package/src/run/reporter.ts +208 -153
  1173. package/src/run-query/index.ts +108 -0
  1174. package/src/runtime/bidi/session.ts +7 -2
  1175. package/src/runtime/decision/fallback.ts +6 -3
  1176. package/src/runtime/decision/parser.ts +10 -9
  1177. package/src/runtime/jobs/registry.ts +346 -0
  1178. package/src/runtime/query/approval-policy.ts +78 -0
  1179. package/src/runtime/query/checkpoint.ts +6 -6
  1180. package/src/runtime/query/context.ts +120 -30
  1181. package/src/runtime/query/events.ts +19 -11
  1182. package/src/runtime/query/executor.ts +287 -66
  1183. package/src/runtime/query/guardrail-presets.ts +61 -14
  1184. package/src/runtime/query/guardrails.ts +16 -12
  1185. package/src/runtime/query/index.ts +579 -96
  1186. package/src/runtime/query/iteration/index.ts +269 -87
  1187. package/src/runtime/query/iteration/phases/advisory.ts +17 -16
  1188. package/src/runtime/query/iteration/phases/compaction.ts +235 -187
  1189. package/src/runtime/query/iteration/phases/context.ts +82 -21
  1190. package/src/runtime/query/iteration/phases/tool-review.ts +28 -9
  1191. package/src/runtime/query/iteration/phases/working-memory.ts +3 -2
  1192. package/src/runtime/query/iteration/stream-turn.ts +14 -14
  1193. package/src/runtime/query/{context-cache.ts → prompt-cache.ts} +23 -3
  1194. package/src/runtime/query/prompt.ts +104 -4
  1195. package/src/runtime/query/repeat-call.ts +130 -0
  1196. package/src/runtime/query/replay/mutate.ts +6 -0
  1197. package/src/runtime/query/result.ts +47 -10
  1198. package/src/runtime/query/resume-pending.ts +19 -17
  1199. package/src/runtime/query/resume-run.ts +2 -2
  1200. package/src/runtime/query/run-state.ts +5 -5
  1201. package/src/runtime/query/tool-grants.ts +1 -1
  1202. package/src/runtime/query/tool-output-budget.ts +36 -3
  1203. package/src/runtime/query/tool-pause.ts +2 -1
  1204. package/src/runtime/query/tooling.ts +17 -2
  1205. package/src/sandbox/provider/local.ts +94 -21
  1206. package/src/sandbox/terminal.ts +197 -0
  1207. package/src/{gateway → scheduler}/completion-inbox.ts +20 -10
  1208. package/src/scheduler/delegating.ts +297 -0
  1209. package/src/{gateway → scheduler}/local.ts +24 -15
  1210. package/src/session/actor-scope.ts +121 -0
  1211. package/src/session/errors.ts +30 -8
  1212. package/src/session/handoff/assignment.ts +5 -5
  1213. package/src/session/handoff/broadcast.ts +9 -9
  1214. package/src/session/handoff/single.ts +8 -8
  1215. package/src/session/migration/filesystem.ts +46 -2
  1216. package/src/session/migration/id-prefix.ts +60 -22
  1217. package/src/session/migration/index.ts +5 -0
  1218. package/src/session/migration/marker.ts +19 -4
  1219. package/src/session/retention/archive.ts +32 -12
  1220. package/src/session/workspace/git-worktree.ts +17 -8
  1221. package/src/skills/loader.ts +39 -9
  1222. package/src/skills/registry.ts +177 -20
  1223. package/src/store/attachment/index.ts +182 -0
  1224. package/src/store/config/index.ts +74 -0
  1225. package/src/store/feedback/conformance.ts +193 -0
  1226. package/src/store/feedback/disk.ts +184 -0
  1227. package/src/store/feedback/index.ts +13 -0
  1228. package/src/store/feedback/memory.ts +0 -0
  1229. package/src/store/feedback/types.ts +107 -0
  1230. package/src/store/index.ts +5 -0
  1231. package/src/store/kv/record-store.ts +91 -0
  1232. package/src/store/memory/disk.ts +35 -32
  1233. package/src/store/run/checkpoint-disk.ts +27 -6
  1234. package/src/store/run/checkpoint-memory.ts +8 -8
  1235. package/src/store/run/claim-disk.ts +58 -13
  1236. package/src/store/run/conformance.ts +11 -10
  1237. package/src/store/run/disk.ts +77 -5
  1238. package/src/store/run/listing.ts +6 -6
  1239. package/src/store/run/memory.ts +24 -1
  1240. package/src/store/session/canonical-path.ts +45 -0
  1241. package/src/store/session/disk.ts +216 -191
  1242. package/src/store/session/memory.ts +43 -5
  1243. package/src/store/task/disk.ts +77 -67
  1244. package/src/store/topic/index.ts +33 -0
  1245. package/src/store/topic/memory.ts +111 -0
  1246. package/src/store/topic/objective.ts +290 -0
  1247. package/src/store/topic/state.ts +204 -0
  1248. package/src/streaming/coalesce.ts +19 -5
  1249. package/src/telemetry/runtime-accessors.ts +45 -1
  1250. package/src/test-support/ids.ts +117 -0
  1251. package/src/testing.ts +40 -0
  1252. package/src/tools/builtins/bash.ts +82 -3
  1253. package/src/tools/builtins/edit.ts +36 -0
  1254. package/src/tools/builtins/index.ts +29 -1
  1255. package/src/tools/builtins/job.ts +133 -0
  1256. package/src/tools/builtins/lsp.ts +214 -0
  1257. package/src/tools/builtins/run-code.ts +154 -0
  1258. package/src/tools/builtins/skill.ts +134 -0
  1259. package/src/tools/builtins/web-guidance.ts +46 -0
  1260. package/src/tools/builtins/web.ts +156 -0
  1261. package/src/tools/builtins/write-file.ts +37 -1
  1262. package/src/tools/coordinator/agent.ts +2 -2
  1263. package/src/tools/coordinator/index.ts +144 -40
  1264. package/src/tools/coordinator/outcome.ts +2 -2
  1265. package/src/tools/coordinator/wait-with-idle-bound.ts +3 -3
  1266. package/src/tools/defineTool.ts +14 -0
  1267. package/src/tools/env-scrub.ts +91 -0
  1268. package/src/tools/memory/read.ts +5 -2
  1269. package/src/tools/task/create.ts +2 -1
  1270. package/src/tools/task/update.ts +7 -4
  1271. package/src/types/acp/index.ts +163 -0
  1272. package/src/types/agent/base.ts +67 -5
  1273. package/src/types/agent/delegate.ts +110 -0
  1274. package/src/types/agent/index.ts +1 -1
  1275. package/src/types/agent/manager.ts +7 -1
  1276. package/src/types/agent/reactive.ts +27 -3
  1277. package/src/types/agent/{gateway.ts → scheduler.ts} +41 -4
  1278. package/src/types/agent/supervisor.ts +26 -5
  1279. package/src/types/agent/task.ts +31 -9
  1280. package/src/types/agent/working-memory.ts +1 -1
  1281. package/src/types/{verification → authorization}/index.ts +79 -10
  1282. package/src/types/bus/index.ts +30 -1
  1283. package/src/types/code-navigation/index.ts +99 -0
  1284. package/src/types/command/index.ts +68 -0
  1285. package/src/types/common/index.ts +26 -2
  1286. package/src/types/connector/mcp.ts +8 -0
  1287. package/src/types/guardrail/index.ts +72 -1
  1288. package/src/types/hitl/policy.ts +83 -0
  1289. package/src/types/ids/brand.ts +58 -0
  1290. package/src/types/ids/index.ts +109 -42
  1291. package/src/types/message/index.ts +25 -1
  1292. package/src/types/project/entity.ts +22 -2
  1293. package/src/types/provider/interface.ts +45 -2
  1294. package/src/types/provider/model.ts +16 -2
  1295. package/src/types/run/audit.ts +164 -0
  1296. package/src/types/run/cancel-cause.ts +60 -0
  1297. package/src/types/run/checkpoint-store.ts +31 -11
  1298. package/src/types/run/config.ts +25 -4
  1299. package/src/types/run/derive-status.ts +3 -3
  1300. package/src/types/run/entity.ts +2 -4
  1301. package/src/types/run/event-cursor.ts +3 -3
  1302. package/src/types/run/events.ts +165 -6
  1303. package/src/types/run/index.ts +2 -0
  1304. package/src/types/run/metadata.ts +2 -2
  1305. package/src/types/run/prepare-step.ts +33 -0
  1306. package/src/types/run/state.ts +78 -11
  1307. package/src/types/run/stop-reason.ts +9 -0
  1308. package/src/types/run/store.ts +40 -0
  1309. package/src/types/sandbox/index.ts +37 -0
  1310. package/src/types/session/actor.ts +10 -2
  1311. package/src/types/session/entity.ts +9 -7
  1312. package/src/types/session/ids.ts +2 -0
  1313. package/src/types/session/index.ts +2 -0
  1314. package/src/types/session/store.ts +53 -22
  1315. package/src/types/session/sub-session.ts +50 -9
  1316. package/src/types/skills/index.ts +50 -0
  1317. package/src/types/tool/index.ts +171 -1
  1318. package/src/types/tool/presentation.ts +48 -0
  1319. package/src/types/{thread → topic}/entity.ts +34 -26
  1320. package/src/types/topic/index.ts +23 -0
  1321. package/src/types/topic/objective.ts +93 -0
  1322. package/src/types/topic/state.ts +60 -0
  1323. package/src/types/topic/store.ts +101 -0
  1324. package/src/types/workspace/ref.ts +7 -0
  1325. package/src/utils/abort.ts +16 -1
  1326. package/src/utils/hash.ts +16 -0
  1327. package/src/utils/id.ts +172 -12
  1328. package/src/utils/log/attributes.ts +47 -0
  1329. package/src/utils/log/caps.ts +118 -0
  1330. package/src/utils/log/create-logger.ts +198 -0
  1331. package/src/utils/log/exception.ts +124 -0
  1332. package/src/utils/log/index.ts +24 -0
  1333. package/src/utils/log/process-sink.ts +76 -0
  1334. package/src/utils/log/redact.ts +77 -0
  1335. package/src/utils/log/sinks.ts +205 -0
  1336. package/src/utils/log/templates.ts +161 -0
  1337. package/src/utils/log/types.ts +195 -0
  1338. package/src/utils/logger.ts +121 -2
  1339. package/src/utils/renamed-field.ts +35 -0
  1340. package/src/vault/CredentialProvider.ts +147 -0
  1341. package/src/vault/InMemoryCredentialVault.ts +16 -5
  1342. package/src/vault/index.ts +16 -0
  1343. package/src/vault/instrumentation.ts +63 -2
  1344. package/dist/bridge/tools/connector/adapter.d.ts.map +0 -1
  1345. package/dist/bridge/tools/connector/adapter.js.map +0 -1
  1346. package/dist/bridge/tools/connector/definitions.d.ts.map +0 -1
  1347. package/dist/bridge/tools/connector/definitions.js.map +0 -1
  1348. package/dist/bridge/tools/connector/index.d.ts.map +0 -1
  1349. package/dist/bridge/tools/connector/index.js.map +0 -1
  1350. package/dist/bridge/tools/connector/router.d.ts.map +0 -1
  1351. package/dist/bridge/tools/connector/router.js.map +0 -1
  1352. package/dist/connector/execution/factory.d.ts.map +0 -1
  1353. package/dist/connector/execution/factory.js.map +0 -1
  1354. package/dist/connector/execution/hybrid.d.ts.map +0 -1
  1355. package/dist/connector/execution/hybrid.js.map +0 -1
  1356. package/dist/connector/execution/index.d.ts +0 -6
  1357. package/dist/connector/execution/index.d.ts.map +0 -1
  1358. package/dist/connector/execution/index.js +0 -4
  1359. package/dist/connector/execution/index.js.map +0 -1
  1360. package/dist/connector/execution/remote.d.ts.map +0 -1
  1361. package/dist/connector/execution/remote.js.map +0 -1
  1362. package/dist/connector/mcp/server-stdio.d.ts.map +0 -1
  1363. package/dist/connector/mcp/server-stdio.js.map +0 -1
  1364. package/dist/connector/mcp/server.d.ts.map +0 -1
  1365. package/dist/connector/mcp/server.js.map +0 -1
  1366. package/dist/constants/verification/index.d.ts.map +0 -1
  1367. package/dist/constants/verification/index.js.map +0 -1
  1368. package/dist/gateway/completion-inbox.d.ts.map +0 -1
  1369. package/dist/gateway/completion-inbox.js.map +0 -1
  1370. package/dist/gateway/local.d.ts.map +0 -1
  1371. package/dist/gateway/local.js.map +0 -1
  1372. package/dist/manager/thread/lifecycle.d.ts +0 -105
  1373. package/dist/manager/thread/lifecycle.d.ts.map +0 -1
  1374. package/dist/manager/thread/lifecycle.js.map +0 -1
  1375. package/dist/provider/collect.d.ts.map +0 -1
  1376. package/dist/provider/collect.js.map +0 -1
  1377. package/dist/registry/Registry.d.ts.map +0 -1
  1378. package/dist/registry/Registry.js.map +0 -1
  1379. package/dist/router/task-router.d.ts.map +0 -1
  1380. package/dist/router/task-router.js.map +0 -1
  1381. package/dist/runtime/query/context-cache.d.ts.map +0 -1
  1382. package/dist/runtime/query/context-cache.js.map +0 -1
  1383. package/dist/store/thread/disk.d.ts +0 -41
  1384. package/dist/store/thread/disk.d.ts.map +0 -1
  1385. package/dist/store/thread/disk.js +0 -238
  1386. package/dist/store/thread/disk.js.map +0 -1
  1387. package/dist/store/thread/index.d.ts +0 -4
  1388. package/dist/store/thread/index.d.ts.map +0 -1
  1389. package/dist/store/thread/index.js +0 -6
  1390. package/dist/store/thread/index.js.map +0 -1
  1391. package/dist/store/thread/memory.d.ts +0 -23
  1392. package/dist/store/thread/memory.d.ts.map +0 -1
  1393. package/dist/store/thread/memory.js +0 -90
  1394. package/dist/store/thread/memory.js.map +0 -1
  1395. package/dist/types/agent/gateway.d.ts.map +0 -1
  1396. package/dist/types/agent/gateway.js +0 -2
  1397. package/dist/types/agent/gateway.js.map +0 -1
  1398. package/dist/types/thread/entity.d.ts.map +0 -1
  1399. package/dist/types/thread/index.d.ts +0 -3
  1400. package/dist/types/thread/index.d.ts.map +0 -1
  1401. package/dist/types/thread/index.js +0 -5
  1402. package/dist/types/thread/index.js.map +0 -1
  1403. package/dist/types/thread/store.d.ts +0 -86
  1404. package/dist/types/thread/store.d.ts.map +0 -1
  1405. package/dist/types/thread/store.js +0 -22
  1406. package/dist/types/thread/store.js.map +0 -1
  1407. package/dist/types/verification/index.d.ts +0 -317
  1408. package/dist/types/verification/index.d.ts.map +0 -1
  1409. package/dist/types/verification/index.js +0 -53
  1410. package/dist/types/verification/index.js.map +0 -1
  1411. package/dist/verification/gate.d.ts.map +0 -1
  1412. package/dist/verification/gate.js.map +0 -1
  1413. package/dist/verification/index.d.ts +0 -4
  1414. package/dist/verification/index.d.ts.map +0 -1
  1415. package/dist/verification/index.js +0 -4
  1416. package/dist/verification/index.js.map +0 -1
  1417. package/dist/verification/presets.d.ts.map +0 -1
  1418. package/dist/verification/presets.js.map +0 -1
  1419. package/dist/verification/rules.d.ts +0 -4
  1420. package/dist/verification/rules.d.ts.map +0 -1
  1421. package/dist/verification/rules.js.map +0 -1
  1422. package/src/connector/execution/index.ts +0 -5
  1423. package/src/manager/thread/lifecycle.ts +0 -217
  1424. package/src/store/thread/disk.ts +0 -272
  1425. package/src/store/thread/index.ts +0 -7
  1426. package/src/store/thread/memory.ts +0 -104
  1427. package/src/types/thread/index.ts +0 -6
  1428. package/src/types/thread/store.ts +0 -92
  1429. package/src/verification/index.ts +0 -3
  1430. /package/dist/{bridge/tools/connector → connector/tools}/index.d.ts +0 -0
  1431. /package/dist/{bridge/tools/connector → connector/tools}/index.js +0 -0
  1432. /package/dist/constants/{verification → authorization}/index.d.ts +0 -0
  1433. /package/dist/constants/{verification → authorization}/index.js +0 -0
  1434. /package/dist/{router → model-router}/task-router.d.ts +0 -0
  1435. /package/dist/{router → model-router}/task-router.js +0 -0
  1436. /package/dist/types/{thread → topic}/entity.js +0 -0
  1437. /package/src/{bridge/tools/connector → connector/tools}/index.ts +0 -0
  1438. /package/src/constants/{verification → authorization}/index.ts +0 -0
  1439. /package/src/{router → model-router}/task-router.ts +0 -0
@@ -1,25 +1,76 @@
1
+ import { stat } from 'node:fs/promises'
2
+ import { join } from 'node:path'
1
3
  import type {
2
4
  Skill,
3
5
  SkillChain,
4
6
  SkillDisclosureLevel,
5
7
  SkillLoadResult,
6
8
  } from '../types/skills/index.js'
7
- import { getRootLogger } from '../utils/logger.js'
8
- import { discoverSkills, loadSkill } from './loader.js'
9
+ import { SCOPE_ATTRIBUTE } from '../utils/log/types.js'
10
+ import { type Logger, resolveLogger } from '../utils/logger.js'
9
11
 
10
- const logger = getRootLogger().child({ component: 'SkillRegistry' })
12
+ import { SKILL_FILENAME, discoverSkills, loadSkill } from './loader.js'
13
+
14
+ /**
15
+ * What the file looked like when we read it.
16
+ *
17
+ * mtime AND size, not mtime alone. Coarse-grained filesystem timestamps —
18
+ * one-second resolution is still common on network mounts, and some
19
+ * container layers are worse — make two edits within one tick
20
+ * indistinguishable by mtime. Size catches most of what mtime misses, and
21
+ * the remainder is stated rather than papered over: an edit that changes
22
+ * neither, inside one timestamp tick, is not detected. Hashing the file
23
+ * would catch it and would mean reading every skill on every lookup, which
24
+ * is the cost this check exists to avoid.
25
+ */
26
+ interface FileStamp {
27
+ readonly path: string
28
+ readonly mtimeMs: number
29
+ readonly size: number
30
+ }
11
31
 
12
32
  export class SkillRegistry {
13
33
  private skills = new Map<string, Skill>()
34
+ private stamps = new Map<string, FileStamp>()
35
+ private readonly log: Logger
36
+
37
+ /**
38
+ * Bound once, at construction — not per call and not at module scope.
39
+ * Per-call construction (what `register`/`registerAll` did before this)
40
+ * still reads `getRootLogger()` on every call with no way for a caller to
41
+ * override it; module scope is worse still, for the reason `loadSkill`
42
+ * and `discoverSkills` document. A host that wants its own destination
43
+ * passes `log` here once.
44
+ */
45
+ constructor(log?: Logger) {
46
+ this.log = resolveLogger(log).child({ [SCOPE_ATTRIBUTE]: 'skills/registry' })
47
+ }
14
48
 
15
49
  async register(dirPath: string, level: SkillDisclosureLevel = 'metadata'): Promise<Skill> {
16
- const result = await loadSkill(dirPath, level)
50
+ const result = await loadSkill(dirPath, level, this.log)
17
51
  this.skills.set(result.skill.metadata.name, result.skill)
52
+ await this.stamp(result.skill.metadata.name, dirPath)
18
53
  return result.skill
19
54
  }
20
55
 
56
+ /** Record what the file looked like, so a later read can tell it changed. */
57
+ private async stamp(name: string, dirPath: string): Promise<void> {
58
+ const path = join(dirPath, SKILL_FILENAME)
59
+ try {
60
+ const info = await stat(path)
61
+ this.stamps.set(name, { path, mtimeMs: info.mtimeMs, size: info.size })
62
+ } catch {
63
+ // A skill that was just read and whose file cannot now be stat'ed
64
+ // is a race with somebody editing it. Leaving no stamp means the
65
+ // next lookup treats it as changed and re-reads — which is the
66
+ // right answer, and strictly better than recording a stamp we
67
+ // could not take.
68
+ this.stamps.delete(name)
69
+ }
70
+ }
71
+
21
72
  async registerAll(parentDir: string, level: SkillDisclosureLevel = 'metadata'): Promise<Skill[]> {
22
- const dirs = await discoverSkills(parentDir)
73
+ const dirs = await discoverSkills(parentDir, this.log)
23
74
  const results: Skill[] = []
24
75
 
25
76
  for (const dir of dirs) {
@@ -27,10 +78,10 @@ export class SkillRegistry {
27
78
  results.push(skill)
28
79
  }
29
80
 
30
- logger.debug('Registered skills from directory', {
31
- parentDir,
32
- count: results.length,
33
- names: results.map((s) => s.metadata.name),
81
+ this.log.debug('Registered skills from directory', {
82
+ 'namzu.skills.parent_dir': parentDir,
83
+ 'namzu.skills.count': results.length,
84
+ 'namzu.skills.names': results.map((s) => s.metadata.name),
34
85
  })
35
86
 
36
87
  return results
@@ -40,6 +91,53 @@ export class SkillRegistry {
40
91
  return this.skills.get(name)
41
92
  }
42
93
 
94
+ /**
95
+ * Register a skill already loaded, under a name the caller chose.
96
+ *
97
+ * The plugin path needs this: it namespaces a plugin's skills so two
98
+ * plugins shipping `reconcile` do not silently overwrite each other, and
99
+ * the name a skill is filed under is then not the name in its own
100
+ * frontmatter. `register(dirPath)` cannot express that.
101
+ */
102
+ add(name: string, skill: Skill): void {
103
+ this.skills.set(name, skill)
104
+ // Deliberately NOT stamped. `add` is synchronous by contract, and a
105
+ // fire-and-forget `stat` here would be a promise nothing awaits
106
+ // racing the first `load` — sometimes stamped, sometimes not,
107
+ // depending on scheduling. Unstamped is treated as changed, so the
108
+ // first `load` re-reads: one extra read, never a stale answer, and no
109
+ // race to reason about.
110
+ }
111
+
112
+ /**
113
+ * Forget one. Reports whether it was there.
114
+ *
115
+ * Needed by anything that can UNDO a registration — a plugin rollback,
116
+ * a plugin disable. Without it a plugin that failed halfway through
117
+ * enabling left its skills in the registry with nothing that could
118
+ * remove them, so the model kept being offered skills from a plugin the
119
+ * runtime had marked `error`.
120
+ */
121
+ unregister(name: string): boolean {
122
+ this.stamps.delete(name)
123
+ return this.skills.delete(name)
124
+ }
125
+
126
+ /**
127
+ * Load a skill, re-reading it if the file changed since we last did.
128
+ *
129
+ * The cache was permanent: once a body had been read, `existing.body`
130
+ * short-circuited every later call, so an edited SKILL.md could not reach
131
+ * the model without restarting the process. That is fine for a run and
132
+ * wrong for a long-lived one — a skill is a file an author is editing
133
+ * WHILE the agent is running, which is the whole reason it is a file and
134
+ * not a constant.
135
+ *
136
+ * One `stat` per lookup, not a hash and not a watcher. A watcher is a
137
+ * resource with a lifetime, and this registry has no teardown to hang one
138
+ * on; a hash means reading every skill on every lookup, which is the cost
139
+ * the cache exists to avoid.
140
+ */
43
141
  async load(
44
142
  name: string,
45
143
  level: SkillDisclosureLevel = 'full',
@@ -47,7 +145,21 @@ export class SkillRegistry {
47
145
  const existing = this.skills.get(name)
48
146
  if (!existing) return undefined
49
147
 
50
- if (level === 'metadata' || existing.body) {
148
+ const changed = await this.hasChanged(name, existing.dirPath)
149
+ if (changed === 'gone') {
150
+ // Dropped, not served stale. A skill whose file was deleted is a
151
+ // skill that no longer exists, and answering with its last known
152
+ // body hands the model instructions for something nobody can point
153
+ // at. Removing the name keeps the manifest and this lookup
154
+ // agreeing, which they would not if one listed it and the other
155
+ // refused.
156
+ this.skills.delete(name)
157
+ this.stamps.delete(name)
158
+ this.log.info('Skill removed: its SKILL.md is gone', { 'namzu.skill.name': name })
159
+ return undefined
160
+ }
161
+
162
+ if (changed === 'same' && (level === 'metadata' || existing.body)) {
51
163
  return {
52
164
  skill: existing,
53
165
  disclosureLevel: existing.body ? 'full' : 'metadata',
@@ -55,15 +167,57 @@ export class SkillRegistry {
55
167
  }
56
168
  }
57
169
 
58
- const result = await loadSkill(existing.dirPath, level)
59
- this.skills.set(name, result.skill)
60
- return result
170
+ const result = await loadSkill(existing.dirPath, level, this.log)
171
+ // Keyed by the name it was REGISTERED under, not by what the reloaded
172
+ // file now says. The plugin path files skills under `plugin__skill`
173
+ // while the file says `skill`, so taking the name off disk would
174
+ // silently un-namespace them — the old key would point at nothing and
175
+ // a new one would appear that nothing in the prompt has heard of.
176
+ //
177
+ // The SAME object is stored and returned. Returning `result` while
178
+ // caching a re-keyed copy handed the caller the on-disk name and the
179
+ // registry the registered one, which is the divergence this re-keying
180
+ // exists to prevent, reintroduced one line below the comment saying
181
+ // so.
182
+ const rekeyed: Skill = { ...result.skill, metadata: { ...result.skill.metadata, name } }
183
+ this.skills.set(name, rekeyed)
184
+ await this.stamp(name, existing.dirPath)
185
+ return { ...result, skill: rekeyed }
186
+ }
187
+
188
+ /** `same`, `changed`, or `gone`. */
189
+ private async hasChanged(name: string, dirPath: string): Promise<'same' | 'changed' | 'gone'> {
190
+ const previous = this.stamps.get(name)
191
+ const path = previous?.path ?? join(dirPath, SKILL_FILENAME)
192
+ let info: Awaited<ReturnType<typeof stat>>
193
+ try {
194
+ info = await stat(path)
195
+ } catch {
196
+ return 'gone'
197
+ }
198
+ // Unstamped is CHANGED, not unchanged. A skill put in by `add` has no
199
+ // stamp, and reading it as unchanged would serve whatever the caller
200
+ // handed over forever — which for the plugin path is a body read at
201
+ // enable time and never again.
202
+ if (!previous) return 'changed'
203
+ return info.mtimeMs === previous.mtimeMs && info.size === previous.size ? 'same' : 'changed'
61
204
  }
62
205
 
63
206
  list(): Skill[] {
64
207
  return [...this.skills.values()]
65
208
  }
66
209
 
210
+ /**
211
+ * Every registered name.
212
+ *
213
+ * So a lookup that misses can name what IS there. A bare "not found"
214
+ * sends the model guessing at spellings, and it is guessing from a
215
+ * manifest already in its own prompt.
216
+ */
217
+ names(): readonly string[] {
218
+ return [...this.skills.keys()]
219
+ }
220
+
67
221
  get size(): number {
68
222
  return this.skills.size
69
223
  }
@@ -77,9 +231,10 @@ export async function resolveSkillChain(
77
231
  categorySkillsDir: string | undefined,
78
232
  agentSkillsDir: string | undefined,
79
233
  level: SkillDisclosureLevel = 'metadata',
234
+ log?: Logger,
80
235
  ): Promise<SkillChain> {
81
- const categoryRegistry = new SkillRegistry()
82
- const agentRegistry = new SkillRegistry()
236
+ const categoryRegistry = new SkillRegistry(log)
237
+ const agentRegistry = new SkillRegistry(log)
83
238
 
84
239
  const inherited = categorySkillsDir
85
240
  ? await categoryRegistry.registerAll(categorySkillsDir, level)
@@ -98,11 +253,13 @@ export async function resolveSkillChain(
98
253
 
99
254
  const resolved = [...resolvedMap.values()]
100
255
 
101
- logger.debug('Resolved skill chain', {
102
- inherited: inherited.map((s) => s.metadata.name),
103
- own: own.map((s) => s.metadata.name),
104
- resolved: resolved.map((s) => s.metadata.name),
105
- })
256
+ resolveLogger(log)
257
+ .child({ [SCOPE_ATTRIBUTE]: 'skills/registry' })
258
+ .debug('Resolved skill chain', {
259
+ 'namzu.skills.inherited': inherited.map((s) => s.metadata.name),
260
+ 'namzu.skills.own': own.map((s) => s.metadata.name),
261
+ 'namzu.skills.resolved': resolved.map((s) => s.metadata.name),
262
+ })
106
263
 
107
264
  return { inherited, own, resolved }
108
265
  }
@@ -0,0 +1,182 @@
1
+ import type { Message, MessageAttachment } from '../../types/message/index.js'
2
+
3
+ /**
4
+ * Where an attachment's bytes live when the message does not carry them.
5
+ *
6
+ * Every attachment was inline base64 on the message. That is fine for one
7
+ * screenshot and wrong for everything else it implies: the bytes are copied
8
+ * into the run's durable transcript, into every checkpoint, into every
9
+ * compaction pass that walks the history, and — because a conversation
10
+ * resends its history — into every subsequent request. A 4 MB PDF attached
11
+ * once is 4 MB in the transcript and 4 MB on the wire per turn for the rest
12
+ * of the run.
13
+ *
14
+ * So a message may carry a REFERENCE instead. The kernel treats `ref` as
15
+ * opaque: this seam says nothing about whether it is a hash, a path, or a
16
+ * URL, because the store that minted it is the only thing that can answer.
17
+ * A content-addressed store gets deduplication for free and this interface
18
+ * neither requires nor prevents that.
19
+ */
20
+
21
+ /** An attachment whose bytes are held by a store. */
22
+ export interface StoredAttachment {
23
+ readonly type: 'stored'
24
+ /**
25
+ * Opaque to the kernel, meaningful to the store that minted it.
26
+ *
27
+ * Never parsed here. A ref that the kernel could interpret is a ref the
28
+ * kernel could construct, and a model-authored one would then be a path
29
+ * into whatever the store can reach.
30
+ */
31
+ readonly ref: string
32
+ /**
33
+ * What the provider is told this is.
34
+ *
35
+ * Declared on the message rather than read from the store, because it
36
+ * decides which content block gets built and that decision has to be
37
+ * makeable without a round trip. `resolveAttachment` checks it against
38
+ * what the store reports and refuses a mismatch.
39
+ */
40
+ readonly mediaType: string
41
+ /** Which kind of block to build once the bytes arrive. */
42
+ readonly kind: 'image' | 'document'
43
+ /** Shown to the model, for a document it can refer to by name. */
44
+ readonly name?: string
45
+ /** See {@link DocumentAttachment.citations}. Ignored for an image. */
46
+ readonly citations?: boolean
47
+ }
48
+
49
+ export interface StoredBytes {
50
+ readonly data: string
51
+ readonly mediaType: string
52
+ }
53
+
54
+ export interface AttachmentStore {
55
+ /**
56
+ * Take bytes, return a ref.
57
+ *
58
+ * `mediaType` is stored alongside, so `get` can report what it holds and
59
+ * a caller can be caught claiming something else.
60
+ */
61
+ put(bytes: StoredBytes): Promise<string>
62
+ /** `undefined` for a ref this store does not hold. */
63
+ get(ref: string): Promise<StoredBytes | undefined>
64
+ }
65
+
66
+ /** A reference nothing could resolve. */
67
+ export class AttachmentNotFoundError extends Error {
68
+ readonly details: { ref: string }
69
+
70
+ constructor(details: { ref: string }) {
71
+ super(`No attachment for ref "${details.ref}".`)
72
+ this.name = 'AttachmentNotFoundError'
73
+ this.details = details
74
+ }
75
+ }
76
+
77
+ /** A message that carries a ref, in a run with nowhere to resolve it. */
78
+ export class NoAttachmentStoreError extends Error {
79
+ readonly details: { ref: string }
80
+
81
+ constructor(details: { ref: string }) {
82
+ super(
83
+ `A message carries a stored attachment ("${details.ref}") but this run has no attachment store.`,
84
+ )
85
+ this.name = 'NoAttachmentStoreError'
86
+ this.details = details
87
+ }
88
+ }
89
+
90
+ /** A store whose bytes are not what the message said they were. */
91
+ export class AttachmentMediaTypeMismatchError extends Error {
92
+ readonly details: { ref: string; declared: string; stored: string }
93
+
94
+ constructor(details: { ref: string; declared: string; stored: string }) {
95
+ super(
96
+ `Attachment "${details.ref}" was declared ${details.declared} but the store holds ${details.stored}.`,
97
+ )
98
+ this.name = 'AttachmentMediaTypeMismatchError'
99
+ this.details = details
100
+ }
101
+ }
102
+
103
+ export const isStoredAttachment = (
104
+ attachment: MessageAttachment,
105
+ ): attachment is MessageAttachment & StoredAttachment =>
106
+ (attachment as { type?: string }).type === 'stored'
107
+
108
+ /**
109
+ * Turn a stored attachment into an inline one, or refuse.
110
+ *
111
+ * Every failure here REFUSES rather than dropping the attachment. A message
112
+ * that quietly lost its image is a model answering a question about a
113
+ * picture it never saw, confidently, and nothing in the transcript says
114
+ * why — the worst available outcome, and the reason none of these three
115
+ * branches returns the message unchanged.
116
+ */
117
+ export async function resolveAttachment(
118
+ attachment: MessageAttachment,
119
+ store: AttachmentStore | undefined,
120
+ ): Promise<MessageAttachment> {
121
+ if (!isStoredAttachment(attachment)) return attachment
122
+ if (!store) throw new NoAttachmentStoreError({ ref: attachment.ref })
123
+
124
+ const bytes = await store.get(attachment.ref)
125
+ if (!bytes) throw new AttachmentNotFoundError({ ref: attachment.ref })
126
+
127
+ if (bytes.mediaType !== attachment.mediaType) {
128
+ // The declared type decides which content block is built and what the
129
+ // provider is told the bytes are. A store holding a PDF under a ref
130
+ // declared `image/png` means one of the two is wrong, and guessing
131
+ // which sends the provider bytes it cannot read while telling it
132
+ // otherwise.
133
+ throw new AttachmentMediaTypeMismatchError({
134
+ ref: attachment.ref,
135
+ declared: attachment.mediaType,
136
+ stored: bytes.mediaType,
137
+ })
138
+ }
139
+
140
+ if (attachment.kind === 'document') {
141
+ return {
142
+ type: 'document',
143
+ data: bytes.data,
144
+ mediaType: bytes.mediaType,
145
+ ...(attachment.name === undefined ? {} : { name: attachment.name }),
146
+ ...(attachment.citations === undefined ? {} : { citations: attachment.citations }),
147
+ }
148
+ }
149
+ return { type: 'image', data: bytes.data, mediaType: bytes.mediaType }
150
+ }
151
+
152
+ /**
153
+ * Resolve every stored attachment on every message.
154
+ *
155
+ * Returns the SAME array when nothing was stored, so the common case costs
156
+ * one scan and no allocation — and so a caller cannot tell resolved
157
+ * messages from unresolved ones by identity and get it wrong.
158
+ */
159
+ export async function resolveAttachments(
160
+ messages: readonly Message[],
161
+ store: AttachmentStore | undefined,
162
+ ): Promise<readonly Message[]> {
163
+ // `Message` rather than a structural constraint: only some members of
164
+ // the union carry `attachments`, and a structural bound over a union
165
+ // like that is not assignable in either direction. Naming the real type
166
+ // costs one import this module already had.
167
+ const has = (message: Message): readonly MessageAttachment[] | undefined =>
168
+ (message as { attachments?: readonly MessageAttachment[] }).attachments
169
+
170
+ if (!messages.some((m) => has(m)?.some(isStoredAttachment))) return messages
171
+
172
+ return await Promise.all(
173
+ messages.map(async (message) => {
174
+ const attachments = has(message)
175
+ if (!attachments?.some(isStoredAttachment)) return message
176
+ return {
177
+ ...message,
178
+ attachments: await Promise.all(attachments.map((a) => resolveAttachment(a, store))),
179
+ }
180
+ }),
181
+ )
182
+ }
@@ -0,0 +1,74 @@
1
+ import { mkdirSync, readFileSync, writeFileSync } from 'node:fs'
2
+ import { dirname } from 'node:path'
3
+
4
+ /**
5
+ * Where an operator's config overrides survive a process.
6
+ *
7
+ * In `store/` rather than beside the registry, and shaped like its
8
+ * neighbours, because the alternative is a second persistence mechanism in a
9
+ * tree that already has one — and two ways to write durable state is two
10
+ * places to get a path, a permission or an encoding wrong.
11
+ *
12
+ * **Synchronous, deliberately.** `ConfigScope.get()` is read on every
13
+ * reconnect attempt and inside a supervisor's backoff loop, so a config read
14
+ * cannot be a promise without making every consumer async for a value that
15
+ * is already in memory. The store is read ONCE at construction and written
16
+ * through on update, which is what makes that possible.
17
+ */
18
+
19
+ export interface ConfigOverrideStore {
20
+ /** Everything previously written, keyed by namespace. Read once. */
21
+ load(): Record<string, unknown>
22
+ /** Persist one namespace's accumulated override. */
23
+ save(namespace: string, override: unknown): void
24
+ }
25
+
26
+ /** The default: nothing survives the process, and it says so by its name. */
27
+ export class InMemoryConfigOverrideStore implements ConfigOverrideStore {
28
+ private readonly overrides: Record<string, unknown> = {}
29
+
30
+ load(): Record<string, unknown> {
31
+ return { ...this.overrides }
32
+ }
33
+
34
+ save(namespace: string, override: unknown): void {
35
+ this.overrides[namespace] = override
36
+ }
37
+ }
38
+
39
+ /**
40
+ * One JSON file, rewritten whole on every save.
41
+ *
42
+ * Whole-file rather than append-and-replay: this holds tens of small
43
+ * objects, not a log, and a rewrite is the shape a human can open and read.
44
+ * A corrupt file loads as empty rather than throwing — a config override is
45
+ * a preference, and refusing to start a run because one is unreadable would
46
+ * make a convenience into an outage.
47
+ */
48
+ export class DiskConfigOverrideStore implements ConfigOverrideStore {
49
+ private cache: Record<string, unknown> | undefined
50
+
51
+ constructor(private readonly path: string) {}
52
+
53
+ load(): Record<string, unknown> {
54
+ if (this.cache) return { ...this.cache }
55
+ try {
56
+ const parsed: unknown = JSON.parse(readFileSync(this.path, 'utf-8'))
57
+ this.cache =
58
+ typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed)
59
+ ? (parsed as Record<string, unknown>)
60
+ : {}
61
+ } catch {
62
+ this.cache = {}
63
+ }
64
+ return { ...this.cache }
65
+ }
66
+
67
+ save(namespace: string, override: unknown): void {
68
+ const current = this.load()
69
+ current[namespace] = override
70
+ this.cache = current
71
+ mkdirSync(dirname(this.path), { recursive: true })
72
+ writeFileSync(this.path, `${JSON.stringify(current, null, '\t')}\n`, 'utf-8')
73
+ }
74
+ }