@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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reload.js","sourceRoot":"","sources":["../src/reload.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,IAAI,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEhE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAEN,UAAU,EACV,WAAW,EACX,aAAa,GAOb,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAkDrD,MAAM,IAAI,GAAG,GAAS,EAAE,GAAE,CAAC,CAAC;AAE5B;;;;GAIG;AACH,SAAS,MAAM,CAAC,SAAoB;IACnC,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IACrD,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;IACrD,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,QAAQ,EAAE,CAAC;QACtC,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE;YAC3C,WAAW,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,OAAO,oBAAoB,IAAI,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IACvF,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,GAAG,CAAmB,QAAQ,CAAC,CAAC;IACnD,MAAM,OAAO,G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,CACV,IAAI,UAAU,CAAC,kBAAkB,EAAE,GAAG,MAAM,CAAC,QAAQ,iCAAiC,EAAE;wBACvF,KAAK,EAAE,KAAK;qBACZ,CAAC,CACF,CAAC;oBACF,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;oBACvB,SAAS;gBACV,CAAC;YACF,CAAC;YACD,MAAM,CAAC,YAAY,EAAE,CAAC;QACvB,CAAC;IACF,CAAC;CACD","sourcesContent":["import type { Cell } from \"./cell.ts\";\nimport { type AnyContract, bind, coverage } from \"./contract.ts\";\nimport { asChordError, ChordError, invalid } from \"./errors.ts\";\nimport type { EpochState, Facet, HostImpl, PluginRef, Serve } from \"./host.ts\";\nimport { holdPublications } from \"./publish.ts\";\nimport {\n\ttype Factory,\n\tHandleImpl,\n\tmakeService,\n\tmemberSchemas,\n\ttype RecordImpl,\n\ttype ResourceImpl,\n\ttype Run,\n\ttype ServeOptions,\n\ttype Service,\n\ttype StagedListeners,\n} from \"./record.ts\";\nimport type { RegistryTable } from \"./registry.ts\";\nimport { assertValid, deepEqual } from \"./schema.ts\";\n\nexport interface ReloadOptions {\n\t/** Facet names to remove. */\n\treadonly remove?: readonly string[];\n\t/** Milliseconds the gate waits for grandfathered roots (default 5000). Missed: the reload aborts. */\n\treadonly gateDeadline?: number;\n\t/** Milliseconds to wait for the previous epoch to retire first (default 5000). Missed: it is retired anyway. */\n\treadonly retireDeadline?: number;\n\t/** Server: facet modules for child hosts by host-name prefix (longest wins). Every connected host participates. */\n\treadonly remote?: Readonly<Record<string, readonly string[]>>;\n\t/** Server: facet names to remove on child hosts, by the same host-name prefix rules. */\n\treadonly remoteRemove?: Readonly<Record<string, readonly string[]>>;\n\t/** Server: milliseconds to wait for every child's vote (default: gate + retire deadlines + 5000). */\n\treadonly voteDeadline?: number;\n}\n\nexport interface ReloadReport {\n\treadonly epoch: number;\n\treadonly previous: number;\n\treadonly changed: readonly string[];\n\treadonly removed: readonly string[];\n\t/** Addresses of records whose new factory was installed. */\n\treadonly prepared: readonly string[];\n\t/** Addresses of records that went through the gate. */\n\treadonly gated: readonly string[];\n\t/**\n\t * Cluster reloads: what each participating child host prepared, by host name (its vote; the child commits it after\n\t * the server). Absent for local reloads.\n\t */\n\treadonly children?: Readonly<Record<string, ReloadReport>>;\n}\n\ninterface Candidate {\n\treadonly record: RecordImpl;\n\treadonly service: Service;\n\treadonly run: Run;\n\t/** Why the record needs the gate (empty: compatible). */\n\treadonly reasons: string[];\n\t/** New exclusive resources and their new dependents, opened at the gate. */\n\treadonly atGate: ResourceImpl[];\n\t/** Old exclusive resources closed at the gate. */\n\treadonly replaced: ResourceImpl[];\n\treadonly migrated: Map<Cell<unknown>, unknown>;\n\t/** Values of the run's derivations over the candidate (migrated) values, validated. */\n\tderived: Map<unknown, unknown>;\n\t/** Listener subscriptions made at the end of prepare, activated by the commit. */\n\tstaged: StagedListeners | undefined;\n}\n\nconst noop = (): void => {};\n\n/**\n * Computes the new derivation functions over the candidate values and validates every prospective value (migrated\n * cells and derivations) against every schema that will apply after the commit: the cell's new schema and the new\n * behavior's remote state-member schemas. A failure fails prepare; the commit then installs without re-checking.\n */\nfunction dryRun(candidate: Candidate): void {\n\tconst { run, migrated, service, record } = candidate;\n\tconst exposed = memberSchemas(service, run.behavior);\n\tfor (const [cell, value] of migrated) {\n\t\tfor (const schema of exposed.get(cell) ?? [])\n\t\t\tassertValid(\"state\", `${record.address}: migrated state ${cell.key}`, schema, value);\n\t}\n\tconst values = new Map<unknown, unknown>(migrated);\n\tconst derives = [...run.decls.derives].sort(([, a], [, b]) => a.seq - b.seq);\n\tfor (const [name, derived] of derives) {\n\t\tconst value = derived.compute(\n\t\t\t(source) => (values.has(source) ? values.get(source) : source.value),\n\t\t\trun.decls.deriveFns.get(name),\n\t\t);\n\t\tfor (const schema of exposed.get(derived) ?? [])\n\t\t\tassertValid(\"state\", `${record.address}: derived ${name}`, schema, value);\n\t\tvalues.set(derived, value);\n\t}\n\tcandidate.derived = values;\n}\n\n/** A reload error keeps the underlying code (`contract_mismatch`, `invalid`, ...) and says it aborted the reload. */\nexport function reloadError(error: unknown): ChordError {\n\tconst cause = asChordError(error, \"reload\");\n\tif (/^reload aborted/.test(cause.message.replace(/^[^:]*: /, \"\"))) return cause;\n\treturn new ChordError(cause.code, `reload aborted: ${cause.message}`, {\n\t\tcause,\n\t\treason: cause.reason,\n\t\tdetails: cause.details,\n\t});\n}\n\n/** Serialized: a second reload while one runs is rejected. */\nexport async function runReload(\n\thost: HostImpl,\n\tplugins: readonly PluginRef[],\n\toptions: ReloadOptions,\n): Promise<ReloadReport> {\n\tconst reload = await beginReload(host, plugins, options);\n\ttry {\n\t\tawait reload.prepare();\n\t\treturn reload.commit();\n\t} finally {\n\t\tendReload(host);\n\t}\n}\n\n/** Takes the host's reload slot and loads the plugin modules. Pair with `endReload`. */\nexport async function beginReload(\n\thost: HostImpl,\n\tplugins: readonly PluginRef[],\n\toptions: ReloadOptions,\n\tepoch?: number,\n): Promise<Reload> {\n\tif (host.reloading) {\n\t\tthrow new ChordError(\"unavailable\", \"a reload is already running\", { reason: \"reload_running\" });\n\t}\n\thost.reloading = true;\n\ttry {\n\t\treturn new Reload(host, await host.resolve(plugins), options, epoch);\n\t} catch (error) {\n\t\thost.reloading = false;\n\t\tthrow reloadError(error);\n\t}\n}\n\nexport function endReload(host: HostImpl): void {\n\thost.reloading = false;\n\thost.maybeRetire();\n}\n\n/** One reload on one host: `prepare` (load, prepare, gate), then `commit` or `rollback`. */\nexport class Reload {\n\treadonly host: HostImpl;\n\treadonly facets: readonly Facet[];\n\treadonly options: ReloadOptions;\n\t/** Epoch id to commit (issued by the coordinating server); a local reload allocates one. */\n\treadonly epoch: number | undefined;\n\treadonly candidates = new Map<RecordImpl, Candidate>();\n\treadonly abort = new AbortController();\n\treadonly closed: [RecordImpl, ResourceImpl][] = [];\n\tservices = new Map<string, Service>();\n\tchanged = new Set<string>();\n\tremoved = new Set<string>();\n\ttables = new Map<string, RegistryTable<unknown>>();\n\tgated: Candidate[] = [];\n\trolledBack = false;\n\t/** Records of types this reload adds, with their staged listeners: their runtime starts at commit. */\n\treadonly deferred = new Map<RecordImpl, StagedListeners>();\n\n\tconstructor(host: HostImpl, facets: readonly Facet[], options: ReloadOptions, epoch?: number) {\n\t\tthis.host = host;\n\t\tthis.facets = facets;\n\t\tthis.options = options;\n\t\tthis.epoch = epoch;\n\t}\n\n\t/** Everything up to the commit. On failure the host is rolled back and the underlying error is thrown. */\n\tasync prepare(): Promise<void> {\n\t\ttry {\n\t\t\tawait this.waitForRetirement();\n\t\t\tthis.load();\n\t\t\tthis.checkProviders();\n\t\t\tawait this.prepareAll();\n\t\t\t// From here new records of changed types are rejected (upgrade_conflict, retryable) until commit or abort,\n\t\t\t// so the candidate set is final once the activations already in flight have been prepared.\n\t\t\tthis.host.gating = this.changed;\n\t\t\tawait this.withDeadline(this.prepareAll(), \"activations in flight did not finish\");\n\t\t\tthis.checkHolds();\n\t\t\tthis.tables = this.host.buildTables(this.entries());\n\t\t\tawait this.gate();\n\t\t\tthis.#alive();\n\t\t\tthis.#stage();\n\t\t} catch (error) {\n\t\t\tawait this.rollback();\n\t\t\tthrow reloadError(error);\n\t\t}\n\t}\n\n\t/** What a successful prepare will commit (a child sends it with its vote). */\n\tsummary(): ReloadReport {\n\t\tconst live = [...this.candidates.values()].filter(({ record }) => record.status === \"live\");\n\t\treturn {\n\t\t\tepoch: this.host.pending?.id ?? this.host.current.id,\n\t\t\tprevious: this.host.current.id,\n\t\t\tchanged: [...this.changed],\n\t\t\tremoved: [...this.removed],\n\t\t\tprepared: live.map(({ record }) => record.address),\n\t\t\tgated: this.gated.map(({ record }) => record.address),\n\t\t};\n\t}\n\n\t/** After every await of prepare: a rollback meanwhile (abort from the coordinator) ends it. */\n\t#alive(): void {\n\t\tif (this.rolledBack) throw new ChordError(\"aborted\", \"reload aborted while preparing\", { reason: \"aborted\" });\n\t}\n\n\t/**\n\t * Subscribes every new listener now, buffering its events, so a failing source fails prepare instead of leaving a\n\t * half-installed epoch. Records running only the new code (types this reload adds) are staged too.\n\t */\n\t#stage(): void {\n\t\tfor (const candidate of this.candidates.values()) {\n\t\t\tif (candidate.record.status === \"live\")\n\t\t\t\tcandidate.staged = candidate.record.stageListeners(candidate.run.decls);\n\t\t}\n\t\tfor (const record of this.host.records.values()) {\n\t\t\tif (record.status === \"live\" && record.deferredRuntime)\n\t\t\t\tthis.deferred.set(record, record.stageListeners(record.decls));\n\t\t}\n\t}\n\n\tasync waitForRetirement(): Promise<void> {\n\t\tconst host = this.host;\n\t\tif (host.previous === undefined) return;\n\t\tif (host.previous.roots.size > 0) {\n\t\t\tlet timer: ReturnType<typeof setTimeout> | undefined;\n\t\t\tawait new Promise<void>((resolve) => {\n\t\t\t\thost.retired = resolve;\n\t\t\t\ttimer = setTimeout(resolve, this.options.retireDeadline ?? 5000);\n\t\t\t});\n\t\t\tclearTimeout(timer);\n\t\t\thost.retired = noop;\n\t\t}\n\t\t// Roots of the dropped epoch still running get `superseded` on their next call.\n\t\thost.retire();\n\t}\n\n\t/** Builds the candidate service table: unchanged services plus everything the given facets serve. */\n\tload(): void {\n\t\tconst replaced = new Set([...this.facets.map((facet) => facet.name), ...(this.options.remove ?? [])]);\n\t\tconst current = this.host.current.services;\n\t\tthis.services = new Map([...current].filter(([, service]) => !replaced.has(service.facet)));\n\t\tfor (const facet of this.facets) {\n\t\t\tfacet.setup(\n\t\t\t\tthis.host.facetApi(((type: AnyContract, factory: Factory<AnyContract>, options: ServeOptions = {}) =>\n\t\t\t\t\tthis.host.serveInto(this.services, makeService(type, factory, options, facet.name))) as Serve),\n\t\t\t);\n\t\t}\n\t\tfor (const [name, service] of this.services) if (current.get(name) !== service) this.changed.add(name);\n\t\tfor (const name of current.keys()) if (!this.services.has(name)) this.removed.add(name);\n\t\tthis.host.pending = {\n\t\t\tid: this.host.nextEpochId(this.epoch),\n\t\t\tservices: this.services,\n\t\t\ttables: new Map(),\n\t\t\troots: new Map(),\n\t\t};\n\t}\n\n\tasync withDeadline<T>(promise: Promise<T>, what: string): Promise<T> {\n\t\tconst deadline = this.options.gateDeadline ?? 5000;\n\t\tlet timer: ReturnType<typeof setTimeout> | undefined;\n\t\tconst timeout = new Promise<never>((_, reject) => {\n\t\t\ttimer = setTimeout(\n\t\t\t\t() => reject(new ChordError(\"aborted\", `${what} within ${deadline} ms`, { reason: \"deadline\" })),\n\t\t\t\tdeadline,\n\t\t\t);\n\t\t});\n\t\ttry {\n\t\t\treturn await Promise.race([promise, timeout]);\n\t\t} finally {\n\t\t\tclearTimeout(timer);\n\t\t}\n\t}\n\n\t/** Same contract version must cover the old description (forgotten bump); facets' `uses` must bind. */\n\tcheckProviders(): void {\n\t\tfor (const name of this.changed) {\n\t\t\tconst next = this.services.get(name)!.contract;\n\t\t\tconst old = this.host.current.services.get(name)?.contract;\n\t\t\tif (old === undefined || old.version !== next.version) continue;\n\t\t\tconst reason = coverage(next.description, old.description);\n\t\t\tif (reason !== undefined) {\n\t\t\t\tthrow new ChordError(\n\t\t\t\t\t\"contract_mismatch\",\n\t\t\t\t\t`${name}@${next.version} changed incompatibly without a version bump (${reason})`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tconst facets = new Map(this.host.facets);\n\t\tfor (const facet of this.facets) facets.set(facet.name, facet);\n\t\tfor (const name of this.options.remove ?? []) facets.delete(name);\n\t\tfor (const facet of facets.values()) {\n\t\t\tfor (const token of facet.uses ?? []) {\n\t\t\t\tconst service = this.services.get(token.name);\n\t\t\t\tif (service !== undefined && this.changed.has(token.name))\n\t\t\t\t\tbind(service.contract, service.options.accepts, token);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Prepares every live record of a changed type, including records that activate meanwhile, to a fixpoint. Records\n\t * already running the new code (types this reload adds) are skipped.\n\t */\n\tasync prepareAll(): Promise<void> {\n\t\tfor (;;) {\n\t\t\tconst todo = [...this.host.records.values()].filter(\n\t\t\t\t(record) =>\n\t\t\t\t\tthis.changed.has(record.typeName) &&\n\t\t\t\t\t!this.candidates.has(record) &&\n\t\t\t\t\trecord.service !== this.services.get(record.typeName) &&\n\t\t\t\t\t(record.status === \"live\" || record.status === \"activating\"),\n\t\t\t);\n\t\t\tif (todo.length === 0) return;\n\t\t\tawait Promise.allSettled(todo.map((record) => record.ready));\n\t\t\tthis.#alive();\n\t\t\tfor (const record of todo) {\n\t\t\t\tif (record.status === \"live\" && record.service !== this.services.get(record.typeName)) {\n\t\t\t\t\tawait this.prepareRecord(record);\n\t\t\t\t\tthis.#alive();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/** Runs the new factory in recording mode and opens what can be opened without the gate. */\n\tasync prepareRecord(record: RecordImpl): Promise<void> {\n\t\tconst service = this.services.get(record.typeName)!;\n\t\tconst run = record.run(service, record.decls);\n\t\tconst candidate: Candidate = {\n\t\t\trecord,\n\t\t\tservice,\n\t\t\trun,\n\t\t\treasons: [],\n\t\t\tatGate: [],\n\t\t\treplaced: [],\n\t\t\tmigrated: new Map(),\n\t\t\tderived: new Map(),\n\t\t\tstaged: undefined,\n\t\t};\n\t\tthis.candidates.set(record, candidate);\n\t\tconst bumped = service.stateVersion !== record.stateVersion;\n\t\tif (bumped) candidate.reasons.push(`state version ${record.stateVersion} -> ${service.stateVersion}`);\n\t\tfor (const [name, cell] of run.decls.cells) {\n\t\t\tif (record.decls.cells.get(name) !== cell || deepEqual(cell.schema, run.decls.cellSchemas.get(name))) continue;\n\t\t\tif (!bumped) {\n\t\t\t\tthrow invalid(\"state\", `${record.address}: schema of state ${name} changed without a state-version bump`);\n\t\t\t}\n\t\t}\n\t\tfor (const name of Object.keys(service.options.state?.migrate ?? {})) {\n\t\t\tif (!run.decls.cells.has(name))\n\t\t\t\tthrow invalid(\"state\", `${record.address}: migrate for undeclared state ${name}`);\n\t\t}\n\t\tconst deferred = new Set<ResourceImpl>();\n\t\tfor (const resource of run.created.resources) {\n\t\t\tif (resource.exclusive || resource.deps.some((dep) => deferred.has(dep as ResourceImpl)))\n\t\t\t\tdeferred.add(resource);\n\t\t}\n\t\tfor (const resource of deferred) {\n\t\t\tcandidate.atGate.push(resource);\n\t\t\tconst old = record.decls.resources.get(resource.key);\n\t\t\tif (resource.exclusive && old?.exclusive && old.state === \"open\") candidate.replaced.push(old);\n\t\t}\n\t\tif (deferred.size > 0) candidate.reasons.push(\"exclusive resource replaced\");\n\t\tif (candidate.reasons.length === 0) dryRun(candidate);\n\t\tawait record.open(\n\t\t\trun.created.resources.filter((resource) => !deferred.has(resource)),\n\t\t\trun.created.holds,\n\t\t\tthis.abort.signal,\n\t\t);\n\t}\n\n\t/**\n\t * Every hold that survives into the new epoch must bind to the new provider. Browser holds don't block a reload:\n\t * after the commit they get `upgrade_required` instead.\n\t */\n\tcheckHolds(): void {\n\t\tconst dropped = new Set<unknown>();\n\t\tfor (const { record, run } of this.candidates.values()) {\n\t\t\tfor (const hold of record.decls.holds.values())\n\t\t\t\tif (![...run.decls.holds.values()].includes(hold)) dropped.add(hold);\n\t\t}\n\t\tfor (const record of this.host.records.values()) {\n\t\t\tconst service = this.services.get(record.typeName);\n\t\t\tif (service === undefined || !this.changed.has(record.typeName)) continue;\n\t\t\tfor (const hold of record.holds) {\n\t\t\t\t// The host's bootstrap hold follows this provider at commit; it is not an old-code consumer.\n\t\t\t\tif (hold === this.host.eager.get(record.typeName)) continue;\n\t\t\t\tif (!dropped.has(hold) && hold.owner !== \"client\")\n\t\t\t\t\tbind(service.contract, service.options.accepts, hold.contract);\n\t\t\t}\n\t\t}\n\t}\n\n\tentries(): [RecordImpl, Run[\"decls\"]][] {\n\t\treturn this.host\n\t\t\t.liveDecls(true)\n\t\t\t.filter(([record]) => !this.removed.has(record.typeName))\n\t\t\t.map(([record, decls]) => [record, this.candidates.get(record)?.run.decls ?? decls]);\n\t}\n\n\t/**\n\t * Admission cut, wait for grandfathered roots (deadline), replace exclusive resources, migrate into private\n\t * copies. Old tasks of gated records are stopped at the cut; listener events are queued until commit or abort.\n\t */\n\tasync gate(): Promise<void> {\n\t\tthis.gated = [...this.candidates.values()].filter(\n\t\t\t(candidate) => candidate.reasons.length > 0 && candidate.record.status === \"live\",\n\t\t);\n\t\tconst drained = this.gated.map(({ record }) => {\n\t\t\tconst grandfathered = new Set(record.leases.keys());\n\t\t\treturn new Promise<void>((resolve) => {\n\t\t\t\trecord.gate = { grandfathered, queue: [], drained: resolve };\n\t\t\t\trecord.stopTasks();\n\t\t\t\tif (grandfathered.size === 0) resolve();\n\t\t\t});\n\t\t});\n\t\tconst deadline = this.options.gateDeadline ?? 5000;\n\t\tlet timer: ReturnType<typeof setTimeout> | undefined;\n\t\tconst timedOut = await Promise.race([\n\t\t\tPromise.all(drained).then(() => false),\n\t\t\tnew Promise<boolean>((resolve) => {\n\t\t\t\ttimer = setTimeout(() => resolve(true), deadline);\n\t\t\t}),\n\t\t]);\n\t\tclearTimeout(timer);\n\t\tif (timedOut) {\n\t\t\tconst blocking = this.gated.flatMap(({ record }) => [...(record.gate?.grandfathered ?? [])]);\n\t\t\tthrow new ChordError(\n\t\t\t\t\"aborted\",\n\t\t\t\t`gate deadline (${deadline} ms) missed; blocking roots: ${blocking.join(\", \")}`,\n\t\t\t\t{\n\t\t\t\t\treason: \"gate_deadline\",\n\t\t\t\t\tdetails: { blocking },\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\t\tthis.#alive();\n\t\tfor (const candidate of this.gated) {\n\t\t\tconst { record } = candidate;\n\t\t\tfor (const old of candidate.replaced) {\n\t\t\t\t// Owned by the rollback before closing: a failing close must still be restored.\n\t\t\t\tthis.closed.push([record, old]);\n\t\t\t\tawait old.close(record.openOrder);\n\t\t\t}\n\t\t\tawait record.open(candidate.atGate, [], this.abort.signal);\n\t\t\tthis.#alive();\n\t\t}\n\t\tfor (const candidate of this.gated) this.migrate(candidate);\n\t}\n\n\tmigrate(candidate: Candidate): void {\n\t\tconst { record, service, run } = candidate;\n\t\tconst migrate = service.options.state?.migrate ?? {};\n\t\tconst bumped = service.stateVersion !== record.stateVersion;\n\t\tfor (const [name, cell] of run.decls.cells) {\n\t\t\tif (record.decls.cells.get(name) !== cell) continue;\n\t\t\tconst schema = run.decls.cellSchemas.get(name)!;\n\t\t\tconst fn = migrate[name];\n\t\t\tlet value: unknown;\n\t\t\tif (bumped && fn !== undefined) value = fn(structuredClone(cell.value), record.stateVersion);\n\t\t\telse if (!deepEqual(cell.schema, schema)) value = cell.value;\n\t\t\telse continue;\n\t\t\tassertValid(\"state\", `${record.address}: migrated state ${name}`, schema, value);\n\t\t\tcandidate.migrated.set(cell, value);\n\t\t}\n\t\tdryRun(candidate);\n\t}\n\n\tasync rollback(): Promise<void> {\n\t\tif (this.rolledBack) return;\n\t\tthis.rolledBack = true;\n\t\tthis.abort.abort(new ChordError(\"aborted\", \"reload aborted\"));\n\t\tconst report = (error: unknown): void => this.host.report(error);\n\t\tfor (const candidate of this.candidates.values()) candidate.staged?.discard();\n\t\tfor (const staged of this.deferred.values()) staged.discard();\n\t\tfor (const { record, run } of this.candidates.values()) {\n\t\t\trecord.pending.delete(run.decls);\n\t\t\tawait record.unwind(run).catch(report);\n\t\t}\n\t\t// Replaced exclusive resources are restored; one that cannot be is marked unavailable, never silently closed.\n\t\tfor (const [record, resource] of this.closed) {\n\t\t\tif (resource.state !== \"closed\") continue;\n\t\t\tawait resource.open(new AbortController().signal, record.openOrder).catch((error: unknown) => {\n\t\t\t\tresource.markUnavailable();\n\t\t\t\treport(\n\t\t\t\t\tnew ChordError(\"unavailable\", `${record.address}: resource ${resource.key} could not be restored`, {\n\t\t\t\t\t\tcause: error,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t});\n\t\t}\n\t\tfor (const { record } of this.gated) {\n\t\t\tif (record.gate === undefined) continue;\n\t\t\trecord.openGate();\n\t\t\tfor (const name of record.decls.tasks.keys()) record.startTask(name, this.host.current.id);\n\t\t}\n\t\t// Records of types this reload would have added lose their code.\n\t\tconst reason = new ChordError(\"gone\", \"reload aborted; type not served\");\n\t\tfor (const record of [...this.host.records.values()]) {\n\t\t\tif (!this.host.current.services.has(record.typeName)) await record.dispose(true, reason).catch(report);\n\t\t}\n\t\tthis.host.pending = undefined;\n\t\tthis.host.gating = undefined;\n\t}\n\n\t/**\n\t * Publishes the new epoch in one synchronous step. Everything fallible ran in prepare (factories, opens, migration\n\t * and derivation checks against the prospective schemas, listener subscriptions), so this only installs. Observers\n\t * (state, shapes, registries, listener roots) are notified after the whole step. If an install still throws, the\n\t * epoch is half-published: the host fails terminally and admits no more work.\n\t */\n\tcommit(beforeStart?: () => void): ReloadReport {\n\t\ttry {\n\t\t\treturn holdPublications(() => {\n\t\t\t\tconst report = this.#publish();\n\t\t\t\t// Installed, not yet started: the coordinator queues its commit frames here, so nothing this epoch starts\n\t\t\t\t// (tasks, eager activations, then the held listener/registry/state notifications) can reach a child first.\n\t\t\t\tbeforeStart?.();\n\t\t\t\tfor (const start of this.#starts.splice(0)) start();\n\t\t\t\treturn report;\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tthis.host.fail(error);\n\t\t\tthrow reloadError(error);\n\t\t}\n\t}\n\n\t/** Work that may start new-epoch roots, run after installation (and after the coordinator's commit frames). */\n\treadonly #starts: (() => void)[] = [];\n\n\t#publish(): ReloadReport {\n\t\tconst host = this.host;\n\t\tconst previous = host.current;\n\t\tconst next: EpochState = host.pending!;\n\t\thost.pending = undefined;\n\t\thost.epochs.set(next.id, next);\n\t\thost.previous = previous;\n\t\thost.current = next;\n\t\tconst prepared: string[] = [];\n\t\tfor (const record of [...host.records.values()]) {\n\t\t\tif (this.removed.has(record.typeName)) continue;\n\t\t\tconst candidate = this.candidates.get(record);\n\t\t\tif (candidate === undefined) {\n\t\t\t\tconst installed = record.behaviors.get(previous.id);\n\t\t\t\tif (installed !== undefined) record.behaviors.set(next.id, { ...installed, epoch: next.id });\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (record.status !== \"live\") continue;\n\t\t\tthis.install(candidate, next.id);\n\t\t\tprepared.push(record.address);\n\t\t}\n\t\tfor (const { record, run, staged } of this.candidates.values()) {\n\t\t\tif (record.status === \"live\") continue;\n\t\t\tstaged?.discard();\n\t\t\trecord.pending.delete(run.decls);\n\t\t\trecord.unwind(run).catch((error: unknown) => host.report(error));\n\t\t}\n\t\t// Records of types this reload adds start their runtime now.\n\t\tfor (const [record, staged] of this.deferred) {\n\t\t\tif (record.status !== \"live\") {\n\t\t\t\tstaged.discard();\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\trecord.deferredRuntime = false;\n\t\t\tstaged.activate();\n\t\t\tthis.#starts.push(() => record.startTasks());\n\t\t}\n\t\thost.installTables(next, this.tables, true);\n\t\tconst reason = new ChordError(\"gone\", \"type no longer served\");\n\t\tfor (const record of [...host.records.values()]) {\n\t\t\tif (this.removed.has(record.typeName))\n\t\t\t\trecord.dispose(true, reason).catch((error: unknown) => host.report(error));\n\t\t}\n\t\tfor (const name of this.removed) host.eager.delete(name);\n\t\tfor (const facet of this.facets) host.facets.set(facet.name, facet);\n\t\tfor (const name of this.options.remove ?? []) host.facets.delete(name);\n\t\thost.gating = undefined;\n\t\tfor (const [name, service] of this.services) {\n\t\t\tif (service.options.eager && this.changed.has(name) && host.eager.get(name)?.record?.status !== \"live\") {\n\t\t\t\tthis.#starts.push(() => host.startEager(service));\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\tepoch: next.id,\n\t\t\tprevious: previous.id,\n\t\t\tchanged: [...this.changed],\n\t\t\tremoved: [...this.removed],\n\t\t\tprepared,\n\t\t\tgated: this.gated.map(({ record }) => record.address),\n\t\t};\n\t}\n\n\tinstall(candidate: Candidate, epoch: number): void {\n\t\tconst { record, run, service } = candidate;\n\t\tconst gated = candidate.reasons.length > 0;\n\t\trecord.pending.delete(run.decls);\n\t\trecord.stopTasks();\n\t\tif (gated) {\n\t\t\t// Old derivations would compute over migrated values; the old behavior can no longer run anyway.\n\t\t\tconst kept = new Set(run.decls.derives.values());\n\t\t\tfor (const derived of record.decls.derives.values()) if (!kept.has(derived)) derived.detach();\n\t\t}\n\t\trecord.decls = run.decls;\n\t\trecord.service = service;\n\t\trecord.stateVersion = service.stateVersion;\n\t\trecord.behaviors.set(epoch, { epoch, service, behavior: run.behavior, decls: run.decls });\n\t\tif (gated) {\n\t\t\t// Old code can never run over migrated state: drop the previous behavior now, not at retirement.\n\t\t\trecord.minEpoch = epoch;\n\t\t\tfor (const old of [...record.behaviors.keys()]) if (old !== epoch) this.host.retireBehavior(record, old);\n\t\t}\n\t\t// Schemas first, then the values validated against them in prepare.\n\t\trecord.refreshSchemas();\n\t\tfor (const [name, derived] of run.decls.derives) derived.setFn(run.decls.deriveFns.get(name)!);\n\t\tfor (const [name, cell] of run.decls.cells) {\n\t\t\tconst schema = run.decls.cellSchemas.get(name)!;\n\t\t\tif (candidate.migrated.has(cell)) cell.reset(candidate.migrated.get(cell), schema);\n\t\t\telse cell.schema = schema;\n\t\t}\n\t\tconst created = new Set(run.created.derives);\n\t\tfor (const derived of run.created.derives) derived.attach(candidate.derived);\n\t\tfor (const derived of run.decls.derives.values()) if (!created.has(derived)) derived.refresh();\n\t\tcandidate.staged?.activate();\n\t\tthis.#starts.push(() => record.startTasks());\n\t\trecord.openGate();\n\t\tconst eager = this.host.eager.get(record.typeName);\n\t\tif (eager?.record === record && eager.contract.fingerprint !== service.contract.fingerprint) {\n\t\t\tconst replacement = new HandleImpl(record, service.contract, \"host\");\n\t\t\t// Acquire first: releasing the only hold must not dispose/reopen the surviving eager record.\n\t\t\trecord.addHold(replacement);\n\t\t\tthis.host.eager.set(record.typeName, replacement);\n\t\t\teager.release();\n\t\t}\n\t\tfor (const handle of [...record.holds]) {\n\t\t\t// Browser holds whose contract no longer binds are told to reload their code (they never block a reload).\n\t\t\tif (handle.owner === \"client\") {\n\t\t\t\ttry {\n\t\t\t\t\tbind(service.contract, service.options.accepts, handle.contract);\n\t\t\t\t} catch (error) {\n\t\t\t\t\thandle.gone(\n\t\t\t\t\t\tnew ChordError(\"upgrade_required\", `${record.typeName} changed; reload the web facets`, {\n\t\t\t\t\t\t\tcause: error,\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t\trecord.release(handle);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\thandle.shapeChanged();\n\t\t}\n\t}\n}\n"]}
@@ -0,0 +1,70 @@
1
+ import type { AnyContract } from "./contract.ts";
2
+ import { type WireOp } from "./delta/index.ts";
3
+ import { type Hold, type HoldOwner, type StatusListener } from "./record.ts";
4
+ import type { Ctx, HandleStatus, Principal, Shape } from "./types.ts";
5
+ import { type RootRef, type WireError } from "./wire.ts";
6
+ export interface StateSink {
7
+ snap?: unknown;
8
+ reset?: unknown;
9
+ ops?: readonly WireOp[];
10
+ error?: WireError;
11
+ }
12
+ /** What a remote handle needs from the link it is bound to (implemented by Connection). */
13
+ export interface RemoteChannel {
14
+ hold(handle: RemoteHandle): number;
15
+ release(id: number): void;
16
+ call(hold: number, member: string, args: unknown, root: RootRef | undefined, signal: AbortSignal): Promise<unknown>;
17
+ sub(hold: number, member: string, sink: (frame: StateSink) => void): number;
18
+ unsub(id: number): void;
19
+ }
20
+ /** What a remote handle needs from its host. */
21
+ export interface RemoteHost {
22
+ readonly inFactory: number;
23
+ report(error: unknown): void;
24
+ root<T>(fn: (ctx: Ctx) => T | Promise<T>, options?: {
25
+ signal?: AbortSignal;
26
+ }): Promise<T>;
27
+ forgetRemote(handle: RemoteHandle): void;
28
+ }
29
+ /** A hold on an object on another host, bound to a link. Late-bound like a local handle. */
30
+ export declare class RemoteHandle implements Hold {
31
+ #private;
32
+ readonly record: undefined;
33
+ readonly host: RemoteHost;
34
+ readonly contract: AnyContract;
35
+ readonly at: string;
36
+ readonly input: unknown;
37
+ /** Forwarded principal (omitted for the host's own principal). */
38
+ readonly principal: Principal | undefined;
39
+ readonly owner: HoldOwner;
40
+ readonly address: string;
41
+ readonly proxy: object;
42
+ readonly ready: Promise<void>;
43
+ status: HandleStatus;
44
+ error: unknown;
45
+ shape: Shape | undefined;
46
+ binding: {
47
+ readonly channel: RemoteChannel;
48
+ readonly id: number;
49
+ } | undefined;
50
+ readonly shapeListeners: Set<(shape: Shape) => void>;
51
+ constructor(host: RemoteHost, fields: {
52
+ contract: AnyContract;
53
+ at: string;
54
+ input: unknown;
55
+ principal: Principal | undefined;
56
+ owner: HoldOwner;
57
+ address: string;
58
+ });
59
+ get kind(): string | undefined;
60
+ onShape(listener: (shape: Shape) => void): () => void;
61
+ onStatus(listener: StatusListener): () => void;
62
+ release(): void;
63
+ bound(channel: RemoteChannel, id: number): void;
64
+ shaped(shape: Shape): void;
65
+ gone(error: unknown): void;
66
+ /** The link went down but may come back (upstream reconnect): wait, then re-hold. */
67
+ detached(): void;
68
+ member(name: string): unknown;
69
+ }
70
+ //# sourceMappingURL=remote.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../src/remote.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAyC,KAAK,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAEtF,OAAO,EAGN,KAAK,IAAI,EACT,KAAK,SAAS,EAId,KAAK,cAAc,EACnB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,GAAG,EAAE,YAAY,EAAE,SAAS,EAAY,KAAK,EAAc,MAAM,YAAY,CAAC;AAC5F,OAAO,EAAiB,KAAK,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAIxE,MAAM,WAAW,SAAS;IACzB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,GAAG,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,KAAK,CAAC,EAAE,SAAS,CAAC;CAClB;AAED,2FAA2F;AAC3F,MAAM,WAAW,aAAa;IAC7B,IAAI,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAAC;IACnC,OAA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 import { applyImmutable, decoder } from "./delta/index.js";
3
+ import { ChordError } from "./errors.js";
4
+ import { CtxImpl, HANDLE_BASE, holdsByProxy, notifyStatus, raceSignal, } from "./record.js";
5
+ import { fromWireError } from "./wire.js";
6
+ const noop = () => { };
7
+ /**
8
+ * A state member of a remote handle: hydrated while subscribed (snapshot, then decoded ops); `undefined` before.
9
+ * Re-subscribing after a reconnect delivers the new snapshot as a reset.
10
+ */
11
+ class RemoteReadable {
12
+ #handle;
13
+ #name;
14
+ #values = new Set();
15
+ #events = new Set();
16
+ #sub;
17
+ #decoder = decoder();
18
+ #value;
19
+ constructor(handle, name) {
20
+ this.#handle = handle;
21
+ this.#name = name;
22
+ }
23
+ get value() {
24
+ return this.#value;
25
+ }
26
+ subscribe(listener) {
27
+ this.#values.add(listener);
28
+ this.#safe(() => listener(this.#value));
29
+ this.bind();
30
+ return () => this.#remove(this.#values, listener);
31
+ }
32
+ events(listener) {
33
+ this.#events.add(listener);
34
+ this.#safe(() => listener({ type: "snap", value: this.#value }));
35
+ this.bind();
36
+ return () => this.#remove(this.#events, listener);
37
+ }
38
+ /** Subscribes upstream while someone listens and the handle is bound; drops a subscription on an old link. */
39
+ bind() {
40
+ const listening = this.#values.size + this.#events.size > 0;
41
+ // Nobody listens: the value would go stale, so forget it. The next subscriber sees `undefined`, then the snapshot.
42
+ if (!listening)
43
+ this.#value = undefined;
44
+ const binding = listening ? this.#handle.binding : undefined;
45
+ if (binding !== undefined && this.#sub?.channel === binding.channel)
46
+ return;
47
+ if (this.#sub !== undefined) {
48
+ if (this.#sub.channel !== binding?.channel || binding === undefined)
49
+ this.#sub.channel.unsub(this.#sub.id);
50
+ this.#sub = undefined;
51
+ }
52
+ if (binding === undefined)
53
+ return;
54
+ const channel = binding.channel;
55
+ this.#decoder = decoder();
56
+ const id = channel.sub(binding.id, this.#name, (frame) => this.#receive(frame));
57
+ this.#sub = { channel, id };
58
+ }
59
+ /** The link is gone: keep the last value, resubscribe on the next binding. */
60
+ detach() {
61
+ this.#sub = undefined;
62
+ }
63
+ stop() {
64
+ this.#values.clear();
65
+ this.#events.clear();
66
+ this.bind();
67
+ }
68
+ #receive(frame) {
69
+ if (frame.error !== undefined) {
70
+ this.#handle.host.report(fromWireError(frame.error));
71
+ return;
72
+ }
73
+ let event;
74
+ if (frame.ops === undefined && !("snap" in frame) && !("reset" in frame))
75
+ return;
76
+ if (frame.ops !== undefined) {
77
+ const ops = this.#decoder.decode(frame.ops);
78
+ this.#value = applyImmutable(this.#value, ops);
79
+ event = { type: "ops", ops, value: this.#value };
80
+ }
81
+ else {
82
+ // Listeners already saw a snapshot (`undefined` or an older value), so every upstream snapshot is a reset.
83
+ this.#decoder = decoder();
84
+ this.#value = "snap" in frame ? frame.snap : frame.reset;
85
+ event = { type: "reset", value: this.#value };
86
+ }
87
+ for (const listener of [...this.#events])
88
+ this.#safe(() => listener(event));
89
+ for (const listener of [...this.#values])
90
+ this.#safe(() => listener(this.#value));
91
+ }
92
+ #remove(set, listener) {
93
+ set.delete(listener);
94
+ this.bind();
95
+ }
96
+ #safe(fn) {
97
+ try {
98
+ fn();
99
+ }
100
+ catch (error) {
101
+ this.#handle.host.report(error);
102
+ }
103
+ }
104
+ }
105
+ /** A hold on an object on another host, bound to a link. Late-bound like a local handle. */
106
+ export class RemoteHandle {
107
+ record = undefined;
108
+ host;
109
+ contract;
110
+ at;
111
+ input;
112
+ /** Forwarded principal (omitted for the host's own principal). */
113
+ principal;
114
+ owner;
115
+ address;
116
+ proxy;
117
+ ready;
118
+ status = "loading";
119
+ error;
120
+ shape;
121
+ binding;
122
+ shapeListeners = new Set();
123
+ #readables = new Map();
124
+ #callers = new Map();
125
+ #settleReady;
126
+ #live;
127
+ constructor(host, fields) {
128
+ this.host = host;
129
+ this.contract = fields.contract;
130
+ this.at = fields.at;
131
+ this.input = fields.input;
132
+ this.principal = fields.principal;
133
+ this.owner = fields.owner;
134
+ this.address = fields.address;
135
+ this.ready = new Promise((resolve, reject) => {
136
+ this.#settleReady = { resolve, reject };
137
+ });
138
+ this.ready.catch(noop);
139
+ this.#live = this.#newLive();
140
+ this.proxy = new Proxy(this, {
141
+ get: (target, property) => {
142
+ if (HANDLE_BASE.has(property)) {
143
+ const value = Reflect.get(target, property, target);
144
+ return typeof value === "function" ? value.bind(target) : value;
145
+ }
146
+ if (typeof property !== "string" || property === "then")
147
+ return undefined;
148
+ return target.member(property);
149
+ },
150
+ });
151
+ holdsByProxy.set(this.proxy, this);
152
+ }
153
+ get kind() {
154
+ return this.shape?.kind;
155
+ }
156
+ onShape(listener) {
157
+ this.shapeListeners.add(listener);
158
+ return () => this.shapeListeners.delete(listener);
159
+ }
160
+ onStatus(listener) {
161
+ this.#statusListeners.add(listener);
162
+ return () => this.#statusListeners.delete(listener);
163
+ }
164
+ #statusListeners = new Set();
165
+ #statusChanged() {
166
+ notifyStatus(this.#statusListeners, this.status, this.error, (error) => this.host.report(error));
167
+ }
168
+ release() {
169
+ if (this.status === "released" || this.status === "gone")
170
+ return;
171
+ this.status = "released";
172
+ this.#statusChanged();
173
+ const error = new ChordError("released", `handle ${this.address} released`);
174
+ this.#settleReady?.reject(error);
175
+ this.#live.reject(error);
176
+ for (const readable of this.#readables.values())
177
+ readable.stop();
178
+ if (this.binding !== undefined)
179
+ this.binding.channel.release(this.binding.id);
180
+ this.binding = undefined;
181
+ this.host.forgetRemote(this);
182
+ }
183
+ // ─── driven by the link ───
184
+ bound(channel, id) {
185
+ this.binding = { channel, id };
186
+ }
187
+ shaped(shape) {
188
+ if (this.status === "released" || this.status === "gone")
189
+ return;
190
+ this.shape = shape;
191
+ const wasLoading = this.status === "loading";
192
+ this.status = "live";
193
+ if (wasLoading)
194
+ this.#statusChanged();
195
+ if (wasLoading) {
196
+ this.#settleReady?.resolve();
197
+ this.#settleReady = undefined;
198
+ this.#live.resolve();
199
+ }
200
+ for (const readable of this.#readables.values())
201
+ readable.bind();
202
+ for (const listener of [...this.shapeListeners]) {
203
+ try {
204
+ listener(shape);
205
+ }
206
+ catch (error) {
207
+ this.host.report(error);
208
+ }
209
+ }
210
+ }
211
+ gone(error) {
212
+ if (this.status === "released" || this.status === "gone")
213
+ return;
214
+ this.status = "gone";
215
+ this.error = error;
216
+ this.#statusChanged();
217
+ this.binding = undefined;
218
+ this.#settleReady?.reject(error);
219
+ this.#live.reject(error);
220
+ for (const readable of this.#readables.values())
221
+ readable.stop();
222
+ this.host.forgetRemote(this);
223
+ }
224
+ /** The link went down but may come back (upstream reconnect): wait, then re-hold. */
225
+ detached() {
226
+ if (this.status === "released" || this.status === "gone")
227
+ return;
228
+ this.binding = undefined;
229
+ for (const readable of this.#readables.values())
230
+ readable.detach();
231
+ if (this.status === "live") {
232
+ this.status = "loading";
233
+ this.#live = this.#newLive();
234
+ this.#statusChanged();
235
+ }
236
+ }
237
+ // ─── members ───
238
+ member(name) {
239
+ const description = Object.values(this.contract.description.variants)
240
+ .map((members) => members[name])
241
+ .find((member) => member !== undefined);
242
+ if (description?.kind === "method")
243
+ return this.#caller(name);
244
+ if (description?.kind === "state") {
245
+ let readable = this.#readables.get(name);
246
+ if (readable === undefined) {
247
+ readable = new RemoteReadable(this, name);
248
+ this.#readables.set(name, readable);
249
+ }
250
+ return readable;
251
+ }
252
+ return undefined;
253
+ }
254
+ #caller(name) {
255
+ let caller = this.#callers.get(name);
256
+ if (caller === undefined) {
257
+ caller = (args, ctx) => {
258
+ if (this.host.inFactory > 0)
259
+ throw new ChordError("not_ready", `${this.address}.${name} called inside a factory`);
260
+ if (ctx instanceof CtxImpl) {
261
+ try {
262
+ ctx.check(ctx.host);
263
+ }
264
+ catch (error) {
265
+ return Promise.reject(error);
266
+ }
267
+ }
268
+ if (ctx === undefined || (ctx instanceof CtxImpl && ctx.holder)) {
269
+ return this.host.root((root) => this.#call(name, args, root), { signal: ctx?.signal });
270
+ }
271
+ return this.#call(name, args, ctx);
272
+ };
273
+ this.#callers.set(name, caller);
274
+ }
275
+ return caller;
276
+ }
277
+ async #call(name, args, ctx) {
278
+ for (;;) {
279
+ if (this.status === "released" || this.status === "gone") {
280
+ throw this.status === "gone" ? this.error : new ChordError("released", `handle ${this.address} released`);
281
+ }
282
+ if (this.status === "loading")
283
+ await raceSignal(this.#live.promise, ctx.signal);
284
+ const binding = this.binding;
285
+ if (binding === undefined)
286
+ continue;
287
+ const kind = this.shape?.kind;
288
+ if (kind === undefined || this.contract.description.variants[kind]?.[name]?.kind !== "method") {
289
+ throw new ChordError("not_in_variant", `${this.address}: ${name} is not a method of variant ${kind}`);
290
+ }
291
+ // Send only what the consumer's own schema knows (the additive rule's premise; see RecordImpl.call).
292
+ const description = this.contract.description.variants[kind]?.[name];
293
+ const sent = description?.kind === "method" ? Value.Clean(description.args, Value.Clone(args)) : args;
294
+ return binding.channel.call(binding.id, name, sent, { rootId: ctx.rootId, epoch: ctx.epoch }, ctx.signal);
295
+ }
296
+ }
297
+ #newLive() {
298
+ let resolve = noop;
299
+ let reject = noop;
300
+ const promise = new Promise((done, fail) => {
301
+ resolve = done;
302
+ reject = fail;
303
+ });
304
+ promise.catch(noop);
305
+ return { promise, resolve, reject };
306
+ }
307
+ }
308
+ //# sourceMappingURL=remote.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote.js","sourceRoot":"","sources":["../src/remote.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,OAAO,EAAE,cAAc,EAAgB,OAAO,EAAe,MAAM,kBAAkB,CAAC;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACN,OAAO,EACP,WAAW,EAGX,YAAY,EACZ,YAAY,EACZ,UAAU,GAEV,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,aAAa,EAAgC,MAAM,WAAW,CAAC;AAExE,MAAM,IAAI,GAAG,GAAS,EAAE,GAAE,CAAC,CAAC;AA0B5B;;;GAGG;AACH,MAAM,cAAc;IACV,OAAO,CAAe;IACtB,KAAK,CAAS;IACd,OAAO,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CAAC,CAAC;YACvG,CAAC;YACD,qGAAqG;YACrG,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;YACrE,MAAM,IAAI,GAAG,WAAW,EAAE,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;YACtG,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;QAC3G,CAAC;IACF,CAAC;IAED,QAAQ;QACP,IAAI,OAAO,GAAG,IAAI,CAAC;QACnB,IAAI,MAAM,GAA6B,IAAI,CAAC;QAC5C,MAAM,OAAO,GAAG,IAAI,OAAO,CAAO,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;YAChD,OAAO,GAAG,IAAI,CAAC;YACf,MAAM,GAAG,IAAI,CAAC;QACf,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACpB,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IACrC,CAAC;CACD","sourcesContent":["import { Value } from \"typebox/value\";\nimport type { AnyContract } from \"./contract.ts\";\nimport { applyImmutable, type Decoder, decoder, type WireOp } from \"./delta/index.ts\";\nimport { ChordError } from \"./errors.ts\";\nimport {\n\tCtxImpl,\n\tHANDLE_BASE,\n\ttype Hold,\n\ttype HoldOwner,\n\tholdsByProxy,\n\tnotifyStatus,\n\traceSignal,\n\ttype StatusListener,\n} from \"./record.ts\";\nimport type { Ctx, HandleStatus, Principal, Readable, Shape, StateEvent } from \"./types.ts\";\nimport { fromWireError, type RootRef, type WireError } from \"./wire.ts\";\n\nconst noop = (): void => {};\n\nexport interface StateSink {\n\tsnap?: unknown;\n\treset?: unknown;\n\tops?: readonly WireOp[];\n\terror?: WireError;\n}\n\n/** What a remote handle needs from the link it is bound to (implemented by Connection). */\nexport interface RemoteChannel {\n\thold(handle: RemoteHandle): number;\n\trelease(id: number): void;\n\tcall(hold: number, member: string, args: unknown, root: RootRef | undefined, signal: AbortSignal): Promise<unknown>;\n\tsub(hold: number, member: string, sink: (frame: StateSink) => void): number;\n\tunsub(id: number): void;\n}\n\n/** What a remote handle needs from its host. */\nexport interface RemoteHost {\n\treadonly inFactory: number;\n\treport(error: unknown): void;\n\troot<T>(fn: (ctx: Ctx) => T | Promise<T>, options?: { signal?: AbortSignal }): Promise<T>;\n\tforgetRemote(handle: RemoteHandle): void;\n}\n\n/**\n * A state member of a remote handle: hydrated while subscribed (snapshot, then decoded ops); `undefined` before.\n * Re-subscribing after a reconnect delivers the new snapshot as a reset.\n */\nclass RemoteReadable implements Readable<unknown> {\n\treadonly #handle: RemoteHandle;\n\treadonly #name: string;\n\treadonly #values = new Set<(value: unknown) => void>();\n\treadonly #events = new Set<(event: StateEvent<unknown>) => void>();\n\t#sub: { readonly channel: RemoteChannel; readonly id: number } | undefined;\n\t#decoder: Decoder = decoder();\n\t#value: unknown;\n\n\tconstructor(handle: RemoteHandle, name: string) {\n\t\tthis.#handle = handle;\n\t\tthis.#name = name;\n\t}\n\n\tget value(): unknown {\n\t\treturn this.#value;\n\t}\n\n\tsubscribe(listener: (value: unknown) => void): () => void {\n\t\tthis.#values.add(listener);\n\t\tthis.#safe(() => listener(this.#value));\n\t\tthis.bind();\n\t\treturn () => this.#remove(this.#values, listener);\n\t}\n\n\tevents(listener: (event: StateEvent<unknown>) => void): () => void {\n\t\tthis.#events.add(listener);\n\t\tthis.#safe(() => listener({ type: \"snap\", value: this.#value }));\n\t\tthis.bind();\n\t\treturn () => this.#remove(this.#events, listener);\n\t}\n\n\t/** Subscribes upstream while someone listens and the handle is bound; drops a subscription on an old link. */\n\tbind(): void {\n\t\tconst listening = this.#values.size + this.#events.size > 0;\n\t\t// Nobody listens: the value would go stale, so forget it. The next subscriber sees `undefined`, then the snapshot.\n\t\tif (!listening) this.#value = undefined;\n\t\tconst binding = listening ? this.#handle.binding : undefined;\n\t\tif (binding !== undefined && this.#sub?.channel === binding.channel) return;\n\t\tif (this.#sub !== undefined) {\n\t\t\tif (this.#sub.channel !== binding?.channel || binding === undefined) this.#sub.channel.unsub(this.#sub.id);\n\t\t\tthis.#sub = undefined;\n\t\t}\n\t\tif (binding === undefined) return;\n\t\tconst channel = binding.channel;\n\t\tthis.#decoder = decoder();\n\t\tconst id = channel.sub(binding.id, this.#name, (frame) => this.#receive(frame));\n\t\tthis.#sub = { channel, id };\n\t}\n\n\t/** The link is gone: keep the last value, resubscribe on the next binding. */\n\tdetach(): void {\n\t\tthis.#sub = undefined;\n\t}\n\n\tstop(): void {\n\t\tthis.#values.clear();\n\t\tthis.#events.clear();\n\t\tthis.bind();\n\t}\n\n\t#receive(frame: StateSink): void {\n\t\tif (frame.error !== undefined) {\n\t\t\tthis.#handle.host.report(fromWireError(frame.error));\n\t\t\treturn;\n\t\t}\n\t\tlet event: StateEvent<unknown>;\n\t\tif (frame.ops === undefined && !(\"snap\" in frame) && !(\"reset\" in frame)) return;\n\t\tif (frame.ops !== undefined) {\n\t\t\tconst ops = this.#decoder.decode(frame.ops);\n\t\t\tthis.#value = applyImmutable(this.#value, ops);\n\t\t\tevent = { type: \"ops\", ops, value: this.#value };\n\t\t} else {\n\t\t\t// Listeners already saw a snapshot (`undefined` or an older value), so every upstream snapshot is a reset.\n\t\t\tthis.#decoder = decoder();\n\t\t\tthis.#value = \"snap\" in frame ? frame.snap : frame.reset;\n\t\t\tevent = { type: \"reset\", value: this.#value };\n\t\t}\n\t\tfor (const listener of [...this.#events]) this.#safe(() => listener(event));\n\t\tfor (const listener of [...this.#values]) this.#safe(() => listener(this.#value));\n\t}\n\n\t#remove<T>(set: Set<T>, listener: T): void {\n\t\tset.delete(listener);\n\t\tthis.bind();\n\t}\n\n\t#safe(fn: () => void): void {\n\t\ttry {\n\t\t\tfn();\n\t\t} catch (error) {\n\t\t\tthis.#handle.host.report(error);\n\t\t}\n\t}\n}\n\n/** A hold on an object on another host, bound to a link. Late-bound like a local handle. */\nexport class RemoteHandle implements Hold {\n\treadonly record = undefined;\n\treadonly host: RemoteHost;\n\treadonly contract: AnyContract;\n\treadonly at: string;\n\treadonly input: unknown;\n\t/** Forwarded principal (omitted for the host's own principal). */\n\treadonly principal: Principal | undefined;\n\treadonly owner: HoldOwner;\n\treadonly address: string;\n\treadonly proxy: object;\n\treadonly ready: Promise<void>;\n\tstatus: HandleStatus = \"loading\";\n\terror: unknown;\n\tshape: Shape | undefined;\n\tbinding: { readonly channel: RemoteChannel; readonly id: number } | undefined;\n\treadonly shapeListeners = new Set<(shape: Shape) => void>();\n\treadonly #readables = new Map<string, RemoteReadable>();\n\treadonly #callers = new Map<string, (args: unknown, ctx?: Ctx) => Promise<unknown>>();\n\t#settleReady: { resolve: () => void; reject: (error: unknown) => void } | undefined;\n\t#live: { promise: Promise<void>; resolve: () => void; reject: (error: unknown) => void };\n\n\tconstructor(\n\t\thost: RemoteHost,\n\t\tfields: {\n\t\t\tcontract: AnyContract;\n\t\t\tat: string;\n\t\t\tinput: unknown;\n\t\t\tprincipal: Principal | undefined;\n\t\t\towner: HoldOwner;\n\t\t\taddress: string;\n\t\t},\n\t) {\n\t\tthis.host = host;\n\t\tthis.contract = fields.contract;\n\t\tthis.at = fields.at;\n\t\tthis.input = fields.input;\n\t\tthis.principal = fields.principal;\n\t\tthis.owner = fields.owner;\n\t\tthis.address = fields.address;\n\t\tthis.ready = new Promise<void>((resolve, reject) => {\n\t\t\tthis.#settleReady = { resolve, reject };\n\t\t});\n\t\tthis.ready.catch(noop);\n\t\tthis.#live = this.#newLive();\n\t\tthis.proxy = new Proxy(this, {\n\t\t\tget: (target, property) => {\n\t\t\t\tif (HANDLE_BASE.has(property)) {\n\t\t\t\t\tconst value: unknown = Reflect.get(target, property, target);\n\t\t\t\t\treturn typeof value === \"function\" ? value.bind(target) : value;\n\t\t\t\t}\n\t\t\t\tif (typeof property !== \"string\" || property === \"then\") return undefined;\n\t\t\t\treturn target.member(property);\n\t\t\t},\n\t\t});\n\t\tholdsByProxy.set(this.proxy, this);\n\t}\n\n\tget kind(): string | undefined {\n\t\treturn this.shape?.kind;\n\t}\n\n\tonShape(listener: (shape: Shape) => void): () => void {\n\t\tthis.shapeListeners.add(listener);\n\t\treturn () => this.shapeListeners.delete(listener);\n\t}\n\n\tonStatus(listener: StatusListener): () => void {\n\t\tthis.#statusListeners.add(listener);\n\t\treturn () => this.#statusListeners.delete(listener);\n\t}\n\n\treadonly #statusListeners = new Set<StatusListener>();\n\n\t#statusChanged(): void {\n\t\tnotifyStatus(this.#statusListeners, this.status, this.error, (error) => this.host.report(error));\n\t}\n\n\trelease(): void {\n\t\tif (this.status === \"released\" || this.status === \"gone\") return;\n\t\tthis.status = \"released\";\n\t\tthis.#statusChanged();\n\t\tconst error = new ChordError(\"released\", `handle ${this.address} released`);\n\t\tthis.#settleReady?.reject(error);\n\t\tthis.#live.reject(error);\n\t\tfor (const readable of this.#readables.values()) readable.stop();\n\t\tif (this.binding !== undefined) this.binding.channel.release(this.binding.id);\n\t\tthis.binding = undefined;\n\t\tthis.host.forgetRemote(this);\n\t}\n\n\t// ─── driven by the link ───\n\n\tbound(channel: RemoteChannel, id: number): void {\n\t\tthis.binding = { channel, id };\n\t}\n\n\tshaped(shape: Shape): void {\n\t\tif (this.status === \"released\" || this.status === \"gone\") return;\n\t\tthis.shape = shape;\n\t\tconst wasLoading = this.status === \"loading\";\n\t\tthis.status = \"live\";\n\t\tif (wasLoading) this.#statusChanged();\n\t\tif (wasLoading) {\n\t\t\tthis.#settleReady?.resolve();\n\t\t\tthis.#settleReady = undefined;\n\t\t\tthis.#live.resolve();\n\t\t}\n\t\tfor (const readable of this.#readables.values()) readable.bind();\n\t\tfor (const listener of [...this.shapeListeners]) {\n\t\t\ttry {\n\t\t\t\tlistener(shape);\n\t\t\t} catch (error) {\n\t\t\t\tthis.host.report(error);\n\t\t\t}\n\t\t}\n\t}\n\n\tgone(error: unknown): void {\n\t\tif (this.status === \"released\" || this.status === \"gone\") return;\n\t\tthis.status = \"gone\";\n\t\tthis.error = error;\n\t\tthis.#statusChanged();\n\t\tthis.binding = undefined;\n\t\tthis.#settleReady?.reject(error);\n\t\tthis.#live.reject(error);\n\t\tfor (const readable of this.#readables.values()) readable.stop();\n\t\tthis.host.forgetRemote(this);\n\t}\n\n\t/** The link went down but may come back (upstream reconnect): wait, then re-hold. */\n\tdetached(): void {\n\t\tif (this.status === \"released\" || this.status === \"gone\") return;\n\t\tthis.binding = undefined;\n\t\tfor (const readable of this.#readables.values()) readable.detach();\n\t\tif (this.status === \"live\") {\n\t\t\tthis.status = \"loading\";\n\t\t\tthis.#live = this.#newLive();\n\t\t\tthis.#statusChanged();\n\t\t}\n\t}\n\n\t// ─── members ───\n\n\tmember(name: string): unknown {\n\t\tconst description = Object.values(this.contract.description.variants)\n\t\t\t.map((members) => members[name])\n\t\t\t.find((member) => member !== undefined);\n\t\tif (description?.kind === \"method\") return this.#caller(name);\n\t\tif (description?.kind === \"state\") {\n\t\t\tlet readable = this.#readables.get(name);\n\t\t\tif (readable === undefined) {\n\t\t\t\treadable = new RemoteReadable(this, name);\n\t\t\t\tthis.#readables.set(name, readable);\n\t\t\t}\n\t\t\treturn readable;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t#caller(name: string): (args: unknown, ctx?: Ctx) => Promise<unknown> {\n\t\tlet caller = this.#callers.get(name);\n\t\tif (caller === undefined) {\n\t\t\tcaller = (args, ctx) => {\n\t\t\t\tif (this.host.inFactory > 0)\n\t\t\t\t\tthrow new ChordError(\"not_ready\", `${this.address}.${name} called inside a factory`);\n\t\t\t\tif (ctx instanceof CtxImpl) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tctx.check(ctx.host);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\treturn Promise.reject(error);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (ctx === undefined || (ctx instanceof CtxImpl && ctx.holder)) {\n\t\t\t\t\treturn this.host.root((root) => this.#call(name, args, root), { signal: ctx?.signal });\n\t\t\t\t}\n\t\t\t\treturn this.#call(name, args, ctx);\n\t\t\t};\n\t\t\tthis.#callers.set(name, caller);\n\t\t}\n\t\treturn caller;\n\t}\n\n\tasync #call(name: string, args: unknown, ctx: Ctx): Promise<unknown> {\n\t\tfor (;;) {\n\t\t\tif (this.status === \"released\" || this.status === \"gone\") {\n\t\t\t\tthrow this.status === \"gone\" ? this.error : new ChordError(\"released\", `handle ${this.address} released`);\n\t\t\t}\n\t\t\tif (this.status === \"loading\") await raceSignal(this.#live.promise, ctx.signal);\n\t\t\tconst binding = this.binding;\n\t\t\tif (binding === undefined) continue;\n\t\t\tconst kind = this.shape?.kind;\n\t\t\tif (kind === undefined || this.contract.description.variants[kind]?.[name]?.kind !== \"method\") {\n\t\t\t\tthrow new ChordError(\"not_in_variant\", `${this.address}: ${name} is not a method of variant ${kind}`);\n\t\t\t}\n\t\t\t// Send only what the consumer's own schema knows (the additive rule's premise; see RecordImpl.call).\n\t\t\tconst description = this.contract.description.variants[kind]?.[name];\n\t\t\tconst sent = description?.kind === \"method\" ? Value.Clean(description.args, Value.Clone(args)) : args;\n\t\t\treturn binding.channel.call(binding.id, name, sent, { rootId: ctx.rootId, epoch: ctx.epoch }, ctx.signal);\n\t\t}\n\t}\n\n\t#newLive(): { promise: Promise<void>; resolve: () => void; reject: (error: unknown) => void } {\n\t\tlet resolve = noop;\n\t\tlet reject: (error: unknown) => void = noop;\n\t\tconst promise = new Promise<void>((done, fail) => {\n\t\t\tresolve = done;\n\t\t\treject = fail;\n\t\t});\n\t\tpromise.catch(noop);\n\t\treturn { promise, resolve, reject };\n\t}\n}\n"]}
@@ -0,0 +1,21 @@
1
+ import type { TSchema } from "typebox";
2
+ import { type ChordErrorReason } from "./errors.ts";
3
+ /** Canonical JSON: sorted object keys, `undefined` members dropped. */
4
+ export declare function canonicalJson(value: unknown): string;
5
+ /** Non-cryptographic 64-bit hash (two FNV-1a lanes). Contracts are trusted, so collisions are not an attack surface. */
6
+ export declare function hash64(text: string): string;
7
+ export declare function deepEqual(a: unknown, b: unknown): boolean;
8
+ /** Throws `invalid` (with `reason`) and the first schema errors when `value` does not match. */
9
+ export declare function assertValid(reason: ChordErrorReason, what: string, schema: TSchema, value: unknown): void;
10
+ /** Applies defaults, strips unknown fields, validates. Returns a fresh value. */
11
+ export declare function normalize(schema: TSchema, value: unknown, what: string): unknown;
12
+ /** Canonical identity of a normalized value: fields equal to their schema default are omitted. */
13
+ export declare function canonicalIdentity(schema: TSchema, value: unknown): string;
14
+ /**
15
+ * Conservative structural subtyping: true only if every value valid under `sub` is valid under `sup`, where object
16
+ * fields missing from `sub` but optional in `sup` count as fine (unknown fields are stripped at the provider, see
17
+ * `RecordImpl.call`). A provider schema using a keyword this function does not model (`not`, `allOf`, `contains`,
18
+ * `$ref`, ...) or an `additionalProperties` schema only fits an identical consumer schema.
19
+ */
20
+ export declare function fits(subSchema: unknown, supSchema: unknown): boolean;
21
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,KAAK,gBAAgB,EAAW,MAAM,aAAa,CAAC;AAQ7D,uEAAuE;AACvE,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAOpD;AAED,wHAAwH;AACxH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAS3C;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAEzD;AAED,gGAAgG;AAChG,wBAAgB,WAAW,CAAC,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAKzG;AAED,iFAAiF;AACjF,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAIhF;AAED,kGAAkG;AAClG,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAEzE;AAyED;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,CA0BpE"}