@harrylabsj/kiwi-merchant-cloud 0.12.4 → 0.12.5

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 (1225) hide show
  1. package/app/a2a/node.d.ts +5 -1
  2. package/app/a2a/node.js +68 -30
  3. package/app/a2a/node.js.map +1 -1
  4. package/app/a2a/server/merchant-handler.d.ts +4 -0
  5. package/app/a2a/server/merchant-handler.js +123 -45
  6. package/app/a2a/server/merchant-handler.js.map +1 -1
  7. package/app/a2a/server/merchant-product-facts.d.ts +32 -0
  8. package/app/a2a/server/merchant-product-facts.js +57 -0
  9. package/app/a2a/server/merchant-product-facts.js.map +1 -0
  10. package/app/agent/buyer/buyer-tools.js +285 -3
  11. package/app/agent/buyer/buyer-tools.js.map +1 -1
  12. package/app/agent/merchant/types.d.ts +4 -9
  13. package/app/agent/merchant/types.js +14 -0
  14. package/app/agent/merchant/types.js.map +1 -1
  15. package/app/buyer-core/a2a-knp.d.ts +1 -0
  16. package/app/buyer-core/a2a-knp.js +1 -1
  17. package/app/buyer-core/a2a-knp.js.map +1 -1
  18. package/app/buyer-core/a2a-negotiator.d.ts +2 -0
  19. package/app/buyer-core/a2a-negotiator.js +20 -19
  20. package/app/buyer-core/a2a-negotiator.js.map +1 -1
  21. package/app/buyer-core/a2a-quote-fetcher.d.ts +2 -0
  22. package/app/buyer-core/a2a-quote-fetcher.js +13 -5
  23. package/app/buyer-core/a2a-quote-fetcher.js.map +1 -1
  24. package/app/buyer-core/product-summary.d.ts +4 -0
  25. package/app/buyer-core/product-summary.js +6 -0
  26. package/app/buyer-core/product-summary.js.map +1 -1
  27. package/app/buyer-core/protocol-recovery.d.ts +12 -1
  28. package/app/buyer-core/protocol-recovery.js +59 -19
  29. package/app/buyer-core/protocol-recovery.js.map +1 -1
  30. package/app/buyer-core/receive-gate.d.ts +11 -0
  31. package/app/buyer-core/receive-gate.js +107 -0
  32. package/app/buyer-core/receive-gate.js.map +1 -0
  33. package/app/cloud/bootstrap.d.ts +4 -0
  34. package/app/cloud/bootstrap.js +69 -55
  35. package/app/cloud/bootstrap.js.map +1 -1
  36. package/app/cloud/file-listing-publication.js +6 -0
  37. package/app/cloud/file-listing-publication.js.map +1 -1
  38. package/app/cloud/main.d.ts +3 -0
  39. package/app/cloud/main.js +47 -11
  40. package/app/cloud/main.js.map +1 -1
  41. package/app/cloud/product-import-tabular.d.ts +1 -1
  42. package/app/cloud/product-import-tabular.js +263 -36
  43. package/app/cloud/product-import-tabular.js.map +1 -1
  44. package/app/cloud/product-source.d.ts +6 -1
  45. package/app/cloud/product-source.js +47 -15
  46. package/app/cloud/product-source.js.map +1 -1
  47. package/app/cloud-sample/products.json +3 -3
  48. package/app/commerce/data-source.d.ts +4 -0
  49. package/app/commerce/data-source.js.map +1 -1
  50. package/app/commerce/shopping-cli-source.js +4 -0
  51. package/app/commerce/shopping-cli-source.js.map +1 -1
  52. package/app/discovery/catalog-source/kiwi-source.d.ts +2 -0
  53. package/app/discovery/catalog-source/kiwi-source.js +4 -0
  54. package/app/discovery/catalog-source/kiwi-source.js.map +1 -1
  55. package/app/handoff/index.d.ts +2 -1
  56. package/app/handoff/index.js +1 -0
  57. package/app/handoff/index.js.map +1 -1
  58. package/app/handoff/launch-marketplace-policy.d.ts +149 -0
  59. package/app/handoff/launch-marketplace-policy.js +301 -0
  60. package/app/handoff/launch-marketplace-policy.js.map +1 -0
  61. package/app/handoff/marketplace-product-link.d.ts +18 -0
  62. package/app/handoff/marketplace-product-link.js +71 -0
  63. package/app/handoff/marketplace-product-link.js.map +1 -0
  64. package/app/handoff/transaction.d.ts +30 -0
  65. package/app/handoff/transaction.js +64 -0
  66. package/app/handoff/transaction.js.map +1 -1
  67. package/app/handoff/url-safety.d.ts +3 -0
  68. package/app/handoff/url-safety.js +4 -0
  69. package/app/handoff/url-safety.js.map +1 -1
  70. package/app/http/merchant-management/page.js +176 -45
  71. package/app/http/merchant-management/page.js.map +1 -1
  72. package/app/i18n.d.ts +1 -0
  73. package/app/i18n.js +3 -0
  74. package/app/i18n.js.map +1 -1
  75. package/app/lifecycle/close.d.ts +24 -0
  76. package/app/lifecycle/close.js +131 -0
  77. package/app/lifecycle/close.js.map +1 -0
  78. package/app/mcp/merchant-runtime-assembly.js +6 -4
  79. package/app/mcp/merchant-runtime-assembly.js.map +1 -1
  80. package/app/mcp/tools.js +17 -16
  81. package/app/mcp/tools.js.map +1 -1
  82. package/app/merchant/application/service.d.ts +4 -0
  83. package/app/merchant/application/service.js.map +1 -1
  84. package/app/merchant/stats-store.d.ts +3 -0
  85. package/app/merchant/stats-store.js +15 -1
  86. package/app/merchant/stats-store.js.map +1 -1
  87. package/app/merchant-core/rfq/data-source-adapter.d.ts +2 -10
  88. package/app/merchant-core/rfq/data-source-adapter.js +21 -9
  89. package/app/merchant-core/rfq/data-source-adapter.js.map +1 -1
  90. package/app/merchant-gateway/pinned-fetch.js +5 -2
  91. package/app/merchant-gateway/pinned-fetch.js.map +1 -1
  92. package/build-manifest.json +2901 -1966
  93. package/node_modules/@earendil-works/chord/CHANGELOG.md +20 -0
  94. package/node_modules/@earendil-works/chord/README.md +77 -194
  95. package/node_modules/@earendil-works/chord/dist/cell.d.ts +101 -0
  96. package/node_modules/@earendil-works/chord/dist/cell.d.ts.map +1 -0
  97. package/node_modules/@earendil-works/chord/dist/cell.js +316 -0
  98. package/node_modules/@earendil-works/chord/dist/cell.js.map +1 -0
  99. package/node_modules/@earendil-works/chord/dist/cluster.d.ts +26 -0
  100. package/node_modules/@earendil-works/chord/dist/cluster.d.ts.map +1 -0
  101. package/node_modules/@earendil-works/chord/dist/cluster.js +214 -0
  102. package/node_modules/@earendil-works/chord/dist/cluster.js.map +1 -0
  103. package/node_modules/@earendil-works/chord/dist/connection.d.ts +157 -0
  104. package/node_modules/@earendil-works/chord/dist/connection.d.ts.map +1 -0
  105. package/node_modules/@earendil-works/chord/dist/connection.js +757 -0
  106. package/node_modules/@earendil-works/chord/dist/connection.js.map +1 -0
  107. package/node_modules/@earendil-works/chord/dist/context/index.d.ts +12 -1
  108. package/node_modules/@earendil-works/chord/dist/context/index.d.ts.map +1 -1
  109. package/node_modules/@earendil-works/chord/dist/context/index.js.map +1 -1
  110. package/node_modules/@earendil-works/chord/dist/contract.d.ts +133 -0
  111. package/node_modules/@earendil-works/chord/dist/contract.d.ts.map +1 -0
  112. package/node_modules/@earendil-works/chord/dist/contract.js +157 -0
  113. package/node_modules/@earendil-works/chord/dist/contract.js.map +1 -0
  114. package/node_modules/@earendil-works/chord/dist/declare.d.ts +70 -0
  115. package/node_modules/@earendil-works/chord/dist/declare.d.ts.map +1 -0
  116. package/node_modules/@earendil-works/chord/dist/declare.js +22 -0
  117. package/node_modules/@earendil-works/chord/dist/declare.js.map +1 -0
  118. package/node_modules/@earendil-works/chord/dist/delta/apply-immutable-trusted.js.map +1 -1
  119. package/node_modules/@earendil-works/chord/dist/delta/diff.d.ts +1 -1
  120. package/node_modules/@earendil-works/chord/dist/delta/diff.d.ts.map +1 -1
  121. package/node_modules/@earendil-works/chord/dist/delta/diff.js.map +1 -1
  122. package/node_modules/@earendil-works/chord/dist/delta/index.d.ts +2 -2
  123. package/node_modules/@earendil-works/chord/dist/delta/index.d.ts.map +1 -1
  124. package/node_modules/@earendil-works/chord/dist/delta/index.js +41 -0
  125. package/node_modules/@earendil-works/chord/dist/delta/index.js.map +1 -1
  126. package/node_modules/@earendil-works/chord/dist/delta/revision-validator.d.ts +1 -1
  127. package/node_modules/@earendil-works/chord/dist/delta/revision-validator.d.ts.map +1 -1
  128. package/node_modules/@earendil-works/chord/dist/delta/revision-validator.js.map +1 -1
  129. package/node_modules/@earendil-works/chord/dist/delta/tracker.d.ts +1 -1
  130. package/node_modules/@earendil-works/chord/dist/delta/tracker.d.ts.map +1 -1
  131. package/node_modules/@earendil-works/chord/dist/delta/tracker.js +40 -4
  132. package/node_modules/@earendil-works/chord/dist/delta/tracker.js.map +1 -1
  133. package/node_modules/@earendil-works/chord/dist/errors.d.ts +27 -0
  134. package/node_modules/@earendil-works/chord/dist/errors.d.ts.map +1 -0
  135. package/node_modules/@earendil-works/chord/dist/errors.js +44 -0
  136. package/node_modules/@earendil-works/chord/dist/errors.js.map +1 -0
  137. package/node_modules/@earendil-works/chord/dist/host.d.ts +254 -0
  138. package/node_modules/@earendil-works/chord/dist/host.d.ts.map +1 -0
  139. package/node_modules/@earendil-works/chord/dist/host.js +795 -0
  140. package/node_modules/@earendil-works/chord/dist/host.js.map +1 -0
  141. package/node_modules/@earendil-works/chord/dist/index.d.ts +17 -10
  142. package/node_modules/@earendil-works/chord/dist/index.d.ts.map +1 -1
  143. package/node_modules/@earendil-works/chord/dist/index.js +8 -8
  144. package/node_modules/@earendil-works/chord/dist/index.js.map +1 -1
  145. package/node_modules/@earendil-works/chord/dist/json.d.ts +9 -1
  146. package/node_modules/@earendil-works/chord/dist/json.d.ts.map +1 -1
  147. package/node_modules/@earendil-works/chord/dist/json.js.map +1 -1
  148. package/node_modules/@earendil-works/chord/dist/link.d.ts +72 -0
  149. package/node_modules/@earendil-works/chord/dist/link.d.ts.map +1 -0
  150. package/node_modules/@earendil-works/chord/dist/link.js +169 -0
  151. package/node_modules/@earendil-works/chord/dist/link.js.map +1 -0
  152. package/node_modules/@earendil-works/chord/dist/loader.d.ts +4 -0
  153. package/node_modules/@earendil-works/chord/dist/loader.d.ts.map +1 -0
  154. package/node_modules/@earendil-works/chord/dist/loader.js +68 -0
  155. package/node_modules/@earendil-works/chord/dist/loader.js.map +1 -0
  156. package/node_modules/@earendil-works/chord/dist/manager.d.ts +115 -0
  157. package/node_modules/@earendil-works/chord/dist/manager.d.ts.map +1 -0
  158. package/node_modules/@earendil-works/chord/dist/manager.js +319 -0
  159. package/node_modules/@earendil-works/chord/dist/manager.js.map +1 -0
  160. package/node_modules/@earendil-works/chord/dist/node.d.ts +3 -4
  161. package/node_modules/@earendil-works/chord/dist/node.d.ts.map +1 -1
  162. package/node_modules/@earendil-works/chord/dist/node.js +3 -2
  163. package/node_modules/@earendil-works/chord/dist/node.js.map +1 -1
  164. package/node_modules/@earendil-works/chord/dist/publish.d.ts +5 -0
  165. package/node_modules/@earendil-works/chord/dist/publish.d.ts.map +1 -0
  166. package/node_modules/@earendil-works/chord/dist/publish.js +40 -0
  167. package/node_modules/@earendil-works/chord/dist/publish.js.map +1 -0
  168. package/node_modules/@earendil-works/chord/dist/record.d.ts +320 -0
  169. package/node_modules/@earendil-works/chord/dist/record.d.ts.map +1 -0
  170. package/node_modules/@earendil-works/chord/dist/record.js +1292 -0
  171. package/node_modules/@earendil-works/chord/dist/record.js.map +1 -0
  172. package/node_modules/@earendil-works/chord/dist/registry.d.ts +25 -0
  173. package/node_modules/@earendil-works/chord/dist/registry.d.ts.map +1 -0
  174. package/node_modules/@earendil-works/chord/dist/registry.js +6 -0
  175. package/node_modules/@earendil-works/chord/dist/registry.js.map +1 -0
  176. package/node_modules/@earendil-works/chord/dist/reload.d.ts +118 -0
  177. package/node_modules/@earendil-works/chord/dist/reload.d.ts.map +1 -0
  178. package/node_modules/@earendil-works/chord/dist/reload.js +589 -0
  179. package/node_modules/@earendil-works/chord/dist/reload.js.map +1 -0
  180. package/node_modules/@earendil-works/chord/dist/remote.d.ts +70 -0
  181. package/node_modules/@earendil-works/chord/dist/remote.d.ts.map +1 -0
  182. package/node_modules/@earendil-works/chord/dist/remote.js +308 -0
  183. package/node_modules/@earendil-works/chord/dist/remote.js.map +1 -0
  184. package/node_modules/@earendil-works/chord/dist/schema.d.ts +21 -0
  185. package/node_modules/@earendil-works/chord/dist/schema.d.ts.map +1 -0
  186. package/node_modules/@earendil-works/chord/dist/schema.js +228 -0
  187. package/node_modules/@earendil-works/chord/dist/schema.js.map +1 -0
  188. package/node_modules/@earendil-works/chord/dist/state.d.ts +92 -0
  189. package/node_modules/@earendil-works/chord/dist/state.d.ts.map +1 -0
  190. package/node_modules/@earendil-works/chord/dist/{services/state.js → state.js} +28 -138
  191. package/node_modules/@earendil-works/chord/dist/state.js.map +1 -0
  192. package/node_modules/@earendil-works/chord/dist/types.d.ts +62 -262
  193. package/node_modules/@earendil-works/chord/dist/types.d.ts.map +1 -1
  194. package/node_modules/@earendil-works/chord/dist/types.js.map +1 -1
  195. package/node_modules/@earendil-works/chord/dist/websocket.d.ts +16 -0
  196. package/node_modules/@earendil-works/chord/dist/websocket.d.ts.map +1 -0
  197. package/node_modules/@earendil-works/chord/dist/websocket.js +15 -0
  198. package/node_modules/@earendil-works/chord/dist/websocket.js.map +1 -0
  199. package/node_modules/@earendil-works/chord/dist/wire.d.ts +135 -0
  200. package/node_modules/@earendil-works/chord/dist/wire.d.ts.map +1 -0
  201. package/node_modules/@earendil-works/chord/dist/wire.js +112 -0
  202. package/node_modules/@earendil-works/chord/dist/wire.js.map +1 -0
  203. package/node_modules/@earendil-works/chord/docs/guide.md +750 -0
  204. package/node_modules/@earendil-works/chord/docs/spec.md +261 -0
  205. package/node_modules/@earendil-works/chord/docs/tutorial.md +909 -0
  206. package/node_modules/@earendil-works/chord/package.json +10 -11
  207. package/node_modules/@earendil-works/chord/src/delta/README.md +5 -3
  208. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
  209. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +9 -1
  210. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -1
  211. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts +2 -5
  212. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts.map +1 -1
  213. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js +2 -14
  214. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js.map +1 -1
  215. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +4 -0
  216. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts.map +1 -1
  217. package/node_modules/@earendil-works/pi-agent-core/dist/types.js.map +1 -1
  218. package/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
  219. package/node_modules/@earendil-works/pi-ai/README.md +14 -3
  220. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts.map +1 -1
  221. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +63 -22
  222. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js.map +1 -1
  223. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-config.d.ts +15 -0
  224. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-config.d.ts.map +1 -0
  225. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-config.js +76 -0
  226. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-config.js.map +1 -0
  227. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.d.ts +3 -6
  228. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.d.ts.map +1 -1
  229. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js +2 -74
  230. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js.map +1 -1
  231. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js +33 -2
  232. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js.map +1 -1
  233. package/node_modules/@earendil-works/pi-ai/dist/api/classifier-shared.d.ts +21 -0
  234. package/node_modules/@earendil-works/pi-ai/dist/api/classifier-shared.d.ts.map +1 -0
  235. package/node_modules/@earendil-works/pi-ai/dist/api/classifier-shared.js +98 -0
  236. package/node_modules/@earendil-works/pi-ai/dist/api/classifier-shared.js.map +1 -0
  237. package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-workers-ai-system-one.d.ts.map +1 -1
  238. package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-workers-ai-system-one.js +2 -1
  239. package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-workers-ai-system-one.js.map +1 -1
  240. package/node_modules/@earendil-works/pi-ai/dist/api/lazy.d.ts.map +1 -1
  241. package/node_modules/@earendil-works/pi-ai/dist/api/lazy.js +4 -3
  242. package/node_modules/@earendil-works/pi-ai/dist/api/lazy.js.map +1 -1
  243. package/node_modules/@earendil-works/pi-ai/dist/api/llama-cpp-classify.d.ts.map +1 -1
  244. package/node_modules/@earendil-works/pi-ai/dist/api/llama-cpp-classify.js +2 -0
  245. package/node_modules/@earendil-works/pi-ai/dist/api/llama-cpp-classify.js.map +1 -1
  246. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.d.ts.map +1 -1
  247. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +31 -14
  248. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js.map +1 -1
  249. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts.map +1 -1
  250. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +7 -4
  251. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js.map +1 -1
  252. package/node_modules/@earendil-works/pi-ai/dist/api/openai-decisions.d.ts +4 -0
  253. package/node_modules/@earendil-works/pi-ai/dist/api/openai-decisions.d.ts.map +1 -0
  254. package/node_modules/@earendil-works/pi-ai/dist/api/openai-decisions.js +162 -0
  255. package/node_modules/@earendil-works/pi-ai/dist/api/openai-decisions.js.map +1 -0
  256. package/node_modules/@earendil-works/pi-ai/dist/api/openai-decisions.lazy.d.ts +3 -0
  257. package/node_modules/@earendil-works/pi-ai/dist/api/openai-decisions.lazy.d.ts.map +1 -0
  258. package/node_modules/@earendil-works/pi-ai/dist/api/openai-decisions.lazy.js +4 -0
  259. package/node_modules/@earendil-works/pi-ai/dist/api/openai-decisions.lazy.js.map +1 -0
  260. package/node_modules/@earendil-works/pi-ai/dist/api/system-one-shared.d.ts +0 -1
  261. package/node_modules/@earendil-works/pi-ai/dist/api/system-one-shared.d.ts.map +1 -1
  262. package/node_modules/@earendil-works/pi-ai/dist/api/system-one-shared.js +5 -89
  263. package/node_modules/@earendil-works/pi-ai/dist/api/system-one-shared.js.map +1 -1
  264. package/node_modules/@earendil-works/pi-ai/dist/api/typesafe-system-one.d.ts.map +1 -1
  265. package/node_modules/@earendil-works/pi-ai/dist/api/typesafe-system-one.js +2 -1
  266. package/node_modules/@earendil-works/pi-ai/dist/api/typesafe-system-one.js.map +1 -1
  267. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/anthropic.d.ts.map +1 -1
  268. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/anthropic.js +14 -6
  269. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/anthropic.js.map +1 -1
  270. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-chatgpt.js +1 -1
  271. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-chatgpt.js.map +1 -1
  272. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-codex.d.ts.map +1 -1
  273. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-codex.js +4 -4
  274. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-codex.js.map +1 -1
  275. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.d.ts +16 -1
  276. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.d.ts.map +1 -1
  277. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js +51 -27
  278. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js.map +1 -1
  279. package/node_modules/@earendil-works/pi-ai/dist/auth/types.d.ts +5 -0
  280. package/node_modules/@earendil-works/pi-ai/dist/auth/types.d.ts.map +1 -1
  281. package/node_modules/@earendil-works/pi-ai/dist/auth/types.js.map +1 -1
  282. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js +1 -1
  283. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js.map +1 -1
  284. package/node_modules/@earendil-works/pi-ai/dist/models.d.ts +5 -0
  285. package/node_modules/@earendil-works/pi-ai/dist/models.d.ts.map +1 -1
  286. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +4 -4
  287. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts.map +1 -1
  288. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +4 -4
  289. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js.map +1 -1
  290. package/node_modules/@earendil-works/pi-ai/dist/models.js +7 -8
  291. package/node_modules/@earendil-works/pi-ai/dist/models.js.map +1 -1
  292. package/node_modules/@earendil-works/pi-ai/dist/providers/all.js +2 -2
  293. package/node_modules/@earendil-works/pi-ai/dist/providers/all.js.map +1 -1
  294. package/node_modules/@earendil-works/pi-ai/dist/providers/azure.d.ts +3 -0
  295. package/node_modules/@earendil-works/pi-ai/dist/providers/azure.d.ts.map +1 -0
  296. package/node_modules/@earendil-works/pi-ai/dist/providers/azure.js +46 -0
  297. package/node_modules/@earendil-works/pi-ai/dist/providers/azure.js.map +1 -0
  298. package/node_modules/@earendil-works/pi-ai/dist/providers/azure.models.d.ts +6 -0
  299. package/node_modules/@earendil-works/pi-ai/dist/providers/azure.models.d.ts.map +1 -0
  300. package/node_modules/@earendil-works/pi-ai/dist/providers/azure.models.js +8 -0
  301. package/node_modules/@earendil-works/pi-ai/dist/providers/azure.models.js.map +1 -0
  302. package/node_modules/@earendil-works/pi-ai/dist/providers/compat-schema.d.ts +338 -0
  303. package/node_modules/@earendil-works/pi-ai/dist/providers/compat-schema.d.ts.map +1 -0
  304. package/node_modules/@earendil-works/pi-ai/dist/providers/compat-schema.js +375 -0
  305. package/node_modules/@earendil-works/pi-ai/dist/providers/compat-schema.js.map +1 -0
  306. package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  307. package/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -1
  308. package/node_modules/@earendil-works/pi-ai/dist/providers/data/anthropic.json +1 -1
  309. package/node_modules/@earendil-works/pi-ai/dist/providers/data/azure.json +1 -0
  310. package/node_modules/@earendil-works/pi-ai/dist/providers/data/baseten.json +1 -1
  311. package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
  312. package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-workers-ai.json +1 -1
  313. package/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
  314. package/node_modules/@earendil-works/pi-ai/dist/providers/data/google-vertex.json +1 -1
  315. package/node_modules/@earendil-works/pi-ai/dist/providers/data/google.json +1 -1
  316. package/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
  317. package/node_modules/@earendil-works/pi-ai/dist/providers/data/meta.json +1 -1
  318. package/node_modules/@earendil-works/pi-ai/dist/providers/data/minimax-cn.json +1 -1
  319. package/node_modules/@earendil-works/pi-ai/dist/providers/data/minimax.json +1 -1
  320. package/node_modules/@earendil-works/pi-ai/dist/providers/data/mistral.json +1 -1
  321. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai.json +1 -1
  322. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
  323. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
  324. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  325. package/node_modules/@earendil-works/pi-ai/dist/providers/data/radius.json +1 -1
  326. package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  327. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts.map +1 -1
  328. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js +25 -8
  329. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js.map +1 -1
  330. package/node_modules/@earendil-works/pi-ai/dist/providers/model-schema.d.ts +91 -0
  331. package/node_modules/@earendil-works/pi-ai/dist/providers/model-schema.d.ts.map +1 -0
  332. package/node_modules/@earendil-works/pi-ai/dist/providers/model-schema.js +55 -0
  333. package/node_modules/@earendil-works/pi-ai/dist/providers/model-schema.js.map +1 -0
  334. package/node_modules/@earendil-works/pi-ai/dist/providers/openai.d.ts.map +1 -1
  335. package/node_modules/@earendil-works/pi-ai/dist/providers/openai.js +12 -3
  336. package/node_modules/@earendil-works/pi-ai/dist/providers/openai.js.map +1 -1
  337. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter-api.d.ts +40 -0
  338. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter-api.d.ts.map +1 -0
  339. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter-api.js +41 -0
  340. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter-api.js.map +1 -0
  341. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.d.ts +11 -1
  342. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.d.ts.map +1 -1
  343. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.js +52 -1
  344. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.js.map +1 -1
  345. package/node_modules/@earendil-works/pi-ai/dist/providers/radius.d.ts.map +1 -1
  346. package/node_modules/@earendil-works/pi-ai/dist/providers/radius.js +4 -12
  347. package/node_modules/@earendil-works/pi-ai/dist/providers/radius.js.map +1 -1
  348. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +22 -305
  349. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
  350. package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
  351. package/node_modules/@earendil-works/pi-ai/dist/utils/estimate.js +1 -1
  352. package/node_modules/@earendil-works/pi-ai/dist/utils/estimate.js.map +1 -1
  353. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.d.ts +10 -1
  354. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.d.ts.map +1 -1
  355. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js +25 -0
  356. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js.map +1 -1
  357. package/node_modules/@earendil-works/pi-ai/dist/utils/model-operations.d.ts +3 -1
  358. package/node_modules/@earendil-works/pi-ai/dist/utils/model-operations.d.ts.map +1 -1
  359. package/node_modules/@earendil-works/pi-ai/dist/utils/model-operations.js +6 -0
  360. package/node_modules/@earendil-works/pi-ai/dist/utils/model-operations.js.map +1 -1
  361. package/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.d.ts +2 -0
  362. package/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.d.ts.map +1 -1
  363. package/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.js +2 -0
  364. package/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.js.map +1 -1
  365. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.d.ts.map +1 -1
  366. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js +8 -2
  367. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js.map +1 -1
  368. package/node_modules/@earendil-works/pi-ai/package.json +2 -2
  369. package/node_modules/@earendil-works/pi-codemode/README.md +177 -11
  370. package/node_modules/@earendil-works/pi-codemode/dist/cloudflare.d.ts +53 -0
  371. package/node_modules/@earendil-works/pi-codemode/dist/cloudflare.d.ts.map +1 -0
  372. package/node_modules/@earendil-works/pi-codemode/dist/cloudflare.js +64 -0
  373. package/node_modules/@earendil-works/pi-codemode/dist/cloudflare.js.map +1 -0
  374. package/node_modules/@earendil-works/pi-codemode/dist/declarations.d.ts +6 -21
  375. package/node_modules/@earendil-works/pi-codemode/dist/declarations.d.ts.map +1 -1
  376. package/node_modules/@earendil-works/pi-codemode/dist/declarations.js +113 -127
  377. package/node_modules/@earendil-works/pi-codemode/dist/declarations.js.map +1 -1
  378. package/node_modules/@earendil-works/pi-codemode/dist/index.d.ts +5 -2
  379. package/node_modules/@earendil-works/pi-codemode/dist/index.d.ts.map +1 -1
  380. package/node_modules/@earendil-works/pi-codemode/dist/index.js +4 -1
  381. package/node_modules/@earendil-works/pi-codemode/dist/index.js.map +1 -1
  382. package/node_modules/@earendil-works/pi-codemode/dist/portable.d.ts +15 -0
  383. package/node_modules/@earendil-works/pi-codemode/dist/portable.d.ts.map +1 -0
  384. package/node_modules/@earendil-works/pi-codemode/dist/portable.js +12 -0
  385. package/node_modules/@earendil-works/pi-codemode/dist/portable.js.map +1 -0
  386. package/node_modules/@earendil-works/pi-codemode/dist/runtime/execution.d.ts +66 -0
  387. package/node_modules/@earendil-works/pi-codemode/dist/runtime/execution.d.ts.map +1 -0
  388. package/node_modules/@earendil-works/pi-codemode/dist/runtime/execution.js +494 -0
  389. package/node_modules/@earendil-works/pi-codemode/dist/runtime/execution.js.map +1 -0
  390. package/node_modules/@earendil-works/pi-codemode/dist/runtime/host.d.ts +8 -30
  391. package/node_modules/@earendil-works/pi-codemode/dist/runtime/host.d.ts.map +1 -1
  392. package/node_modules/@earendil-works/pi-codemode/dist/runtime/host.js +41 -283
  393. package/node_modules/@earendil-works/pi-codemode/dist/runtime/host.js.map +1 -1
  394. package/node_modules/@earendil-works/pi-codemode/dist/runtime/inline.d.ts +63 -0
  395. package/node_modules/@earendil-works/pi-codemode/dist/runtime/inline.d.ts.map +1 -0
  396. package/node_modules/@earendil-works/pi-codemode/dist/runtime/inline.js +80 -0
  397. package/node_modules/@earendil-works/pi-codemode/dist/runtime/inline.js.map +1 -0
  398. package/node_modules/@earendil-works/pi-codemode/dist/runtime/prelude-source.d.ts +9 -3
  399. package/node_modules/@earendil-works/pi-codemode/dist/runtime/prelude-source.d.ts.map +1 -1
  400. package/node_modules/@earendil-works/pi-codemode/dist/runtime/prelude-source.js +122 -12
  401. package/node_modules/@earendil-works/pi-codemode/dist/runtime/prelude-source.js.map +1 -1
  402. package/node_modules/@earendil-works/pi-codemode/dist/runtime/protocol.d.ts +47 -6
  403. package/node_modules/@earendil-works/pi-codemode/dist/runtime/protocol.d.ts.map +1 -1
  404. package/node_modules/@earendil-works/pi-codemode/dist/runtime/protocol.js +6 -1
  405. package/node_modules/@earendil-works/pi-codemode/dist/runtime/protocol.js.map +1 -1
  406. package/node_modules/@earendil-works/pi-codemode/dist/runtime/remote.d.ts +102 -0
  407. package/node_modules/@earendil-works/pi-codemode/dist/runtime/remote.d.ts.map +1 -0
  408. package/node_modules/@earendil-works/pi-codemode/dist/runtime/remote.js +175 -0
  409. package/node_modules/@earendil-works/pi-codemode/dist/runtime/remote.js.map +1 -0
  410. package/node_modules/@earendil-works/pi-codemode/dist/runtime/vm.d.ts +24 -0
  411. package/node_modules/@earendil-works/pi-codemode/dist/runtime/vm.d.ts.map +1 -0
  412. package/node_modules/@earendil-works/pi-codemode/dist/runtime/vm.js +293 -0
  413. package/node_modules/@earendil-works/pi-codemode/dist/runtime/vm.js.map +1 -0
  414. package/node_modules/@earendil-works/pi-codemode/dist/runtime/worker.js +11 -110
  415. package/node_modules/@earendil-works/pi-codemode/dist/runtime/worker.js.map +1 -1
  416. package/node_modules/@earendil-works/pi-codemode/dist/source.d.ts +2 -1
  417. package/node_modules/@earendil-works/pi-codemode/dist/source.d.ts.map +1 -1
  418. package/node_modules/@earendil-works/pi-codemode/dist/source.js +8 -2
  419. package/node_modules/@earendil-works/pi-codemode/dist/source.js.map +1 -1
  420. package/node_modules/@earendil-works/pi-codemode/dist/types.d.ts +101 -6
  421. package/node_modules/@earendil-works/pi-codemode/dist/types.d.ts.map +1 -1
  422. package/node_modules/@earendil-works/pi-codemode/dist/types.js.map +1 -1
  423. package/node_modules/@earendil-works/pi-codemode/package.json +15 -3
  424. package/node_modules/@earendil-works/pi-coding-agent/CHANGELOG.md +165 -0
  425. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/anthropic-messages-Q7SXESRX.js +6 -0
  426. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/anthropic.js +1 -1
  427. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/azure-openai-responses-LM52U7CK.js +2 -0
  428. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/bedrock-converse-stream.js +2 -2
  429. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-22CYIUS4.js +2 -0
  430. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-3ZATHNCK.js +9 -0
  431. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-5GTPJSRI.js +7 -0
  432. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-6MWTY2OB.js +130 -0
  433. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-6QGV3IWD.js +6 -0
  434. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-2KAZSACP.js → chunk-AKJ3ZOR3.js} +1 -1
  435. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-G7EDXK4D.js → chunk-CQ3XTLTY.js} +1 -1
  436. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-SYF2TF6W.js → chunk-D7PHKNBM.js} +29 -92
  437. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-DOST5PQW.js +82 -0
  438. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-DVQEBGVL.js +2 -0
  439. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-ZSI3BL5Q.js → chunk-GDR5JFDJ.js} +1 -1
  440. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-HACVPRBJ.js +11 -0
  441. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-ITZNWD4K.js +2 -0
  442. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-LPXNMA2W.js +2 -0
  443. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-LD2P6SFZ.js → chunk-PMRZO46Y.js} +1 -1
  444. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-RDZVAGPR.js +2 -0
  445. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-ZSBPJAJ2.js → chunk-TJXZSVTD.js} +116 -99
  446. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-BYB6ZAAQ.js → chunk-TN4NLWHF.js} +1 -1
  447. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-WBQBCFWG.js +2 -0
  448. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-WJUNYZC5.js +2 -0
  449. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-XIX7LUWI.js +2 -0
  450. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-ZBURYEWF.js +2 -0
  451. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{cli-KILDDGW3.js → cli-SWM4FQ6V.js} +4 -4
  452. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/cloudflare-workers-ai-system-one-UTBL2KOF.js +2 -0
  453. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/codemode-worker.js +117 -14
  454. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/easter-egg-3d-OX6RUCIS.js +2 -0
  455. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/execute-3CFUPDLS.js +499 -0
  456. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/github-copilot.js +1 -1
  457. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{google-generative-ai-ZOK6CV7D.js → google-generative-ai-DXKP72HC.js} +1 -1
  458. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{google-vertex-VKWZQ3AY.js → google-vertex-W6SIDOVV.js} +1 -1
  459. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/image-resize-worker.js +1 -1
  460. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{llama-cpp-classify-XT44PI3C.js → llama-cpp-classify-FYN623RH.js} +2 -2
  461. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/mistral-conversations-GBMHTSYF.js +5 -0
  462. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/openai-chatgpt.js +1 -1
  463. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/openai-codex-responses-RN6B5UPP.js +10 -0
  464. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/openai-codex.js +1 -1
  465. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{openai-completions-GWHGMQ3T.js → openai-completions-QW2B4SML.js} +1 -1
  466. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/openai-decisions-WVPMQ4JD.js +5 -0
  467. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{openai-responses-EZ7FJ2KL.js → openai-responses-KDJUSIU7.js} +1 -1
  468. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{openrouter-images-ZVXWCSIM.js → openrouter-images-DUPG5DZO.js} +1 -1
  469. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{pi-messages-TM5SOOIW.js → pi-messages-YHKPQIHC.js} +1 -1
  470. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/runtime-366HE7CW.js +2 -0
  471. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/typesafe-system-one-ZSK3RN4B.js +2 -0
  472. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/virtual-modules-GI6FRNLG.js +2 -0
  473. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/cli-runtime.js +1 -1
  474. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/index.js +1 -1
  475. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/rpc-entry.js +1 -1
  476. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.d.ts +2 -1
  477. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.d.ts.map +1 -1
  478. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.js +24 -5
  479. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.js.map +1 -1
  480. package/node_modules/@earendil-works/pi-coding-agent/dist/config.d.ts +18 -1
  481. package/node_modules/@earendil-works/pi-coding-agent/dist/config.d.ts.map +1 -1
  482. package/node_modules/@earendil-works/pi-coding-agent/dist/config.js +44 -6
  483. package/node_modules/@earendil-works/pi-coding-agent/dist/config.js.map +1 -1
  484. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.d.ts +47 -5
  485. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
  486. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.js +148 -78
  487. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.js.map +1 -1
  488. package/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.d.ts.map +1 -1
  489. package/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.js +20 -13
  490. package/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.js.map +1 -1
  491. package/node_modules/@earendil-works/pi-coding-agent/dist/core/bash-executor.d.ts.map +1 -1
  492. package/node_modules/@earendil-works/pi-coding-agent/dist/core/bash-executor.js +42 -52
  493. package/node_modules/@earendil-works/pi-coding-agent/dist/core/bash-executor.js.map +1 -1
  494. package/node_modules/@earendil-works/pi-coding-agent/dist/core/bug-report.d.ts +9 -1
  495. package/node_modules/@earendil-works/pi-coding-agent/dist/core/bug-report.d.ts.map +1 -1
  496. package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/utils.d.ts +6 -0
  497. package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/utils.d.ts.map +1 -1
  498. package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/utils.js +7 -8
  499. package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/utils.js.map +1 -1
  500. package/node_modules/@earendil-works/pi-coding-agent/dist/core/export-html/tool-renderer.d.ts.map +1 -1
  501. package/node_modules/@earendil-works/pi-coding-agent/dist/core/export-html/tool-renderer.js +2 -0
  502. package/node_modules/@earendil-works/pi-coding-agent/dist/core/export-html/tool-renderer.js.map +1 -1
  503. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/index.d.ts +1 -1
  504. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/index.d.ts.map +1 -1
  505. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/index.js.map +1 -1
  506. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.d.ts +4 -2
  507. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
  508. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.js +2 -3
  509. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
  510. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/types.d.ts +44 -7
  511. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -1
  512. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/types.js.map +1 -1
  513. package/node_modules/@earendil-works/pi-coding-agent/dist/core/key-id-schema.d.ts +6 -0
  514. package/node_modules/@earendil-works/pi-coding-agent/dist/core/key-id-schema.d.ts.map +1 -0
  515. package/node_modules/@earendil-works/pi-coding-agent/dist/core/key-id-schema.js +16 -0
  516. package/node_modules/@earendil-works/pi-coding-agent/dist/core/key-id-schema.js.map +1 -0
  517. package/node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings-schema.d.ts +4 -0
  518. package/node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings-schema.d.ts.map +1 -0
  519. package/node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings-schema.js +16 -0
  520. package/node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings-schema.js.map +1 -0
  521. package/node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings.d.ts +198 -66
  522. package/node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings.d.ts.map +1 -1
  523. package/node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings.js +26 -23
  524. package/node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings.js.map +1 -1
  525. package/node_modules/@earendil-works/pi-coding-agent/dist/core/mcp-servers.d.ts +8 -0
  526. package/node_modules/@earendil-works/pi-coding-agent/dist/core/mcp-servers.d.ts.map +1 -1
  527. package/node_modules/@earendil-works/pi-coding-agent/dist/core/mcp-servers.js +30 -7
  528. package/node_modules/@earendil-works/pi-coding-agent/dist/core/mcp-servers.js.map +1 -1
  529. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-config.d.ts +695 -74
  530. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-config.d.ts.map +1 -1
  531. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-config.js +16 -166
  532. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-config.js.map +1 -1
  533. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-resolver.js +1 -1
  534. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-resolver.js.map +1 -1
  535. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-runtime.d.ts.map +1 -1
  536. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-runtime.js +13 -7
  537. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-runtime.js.map +1 -1
  538. package/node_modules/@earendil-works/pi-coding-agent/dist/core/nested-tool-calls.d.ts +1 -0
  539. package/node_modules/@earendil-works/pi-coding-agent/dist/core/nested-tool-calls.d.ts.map +1 -1
  540. package/node_modules/@earendil-works/pi-coding-agent/dist/core/nested-tool-calls.js +1 -0
  541. package/node_modules/@earendil-works/pi-coding-agent/dist/core/nested-tool-calls.js.map +1 -1
  542. package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.d.ts.map +1 -1
  543. package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.js +3 -3
  544. package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.js.map +1 -1
  545. package/node_modules/@earendil-works/pi-coding-agent/dist/core/project-trust.d.ts.map +1 -1
  546. package/node_modules/@earendil-works/pi-coding-agent/dist/core/project-trust.js +2 -1
  547. package/node_modules/@earendil-works/pi-coding-agent/dist/core/project-trust.js.map +1 -1
  548. package/node_modules/@earendil-works/pi-coding-agent/dist/core/remote-catalog-provider.d.ts +12 -1
  549. package/node_modules/@earendil-works/pi-coding-agent/dist/core/remote-catalog-provider.d.ts.map +1 -1
  550. package/node_modules/@earendil-works/pi-coding-agent/dist/core/remote-catalog-provider.js +82 -24
  551. package/node_modules/@earendil-works/pi-coding-agent/dist/core/remote-catalog-provider.js.map +1 -1
  552. package/node_modules/@earendil-works/pi-coding-agent/dist/core/resource-loader.d.ts +3 -0
  553. package/node_modules/@earendil-works/pi-coding-agent/dist/core/resource-loader.d.ts.map +1 -1
  554. package/node_modules/@earendil-works/pi-coding-agent/dist/core/resource-loader.js +9 -4
  555. package/node_modules/@earendil-works/pi-coding-agent/dist/core/resource-loader.js.map +1 -1
  556. package/node_modules/@earendil-works/pi-coding-agent/dist/core/sdk.d.ts +13 -4
  557. package/node_modules/@earendil-works/pi-coding-agent/dist/core/sdk.d.ts.map +1 -1
  558. package/node_modules/@earendil-works/pi-coding-agent/dist/core/sdk.js +19 -6
  559. package/node_modules/@earendil-works/pi-coding-agent/dist/core/sdk.js.map +1 -1
  560. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-defaults.d.ts +65 -0
  561. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-defaults.d.ts.map +1 -0
  562. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-defaults.js +66 -0
  563. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-defaults.js.map +1 -0
  564. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-manager.d.ts +15 -145
  565. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
  566. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-manager.js +85 -57
  567. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
  568. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-schema.d.ts +228 -0
  569. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-schema.d.ts.map +1 -0
  570. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-schema.js +287 -0
  571. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-schema.js.map +1 -0
  572. package/node_modules/@earendil-works/pi-coding-agent/dist/core/skills.d.ts +4 -1
  573. package/node_modules/@earendil-works/pi-coding-agent/dist/core/skills.d.ts.map +1 -1
  574. package/node_modules/@earendil-works/pi-coding-agent/dist/core/skills.js +6 -1
  575. package/node_modules/@earendil-works/pi-coding-agent/dist/core/skills.js.map +1 -1
  576. package/node_modules/@earendil-works/pi-coding-agent/dist/core/system-prompt.d.ts +6 -0
  577. package/node_modules/@earendil-works/pi-coding-agent/dist/core/system-prompt.d.ts.map +1 -1
  578. package/node_modules/@earendil-works/pi-coding-agent/dist/core/system-prompt.js +9 -4
  579. package/node_modules/@earendil-works/pi-coding-agent/dist/core/system-prompt.js.map +1 -1
  580. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/output-accumulator.d.ts.map +1 -1
  581. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/output-accumulator.js +4 -10
  582. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/output-accumulator.js.map +1 -1
  583. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.d.ts +13 -0
  584. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.d.ts.map +1 -1
  585. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.js +18 -1
  586. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.js.map +1 -1
  587. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/render-utils.d.ts +18 -0
  588. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/render-utils.d.ts.map +1 -1
  589. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/render-utils.js +46 -0
  590. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/render-utils.js.map +1 -1
  591. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/renderers/bash.d.ts.map +1 -1
  592. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/renderers/bash.js +7 -35
  593. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/renderers/bash.js.map +1 -1
  594. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/renderers/edit.d.ts.map +1 -1
  595. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/renderers/edit.js +5 -4
  596. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/renderers/edit.js.map +1 -1
  597. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/execute.d.ts.map +1 -1
  598. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/execute.js +165 -48
  599. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/execute.js.map +1 -1
  600. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/index.d.ts.map +1 -1
  601. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/index.js +3 -1
  602. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/index.js.map +1 -1
  603. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/renderer.d.ts +2 -2
  604. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/renderer.d.ts.map +1 -1
  605. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/renderer.js +9 -3
  606. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/renderer.js.map +1 -1
  607. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/tool.d.ts +15 -14
  608. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/tool.d.ts.map +1 -1
  609. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/tool.js +58 -38
  610. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/tool.js.map +1 -1
  611. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/llama/provider.d.ts.map +1 -1
  612. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/llama/provider.js +34 -11
  613. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/llama/provider.js.map +1 -1
  614. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/cli.js +22 -31
  615. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/cli.js.map +1 -1
  616. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/index.d.ts.map +1 -1
  617. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/index.js +188 -84
  618. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/index.js.map +1 -1
  619. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/oauth.d.ts +5 -3
  620. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/oauth.d.ts.map +1 -1
  621. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/oauth.js +36 -10
  622. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/oauth.js.map +1 -1
  623. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/resources.d.ts +3 -10
  624. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/resources.d.ts.map +1 -1
  625. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/resources.js +4 -5
  626. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/resources.js.map +1 -1
  627. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/runtime.d.ts +7 -7
  628. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/runtime.d.ts.map +1 -1
  629. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/runtime.js +26 -44
  630. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/runtime.js.map +1 -1
  631. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/tools.d.ts +4 -4
  632. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/tools.d.ts.map +1 -1
  633. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/tools.js +68 -16
  634. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/tools.js.map +1 -1
  635. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/ui.d.ts +3 -3
  636. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/ui.d.ts.map +1 -1
  637. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/ui.js +10 -2
  638. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/ui.js.map +1 -1
  639. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/tool-search/tool.d.ts +0 -2
  640. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/tool-search/tool.d.ts.map +1 -1
  641. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/tool-search/tool.js +2 -4
  642. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/tool-search/tool.js.map +1 -1
  643. package/node_modules/@earendil-works/pi-coding-agent/dist/index.d.ts +1 -1
  644. package/node_modules/@earendil-works/pi-coding-agent/dist/index.d.ts.map +1 -1
  645. package/node_modules/@earendil-works/pi-coding-agent/dist/index.js.map +1 -1
  646. package/node_modules/@earendil-works/pi-coding-agent/dist/main.d.ts.map +1 -1
  647. package/node_modules/@earendil-works/pi-coding-agent/dist/main.js +4 -3
  648. package/node_modules/@earendil-works/pi-coding-agent/dist/main.js.map +1 -1
  649. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/bash-execution.d.ts +5 -1
  650. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
  651. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/bash-execution.js +17 -14
  652. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/bash-execution.js.map +1 -1
  653. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.d.ts +2 -1
  654. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
  655. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.js +5 -2
  656. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
  657. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.d.ts +2 -1
  658. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
  659. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.js +5 -2
  660. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
  661. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/custom-entry.d.ts +3 -1
  662. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/custom-entry.d.ts.map +1 -1
  663. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/custom-entry.js +8 -2
  664. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/custom-entry.js.map +1 -1
  665. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  666. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/custom-message.js +1 -0
  667. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/custom-message.js.map +1 -1
  668. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  669. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/settings-selector.js +4 -3
  670. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/settings-selector.js.map +1 -1
  671. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts +2 -1
  672. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
  673. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.js +5 -2
  674. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
  675. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/status-indicator.d.ts +1 -1
  676. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
  677. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/status-indicator.js +2 -2
  678. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/status-indicator.js.map +1 -1
  679. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts +5 -0
  680. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  681. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +10 -0
  682. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
  683. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +9 -0
  684. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  685. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js +103 -40
  686. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
  687. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/program-status-reporter.d.ts +34 -0
  688. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/program-status-reporter.d.ts.map +1 -0
  689. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/program-status-reporter.js +110 -0
  690. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/program-status-reporter.js.map +1 -0
  691. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/dark.json +1 -1
  692. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/light.json +1 -1
  693. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-schema.d.ts +28 -0
  694. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -0
  695. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-schema.js +105 -0
  696. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-schema.js.map +1 -0
  697. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-tokens.d.ts +257 -0
  698. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-tokens.d.ts.map +1 -0
  699. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-tokens.js +94 -0
  700. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-tokens.js.map +1 -0
  701. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts +13 -16
  702. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  703. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.js +22 -29
  704. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.js.map +1 -1
  705. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/print-mode.d.ts.map +1 -1
  706. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/print-mode.js +4 -0
  707. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/print-mode.js.map +1 -1
  708. package/node_modules/@earendil-works/pi-coding-agent/dist/package-manager-cli.d.ts.map +1 -1
  709. package/node_modules/@earendil-works/pi-coding-agent/dist/package-manager-cli.js +24 -0
  710. package/node_modules/@earendil-works/pi-coding-agent/dist/package-manager-cli.js.map +1 -1
  711. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/ansi.d.ts +8 -0
  712. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/ansi.d.ts.map +1 -1
  713. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/ansi.js +30 -11
  714. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/ansi.js.map +1 -1
  715. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/clipboard.d.ts.map +1 -1
  716. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/clipboard.js +18 -12
  717. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/clipboard.js.map +1 -1
  718. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-core.d.ts +12 -0
  719. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-core.d.ts.map +1 -1
  720. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-core.js +5 -0
  721. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-core.js.map +1 -1
  722. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-worker.js +3 -2
  723. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-worker.js.map +1 -1
  724. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize.d.ts.map +1 -1
  725. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize.js +9 -10
  726. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize.js.map +1 -1
  727. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/output-files.d.ts +15 -0
  728. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/output-files.d.ts.map +1 -0
  729. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/output-files.js +30 -0
  730. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/output-files.js.map +1 -0
  731. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/syntax-highlight.d.ts.map +1 -1
  732. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/syntax-highlight.js +6 -1
  733. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/syntax-highlight.js.map +1 -1
  734. package/node_modules/@earendil-works/pi-coding-agent/docs/cli-integration.md +1 -1
  735. package/node_modules/@earendil-works/pi-coding-agent/docs/cli.md +19 -7
  736. package/node_modules/@earendil-works/pi-coding-agent/docs/codemode.md +30 -9
  737. package/node_modules/@earendil-works/pi-coding-agent/docs/compaction.md +2 -2
  738. package/node_modules/@earendil-works/pi-coding-agent/docs/environment-variables.md +3 -1
  739. package/node_modules/@earendil-works/pi-coding-agent/docs/extensions.md +7 -4
  740. package/node_modules/@earendil-works/pi-coding-agent/docs/json.md +3 -3
  741. package/node_modules/@earendil-works/pi-coding-agent/docs/keybindings.md +5 -4
  742. package/node_modules/@earendil-works/pi-coding-agent/docs/llama-cpp.md +8 -1
  743. package/node_modules/@earendil-works/pi-coding-agent/docs/mcp.md +4 -2
  744. package/node_modules/@earendil-works/pi-coding-agent/docs/message-types.md +22 -4
  745. package/node_modules/@earendil-works/pi-coding-agent/docs/models.md +5 -1
  746. package/node_modules/@earendil-works/pi-coding-agent/docs/providers.md +47 -0
  747. package/node_modules/@earendil-works/pi-coding-agent/docs/settings.md +6 -4
  748. package/node_modules/@earendil-works/pi-coding-agent/docs/terminal-setup.md +14 -0
  749. package/node_modules/@earendil-works/pi-coding-agent/docs/themes.md +4 -2
  750. package/node_modules/@earendil-works/pi-coding-agent/docs/tui.md +1 -1
  751. package/node_modules/@earendil-works/pi-coding-agent/examples/README.md +0 -3
  752. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  753. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-anthropic/package.json +1 -1
  754. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  755. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/dynamic-resources/dynamic.json +1 -1
  756. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/gondolin/package-lock.json +2 -2
  757. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/gondolin/package.json +1 -1
  758. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/overlay-test.ts +2 -2
  759. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/plan-mode/index.ts +6 -2
  760. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/sandbox/package-lock.json +2 -2
  761. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/sandbox/package.json +1 -1
  762. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/with-deps/package-lock.json +2 -2
  763. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/with-deps/package.json +1 -1
  764. package/node_modules/@earendil-works/pi-coding-agent/package.json +10 -21
  765. package/node_modules/@earendil-works/pi-coding-agent/schemas/keybindings.schema.json +393 -0
  766. package/node_modules/@earendil-works/pi-coding-agent/schemas/models.schema.json +1157 -0
  767. package/node_modules/@earendil-works/pi-coding-agent/schemas/settings.schema.json +765 -0
  768. package/node_modules/@earendil-works/pi-coding-agent/schemas/theme.schema.json +365 -0
  769. package/node_modules/@earendil-works/pi-durable/CHANGELOG.md +114 -0
  770. package/node_modules/@earendil-works/pi-durable/README.md +164 -12
  771. package/node_modules/@earendil-works/pi-durable/dist/codemode/codemode.d.ts +173 -0
  772. package/node_modules/@earendil-works/pi-durable/dist/codemode/codemode.d.ts.map +1 -0
  773. package/node_modules/@earendil-works/pi-durable/dist/codemode/codemode.js +886 -0
  774. package/node_modules/@earendil-works/pi-durable/dist/codemode/codemode.js.map +1 -0
  775. package/node_modules/@earendil-works/pi-durable/dist/codemode/describe.d.ts +38 -0
  776. package/node_modules/@earendil-works/pi-durable/dist/codemode/describe.d.ts.map +1 -0
  777. package/node_modules/@earendil-works/pi-durable/dist/codemode/describe.js +119 -0
  778. package/node_modules/@earendil-works/pi-durable/dist/codemode/describe.js.map +1 -0
  779. package/node_modules/@earendil-works/pi-durable/dist/codemode/index.d.ts +3 -0
  780. package/node_modules/@earendil-works/pi-durable/dist/codemode/index.d.ts.map +1 -0
  781. package/node_modules/@earendil-works/pi-durable/dist/codemode/index.js +3 -0
  782. package/node_modules/@earendil-works/pi-durable/dist/codemode/index.js.map +1 -0
  783. package/node_modules/@earendil-works/pi-durable/dist/codemode/models.d.ts +28 -0
  784. package/node_modules/@earendil-works/pi-durable/dist/codemode/models.d.ts.map +1 -0
  785. package/node_modules/@earendil-works/pi-durable/dist/codemode/models.js +231 -0
  786. package/node_modules/@earendil-works/pi-durable/dist/codemode/models.js.map +1 -0
  787. package/node_modules/@earendil-works/pi-durable/dist/codemode/output.d.ts +41 -0
  788. package/node_modules/@earendil-works/pi-durable/dist/codemode/output.d.ts.map +1 -0
  789. package/node_modules/@earendil-works/pi-durable/dist/codemode/output.js +167 -0
  790. package/node_modules/@earendil-works/pi-durable/dist/codemode/output.js.map +1 -0
  791. package/node_modules/@earendil-works/pi-durable/dist/env/decode.d.ts +16 -0
  792. package/node_modules/@earendil-works/pi-durable/dist/env/decode.d.ts.map +1 -0
  793. package/node_modules/@earendil-works/pi-durable/dist/env/decode.js +28 -0
  794. package/node_modules/@earendil-works/pi-durable/dist/env/decode.js.map +1 -0
  795. package/node_modules/@earendil-works/pi-durable/dist/env/index.d.ts +197 -3
  796. package/node_modules/@earendil-works/pi-durable/dist/env/index.d.ts.map +1 -1
  797. package/node_modules/@earendil-works/pi-durable/dist/env/index.js +2 -0
  798. package/node_modules/@earendil-works/pi-durable/dist/env/index.js.map +1 -1
  799. package/node_modules/@earendil-works/pi-durable/dist/env/line-scan.d.ts +13 -0
  800. package/node_modules/@earendil-works/pi-durable/dist/env/line-scan.d.ts.map +1 -0
  801. package/node_modules/@earendil-works/pi-durable/dist/env/line-scan.js +147 -0
  802. package/node_modules/@earendil-works/pi-durable/dist/env/line-scan.js.map +1 -0
  803. package/node_modules/@earendil-works/pi-durable/dist/env/node-watch.d.ts +29 -0
  804. package/node_modules/@earendil-works/pi-durable/dist/env/node-watch.d.ts.map +1 -0
  805. package/node_modules/@earendil-works/pi-durable/dist/env/node-watch.js +485 -0
  806. package/node_modules/@earendil-works/pi-durable/dist/env/node-watch.js.map +1 -0
  807. package/node_modules/@earendil-works/pi-durable/dist/env/node.d.ts +11 -2
  808. package/node_modules/@earendil-works/pi-durable/dist/env/node.d.ts.map +1 -1
  809. package/node_modules/@earendil-works/pi-durable/dist/env/node.js +284 -21
  810. package/node_modules/@earendil-works/pi-durable/dist/env/node.js.map +1 -1
  811. package/node_modules/@earendil-works/pi-durable/dist/errors.d.ts +20 -3
  812. package/node_modules/@earendil-works/pi-durable/dist/errors.d.ts.map +1 -1
  813. package/node_modules/@earendil-works/pi-durable/dist/errors.js +34 -5
  814. package/node_modules/@earendil-works/pi-durable/dist/errors.js.map +1 -1
  815. package/node_modules/@earendil-works/pi-durable/dist/harness/agent.d.ts +7 -3
  816. package/node_modules/@earendil-works/pi-durable/dist/harness/agent.d.ts.map +1 -1
  817. package/node_modules/@earendil-works/pi-durable/dist/harness/agent.js +81 -25
  818. package/node_modules/@earendil-works/pi-durable/dist/harness/agent.js.map +1 -1
  819. package/node_modules/@earendil-works/pi-durable/dist/harness/compaction.d.ts +6 -1
  820. package/node_modules/@earendil-works/pi-durable/dist/harness/compaction.d.ts.map +1 -1
  821. package/node_modules/@earendil-works/pi-durable/dist/harness/compaction.js +11 -8
  822. package/node_modules/@earendil-works/pi-durable/dist/harness/compaction.js.map +1 -1
  823. package/node_modules/@earendil-works/pi-durable/dist/harness/context.d.ts +29 -1
  824. package/node_modules/@earendil-works/pi-durable/dist/harness/context.d.ts.map +1 -1
  825. package/node_modules/@earendil-works/pi-durable/dist/harness/context.js +125 -24
  826. package/node_modules/@earendil-works/pi-durable/dist/harness/context.js.map +1 -1
  827. package/node_modules/@earendil-works/pi-durable/dist/harness/events.d.ts +35 -15
  828. package/node_modules/@earendil-works/pi-durable/dist/harness/events.d.ts.map +1 -1
  829. package/node_modules/@earendil-works/pi-durable/dist/harness/events.js +77 -23
  830. package/node_modules/@earendil-works/pi-durable/dist/harness/events.js.map +1 -1
  831. package/node_modules/@earendil-works/pi-durable/dist/harness/generation.d.ts +2 -0
  832. package/node_modules/@earendil-works/pi-durable/dist/harness/generation.d.ts.map +1 -1
  833. package/node_modules/@earendil-works/pi-durable/dist/harness/generation.js +40 -16
  834. package/node_modules/@earendil-works/pi-durable/dist/harness/generation.js.map +1 -1
  835. package/node_modules/@earendil-works/pi-durable/dist/harness/harness.d.ts +7 -0
  836. package/node_modules/@earendil-works/pi-durable/dist/harness/harness.d.ts.map +1 -1
  837. package/node_modules/@earendil-works/pi-durable/dist/harness/harness.js +56 -28
  838. package/node_modules/@earendil-works/pi-durable/dist/harness/harness.js.map +1 -1
  839. package/node_modules/@earendil-works/pi-durable/dist/harness/inbox.d.ts +16 -4
  840. package/node_modules/@earendil-works/pi-durable/dist/harness/inbox.d.ts.map +1 -1
  841. package/node_modules/@earendil-works/pi-durable/dist/harness/inbox.js +26 -3
  842. package/node_modules/@earendil-works/pi-durable/dist/harness/inbox.js.map +1 -1
  843. package/node_modules/@earendil-works/pi-durable/dist/harness/live.d.ts +74 -17
  844. package/node_modules/@earendil-works/pi-durable/dist/harness/live.d.ts.map +1 -1
  845. package/node_modules/@earendil-works/pi-durable/dist/harness/live.js +66 -14
  846. package/node_modules/@earendil-works/pi-durable/dist/harness/live.js.map +1 -1
  847. package/node_modules/@earendil-works/pi-durable/dist/harness/output.d.ts +13 -6
  848. package/node_modules/@earendil-works/pi-durable/dist/harness/output.d.ts.map +1 -1
  849. package/node_modules/@earendil-works/pi-durable/dist/harness/output.js +75 -18
  850. package/node_modules/@earendil-works/pi-durable/dist/harness/output.js.map +1 -1
  851. package/node_modules/@earendil-works/pi-durable/dist/harness/scheduler.d.ts +18 -5
  852. package/node_modules/@earendil-works/pi-durable/dist/harness/scheduler.d.ts.map +1 -1
  853. package/node_modules/@earendil-works/pi-durable/dist/harness/scheduler.js +794 -168
  854. package/node_modules/@earendil-works/pi-durable/dist/harness/scheduler.js.map +1 -1
  855. package/node_modules/@earendil-works/pi-durable/dist/harness/submissions.d.ts +7 -4
  856. package/node_modules/@earendil-works/pi-durable/dist/harness/submissions.d.ts.map +1 -1
  857. package/node_modules/@earendil-works/pi-durable/dist/harness/submissions.js +32 -13
  858. package/node_modules/@earendil-works/pi-durable/dist/harness/submissions.js.map +1 -1
  859. package/node_modules/@earendil-works/pi-durable/dist/harness/task-graph.d.ts +1 -1
  860. package/node_modules/@earendil-works/pi-durable/dist/harness/task-graph.d.ts.map +1 -1
  861. package/node_modules/@earendil-works/pi-durable/dist/harness/task-graph.js +15 -10
  862. package/node_modules/@earendil-works/pi-durable/dist/harness/task-graph.js.map +1 -1
  863. package/node_modules/@earendil-works/pi-durable/dist/harness/tool.d.ts +45 -5
  864. package/node_modules/@earendil-works/pi-durable/dist/harness/tool.d.ts.map +1 -1
  865. package/node_modules/@earendil-works/pi-durable/dist/harness/tool.js +400 -67
  866. package/node_modules/@earendil-works/pi-durable/dist/harness/tool.js.map +1 -1
  867. package/node_modules/@earendil-works/pi-durable/dist/harness/types.d.ts +194 -17
  868. package/node_modules/@earendil-works/pi-durable/dist/harness/types.d.ts.map +1 -1
  869. package/node_modules/@earendil-works/pi-durable/dist/harness/types.js.map +1 -1
  870. package/node_modules/@earendil-works/pi-durable/dist/harness/util.d.ts +6 -1
  871. package/node_modules/@earendil-works/pi-durable/dist/harness/util.d.ts.map +1 -1
  872. package/node_modules/@earendil-works/pi-durable/dist/harness/util.js +5 -2
  873. package/node_modules/@earendil-works/pi-durable/dist/harness/util.js.map +1 -1
  874. package/node_modules/@earendil-works/pi-durable/dist/harness/view.d.ts +6 -2
  875. package/node_modules/@earendil-works/pi-durable/dist/harness/view.d.ts.map +1 -1
  876. package/node_modules/@earendil-works/pi-durable/dist/harness/view.js +22 -12
  877. package/node_modules/@earendil-works/pi-durable/dist/harness/view.js.map +1 -1
  878. package/node_modules/@earendil-works/pi-durable/dist/images/cloudflare.d.ts +4 -0
  879. package/node_modules/@earendil-works/pi-durable/dist/images/cloudflare.d.ts.map +1 -0
  880. package/node_modules/@earendil-works/pi-durable/dist/images/cloudflare.js +9 -0
  881. package/node_modules/@earendil-works/pi-durable/dist/images/cloudflare.js.map +1 -0
  882. package/node_modules/@earendil-works/pi-durable/dist/images/exif.d.ts +3 -0
  883. package/node_modules/@earendil-works/pi-durable/dist/images/exif.d.ts.map +1 -0
  884. package/node_modules/@earendil-works/pi-durable/dist/images/exif.js +71 -0
  885. package/node_modules/@earendil-works/pi-durable/dist/images/exif.js.map +1 -0
  886. package/node_modules/@earendil-works/pi-durable/dist/images/index.d.ts +18 -0
  887. package/node_modules/@earendil-works/pi-durable/dist/images/index.d.ts.map +1 -0
  888. package/node_modules/@earendil-works/pi-durable/dist/images/index.js +125 -0
  889. package/node_modules/@earendil-works/pi-durable/dist/images/index.js.map +1 -0
  890. package/node_modules/@earendil-works/pi-durable/dist/images/node-worker.d.ts +17 -0
  891. package/node_modules/@earendil-works/pi-durable/dist/images/node-worker.d.ts.map +1 -0
  892. package/node_modules/@earendil-works/pi-durable/dist/images/node-worker.js +16 -0
  893. package/node_modules/@earendil-works/pi-durable/dist/images/node-worker.js.map +1 -0
  894. package/node_modules/@earendil-works/pi-durable/dist/images/node.d.ts +21 -0
  895. package/node_modules/@earendil-works/pi-durable/dist/images/node.d.ts.map +1 -0
  896. package/node_modules/@earendil-works/pi-durable/dist/images/node.js +121 -0
  897. package/node_modules/@earendil-works/pi-durable/dist/images/node.js.map +1 -0
  898. package/node_modules/@earendil-works/pi-durable/dist/index.d.ts +7 -7
  899. package/node_modules/@earendil-works/pi-durable/dist/index.d.ts.map +1 -1
  900. package/node_modules/@earendil-works/pi-durable/dist/index.js +4 -4
  901. package/node_modules/@earendil-works/pi-durable/dist/index.js.map +1 -1
  902. package/node_modules/@earendil-works/pi-durable/dist/search.d.ts +13 -0
  903. package/node_modules/@earendil-works/pi-durable/dist/search.d.ts.map +1 -0
  904. package/node_modules/@earendil-works/pi-durable/dist/search.js +85 -0
  905. package/node_modules/@earendil-works/pi-durable/dist/search.js.map +1 -0
  906. package/node_modules/@earendil-works/pi-durable/dist/session/observation.d.ts +10 -3
  907. package/node_modules/@earendil-works/pi-durable/dist/session/observation.d.ts.map +1 -1
  908. package/node_modules/@earendil-works/pi-durable/dist/session/observation.js +24 -34
  909. package/node_modules/@earendil-works/pi-durable/dist/session/observation.js.map +1 -1
  910. package/node_modules/@earendil-works/pi-durable/dist/session/session.d.ts +71 -6
  911. package/node_modules/@earendil-works/pi-durable/dist/session/session.d.ts.map +1 -1
  912. package/node_modules/@earendil-works/pi-durable/dist/session/session.js +463 -50
  913. package/node_modules/@earendil-works/pi-durable/dist/session/session.js.map +1 -1
  914. package/node_modules/@earendil-works/pi-durable/dist/session/transaction.d.ts +2 -0
  915. package/node_modules/@earendil-works/pi-durable/dist/session/transaction.d.ts.map +1 -1
  916. package/node_modules/@earendil-works/pi-durable/dist/session/transaction.js +19 -1
  917. package/node_modules/@earendil-works/pi-durable/dist/session/transaction.js.map +1 -1
  918. package/node_modules/@earendil-works/pi-durable/dist/storage/jsonl/storage.d.ts +8 -0
  919. package/node_modules/@earendil-works/pi-durable/dist/storage/jsonl/storage.d.ts.map +1 -1
  920. package/node_modules/@earendil-works/pi-durable/dist/storage/jsonl/storage.js +2 -1
  921. package/node_modules/@earendil-works/pi-durable/dist/storage/jsonl/storage.js.map +1 -1
  922. package/node_modules/@earendil-works/pi-durable/dist/storage/memory.d.ts +2 -0
  923. package/node_modules/@earendil-works/pi-durable/dist/storage/memory.d.ts.map +1 -1
  924. package/node_modules/@earendil-works/pi-durable/dist/storage/memory.js +79 -27
  925. package/node_modules/@earendil-works/pi-durable/dist/storage/memory.js.map +1 -1
  926. package/node_modules/@earendil-works/pi-durable/dist/storage/scan.d.ts +18 -0
  927. package/node_modules/@earendil-works/pi-durable/dist/storage/scan.d.ts.map +1 -0
  928. package/node_modules/@earendil-works/pi-durable/dist/storage/scan.js +29 -0
  929. package/node_modules/@earendil-works/pi-durable/dist/storage/scan.js.map +1 -0
  930. package/node_modules/@earendil-works/pi-durable/dist/storage/sqlite/cloudflare.d.ts +46 -0
  931. package/node_modules/@earendil-works/pi-durable/dist/storage/sqlite/cloudflare.d.ts.map +1 -0
  932. package/node_modules/@earendil-works/pi-durable/dist/storage/sqlite/cloudflare.js +106 -0
  933. package/node_modules/@earendil-works/pi-durable/dist/storage/sqlite/cloudflare.js.map +1 -0
  934. package/node_modules/@earendil-works/pi-durable/dist/storage/sqlite/storage.d.ts +2 -0
  935. package/node_modules/@earendil-works/pi-durable/dist/storage/sqlite/storage.d.ts.map +1 -1
  936. package/node_modules/@earendil-works/pi-durable/dist/storage/sqlite/storage.js +77 -27
  937. package/node_modules/@earendil-works/pi-durable/dist/storage/sqlite/storage.js.map +1 -1
  938. package/node_modules/@earendil-works/pi-durable/dist/testing/env-conformance.d.ts +7 -0
  939. package/node_modules/@earendil-works/pi-durable/dist/testing/env-conformance.d.ts.map +1 -0
  940. package/node_modules/@earendil-works/pi-durable/dist/testing/env-conformance.js +531 -0
  941. package/node_modules/@earendil-works/pi-durable/dist/testing/env-conformance.js.map +1 -0
  942. package/node_modules/@earendil-works/pi-durable/dist/testing/index.d.ts +3 -2
  943. package/node_modules/@earendil-works/pi-durable/dist/testing/index.d.ts.map +1 -1
  944. package/node_modules/@earendil-works/pi-durable/dist/testing/index.js +2 -1
  945. package/node_modules/@earendil-works/pi-durable/dist/testing/index.js.map +1 -1
  946. package/node_modules/@earendil-works/pi-durable/dist/testing/runner.d.ts +4 -2
  947. package/node_modules/@earendil-works/pi-durable/dist/testing/runner.d.ts.map +1 -1
  948. package/node_modules/@earendil-works/pi-durable/dist/testing/runner.js +9 -0
  949. package/node_modules/@earendil-works/pi-durable/dist/testing/runner.js.map +1 -1
  950. package/node_modules/@earendil-works/pi-durable/dist/testing/storage-conformance.d.ts.map +1 -1
  951. package/node_modules/@earendil-works/pi-durable/dist/testing/storage-conformance.js +61 -2
  952. package/node_modules/@earendil-works/pi-durable/dist/testing/storage-conformance.js.map +1 -1
  953. package/node_modules/@earendil-works/pi-durable/dist/testing/types.d.ts +20 -0
  954. package/node_modules/@earendil-works/pi-durable/dist/testing/types.d.ts.map +1 -1
  955. package/node_modules/@earendil-works/pi-durable/dist/testing/types.js.map +1 -1
  956. package/node_modules/@earendil-works/pi-durable/dist/tool-search/index.d.ts +2 -0
  957. package/node_modules/@earendil-works/pi-durable/dist/tool-search/index.d.ts.map +1 -0
  958. package/node_modules/@earendil-works/pi-durable/dist/tool-search/index.js +2 -0
  959. package/node_modules/@earendil-works/pi-durable/dist/tool-search/index.js.map +1 -0
  960. package/node_modules/@earendil-works/pi-durable/dist/tool-search/tool-search.d.ts +23 -0
  961. package/node_modules/@earendil-works/pi-durable/dist/tool-search/tool-search.d.ts.map +1 -0
  962. package/node_modules/@earendil-works/pi-durable/dist/tool-search/tool-search.js +84 -0
  963. package/node_modules/@earendil-works/pi-durable/dist/tool-search/tool-search.js.map +1 -0
  964. package/node_modules/@earendil-works/pi-durable/dist/tools/bash.d.ts +30 -3
  965. package/node_modules/@earendil-works/pi-durable/dist/tools/bash.d.ts.map +1 -1
  966. package/node_modules/@earendil-works/pi-durable/dist/tools/bash.js +105 -37
  967. package/node_modules/@earendil-works/pi-durable/dist/tools/bash.js.map +1 -1
  968. package/node_modules/@earendil-works/pi-durable/dist/tools/edit.js +1 -1
  969. package/node_modules/@earendil-works/pi-durable/dist/tools/edit.js.map +1 -1
  970. package/node_modules/@earendil-works/pi-durable/dist/tools/image-processor.d.ts +47 -0
  971. package/node_modules/@earendil-works/pi-durable/dist/tools/image-processor.d.ts.map +1 -0
  972. package/node_modules/@earendil-works/pi-durable/dist/tools/image-processor.js +30 -0
  973. package/node_modules/@earendil-works/pi-durable/dist/tools/image-processor.js.map +1 -0
  974. package/node_modules/@earendil-works/pi-durable/dist/tools/image.d.ts +18 -0
  975. package/node_modules/@earendil-works/pi-durable/dist/tools/image.d.ts.map +1 -1
  976. package/node_modules/@earendil-works/pi-durable/dist/tools/image.js +86 -0
  977. package/node_modules/@earendil-works/pi-durable/dist/tools/image.js.map +1 -1
  978. package/node_modules/@earendil-works/pi-durable/dist/tools/index.d.ts +26 -3
  979. package/node_modules/@earendil-works/pi-durable/dist/tools/index.d.ts.map +1 -1
  980. package/node_modules/@earendil-works/pi-durable/dist/tools/index.js +14 -6
  981. package/node_modules/@earendil-works/pi-durable/dist/tools/index.js.map +1 -1
  982. package/node_modules/@earendil-works/pi-durable/dist/tools/read.d.ts +10 -2
  983. package/node_modules/@earendil-works/pi-durable/dist/tools/read.d.ts.map +1 -1
  984. package/node_modules/@earendil-works/pi-durable/dist/tools/read.js +212 -78
  985. package/node_modules/@earendil-works/pi-durable/dist/tools/read.js.map +1 -1
  986. package/node_modules/@earendil-works/pi-durable/dist/tools/write.js +1 -1
  987. package/node_modules/@earendil-works/pi-durable/dist/tools/write.js.map +1 -1
  988. package/node_modules/@earendil-works/pi-durable/dist/truncate.d.ts +9 -0
  989. package/node_modules/@earendil-works/pi-durable/dist/truncate.d.ts.map +1 -1
  990. package/node_modules/@earendil-works/pi-durable/dist/truncate.js +12 -4
  991. package/node_modules/@earendil-works/pi-durable/dist/truncate.js.map +1 -1
  992. package/node_modules/@earendil-works/pi-durable/dist/types.d.ts +89 -12
  993. package/node_modules/@earendil-works/pi-durable/dist/types.d.ts.map +1 -1
  994. package/node_modules/@earendil-works/pi-durable/dist/types.js.map +1 -1
  995. package/node_modules/@earendil-works/pi-durable/package.json +50 -5
  996. package/node_modules/@earendil-works/pi-mcp/CHANGELOG.md +29 -0
  997. package/node_modules/@earendil-works/pi-mcp/dist/auth-provider.d.ts +4 -0
  998. package/node_modules/@earendil-works/pi-mcp/dist/auth-provider.d.ts.map +1 -1
  999. package/node_modules/@earendil-works/pi-mcp/dist/auth-provider.js.map +1 -1
  1000. package/node_modules/@earendil-works/pi-mcp/dist/client.d.ts.map +1 -1
  1001. package/node_modules/@earendil-works/pi-mcp/dist/client.js +9 -5
  1002. package/node_modules/@earendil-works/pi-mcp/dist/client.js.map +1 -1
  1003. package/node_modules/@earendil-works/pi-mcp/dist/index.d.ts +1 -1
  1004. package/node_modules/@earendil-works/pi-mcp/dist/index.d.ts.map +1 -1
  1005. package/node_modules/@earendil-works/pi-mcp/dist/index.js.map +1 -1
  1006. package/node_modules/@earendil-works/pi-mcp/dist/oauth/discovery.d.ts +3 -0
  1007. package/node_modules/@earendil-works/pi-mcp/dist/oauth/discovery.d.ts.map +1 -1
  1008. package/node_modules/@earendil-works/pi-mcp/dist/oauth/discovery.js +8 -5
  1009. package/node_modules/@earendil-works/pi-mcp/dist/oauth/discovery.js.map +1 -1
  1010. package/node_modules/@earendil-works/pi-mcp/dist/oauth/errors.d.ts +3 -2
  1011. package/node_modules/@earendil-works/pi-mcp/dist/oauth/errors.d.ts.map +1 -1
  1012. package/node_modules/@earendil-works/pi-mcp/dist/oauth/errors.js +3 -1
  1013. package/node_modules/@earendil-works/pi-mcp/dist/oauth/errors.js.map +1 -1
  1014. package/node_modules/@earendil-works/pi-mcp/dist/oauth/flow.d.ts +4 -0
  1015. package/node_modules/@earendil-works/pi-mcp/dist/oauth/flow.d.ts.map +1 -1
  1016. package/node_modules/@earendil-works/pi-mcp/dist/oauth/flow.js +35 -7
  1017. package/node_modules/@earendil-works/pi-mcp/dist/oauth/flow.js.map +1 -1
  1018. package/node_modules/@earendil-works/pi-mcp/dist/oauth/types.d.ts +5 -0
  1019. package/node_modules/@earendil-works/pi-mcp/dist/oauth/types.d.ts.map +1 -1
  1020. package/node_modules/@earendil-works/pi-mcp/dist/oauth/types.js.map +1 -1
  1021. package/node_modules/@earendil-works/pi-mcp/dist/protocol/content.d.ts +2 -1
  1022. package/node_modules/@earendil-works/pi-mcp/dist/protocol/content.d.ts.map +1 -1
  1023. package/node_modules/@earendil-works/pi-mcp/dist/protocol/content.js.map +1 -1
  1024. package/node_modules/@earendil-works/pi-mcp/dist/transports/streamable-http.d.ts +9 -2
  1025. package/node_modules/@earendil-works/pi-mcp/dist/transports/streamable-http.d.ts.map +1 -1
  1026. package/node_modules/@earendil-works/pi-mcp/dist/transports/streamable-http.js +28 -19
  1027. package/node_modules/@earendil-works/pi-mcp/dist/transports/streamable-http.js.map +1 -1
  1028. package/node_modules/@earendil-works/pi-mcp/dist/transports/transport.d.ts +9 -1
  1029. package/node_modules/@earendil-works/pi-mcp/dist/transports/transport.d.ts.map +1 -1
  1030. package/node_modules/@earendil-works/pi-mcp/dist/transports/transport.js.map +1 -1
  1031. package/node_modules/@earendil-works/pi-mcp/package.json +2 -2
  1032. package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
  1033. package/node_modules/@earendil-works/pi-tui/README.md +5 -3
  1034. package/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts +1 -0
  1035. package/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts.map +1 -1
  1036. package/node_modules/@earendil-works/pi-tui/dist/components/box.js +4 -0
  1037. package/node_modules/@earendil-works/pi-tui/dist/components/box.js.map +1 -1
  1038. package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts.map +1 -1
  1039. package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +3 -3
  1040. package/node_modules/@earendil-works/pi-tui/dist/components/editor.js.map +1 -1
  1041. package/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts.map +1 -1
  1042. package/node_modules/@earendil-works/pi-tui/dist/components/input.js +4 -4
  1043. package/node_modules/@earendil-works/pi-tui/dist/components/input.js.map +1 -1
  1044. package/node_modules/@earendil-works/pi-tui/dist/components/text.d.ts +1 -0
  1045. package/node_modules/@earendil-works/pi-tui/dist/components/text.d.ts.map +1 -1
  1046. package/node_modules/@earendil-works/pi-tui/dist/components/text.js +4 -0
  1047. package/node_modules/@earendil-works/pi-tui/dist/components/text.js.map +1 -1
  1048. package/node_modules/@earendil-works/pi-tui/dist/index.d.ts +2 -1
  1049. package/node_modules/@earendil-works/pi-tui/dist/index.d.ts.map +1 -1
  1050. package/node_modules/@earendil-works/pi-tui/dist/index.js +3 -1
  1051. package/node_modules/@earendil-works/pi-tui/dist/index.js.map +1 -1
  1052. package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts +4 -4
  1053. package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts.map +1 -1
  1054. package/node_modules/@earendil-works/pi-tui/dist/keybindings.js +4 -4
  1055. package/node_modules/@earendil-works/pi-tui/dist/keybindings.js.map +1 -1
  1056. package/node_modules/@earendil-works/pi-tui/dist/keys.d.ts.map +1 -1
  1057. package/node_modules/@earendil-works/pi-tui/dist/keys.js +52 -20
  1058. package/node_modules/@earendil-works/pi-tui/dist/keys.js.map +1 -1
  1059. package/node_modules/@earendil-works/pi-tui/dist/program-status.d.ts +23 -0
  1060. package/node_modules/@earendil-works/pi-tui/dist/program-status.d.ts.map +1 -0
  1061. package/node_modules/@earendil-works/pi-tui/dist/program-status.js +43 -0
  1062. package/node_modules/@earendil-works/pi-tui/dist/program-status.js.map +1 -0
  1063. package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts +4 -2
  1064. package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts.map +1 -1
  1065. package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js +36 -1
  1066. package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js.map +1 -1
  1067. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts.map +1 -1
  1068. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +5 -0
  1069. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js.map +1 -1
  1070. package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts +17 -0
  1071. package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +1 -1
  1072. package/node_modules/@earendil-works/pi-tui/dist/terminal.js +46 -2
  1073. package/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +1 -1
  1074. package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts +2 -0
  1075. package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts.map +1 -1
  1076. package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js +8 -4
  1077. package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js.map +1 -1
  1078. package/node_modules/@earendil-works/pi-tui/dist/tui-main-screen.d.ts.map +1 -1
  1079. package/node_modules/@earendil-works/pi-tui/dist/tui-main-screen.js +2 -1
  1080. package/node_modules/@earendil-works/pi-tui/dist/tui-main-screen.js.map +1 -1
  1081. package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts +11 -0
  1082. package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +1 -1
  1083. package/node_modules/@earendil-works/pi-tui/dist/tui.js +23 -1
  1084. package/node_modules/@earendil-works/pi-tui/dist/tui.js.map +1 -1
  1085. package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts.map +1 -1
  1086. package/node_modules/@earendil-works/pi-tui/dist/utils.js +5 -2
  1087. package/node_modules/@earendil-works/pi-tui/dist/utils.js.map +1 -1
  1088. package/node_modules/@earendil-works/pi-tui/package.json +1 -1
  1089. package/node_modules/@silvia-odwyer/photon/LICENSE.md +201 -0
  1090. package/node_modules/@silvia-odwyer/photon/README.md +158 -0
  1091. package/node_modules/@silvia-odwyer/photon/package.json +23 -0
  1092. package/node_modules/@silvia-odwyer/photon/photon_rs.d.ts +3443 -0
  1093. package/node_modules/@silvia-odwyer/photon/photon_rs.js +4572 -0
  1094. package/node_modules/@silvia-odwyer/photon/photon_rs_bg.wasm +0 -0
  1095. package/node_modules/@types/node/README.md +1 -1
  1096. package/node_modules/@types/node/crypto.d.ts +2 -2
  1097. package/node_modules/@types/node/dgram.d.ts +1 -1
  1098. package/node_modules/@types/node/package.json +2 -2
  1099. package/node_modules/@types/node/util.d.ts +6 -3
  1100. package/node_modules/@types/node/zlib.d.ts +6 -0
  1101. package/package.json +7 -8
  1102. package/runtime-package.json +7 -9
  1103. package/scripts/check-install-toolchain.mjs +64 -40
  1104. package/shipping-sbom.cdx.json +126 -160
  1105. package/shipping-source.json +15 -15
  1106. package/node_modules/@earendil-works/chord/dist/api.d.ts +0 -20
  1107. package/node_modules/@earendil-works/chord/dist/api.d.ts.map +0 -1
  1108. package/node_modules/@earendil-works/chord/dist/api.js +0 -77
  1109. package/node_modules/@earendil-works/chord/dist/api.js.map +0 -1
  1110. package/node_modules/@earendil-works/chord/dist/bundler.d.ts +0 -6
  1111. package/node_modules/@earendil-works/chord/dist/bundler.d.ts.map +0 -1
  1112. package/node_modules/@earendil-works/chord/dist/bundler.js +0 -3
  1113. package/node_modules/@earendil-works/chord/dist/bundler.js.map +0 -1
  1114. package/node_modules/@earendil-works/chord/dist/facets/host.d.ts +0 -12
  1115. package/node_modules/@earendil-works/chord/dist/facets/host.d.ts.map +0 -1
  1116. package/node_modules/@earendil-works/chord/dist/facets/host.js +0 -763
  1117. package/node_modules/@earendil-works/chord/dist/facets/host.js.map +0 -1
  1118. package/node_modules/@earendil-works/chord/dist/facets/loader.d.ts +0 -3
  1119. package/node_modules/@earendil-works/chord/dist/facets/loader.d.ts.map +0 -1
  1120. package/node_modules/@earendil-works/chord/dist/facets/loader.js +0 -5
  1121. package/node_modules/@earendil-works/chord/dist/facets/loader.js.map +0 -1
  1122. package/node_modules/@earendil-works/chord/dist/node/bundle-loader.d.ts +0 -30
  1123. package/node_modules/@earendil-works/chord/dist/node/bundle-loader.d.ts.map +0 -1
  1124. package/node_modules/@earendil-works/chord/dist/node/bundle-loader.js +0 -377
  1125. package/node_modules/@earendil-works/chord/dist/node/bundle-loader.js.map +0 -1
  1126. package/node_modules/@earendil-works/chord/dist/node/bundle.d.ts +0 -26
  1127. package/node_modules/@earendil-works/chord/dist/node/bundle.d.ts.map +0 -1
  1128. package/node_modules/@earendil-works/chord/dist/node/bundle.js +0 -183
  1129. package/node_modules/@earendil-works/chord/dist/node/bundle.js.map +0 -1
  1130. package/node_modules/@earendil-works/chord/dist/node/manifest.d.ts +0 -36
  1131. package/node_modules/@earendil-works/chord/dist/node/manifest.d.ts.map +0 -1
  1132. package/node_modules/@earendil-works/chord/dist/node/manifest.js +0 -6
  1133. package/node_modules/@earendil-works/chord/dist/node/manifest.js.map +0 -1
  1134. package/node_modules/@earendil-works/chord/dist/node/package.d.ts +0 -15
  1135. package/node_modules/@earendil-works/chord/dist/node/package.d.ts.map +0 -1
  1136. package/node_modules/@earendil-works/chord/dist/node/package.js +0 -199
  1137. package/node_modules/@earendil-works/chord/dist/node/package.js.map +0 -1
  1138. package/node_modules/@earendil-works/chord/dist/services/consumer.d.ts +0 -11
  1139. package/node_modules/@earendil-works/chord/dist/services/consumer.d.ts.map +0 -1
  1140. package/node_modules/@earendil-works/chord/dist/services/consumer.js +0 -585
  1141. package/node_modules/@earendil-works/chord/dist/services/consumer.js.map +0 -1
  1142. package/node_modules/@earendil-works/chord/dist/services/errors.d.ts +0 -8
  1143. package/node_modules/@earendil-works/chord/dist/services/errors.d.ts.map +0 -1
  1144. package/node_modules/@earendil-works/chord/dist/services/errors.js +0 -22
  1145. package/node_modules/@earendil-works/chord/dist/services/errors.js.map +0 -1
  1146. package/node_modules/@earendil-works/chord/dist/services/handle.d.ts +0 -15
  1147. package/node_modules/@earendil-works/chord/dist/services/handle.d.ts.map +0 -1
  1148. package/node_modules/@earendil-works/chord/dist/services/handle.js +0 -101
  1149. package/node_modules/@earendil-works/chord/dist/services/handle.js.map +0 -1
  1150. package/node_modules/@earendil-works/chord/dist/services/instances.d.ts +0 -26
  1151. package/node_modules/@earendil-works/chord/dist/services/instances.d.ts.map +0 -1
  1152. package/node_modules/@earendil-works/chord/dist/services/instances.js +0 -140
  1153. package/node_modules/@earendil-works/chord/dist/services/instances.js.map +0 -1
  1154. package/node_modules/@earendil-works/chord/dist/services/loopback.d.ts +0 -5
  1155. package/node_modules/@earendil-works/chord/dist/services/loopback.d.ts.map +0 -1
  1156. package/node_modules/@earendil-works/chord/dist/services/loopback.js +0 -15
  1157. package/node_modules/@earendil-works/chord/dist/services/loopback.js.map +0 -1
  1158. package/node_modules/@earendil-works/chord/dist/services/provider.d.ts +0 -37
  1159. package/node_modules/@earendil-works/chord/dist/services/provider.d.ts.map +0 -1
  1160. package/node_modules/@earendil-works/chord/dist/services/provider.js +0 -521
  1161. package/node_modules/@earendil-works/chord/dist/services/provider.js.map +0 -1
  1162. package/node_modules/@earendil-works/chord/dist/services/state-codec.d.ts +0 -15
  1163. package/node_modules/@earendil-works/chord/dist/services/state-codec.d.ts.map +0 -1
  1164. package/node_modules/@earendil-works/chord/dist/services/state-codec.js +0 -133
  1165. package/node_modules/@earendil-works/chord/dist/services/state-codec.js.map +0 -1
  1166. package/node_modules/@earendil-works/chord/dist/services/state-internals.d.ts +0 -13
  1167. package/node_modules/@earendil-works/chord/dist/services/state-internals.d.ts.map +0 -1
  1168. package/node_modules/@earendil-works/chord/dist/services/state-internals.js +0 -10
  1169. package/node_modules/@earendil-works/chord/dist/services/state-internals.js.map +0 -1
  1170. package/node_modules/@earendil-works/chord/dist/services/state.d.ts +0 -28
  1171. package/node_modules/@earendil-works/chord/dist/services/state.d.ts.map +0 -1
  1172. package/node_modules/@earendil-works/chord/dist/services/state.js.map +0 -1
  1173. package/node_modules/@earendil-works/chord/dist/services/wire.d.ts +0 -63
  1174. package/node_modules/@earendil-works/chord/dist/services/wire.d.ts.map +0 -1
  1175. package/node_modules/@earendil-works/chord/dist/services/wire.js +0 -186
  1176. package/node_modules/@earendil-works/chord/dist/services/wire.js.map +0 -1
  1177. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.d.ts +0 -3
  1178. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.d.ts.map +0 -1
  1179. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js +0 -14
  1180. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js.map +0 -1
  1181. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.d.ts +0 -6
  1182. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.d.ts.map +0 -1
  1183. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.js +0 -8
  1184. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.js.map +0 -1
  1185. package/node_modules/@earendil-works/pi-ai/dist/providers/data/azure-openai-responses.json +0 -1
  1186. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/anthropic-messages-MVG2FL56.js +0 -6
  1187. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/azure-openai-responses-7AMFUIWJ.js +0 -2
  1188. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-6FX7UEPL.js +0 -132
  1189. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-7JGR3GZN.js +0 -11
  1190. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-A3JYRWB6.js +0 -2
  1191. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-IKZJX7ZT.js +0 -2
  1192. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-OSKPX3Z5.js +0 -2
  1193. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-OYBSLV7Y.js +0 -16
  1194. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-PDFMCAOZ.js +0 -19
  1195. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-U7B62NSC.js +0 -2
  1196. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-VIV3CWXG.js +0 -2
  1197. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-WCQZGZ6I.js +0 -82
  1198. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/cloudflare-workers-ai-system-one-X5PVWWYJ.js +0 -2
  1199. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/easter-egg-3d-T5FFWIBR.js +0 -2
  1200. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/execute-RYVK27GT.js +0 -388
  1201. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/mistral-conversations-7DAUEE4N.js +0 -5
  1202. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/openai-codex-responses-TC3OK7B4.js +0 -10
  1203. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/runtime-D5I2NTIF.js +0 -2
  1204. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/typesafe-system-one-A4CZTQWZ.js +0 -2
  1205. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/virtual-modules-KVWJD3T3.js +0 -2
  1206. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-json.d.ts +0 -85
  1207. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-json.d.ts.map +0 -1
  1208. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-json.js +0 -132
  1209. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-json.js.map +0 -1
  1210. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-schema.json +0 -361
  1211. package/node_modules/@earendil-works/pi-coding-agent/examples/plugins/pi-example-plugin/README.md +0 -38
  1212. package/node_modules/@earendil-works/pi-coding-agent/examples/plugins/pi-example-plugin/package.json +0 -10
  1213. package/node_modules/@earendil-works/pi-coding-agent/examples/plugins/pi-example-plugin/src/contract.ts +0 -13
  1214. package/node_modules/@earendil-works/pi-coding-agent/examples/plugins/pi-example-plugin/src/session.ts +0 -24
  1215. package/node_modules/@earendil-works/pi-coding-agent/examples/plugins/pi-example-plugin/src/tui.ts +0 -31
  1216. package/node_modules/@esbuild/linux-x64/README.md +0 -3
  1217. package/node_modules/@esbuild/linux-x64/bin/esbuild +0 -0
  1218. package/node_modules/@esbuild/linux-x64/package.json +0 -20
  1219. package/node_modules/esbuild/LICENSE.md +0 -21
  1220. package/node_modules/esbuild/README.md +0 -3
  1221. package/node_modules/esbuild/bin/esbuild +0 -223
  1222. package/node_modules/esbuild/install.js +0 -300
  1223. package/node_modules/esbuild/lib/main.d.ts +0 -720
  1224. package/node_modules/esbuild/lib/main.js +0 -2536
  1225. package/node_modules/esbuild/package.json +0 -74
