@llblab/pi-kit 0.38.4 → 0.39.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 (424) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/README.md +1 -1
  3. package/node_modules/@llblab/pi-actors/AGENTS.md +108 -20
  4. package/node_modules/@llblab/pi-actors/BACKLOG.md +207 -4
  5. package/node_modules/@llblab/pi-actors/CHANGELOG.md +13 -0
  6. package/node_modules/@llblab/pi-actors/README.md +31 -1
  7. package/node_modules/@llblab/pi-actors/dist/index.js +1 -1
  8. package/node_modules/@llblab/pi-actors/dist/lib/async-runs.d.ts +37 -0
  9. package/node_modules/@llblab/pi-actors/dist/lib/async-runs.js +131 -62
  10. package/node_modules/@llblab/pi-actors/dist/lib/automatic-review-runtime.d.ts +2 -0
  11. package/node_modules/@llblab/pi-actors/dist/lib/automatic-review-runtime.js +3 -2
  12. package/node_modules/@llblab/pi-actors/dist/lib/command-templates.d.ts +37 -0
  13. package/node_modules/@llblab/pi-actors/dist/lib/command-templates.js +263 -129
  14. package/node_modules/@llblab/pi-actors/dist/lib/execution-files.d.ts +32 -0
  15. package/node_modules/@llblab/pi-actors/dist/lib/execution-files.js +128 -0
  16. package/node_modules/@llblab/pi-actors/dist/lib/execution-output.js +5 -4
  17. package/node_modules/@llblab/pi-actors/dist/lib/execution-sessions.d.ts +19 -1
  18. package/node_modules/@llblab/pi-actors/dist/lib/execution-sessions.js +62 -26
  19. package/node_modules/@llblab/pi-actors/dist/lib/execution.d.ts +4 -1
  20. package/node_modules/@llblab/pi-actors/dist/lib/execution.js +6 -1
  21. package/node_modules/@llblab/pi-actors/dist/lib/extension-runtime.d.ts +9 -2
  22. package/node_modules/@llblab/pi-actors/dist/lib/extension-runtime.js +92 -14
  23. package/node_modules/@llblab/pi-actors/dist/lib/file-state.js +21 -2
  24. package/node_modules/@llblab/pi-actors/dist/lib/inspector-command.js +2 -2
  25. package/node_modules/@llblab/pi-actors/dist/lib/inspector-overlay.d.ts +25 -7
  26. package/node_modules/@llblab/pi-actors/dist/lib/inspector-overlay.js +562 -262
  27. package/node_modules/@llblab/pi-actors/dist/lib/inspector.d.ts +20 -10
  28. package/node_modules/@llblab/pi-actors/dist/lib/inspector.js +80 -91
  29. package/node_modules/@llblab/pi-actors/dist/lib/limits.d.ts +1 -0
  30. package/node_modules/@llblab/pi-actors/dist/lib/limits.js +1 -0
  31. package/node_modules/@llblab/pi-actors/dist/lib/observability.d.ts +15 -1
  32. package/node_modules/@llblab/pi-actors/dist/lib/observability.js +216 -99
  33. package/node_modules/@llblab/pi-actors/dist/lib/pi.d.ts +5 -4
  34. package/node_modules/@llblab/pi-actors/dist/lib/pi.js +64 -10
  35. package/node_modules/@llblab/pi-actors/dist/lib/recipe-projection.d.ts +18 -0
  36. package/node_modules/@llblab/pi-actors/dist/lib/recipe-projection.js +220 -0
  37. package/node_modules/@llblab/pi-actors/dist/lib/recipes-context.d.ts +2 -0
  38. package/node_modules/@llblab/pi-actors/dist/lib/recipes-context.js +30 -6
  39. package/node_modules/@llblab/pi-actors/dist/lib/registry.js +270 -36
  40. package/node_modules/@llblab/pi-actors/dist/lib/run-delivery.d.ts +213 -5
  41. package/node_modules/@llblab/pi-actors/dist/lib/run-delivery.js +1909 -40
  42. package/node_modules/@llblab/pi-actors/dist/lib/run-supervision.d.ts +107 -0
  43. package/node_modules/@llblab/pi-actors/dist/lib/run-supervision.js +412 -0
  44. package/node_modules/@llblab/pi-actors/dist/lib/run-ui-runtime.d.ts +9 -2
  45. package/node_modules/@llblab/pi-actors/dist/lib/run-ui-runtime.js +283 -60
  46. package/node_modules/@llblab/pi-actors/dist/lib/runs-artifacts.d.ts +26 -1
  47. package/node_modules/@llblab/pi-actors/dist/lib/runs-artifacts.js +68 -2
  48. package/node_modules/@llblab/pi-actors/dist/lib/runs-context-exports.d.ts +451 -0
  49. package/node_modules/@llblab/pi-actors/dist/lib/runs-context-exports.js +2315 -0
  50. package/node_modules/@llblab/pi-actors/dist/lib/runs-context-index.d.ts +97 -0
  51. package/node_modules/@llblab/pi-actors/dist/lib/runs-context-index.js +368 -0
  52. package/node_modules/@llblab/pi-actors/dist/lib/runs-control-delivery.js +46 -7
  53. package/node_modules/@llblab/pi-actors/dist/lib/runs-control.d.ts +78 -2
  54. package/node_modules/@llblab/pi-actors/dist/lib/runs-control.js +334 -2
  55. package/node_modules/@llblab/pi-actors/dist/lib/runs-controls.js +4 -1
  56. package/node_modules/@llblab/pi-actors/dist/lib/runs-descendant-launches.d.ts +80 -0
  57. package/node_modules/@llblab/pi-actors/dist/lib/runs-descendant-launches.js +287 -0
  58. package/node_modules/@llblab/pi-actors/dist/lib/runs-execution-evidence.d.ts +110 -0
  59. package/node_modules/@llblab/pi-actors/dist/lib/runs-execution-evidence.js +282 -0
  60. package/node_modules/@llblab/pi-actors/dist/lib/runs-index.d.ts +66 -1
  61. package/node_modules/@llblab/pi-actors/dist/lib/runs-index.js +349 -13
  62. package/node_modules/@llblab/pi-actors/dist/lib/runs-native-launches.d.ts +73 -0
  63. package/node_modules/@llblab/pi-actors/dist/lib/runs-native-launches.js +227 -0
  64. package/node_modules/@llblab/pi-actors/dist/lib/runs-outcomes.d.ts +141 -0
  65. package/node_modules/@llblab/pi-actors/dist/lib/runs-outcomes.js +292 -0
  66. package/node_modules/@llblab/pi-actors/dist/lib/runs-ownership.d.ts +10 -1
  67. package/node_modules/@llblab/pi-actors/dist/lib/runs-ownership.js +36 -4
  68. package/node_modules/@llblab/pi-actors/dist/lib/runs-process-windows-mi.d.ts +46 -0
  69. package/node_modules/@llblab/pi-actors/dist/lib/runs-process-windows-mi.js +114 -0
  70. package/node_modules/@llblab/pi-actors/dist/lib/runs-process.d.ts +34 -1
  71. package/node_modules/@llblab/pi-actors/dist/lib/runs-process.js +158 -26
  72. package/node_modules/@llblab/pi-actors/dist/lib/runs-results.d.ts +116 -0
  73. package/node_modules/@llblab/pi-actors/dist/lib/runs-results.js +518 -0
  74. package/node_modules/@llblab/pi-actors/dist/lib/runs-retention.d.ts +15 -2
  75. package/node_modules/@llblab/pi-actors/dist/lib/runs-retention.js +148 -9
  76. package/node_modules/@llblab/pi-actors/dist/lib/runs-session-exports.d.ts +95 -0
  77. package/node_modules/@llblab/pi-actors/dist/lib/runs-session-exports.js +470 -0
  78. package/node_modules/@llblab/pi-actors/dist/lib/runs-snapshot.d.ts +58 -0
  79. package/node_modules/@llblab/pi-actors/dist/lib/runs-snapshot.js +92 -0
  80. package/node_modules/@llblab/pi-actors/dist/lib/runs-start.d.ts +2 -0
  81. package/node_modules/@llblab/pi-actors/dist/lib/runs-start.js +44 -3
  82. package/node_modules/@llblab/pi-actors/dist/lib/runs-status.d.ts +15 -1
  83. package/node_modules/@llblab/pi-actors/dist/lib/runs-status.js +337 -13
  84. package/node_modules/@llblab/pi-actors/dist/lib/runs-supervision.d.ts +105 -0
  85. package/node_modules/@llblab/pi-actors/dist/lib/runs-supervision.js +501 -0
  86. package/node_modules/@llblab/pi-actors/dist/lib/runs-trace.d.ts +1 -0
  87. package/node_modules/@llblab/pi-actors/dist/lib/runs-trace.js +14 -3
  88. package/node_modules/@llblab/pi-actors/dist/lib/runtime.js +22 -3
  89. package/node_modules/@llblab/pi-actors/dist/lib/session-evidence.d.ts +37 -0
  90. package/node_modules/@llblab/pi-actors/dist/lib/session-evidence.js +59 -3
  91. package/node_modules/@llblab/pi-actors/dist/lib/state-readers.d.ts +4 -1
  92. package/node_modules/@llblab/pi-actors/dist/lib/state-readers.js +14 -8
  93. package/node_modules/@llblab/pi-actors/dist/lib/temp.d.ts +2 -4
  94. package/node_modules/@llblab/pi-actors/dist/lib/temp.js +4 -56
  95. package/node_modules/@llblab/pi-actors/dist/lib/tools-access.d.ts +3 -0
  96. package/node_modules/@llblab/pi-actors/dist/lib/tools-access.js +13 -0
  97. package/node_modules/@llblab/pi-actors/dist/lib/tools-inspect.d.ts +1 -0
  98. package/node_modules/@llblab/pi-actors/dist/lib/tools-inspect.js +110 -43
  99. package/node_modules/@llblab/pi-actors/dist/lib/tools-local.d.ts +3 -0
  100. package/node_modules/@llblab/pi-actors/dist/lib/tools-local.js +18 -6
  101. package/node_modules/@llblab/pi-actors/dist/lib/tools-message.d.ts +4 -1
  102. package/node_modules/@llblab/pi-actors/dist/lib/tools-message.js +126 -31
  103. package/node_modules/@llblab/pi-actors/dist/lib/tools-response.d.ts +31 -3
  104. package/node_modules/@llblab/pi-actors/dist/lib/tools-response.js +311 -47
  105. package/node_modules/@llblab/pi-actors/dist/lib/tools-spawn.d.ts +3 -0
  106. package/node_modules/@llblab/pi-actors/dist/lib/tools-spawn.js +29 -7
  107. package/node_modules/@llblab/pi-actors/dist/lib/trace-projection.d.ts +20 -0
  108. package/node_modules/@llblab/pi-actors/dist/lib/trace-projection.js +192 -43
  109. package/node_modules/@llblab/pi-actors/dist/scripts/async-runner.mjs +272 -194
  110. package/node_modules/@llblab/pi-actors/dist/scripts/conformance.mjs +14 -2
  111. package/node_modules/@llblab/pi-actors/dist/skills/actors/SKILL.md +46 -2
  112. package/node_modules/@llblab/pi-actors/dist/skills/actors/references/diagnostics.md +40 -0
  113. package/node_modules/@llblab/pi-actors/dist/skills/actors/references/runs.md +55 -1
  114. package/node_modules/@llblab/pi-actors/docs/README.md +9 -1
  115. package/node_modules/@llblab/pi-actors/docs/actor-inspector.md +84 -15
  116. package/node_modules/@llblab/pi-actors/docs/agent-experience.md +216 -0
  117. package/node_modules/@llblab/pi-actors/docs/async-runs.md +18 -2
  118. package/node_modules/@llblab/pi-actors/docs/composition-transport.md +103 -0
  119. package/node_modules/@llblab/pi-actors/docs/coordinator-delivery.md +204 -4
  120. package/node_modules/@llblab/pi-actors/docs/inspection.md +38 -2
  121. package/node_modules/@llblab/pi-actors/docs/output-projection-map.md +130 -0
  122. package/node_modules/@llblab/pi-actors/docs/releasing.md +19 -2
  123. package/node_modules/@llblab/pi-actors/docs/run-supervision.md +1622 -0
  124. package/node_modules/@llblab/pi-actors/docs/template-recipes.md +4 -0
  125. package/node_modules/@llblab/pi-actors/docs/windows-process-observation.md +248 -0
  126. package/node_modules/@llblab/pi-actors/index.ts +1 -1
  127. package/node_modules/@llblab/pi-actors/lib/async-runs.ts +164 -73
  128. package/node_modules/@llblab/pi-actors/lib/automatic-review-runtime.ts +4 -2
  129. package/node_modules/@llblab/pi-actors/lib/command-templates.ts +287 -138
  130. package/node_modules/@llblab/pi-actors/lib/execution-files.ts +118 -0
  131. package/node_modules/@llblab/pi-actors/lib/execution-output.ts +4 -4
  132. package/node_modules/@llblab/pi-actors/lib/execution-sessions.ts +57 -27
  133. package/node_modules/@llblab/pi-actors/lib/execution.ts +8 -0
  134. package/node_modules/@llblab/pi-actors/lib/extension-runtime.ts +102 -12
  135. package/node_modules/@llblab/pi-actors/lib/file-state.ts +16 -2
  136. package/node_modules/@llblab/pi-actors/lib/inspector-command.ts +2 -2
  137. package/node_modules/@llblab/pi-actors/lib/inspector-overlay.ts +524 -261
  138. package/node_modules/@llblab/pi-actors/lib/inspector.ts +101 -130
  139. package/node_modules/@llblab/pi-actors/lib/limits.ts +1 -0
  140. package/node_modules/@llblab/pi-actors/lib/observability.ts +235 -116
  141. package/node_modules/@llblab/pi-actors/lib/pi.ts +59 -11
  142. package/node_modules/@llblab/pi-actors/lib/recipe-projection.ts +232 -0
  143. package/node_modules/@llblab/pi-actors/lib/recipes-context.ts +27 -6
  144. package/node_modules/@llblab/pi-actors/lib/registry.ts +266 -36
  145. package/node_modules/@llblab/pi-actors/lib/run-delivery.ts +1737 -49
  146. package/node_modules/@llblab/pi-actors/lib/run-supervision.ts +411 -0
  147. package/node_modules/@llblab/pi-actors/lib/run-ui-runtime.ts +237 -73
  148. package/node_modules/@llblab/pi-actors/lib/runs-artifacts.ts +73 -1
  149. package/node_modules/@llblab/pi-actors/lib/runs-context-exports.ts +1871 -0
  150. package/node_modules/@llblab/pi-actors/lib/runs-context-index.ts +372 -0
  151. package/node_modules/@llblab/pi-actors/lib/runs-control-delivery.ts +36 -18
  152. package/node_modules/@llblab/pi-actors/lib/runs-control.ts +297 -1
  153. package/node_modules/@llblab/pi-actors/lib/runs-controls.ts +3 -1
  154. package/node_modules/@llblab/pi-actors/lib/runs-descendant-launches.ts +338 -0
  155. package/node_modules/@llblab/pi-actors/lib/runs-execution-evidence.ts +302 -0
  156. package/node_modules/@llblab/pi-actors/lib/runs-index.ts +345 -17
  157. package/node_modules/@llblab/pi-actors/lib/runs-native-launches.ts +270 -0
  158. package/node_modules/@llblab/pi-actors/lib/runs-outcomes.ts +377 -0
  159. package/node_modules/@llblab/pi-actors/lib/runs-ownership.ts +37 -4
  160. package/node_modules/@llblab/pi-actors/lib/runs-process-windows-mi.ts +113 -0
  161. package/node_modules/@llblab/pi-actors/lib/runs-process.ts +210 -34
  162. package/node_modules/@llblab/pi-actors/lib/runs-results.ts +601 -0
  163. package/node_modules/@llblab/pi-actors/lib/runs-retention.ts +134 -10
  164. package/node_modules/@llblab/pi-actors/lib/runs-session-exports.ts +406 -0
  165. package/node_modules/@llblab/pi-actors/lib/runs-snapshot.ts +143 -0
  166. package/node_modules/@llblab/pi-actors/lib/runs-start.ts +44 -2
  167. package/node_modules/@llblab/pi-actors/lib/runs-status.ts +252 -10
  168. package/node_modules/@llblab/pi-actors/lib/runs-supervision.ts +394 -0
  169. package/node_modules/@llblab/pi-actors/lib/runs-trace.ts +14 -3
  170. package/node_modules/@llblab/pi-actors/lib/runtime.ts +22 -3
  171. package/node_modules/@llblab/pi-actors/lib/session-evidence.ts +76 -4
  172. package/node_modules/@llblab/pi-actors/lib/state-readers.ts +16 -7
  173. package/node_modules/@llblab/pi-actors/lib/temp.ts +3 -56
  174. package/node_modules/@llblab/pi-actors/lib/tools-access.ts +13 -0
  175. package/node_modules/@llblab/pi-actors/lib/tools-inspect.ts +110 -51
  176. package/node_modules/@llblab/pi-actors/lib/tools-local.ts +37 -24
  177. package/node_modules/@llblab/pi-actors/lib/tools-message.ts +120 -37
  178. package/node_modules/@llblab/pi-actors/lib/tools-response.ts +273 -50
  179. package/node_modules/@llblab/pi-actors/lib/tools-spawn.ts +31 -10
  180. package/node_modules/@llblab/pi-actors/lib/trace-projection.ts +165 -42
  181. package/node_modules/@llblab/pi-actors/package.json +10 -6
  182. package/node_modules/@llblab/pi-actors/scripts/async-runner.mjs +272 -194
  183. package/node_modules/@llblab/pi-actors/scripts/conformance.mjs +14 -2
  184. package/node_modules/@llblab/pi-actors/skills/actors/SKILL.md +46 -2
  185. package/node_modules/@llblab/pi-actors/skills/actors/references/diagnostics.md +40 -0
  186. package/node_modules/@llblab/pi-actors/skills/actors/references/runs.md +55 -1
  187. package/node_modules/yaml/LICENSE +13 -0
  188. package/node_modules/yaml/README.md +172 -0
  189. package/node_modules/yaml/bin.mjs +11 -0
  190. package/node_modules/yaml/browser/dist/compose/compose-collection.js +88 -0
  191. package/node_modules/yaml/browser/dist/compose/compose-doc.js +43 -0
  192. package/node_modules/yaml/browser/dist/compose/compose-node.js +109 -0
  193. package/node_modules/yaml/browser/dist/compose/compose-scalar.js +86 -0
  194. package/node_modules/yaml/browser/dist/compose/composer.js +219 -0
  195. package/node_modules/yaml/browser/dist/compose/resolve-block-map.js +115 -0
  196. package/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +198 -0
  197. package/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +49 -0
  198. package/node_modules/yaml/browser/dist/compose/resolve-end.js +37 -0
  199. package/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +207 -0
  200. package/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +225 -0
  201. package/node_modules/yaml/browser/dist/compose/resolve-props.js +146 -0
  202. package/node_modules/yaml/browser/dist/compose/util-contains-newline.js +34 -0
  203. package/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +26 -0
  204. package/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +15 -0
  205. package/node_modules/yaml/browser/dist/compose/util-map-includes.js +13 -0
  206. package/node_modules/yaml/browser/dist/doc/Document.js +335 -0
  207. package/node_modules/yaml/browser/dist/doc/anchors.js +71 -0
  208. package/node_modules/yaml/browser/dist/doc/applyReviver.js +55 -0
  209. package/node_modules/yaml/browser/dist/doc/createNode.js +88 -0
  210. package/node_modules/yaml/browser/dist/doc/directives.js +176 -0
  211. package/node_modules/yaml/browser/dist/errors.js +57 -0
  212. package/node_modules/yaml/browser/dist/index.js +17 -0
  213. package/node_modules/yaml/browser/dist/log.js +11 -0
  214. package/node_modules/yaml/browser/dist/nodes/Alias.js +116 -0
  215. package/node_modules/yaml/browser/dist/nodes/Collection.js +147 -0
  216. package/node_modules/yaml/browser/dist/nodes/Node.js +38 -0
  217. package/node_modules/yaml/browser/dist/nodes/Pair.js +36 -0
  218. package/node_modules/yaml/browser/dist/nodes/Scalar.js +24 -0
  219. package/node_modules/yaml/browser/dist/nodes/YAMLMap.js +144 -0
  220. package/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +113 -0
  221. package/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +63 -0
  222. package/node_modules/yaml/browser/dist/nodes/identity.js +36 -0
  223. package/node_modules/yaml/browser/dist/nodes/toJS.js +37 -0
  224. package/node_modules/yaml/browser/dist/parse/cst-scalar.js +214 -0
  225. package/node_modules/yaml/browser/dist/parse/cst-stringify.js +61 -0
  226. package/node_modules/yaml/browser/dist/parse/cst-visit.js +97 -0
  227. package/node_modules/yaml/browser/dist/parse/cst.js +98 -0
  228. package/node_modules/yaml/browser/dist/parse/lexer.js +721 -0
  229. package/node_modules/yaml/browser/dist/parse/line-counter.js +39 -0
  230. package/node_modules/yaml/browser/dist/parse/parser.js +975 -0
  231. package/node_modules/yaml/browser/dist/public-api.js +102 -0
  232. package/node_modules/yaml/browser/dist/schema/Schema.js +37 -0
  233. package/node_modules/yaml/browser/dist/schema/common/map.js +17 -0
  234. package/node_modules/yaml/browser/dist/schema/common/null.js +15 -0
  235. package/node_modules/yaml/browser/dist/schema/common/seq.js +17 -0
  236. package/node_modules/yaml/browser/dist/schema/common/string.js +14 -0
  237. package/node_modules/yaml/browser/dist/schema/core/bool.js +19 -0
  238. package/node_modules/yaml/browser/dist/schema/core/float.js +43 -0
  239. package/node_modules/yaml/browser/dist/schema/core/int.js +38 -0
  240. package/node_modules/yaml/browser/dist/schema/core/schema.js +23 -0
  241. package/node_modules/yaml/browser/dist/schema/json/schema.js +62 -0
  242. package/node_modules/yaml/browser/dist/schema/tags.js +96 -0
  243. package/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +58 -0
  244. package/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js +26 -0
  245. package/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js +46 -0
  246. package/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js +71 -0
  247. package/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js +67 -0
  248. package/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +74 -0
  249. package/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +78 -0
  250. package/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +39 -0
  251. package/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +93 -0
  252. package/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +101 -0
  253. package/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +146 -0
  254. package/node_modules/yaml/browser/dist/stringify/stringify.js +129 -0
  255. package/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +153 -0
  256. package/node_modules/yaml/browser/dist/stringify/stringifyComment.js +20 -0
  257. package/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +85 -0
  258. package/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +25 -0
  259. package/node_modules/yaml/browser/dist/stringify/stringifyPair.js +150 -0
  260. package/node_modules/yaml/browser/dist/stringify/stringifyString.js +336 -0
  261. package/node_modules/yaml/browser/dist/util.js +11 -0
  262. package/node_modules/yaml/browser/dist/visit.js +233 -0
  263. package/node_modules/yaml/browser/index.js +5 -0
  264. package/node_modules/yaml/browser/package.json +3 -0
  265. package/node_modules/yaml/dist/cli.d.ts +8 -0
  266. package/node_modules/yaml/dist/cli.mjs +201 -0
  267. package/node_modules/yaml/dist/compose/compose-collection.d.ts +11 -0
  268. package/node_modules/yaml/dist/compose/compose-collection.js +90 -0
  269. package/node_modules/yaml/dist/compose/compose-doc.d.ts +7 -0
  270. package/node_modules/yaml/dist/compose/compose-doc.js +45 -0
  271. package/node_modules/yaml/dist/compose/compose-node.d.ts +29 -0
  272. package/node_modules/yaml/dist/compose/compose-node.js +112 -0
  273. package/node_modules/yaml/dist/compose/compose-scalar.d.ts +5 -0
  274. package/node_modules/yaml/dist/compose/compose-scalar.js +88 -0
  275. package/node_modules/yaml/dist/compose/composer.d.ts +63 -0
  276. package/node_modules/yaml/dist/compose/composer.js +224 -0
  277. package/node_modules/yaml/dist/compose/resolve-block-map.d.ts +6 -0
  278. package/node_modules/yaml/dist/compose/resolve-block-map.js +117 -0
  279. package/node_modules/yaml/dist/compose/resolve-block-scalar.d.ts +11 -0
  280. package/node_modules/yaml/dist/compose/resolve-block-scalar.js +200 -0
  281. package/node_modules/yaml/dist/compose/resolve-block-seq.d.ts +6 -0
  282. package/node_modules/yaml/dist/compose/resolve-block-seq.js +51 -0
  283. package/node_modules/yaml/dist/compose/resolve-end.d.ts +6 -0
  284. package/node_modules/yaml/dist/compose/resolve-end.js +39 -0
  285. package/node_modules/yaml/dist/compose/resolve-flow-collection.d.ts +7 -0
  286. package/node_modules/yaml/dist/compose/resolve-flow-collection.js +209 -0
  287. package/node_modules/yaml/dist/compose/resolve-flow-scalar.d.ts +10 -0
  288. package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +227 -0
  289. package/node_modules/yaml/dist/compose/resolve-props.d.ts +23 -0
  290. package/node_modules/yaml/dist/compose/resolve-props.js +148 -0
  291. package/node_modules/yaml/dist/compose/util-contains-newline.d.ts +2 -0
  292. package/node_modules/yaml/dist/compose/util-contains-newline.js +36 -0
  293. package/node_modules/yaml/dist/compose/util-empty-scalar-position.d.ts +2 -0
  294. package/node_modules/yaml/dist/compose/util-empty-scalar-position.js +28 -0
  295. package/node_modules/yaml/dist/compose/util-flow-indent-check.d.ts +3 -0
  296. package/node_modules/yaml/dist/compose/util-flow-indent-check.js +17 -0
  297. package/node_modules/yaml/dist/compose/util-map-includes.d.ts +4 -0
  298. package/node_modules/yaml/dist/compose/util-map-includes.js +15 -0
  299. package/node_modules/yaml/dist/doc/Document.d.ts +141 -0
  300. package/node_modules/yaml/dist/doc/Document.js +337 -0
  301. package/node_modules/yaml/dist/doc/anchors.d.ts +24 -0
  302. package/node_modules/yaml/dist/doc/anchors.js +76 -0
  303. package/node_modules/yaml/dist/doc/applyReviver.d.ts +9 -0
  304. package/node_modules/yaml/dist/doc/applyReviver.js +57 -0
  305. package/node_modules/yaml/dist/doc/createNode.d.ts +17 -0
  306. package/node_modules/yaml/dist/doc/createNode.js +90 -0
  307. package/node_modules/yaml/dist/doc/directives.d.ts +49 -0
  308. package/node_modules/yaml/dist/doc/directives.js +178 -0
  309. package/node_modules/yaml/dist/errors.d.ts +21 -0
  310. package/node_modules/yaml/dist/errors.js +62 -0
  311. package/node_modules/yaml/dist/index.d.ts +25 -0
  312. package/node_modules/yaml/dist/index.js +50 -0
  313. package/node_modules/yaml/dist/log.d.ts +3 -0
  314. package/node_modules/yaml/dist/log.js +19 -0
  315. package/node_modules/yaml/dist/nodes/Alias.d.ts +29 -0
  316. package/node_modules/yaml/dist/nodes/Alias.js +118 -0
  317. package/node_modules/yaml/dist/nodes/Collection.d.ts +73 -0
  318. package/node_modules/yaml/dist/nodes/Collection.js +151 -0
  319. package/node_modules/yaml/dist/nodes/Node.d.ts +53 -0
  320. package/node_modules/yaml/dist/nodes/Node.js +40 -0
  321. package/node_modules/yaml/dist/nodes/Pair.d.ts +22 -0
  322. package/node_modules/yaml/dist/nodes/Pair.js +39 -0
  323. package/node_modules/yaml/dist/nodes/Scalar.d.ts +47 -0
  324. package/node_modules/yaml/dist/nodes/Scalar.js +27 -0
  325. package/node_modules/yaml/dist/nodes/YAMLMap.d.ts +53 -0
  326. package/node_modules/yaml/dist/nodes/YAMLMap.js +147 -0
  327. package/node_modules/yaml/dist/nodes/YAMLSeq.d.ts +60 -0
  328. package/node_modules/yaml/dist/nodes/YAMLSeq.js +115 -0
  329. package/node_modules/yaml/dist/nodes/addPairToJSMap.d.ts +4 -0
  330. package/node_modules/yaml/dist/nodes/addPairToJSMap.js +65 -0
  331. package/node_modules/yaml/dist/nodes/identity.d.ts +23 -0
  332. package/node_modules/yaml/dist/nodes/identity.js +53 -0
  333. package/node_modules/yaml/dist/nodes/toJS.d.ts +29 -0
  334. package/node_modules/yaml/dist/nodes/toJS.js +39 -0
  335. package/node_modules/yaml/dist/options.d.ts +350 -0
  336. package/node_modules/yaml/dist/parse/cst-scalar.d.ts +64 -0
  337. package/node_modules/yaml/dist/parse/cst-scalar.js +218 -0
  338. package/node_modules/yaml/dist/parse/cst-stringify.d.ts +8 -0
  339. package/node_modules/yaml/dist/parse/cst-stringify.js +63 -0
  340. package/node_modules/yaml/dist/parse/cst-visit.d.ts +39 -0
  341. package/node_modules/yaml/dist/parse/cst-visit.js +99 -0
  342. package/node_modules/yaml/dist/parse/cst.d.ts +109 -0
  343. package/node_modules/yaml/dist/parse/cst.js +112 -0
  344. package/node_modules/yaml/dist/parse/lexer.d.ts +87 -0
  345. package/node_modules/yaml/dist/parse/lexer.js +723 -0
  346. package/node_modules/yaml/dist/parse/line-counter.d.ts +22 -0
  347. package/node_modules/yaml/dist/parse/line-counter.js +41 -0
  348. package/node_modules/yaml/dist/parse/parser.d.ts +84 -0
  349. package/node_modules/yaml/dist/parse/parser.js +980 -0
  350. package/node_modules/yaml/dist/public-api.d.ts +44 -0
  351. package/node_modules/yaml/dist/public-api.js +107 -0
  352. package/node_modules/yaml/dist/schema/Schema.d.ts +17 -0
  353. package/node_modules/yaml/dist/schema/Schema.js +39 -0
  354. package/node_modules/yaml/dist/schema/common/map.d.ts +2 -0
  355. package/node_modules/yaml/dist/schema/common/map.js +19 -0
  356. package/node_modules/yaml/dist/schema/common/null.d.ts +4 -0
  357. package/node_modules/yaml/dist/schema/common/null.js +17 -0
  358. package/node_modules/yaml/dist/schema/common/seq.d.ts +2 -0
  359. package/node_modules/yaml/dist/schema/common/seq.js +19 -0
  360. package/node_modules/yaml/dist/schema/common/string.d.ts +2 -0
  361. package/node_modules/yaml/dist/schema/common/string.js +16 -0
  362. package/node_modules/yaml/dist/schema/core/bool.d.ts +4 -0
  363. package/node_modules/yaml/dist/schema/core/bool.js +21 -0
  364. package/node_modules/yaml/dist/schema/core/float.d.ts +4 -0
  365. package/node_modules/yaml/dist/schema/core/float.js +47 -0
  366. package/node_modules/yaml/dist/schema/core/int.d.ts +4 -0
  367. package/node_modules/yaml/dist/schema/core/int.js +42 -0
  368. package/node_modules/yaml/dist/schema/core/schema.d.ts +1 -0
  369. package/node_modules/yaml/dist/schema/core/schema.js +25 -0
  370. package/node_modules/yaml/dist/schema/json/schema.d.ts +2 -0
  371. package/node_modules/yaml/dist/schema/json/schema.js +64 -0
  372. package/node_modules/yaml/dist/schema/json-schema.d.ts +69 -0
  373. package/node_modules/yaml/dist/schema/tags.d.ts +48 -0
  374. package/node_modules/yaml/dist/schema/tags.js +99 -0
  375. package/node_modules/yaml/dist/schema/types.d.ts +92 -0
  376. package/node_modules/yaml/dist/schema/yaml-1.1/binary.d.ts +2 -0
  377. package/node_modules/yaml/dist/schema/yaml-1.1/binary.js +70 -0
  378. package/node_modules/yaml/dist/schema/yaml-1.1/bool.d.ts +7 -0
  379. package/node_modules/yaml/dist/schema/yaml-1.1/bool.js +29 -0
  380. package/node_modules/yaml/dist/schema/yaml-1.1/float.d.ts +4 -0
  381. package/node_modules/yaml/dist/schema/yaml-1.1/float.js +50 -0
  382. package/node_modules/yaml/dist/schema/yaml-1.1/int.d.ts +5 -0
  383. package/node_modules/yaml/dist/schema/yaml-1.1/int.js +76 -0
  384. package/node_modules/yaml/dist/schema/yaml-1.1/merge.d.ts +9 -0
  385. package/node_modules/yaml/dist/schema/yaml-1.1/merge.js +71 -0
  386. package/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +22 -0
  387. package/node_modules/yaml/dist/schema/yaml-1.1/omap.js +77 -0
  388. package/node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts +10 -0
  389. package/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +82 -0
  390. package/node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts +1 -0
  391. package/node_modules/yaml/dist/schema/yaml-1.1/schema.js +41 -0
  392. package/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts +28 -0
  393. package/node_modules/yaml/dist/schema/yaml-1.1/set.js +96 -0
  394. package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.d.ts +6 -0
  395. package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +105 -0
  396. package/node_modules/yaml/dist/stringify/foldFlowLines.d.ts +34 -0
  397. package/node_modules/yaml/dist/stringify/foldFlowLines.js +151 -0
  398. package/node_modules/yaml/dist/stringify/stringify.d.ts +21 -0
  399. package/node_modules/yaml/dist/stringify/stringify.js +132 -0
  400. package/node_modules/yaml/dist/stringify/stringifyCollection.d.ts +17 -0
  401. package/node_modules/yaml/dist/stringify/stringifyCollection.js +155 -0
  402. package/node_modules/yaml/dist/stringify/stringifyComment.d.ts +10 -0
  403. package/node_modules/yaml/dist/stringify/stringifyComment.js +24 -0
  404. package/node_modules/yaml/dist/stringify/stringifyDocument.d.ts +4 -0
  405. package/node_modules/yaml/dist/stringify/stringifyDocument.js +87 -0
  406. package/node_modules/yaml/dist/stringify/stringifyNumber.d.ts +2 -0
  407. package/node_modules/yaml/dist/stringify/stringifyNumber.js +27 -0
  408. package/node_modules/yaml/dist/stringify/stringifyPair.d.ts +3 -0
  409. package/node_modules/yaml/dist/stringify/stringifyPair.js +152 -0
  410. package/node_modules/yaml/dist/stringify/stringifyString.d.ts +9 -0
  411. package/node_modules/yaml/dist/stringify/stringifyString.js +338 -0
  412. package/node_modules/yaml/dist/test-events.d.ts +4 -0
  413. package/node_modules/yaml/dist/test-events.js +134 -0
  414. package/node_modules/yaml/dist/util.d.ts +16 -0
  415. package/node_modules/yaml/dist/util.js +28 -0
  416. package/node_modules/yaml/dist/visit.d.ts +102 -0
  417. package/node_modules/yaml/dist/visit.js +236 -0
  418. package/node_modules/yaml/package.json +97 -0
  419. package/node_modules/yaml/util.js +2 -0
  420. package/package.json +2 -2
  421. package/node_modules/@llblab/pi-actors/banner.jpg +0 -0
  422. package/node_modules/@llblab/pi-actors/dist/lib/inspector-actions.d.ts +0 -16
  423. package/node_modules/@llblab/pi-actors/dist/lib/inspector-actions.js +0 -57
  424. package/node_modules/@llblab/pi-actors/lib/inspector-actions.ts +0 -79