@@ -1 +1 @@
1
- {"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/harness/events.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAY3D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAItC,OAAO,EAAE,QAAQ,EAAmB,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAyB,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAsFrE,SAAS,KAAK,CAAC,IAAsB;IACpC,OAAO;QACN,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAc;QAC/C,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,CAA2B;QACtD,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,CAA2B;QACtD,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,CAA2B;KACtD,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CAAC,IAAsB;IACzC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;IAClD,OAAO;QACN,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC;QACvE,GAAG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CAAC,IAAI,CAAC,WAAW,KAAK,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,EAAE,EAAE,CAAC;KAC7F,CAAC;IACF,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;AAC9D,CAAC;AAED,SAAS,UAAU,CAAC,IAAU,EAAE,MAAoC;IACnE,OAAO,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,OAAO,CAAC,CAAC;AAClG,CAAC","sourcesContent":["import type { Context, JsonValue } from \"@earendil-works/chord\";\nimport type { Op, Path } from \"@earendil-works/chord/delta\";\nimport type { AssistantMessage, Message, Usage } from \"@earendil-works/pi-ai\";\nimport { CommittedWatch } from \"../session/observation.ts\";\nimport type {\n\tCommitChange,\n\tCommitPublication,\n\tConversationId,\n\tEntryRecord,\n\tJsonObject,\n\tSubmissionId,\n\tSubmissionRecord,\n\tTaskId,\n\tWatchEnd,\n} from \"../types.ts\";\nimport { AgentDoc } from \"./agent.ts\";\nimport type { InboxItem, InboxState } from \"./inbox.ts\";\nimport type { CompactionStatus, LiveState, ToolSlot } from \"./live.ts\";\nimport type { AgentState, CompactionReason, Harness, ToolDiagnostic } from \"./types.ts\";\nimport { UsageDoc, type UsageState } from \"./usage.ts\";\nimport { scanAll } from \"./util.ts\";\nimport { type ConversationView, conversationViews } from \"./view.ts\";\n\ntype Block = AssistantMessage[\"content\"][number];\ntype QueuedItem = { id: SubmissionId; mode: InboxItem[\"mode\"] };\n\n/** One change to the in-flight assistant message, relative to that message. */\nexport type MessageChange =\n\t| { type: \"text_start\" | \"thinking_start\" | \"toolcall_start\"; contentIndex: number; block: Block }\n\t| { type: \"text_delta\" | \"thinking_delta\"; contentIndex: number; delta: string }\n\t| { type: \"toolcall_delta\"; contentIndex: number; path: readonly (string | number)[]; delta: string }\n\t| { type: \"block\"; contentIndex: number; block: Block }\n\t| { type: \"message\"; message: AssistantMessage };\n\nexport type SnapshotEvent = {\n\ttype: \"snapshot\";\n\tentries: readonly EntryRecord[];\n\trun?: { inputs: readonly SubmissionId[] };\n\t/** Current generation attempt: its in-flight partial, retry backoff, or deferred poll. */\n\tgeneration?: {\n\t\tattempt: number;\n\t\tmessage?: AssistantMessage;\n\t\tretry?: { at: number; error: string };\n\t\tdeferred?: { pollAt: number };\n\t};\n\ttools: readonly ToolSlot[];\n\t/** `pi.live.compactions`: live compactions with their attempt and retry backoff. */\n\tcompactions: readonly CompactionStatus[];\n\tinbox: readonly QueuedItem[];\n\t/** `pi.agent`; `{}` when absent. */\n\tagent: AgentState;\n\tusage: UsageState;\n};\n\n/** Experimental agent event, shaped like the coding agent's session events (spec §9.4). */\nexport type AgentEvent =\n\t| SnapshotEvent\n\t| { type: \"run_start\"; inputs: readonly SubmissionId[] }\n\t| { type: \"run_end\"; inputs: readonly SubmissionId[] }\n\t| { type: \"turn_start\" }\n\t| { type: \"turn_end\" }\n\t| { type: \"message_start\"; message: Message }\n\t/** `usage` is the partial's current usage, as in the coding agent's JSON mode. */\n\t| { type: \"message_update\"; usage: Usage; changes: readonly MessageChange[] }\n\t| { type: \"message_end\"; entry: EntryRecord }\n\t| { type: \"tool_execution_start\"; toolCallId: string; toolName: string; args: JsonObject }\n\t| {\n\t\t\ttype: \"tool_execution_update\";\n\t\t\ttoolCallId: string;\n\t\t\ttoolName: string;\n\t\t\t/** A front trim and then an append of the retained window, or its replacement. */\n\t\t\toutput?: { trimStart?: number; append?: string } | { set: string };\n\t\t\tdetails?: JsonValue;\n\t\t\tdiagnostics?: readonly ToolDiagnostic[];\n\t }\n\t/** `entry` is absent when the tool task faulted or was orphaned. */\n\t| { type: \"tool_execution_end\"; toolCallId: string; toolName: string; entry?: EntryRecord }\n\t| { type: \"inbox_update\"; items: readonly QueuedItem[] }\n\t| { type: \"submission\"; record: SubmissionRecord }\n\t| { type: \"auto_retry_start\"; attempt: number; at: number; errorMessage: string }\n\t| { type: \"auto_retry_end\"; attempt: number }\n\t| { type: \"deferred_poll\"; pollAt: number }\n\t| { type: \"entry_appended\"; entry: EntryRecord }\n\t| { type: \"agent_changed\"; agent: AgentState }\n\t| { type: \"usage_changed\"; usage: UsageState }\n\t| { type: \"task_failed\"; taskId: TaskId; kind: string; message: string }\n\t| { type: \"compaction_start\"; taskId: TaskId; reason: CompactionReason; blocking: boolean }\n\t/** The task's receipt tells whether it produced a summary; the summary entry has its own events. */\n\t| { type: \"compaction_end\"; taskId: TaskId; reason: CompactionReason };\n\n/** Serialized stream of one conversation's event batches, one per commit. */\nexport interface AgentEventStream {\n\t/** The `snapshot` event at attachment. */\n\treadonly snapshot: SnapshotEvent;\n\tstart(listener: (events: readonly AgentEvent[], context: Context) => Promise<void>): void;\n\tstop(): Promise<WatchEnd>;\n\treadonly closed: Promise<WatchEnd>;\n}\n\n/** The typed parts of a view the events read. */\ntype Parts = {\n\tlive: LiveState;\n\tinbox: InboxState | undefined;\n\tagent: AgentState | undefined;\n\tusage: UsageState | undefined;\n};\n\nfunction parts(view: ConversationView): Parts {\n\treturn {\n\t\tlive: (view.docs[\"pi.live\"] ?? {}) as LiveState,\n\t\tinbox: view.docs[\"pi.inbox\"] as InboxState | undefined,\n\t\tagent: view.docs[\"pi.agent\"] as AgentState | undefined,\n\t\tusage: view.docs[\"pi.usage\"] as UsageState | undefined,\n\t};\n}\n\nfunction snapshotOf(view: ConversationView): SnapshotEvent {\n\tconst { live, inbox, agent, usage } = parts(view);\n\treturn {\n\t\ttype: \"snapshot\",\n\t\tentries: view.entries,\n\t\t...(live.run === undefined ? {} : { run: { inputs: live.run.inputs } }),\n\t\t...(live.generation === undefined ? {} : { generation: live.generation as SnapshotEvent[\"generation\"] }),\n\t\ttools: live.tools ?? [],\n\t\tcompactions: live.compactions ?? [],\n\t\tinbox: queued(inbox),\n\t\tagent: agent ?? AgentDoc.definition.initial(),\n\t\tusage: usage ?? UsageDoc.definition.initial(),\n\t};\n}\n\nfunction queued(inbox: InboxState | undefined): QueuedItem[] {\n\treturn (inbox?.items ?? []).map((item) => ({ id: item.id, mode: item.mode }));\n}\n\n/**\n * Experimental: attach to one conversation's agent events (spec §9.4). The snapshot and the registration for later\n * commits are captured atomically on the Session line; overflow replaces undelivered batches with one snapshot.\n */\nexport async function watchEvents(\n\tharness: Harness,\n\tconversationId: ConversationId,\n\tcontext: Context,\n): Promise<AgentEventStream> {\n\tlet watch!: CommittedWatch<readonly AgentEvent[]>;\n\tlet snapshot!: SnapshotEvent;\n\tawait conversationViews(harness).attach(\n\t\tconversationId,\n\t\tasync (initial, release, storage) => {\n\t\t\t// Generations whose held outcome already ended their turn, read on the line with the snapshot.\n\t\t\tconst query = { conversationId, kind: \"pi.generation\", status: \"completing\" } as const;\n\t\t\tconst completing = await scanAll((cursor) => storage.scanTasks(query, 100, cursor, context));\n\t\t\tconst held = new Set<TaskId>(completing.map((record) => record.id));\n\t\t\tlet current = initial;\n\t\t\tsnapshot = snapshotOf(initial);\n\t\t\t// Batches are the watch's values; an overflow delivers a snapshot of the newest view instead.\n\t\t\twatch = new CommittedWatch<readonly AgentEvent[]>([], release, () => [snapshotOf(current)]);\n\t\t\treturn {\n\t\t\t\tpublication: (before, after, ops, publication, commitContext) => {\n\t\t\t\t\tcurrent = after;\n\t\t\t\t\tconst events = translate(conversationId, before, after, ops, publication, held);\n\t\t\t\t\tif (events.length > 0) watch.advance(events, [], commitContext);\n\t\t\t\t},\n\t\t\t\tcloseSession: () => watch.closeSession(),\n\t\t\t};\n\t\t},\n\t\tcontext,\n\t);\n\t// Like a watch, the acquisition context governs the stream's lifetime.\n\tconst signal = context.abortSignal;\n\tif (signal?.aborted) {\n\t\twatch.cancel();\n\t\tthrow signal.reason;\n\t}\n\tif (signal !== undefined) watch.observeCancellation(signal);\n\treturn {\n\t\tsnapshot,\n\t\tstart: (listener) => watch.start((events, _ops, deliveryContext) => listener(events, deliveryContext)),\n\t\tstop: () => watch.stop(),\n\t\tclosed: watch.closed,\n\t};\n}\n\ntype TaskChange = Extract<CommitChange, { type: \"task\" }>;\n\n/** The tool result for `callId` among `entries`. */\nfunction resultOf(entries: readonly EntryRecord[], callId: string): EntryRecord | undefined {\n\treturn entries.find((entry) => {\n\t\tconst message = entry.model?.[0];\n\t\treturn message?.role === \"toolResult\" && message.toolCallId === callId;\n\t});\n}\n\n/** Every event one publication causes, in the order of spec §9.4. */\nfunction translate(\n\tconversationId: ConversationId,\n\tbefore: ConversationView,\n\tafter: ConversationView,\n\tviewOps: readonly Op[],\n\tpublication: CommitPublication,\n\theld: Set<TaskId>,\n): AgentEvent[] {\n\tconst entries: EntryRecord[] = [];\n\tconst tasks = new Map<TaskId, TaskChange[\"value\"]>();\n\tconst submissions: SubmissionRecord[] = [];\n\tfor (const change of publication.changes) {\n\t\tif (change.type === \"entry\" && change.value.conversationId === conversationId) entries.push(change.value);\n\t\tif (change.type === \"task\" && change.value.conversationId === conversationId)\n\t\t\ttasks.set(change.value.id, change.value);\n\t\tif (change.type === \"submission\" && change.value.conversationId === conversationId) {\n\t\t\tsubmissions.push(change.value);\n\t\t}\n\t}\n\tif (viewOps.length === 0 && entries.length === 0 && tasks.size === 0 && submissions.length === 0) return [];\n\t// Entries are appended in ID order; submission records are published in the order the commit first touched them.\n\tsubmissions.sort((a, b) => a.id - b.id);\n\tconst was = parts(before);\n\tconst now = parts(after);\n\tconst events: AgentEvent[] = [];\n\n\t// Progress: tool starts, the in-flight message, tool updates, retry and deferred state.\n\tconst slotsBefore = new Map((was.live.tools ?? []).map((slot) => [slot.callId, slot]));\n\tconst slots = now.live.tools ?? [];\n\tfor (const slot of slots) {\n\t\tif (slot.status !== \"running\" || slotsBefore.get(slot.callId)?.status === \"running\") continue;\n\t\tconst checkpoint = slot.taskId === undefined ? undefined : tasks.get(slot.taskId)?.state.checkpoint;\n\t\tconst args = (checkpoint as { arguments?: JsonObject } | undefined)?.arguments ?? {};\n\t\tevents.push({ type: \"tool_execution_start\", toolCallId: slot.callId, toolName: slot.name, args });\n\t}\n\tconst partialBefore = was.live.generation?.message as AssistantMessage | undefined;\n\tconst partial = now.live.generation?.message as AssistantMessage | undefined;\n\tif (partial !== undefined && partialBefore === undefined) events.push({ type: \"message_start\", message: partial });\n\telse if (partial !== undefined && partial !== partialBefore) {\n\t\tevents.push({ type: \"message_update\", usage: partial.usage, changes: messageChanges(viewOps, partial) });\n\t}\n\tfor (const [index, slot] of slots.entries()) {\n\t\tconst previous = slotsBefore.get(slot.callId);\n\t\tif (slot.status !== \"running\" || previous?.status !== \"running\") continue;\n\t\tconst update = toolUpdate(viewOps, index, slot, previous);\n\t\tif (update === undefined) continue;\n\t\tevents.push({ type: \"tool_execution_update\", toolCallId: slot.callId, toolName: slot.name, ...update });\n\t}\n\tconst generation = now.live.generation;\n\tconst generationBefore = was.live.generation;\n\tif (generation?.retry !== undefined && generationBefore?.retry === undefined) {\n\t\tconst { at, error } = generation.retry;\n\t\tevents.push({ type: \"auto_retry_start\", attempt: generation.attempt, at, errorMessage: error });\n\t}\n\tif (generationBefore?.retry !== undefined && generation?.retry === undefined) {\n\t\tevents.push({ type: \"auto_retry_end\", attempt: generationBefore.attempt });\n\t}\n\tif (generation?.deferred !== undefined && generation.deferred.pollAt !== generationBefore?.deferred?.pollAt) {\n\t\tevents.push({ type: \"deferred_poll\", pollAt: generation.deferred.pollAt });\n\t}\n\n\t// Tools that end in this commit: a slot that becomes done, one created done (a call not offered), or an unfinished\n\t// one that vanishes because its run ended. A done slot that vanishes ended earlier.\n\tconst toolEnds: Extract<AgentEvent, { type: \"tool_execution_end\" }>[] = [];\n\tconst endTool = (callId: string, name: string, entryId: number | undefined): void => {\n\t\tconst entry = entries.find((candidate) => candidate.id === entryId);\n\t\ttoolEnds.push({\n\t\t\ttype: \"tool_execution_end\",\n\t\t\ttoolCallId: callId,\n\t\t\ttoolName: name,\n\t\t\t...(entry === undefined ? {} : { entry }),\n\t\t});\n\t};\n\tfor (const previous of slotsBefore.values()) {\n\t\tif (previous.status === \"done\") continue;\n\t\tconst slot = slots.find((candidate) => candidate.callId === previous.callId);\n\t\tif (slot?.status === \"done\") endTool(previous.callId, previous.name, slot.entry);\n\t\t// A slot whose run ended in this commit may have had its result appended with it, as for unstarted calls.\n\t\telse if (slot === undefined) endTool(previous.callId, previous.name, resultOf(entries, previous.callId)?.id);\n\t}\n\tfor (const slot of slots) {\n\t\tif (slot.status === \"done\" && !slotsBefore.has(slot.callId)) endTool(slot.callId, slot.name, slot.entry);\n\t}\n\n\t// Entries in append order; a tool's end directly precedes its result's message, as in the coding agent.\n\tlet assistantAppended = false;\n\tfor (const entry of entries) {\n\t\tevents.push(...toolEnds.filter((end) => end.entry === entry));\n\t\tconst message = entry.model?.[0];\n\t\tif (message === undefined) {\n\t\t\tevents.push({ type: \"entry_appended\", entry });\n\t\t\tcontinue;\n\t\t}\n\t\t// A streamed answer already started with its first partial.\n\t\tconst streamed = message.role === \"assistant\" && partialBefore !== undefined && !assistantAppended;\n\t\tif (message.role === \"assistant\") assistantAppended = true;\n\t\tif (!streamed) events.push({ type: \"message_start\", message });\n\t\tevents.push({ type: \"message_end\", entry });\n\t}\n\t// Ends without a result entry: a faulted or orphaned tool, or one whose run ended.\n\tevents.push(...toolEnds.filter((end) => end.entry === undefined));\n\n\t// Compaction ends, task failures, then turn and run ends.\n\tconst compactionsBefore = was.live.compactions ?? [];\n\tconst compactions = now.live.compactions ?? [];\n\tfor (const { taskId, reason } of compactionsBefore) {\n\t\tif (!compactions.some((status) => status.taskId === taskId)) {\n\t\t\tevents.push({ type: \"compaction_end\", taskId, reason });\n\t\t}\n\t}\n\t// A generation's turn ends when its outcome is committed: at a `completing` hold or at terminal, whichever comes\n\t// first, so a successor created at the hold starts after it.\n\tlet turnEnded = false;\n\tfor (const task of tasks.values()) {\n\t\tconst status = task.state.status;\n\t\tif (task.kind === \"pi.generation\" && status === \"completing\" && !held.has(task.id)) {\n\t\t\theld.add(task.id);\n\t\t\tturnEnded = true;\n\t\t}\n\t\tif (status !== \"terminal\") continue;\n\t\tif (task.kind === \"pi.generation\" && !held.delete(task.id)) turnEnded = true;\n\t\tconst outcome = task.state.outcome;\n\t\tif (outcome.status === \"faulted\" || outcome.status === \"orphaned\") {\n\t\t\tconst message = outcome.status === \"faulted\" ? outcome.error.message : outcome.reason;\n\t\t\tevents.push({ type: \"task_failed\", taskId: task.id, kind: task.kind, message });\n\t\t}\n\t}\n\tif (turnEnded) events.push({ type: \"turn_end\" });\n\tconst run = now.live.run;\n\tconst runBefore = was.live.run;\n\tconst runChanged = run?.inputs[0] !== runBefore?.inputs[0];\n\tif (runBefore !== undefined && runChanged) events.push({ type: \"run_end\", inputs: runBefore.inputs });\n\n\t// Submissions, document state, then what began.\n\tfor (const record of submissions) events.push({ type: \"submission\", record });\n\tif (now.inbox !== was.inbox) events.push({ type: \"inbox_update\", items: queued(now.inbox) });\n\t// A retired document reads as its initial value, as in a snapshot.\n\tif (now.agent !== was.agent) {\n\t\tevents.push({ type: \"agent_changed\", agent: now.agent ?? AgentDoc.definition.initial() });\n\t}\n\tif (now.usage !== was.usage)\n\t\tevents.push({ type: \"usage_changed\", usage: now.usage ?? UsageDoc.definition.initial() });\n\tfor (const { taskId, reason, blocking } of compactions) {\n\t\tif (!compactionsBefore.some((status) => status.taskId === taskId)) {\n\t\t\tevents.push({ type: \"compaction_start\", taskId, reason, blocking });\n\t\t}\n\t}\n\tif (run !== undefined && runChanged) events.push({ type: \"run_start\", inputs: run.inputs });\n\tif (run !== undefined && run.taskId !== runBefore?.taskId && tasks.get(run.taskId)?.kind === \"pi.generation\") {\n\t\tevents.push({ type: \"turn_start\" });\n\t}\n\treturn events;\n}\n\nconst PARTIAL_PATH = [\"docs\", \"pi.live\", \"generation\", \"message\"];\n\n/** Translate the view operations on the in-flight message into message changes (spec §9.4). */\nfunction messageChanges(viewOps: readonly Op[], message: AssistantMessage): MessageChange[] {\n\tconst changes: MessageChange[] = [];\n\t// A block sent whole already holds every later change to it in this batch.\n\tconst whole = new Set<number>();\n\tfor (const op of viewOps) {\n\t\t// View operations never replace the root.\n\t\tconst path = op[1] as Path;\n\t\tif (!startsWith(path, PARTIAL_PATH)) {\n\t\t\t// The whole message or generation was replaced.\n\t\t\tif (startsWith(PARTIAL_PATH, path)) return [{ type: \"message\", message }];\n\t\t\tcontinue;\n\t\t}\n\t\tconst rest = path.slice(PARTIAL_PATH.length);\n\t\tif (rest[0] === \"usage\") continue;\n\t\tif (rest[0] !== \"content\") return [{ type: \"message\", message }];\n\t\tif (rest.length === 1) {\n\t\t\tif (op[0] !== \"p\" || op[3] !== 0) return [{ type: \"message\", message }];\n\t\t\tfor (const [offset, block] of (op[4] as unknown as Block[]).entries()) {\n\t\t\t\tconst type =\n\t\t\t\t\tblock.type === \"text\" ? \"text_start\" : block.type === \"thinking\" ? \"thinking_start\" : \"toolcall_start\";\n\t\t\t\tchanges.push({ type, contentIndex: op[2] + offset, block });\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tconst contentIndex = rest[1] as number;\n\t\tconst field = rest[2];\n\t\tif (whole.has(contentIndex)) continue;\n\t\tif (op[0] === \"a\" && rest.length === 3 && (field === \"text\" || field === \"thinking\")) {\n\t\t\tchanges.push({ type: field === \"text\" ? \"text_delta\" : \"thinking_delta\", contentIndex, delta: op[2] });\n\t\t} else if (op[0] === \"a\" && field === \"arguments\") {\n\t\t\tchanges.push({ type: \"toolcall_delta\", contentIndex, path: rest.slice(3), delta: op[2] });\n\t\t} else {\n\t\t\twhole.add(contentIndex);\n\t\t\tchanges.push({ type: \"block\", contentIndex, block: message.content[contentIndex]! });\n\t\t}\n\t}\n\treturn changes;\n}\n\n/** Output, details, and diagnostics changes of a running slot, from the view operations on it. */\nfunction toolUpdate(\n\tviewOps: readonly Op[],\n\tindex: number,\n\tslot: ToolSlot,\n\tprevious: ToolSlot,\n): Omit<Extract<AgentEvent, { type: \"tool_execution_update\" }>, \"type\" | \"toolCallId\" | \"toolName\"> | undefined {\n\tconst outputPath = [\"docs\", \"pi.live\", \"tools\", index, \"output\"];\n\tlet trimStart = 0;\n\tlet append = \"\";\n\tlet set = false;\n\tfor (const op of viewOps) {\n\t\tif (!startsWith(op[1] as Path, outputPath)) continue;\n\t\tif (op[0] === \"t\") trimStart += op[2];\n\t\telse if (op[0] === \"a\") append += op[2];\n\t\telse set = true;\n\t}\n\tlet output: { trimStart?: number; append?: string } | { set: string } | undefined;\n\tif (set || (slot.output !== previous.output && trimStart === 0 && append === \"\"))\n\t\toutput = { set: slot.output ?? \"\" };\n\telse if (trimStart > 0 || append !== \"\") {\n\t\toutput = { ...(trimStart > 0 ? { trimStart } : {}), ...(append === \"\" ? {} : { append }) };\n\t}\n\t// A safe replay clears a running slot's progress: removed details send `null`, removed diagnostics `[]`.\n\tconst update = {\n\t\t...(output === undefined ? {} : { output }),\n\t\t...(slot.details === previous.details ? {} : { details: slot.details ?? null }),\n\t\t...(slot.diagnostics === previous.diagnostics ? {} : { diagnostics: slot.diagnostics ?? [] }),\n\t};\n\treturn Object.keys(update).length === 0 ? undefined : update;\n}\n\nfunction startsWith(path: Path, prefix: readonly (string | number)[]): boolean {\n\treturn prefix.length <= path.length && prefix.every((segment, index) => path[index] === segment);\n}\n"]}
1
+ {"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/harness/events.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAY3D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC,OAAO,EAAE,aAAa,EAAwB,MAAM,WAAW,CAAC;AAEhE,OAAO,EAAE,QAAQ,EAAmB,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAA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CAAC","sourcesContent":["import type { Context, JsonValue } from \"@earendil-works/chord\";\nimport type { Op, Path } from \"@earendil-works/chord/delta\";\nimport type { AssistantMessage, Message, Usage } from \"@earendil-works/pi-ai\";\nimport { CommittedWatch } from \"../session/observation.ts\";\nimport type {\n\tCommitChange,\n\tCommitPublication,\n\tConversationId,\n\tEntryRecord,\n\tJsonObject,\n\tSubmissionId,\n\tSubmissionRecord,\n\tTaskId,\n\tWatchEnd,\n} from \"../types.ts\";\nimport { AgentDoc } from \"./agent.ts\";\nimport type { InboxItem, InboxState } from \"./inbox.ts\";\nimport type { CompactionFailure, CompactionStatus, LiveState, NestedToolSlot, ToolSlot } from \"./live.ts\";\nimport { NestedCallDoc, type NestedCallState } from \"./tool.ts\";\nimport type { AgentState, CompactionReason, Harness, NestedToolExecutionResult, ToolDiagnostic } from \"./types.ts\";\nimport { UsageDoc, type UsageState } from \"./usage.ts\";\nimport { scanAll } from \"./util.ts\";\nimport { type ConversationView, conversationViews } from \"./view.ts\";\n\ntype Block = AssistantMessage[\"content\"][number];\ntype QueuedItem = { id: SubmissionId; mode: InboxItem[\"mode\"] };\n\n/** One change to the in-flight assistant message, relative to that message. */\nexport type MessageChange =\n\t| { type: \"text_start\" | \"thinking_start\" | \"toolcall_start\"; contentIndex: number; block: Block }\n\t| { type: \"text_delta\" | \"thinking_delta\"; contentIndex: number; delta: string }\n\t| { type: \"toolcall_delta\"; contentIndex: number; path: readonly (string | number)[]; delta: string }\n\t| { type: \"block\"; contentIndex: number; block: Block }\n\t| { type: \"message\"; message: AssistantMessage };\n\nexport type SnapshotEvent = {\n\ttype: \"snapshot\";\n\tentries: readonly EntryRecord[];\n\trun?: { inputs: readonly SubmissionId[] };\n\t/** Current generation attempt: its in-flight partial, retry backoff, or deferred poll. */\n\tgeneration?: {\n\t\tattempt: number;\n\t\tmessage?: AssistantMessage;\n\t\tretry?: { at: number; error: string };\n\t\tdeferred?: { pollAt: number };\n\t};\n\ttools: readonly ToolSlot[];\n\t/** `pi.live.nestedTools`: nested calls of running tool calls. */\n\tnestedTools: readonly NestedToolSlot[];\n\t/** `pi.live.compactions`: live compactions with their attempt and retry backoff. */\n\tcompactions: readonly CompactionStatus[];\n\t/** `pi.live.compactionFailure`: the newest compaction failure since a compaction last produced a summary. */\n\tcompactionFailure?: CompactionFailure;\n\tinbox: readonly QueuedItem[];\n\t/** `pi.agent`; `{}` when absent. */\n\tagent: AgentState;\n\tusage: UsageState;\n};\n\n/** Experimental agent event, shaped like the coding agent's session events (spec §9.4). */\nexport type AgentEvent =\n\t| SnapshotEvent\n\t| { type: \"run_start\"; inputs: readonly SubmissionId[] }\n\t| { type: \"run_end\"; inputs: readonly SubmissionId[] }\n\t| { type: \"turn_start\" }\n\t| { type: \"turn_end\" }\n\t| { type: \"message_start\"; message: Message }\n\t/** `usage` is the partial's current usage, as in the coding agent's JSON mode. */\n\t| { type: \"message_update\"; usage: Usage; changes: readonly MessageChange[] }\n\t| { type: \"message_end\"; entry: EntryRecord }\n\t| ({ type: \"tool_execution_start\"; args: JsonObject } & ToolEventCall)\n\t| ({\n\t\t\ttype: \"tool_execution_update\";\n\t\t\t/** A front trim and then an append of the retained window, or its replacement. */\n\t\t\toutput?: { trimStart?: number; append?: string } | { set: string };\n\t\t\tdetails?: JsonValue;\n\t\t\tdiagnostics?: readonly ToolDiagnostic[];\n\t } & ToolEventCall)\n\t/**\n\t * A model-issued call ends with its result `entry`, a nested call with its `result`. Both are absent when the tool\n\t * task faulted or was orphaned, or when the call's slot left `pi.live` unfinished: its run ended, or its parent\n\t * settled first.\n\t */\n\t| ({ type: \"tool_execution_end\"; entry?: EntryRecord; result?: NestedToolExecutionResult } & ToolEventCall)\n\t| { type: \"inbox_update\"; items: readonly QueuedItem[] }\n\t| { type: \"submission\"; record: SubmissionRecord }\n\t| { type: \"auto_retry_start\"; attempt: number; at: number; errorMessage: string }\n\t| { type: \"auto_retry_end\"; attempt: number }\n\t| { type: \"deferred_poll\"; pollAt: number }\n\t| { type: \"entry_appended\"; entry: EntryRecord }\n\t| { type: \"agent_changed\"; agent: AgentState }\n\t| { type: \"usage_changed\"; usage: UsageState }\n\t| { type: \"task_failed\"; taskId: TaskId; kind: string; message: string }\n\t| { type: \"compaction_start\"; taskId: TaskId; reason: CompactionReason; blocking: boolean }\n\t/**\n\t * The task's receipt tells whether it produced a summary; the summary entry has its own events. `error` is set when\n\t * the compaction failed, faulted, or was orphaned, as in `pi.live.compactionFailure`.\n\t */\n\t| { type: \"compaction_end\"; taskId: TaskId; reason: CompactionReason; error?: string };\n\n/**\n * Which call a tool event is about. `toolCallId` is the call's ID in the transcript and in tool events: the provider's\n * ID for a model-issued call, `<parent call ID>/<key>` for a nested one. Match events by it; do not parse it. `taskId`\n * is the call's tool task, absent for a call that never got one (not offered, or not started in a sequential round).\n * A nested call also names the call that made it, by call ID and by tool task.\n */\nexport type ToolEventCall = {\n\ttoolCallId: string;\n\ttoolName: string;\n\ttaskId?: TaskId;\n\tparentToolCallId?: string;\n\tparentTaskId?: TaskId;\n};\n\n/** Serialized stream of one conversation's event batches, one per commit. */\nexport interface AgentEventStream {\n\t/** The `snapshot` event at attachment. */\n\treadonly snapshot: SnapshotEvent;\n\tstart(listener: (events: readonly AgentEvent[], context: Context) => Promise<void>): void;\n\tstop(): Promise<WatchEnd>;\n\treadonly closed: Promise<WatchEnd>;\n}\n\n/** The typed parts of a view the events read. */\ntype Parts = {\n\tlive: LiveState;\n\tinbox: InboxState | undefined;\n\tagent: AgentState | undefined;\n\tusage: UsageState | undefined;\n};\n\nfunction parts(view: ConversationView): Parts {\n\treturn {\n\t\tlive: (view.docs[\"pi.live\"] ?? {}) as LiveState,\n\t\tinbox: view.docs[\"pi.inbox\"] as InboxState | undefined,\n\t\tagent: view.docs[\"pi.agent\"] as AgentState | undefined,\n\t\tusage: view.docs[\"pi.usage\"] as UsageState | undefined,\n\t};\n}\n\nfunction snapshotOf(view: ConversationView): SnapshotEvent {\n\tconst { live, inbox, agent, usage } = parts(view);\n\treturn {\n\t\ttype: \"snapshot\",\n\t\tentries: view.entries,\n\t\t...(live.run === undefined ? {} : { run: { inputs: live.run.inputs } }),\n\t\t...(live.generation === undefined ? {} : { generation: live.generation as SnapshotEvent[\"generation\"] }),\n\t\ttools: live.tools ?? [],\n\t\tnestedTools: live.nestedTools ?? [],\n\t\tcompactions: live.compactions ?? [],\n\t\t...(live.compactionFailure === undefined ? {} : { compactionFailure: live.compactionFailure }),\n\t\tinbox: queued(inbox),\n\t\tagent: agent ?? AgentDoc.definition.initial(),\n\t\tusage: usage ?? UsageDoc.definition.initial(),\n\t};\n}\n\nfunction queued(inbox: InboxState | undefined): QueuedItem[] {\n\treturn (inbox?.items ?? []).map((item) => ({ id: item.id, mode: item.mode }));\n}\n\n/**\n * Experimental: attach to one conversation's agent events (spec §9.4). The snapshot and the registration for later\n * commits are captured atomically on the Session line; overflow replaces undelivered batches with one snapshot.\n */\nexport async function watchEvents(\n\tharness: Harness,\n\tconversationId: ConversationId,\n\tcontext: Context,\n): Promise<AgentEventStream> {\n\tconst views = conversationViews(harness);\n\tlet watch!: CommittedWatch<readonly AgentEvent[]>;\n\tlet snapshot!: SnapshotEvent;\n\tawait views.attach(\n\t\tconversationId,\n\t\tasync (initial, release, storage) => {\n\t\t\t// Generations whose held outcome already ended their turn, read on the line with the snapshot.\n\t\t\tconst query = { conversationId, kind: \"pi.generation\", status: \"completing\" } as const;\n\t\t\tconst completing = await scanAll((cursor) => storage.scanTasks(query, 100, cursor, context));\n\t\t\tconst held = new Set<TaskId>(completing.map((record) => record.id));\n\t\t\tlet current = initial;\n\t\t\tsnapshot = snapshotOf(initial);\n\t\t\t// Batches are the watch's values; an overflow delivers a snapshot of the newest view instead.\n\t\t\twatch = new CommittedWatch<readonly AgentEvent[]>(\n\t\t\t\t[],\n\t\t\t\trelease,\n\t\t\t\t(error) => views.report(error),\n\t\t\t\t() => [snapshotOf(current)],\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tpublication: (before, after, ops, publication, commitContext) => {\n\t\t\t\t\tcurrent = after;\n\t\t\t\t\tconst events = translate(conversationId, before, after, ops, publication, held);\n\t\t\t\t\tif (events.length > 0) watch.advance(events, [], commitContext);\n\t\t\t\t},\n\t\t\t\tcloseSession: (failure) => watch.closeSession(failure),\n\t\t\t};\n\t\t},\n\t\tcontext,\n\t);\n\t// Like a watch, the acquisition context governs the stream's lifetime.\n\tconst signal = context.abortSignal;\n\tif (signal?.aborted) {\n\t\twatch.cancel();\n\t\tthrow signal.reason;\n\t}\n\tif (signal !== undefined) watch.observeCancellation(signal);\n\treturn {\n\t\tsnapshot,\n\t\tstart: (listener) => watch.start((events, _ops, deliveryContext) => listener(events, deliveryContext)),\n\t\tstop: () => watch.stop(),\n\t\tclosed: watch.closed,\n\t};\n}\n\ntype TaskChange = Extract<CommitChange, { type: \"task\" }>;\n\n/** The tool result for `callId` among `entries`. */\nfunction resultOf(entries: readonly EntryRecord[], callId: string): EntryRecord | undefined {\n\treturn entries.find((entry) => {\n\t\tconst message = entry.model?.[0];\n\t\treturn message?.role === \"toolResult\" && message.toolCallId === callId;\n\t});\n}\n\n/** Every event one publication causes, in the order of spec §9.4. */\nfunction translate(\n\tconversationId: ConversationId,\n\tbefore: ConversationView,\n\tafter: ConversationView,\n\tviewOps: readonly Op[],\n\tpublication: CommitPublication,\n\theld: Set<TaskId>,\n): AgentEvent[] {\n\tconst entries: EntryRecord[] = [];\n\tconst tasks = new Map<TaskId, TaskChange[\"value\"]>();\n\tconst submissions: SubmissionRecord[] = [];\n\t// Nested results this commit stored, by nested task ID; read now, since the caller's documents may retire next.\n\tconst nestedResults = new Map<TaskId, NestedToolExecutionResult>();\n\tfor (const change of publication.changes) {\n\t\tif (\n\t\t\tchange.type === \"document\" &&\n\t\t\tchange.record.kind === NestedCallDoc.definition.kind &&\n\t\t\tchange.value !== null &&\n\t\t\tchange.conversationId === conversationId\n\t\t) {\n\t\t\tconst state = change.value as NestedCallState;\n\t\t\tif (state.taskId !== undefined && state.result !== undefined) {\n\t\t\t\tnestedResults.set(state.taskId, state.result as unknown as NestedToolExecutionResult);\n\t\t\t}\n\t\t}\n\t\tif (change.type === \"entry\" && change.value.conversationId === conversationId) entries.push(change.value);\n\t\tif (change.type === \"task\" && change.value.conversationId === conversationId)\n\t\t\ttasks.set(change.value.id, change.value);\n\t\tif (change.type === \"submission\" && change.value.conversationId === conversationId) {\n\t\t\tsubmissions.push(change.value);\n\t\t}\n\t}\n\tif (viewOps.length === 0 && entries.length === 0 && tasks.size === 0 && submissions.length === 0) return [];\n\t// Entries are appended in ID order; submission records are published in the order the commit first touched them.\n\tsubmissions.sort((a, b) => a.id - b.id);\n\tconst was = parts(before);\n\tconst now = parts(after);\n\tconst events: AgentEvent[] = [];\n\n\t// Progress: tool starts, the in-flight message, tool updates, retry and deferred state.\n\tconst slotsBefore = new Map((was.live.tools ?? []).map((slot) => [slot.callId, slot]));\n\tconst slots = now.live.tools ?? [];\n\tconst nestedBefore = new Map((was.live.nestedTools ?? []).map((slot) => [slot.taskId, slot]));\n\tconst nested = now.live.nestedTools ?? [];\n\tfor (const slot of [...slots, ...nested]) {\n\t\tconst previous = \"parentCallId\" in slot ? nestedBefore.get(slot.taskId) : slotsBefore.get(slot.callId);\n\t\tif (slot.status !== \"running\" || previous?.status === \"running\") continue;\n\t\t// A nested slot carries the arguments the call runs with; a model-issued call's are in its intent checkpoint.\n\t\tconst checkpoint = slot.taskId === undefined ? undefined : tasks.get(slot.taskId)?.state.checkpoint;\n\t\tconst args =\n\t\t\t\"parentCallId\" in slot\n\t\t\t\t? slot.arguments\n\t\t\t\t: ((checkpoint as { arguments?: JsonObject } | undefined)?.arguments ?? {});\n\t\tevents.push({ type: \"tool_execution_start\", ...callOf(slot), args });\n\t}\n\tconst partialBefore = was.live.generation?.message as AssistantMessage | undefined;\n\tconst partial = now.live.generation?.message as AssistantMessage | undefined;\n\tif (partial !== undefined && partialBefore === undefined) events.push({ type: \"message_start\", message: partial });\n\telse if (partial !== undefined && partial !== partialBefore) {\n\t\tevents.push({ type: \"message_update\", usage: partial.usage, changes: messageChanges(viewOps, partial) });\n\t}\n\tfor (const [index, slot] of slots.entries()) {\n\t\tconst previous = slotsBefore.get(slot.callId);\n\t\tif (slot.status !== \"running\" || previous?.status !== \"running\") continue;\n\t\tconst update = toolUpdate(viewOps, [\"tools\", index], slot, previous);\n\t\tif (update === undefined) continue;\n\t\tevents.push({ type: \"tool_execution_update\", ...callOf(slot), ...update });\n\t}\n\tfor (const [index, slot] of nested.entries()) {\n\t\tconst previous = nestedBefore.get(slot.taskId);\n\t\tif (slot.status !== \"running\" || previous?.status !== \"running\") continue;\n\t\tconst update = toolUpdate(viewOps, [\"nestedTools\", index], slot, previous);\n\t\tif (update === undefined) continue;\n\t\tevents.push({ type: \"tool_execution_update\", ...callOf(slot), ...update });\n\t}\n\tconst generation = now.live.generation;\n\tconst generationBefore = was.live.generation;\n\tif (generation?.retry !== undefined && generationBefore?.retry === undefined) {\n\t\tconst { at, error } = generation.retry;\n\t\tevents.push({ type: \"auto_retry_start\", attempt: generation.attempt, at, errorMessage: error });\n\t}\n\tif (generationBefore?.retry !== undefined && generation?.retry === undefined) {\n\t\tevents.push({ type: \"auto_retry_end\", attempt: generationBefore.attempt });\n\t}\n\tif (generation?.deferred !== undefined && generation.deferred.pollAt !== generationBefore?.deferred?.pollAt) {\n\t\tevents.push({ type: \"deferred_poll\", pollAt: generation.deferred.pollAt });\n\t}\n\n\t// Tools that end in this commit: a slot that becomes done, one created done (a call not offered), or an unfinished\n\t// one that vanishes because its run ended. A done slot that vanishes ended earlier.\n\tconst toolEnds: Extract<AgentEvent, { type: \"tool_execution_end\" }>[] = [];\n\tconst endTool = (slot: ToolSlot, entryId: number | undefined): void => {\n\t\tconst entry = entries.find((candidate) => candidate.id === entryId);\n\t\ttoolEnds.push({ type: \"tool_execution_end\", ...callOf(slot), ...(entry === undefined ? {} : { entry }) });\n\t};\n\tfor (const previous of slotsBefore.values()) {\n\t\tif (previous.status === \"done\") continue;\n\t\tconst slot = slots.find((candidate) => candidate.callId === previous.callId);\n\t\tif (slot?.status === \"done\") endTool(slot, slot.entry);\n\t\t// A slot whose run ended in this commit may have had its result appended with it, as for unstarted calls.\n\t\telse if (slot === undefined) endTool(previous, resultOf(entries, previous.callId)?.id);\n\t}\n\tfor (const slot of slots) {\n\t\tif (slot.status === \"done\" && !slotsBefore.has(slot.callId)) endTool(slot, slot.entry);\n\t}\n\t// Nested calls that end in this commit, the same way, children before the calls that made them: the lists hold\n\t// parents first, so walk them backwards.\n\tconst endNested = (slot: NestedToolSlot): void => {\n\t\tconst result = nestedResults.get(slot.taskId);\n\t\tevents.push({ type: \"tool_execution_end\", ...callOf(slot), ...(result === undefined ? {} : { result }) });\n\t};\n\tconst nestedNow = new Map(nested.map((slot) => [slot.taskId, slot]));\n\tfor (const previous of [...nestedBefore.values()].reverse()) {\n\t\tif (previous.status === \"done\") continue;\n\t\tconst slot = nestedNow.get(previous.taskId);\n\t\tif (slot?.status === \"done\" || slot === undefined) endNested(slot ?? previous);\n\t}\n\tfor (const slot of [...nested].reverse()) {\n\t\tif (slot.status === \"done\" && !nestedBefore.has(slot.taskId)) endNested(slot);\n\t}\n\n\t// Entries in append order; a tool's end directly precedes its result's message, as in the coding agent.\n\tlet assistantAppended = false;\n\tfor (const entry of entries) {\n\t\tevents.push(...toolEnds.filter((end) => end.entry === entry));\n\t\tconst message = entry.model?.[0];\n\t\tif (message === undefined) {\n\t\t\tevents.push({ type: \"entry_appended\", entry });\n\t\t\tcontinue;\n\t\t}\n\t\t// A streamed answer already started with its first partial.\n\t\tconst streamed = message.role === \"assistant\" && partialBefore !== undefined && !assistantAppended;\n\t\tif (message.role === \"assistant\") assistantAppended = true;\n\t\tif (!streamed) events.push({ type: \"message_start\", message });\n\t\tevents.push({ type: \"message_end\", entry });\n\t}\n\t// Ends without a result entry: a faulted or orphaned tool, or one whose run ended.\n\tevents.push(...toolEnds.filter((end) => end.entry === undefined));\n\n\t// Compaction ends, task failures, then turn and run ends.\n\tconst compactionsBefore = was.live.compactions ?? [];\n\tconst compactions = now.live.compactions ?? [];\n\tconst failure = now.live.compactionFailure;\n\tfor (const { taskId, reason } of compactionsBefore) {\n\t\tif (!compactions.some((status) => status.taskId === taskId)) {\n\t\t\tconst error = failure?.taskId === taskId ? failure.error : undefined;\n\t\t\tevents.push({ type: \"compaction_end\", taskId, reason, ...(error === undefined ? {} : { error }) });\n\t\t}\n\t}\n\t// A generation's turn ends when its outcome is committed: at a `completing` hold or at terminal, whichever comes\n\t// first, so a successor created at the hold starts after it.\n\tlet turnEnded = false;\n\tfor (const task of tasks.values()) {\n\t\tconst status = task.state.status;\n\t\tif (task.kind === \"pi.generation\" && status === \"completing\" && !held.has(task.id)) {\n\t\t\theld.add(task.id);\n\t\t\tturnEnded = true;\n\t\t}\n\t\tif (status !== \"terminal\") continue;\n\t\tif (task.kind === \"pi.generation\" && !held.delete(task.id)) turnEnded = true;\n\t\tconst outcome = task.state.outcome;\n\t\tif (outcome.status === \"faulted\" || outcome.status === \"orphaned\") {\n\t\t\tconst message = outcome.status === \"faulted\" ? outcome.error.message : outcome.reason;\n\t\t\tevents.push({ type: \"task_failed\", taskId: task.id, kind: task.kind, message });\n\t\t}\n\t}\n\tif (turnEnded) events.push({ type: \"turn_end\" });\n\tconst run = now.live.run;\n\tconst runBefore = was.live.run;\n\tconst runChanged = run?.inputs[0] !== runBefore?.inputs[0];\n\tif (runBefore !== undefined && runChanged) events.push({ type: \"run_end\", inputs: runBefore.inputs });\n\n\t// Submissions, document state, then what began.\n\tfor (const record of submissions) events.push({ type: \"submission\", record });\n\tif (now.inbox !== was.inbox) events.push({ type: \"inbox_update\", items: queued(now.inbox) });\n\t// A retired document reads as its initial value, as in a snapshot.\n\tif (now.agent !== was.agent) {\n\t\tevents.push({ type: \"agent_changed\", agent: now.agent ?? AgentDoc.definition.initial() });\n\t}\n\tif (now.usage !== was.usage)\n\t\tevents.push({ type: \"usage_changed\", usage: now.usage ?? UsageDoc.definition.initial() });\n\tfor (const { taskId, reason, blocking } of compactions) {\n\t\tif (!compactionsBefore.some((status) => status.taskId === taskId)) {\n\t\t\tevents.push({ type: \"compaction_start\", taskId, reason, blocking });\n\t\t}\n\t}\n\tif (run !== undefined && runChanged) events.push({ type: \"run_start\", inputs: run.inputs });\n\tif (run !== undefined && run.taskId !== runBefore?.taskId && tasks.get(run.taskId)?.kind === \"pi.generation\") {\n\t\tevents.push({ type: \"turn_start\" });\n\t}\n\treturn events;\n}\n\nconst PARTIAL_PATH = [\"docs\", \"pi.live\", \"generation\", \"message\"];\n\n/** Translate the view operations on the in-flight message into message changes (spec §9.4). */\nfunction messageChanges(viewOps: readonly Op[], message: AssistantMessage): MessageChange[] {\n\tconst changes: MessageChange[] = [];\n\t// A block sent whole already holds every later change to it in this batch.\n\tconst whole = new Set<number>();\n\tfor (const op of viewOps) {\n\t\t// View operations never replace the root.\n\t\tconst path = op[1] as Path;\n\t\tif (!startsWith(path, PARTIAL_PATH)) {\n\t\t\t// The whole message or generation was replaced.\n\t\t\tif (startsWith(PARTIAL_PATH, path)) return [{ type: \"message\", message }];\n\t\t\tcontinue;\n\t\t}\n\t\tconst rest = path.slice(PARTIAL_PATH.length);\n\t\tif (rest[0] === \"usage\") continue;\n\t\tif (rest[0] !== \"content\") return [{ type: \"message\", message }];\n\t\tif (rest.length === 1) {\n\t\t\tif (op[0] !== \"p\" || op[3] !== 0) return [{ type: \"message\", message }];\n\t\t\tfor (const [offset, block] of (op[4] as unknown as Block[]).entries()) {\n\t\t\t\tconst type =\n\t\t\t\t\tblock.type === \"text\" ? \"text_start\" : block.type === \"thinking\" ? \"thinking_start\" : \"toolcall_start\";\n\t\t\t\tchanges.push({ type, contentIndex: op[2] + offset, block });\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tconst contentIndex = rest[1] as number;\n\t\tconst field = rest[2];\n\t\tif (whole.has(contentIndex)) continue;\n\t\tif (op[0] === \"a\" && rest.length === 3 && (field === \"text\" || field === \"thinking\")) {\n\t\t\tchanges.push({ type: field === \"text\" ? \"text_delta\" : \"thinking_delta\", contentIndex, delta: op[2] });\n\t\t} else if (op[0] === \"a\" && field === \"arguments\") {\n\t\t\tchanges.push({ type: \"toolcall_delta\", contentIndex, path: rest.slice(3), delta: op[2] });\n\t\t} else {\n\t\t\twhole.add(contentIndex);\n\t\t\tchanges.push({ type: \"block\", contentIndex, block: message.content[contentIndex]! });\n\t\t}\n\t}\n\treturn changes;\n}\n\n/** The identifying fields of a slot's tool events. */\nfunction callOf(slot: ToolSlot | NestedToolSlot): ToolEventCall {\n\treturn {\n\t\ttoolCallId: slot.callId,\n\t\ttoolName: slot.name,\n\t\t...(slot.taskId === undefined ? {} : { taskId: slot.taskId }),\n\t\t...(\"parentCallId\" in slot ? { parentToolCallId: slot.parentCallId, parentTaskId: slot.parentTaskId } : {}),\n\t};\n}\n\n/** Output, details, and diagnostics changes of a running slot at `at` in `pi.live`, from the view operations on it. */\nfunction toolUpdate(\n\tviewOps: readonly Op[],\n\tat: readonly [\"tools\" | \"nestedTools\", number],\n\tslot: ToolSlot | NestedToolSlot,\n\tprevious: ToolSlot | NestedToolSlot,\n): Omit<Extract<AgentEvent, { type: \"tool_execution_update\" }>, \"type\" | keyof ToolEventCall> | undefined {\n\tconst outputPath = [\"docs\", \"pi.live\", ...at, \"output\"];\n\tlet trimStart = 0;\n\tlet append = \"\";\n\tlet set = false;\n\tfor (const op of viewOps) {\n\t\tif (!startsWith(op[1] as Path, outputPath)) continue;\n\t\tif (op[0] === \"t\") trimStart += op[2];\n\t\telse if (op[0] === \"a\") append += op[2];\n\t\telse set = true;\n\t}\n\tlet output: { trimStart?: number; append?: string } | { set: string } | undefined;\n\tif (set || (slot.output !== previous.output && trimStart === 0 && append === \"\"))\n\t\toutput = { set: slot.output ?? \"\" };\n\telse if (trimStart > 0 || append !== \"\") {\n\t\toutput = { ...(trimStart > 0 ? { trimStart } : {}), ...(append === \"\" ? {} : { append }) };\n\t}\n\t// A safe replay clears a running slot's progress: removed details send `null`, removed diagnostics `[]`.\n\tconst update = {\n\t\t...(output === undefined ? {} : { output }),\n\t\t...(slot.details === previous.details ? {} : { details: slot.details ?? null }),\n\t\t...(slot.diagnostics === previous.diagnostics ? {} : { diagnostics: slot.diagnostics ?? [] }),\n\t};\n\treturn Object.keys(update).length === 0 ? undefined : update;\n}\n\nfunction startsWith(path: Path, prefix: readonly (string | number)[]): boolean {\n\treturn prefix.length <= path.length && prefix.every((segment, index) => path[index] === segment);\n}\n"]}
@@ -12,6 +12,8 @@ export type GenerationCheckpoint = {
12
12
  compacted?: TaskId<CompactionResult>;
13
13
  /** Error text of the overflow that started `compacted`; checked once when `prepare` resumes. */
14
14
  overflow?: string;
15
+ /** Set when the blocking threshold started `compacted`; its outcome is checked once when `prepare` resumes. */
16
+ threshold?: true;
15
17
  } | {
16
18
  phase: "request";
17
19
  attempt: number;
@@ -1 +1 @@
1
- {"version":3,"file":"generation.d.ts","sourceRoot":"","sources":["../../src/harness/generation.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,KAAK,EAAkB,MAAM,uBAAuB,CAAC;AAC3F,OAAO,KAAK,EAGX,cAAc,EAGd,kBAAkB,EAGlB,MAAM,uBAAuB,CAAC;AAO/B,OAAO,KAAK,EACX,cAAc,EACd,OAAO,EAEP,YAAY,EACZ,MAAM,EAEN,EAAE,EAEF,MAAM,aAAa,CAAC;AAKrB,OAAO,EAAmB,KAAK,SAAS,EAAiB,MAAM,WAAW,CAAC;AAG3E,OAAO,EAA4C,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAC1F,OAAO,KAAK,EAEX,gBAAgB,EAEhB,yBAAyB,EACzB,eAAe,EACf,QAAQ,EAIR,MAAM,YAAY,CAAC;AAGpB,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAEpD,MAAM,MAAM,oBAAoB,GAC7B;IACA,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,MAA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,cAAc,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAKlH;AAuTD,gGAAgG;AAChG,wBAAsB,QAAQ,CAC7B,EAAE,EAAE,EAAE,EACN,cAAc,EAAE,cAAc,EAC9B,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,EACtB,MAAM,EAAE,YAAY,EAAE,GACpB,OAAO,CAAC,IAAI,CAAC,CAEf;AAOD,2EAA2E;AAC3E,wBAAgB,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAE/E"}
@@ -13,7 +13,6 @@ import { planSystemEntries, renderSections, replaySections } from "./prompt.js";
13
13
  import { ensureProviderSessionId } from "./provider.js";
14
14
  import { appendToolResult, harnessError, ToolTask } from "./tool.js";
15
15
  import { recordUsage } from "./usage.js";
16
- const PARTIAL_THROTTLE_MS = 100;
17
16
  const DEFAULT_POLL_AFTER_MS = 5000;
18
17
  /**
19
18
  * Built-in generation task: prepares the positional system prompt and tool loadout, requests or polls the model,
@@ -26,8 +25,9 @@ export const GenerationTask = defineTask({
26
25
  phases: {
27
26
  /**
28
27
  * Render the system prompt and tool loadout and append the positional `pi.system` entries they need, then move to
29
- * `request`. The agent and settings resolved here are fixed for this request. Only the Harness writes to a busy
30
- * conversation, so the transcript read here is still the tail at the commit.
28
+ * `request`. The agent and settings resolved here are fixed for this request. Only the Harness writes model
29
+ * context to a busy conversation, so the context read here is still current at the commit; display-only entries
30
+ * may land meanwhile.
31
31
  */
32
32
  prepare: async (task, runtime, context) => {
33
33
  const { conversationId } = runtime;
@@ -37,13 +37,21 @@ export const GenerationTask = defineTask({
37
37
  const resolved = model === undefined ? undefined : runtime.models.getModel(model.provider, model.modelId);
38
38
  if (model === undefined || resolved === undefined)
39
39
  return failNoModel(runtime, model, context);
40
- const { attempt, compacted, overflow } = task.state.checkpoint;
40
+ const { attempt, compacted, overflow, threshold: blocked } = task.state.checkpoint;
41
41
  if (compacted !== undefined && overflow !== undefined) {
42
42
  const [outcome] = await runtime.outcomes([compacted], context);
43
43
  if (outcome?.status !== "completed" || outcome.result.entryId === undefined) {
44
44
  return failModelError(runtime, overflow, context);
45
45
  }
46
46
  }
47
+ // A threshold compaction that found nothing to compact or was declined leaves a request that may still fit. One
48
+ // that failed left a context it judged too large: sending it would at best leave no room for the answer.
49
+ if (compacted !== undefined && blocked === true) {
50
+ const [outcome] = await runtime.outcomes([compacted], context);
51
+ if (outcome !== undefined && outcome.status !== "completed") {
52
+ return failModelError(runtime, compactionFailure(outcome), context);
53
+ }
54
+ }
47
55
  const view = await runtime.context(conversationId, context);
48
56
  const shown = replaySections(view.messages);
49
57
  const report = (error) => runtime.report(error);
@@ -66,7 +74,7 @@ export const GenerationTask = defineTask({
66
74
  // Compact first and prepare again; the transcript is unchanged until the compaction appends.
67
75
  await runtime.commit(async (tx) => {
68
76
  const child = await createCompaction(tx, conversationId, { reason: "threshold" }, runtime.taskId);
69
- const checkpoint = { phase: "prepare", attempt, compacted: child };
77
+ const checkpoint = { phase: "prepare", attempt, compacted: child, threshold: true };
70
78
  return { status: "waiting", checkpoint, on: [child], policy: "allSettled" };
71
79
  }, context);
72
80
  return;
@@ -104,7 +112,7 @@ export const GenerationTask = defineTask({
104
112
  const model = runtime.models.getModel(ref.provider, ref.modelId);
105
113
  if (model === undefined)
106
114
  return failNoModel(runtime, ref, context);
107
- const view = await runtime.context(conversationId, context, cutoff);
115
+ const view = await runtime.context(conversationId, context, { at: cutoff });
108
116
  let messages = view.messages;
109
117
  await runtime.hooks.each("beforeRequest", async (hook) => {
110
118
  const replaced = await hook({ messages }, runtime, context);
@@ -189,7 +197,7 @@ export const GenerationTask = defineTask({
189
197
  await convertPartial(tx, live, conversationId);
190
198
  for (const call of unstarted) {
191
199
  const result = harnessError("aborted", `Tool ${call.name} was aborted`);
192
- await appendToolResult(tx, conversationId, call, result, runtime.now());
200
+ await appendToolResult(tx, conversationId, call, result, { timestamp: runtime.now() });
193
201
  }
194
202
  endRun(tx, live, runtime.taskId, { status: "unanswered", reason: "aborted" });
195
203
  return { status: "terminal", outcome: { status: "aborted" } };
@@ -204,7 +212,7 @@ async function readCalls(runtime, assistant, callIds, context) {
204
212
  }
205
213
  /** A tool task for call `callId`, owned by the generation. */
206
214
  function createToolTask(tx, runtime, assistant, callId) {
207
- return tx.createTask(ToolTask, { assistant, callId }, { ownership: { kind: "task", taskId: runtime.taskId } });
215
+ return tx.createTask(ToolTask, { kind: "model", assistant, callId }, { ownership: { kind: "task", taskId: runtime.taskId } });
208
216
  }
209
217
  /**
210
218
  * Which threshold compaction preparation starts before its request (spec §8.3): `blocking` above
@@ -222,6 +230,18 @@ function thresholdCompaction(view, planned, contextWindow, policy) {
222
230
  return undefined;
223
231
  return over;
224
232
  }
233
+ /** Error text for a generation whose blocking compaction ended without completing. */
234
+ function compactionFailure(outcome) {
235
+ switch (outcome.status) {
236
+ case "failed":
237
+ case "faulted":
238
+ return `Compaction failed: ${outcome.error.message}`;
239
+ case "orphaned":
240
+ return `Compaction failed: ${outcome.reason}`;
241
+ case "aborted":
242
+ return "Compaction was aborted";
243
+ }
244
+ }
225
245
  /** Settle the run's inputs `unanswered` with `model_error` and fail with `text`. */
226
246
  async function failModelError(runtime, text, context) {
227
247
  await runtime.commit(async (tx) => {
@@ -254,10 +274,12 @@ export async function convertPartial(tx, live, conversationId) {
254
274
  await appendAssistant(tx, conversationId, { ...message, stopReason: "aborted" });
255
275
  }
256
276
  /**
257
- * Stream one request and return the terminal message. Partials commit as trailing writes at most every 100 ms with one
258
- * commit in flight; `finally` stops the throttle and awaits that commit, so no stale partial lands after the outcome.
277
+ * Stream one request and return the terminal message. Partials commit as trailing writes at most every
278
+ * `progress.partialIntervalMs` (default 100 ms) with one commit in flight; `finally` stops the throttle and awaits that
279
+ * commit, so no stale partial lands after the outcome.
259
280
  */
260
281
  async function streamResponse(runtime, model, messages, options, attempt, context) {
282
+ const interval = runtime.settings.progress.partialIntervalMs;
261
283
  let pending;
262
284
  let timer;
263
285
  let inFlight;
@@ -286,7 +308,7 @@ async function streamResponse(runtime, model, messages, options, attempt, contex
286
308
  .finally(() => {
287
309
  inFlight = undefined;
288
310
  if (pending !== undefined && !stopped)
289
- timer = setTimeout(flush, PARTIAL_THROTTLE_MS);
311
+ timer = setTimeout(flush, interval);
290
312
  });
291
313
  };
292
314
  try {
@@ -298,7 +320,7 @@ async function streamResponse(runtime, model, messages, options, attempt, contex
298
320
  continue;
299
321
  pending = event.partial;
300
322
  if (timer === undefined && inFlight === undefined)
301
- timer = setTimeout(flush, PARTIAL_THROTTLE_MS);
323
+ timer = setTimeout(flush, interval);
302
324
  }
303
325
  return await events.result();
304
326
  }
@@ -345,7 +367,7 @@ async function classify(runtime, request, message, context) {
345
367
  const overflow = message.stopReason === "error" && isContextOverflow(message);
346
368
  if (overflow && compacted === undefined && settings.compaction.enabled) {
347
369
  const policy = settings.compaction;
348
- const view = await runtime.context(conversationId, context, cutoff);
370
+ const view = await runtime.context(conversationId, context, { at: cutoff });
349
371
  if (selectCut(view, policy.keepRecentTokens) !== undefined) {
350
372
  const text = message.errorMessage ?? "Context overflow";
351
373
  await runtime.commit(async (tx) => {
@@ -428,7 +450,7 @@ async function answer(runtime, message, context) {
428
450
  */
429
451
  async function startToolRound(runtime, request, message, calls, context) {
430
452
  const conversationId = runtime.conversationId;
431
- const messages = request.messages ?? (await runtime.context(conversationId, context, request.cutoff)).messages;
453
+ const messages = request.messages ?? (await runtime.context(conversationId, context, { at: request.cutoff })).messages;
432
454
  const offered = new Set(getCurrentTools(messages).map((tool) => tool.name));
433
455
  // Read as the round starts; a tool is resolved as its tool task resolves it.
434
456
  const tools = (await runtime.agent(context)).tools;
@@ -443,7 +465,7 @@ async function startToolRound(runtime, request, message, calls, context) {
443
465
  for (const call of calls) {
444
466
  if (!offered.has(call.name)) {
445
467
  const unavailable = harnessError("tool_unavailable", `Tool ${call.name} is not available`);
446
- const result = await appendToolResult(tx, conversationId, call, unavailable, runtime.now());
468
+ const result = await appendToolResult(tx, conversationId, call, unavailable, { timestamp: runtime.now() });
447
469
  slots.push({ callId: call.id, name: call.name, status: "done", entry: result.id });
448
470
  continue;
449
471
  }
@@ -472,7 +494,8 @@ async function finishToolRound(runtime, assistant, tools, context) {
472
494
  const outcomes = await runtime.outcomes(tools, context);
473
495
  tools.forEach((id, index) => {
474
496
  const outcome = outcomes[index];
475
- controls.set(id, outcome.status === "completed" ? outcome.result.control : undefined);
497
+ // Version 1 results have no kind; every result a generation's round reads is a model-issued call's.
498
+ controls.set(id, outcome.status === "completed" && outcome.result.kind !== "nested" ? outcome.result.control : undefined);
476
499
  });
477
500
  const slots = (await runtime.snapshot(LiveDoc, conversationId, context))?.tools ?? [];
478
501
  const results = slots.flatMap((slot) => (slot.entry === undefined ? [] : [slot.entry]));
@@ -510,6 +533,7 @@ async function finishToolRound(runtime, assistant, tools, context) {
510
533
  }
511
534
  else {
512
535
  delete live.tools;
536
+ delete live.nestedTools;
513
537
  if (live.run?.taskId === runtime.taskId)
514
538
  live.run.inputs.push(...users);
515
539
  handOver(live, runtime.taskId, await createGeneration(tx, conversationId));