@@ -16,11 +16,13 @@ import {
16
16
  writeTextAtomic,
17
17
  } from "./file-state.ts";
18
18
  import * as Identity from "./identity.ts";
19
+ import * as Limits from "./limits.ts";
19
20
  import * as Paths from "./paths.ts";
20
21
  import * as RecipesContext from "./recipes-context.ts";
21
22
  import * as RecipesDiscovery from "./recipes-discovery.ts";
22
23
  import * as RecipesReferences from "./recipes-references.ts";
23
24
  import * as Schema from "./schema.ts";
25
+ import * as ToolsResponse from "./tools-response.ts";
24
26
 
25
27
  export interface RegisterToolInput {
26
28
  name?: string;
@@ -89,17 +91,32 @@ function textContent(text: string) {
89
91
  return { type: "text" as const, text };
90
92
  }
91
93
 
94
+ function registryListText(rows: readonly string[]): string {
95
+ const coverage = (shown: number, reason?: string) => "\n- registered_tools_coverage:" +
96
+ (reason ? `\n - reason: ${reason}` : "") + `\n - shown: ${shown}\n - omitted: ${rows.length - shown}\n - total: ${rows.length}`;
97
+ const malformed = rows.some(row => !row.isWellFormed());
98
+ if (!malformed) {
99
+ // Rows already contain the old compiler-owned bullet and selected key coercion.
100
+ const body = rows.length ? "- registered_tools:\n" + rows.map(row => " " + row.replaceAll(/\r\n|\r|\n/gu, newline => newline + " ")).join("\n")
101
+ : "- registered_tools: none";
102
+ const complete = body + coverage(rows.length);
103
+ if (Buffer.byteLength(complete) <= Limits.RUN_DELIVERY_MODEL_MAX_BYTES - 1) return complete;
104
+ }
105
+ return `- registered_tools: [${malformed ? "unavailable" : "omitted"}]` + coverage(0, malformed ? "malformed_selected_text" : "response_too_large");
106
+ }
107
+
92
108
  function listTools<TContext>(
93
109
  deps: RegisterToolRuntimeDeps<TContext>,
94
110
  ): RegisterToolResult {
95
111
  const names = [...deps.getTools().keys()].sort();
112
+ const rows = names.length > 0 ? names.map((name) => `- ${name}`) : [];
113
+ // Retain the original conditional map/join observations before read-time projection.
114
+ void (names.length > 0 ? `Registered tools:\n${rows.join("\n")}` : "No registered tools.");
96
115
  return {
97
116
  content: [
98
117
  textContent(
99
118
  ExecutionOutput.formatToolText(
100
- names.length > 0
101
- ? `Registered tools:\n${names.map((name) => `- ${name}`).join("\n")}`
102
- : "No registered tools.",
119
+ registryListText(rows),
103
120
  ),
104
121
  ),
105
122
  ],
@@ -155,6 +172,133 @@ function registrationNextActions(
155
172
  ];
156
173
  }
157
174
 
175
+ /** Read-time text only: callers supply the original post-activation selections, not live ports. */
176
+ function registrationReceiptText(data: {
177
+ tool: string; result: "registered" | "updated" | "persisted"; source: string; callable: boolean;
178
+ boundary?: string; required: readonly unknown[]; optional: readonly unknown[];
179
+ warnings: readonly unknown[]; next: string;
180
+ }): string {
181
+ const field = ToolsResponse.formatMarkdownField;
182
+ const omission = (key: string, count: number, malformed: boolean) =>
183
+ `- ${key}: [${malformed ? "unavailable" : "omitted"}]\n- ${key}_omission:\n - reason: ${malformed ? "malformed_selected_text" : "response_too_large"}\n - shown: 0\n - omitted: ${count}\n - total: ${count}`;
184
+ const part = (full: string, omitted: string) => ({ full, selected: Buffer.byteLength(full) <= Buffer.byteLength(omitted) ? full : omitted });
185
+ const scalar = (key: string, value: string, literal = false) => {
186
+ const wellFormed = value.isWellFormed();
187
+ const omitted = omission(key, 1, !wellFormed);
188
+ return part(wellFormed ? field(key, literal ? ToolsResponse.formatLiteralBlock(value) : value) : omitted, omitted);
189
+ };
190
+ const sequence = (key: string, values: readonly unknown[]) => {
191
+ const rows: string[] = [];
192
+ let malformed = false;
193
+ for (let index = 0; index < values.length; index++) {
194
+ const value = values[index];
195
+ if (typeof value !== "string" || !value.isWellFormed()) { malformed = true; break; }
196
+ rows.push(" - " + value.replaceAll(/\r\n|\r|\n/gu, newline => newline + " "));
197
+ }
198
+ const omitted = omission(key, values.length, malformed);
199
+ return part(malformed ? omitted : rows.length ? `- ${key}:\n${rows.join("\n")}` : field(key, "none"), omitted);
200
+ };
201
+ const tool = scalar("tool", data.tool);
202
+ const source = scalar("source", data.source, data.source !== "template");
203
+ const required = sequence("required_args", data.required), optional = sequence("optional_args", data.optional);
204
+ const warnings = data.warnings.length ? sequence("warnings", data.warnings) : undefined;
205
+ const nextWellFormed = data.next.isWellFormed();
206
+ const omittedNext = omission("next_action", 1, !nextWellFormed);
207
+ // This producer knows only its existing status hint; invocation advice stays opaque.
208
+ const next = part(nextWellFormed
209
+ ? data.callable ? field("instruction", data.next) : ToolsResponse.formatInspectNextAction(`tool:${data.tool}`, "status")
210
+ : omittedNext, omittedNext);
211
+ const render = () => [tool.selected, field("result", data.result), source.selected, field("callable_now", data.callable ? "true" : "false"),
212
+ ...(data.boundary === undefined ? [] : [field("activation_boundary", data.boundary)]), required.selected, optional.selected,
213
+ ...(warnings ? [warnings.selected] : []), next.selected].join("\n");
214
+ // Preserve complete safety notes before large argument lists; all seeds are monotone.
215
+ for (const current of [...(warnings ? [warnings] : []), tool, source, next, required, optional]) {
216
+ if (current.selected === current.full) continue;
217
+ const previous = current.selected;
218
+ current.selected = current.full;
219
+ if (Buffer.byteLength(render()) > Limits.RUN_DELIVERY_MODEL_MAX_BYTES - 1) current.selected = previous;
220
+ }
221
+ return render();
222
+ }
223
+
224
+ function registryNoticeText(kind: "activated" | "promoted" | "deleted", name: string): string {
225
+ const report = { activated: "Tool activated", promoted: "Promoted draft recipe", deleted: "Deleted tool" }[kind];
226
+ const selected = name.isWellFormed() ? ToolsResponse.formatMarkdownField("tool", name)
227
+ : "- tool: [unavailable]\n- tool_omission:\n - reason: malformed_selected_text\n - shown: 0\n - omitted: 1\n - total: 1";
228
+ return ToolsResponse.formatMarkdownField("report", report) + "\n" + selected;
229
+ }
230
+
231
+ function registrationTransactionFailureText(stage: string, generation: string, summary: string, error: string): string {
232
+ const field = ToolsResponse.formatMarkdownField;
233
+ const part = (key: string, value: string) => {
234
+ const wellFormed = value.isWellFormed();
235
+ const omitted = `- ${key}: [${wellFormed ? "omitted" : "unavailable"}]\n- ${key}_omission:\n - reason: ${wellFormed ? "response_too_large" : "malformed_selected_text"}\n - shown: 0\n - omitted: 1\n - total: 1`;
236
+ const full = wellFormed ? field(key, value) : omitted;
237
+ return { full, selected: Buffer.byteLength(full) <= Buffer.byteLength(omitted) ? full : omitted };
238
+ };
239
+ const selectedGeneration = part("resolution_generation", generation);
240
+ const selectedSummary = part("active_skills_summary", summary);
241
+ const selectedError = part("error", error);
242
+ const render = () => [field("result", "Tool registration transaction failed."), field("stage", stage),
243
+ selectedGeneration.selected, selectedSummary.selected, selectedError.selected].join("\n");
244
+ // Keep a fitting surfaced error before large optional resolution metadata.
245
+ for (const current of [selectedError, selectedGeneration, selectedSummary]) {
246
+ if (current.selected === current.full) continue;
247
+ const previous = current.selected;
248
+ current.selected = current.full;
249
+ if (Buffer.byteLength(render()) > Limits.RUN_DELIVERY_MODEL_MAX_BYTES - 1) current.selected = previous;
250
+ }
251
+ return render();
252
+ }
253
+
254
+ function candidateAdmissionFailureText(data: { kind: "source"; source: string; diagnostics: string; summary: string; instruction: string } | { kind: "recipe"; diagnostics: string }): string {
255
+ const field = ToolsResponse.formatMarkdownField;
256
+ const part = (key: string, value: string, literal = false) => {
257
+ const wellFormed = value.isWellFormed();
258
+ const omitted = `- ${key}: [${wellFormed ? "omitted" : "unavailable"}]\n- ${key}_omission:\n - reason: ${wellFormed ? "response_too_large" : "malformed_selected_text"}\n - shown: 0\n - omitted: 1\n - total: 1`;
259
+ const full = wellFormed ? field(key, literal ? ToolsResponse.formatLiteralBlock(value) : value) : omitted;
260
+ return { full, selected: Buffer.byteLength(full) <= Buffer.byteLength(omitted) ? full : omitted };
261
+ };
262
+ const diagnostics = part("diagnostics_summary", data.diagnostics);
263
+ const source = data.kind === "source" ? part("source", data.source, true) : undefined;
264
+ const summary = data.kind === "source" ? part("active_skills_summary", data.summary) : undefined;
265
+ const instruction = data.kind === "source" ? part("instruction", data.instruction) : undefined;
266
+ const render = () => [field("field", "recipe"), ...(source ? [source.selected] : []),
267
+ field("result", data.kind === "source" ? "Recipe source validation failed." : "Tool recipe validation failed."),
268
+ diagnostics.selected, ...(summary ? [summary.selected] : []), ...(instruction ? [instruction.selected] : [])].join("\n");
269
+ // Preserve fitting diagnostics before large optional source/context/advice fields.
270
+ for (const current of [diagnostics, source, summary, instruction]) {
271
+ if (!current || current.selected === current.full) continue;
272
+ const previous = current.selected;
273
+ current.selected = current.full;
274
+ if (Buffer.byteLength(render()) > Limits.RUN_DELIVERY_MODEL_MAX_BYTES - 1) current.selected = previous;
275
+ }
276
+ return render();
277
+ }
278
+
279
+ function sourceNormalizationFailureText(source: string, reason: string, summary: string, instruction: string): string {
280
+ const field = ToolsResponse.formatMarkdownField;
281
+ const part = (key: string, value: string, literal = false) => {
282
+ const wellFormed = value.isWellFormed();
283
+ const omitted = `- ${key}: [${wellFormed ? "omitted" : "unavailable"}]\n- ${key}_omission:\n - reason: ${wellFormed ? "response_too_large" : "malformed_selected_text"}\n - shown: 0\n - omitted: 1\n - total: 1`;
284
+ const full = wellFormed ? field(key, literal ? ToolsResponse.formatLiteralBlock(value) : value) : omitted;
285
+ return { full, selected: Buffer.byteLength(full) <= Buffer.byteLength(omitted) ? full : omitted };
286
+ };
287
+ const selectedSource = part("source", source, true);
288
+ const selectedReason = part("reason", reason);
289
+ const selectedSummary = part("active_skills_summary", summary);
290
+ const selectedInstruction = part("instruction", instruction);
291
+ const render = () => [field("field", "from"), selectedSource.selected, field("result", "Recipe source is invalid."),
292
+ selectedReason.selected, selectedSummary.selected, selectedInstruction.selected].join("\n");
293
+ for (const current of [selectedSource, selectedReason, selectedSummary, selectedInstruction]) {
294
+ if (current.selected === current.full) continue;
295
+ const previous = current.selected;
296
+ current.selected = current.full;
297
+ if (Buffer.byteLength(render()) > Limits.RUN_DELIVERY_MODEL_MAX_BYTES - 1) current.selected = previous;
298
+ }
299
+ return render();
300
+ }
301
+
158
302
  function activeSkillSummary(
159
303
  resolutionContext: RecipesContext.RecipeResolutionContext,
160
304
  ): string {
@@ -168,6 +312,19 @@ function activeSkillSummary(
168
312
  return names.length > 0 ? names.join(", ") : "<none>";
169
313
  }
170
314
 
315
+ function draftPathFailureText(kind: "root" | "missing", reference: string): string {
316
+ const key = kind === "root" ? "allowed_root" : "path";
317
+ const render = (selected: string) => "- field: draft\n" + selected + (kind === "root"
318
+ ? "\n- result: Draft must be under the allowed root.\n- instruction: Use inspect target=recipes view=summary to list drafts."
319
+ : "\n- result: Draft not found.");
320
+ const wellFormed = reference.isWellFormed();
321
+ if (wellFormed) {
322
+ const complete = render(ToolsResponse.formatMarkdownField(key, ToolsResponse.formatLiteralBlock(reference)));
323
+ if (Buffer.byteLength(complete) <= Limits.RUN_DELIVERY_MODEL_MAX_BYTES - 1) return complete;
324
+ }
325
+ return render(`- ${key}: [${wellFormed ? "omitted" : "unavailable"}]\n- ${key}_omission:\n - reason: ${wellFormed ? "response_too_large" : "malformed_selected_text"}\n - shown: 0\n - omitted: 1\n - total: 1`);
326
+ }
327
+
171
328
  function assertDraftPath<TContext>(
172
329
  deps: RegisterToolRuntimeDeps<TContext>,
173
330
  draft: string,
@@ -182,16 +339,60 @@ function assertDraftPath<TContext>(
182
339
  ) {
183
340
  throw new Error(
184
341
  ExecutionOutput.formatToolText(
185
- `Draft must be under ${draftRoot}. Use inspect target=recipes view=summary to list drafts.`,
342
+ draftPathFailureText("root", `${draftRoot}`),
186
343
  ),
187
344
  );
188
345
  }
189
346
  if (!existsSync(path)) {
190
- throw new Error(ExecutionOutput.formatToolText(`Draft not found: ${path}`));
347
+ throw new Error(ExecutionOutput.formatToolText(draftPathFailureText("missing", `${path}`)));
191
348
  }
192
349
  return path;
193
350
  }
194
351
 
352
+ function draftReceiptText(result: "updated" | "registered", tool: string, callable: string, next: string): string {
353
+ const field = ToolsResponse.formatMarkdownField;
354
+ const part = (key: string, value: string, rendered: string) => {
355
+ const wellFormed = value.isWellFormed();
356
+ const omitted = `- ${key}: [${wellFormed ? "omitted" : "unavailable"}]\n- ${key}_omission:\n - reason: ${wellFormed ? "response_too_large" : "malformed_selected_text"}\n - shown: 0\n - omitted: 1\n - total: 1`;
357
+ const full = wellFormed ? rendered : omitted;
358
+ return { full, selected: Buffer.byteLength(full) <= Buffer.byteLength(omitted) ? full : omitted };
359
+ };
360
+ const identity = part("tool", tool, field("tool", tool));
361
+ const flag = part("callable_now", callable, field("callable_now", callable));
362
+ // Only this producer's exact canonical read-only status hint is typed, never body advice.
363
+ const status = /^inspect target=(tool:[a-z][a-z0-9_]{0,63}) view=status$/u.exec(next);
364
+ const hint = part("next_action", next, status ? ToolsResponse.formatInspectNextAction(status[1], "status") : field("instruction", next));
365
+ const render = () => [identity.selected, field("result", result), field("source", "draft"), flag.selected, hint.selected].join("\n");
366
+ for (const current of [identity, flag, hint]) {
367
+ if (current.selected === current.full) continue;
368
+ const previous = current.selected;
369
+ current.selected = current.full;
370
+ if (Buffer.byteLength(render()) > Limits.RUN_DELIVERY_MODEL_MAX_BYTES - 1) current.selected = previous;
371
+ }
372
+ return render();
373
+ }
374
+
375
+ function duplicateRegistrationText(value: string): string {
376
+ const render = (selected: string) => "- field: name\n" + selected + "\n- result: Tool already registered.\n- instruction: Use update=true to overwrite.";
377
+ const wellFormed = value.isWellFormed();
378
+ if (wellFormed) {
379
+ const complete = render(ToolsResponse.formatMarkdownField("value", value));
380
+ if (Buffer.byteLength(complete) <= Limits.RUN_DELIVERY_MODEL_MAX_BYTES - 1) return complete;
381
+ }
382
+ return render(`- value: [${wellFormed ? "omitted" : "unavailable"}]\n- value_omission:\n - reason: ${wellFormed ? "response_too_large" : "malformed_selected_text"}\n - shown: 0\n - omitted: 1\n - total: 1`);
383
+ }
384
+
385
+ function draftRecipeFailureText(key: "reason" | "diagnostics_summary", value?: string): string {
386
+ const header = "- field: draft\n- result: Draft recipe is invalid.";
387
+ if (value === undefined) return header;
388
+ const wellFormed = value.isWellFormed();
389
+ if (wellFormed) {
390
+ const complete = header + "\n" + ToolsResponse.formatMarkdownField(key, value);
391
+ if (Buffer.byteLength(complete) <= Limits.RUN_DELIVERY_MODEL_MAX_BYTES - 1) return complete;
392
+ }
393
+ return header + `\n- ${key}: [${wellFormed ? "omitted" : "unavailable"}]\n- ${key}_omission:\n - reason: ${wellFormed ? "response_too_large" : "malformed_selected_text"}\n - shown: 0\n - omitted: 1\n - total: 1`;
394
+ }
395
+
195
396
  function promoteDraftRecipe<TContext>(
196
397
  name: string,
197
398
  input: RegisterToolInput,
@@ -207,7 +408,7 @@ function promoteDraftRecipe<TContext>(
207
408
  if ((existing || existsSync(targetPath)) && !input.update) {
208
409
  throw new Error(
209
410
  ExecutionOutput.formatToolText(
210
- `Tool "${name}" already registered. Use update=true to overwrite.`,
411
+ duplicateRegistrationText(`${name}`),
211
412
  ),
212
413
  );
213
414
  }
@@ -216,7 +417,7 @@ function promoteDraftRecipe<TContext>(
216
417
  const reason = RecipesReferences.diagnoseRawRecipeConfigFailure(draftPath);
217
418
  throw new Error(
218
419
  ExecutionOutput.formatToolText(
219
- `Draft recipe is invalid${reason ? `: ${reason}` : "."}`,
420
+ draftRecipeFailureText("reason", reason ? `${reason}` : undefined),
220
421
  ),
221
422
  );
222
423
  }
@@ -239,7 +440,7 @@ function promoteDraftRecipe<TContext>(
239
440
  if (!candidate.validated || !candidate.tool) {
240
441
  throw new Error(
241
442
  ExecutionOutput.formatToolText(
242
- `Draft recipe is invalid: ${candidate.diagnostics.join("; ")}`,
443
+ draftRecipeFailureText("diagnostics_summary", `${candidate.diagnostics.join("; ")}`),
243
444
  ),
244
445
  );
245
446
  }
@@ -254,12 +455,13 @@ function promoteDraftRecipe<TContext>(
254
455
  const argSummary = RecipesDiscovery.summarizeRegisteredToolArgs(promoted);
255
456
  const callableNow = activation?.callable_now ?? false;
256
457
  const nextActions = registrationNextActions(name, "draft", callableNow);
257
- deps.notify(ctx, `Promoted draft recipe: ${name}`, "info");
458
+ deps.notify(ctx, registryNoticeText("promoted", `${name}`), "info");
258
459
  return {
259
460
  content: [
260
461
  textContent(
261
462
  ExecutionOutput.formatToolText(
262
- `${existing ? "Updated" : "Registered"} tool "${name}" from draft; callable_now=${callableNow}; next=${nextActions[0]}.`,
463
+ // Preserve the old name→flag→hint template conversions here, after notify.
464
+ draftReceiptText(existing ? "updated" : "registered", `${name}`, `${callableNow}`, `${nextActions[0]}`),
263
465
  ),
264
466
  ),
265
467
  ],
@@ -296,6 +498,19 @@ function persistToolRecipe<TContext>(
296
498
  return path;
297
499
  }
298
500
 
501
+ function registryDeletionText(name: string, result: "deleted" | "not found"): string {
502
+ const field = ToolsResponse.formatMarkdownField;
503
+ const facts = [field("result", result), ...(result === "deleted"
504
+ ? [field("instruction", "Reload to remove it from the complete registry.")] : [])];
505
+ const render = (identity: string) => [identity, ...facts].join("\n");
506
+ const wellFormed = name.isWellFormed();
507
+ if (wellFormed) {
508
+ const complete = render(field("tool", name));
509
+ if (Buffer.byteLength(complete) <= Limits.RUN_DELIVERY_MODEL_MAX_BYTES - 1) return complete;
510
+ }
511
+ return render(`- tool: [${wellFormed ? "omitted" : "unavailable"}]\n- tool_omission:\n - reason: ${wellFormed ? "response_too_large" : "malformed_selected_text"}\n - shown: 0\n - omitted: 1\n - total: 1`);
512
+ }
513
+
299
514
  function deleteTool<TContext>(
300
515
  name: string,
301
516
  ctx: TContext,
@@ -306,7 +521,7 @@ function deleteTool<TContext>(
306
521
  return {
307
522
  content: [
308
523
  textContent(
309
- ExecutionOutput.formatToolText(`Tool "${name}" not found.`),
524
+ ExecutionOutput.formatToolText(registryDeletionText(`${name}`, "not found")),
310
525
  ),
311
526
  ],
312
527
  details: { tool: name },
@@ -318,12 +533,12 @@ function deleteTool<TContext>(
318
533
  deps.setActiveTools(
319
534
  deps.getActiveTools().filter((toolName) => toolName !== name),
320
535
  );
321
- deps.notify(ctx, `Deleted tool: ${name}`, "info");
536
+ deps.notify(ctx, registryNoticeText("deleted", `${name}`), "info");
322
537
  return {
323
538
  content: [
324
539
  textContent(
325
540
  ExecutionOutput.formatToolText(
326
- `Deleted tool "${name}". Reload to remove it from the complete registry.`,
541
+ registryDeletionText(`${name}`, "deleted"),
327
542
  ),
328
543
  ),
329
544
  ],
@@ -384,7 +599,7 @@ function assertTemplateIsNotNestedRecipe(value: unknown): void {
384
599
  ) {
385
600
  throw new Error(
386
601
  ExecutionOutput.formatToolText(
387
- "Nested Recipe-shaped templates are not a register_tool source mode. Next: retry with from=<skill>/<recipe> and defaults={...}.",
602
+ "- field: template\n- result: Nested Recipe-shaped templates are not a register_tool source mode.\n- instruction: retry with from=<skill>/<recipe> and defaults={...}.",
388
603
  ),
389
604
  );
390
605
  }
@@ -402,7 +617,7 @@ function getInputTemplate(
402
617
  });
403
618
  if (steps.length === 0)
404
619
  throw new Error(
405
- ExecutionOutput.formatToolText("Tool template sequence is empty."),
620
+ ExecutionOutput.formatToolText("- field: template\n- result: Tool template sequence is empty."),
406
621
  );
407
622
  return value;
408
623
  }
@@ -414,7 +629,7 @@ function getInputTemplate(
414
629
  }
415
630
  throw new Error(
416
631
  ExecutionOutput.formatToolText(
417
- "Tool template must be a string, object, or sequence.",
632
+ "- field: template\n- result: unsupported template type\n- supported_types:\n - string\n - object\n - sequence",
418
633
  ),
419
634
  );
420
635
  }
@@ -441,7 +656,7 @@ function normalizeDefaults(value: unknown): Record<string, unknown> | undefined
441
656
  if (value === undefined) return undefined;
442
657
  if (!value || typeof value !== "object" || Array.isArray(value)) {
443
658
  throw new Error(
444
- ExecutionOutput.formatToolText("Tool defaults must be an object."),
659
+ ExecutionOutput.formatToolText("- field: defaults\n- result: Tool defaults must be an object."),
445
660
  );
446
661
  }
447
662
  return { ...(value as Record<string, unknown>) };
@@ -502,7 +717,7 @@ function buildAuthoredRecipe(
502
717
  if (!description && !from) {
503
718
  throw new Error(
504
719
  ExecutionOutput.formatToolText(
505
- "Tool description is required for command-template registration.",
720
+ "- field: description\n- result: Tool description is required for command-template registration.",
506
721
  ),
507
722
  );
508
723
  }
@@ -514,7 +729,7 @@ function buildAuthoredRecipe(
514
729
  if (runtimeOwnedDefault) {
515
730
  throw new Error(
516
731
  ExecutionOutput.formatToolText(
517
- `Tool defaults cannot set runtime-owned input: ${runtimeOwnedDefault}. Next: remove that default and retry register_tool; the runtime supplies it.`,
732
+ `- field: defaults\n- key: ${runtimeOwnedDefault}\n- result: Tool defaults cannot set runtime-owned input.\n- instruction: remove that default and retry register_tool; the runtime supplies it.`,
518
733
  ),
519
734
  );
520
735
  }
@@ -534,7 +749,7 @@ function buildAuthoredRecipe(
534
749
  const template = getInputTemplate(input.template);
535
750
  if (template === null) {
536
751
  throw new Error(
537
- ExecutionOutput.formatToolText("Tool template cannot be null here."),
752
+ ExecutionOutput.formatToolText("- field: template\n- result: Tool template cannot be null here."),
538
753
  );
539
754
  }
540
755
  const finalTemplate =
@@ -543,7 +758,7 @@ function buildAuthoredRecipe(
543
758
  : template;
544
759
  if (!finalTemplate) {
545
760
  throw new Error(
546
- ExecutionOutput.formatToolText("Tool template is required."),
761
+ ExecutionOutput.formatToolText("- field: template\n- result: Tool template is required."),
547
762
  );
548
763
  }
549
764
  const authored: Record<string, unknown> = {
@@ -569,7 +784,7 @@ function assertRegisterToolInputModes(input: RegisterToolInput): void {
569
784
  if (Object.hasOwn(record, "values")) {
570
785
  throw new Error(
571
786
  ExecutionOutput.formatToolText(
572
- "register_tool values was removed. Next: retry register_tool with defaults for caller inputs, or use from=<skill>/<recipe> for maintained composition.",
787
+ "- field: values\n- result: register_tool values was removed.\n- replacement_fields:\n - defaults\n - from\n- instruction: retry register_tool with defaults for caller inputs, or use from=<skill>/<recipe> for maintained composition.",
573
788
  ),
574
789
  );
575
790
  }
@@ -580,7 +795,7 @@ function assertRegisterToolInputModes(input: RegisterToolInput): void {
580
795
  ) {
581
796
  throw new Error(
582
797
  ExecutionOutput.formatToolText(
583
- "Tool from must be a non-empty Recipe reference. Next: retry register_tool with from=<skill>/<recipe> or an explicit .json/.md path.",
798
+ "- field: from\n- result: Tool from must be a non-empty Recipe reference.\n- reference_forms:\n - <skill>/<recipe>\n - explicit .json path\n - explicit .md path\n- instruction: retry register_tool with from=<skill>/<recipe> or an explicit .json/.md path.",
584
799
  ),
585
800
  );
586
801
  }
@@ -592,7 +807,7 @@ function assertRegisterToolInputModes(input: RegisterToolInput): void {
592
807
  if (modeCount > 1) {
593
808
  throw new Error(
594
809
  ExecutionOutput.formatToolText(
595
- "Use exactly one register_tool source mode: from, template, or draft. Next: remove the extra source fields and retry register_tool.",
810
+ "- result: Use exactly one register_tool source mode.\n- source_modes:\n - from\n - template\n - draft\n- instruction: remove the extra source fields and retry register_tool.",
596
811
  ),
597
812
  );
598
813
  }
@@ -602,12 +817,22 @@ function assertRegisterToolInputModes(input: RegisterToolInput): void {
602
817
  ) {
603
818
  throw new Error(
604
819
  ExecutionOutput.formatToolText(
605
- "register_tool from inherits args and async behavior. Next: retry register_tool with from and optional defaults only; omit args and async.",
820
+ "- field: from\n- result: register_tool from inherits args and async behavior.\n- inherited_fields:\n - args\n - async\n- instruction: retry register_tool with from and optional defaults only; omit args and async.",
606
821
  ),
607
822
  );
608
823
  }
609
824
  }
610
825
 
826
+ function reservedRegistrationNameText(value: string): string {
827
+ const render = (selected: string) => "- field: name\n" + selected + "\n- result: Reserved tool name.";
828
+ const wellFormed = value.isWellFormed();
829
+ if (wellFormed) {
830
+ const complete = render(ToolsResponse.formatMarkdownField("value", value));
831
+ if (Buffer.byteLength(complete) <= Limits.RUN_DELIVERY_MODEL_MAX_BYTES - 1) return complete;
832
+ }
833
+ return render(`- value: [${wellFormed ? "omitted" : "unavailable"}]\n- value_omission:\n - reason: ${wellFormed ? "response_too_large" : "malformed_selected_text"}\n - shown: 0\n - omitted: 1\n - total: 1`);
834
+ }
835
+
611
836
  function executeRegisterToolUnlocked<TContext>(
612
837
  params: unknown,
613
838
  ctx: TContext,
@@ -622,10 +847,10 @@ function executeRegisterToolUnlocked<TContext>(
622
847
  if (!input.name) return listTools(deps);
623
848
  const name = Identity.normalizeToolName(input.name);
624
849
  if (!name)
625
- throw new Error(ExecutionOutput.formatToolText("Invalid tool name."));
850
+ throw new Error(ExecutionOutput.formatToolText("- field: name\n- result: Invalid tool name."));
626
851
  if (deps.reservedToolNames.has(name)) {
627
852
  throw new Error(
628
- ExecutionOutput.formatToolText(`Reserved tool name: ${name}`),
853
+ ExecutionOutput.formatToolText(reservedRegistrationNameText(`${name}`)),
629
854
  );
630
855
  }
631
856
  if (typeof input.draft === "string" && input.draft.trim()) {
@@ -647,7 +872,7 @@ function executeRegisterToolUnlocked<TContext>(
647
872
  : requestedSource ?? "";
648
873
  throw new Error(
649
874
  ExecutionOutput.formatToolText(
650
- `Recipe source "${requestedSource}" is invalid: ${reason}. Active Skills: ${activeSkillSummary(resolutionContext)}. Next: ${recipeDoctorAction(diagnosticSource)}`,
875
+ sourceNormalizationFailureText(`${requestedSource}`, `${reason}`, `${activeSkillSummary(resolutionContext)}`, `${recipeDoctorAction(diagnosticSource)}`),
651
876
  ),
652
877
  );
653
878
  }
@@ -664,14 +889,14 @@ function executeRegisterToolUnlocked<TContext>(
664
889
  if ((authoritative.exists || existing) && !input.update) {
665
890
  throw new Error(
666
891
  ExecutionOutput.formatToolText(
667
- `Tool "${name}" already registered. Use update=true to overwrite.`,
892
+ duplicateRegistrationText(`${name}`),
668
893
  ),
669
894
  );
670
895
  }
671
896
  if (template === undefined && !input.from && !existing) {
672
897
  throw new Error(
673
898
  ExecutionOutput.formatToolText(
674
- "New registration requires exactly one source mode: from, template, or draft. Next: retry register_tool with one source field.",
899
+ "- result: New registration requires exactly one source mode.\n- source_modes:\n - from\n - template\n - draft\n- instruction: retry register_tool with one source field.",
675
900
  ),
676
901
  );
677
902
  }
@@ -688,8 +913,8 @@ function executeRegisterToolUnlocked<TContext>(
688
913
  );
689
914
  if (!candidate.validated || !candidate.tool) {
690
915
  const sourceDiagnostic = requestedSource
691
- ? `Recipe source "${requestedSource}" validation failed: ${candidate.diagnostics.join("; ")}. Active Skills: ${activeSkillSummary(resolutionContext)}. Next: ${recipeDoctorAction(requestedSource)}`
692
- : `Tool recipe validation failed: ${candidate.diagnostics.join("; ")}`;
916
+ ? candidateAdmissionFailureText({ kind: "source", source: `${requestedSource}`, diagnostics: `${candidate.diagnostics.join("; ")}`, summary: `${activeSkillSummary(resolutionContext)}`, instruction: `${recipeDoctorAction(requestedSource)}` })
917
+ : candidateAdmissionFailureText({ kind: "recipe", diagnostics: `${candidate.diagnostics.join("; ")}` });
693
918
  throw new Error(ExecutionOutput.formatToolText(sourceDiagnostic));
694
919
  }
695
920
  const activeBefore = deps.getActiveTools();
@@ -739,11 +964,11 @@ function executeRegisterToolUnlocked<TContext>(
739
964
  deps.setActiveTools(activeBefore);
740
965
  throw new Error(
741
966
  ExecutionOutput.formatToolText(
742
- `Tool registration transaction failed at ${transactionStage} (${resolutionContext.generation}; active Skills: ${activeSkillSummary(resolutionContext)}): ${error instanceof Error ? error.message : String(error)}`,
967
+ registrationTransactionFailureText(`${transactionStage}`, `${resolutionContext.generation}`, `${activeSkillSummary(resolutionContext)}`, `${error instanceof Error ? error.message : String(error)}`),
743
968
  ),
744
969
  );
745
970
  }
746
- deps.notify(ctx, `Tool activated: ${name}`, "info");
971
+ deps.notify(ctx, registryNoticeText("activated", `${name}`), "info");
747
972
  const templateWarnings = CommandTemplates.getCommandTemplateWarnings(
748
973
  typeof cfg.recipe?.template === "object" && !Array.isArray(cfg.recipe.template)
749
974
  ? cfg.recipe.template
@@ -757,14 +982,19 @@ function executeRegisterToolUnlocked<TContext>(
757
982
  const source = requestedSource ?? "template";
758
983
  const argSummary = RecipesDiscovery.summarizeRegisteredToolArgs(cfg);
759
984
  const nextActions = registrationNextActions(name, source, callableNow);
985
+ let displayBoundary: string | undefined;
760
986
  const outcomeText = callableNow
761
987
  ? `${existing ? "Updated" : "Registered"} tool "${name}" from ${source}; callable_now=true`
762
- : `Persisted tool "${name}" from ${source}; callable_now=false; activation_boundary=${activationBoundary(activation)}`;
988
+ : `Persisted tool "${name}" from ${source}; callable_now=false; activation_boundary=${displayBoundary = activationBoundary(activation)}`;
989
+ // Keep original fallible advisory evaluation/order after effects, before the new text.
990
+ void `${outcomeText}; required=${Schema.formatToolArgs(argSummary.required)}; optional=${Schema.formatToolArgs(argSummary.optional)}; next=${nextActions[0]}.${warningText}`;
763
991
  return {
764
992
  content: [
765
993
  textContent(
766
994
  ExecutionOutput.formatToolText(
767
- `${outcomeText}; required=${Schema.formatToolArgs(argSummary.required)}; optional=${Schema.formatToolArgs(argSummary.optional)}; next=${nextActions[0]}.${warningText}`,
995
+ registrationReceiptText({ tool: name, result: callableNow ? existing ? "updated" : "registered" : "persisted",
996
+ source, callable: Boolean(callableNow), boundary: displayBoundary, required: argSummary.required,
997
+ optional: argSummary.optional, warnings: templateWarnings, next: nextActions[0] }),
768
998
  ),
769
999
  ),
770
1000
  ],