@harrylabsj/kiwi-merchant-cloud 0.12.4 → 0.12.6

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 (1813) 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/buyer-core/service.d.ts +22 -1
  34. package/app/buyer-core/service.js +325 -33
  35. package/app/buyer-core/service.js.map +1 -1
  36. package/app/buyer-core/store.d.ts +23 -0
  37. package/app/buyer-core/store.js +71 -8
  38. package/app/buyer-core/store.js.map +1 -1
  39. package/app/cloud/bootstrap.d.ts +17 -0
  40. package/app/cloud/bootstrap.js +96 -59
  41. package/app/cloud/bootstrap.js.map +1 -1
  42. package/app/cloud/config.d.ts +26 -0
  43. package/app/cloud/config.js +75 -3
  44. package/app/cloud/config.js.map +1 -1
  45. package/app/cloud/file-listing-publication.js +6 -0
  46. package/app/cloud/file-listing-publication.js.map +1 -1
  47. package/app/cloud/main.d.ts +72 -0
  48. package/app/cloud/main.js +332 -11
  49. package/app/cloud/main.js.map +1 -1
  50. package/app/cloud/owned-clock.d.ts +27 -0
  51. package/app/cloud/owned-clock.js +98 -0
  52. package/app/cloud/owned-clock.js.map +1 -0
  53. package/app/cloud/owned-runtime.d.ts +188 -0
  54. package/app/cloud/owned-runtime.js +1041 -0
  55. package/app/cloud/owned-runtime.js.map +1 -0
  56. package/app/cloud/product-import-tabular.d.ts +1 -1
  57. package/app/cloud/product-import-tabular.js +263 -36
  58. package/app/cloud/product-import-tabular.js.map +1 -1
  59. package/app/cloud/product-source.d.ts +6 -1
  60. package/app/cloud/product-source.js +47 -15
  61. package/app/cloud/product-source.js.map +1 -1
  62. package/app/cloud-sample/products.json +3 -3
  63. package/app/commerce/data-source.d.ts +4 -0
  64. package/app/commerce/data-source.js.map +1 -1
  65. package/app/commerce/shopping-cli-source.js +4 -0
  66. package/app/commerce/shopping-cli-source.js.map +1 -1
  67. package/app/demo/demo-runner.js +6 -0
  68. package/app/demo/demo-runner.js.map +1 -1
  69. package/app/discovery/catalog-source/kiwi-source.d.ts +2 -0
  70. package/app/discovery/catalog-source/kiwi-source.js +4 -0
  71. package/app/discovery/catalog-source/kiwi-source.js.map +1 -1
  72. package/app/handoff/destination.d.ts +2 -0
  73. package/app/handoff/destination.js +4 -0
  74. package/app/handoff/destination.js.map +1 -1
  75. package/app/handoff/index.d.ts +2 -1
  76. package/app/handoff/index.js +1 -0
  77. package/app/handoff/index.js.map +1 -1
  78. package/app/handoff/launch-marketplace-policy.d.ts +149 -0
  79. package/app/handoff/launch-marketplace-policy.js +301 -0
  80. package/app/handoff/launch-marketplace-policy.js.map +1 -0
  81. package/app/handoff/marketplace-product-link.d.ts +18 -0
  82. package/app/handoff/marketplace-product-link.js +71 -0
  83. package/app/handoff/marketplace-product-link.js.map +1 -0
  84. package/app/handoff/transaction.d.ts +30 -0
  85. package/app/handoff/transaction.js +64 -0
  86. package/app/handoff/transaction.js.map +1 -1
  87. package/app/handoff/url-safety.d.ts +3 -0
  88. package/app/handoff/url-safety.js +4 -0
  89. package/app/handoff/url-safety.js.map +1 -1
  90. package/app/http/merchant-management/page.js +176 -45
  91. package/app/http/merchant-management/page.js.map +1 -1
  92. package/app/i18n.d.ts +1 -0
  93. package/app/i18n.js +3 -0
  94. package/app/i18n.js.map +1 -1
  95. package/app/lifecycle/close.d.ts +24 -0
  96. package/app/lifecycle/close.js +131 -0
  97. package/app/lifecycle/close.js.map +1 -0
  98. package/app/mcp/merchant-runtime-assembly.js +6 -4
  99. package/app/mcp/merchant-runtime-assembly.js.map +1 -1
  100. package/app/mcp/tools.js +17 -16
  101. package/app/mcp/tools.js.map +1 -1
  102. package/app/merchant/application/service.d.ts +4 -0
  103. package/app/merchant/application/service.js.map +1 -1
  104. package/app/merchant/stats-store.d.ts +3 -0
  105. package/app/merchant/stats-store.js +15 -1
  106. package/app/merchant/stats-store.js.map +1 -1
  107. package/app/merchant-core/rfq/data-source-adapter.d.ts +2 -10
  108. package/app/merchant-core/rfq/data-source-adapter.js +21 -9
  109. package/app/merchant-core/rfq/data-source-adapter.js.map +1 -1
  110. package/app/merchant-gateway/pinned-fetch.js +5 -2
  111. package/app/merchant-gateway/pinned-fetch.js.map +1 -1
  112. package/build-manifest.json +4103 -3123
  113. package/node_modules/@earendil-works/chord/CHANGELOG.md +20 -0
  114. package/node_modules/@earendil-works/chord/README.md +77 -194
  115. package/node_modules/@earendil-works/chord/dist/cell.d.ts +101 -0
  116. package/node_modules/@earendil-works/chord/dist/cell.d.ts.map +1 -0
  117. package/node_modules/@earendil-works/chord/dist/cell.js +316 -0
  118. package/node_modules/@earendil-works/chord/dist/cell.js.map +1 -0
  119. package/node_modules/@earendil-works/chord/dist/cluster.d.ts +26 -0
  120. package/node_modules/@earendil-works/chord/dist/cluster.d.ts.map +1 -0
  121. package/node_modules/@earendil-works/chord/dist/cluster.js +214 -0
  122. package/node_modules/@earendil-works/chord/dist/cluster.js.map +1 -0
  123. package/node_modules/@earendil-works/chord/dist/connection.d.ts +157 -0
  124. package/node_modules/@earendil-works/chord/dist/connection.d.ts.map +1 -0
  125. package/node_modules/@earendil-works/chord/dist/connection.js +757 -0
  126. package/node_modules/@earendil-works/chord/dist/connection.js.map +1 -0
  127. package/node_modules/@earendil-works/chord/dist/context/index.d.ts +12 -1
  128. package/node_modules/@earendil-works/chord/dist/context/index.d.ts.map +1 -1
  129. package/node_modules/@earendil-works/chord/dist/context/index.js.map +1 -1
  130. package/node_modules/@earendil-works/chord/dist/contract.d.ts +133 -0
  131. package/node_modules/@earendil-works/chord/dist/contract.d.ts.map +1 -0
  132. package/node_modules/@earendil-works/chord/dist/contract.js +157 -0
  133. package/node_modules/@earendil-works/chord/dist/contract.js.map +1 -0
  134. package/node_modules/@earendil-works/chord/dist/declare.d.ts +70 -0
  135. package/node_modules/@earendil-works/chord/dist/declare.d.ts.map +1 -0
  136. package/node_modules/@earendil-works/chord/dist/declare.js +22 -0
  137. package/node_modules/@earendil-works/chord/dist/declare.js.map +1 -0
  138. package/node_modules/@earendil-works/chord/dist/delta/apply-immutable-trusted.js.map +1 -1
  139. package/node_modules/@earendil-works/chord/dist/delta/diff.d.ts +1 -1
  140. package/node_modules/@earendil-works/chord/dist/delta/diff.d.ts.map +1 -1
  141. package/node_modules/@earendil-works/chord/dist/delta/diff.js.map +1 -1
  142. package/node_modules/@earendil-works/chord/dist/delta/index.d.ts +2 -2
  143. package/node_modules/@earendil-works/chord/dist/delta/index.d.ts.map +1 -1
  144. package/node_modules/@earendil-works/chord/dist/delta/index.js +41 -0
  145. package/node_modules/@earendil-works/chord/dist/delta/index.js.map +1 -1
  146. package/node_modules/@earendil-works/chord/dist/delta/revision-validator.d.ts +1 -1
  147. package/node_modules/@earendil-works/chord/dist/delta/revision-validator.d.ts.map +1 -1
  148. package/node_modules/@earendil-works/chord/dist/delta/revision-validator.js.map +1 -1
  149. package/node_modules/@earendil-works/chord/dist/delta/tracker.d.ts +1 -1
  150. package/node_modules/@earendil-works/chord/dist/delta/tracker.d.ts.map +1 -1
  151. package/node_modules/@earendil-works/chord/dist/delta/tracker.js +40 -4
  152. package/node_modules/@earendil-works/chord/dist/delta/tracker.js.map +1 -1
  153. package/node_modules/@earendil-works/chord/dist/errors.d.ts +27 -0
  154. package/node_modules/@earendil-works/chord/dist/errors.d.ts.map +1 -0
  155. package/node_modules/@earendil-works/chord/dist/errors.js +44 -0
  156. package/node_modules/@earendil-works/chord/dist/errors.js.map +1 -0
  157. package/node_modules/@earendil-works/chord/dist/host.d.ts +254 -0
  158. package/node_modules/@earendil-works/chord/dist/host.d.ts.map +1 -0
  159. package/node_modules/@earendil-works/chord/dist/host.js +795 -0
  160. package/node_modules/@earendil-works/chord/dist/host.js.map +1 -0
  161. package/node_modules/@earendil-works/chord/dist/index.d.ts +17 -10
  162. package/node_modules/@earendil-works/chord/dist/index.d.ts.map +1 -1
  163. package/node_modules/@earendil-works/chord/dist/index.js +8 -8
  164. package/node_modules/@earendil-works/chord/dist/index.js.map +1 -1
  165. package/node_modules/@earendil-works/chord/dist/json.d.ts +9 -1
  166. package/node_modules/@earendil-works/chord/dist/json.d.ts.map +1 -1
  167. package/node_modules/@earendil-works/chord/dist/json.js.map +1 -1
  168. package/node_modules/@earendil-works/chord/dist/link.d.ts +72 -0
  169. package/node_modules/@earendil-works/chord/dist/link.d.ts.map +1 -0
  170. package/node_modules/@earendil-works/chord/dist/link.js +169 -0
  171. package/node_modules/@earendil-works/chord/dist/link.js.map +1 -0
  172. package/node_modules/@earendil-works/chord/dist/loader.d.ts +4 -0
  173. package/node_modules/@earendil-works/chord/dist/loader.d.ts.map +1 -0
  174. package/node_modules/@earendil-works/chord/dist/loader.js +68 -0
  175. package/node_modules/@earendil-works/chord/dist/loader.js.map +1 -0
  176. package/node_modules/@earendil-works/chord/dist/manager.d.ts +115 -0
  177. package/node_modules/@earendil-works/chord/dist/manager.d.ts.map +1 -0
  178. package/node_modules/@earendil-works/chord/dist/manager.js +319 -0
  179. package/node_modules/@earendil-works/chord/dist/manager.js.map +1 -0
  180. package/node_modules/@earendil-works/chord/dist/node.d.ts +3 -4
  181. package/node_modules/@earendil-works/chord/dist/node.d.ts.map +1 -1
  182. package/node_modules/@earendil-works/chord/dist/node.js +3 -2
  183. package/node_modules/@earendil-works/chord/dist/node.js.map +1 -1
  184. package/node_modules/@earendil-works/chord/dist/publish.d.ts +5 -0
  185. package/node_modules/@earendil-works/chord/dist/publish.d.ts.map +1 -0
  186. package/node_modules/@earendil-works/chord/dist/publish.js +40 -0
  187. package/node_modules/@earendil-works/chord/dist/publish.js.map +1 -0
  188. package/node_modules/@earendil-works/chord/dist/record.d.ts +320 -0
  189. package/node_modules/@earendil-works/chord/dist/record.d.ts.map +1 -0
  190. package/node_modules/@earendil-works/chord/dist/record.js +1292 -0
  191. package/node_modules/@earendil-works/chord/dist/record.js.map +1 -0
  192. package/node_modules/@earendil-works/chord/dist/registry.d.ts +25 -0
  193. package/node_modules/@earendil-works/chord/dist/registry.d.ts.map +1 -0
  194. package/node_modules/@earendil-works/chord/dist/registry.js +6 -0
  195. package/node_modules/@earendil-works/chord/dist/registry.js.map +1 -0
  196. package/node_modules/@earendil-works/chord/dist/reload.d.ts +118 -0
  197. package/node_modules/@earendil-works/chord/dist/reload.d.ts.map +1 -0
  198. package/node_modules/@earendil-works/chord/dist/reload.js +589 -0
  199. package/node_modules/@earendil-works/chord/dist/reload.js.map +1 -0
  200. package/node_modules/@earendil-works/chord/dist/remote.d.ts +70 -0
  201. package/node_modules/@earendil-works/chord/dist/remote.d.ts.map +1 -0
  202. package/node_modules/@earendil-works/chord/dist/remote.js +308 -0
  203. package/node_modules/@earendil-works/chord/dist/remote.js.map +1 -0
  204. package/node_modules/@earendil-works/chord/dist/schema.d.ts +21 -0
  205. package/node_modules/@earendil-works/chord/dist/schema.d.ts.map +1 -0
  206. package/node_modules/@earendil-works/chord/dist/schema.js +228 -0
  207. package/node_modules/@earendil-works/chord/dist/schema.js.map +1 -0
  208. package/node_modules/@earendil-works/chord/dist/state.d.ts +92 -0
  209. package/node_modules/@earendil-works/chord/dist/state.d.ts.map +1 -0
  210. package/node_modules/@earendil-works/chord/dist/{services/state.js → state.js} +28 -138
  211. package/node_modules/@earendil-works/chord/dist/state.js.map +1 -0
  212. package/node_modules/@earendil-works/chord/dist/types.d.ts +62 -262
  213. package/node_modules/@earendil-works/chord/dist/types.d.ts.map +1 -1
  214. package/node_modules/@earendil-works/chord/dist/types.js.map +1 -1
  215. package/node_modules/@earendil-works/chord/dist/websocket.d.ts +16 -0
  216. package/node_modules/@earendil-works/chord/dist/websocket.d.ts.map +1 -0
  217. package/node_modules/@earendil-works/chord/dist/websocket.js +15 -0
  218. package/node_modules/@earendil-works/chord/dist/websocket.js.map +1 -0
  219. package/node_modules/@earendil-works/chord/dist/wire.d.ts +135 -0
  220. package/node_modules/@earendil-works/chord/dist/wire.d.ts.map +1 -0
  221. package/node_modules/@earendil-works/chord/dist/wire.js +112 -0
  222. package/node_modules/@earendil-works/chord/dist/wire.js.map +1 -0
  223. package/node_modules/@earendil-works/chord/docs/guide.md +750 -0
  224. package/node_modules/@earendil-works/chord/docs/spec.md +261 -0
  225. package/node_modules/@earendil-works/chord/docs/tutorial.md +909 -0
  226. package/node_modules/@earendil-works/chord/package.json +10 -11
  227. package/node_modules/@earendil-works/chord/src/delta/README.md +5 -3
  228. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
  229. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +9 -1
  230. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -1
  231. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts +2 -5
  232. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts.map +1 -1
  233. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js +2 -14
  234. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js.map +1 -1
  235. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +4 -0
  236. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts.map +1 -1
  237. package/node_modules/@earendil-works/pi-agent-core/dist/types.js.map +1 -1
  238. package/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
  239. package/node_modules/@earendil-works/pi-ai/README.md +14 -3
  240. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts.map +1 -1
  241. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +63 -22
  242. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js.map +1 -1
  243. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-config.d.ts +15 -0
  244. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-config.d.ts.map +1 -0
  245. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-config.js +76 -0
  246. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-config.js.map +1 -0
  247. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.d.ts +3 -6
  248. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.d.ts.map +1 -1
  249. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js +2 -74
  250. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js.map +1 -1
  251. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js +33 -2
  252. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js.map +1 -1
  253. package/node_modules/@earendil-works/pi-ai/dist/api/classifier-shared.d.ts +21 -0
  254. package/node_modules/@earendil-works/pi-ai/dist/api/classifier-shared.d.ts.map +1 -0
  255. package/node_modules/@earendil-works/pi-ai/dist/api/classifier-shared.js +98 -0
  256. package/node_modules/@earendil-works/pi-ai/dist/api/classifier-shared.js.map +1 -0
  257. package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-workers-ai-system-one.d.ts.map +1 -1
  258. package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-workers-ai-system-one.js +2 -1
  259. package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-workers-ai-system-one.js.map +1 -1
  260. package/node_modules/@earendil-works/pi-ai/dist/api/lazy.d.ts.map +1 -1
  261. package/node_modules/@earendil-works/pi-ai/dist/api/lazy.js +4 -3
  262. package/node_modules/@earendil-works/pi-ai/dist/api/lazy.js.map +1 -1
  263. package/node_modules/@earendil-works/pi-ai/dist/api/llama-cpp-classify.d.ts.map +1 -1
  264. package/node_modules/@earendil-works/pi-ai/dist/api/llama-cpp-classify.js +2 -0
  265. package/node_modules/@earendil-works/pi-ai/dist/api/llama-cpp-classify.js.map +1 -1
  266. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.d.ts.map +1 -1
  267. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +31 -14
  268. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js.map +1 -1
  269. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts.map +1 -1
  270. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +7 -4
  271. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js.map +1 -1
  272. package/node_modules/@earendil-works/pi-ai/dist/api/openai-decisions.d.ts +4 -0
  273. package/node_modules/@earendil-works/pi-ai/dist/api/openai-decisions.d.ts.map +1 -0
  274. package/node_modules/@earendil-works/pi-ai/dist/api/openai-decisions.js +162 -0
  275. package/node_modules/@earendil-works/pi-ai/dist/api/openai-decisions.js.map +1 -0
  276. package/node_modules/@earendil-works/pi-ai/dist/api/openai-decisions.lazy.d.ts +3 -0
  277. package/node_modules/@earendil-works/pi-ai/dist/api/openai-decisions.lazy.d.ts.map +1 -0
  278. package/node_modules/@earendil-works/pi-ai/dist/api/openai-decisions.lazy.js +4 -0
  279. package/node_modules/@earendil-works/pi-ai/dist/api/openai-decisions.lazy.js.map +1 -0
  280. package/node_modules/@earendil-works/pi-ai/dist/api/system-one-shared.d.ts +0 -1
  281. package/node_modules/@earendil-works/pi-ai/dist/api/system-one-shared.d.ts.map +1 -1
  282. package/node_modules/@earendil-works/pi-ai/dist/api/system-one-shared.js +5 -89
  283. package/node_modules/@earendil-works/pi-ai/dist/api/system-one-shared.js.map +1 -1
  284. package/node_modules/@earendil-works/pi-ai/dist/api/typesafe-system-one.d.ts.map +1 -1
  285. package/node_modules/@earendil-works/pi-ai/dist/api/typesafe-system-one.js +2 -1
  286. package/node_modules/@earendil-works/pi-ai/dist/api/typesafe-system-one.js.map +1 -1
  287. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/anthropic.d.ts.map +1 -1
  288. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/anthropic.js +14 -6
  289. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/anthropic.js.map +1 -1
  290. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-chatgpt.js +1 -1
  291. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-chatgpt.js.map +1 -1
  292. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-codex.d.ts.map +1 -1
  293. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-codex.js +4 -4
  294. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-codex.js.map +1 -1
  295. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.d.ts +16 -1
  296. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.d.ts.map +1 -1
  297. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js +51 -27
  298. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js.map +1 -1
  299. package/node_modules/@earendil-works/pi-ai/dist/auth/types.d.ts +5 -0
  300. package/node_modules/@earendil-works/pi-ai/dist/auth/types.d.ts.map +1 -1
  301. package/node_modules/@earendil-works/pi-ai/dist/auth/types.js.map +1 -1
  302. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js +1 -1
  303. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js.map +1 -1
  304. package/node_modules/@earendil-works/pi-ai/dist/models.d.ts +5 -0
  305. package/node_modules/@earendil-works/pi-ai/dist/models.d.ts.map +1 -1
  306. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +4 -4
  307. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts.map +1 -1
  308. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +4 -4
  309. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js.map +1 -1
  310. package/node_modules/@earendil-works/pi-ai/dist/models.js +7 -8
  311. package/node_modules/@earendil-works/pi-ai/dist/models.js.map +1 -1
  312. package/node_modules/@earendil-works/pi-ai/dist/providers/all.js +2 -2
  313. package/node_modules/@earendil-works/pi-ai/dist/providers/all.js.map +1 -1
  314. package/node_modules/@earendil-works/pi-ai/dist/providers/azure.d.ts +3 -0
  315. package/node_modules/@earendil-works/pi-ai/dist/providers/azure.d.ts.map +1 -0
  316. package/node_modules/@earendil-works/pi-ai/dist/providers/azure.js +46 -0
  317. package/node_modules/@earendil-works/pi-ai/dist/providers/azure.js.map +1 -0
  318. package/node_modules/@earendil-works/pi-ai/dist/providers/azure.models.d.ts +6 -0
  319. package/node_modules/@earendil-works/pi-ai/dist/providers/azure.models.d.ts.map +1 -0
  320. package/node_modules/@earendil-works/pi-ai/dist/providers/azure.models.js +8 -0
  321. package/node_modules/@earendil-works/pi-ai/dist/providers/azure.models.js.map +1 -0
  322. package/node_modules/@earendil-works/pi-ai/dist/providers/compat-schema.d.ts +338 -0
  323. package/node_modules/@earendil-works/pi-ai/dist/providers/compat-schema.d.ts.map +1 -0
  324. package/node_modules/@earendil-works/pi-ai/dist/providers/compat-schema.js +375 -0
  325. package/node_modules/@earendil-works/pi-ai/dist/providers/compat-schema.js.map +1 -0
  326. package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  327. package/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -1
  328. package/node_modules/@earendil-works/pi-ai/dist/providers/data/anthropic.json +1 -1
  329. package/node_modules/@earendil-works/pi-ai/dist/providers/data/azure.json +1 -0
  330. package/node_modules/@earendil-works/pi-ai/dist/providers/data/baseten.json +1 -1
  331. package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
  332. package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-workers-ai.json +1 -1
  333. package/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
  334. package/node_modules/@earendil-works/pi-ai/dist/providers/data/google-vertex.json +1 -1
  335. package/node_modules/@earendil-works/pi-ai/dist/providers/data/google.json +1 -1
  336. package/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
  337. package/node_modules/@earendil-works/pi-ai/dist/providers/data/meta.json +1 -1
  338. package/node_modules/@earendil-works/pi-ai/dist/providers/data/minimax-cn.json +1 -1
  339. package/node_modules/@earendil-works/pi-ai/dist/providers/data/minimax.json +1 -1
  340. package/node_modules/@earendil-works/pi-ai/dist/providers/data/mistral.json +1 -1
  341. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai.json +1 -1
  342. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
  343. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
  344. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  345. package/node_modules/@earendil-works/pi-ai/dist/providers/data/radius.json +1 -1
  346. package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  347. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts.map +1 -1
  348. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js +25 -8
  349. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js.map +1 -1
  350. package/node_modules/@earendil-works/pi-ai/dist/providers/model-schema.d.ts +91 -0
  351. package/node_modules/@earendil-works/pi-ai/dist/providers/model-schema.d.ts.map +1 -0
  352. package/node_modules/@earendil-works/pi-ai/dist/providers/model-schema.js +55 -0
  353. package/node_modules/@earendil-works/pi-ai/dist/providers/model-schema.js.map +1 -0
  354. package/node_modules/@earendil-works/pi-ai/dist/providers/openai.d.ts.map +1 -1
  355. package/node_modules/@earendil-works/pi-ai/dist/providers/openai.js +12 -3
  356. package/node_modules/@earendil-works/pi-ai/dist/providers/openai.js.map +1 -1
  357. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter-api.d.ts +40 -0
  358. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter-api.d.ts.map +1 -0
  359. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter-api.js +41 -0
  360. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter-api.js.map +1 -0
  361. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.d.ts +11 -1
  362. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.d.ts.map +1 -1
  363. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.js +52 -1
  364. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.js.map +1 -1
  365. package/node_modules/@earendil-works/pi-ai/dist/providers/radius.d.ts.map +1 -1
  366. package/node_modules/@earendil-works/pi-ai/dist/providers/radius.js +4 -12
  367. package/node_modules/@earendil-works/pi-ai/dist/providers/radius.js.map +1 -1
  368. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +22 -305
  369. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
  370. package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
  371. package/node_modules/@earendil-works/pi-ai/dist/utils/estimate.js +1 -1
  372. package/node_modules/@earendil-works/pi-ai/dist/utils/estimate.js.map +1 -1
  373. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.d.ts +10 -1
  374. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.d.ts.map +1 -1
  375. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js +25 -0
  376. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js.map +1 -1
  377. package/node_modules/@earendil-works/pi-ai/dist/utils/model-operations.d.ts +3 -1
  378. package/node_modules/@earendil-works/pi-ai/dist/utils/model-operations.d.ts.map +1 -1
  379. package/node_modules/@earendil-works/pi-ai/dist/utils/model-operations.js +6 -0
  380. package/node_modules/@earendil-works/pi-ai/dist/utils/model-operations.js.map +1 -1
  381. package/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.d.ts +2 -0
  382. package/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.d.ts.map +1 -1
  383. package/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.js +2 -0
  384. package/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.js.map +1 -1
  385. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.d.ts.map +1 -1
  386. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js +8 -2
  387. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js.map +1 -1
  388. package/node_modules/@earendil-works/pi-ai/package.json +2 -2
  389. package/node_modules/@earendil-works/pi-codemode/README.md +177 -11
  390. package/node_modules/@earendil-works/pi-codemode/dist/cloudflare.d.ts +53 -0
  391. package/node_modules/@earendil-works/pi-codemode/dist/cloudflare.d.ts.map +1 -0
  392. package/node_modules/@earendil-works/pi-codemode/dist/cloudflare.js +64 -0
  393. package/node_modules/@earendil-works/pi-codemode/dist/cloudflare.js.map +1 -0
  394. package/node_modules/@earendil-works/pi-codemode/dist/declarations.d.ts +6 -21
  395. package/node_modules/@earendil-works/pi-codemode/dist/declarations.d.ts.map +1 -1
  396. package/node_modules/@earendil-works/pi-codemode/dist/declarations.js +113 -127
  397. package/node_modules/@earendil-works/pi-codemode/dist/declarations.js.map +1 -1
  398. package/node_modules/@earendil-works/pi-codemode/dist/index.d.ts +5 -2
  399. package/node_modules/@earendil-works/pi-codemode/dist/index.d.ts.map +1 -1
  400. package/node_modules/@earendil-works/pi-codemode/dist/index.js +4 -1
  401. package/node_modules/@earendil-works/pi-codemode/dist/index.js.map +1 -1
  402. package/node_modules/@earendil-works/pi-codemode/dist/portable.d.ts +15 -0
  403. package/node_modules/@earendil-works/pi-codemode/dist/portable.d.ts.map +1 -0
  404. package/node_modules/@earendil-works/pi-codemode/dist/portable.js +12 -0
  405. package/node_modules/@earendil-works/pi-codemode/dist/portable.js.map +1 -0
  406. package/node_modules/@earendil-works/pi-codemode/dist/runtime/execution.d.ts +66 -0
  407. package/node_modules/@earendil-works/pi-codemode/dist/runtime/execution.d.ts.map +1 -0
  408. package/node_modules/@earendil-works/pi-codemode/dist/runtime/execution.js +494 -0
  409. package/node_modules/@earendil-works/pi-codemode/dist/runtime/execution.js.map +1 -0
  410. package/node_modules/@earendil-works/pi-codemode/dist/runtime/host.d.ts +8 -30
  411. package/node_modules/@earendil-works/pi-codemode/dist/runtime/host.d.ts.map +1 -1
  412. package/node_modules/@earendil-works/pi-codemode/dist/runtime/host.js +41 -283
  413. package/node_modules/@earendil-works/pi-codemode/dist/runtime/host.js.map +1 -1
  414. package/node_modules/@earendil-works/pi-codemode/dist/runtime/inline.d.ts +63 -0
  415. package/node_modules/@earendil-works/pi-codemode/dist/runtime/inline.d.ts.map +1 -0
  416. package/node_modules/@earendil-works/pi-codemode/dist/runtime/inline.js +80 -0
  417. package/node_modules/@earendil-works/pi-codemode/dist/runtime/inline.js.map +1 -0
  418. package/node_modules/@earendil-works/pi-codemode/dist/runtime/prelude-source.d.ts +9 -3
  419. package/node_modules/@earendil-works/pi-codemode/dist/runtime/prelude-source.d.ts.map +1 -1
  420. package/node_modules/@earendil-works/pi-codemode/dist/runtime/prelude-source.js +122 -12
  421. package/node_modules/@earendil-works/pi-codemode/dist/runtime/prelude-source.js.map +1 -1
  422. package/node_modules/@earendil-works/pi-codemode/dist/runtime/protocol.d.ts +47 -6
  423. package/node_modules/@earendil-works/pi-codemode/dist/runtime/protocol.d.ts.map +1 -1
  424. package/node_modules/@earendil-works/pi-codemode/dist/runtime/protocol.js +6 -1
  425. package/node_modules/@earendil-works/pi-codemode/dist/runtime/protocol.js.map +1 -1
  426. package/node_modules/@earendil-works/pi-codemode/dist/runtime/remote.d.ts +102 -0
  427. package/node_modules/@earendil-works/pi-codemode/dist/runtime/remote.d.ts.map +1 -0
  428. package/node_modules/@earendil-works/pi-codemode/dist/runtime/remote.js +175 -0
  429. package/node_modules/@earendil-works/pi-codemode/dist/runtime/remote.js.map +1 -0
  430. package/node_modules/@earendil-works/pi-codemode/dist/runtime/vm.d.ts +24 -0
  431. package/node_modules/@earendil-works/pi-codemode/dist/runtime/vm.d.ts.map +1 -0
  432. package/node_modules/@earendil-works/pi-codemode/dist/runtime/vm.js +293 -0
  433. package/node_modules/@earendil-works/pi-codemode/dist/runtime/vm.js.map +1 -0
  434. package/node_modules/@earendil-works/pi-codemode/dist/runtime/worker.js +11 -110
  435. package/node_modules/@earendil-works/pi-codemode/dist/runtime/worker.js.map +1 -1
  436. package/node_modules/@earendil-works/pi-codemode/dist/source.d.ts +2 -1
  437. package/node_modules/@earendil-works/pi-codemode/dist/source.d.ts.map +1 -1
  438. package/node_modules/@earendil-works/pi-codemode/dist/source.js +8 -2
  439. package/node_modules/@earendil-works/pi-codemode/dist/source.js.map +1 -1
  440. package/node_modules/@earendil-works/pi-codemode/dist/types.d.ts +101 -6
  441. package/node_modules/@earendil-works/pi-codemode/dist/types.d.ts.map +1 -1
  442. package/node_modules/@earendil-works/pi-codemode/dist/types.js.map +1 -1
  443. package/node_modules/@earendil-works/pi-codemode/package.json +15 -3
  444. package/node_modules/@earendil-works/pi-coding-agent/CHANGELOG.md +165 -0
  445. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/anthropic-messages-Q7SXESRX.js +6 -0
  446. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/anthropic.js +1 -1
  447. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/azure-openai-responses-LM52U7CK.js +2 -0
  448. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/bedrock-converse-stream.js +2 -2
  449. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-22CYIUS4.js +2 -0
  450. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-3ZATHNCK.js +9 -0
  451. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-5GTPJSRI.js +7 -0
  452. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-6MWTY2OB.js +130 -0
  453. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-6QGV3IWD.js +6 -0
  454. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-2KAZSACP.js → chunk-AKJ3ZOR3.js} +1 -1
  455. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-G7EDXK4D.js → chunk-CQ3XTLTY.js} +1 -1
  456. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-SYF2TF6W.js → chunk-D7PHKNBM.js} +29 -92
  457. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-DOST5PQW.js +82 -0
  458. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-DVQEBGVL.js +2 -0
  459. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-ZSI3BL5Q.js → chunk-GDR5JFDJ.js} +1 -1
  460. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-HACVPRBJ.js +11 -0
  461. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-ITZNWD4K.js +2 -0
  462. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-LPXNMA2W.js +2 -0
  463. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-LD2P6SFZ.js → chunk-PMRZO46Y.js} +1 -1
  464. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-RDZVAGPR.js +2 -0
  465. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-ZSBPJAJ2.js → chunk-TJXZSVTD.js} +116 -99
  466. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-BYB6ZAAQ.js → chunk-TN4NLWHF.js} +1 -1
  467. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-WBQBCFWG.js +2 -0
  468. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-WJUNYZC5.js +2 -0
  469. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-XIX7LUWI.js +2 -0
  470. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-ZBURYEWF.js +2 -0
  471. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{cli-KILDDGW3.js → cli-SWM4FQ6V.js} +4 -4
  472. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/cloudflare-workers-ai-system-one-UTBL2KOF.js +2 -0
  473. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/codemode-worker.js +117 -14
  474. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/easter-egg-3d-OX6RUCIS.js +2 -0
  475. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/execute-3CFUPDLS.js +499 -0
  476. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/github-copilot.js +1 -1
  477. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{google-generative-ai-ZOK6CV7D.js → google-generative-ai-DXKP72HC.js} +1 -1
  478. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{google-vertex-VKWZQ3AY.js → google-vertex-W6SIDOVV.js} +1 -1
  479. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/image-resize-worker.js +1 -1
  480. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{llama-cpp-classify-XT44PI3C.js → llama-cpp-classify-FYN623RH.js} +2 -2
  481. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/mistral-conversations-GBMHTSYF.js +5 -0
  482. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/openai-chatgpt.js +1 -1
  483. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/openai-codex-responses-RN6B5UPP.js +10 -0
  484. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/openai-codex.js +1 -1
  485. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{openai-completions-GWHGMQ3T.js → openai-completions-QW2B4SML.js} +1 -1
  486. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/openai-decisions-WVPMQ4JD.js +5 -0
  487. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{openai-responses-EZ7FJ2KL.js → openai-responses-KDJUSIU7.js} +1 -1
  488. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{openrouter-images-ZVXWCSIM.js → openrouter-images-DUPG5DZO.js} +1 -1
  489. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{pi-messages-TM5SOOIW.js → pi-messages-YHKPQIHC.js} +1 -1
  490. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/runtime-366HE7CW.js +2 -0
  491. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/typesafe-system-one-ZSK3RN4B.js +2 -0
  492. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/virtual-modules-GI6FRNLG.js +2 -0
  493. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/cli-runtime.js +1 -1
  494. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/index.js +1 -1
  495. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/rpc-entry.js +1 -1
  496. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.d.ts +2 -1
  497. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.d.ts.map +1 -1
  498. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.js +24 -5
  499. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.js.map +1 -1
  500. package/node_modules/@earendil-works/pi-coding-agent/dist/config.d.ts +18 -1
  501. package/node_modules/@earendil-works/pi-coding-agent/dist/config.d.ts.map +1 -1
  502. package/node_modules/@earendil-works/pi-coding-agent/dist/config.js +44 -6
  503. package/node_modules/@earendil-works/pi-coding-agent/dist/config.js.map +1 -1
  504. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.d.ts +47 -5
  505. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
  506. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.js +148 -78
  507. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.js.map +1 -1
  508. package/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.d.ts.map +1 -1
  509. package/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.js +20 -13
  510. package/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.js.map +1 -1
  511. package/node_modules/@earendil-works/pi-coding-agent/dist/core/bash-executor.d.ts.map +1 -1
  512. package/node_modules/@earendil-works/pi-coding-agent/dist/core/bash-executor.js +42 -52
  513. package/node_modules/@earendil-works/pi-coding-agent/dist/core/bash-executor.js.map +1 -1
  514. package/node_modules/@earendil-works/pi-coding-agent/dist/core/bug-report.d.ts +9 -1
  515. package/node_modules/@earendil-works/pi-coding-agent/dist/core/bug-report.d.ts.map +1 -1
  516. package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/utils.d.ts +6 -0
  517. package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/utils.d.ts.map +1 -1
  518. package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/utils.js +7 -8
  519. package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/utils.js.map +1 -1
  520. package/node_modules/@earendil-works/pi-coding-agent/dist/core/export-html/tool-renderer.d.ts.map +1 -1
  521. package/node_modules/@earendil-works/pi-coding-agent/dist/core/export-html/tool-renderer.js +2 -0
  522. package/node_modules/@earendil-works/pi-coding-agent/dist/core/export-html/tool-renderer.js.map +1 -1
  523. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/index.d.ts +1 -1
  524. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/index.d.ts.map +1 -1
  525. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/index.js.map +1 -1
  526. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.d.ts +4 -2
  527. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
  528. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.js +2 -3
  529. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
  530. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/types.d.ts +44 -7
  531. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -1
  532. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/types.js.map +1 -1
  533. package/node_modules/@earendil-works/pi-coding-agent/dist/core/key-id-schema.d.ts +6 -0
  534. package/node_modules/@earendil-works/pi-coding-agent/dist/core/key-id-schema.d.ts.map +1 -0
  535. package/node_modules/@earendil-works/pi-coding-agent/dist/core/key-id-schema.js +16 -0
  536. package/node_modules/@earendil-works/pi-coding-agent/dist/core/key-id-schema.js.map +1 -0
  537. package/node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings-schema.d.ts +4 -0
  538. package/node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings-schema.d.ts.map +1 -0
  539. package/node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings-schema.js +16 -0
  540. package/node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings-schema.js.map +1 -0
  541. package/node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings.d.ts +198 -66
  542. package/node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings.d.ts.map +1 -1
  543. package/node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings.js +26 -23
  544. package/node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings.js.map +1 -1
  545. package/node_modules/@earendil-works/pi-coding-agent/dist/core/mcp-servers.d.ts +8 -0
  546. package/node_modules/@earendil-works/pi-coding-agent/dist/core/mcp-servers.d.ts.map +1 -1
  547. package/node_modules/@earendil-works/pi-coding-agent/dist/core/mcp-servers.js +30 -7
  548. package/node_modules/@earendil-works/pi-coding-agent/dist/core/mcp-servers.js.map +1 -1
  549. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-config.d.ts +695 -74
  550. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-config.d.ts.map +1 -1
  551. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-config.js +16 -166
  552. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-config.js.map +1 -1
  553. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-resolver.js +1 -1
  554. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-resolver.js.map +1 -1
  555. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-runtime.d.ts.map +1 -1
  556. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-runtime.js +13 -7
  557. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-runtime.js.map +1 -1
  558. package/node_modules/@earendil-works/pi-coding-agent/dist/core/nested-tool-calls.d.ts +1 -0
  559. package/node_modules/@earendil-works/pi-coding-agent/dist/core/nested-tool-calls.d.ts.map +1 -1
  560. package/node_modules/@earendil-works/pi-coding-agent/dist/core/nested-tool-calls.js +1 -0
  561. package/node_modules/@earendil-works/pi-coding-agent/dist/core/nested-tool-calls.js.map +1 -1
  562. package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.d.ts.map +1 -1
  563. package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.js +3 -3
  564. package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.js.map +1 -1
  565. package/node_modules/@earendil-works/pi-coding-agent/dist/core/project-trust.d.ts.map +1 -1
  566. package/node_modules/@earendil-works/pi-coding-agent/dist/core/project-trust.js +2 -1
  567. package/node_modules/@earendil-works/pi-coding-agent/dist/core/project-trust.js.map +1 -1
  568. package/node_modules/@earendil-works/pi-coding-agent/dist/core/remote-catalog-provider.d.ts +12 -1
  569. package/node_modules/@earendil-works/pi-coding-agent/dist/core/remote-catalog-provider.d.ts.map +1 -1
  570. package/node_modules/@earendil-works/pi-coding-agent/dist/core/remote-catalog-provider.js +82 -24
  571. package/node_modules/@earendil-works/pi-coding-agent/dist/core/remote-catalog-provider.js.map +1 -1
  572. package/node_modules/@earendil-works/pi-coding-agent/dist/core/resource-loader.d.ts +3 -0
  573. package/node_modules/@earendil-works/pi-coding-agent/dist/core/resource-loader.d.ts.map +1 -1
  574. package/node_modules/@earendil-works/pi-coding-agent/dist/core/resource-loader.js +9 -4
  575. package/node_modules/@earendil-works/pi-coding-agent/dist/core/resource-loader.js.map +1 -1
  576. package/node_modules/@earendil-works/pi-coding-agent/dist/core/sdk.d.ts +13 -4
  577. package/node_modules/@earendil-works/pi-coding-agent/dist/core/sdk.d.ts.map +1 -1
  578. package/node_modules/@earendil-works/pi-coding-agent/dist/core/sdk.js +19 -6
  579. package/node_modules/@earendil-works/pi-coding-agent/dist/core/sdk.js.map +1 -1
  580. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-defaults.d.ts +65 -0
  581. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-defaults.d.ts.map +1 -0
  582. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-defaults.js +66 -0
  583. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-defaults.js.map +1 -0
  584. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-manager.d.ts +15 -145
  585. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
  586. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-manager.js +85 -57
  587. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
  588. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-schema.d.ts +228 -0
  589. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-schema.d.ts.map +1 -0
  590. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-schema.js +287 -0
  591. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-schema.js.map +1 -0
  592. package/node_modules/@earendil-works/pi-coding-agent/dist/core/skills.d.ts +4 -1
  593. package/node_modules/@earendil-works/pi-coding-agent/dist/core/skills.d.ts.map +1 -1
  594. package/node_modules/@earendil-works/pi-coding-agent/dist/core/skills.js +6 -1
  595. package/node_modules/@earendil-works/pi-coding-agent/dist/core/skills.js.map +1 -1
  596. package/node_modules/@earendil-works/pi-coding-agent/dist/core/system-prompt.d.ts +6 -0
  597. package/node_modules/@earendil-works/pi-coding-agent/dist/core/system-prompt.d.ts.map +1 -1
  598. package/node_modules/@earendil-works/pi-coding-agent/dist/core/system-prompt.js +9 -4
  599. package/node_modules/@earendil-works/pi-coding-agent/dist/core/system-prompt.js.map +1 -1
  600. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/output-accumulator.d.ts.map +1 -1
  601. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/output-accumulator.js +4 -10
  602. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/output-accumulator.js.map +1 -1
  603. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.d.ts +13 -0
  604. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.d.ts.map +1 -1
  605. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.js +18 -1
  606. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.js.map +1 -1
  607. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/render-utils.d.ts +18 -0
  608. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/render-utils.d.ts.map +1 -1
  609. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/render-utils.js +46 -0
  610. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/render-utils.js.map +1 -1
  611. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/renderers/bash.d.ts.map +1 -1
  612. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/renderers/bash.js +7 -35
  613. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/renderers/bash.js.map +1 -1
  614. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/renderers/edit.d.ts.map +1 -1
  615. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/renderers/edit.js +5 -4
  616. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/renderers/edit.js.map +1 -1
  617. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/execute.d.ts.map +1 -1
  618. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/execute.js +165 -48
  619. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/execute.js.map +1 -1
  620. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/index.d.ts.map +1 -1
  621. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/index.js +3 -1
  622. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/index.js.map +1 -1
  623. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/renderer.d.ts +2 -2
  624. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/renderer.d.ts.map +1 -1
  625. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/renderer.js +9 -3
  626. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/renderer.js.map +1 -1
  627. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/tool.d.ts +15 -14
  628. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/tool.d.ts.map +1 -1
  629. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/tool.js +58 -38
  630. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/codemode/tool.js.map +1 -1
  631. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/llama/provider.d.ts.map +1 -1
  632. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/llama/provider.js +34 -11
  633. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/llama/provider.js.map +1 -1
  634. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/cli.js +22 -31
  635. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/cli.js.map +1 -1
  636. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/index.d.ts.map +1 -1
  637. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/index.js +188 -84
  638. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/index.js.map +1 -1
  639. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/oauth.d.ts +5 -3
  640. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/oauth.d.ts.map +1 -1
  641. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/oauth.js +36 -10
  642. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/oauth.js.map +1 -1
  643. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/resources.d.ts +3 -10
  644. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/resources.d.ts.map +1 -1
  645. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/resources.js +4 -5
  646. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/resources.js.map +1 -1
  647. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/runtime.d.ts +7 -7
  648. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/runtime.d.ts.map +1 -1
  649. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/runtime.js +26 -44
  650. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/runtime.js.map +1 -1
  651. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/tools.d.ts +4 -4
  652. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/tools.d.ts.map +1 -1
  653. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/tools.js +68 -16
  654. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/tools.js.map +1 -1
  655. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/ui.d.ts +3 -3
  656. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/ui.d.ts.map +1 -1
  657. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/ui.js +10 -2
  658. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/ui.js.map +1 -1
  659. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/tool-search/tool.d.ts +0 -2
  660. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/tool-search/tool.d.ts.map +1 -1
  661. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/tool-search/tool.js +2 -4
  662. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/tool-search/tool.js.map +1 -1
  663. package/node_modules/@earendil-works/pi-coding-agent/dist/index.d.ts +1 -1
  664. package/node_modules/@earendil-works/pi-coding-agent/dist/index.d.ts.map +1 -1
  665. package/node_modules/@earendil-works/pi-coding-agent/dist/index.js.map +1 -1
  666. package/node_modules/@earendil-works/pi-coding-agent/dist/main.d.ts.map +1 -1
  667. package/node_modules/@earendil-works/pi-coding-agent/dist/main.js +4 -3
  668. package/node_modules/@earendil-works/pi-coding-agent/dist/main.js.map +1 -1
  669. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/bash-execution.d.ts +5 -1
  670. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
  671. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/bash-execution.js +17 -14
  672. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/bash-execution.js.map +1 -1
  673. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.d.ts +2 -1
  674. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
  675. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.js +5 -2
  676. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
  677. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.d.ts +2 -1
  678. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
  679. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.js +5 -2
  680. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
  681. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/custom-entry.d.ts +3 -1
  682. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/custom-entry.d.ts.map +1 -1
  683. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/custom-entry.js +8 -2
  684. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/custom-entry.js.map +1 -1
  685. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  686. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/custom-message.js +1 -0
  687. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/custom-message.js.map +1 -1
  688. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  689. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/settings-selector.js +4 -3
  690. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/settings-selector.js.map +1 -1
  691. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts +2 -1
  692. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
  693. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.js +5 -2
  694. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
  695. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/status-indicator.d.ts +1 -1
  696. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
  697. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/status-indicator.js +2 -2
  698. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/status-indicator.js.map +1 -1
  699. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts +5 -0
  700. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  701. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +10 -0
  702. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
  703. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +9 -0
  704. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  705. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js +103 -40
  706. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
  707. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/program-status-reporter.d.ts +34 -0
  708. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/program-status-reporter.d.ts.map +1 -0
  709. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/program-status-reporter.js +110 -0
  710. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/program-status-reporter.js.map +1 -0
  711. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/dark.json +1 -1
  712. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/light.json +1 -1
  713. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-schema.d.ts +28 -0
  714. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -0
  715. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-schema.js +105 -0
  716. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-schema.js.map +1 -0
  717. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-tokens.d.ts +257 -0
  718. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-tokens.d.ts.map +1 -0
  719. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-tokens.js +94 -0
  720. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-tokens.js.map +1 -0
  721. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts +13 -16
  722. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  723. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.js +22 -29
  724. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.js.map +1 -1
  725. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/print-mode.d.ts.map +1 -1
  726. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/print-mode.js +4 -0
  727. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/print-mode.js.map +1 -1
  728. package/node_modules/@earendil-works/pi-coding-agent/dist/package-manager-cli.d.ts.map +1 -1
  729. package/node_modules/@earendil-works/pi-coding-agent/dist/package-manager-cli.js +24 -0
  730. package/node_modules/@earendil-works/pi-coding-agent/dist/package-manager-cli.js.map +1 -1
  731. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/ansi.d.ts +8 -0
  732. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/ansi.d.ts.map +1 -1
  733. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/ansi.js +30 -11
  734. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/ansi.js.map +1 -1
  735. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/clipboard.d.ts.map +1 -1
  736. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/clipboard.js +18 -12
  737. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/clipboard.js.map +1 -1
  738. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-core.d.ts +12 -0
  739. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-core.d.ts.map +1 -1
  740. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-core.js +5 -0
  741. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-core.js.map +1 -1
  742. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-worker.js +3 -2
  743. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-worker.js.map +1 -1
  744. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize.d.ts.map +1 -1
  745. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize.js +9 -10
  746. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize.js.map +1 -1
  747. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/output-files.d.ts +15 -0
  748. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/output-files.d.ts.map +1 -0
  749. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/output-files.js +30 -0
  750. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/output-files.js.map +1 -0
  751. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/syntax-highlight.d.ts.map +1 -1
  752. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/syntax-highlight.js +6 -1
  753. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/syntax-highlight.js.map +1 -1
  754. package/node_modules/@earendil-works/pi-coding-agent/docs/cli-integration.md +1 -1
  755. package/node_modules/@earendil-works/pi-coding-agent/docs/cli.md +19 -7
  756. package/node_modules/@earendil-works/pi-coding-agent/docs/codemode.md +30 -9
  757. package/node_modules/@earendil-works/pi-coding-agent/docs/compaction.md +2 -2
  758. package/node_modules/@earendil-works/pi-coding-agent/docs/environment-variables.md +3 -1
  759. package/node_modules/@earendil-works/pi-coding-agent/docs/extensions.md +7 -4
  760. package/node_modules/@earendil-works/pi-coding-agent/docs/json.md +3 -3
  761. package/node_modules/@earendil-works/pi-coding-agent/docs/keybindings.md +5 -4
  762. package/node_modules/@earendil-works/pi-coding-agent/docs/llama-cpp.md +8 -1
  763. package/node_modules/@earendil-works/pi-coding-agent/docs/mcp.md +4 -2
  764. package/node_modules/@earendil-works/pi-coding-agent/docs/message-types.md +22 -4
  765. package/node_modules/@earendil-works/pi-coding-agent/docs/models.md +5 -1
  766. package/node_modules/@earendil-works/pi-coding-agent/docs/providers.md +47 -0
  767. package/node_modules/@earendil-works/pi-coding-agent/docs/settings.md +6 -4
  768. package/node_modules/@earendil-works/pi-coding-agent/docs/terminal-setup.md +14 -0
  769. package/node_modules/@earendil-works/pi-coding-agent/docs/themes.md +4 -2
  770. package/node_modules/@earendil-works/pi-coding-agent/docs/tui.md +1 -1
  771. package/node_modules/@earendil-works/pi-coding-agent/examples/README.md +0 -3
  772. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  773. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-anthropic/package.json +1 -1
  774. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  775. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/dynamic-resources/dynamic.json +1 -1
  776. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/gondolin/package-lock.json +2 -2
  777. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/gondolin/package.json +1 -1
  778. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/overlay-test.ts +2 -2
  779. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/plan-mode/index.ts +6 -2
  780. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/sandbox/package-lock.json +2 -2
  781. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/sandbox/package.json +1 -1
  782. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/with-deps/package-lock.json +2 -2
  783. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/with-deps/package.json +1 -1
  784. package/node_modules/@earendil-works/pi-coding-agent/package.json +10 -21
  785. package/node_modules/@earendil-works/pi-coding-agent/schemas/keybindings.schema.json +393 -0
  786. package/node_modules/@earendil-works/pi-coding-agent/schemas/models.schema.json +1157 -0
  787. package/node_modules/@earendil-works/pi-coding-agent/schemas/settings.schema.json +765 -0
  788. package/node_modules/@earendil-works/pi-coding-agent/schemas/theme.schema.json +365 -0
  789. package/node_modules/@earendil-works/pi-durable/CHANGELOG.md +114 -0
  790. package/node_modules/@earendil-works/pi-durable/README.md +164 -12
  791. package/node_modules/@earendil-works/pi-durable/dist/codemode/codemode.d.ts +173 -0
  792. package/node_modules/@earendil-works/pi-durable/dist/codemode/codemode.d.ts.map +1 -0
  793. package/node_modules/@earendil-works/pi-durable/dist/codemode/codemode.js +886 -0
  794. package/node_modules/@earendil-works/pi-durable/dist/codemode/codemode.js.map +1 -0
  795. package/node_modules/@earendil-works/pi-durable/dist/codemode/describe.d.ts +38 -0
  796. package/node_modules/@earendil-works/pi-durable/dist/codemode/describe.d.ts.map +1 -0
  797. package/node_modules/@earendil-works/pi-durable/dist/codemode/describe.js +119 -0
  798. package/node_modules/@earendil-works/pi-durable/dist/codemode/describe.js.map +1 -0
  799. package/node_modules/@earendil-works/pi-durable/dist/codemode/index.d.ts +3 -0
  800. package/node_modules/@earendil-works/pi-durable/dist/codemode/index.d.ts.map +1 -0
  801. package/node_modules/@earendil-works/pi-durable/dist/codemode/index.js +3 -0
  802. package/node_modules/@earendil-works/pi-durable/dist/codemode/index.js.map +1 -0
  803. package/node_modules/@earendil-works/pi-durable/dist/codemode/models.d.ts +28 -0
  804. package/node_modules/@earendil-works/pi-durable/dist/codemode/models.d.ts.map +1 -0
  805. package/node_modules/@earendil-works/pi-durable/dist/codemode/models.js +231 -0
  806. package/node_modules/@earendil-works/pi-durable/dist/codemode/models.js.map +1 -0
  807. package/node_modules/@earendil-works/pi-durable/dist/codemode/output.d.ts +41 -0
  808. package/node_modules/@earendil-works/pi-durable/dist/codemode/output.d.ts.map +1 -0
  809. package/node_modules/@earendil-works/pi-durable/dist/codemode/output.js +167 -0
  810. package/node_modules/@earendil-works/pi-durable/dist/codemode/output.js.map +1 -0
  811. package/node_modules/@earendil-works/pi-durable/dist/env/decode.d.ts +16 -0
  812. package/node_modules/@earendil-works/pi-durable/dist/env/decode.d.ts.map +1 -0
  813. package/node_modules/@earendil-works/pi-durable/dist/env/decode.js +28 -0
  814. package/node_modules/@earendil-works/pi-durable/dist/env/decode.js.map +1 -0
  815. package/node_modules/@earendil-works/pi-durable/dist/env/index.d.ts +197 -3
  816. package/node_modules/@earendil-works/pi-durable/dist/env/index.d.ts.map +1 -1
  817. package/node_modules/@earendil-works/pi-durable/dist/env/index.js +2 -0
  818. package/node_modules/@earendil-works/pi-durable/dist/env/index.js.map +1 -1
  819. package/node_modules/@earendil-works/pi-durable/dist/env/line-scan.d.ts +13 -0
  820. package/node_modules/@earendil-works/pi-durable/dist/env/line-scan.d.ts.map +1 -0
  821. package/node_modules/@earendil-works/pi-durable/dist/env/line-scan.js +147 -0
  822. package/node_modules/@earendil-works/pi-durable/dist/env/line-scan.js.map +1 -0
  823. package/node_modules/@earendil-works/pi-durable/dist/env/node-watch.d.ts +29 -0
  824. package/node_modules/@earendil-works/pi-durable/dist/env/node-watch.d.ts.map +1 -0
  825. package/node_modules/@earendil-works/pi-durable/dist/env/node-watch.js +485 -0
  826. package/node_modules/@earendil-works/pi-durable/dist/env/node-watch.js.map +1 -0
  827. package/node_modules/@earendil-works/pi-durable/dist/env/node.d.ts +11 -2
  828. package/node_modules/@earendil-works/pi-durable/dist/env/node.d.ts.map +1 -1
  829. package/node_modules/@earendil-works/pi-durable/dist/env/node.js +284 -21
  830. package/node_modules/@earendil-works/pi-durable/dist/env/node.js.map +1 -1
  831. package/node_modules/@earendil-works/pi-durable/dist/errors.d.ts +20 -3
  832. package/node_modules/@earendil-works/pi-durable/dist/errors.d.ts.map +1 -1
  833. package/node_modules/@earendil-works/pi-durable/dist/errors.js +34 -5
  834. package/node_modules/@earendil-works/pi-durable/dist/errors.js.map +1 -1
  835. package/node_modules/@earendil-works/pi-durable/dist/harness/agent.d.ts +7 -3
  836. package/node_modules/@earendil-works/pi-durable/dist/harness/agent.d.ts.map +1 -1
  837. package/node_modules/@earendil-works/pi-durable/dist/harness/agent.js +81 -25
  838. package/node_modules/@earendil-works/pi-durable/dist/harness/agent.js.map +1 -1
  839. package/node_modules/@earendil-works/pi-durable/dist/harness/compaction.d.ts +6 -1
  840. package/node_modules/@earendil-works/pi-durable/dist/harness/compaction.d.ts.map +1 -1
  841. package/node_modules/@earendil-works/pi-durable/dist/harness/compaction.js +11 -8
  842. package/node_modules/@earendil-works/pi-durable/dist/harness/compaction.js.map +1 -1
  843. package/node_modules/@earendil-works/pi-durable/dist/harness/context.d.ts +29 -1
  844. package/node_modules/@earendil-works/pi-durable/dist/harness/context.d.ts.map +1 -1
  845. package/node_modules/@earendil-works/pi-durable/dist/harness/context.js +125 -24
  846. package/node_modules/@earendil-works/pi-durable/dist/harness/context.js.map +1 -1
  847. package/node_modules/@earendil-works/pi-durable/dist/harness/events.d.ts +35 -15
  848. package/node_modules/@earendil-works/pi-durable/dist/harness/events.d.ts.map +1 -1
  849. package/node_modules/@earendil-works/pi-durable/dist/harness/events.js +77 -23
  850. package/node_modules/@earendil-works/pi-durable/dist/harness/events.js.map +1 -1
  851. package/node_modules/@earendil-works/pi-durable/dist/harness/generation.d.ts +2 -0
  852. package/node_modules/@earendil-works/pi-durable/dist/harness/generation.d.ts.map +1 -1
  853. package/node_modules/@earendil-works/pi-durable/dist/harness/generation.js +40 -16
  854. package/node_modules/@earendil-works/pi-durable/dist/harness/generation.js.map +1 -1
  855. package/node_modules/@earendil-works/pi-durable/dist/harness/harness.d.ts +7 -0
  856. package/node_modules/@earendil-works/pi-durable/dist/harness/harness.d.ts.map +1 -1
  857. package/node_modules/@earendil-works/pi-durable/dist/harness/harness.js +56 -28
  858. package/node_modules/@earendil-works/pi-durable/dist/harness/harness.js.map +1 -1
  859. package/node_modules/@earendil-works/pi-durable/dist/harness/inbox.d.ts +16 -4
  860. package/node_modules/@earendil-works/pi-durable/dist/harness/inbox.d.ts.map +1 -1
  861. package/node_modules/@earendil-works/pi-durable/dist/harness/inbox.js +26 -3
  862. package/node_modules/@earendil-works/pi-durable/dist/harness/inbox.js.map +1 -1
  863. package/node_modules/@earendil-works/pi-durable/dist/harness/live.d.ts +74 -17
  864. package/node_modules/@earendil-works/pi-durable/dist/harness/live.d.ts.map +1 -1
  865. package/node_modules/@earendil-works/pi-durable/dist/harness/live.js +66 -14
  866. package/node_modules/@earendil-works/pi-durable/dist/harness/live.js.map +1 -1
  867. package/node_modules/@earendil-works/pi-durable/dist/harness/output.d.ts +13 -6
  868. package/node_modules/@earendil-works/pi-durable/dist/harness/output.d.ts.map +1 -1
  869. package/node_modules/@earendil-works/pi-durable/dist/harness/output.js +75 -18
  870. package/node_modules/@earendil-works/pi-durable/dist/harness/output.js.map +1 -1
  871. package/node_modules/@earendil-works/pi-durable/dist/harness/scheduler.d.ts +18 -5
  872. package/node_modules/@earendil-works/pi-durable/dist/harness/scheduler.d.ts.map +1 -1
  873. package/node_modules/@earendil-works/pi-durable/dist/harness/scheduler.js +794 -168
  874. package/node_modules/@earendil-works/pi-durable/dist/harness/scheduler.js.map +1 -1
  875. package/node_modules/@earendil-works/pi-durable/dist/harness/submissions.d.ts +7 -4
  876. package/node_modules/@earendil-works/pi-durable/dist/harness/submissions.d.ts.map +1 -1
  877. package/node_modules/@earendil-works/pi-durable/dist/harness/submissions.js +32 -13
  878. package/node_modules/@earendil-works/pi-durable/dist/harness/submissions.js.map +1 -1
  879. package/node_modules/@earendil-works/pi-durable/dist/harness/task-graph.d.ts +1 -1
  880. package/node_modules/@earendil-works/pi-durable/dist/harness/task-graph.d.ts.map +1 -1
  881. package/node_modules/@earendil-works/pi-durable/dist/harness/task-graph.js +15 -10
  882. package/node_modules/@earendil-works/pi-durable/dist/harness/task-graph.js.map +1 -1
  883. package/node_modules/@earendil-works/pi-durable/dist/harness/tool.d.ts +45 -5
  884. package/node_modules/@earendil-works/pi-durable/dist/harness/tool.d.ts.map +1 -1
  885. package/node_modules/@earendil-works/pi-durable/dist/harness/tool.js +400 -67
  886. package/node_modules/@earendil-works/pi-durable/dist/harness/tool.js.map +1 -1
  887. package/node_modules/@earendil-works/pi-durable/dist/harness/types.d.ts +194 -17
  888. package/node_modules/@earendil-works/pi-durable/dist/harness/types.d.ts.map +1 -1
  889. package/node_modules/@earendil-works/pi-durable/dist/harness/types.js.map +1 -1
  890. package/node_modules/@earendil-works/pi-durable/dist/harness/util.d.ts +6 -1
  891. package/node_modules/@earendil-works/pi-durable/dist/harness/util.d.ts.map +1 -1
  892. package/node_modules/@earendil-works/pi-durable/dist/harness/util.js +5 -2
  893. package/node_modules/@earendil-works/pi-durable/dist/harness/util.js.map +1 -1
  894. package/node_modules/@earendil-works/pi-durable/dist/harness/view.d.ts +6 -2
  895. package/node_modules/@earendil-works/pi-durable/dist/harness/view.d.ts.map +1 -1
  896. package/node_modules/@earendil-works/pi-durable/dist/harness/view.js +22 -12
  897. package/node_modules/@earendil-works/pi-durable/dist/harness/view.js.map +1 -1
  898. package/node_modules/@earendil-works/pi-durable/dist/images/cloudflare.d.ts +4 -0
  899. package/node_modules/@earendil-works/pi-durable/dist/images/cloudflare.d.ts.map +1 -0
  900. package/node_modules/@earendil-works/pi-durable/dist/images/cloudflare.js +9 -0
  901. package/node_modules/@earendil-works/pi-durable/dist/images/cloudflare.js.map +1 -0
  902. package/node_modules/@earendil-works/pi-durable/dist/images/exif.d.ts +3 -0
  903. package/node_modules/@earendil-works/pi-durable/dist/images/exif.d.ts.map +1 -0
  904. package/node_modules/@earendil-works/pi-durable/dist/images/exif.js +71 -0
  905. package/node_modules/@earendil-works/pi-durable/dist/images/exif.js.map +1 -0
  906. package/node_modules/@earendil-works/pi-durable/dist/images/index.d.ts +18 -0
  907. package/node_modules/@earendil-works/pi-durable/dist/images/index.d.ts.map +1 -0
  908. package/node_modules/@earendil-works/pi-durable/dist/images/index.js +125 -0
  909. package/node_modules/@earendil-works/pi-durable/dist/images/index.js.map +1 -0
  910. package/node_modules/@earendil-works/pi-durable/dist/images/node-worker.d.ts +17 -0
  911. package/node_modules/@earendil-works/pi-durable/dist/images/node-worker.d.ts.map +1 -0
  912. package/node_modules/@earendil-works/pi-durable/dist/images/node-worker.js +16 -0
  913. package/node_modules/@earendil-works/pi-durable/dist/images/node-worker.js.map +1 -0
  914. package/node_modules/@earendil-works/pi-durable/dist/images/node.d.ts +21 -0
  915. package/node_modules/@earendil-works/pi-durable/dist/images/node.d.ts.map +1 -0
  916. package/node_modules/@earendil-works/pi-durable/dist/images/node.js +121 -0
  917. package/node_modules/@earendil-works/pi-durable/dist/images/node.js.map +1 -0
  918. package/node_modules/@earendil-works/pi-durable/dist/index.d.ts +7 -7
  919. package/node_modules/@earendil-works/pi-durable/dist/index.d.ts.map +1 -1
  920. package/node_modules/@earendil-works/pi-durable/dist/index.js +4 -4
  921. package/node_modules/@earendil-works/pi-durable/dist/index.js.map +1 -1
  922. package/node_modules/@earendil-works/pi-durable/dist/search.d.ts +13 -0
  923. package/node_modules/@earendil-works/pi-durable/dist/search.d.ts.map +1 -0
  924. package/node_modules/@earendil-works/pi-durable/dist/search.js +85 -0
  925. package/node_modules/@earendil-works/pi-durable/dist/search.js.map +1 -0
  926. package/node_modules/@earendil-works/pi-durable/dist/session/observation.d.ts +10 -3
  927. package/node_modules/@earendil-works/pi-durable/dist/session/observation.d.ts.map +1 -1
  928. package/node_modules/@earendil-works/pi-durable/dist/session/observation.js +24 -34
  929. package/node_modules/@earendil-works/pi-durable/dist/session/observation.js.map +1 -1
  930. package/node_modules/@earendil-works/pi-durable/dist/session/session.d.ts +71 -6
  931. package/node_modules/@earendil-works/pi-durable/dist/session/session.d.ts.map +1 -1
  932. package/node_modules/@earendil-works/pi-durable/dist/session/session.js +463 -50
  933. package/node_modules/@earendil-works/pi-durable/dist/session/session.js.map +1 -1
  934. package/node_modules/@earendil-works/pi-durable/dist/session/transaction.d.ts +2 -0
  935. package/node_modules/@earendil-works/pi-durable/dist/session/transaction.d.ts.map +1 -1
  936. package/node_modules/@earendil-works/pi-durable/dist/session/transaction.js +19 -1
  937. package/node_modules/@earendil-works/pi-durable/dist/session/transaction.js.map +1 -1
  938. package/node_modules/@earendil-works/pi-durable/dist/storage/jsonl/storage.d.ts +8 -0
  939. package/node_modules/@earendil-works/pi-durable/dist/storage/jsonl/storage.d.ts.map +1 -1
  940. package/node_modules/@earendil-works/pi-durable/dist/storage/jsonl/storage.js +2 -1
  941. package/node_modules/@earendil-works/pi-durable/dist/storage/jsonl/storage.js.map +1 -1
  942. package/node_modules/@earendil-works/pi-durable/dist/storage/memory.d.ts +2 -0
  943. package/node_modules/@earendil-works/pi-durable/dist/storage/memory.d.ts.map +1 -1
  944. package/node_modules/@earendil-works/pi-durable/dist/storage/memory.js +79 -27
  945. package/node_modules/@earendil-works/pi-durable/dist/storage/memory.js.map +1 -1
  946. package/node_modules/@earendil-works/pi-durable/dist/storage/scan.d.ts +18 -0
  947. package/node_modules/@earendil-works/pi-durable/dist/storage/scan.d.ts.map +1 -0
  948. package/node_modules/@earendil-works/pi-durable/dist/storage/scan.js +29 -0
  949. package/node_modules/@earendil-works/pi-durable/dist/storage/scan.js.map +1 -0
  950. package/node_modules/@earendil-works/pi-durable/dist/storage/sqlite/cloudflare.d.ts +46 -0
  951. package/node_modules/@earendil-works/pi-durable/dist/storage/sqlite/cloudflare.d.ts.map +1 -0
  952. package/node_modules/@earendil-works/pi-durable/dist/storage/sqlite/cloudflare.js +106 -0
  953. package/node_modules/@earendil-works/pi-durable/dist/storage/sqlite/cloudflare.js.map +1 -0
  954. package/node_modules/@earendil-works/pi-durable/dist/storage/sqlite/storage.d.ts +2 -0
  955. package/node_modules/@earendil-works/pi-durable/dist/storage/sqlite/storage.d.ts.map +1 -1
  956. package/node_modules/@earendil-works/pi-durable/dist/storage/sqlite/storage.js +77 -27
  957. package/node_modules/@earendil-works/pi-durable/dist/storage/sqlite/storage.js.map +1 -1
  958. package/node_modules/@earendil-works/pi-durable/dist/testing/env-conformance.d.ts +7 -0
  959. package/node_modules/@earendil-works/pi-durable/dist/testing/env-conformance.d.ts.map +1 -0
  960. package/node_modules/@earendil-works/pi-durable/dist/testing/env-conformance.js +531 -0
  961. package/node_modules/@earendil-works/pi-durable/dist/testing/env-conformance.js.map +1 -0
  962. package/node_modules/@earendil-works/pi-durable/dist/testing/index.d.ts +3 -2
  963. package/node_modules/@earendil-works/pi-durable/dist/testing/index.d.ts.map +1 -1
  964. package/node_modules/@earendil-works/pi-durable/dist/testing/index.js +2 -1
  965. package/node_modules/@earendil-works/pi-durable/dist/testing/index.js.map +1 -1
  966. package/node_modules/@earendil-works/pi-durable/dist/testing/runner.d.ts +4 -2
  967. package/node_modules/@earendil-works/pi-durable/dist/testing/runner.d.ts.map +1 -1
  968. package/node_modules/@earendil-works/pi-durable/dist/testing/runner.js +9 -0
  969. package/node_modules/@earendil-works/pi-durable/dist/testing/runner.js.map +1 -1
  970. package/node_modules/@earendil-works/pi-durable/dist/testing/storage-conformance.d.ts.map +1 -1
  971. package/node_modules/@earendil-works/pi-durable/dist/testing/storage-conformance.js +61 -2
  972. package/node_modules/@earendil-works/pi-durable/dist/testing/storage-conformance.js.map +1 -1
  973. package/node_modules/@earendil-works/pi-durable/dist/testing/types.d.ts +20 -0
  974. package/node_modules/@earendil-works/pi-durable/dist/testing/types.d.ts.map +1 -1
  975. package/node_modules/@earendil-works/pi-durable/dist/testing/types.js.map +1 -1
  976. package/node_modules/@earendil-works/pi-durable/dist/tool-search/index.d.ts +2 -0
  977. package/node_modules/@earendil-works/pi-durable/dist/tool-search/index.d.ts.map +1 -0
  978. package/node_modules/@earendil-works/pi-durable/dist/tool-search/index.js +2 -0
  979. package/node_modules/@earendil-works/pi-durable/dist/tool-search/index.js.map +1 -0
  980. package/node_modules/@earendil-works/pi-durable/dist/tool-search/tool-search.d.ts +23 -0
  981. package/node_modules/@earendil-works/pi-durable/dist/tool-search/tool-search.d.ts.map +1 -0
  982. package/node_modules/@earendil-works/pi-durable/dist/tool-search/tool-search.js +84 -0
  983. package/node_modules/@earendil-works/pi-durable/dist/tool-search/tool-search.js.map +1 -0
  984. package/node_modules/@earendil-works/pi-durable/dist/tools/bash.d.ts +30 -3
  985. package/node_modules/@earendil-works/pi-durable/dist/tools/bash.d.ts.map +1 -1
  986. package/node_modules/@earendil-works/pi-durable/dist/tools/bash.js +105 -37
  987. package/node_modules/@earendil-works/pi-durable/dist/tools/bash.js.map +1 -1
  988. package/node_modules/@earendil-works/pi-durable/dist/tools/edit.js +1 -1
  989. package/node_modules/@earendil-works/pi-durable/dist/tools/edit.js.map +1 -1
  990. package/node_modules/@earendil-works/pi-durable/dist/tools/image-processor.d.ts +47 -0
  991. package/node_modules/@earendil-works/pi-durable/dist/tools/image-processor.d.ts.map +1 -0
  992. package/node_modules/@earendil-works/pi-durable/dist/tools/image-processor.js +30 -0
  993. package/node_modules/@earendil-works/pi-durable/dist/tools/image-processor.js.map +1 -0
  994. package/node_modules/@earendil-works/pi-durable/dist/tools/image.d.ts +18 -0
  995. package/node_modules/@earendil-works/pi-durable/dist/tools/image.d.ts.map +1 -1
  996. package/node_modules/@earendil-works/pi-durable/dist/tools/image.js +86 -0
  997. package/node_modules/@earendil-works/pi-durable/dist/tools/image.js.map +1 -1
  998. package/node_modules/@earendil-works/pi-durable/dist/tools/index.d.ts +26 -3
  999. package/node_modules/@earendil-works/pi-durable/dist/tools/index.d.ts.map +1 -1
  1000. package/node_modules/@earendil-works/pi-durable/dist/tools/index.js +14 -6
  1001. package/node_modules/@earendil-works/pi-durable/dist/tools/index.js.map +1 -1
  1002. package/node_modules/@earendil-works/pi-durable/dist/tools/read.d.ts +10 -2
  1003. package/node_modules/@earendil-works/pi-durable/dist/tools/read.d.ts.map +1 -1
  1004. package/node_modules/@earendil-works/pi-durable/dist/tools/read.js +212 -78
  1005. package/node_modules/@earendil-works/pi-durable/dist/tools/read.js.map +1 -1
  1006. package/node_modules/@earendil-works/pi-durable/dist/tools/write.js +1 -1
  1007. package/node_modules/@earendil-works/pi-durable/dist/tools/write.js.map +1 -1
  1008. package/node_modules/@earendil-works/pi-durable/dist/truncate.d.ts +9 -0
  1009. package/node_modules/@earendil-works/pi-durable/dist/truncate.d.ts.map +1 -1
  1010. package/node_modules/@earendil-works/pi-durable/dist/truncate.js +12 -4
  1011. package/node_modules/@earendil-works/pi-durable/dist/truncate.js.map +1 -1
  1012. package/node_modules/@earendil-works/pi-durable/dist/types.d.ts +89 -12
  1013. package/node_modules/@earendil-works/pi-durable/dist/types.d.ts.map +1 -1
  1014. package/node_modules/@earendil-works/pi-durable/dist/types.js.map +1 -1
  1015. package/node_modules/@earendil-works/pi-durable/package.json +50 -5
  1016. package/node_modules/@earendil-works/pi-mcp/CHANGELOG.md +29 -0
  1017. package/node_modules/@earendil-works/pi-mcp/dist/auth-provider.d.ts +4 -0
  1018. package/node_modules/@earendil-works/pi-mcp/dist/auth-provider.d.ts.map +1 -1
  1019. package/node_modules/@earendil-works/pi-mcp/dist/auth-provider.js.map +1 -1
  1020. package/node_modules/@earendil-works/pi-mcp/dist/client.d.ts.map +1 -1
  1021. package/node_modules/@earendil-works/pi-mcp/dist/client.js +9 -5
  1022. package/node_modules/@earendil-works/pi-mcp/dist/client.js.map +1 -1
  1023. package/node_modules/@earendil-works/pi-mcp/dist/index.d.ts +1 -1
  1024. package/node_modules/@earendil-works/pi-mcp/dist/index.d.ts.map +1 -1
  1025. package/node_modules/@earendil-works/pi-mcp/dist/index.js.map +1 -1
  1026. package/node_modules/@earendil-works/pi-mcp/dist/oauth/discovery.d.ts +3 -0
  1027. package/node_modules/@earendil-works/pi-mcp/dist/oauth/discovery.d.ts.map +1 -1
  1028. package/node_modules/@earendil-works/pi-mcp/dist/oauth/discovery.js +8 -5
  1029. package/node_modules/@earendil-works/pi-mcp/dist/oauth/discovery.js.map +1 -1
  1030. package/node_modules/@earendil-works/pi-mcp/dist/oauth/errors.d.ts +3 -2
  1031. package/node_modules/@earendil-works/pi-mcp/dist/oauth/errors.d.ts.map +1 -1
  1032. package/node_modules/@earendil-works/pi-mcp/dist/oauth/errors.js +3 -1
  1033. package/node_modules/@earendil-works/pi-mcp/dist/oauth/errors.js.map +1 -1
  1034. package/node_modules/@earendil-works/pi-mcp/dist/oauth/flow.d.ts +4 -0
  1035. package/node_modules/@earendil-works/pi-mcp/dist/oauth/flow.d.ts.map +1 -1
  1036. package/node_modules/@earendil-works/pi-mcp/dist/oauth/flow.js +35 -7
  1037. package/node_modules/@earendil-works/pi-mcp/dist/oauth/flow.js.map +1 -1
  1038. package/node_modules/@earendil-works/pi-mcp/dist/oauth/types.d.ts +5 -0
  1039. package/node_modules/@earendil-works/pi-mcp/dist/oauth/types.d.ts.map +1 -1
  1040. package/node_modules/@earendil-works/pi-mcp/dist/oauth/types.js.map +1 -1
  1041. package/node_modules/@earendil-works/pi-mcp/dist/protocol/content.d.ts +2 -1
  1042. package/node_modules/@earendil-works/pi-mcp/dist/protocol/content.d.ts.map +1 -1
  1043. package/node_modules/@earendil-works/pi-mcp/dist/protocol/content.js.map +1 -1
  1044. package/node_modules/@earendil-works/pi-mcp/dist/transports/streamable-http.d.ts +9 -2
  1045. package/node_modules/@earendil-works/pi-mcp/dist/transports/streamable-http.d.ts.map +1 -1
  1046. package/node_modules/@earendil-works/pi-mcp/dist/transports/streamable-http.js +28 -19
  1047. package/node_modules/@earendil-works/pi-mcp/dist/transports/streamable-http.js.map +1 -1
  1048. package/node_modules/@earendil-works/pi-mcp/dist/transports/transport.d.ts +9 -1
  1049. package/node_modules/@earendil-works/pi-mcp/dist/transports/transport.d.ts.map +1 -1
  1050. package/node_modules/@earendil-works/pi-mcp/dist/transports/transport.js.map +1 -1
  1051. package/node_modules/@earendil-works/pi-mcp/package.json +2 -2
  1052. package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
  1053. package/node_modules/@earendil-works/pi-tui/README.md +5 -3
  1054. package/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts +1 -0
  1055. package/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts.map +1 -1
  1056. package/node_modules/@earendil-works/pi-tui/dist/components/box.js +4 -0
  1057. package/node_modules/@earendil-works/pi-tui/dist/components/box.js.map +1 -1
  1058. package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts.map +1 -1
  1059. package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +3 -3
  1060. package/node_modules/@earendil-works/pi-tui/dist/components/editor.js.map +1 -1
  1061. package/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts.map +1 -1
  1062. package/node_modules/@earendil-works/pi-tui/dist/components/input.js +4 -4
  1063. package/node_modules/@earendil-works/pi-tui/dist/components/input.js.map +1 -1
  1064. package/node_modules/@earendil-works/pi-tui/dist/components/text.d.ts +1 -0
  1065. package/node_modules/@earendil-works/pi-tui/dist/components/text.d.ts.map +1 -1
  1066. package/node_modules/@earendil-works/pi-tui/dist/components/text.js +4 -0
  1067. package/node_modules/@earendil-works/pi-tui/dist/components/text.js.map +1 -1
  1068. package/node_modules/@earendil-works/pi-tui/dist/index.d.ts +2 -1
  1069. package/node_modules/@earendil-works/pi-tui/dist/index.d.ts.map +1 -1
  1070. package/node_modules/@earendil-works/pi-tui/dist/index.js +3 -1
  1071. package/node_modules/@earendil-works/pi-tui/dist/index.js.map +1 -1
  1072. package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts +4 -4
  1073. package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts.map +1 -1
  1074. package/node_modules/@earendil-works/pi-tui/dist/keybindings.js +4 -4
  1075. package/node_modules/@earendil-works/pi-tui/dist/keybindings.js.map +1 -1
  1076. package/node_modules/@earendil-works/pi-tui/dist/keys.d.ts.map +1 -1
  1077. package/node_modules/@earendil-works/pi-tui/dist/keys.js +52 -20
  1078. package/node_modules/@earendil-works/pi-tui/dist/keys.js.map +1 -1
  1079. package/node_modules/@earendil-works/pi-tui/dist/program-status.d.ts +23 -0
  1080. package/node_modules/@earendil-works/pi-tui/dist/program-status.d.ts.map +1 -0
  1081. package/node_modules/@earendil-works/pi-tui/dist/program-status.js +43 -0
  1082. package/node_modules/@earendil-works/pi-tui/dist/program-status.js.map +1 -0
  1083. package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts +4 -2
  1084. package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts.map +1 -1
  1085. package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js +36 -1
  1086. package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js.map +1 -1
  1087. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts.map +1 -1
  1088. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +5 -0
  1089. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js.map +1 -1
  1090. package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts +17 -0
  1091. package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +1 -1
  1092. package/node_modules/@earendil-works/pi-tui/dist/terminal.js +46 -2
  1093. package/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +1 -1
  1094. package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts +2 -0
  1095. package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts.map +1 -1
  1096. package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js +8 -4
  1097. package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js.map +1 -1
  1098. package/node_modules/@earendil-works/pi-tui/dist/tui-main-screen.d.ts.map +1 -1
  1099. package/node_modules/@earendil-works/pi-tui/dist/tui-main-screen.js +2 -1
  1100. package/node_modules/@earendil-works/pi-tui/dist/tui-main-screen.js.map +1 -1
  1101. package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts +11 -0
  1102. package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +1 -1
  1103. package/node_modules/@earendil-works/pi-tui/dist/tui.js +23 -1
  1104. package/node_modules/@earendil-works/pi-tui/dist/tui.js.map +1 -1
  1105. package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts.map +1 -1
  1106. package/node_modules/@earendil-works/pi-tui/dist/utils.js +5 -2
  1107. package/node_modules/@earendil-works/pi-tui/dist/utils.js.map +1 -1
  1108. package/node_modules/@earendil-works/pi-tui/package.json +1 -1
  1109. package/node_modules/@silvia-odwyer/photon/LICENSE.md +201 -0
  1110. package/node_modules/@silvia-odwyer/photon/README.md +158 -0
  1111. package/node_modules/@silvia-odwyer/photon/package.json +23 -0
  1112. package/node_modules/@silvia-odwyer/photon/photon_rs.d.ts +3443 -0
  1113. package/node_modules/@silvia-odwyer/photon/photon_rs.js +4572 -0
  1114. package/node_modules/@silvia-odwyer/photon/photon_rs_bg.wasm +0 -0
  1115. package/node_modules/@types/node/README.md +1 -1
  1116. package/node_modules/@types/node/crypto.d.ts +2 -2
  1117. package/node_modules/@types/node/dgram.d.ts +1 -1
  1118. package/node_modules/@types/node/package.json +2 -2
  1119. package/node_modules/@types/node/util.d.ts +6 -3
  1120. package/node_modules/@types/node/zlib.d.ts +6 -0
  1121. package/node_modules/hono/README.md +1 -1
  1122. package/node_modules/hono/dist/_virtual/_rolldown/runtime.js +13 -0
  1123. package/node_modules/hono/dist/adapter/aws-lambda/conninfo.js +42 -23
  1124. package/node_modules/hono/dist/adapter/aws-lambda/handler.js +320 -342
  1125. package/node_modules/hono/dist/adapter/aws-lambda/index.js +2 -8
  1126. package/node_modules/hono/dist/adapter/aws-lambda/types.js +1 -0
  1127. package/node_modules/hono/dist/adapter/bun/conninfo.js +20 -25
  1128. package/node_modules/hono/dist/adapter/bun/index.js +3 -13
  1129. package/node_modules/hono/dist/adapter/bun/serve-static.js +27 -27
  1130. package/node_modules/hono/dist/adapter/bun/server.js +11 -5
  1131. package/node_modules/hono/dist/adapter/bun/ssg.js +25 -15
  1132. package/node_modules/hono/dist/adapter/bun/websocket.js +61 -68
  1133. package/node_modules/hono/dist/adapter/cloudflare-pages/conninfo.js +24 -9
  1134. package/node_modules/hono/dist/adapter/cloudflare-pages/handler.js +59 -62
  1135. package/node_modules/hono/dist/adapter/cloudflare-pages/index.js +2 -8
  1136. package/node_modules/hono/dist/adapter/cloudflare-workers/conninfo.js +7 -9
  1137. package/node_modules/hono/dist/adapter/cloudflare-workers/index.js +3 -8
  1138. package/node_modules/hono/dist/adapter/cloudflare-workers/serve-static-module.js +5 -6
  1139. package/node_modules/hono/dist/adapter/cloudflare-workers/serve-static.js +26 -20
  1140. package/node_modules/hono/dist/adapter/cloudflare-workers/utils.js +21 -34
  1141. package/node_modules/hono/dist/adapter/cloudflare-workers/websocket.js +31 -39
  1142. package/node_modules/hono/dist/adapter/deno/conninfo.js +16 -13
  1143. package/node_modules/hono/dist/adapter/deno/deno.d.js +1 -0
  1144. package/node_modules/hono/dist/adapter/deno/index.js +3 -10
  1145. package/node_modules/hono/dist/adapter/deno/serve-static.js +33 -38
  1146. package/node_modules/hono/dist/adapter/deno/ssg.js +27 -16
  1147. package/node_modules/hono/dist/adapter/deno/websocket.js +30 -30
  1148. package/node_modules/hono/dist/adapter/lambda-edge/conninfo.js +7 -9
  1149. package/node_modules/hono/dist/adapter/lambda-edge/handler.js +102 -87
  1150. package/node_modules/hono/dist/adapter/lambda-edge/index.js +2 -6
  1151. package/node_modules/hono/dist/adapter/netlify/conninfo.js +24 -9
  1152. package/node_modules/hono/dist/adapter/netlify/handler.js +10 -8
  1153. package/node_modules/hono/dist/adapter/netlify/index.js +3 -2
  1154. package/node_modules/hono/dist/adapter/netlify/mod.js +2 -6
  1155. package/node_modules/hono/dist/adapter/service-worker/handler.js +15 -19
  1156. package/node_modules/hono/dist/adapter/service-worker/index.js +23 -7
  1157. package/node_modules/hono/dist/adapter/service-worker/types.js +1 -0
  1158. package/node_modules/hono/dist/adapter/vercel/conninfo.js +7 -10
  1159. package/node_modules/hono/dist/adapter/vercel/handler.js +8 -6
  1160. package/node_modules/hono/dist/adapter/vercel/index.js +2 -6
  1161. package/node_modules/hono/dist/cjs/_virtual/_rolldown/runtime.js +33 -0
  1162. package/node_modules/hono/dist/cjs/adapter/aws-lambda/conninfo.js +42 -44
  1163. package/node_modules/hono/dist/cjs/adapter/aws-lambda/handler.js +328 -371
  1164. package/node_modules/hono/dist/cjs/adapter/aws-lambda/index.js +7 -34
  1165. package/node_modules/hono/dist/cjs/adapter/aws-lambda/types.js +0 -15
  1166. package/node_modules/hono/dist/cjs/adapter/bun/conninfo.js +21 -47
  1167. package/node_modules/hono/dist/cjs/adapter/bun/index.js +14 -45
  1168. package/node_modules/hono/dist/cjs/adapter/bun/serve-static.js +29 -50
  1169. package/node_modules/hono/dist/cjs/adapter/bun/server.js +11 -26
  1170. package/node_modules/hono/dist/cjs/adapter/bun/ssg.js +24 -35
  1171. package/node_modules/hono/dist/cjs/adapter/bun/websocket.js +63 -91
  1172. package/node_modules/hono/dist/cjs/adapter/cloudflare-pages/conninfo.js +25 -31
  1173. package/node_modules/hono/dist/cjs/adapter/cloudflare-pages/handler.js +61 -85
  1174. package/node_modules/hono/dist/cjs/adapter/cloudflare-pages/index.js +7 -34
  1175. package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/conninfo.js +8 -31
  1176. package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/index.js +7 -33
  1177. package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/serve-static-module.js +7 -29
  1178. package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/serve-static.js +27 -42
  1179. package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/utils.js +21 -55
  1180. package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/websocket.js +33 -62
  1181. package/node_modules/hono/dist/cjs/adapter/deno/conninfo.js +16 -34
  1182. package/node_modules/hono/dist/cjs/adapter/deno/index.js +10 -38
  1183. package/node_modules/hono/dist/cjs/adapter/deno/serve-static.js +33 -59
  1184. package/node_modules/hono/dist/cjs/adapter/deno/ssg.js +27 -37
  1185. package/node_modules/hono/dist/cjs/adapter/deno/websocket.js +32 -53
  1186. package/node_modules/hono/dist/cjs/adapter/lambda-edge/conninfo.js +8 -31
  1187. package/node_modules/hono/dist/cjs/adapter/lambda-edge/handler.js +105 -119
  1188. package/node_modules/hono/dist/cjs/adapter/lambda-edge/index.js +5 -30
  1189. package/node_modules/hono/dist/cjs/adapter/netlify/conninfo.js +25 -31
  1190. package/node_modules/hono/dist/cjs/adapter/netlify/handler.js +10 -29
  1191. package/node_modules/hono/dist/cjs/adapter/netlify/index.js +5 -21
  1192. package/node_modules/hono/dist/cjs/adapter/netlify/mod.js +5 -30
  1193. package/node_modules/hono/dist/cjs/adapter/service-worker/handler.js +16 -41
  1194. package/node_modules/hono/dist/cjs/adapter/service-worker/index.js +25 -30
  1195. package/node_modules/hono/dist/cjs/adapter/service-worker/types.js +0 -15
  1196. package/node_modules/hono/dist/cjs/adapter/vercel/conninfo.js +8 -32
  1197. package/node_modules/hono/dist/cjs/adapter/vercel/handler.js +8 -27
  1198. package/node_modules/hono/dist/cjs/adapter/vercel/index.js +5 -30
  1199. package/node_modules/hono/dist/cjs/client/client.js +139 -212
  1200. package/node_modules/hono/dist/cjs/client/fetch-result-please.js +62 -80
  1201. package/node_modules/hono/dist/cjs/client/index.js +7 -32
  1202. package/node_modules/hono/dist/cjs/client/types.js +0 -15
  1203. package/node_modules/hono/dist/cjs/client/utils.js +54 -92
  1204. package/node_modules/hono/dist/cjs/compose.js +49 -66
  1205. package/node_modules/hono/dist/cjs/context.js +379 -450
  1206. package/node_modules/hono/dist/cjs/helper/accepts/accepts.js +47 -70
  1207. package/node_modules/hono/dist/cjs/helper/accepts/index.js +3 -27
  1208. package/node_modules/hono/dist/cjs/helper/adapter/index.js +33 -73
  1209. package/node_modules/hono/dist/cjs/helper/conninfo/index.js +0 -15
  1210. package/node_modules/hono/dist/cjs/helper/conninfo/types.js +0 -15
  1211. package/node_modules/hono/dist/cjs/helper/cookie/index.js +75 -116
  1212. package/node_modules/hono/dist/cjs/helper/css/common.js +165 -244
  1213. package/node_modules/hono/dist/cjs/helper/css/index.js +136 -151
  1214. package/node_modules/hono/dist/cjs/helper/dev/index.js +45 -71
  1215. package/node_modules/hono/dist/cjs/helper/factory/index.js +30 -51
  1216. package/node_modules/hono/dist/cjs/helper/html/index.js +32 -62
  1217. package/node_modules/hono/dist/cjs/helper/proxy/index.js +113 -106
  1218. package/node_modules/hono/dist/cjs/helper/route/index.js +123 -66
  1219. package/node_modules/hono/dist/cjs/helper/ssg/index.js +19 -43
  1220. package/node_modules/hono/dist/cjs/helper/ssg/middleware.js +56 -64
  1221. package/node_modules/hono/dist/cjs/helper/ssg/plugins.js +55 -57
  1222. package/node_modules/hono/dist/cjs/helper/ssg/ssg.js +196 -296
  1223. package/node_modules/hono/dist/cjs/helper/ssg/utils.js +47 -90
  1224. package/node_modules/hono/dist/cjs/helper/streaming/index.js +8 -35
  1225. package/node_modules/hono/dist/cjs/helper/streaming/sse.js +53 -85
  1226. package/node_modules/hono/dist/cjs/helper/streaming/stream.js +23 -53
  1227. package/node_modules/hono/dist/cjs/helper/streaming/text.js +10 -32
  1228. package/node_modules/hono/dist/cjs/helper/streaming/utils.js +13 -32
  1229. package/node_modules/hono/dist/cjs/helper/testing/index.js +16 -31
  1230. package/node_modules/hono/dist/cjs/helper/websocket/index.js +51 -76
  1231. package/node_modules/hono/dist/cjs/hono-base.js +345 -403
  1232. package/node_modules/hono/dist/cjs/hono.js +28 -42
  1233. package/node_modules/hono/dist/cjs/http-exception.js +55 -56
  1234. package/node_modules/hono/dist/cjs/index.js +22 -30
  1235. package/node_modules/hono/dist/cjs/jsx/base.js +237 -366
  1236. package/node_modules/hono/dist/cjs/jsx/children.js +16 -41
  1237. package/node_modules/hono/dist/cjs/jsx/components.js +119 -192
  1238. package/node_modules/hono/dist/cjs/jsx/constants.js +15 -42
  1239. package/node_modules/hono/dist/cjs/jsx/context.js +144 -162
  1240. package/node_modules/hono/dist/cjs/jsx/dom/client.js +49 -69
  1241. package/node_modules/hono/dist/cjs/jsx/dom/components.js +23 -52
  1242. package/node_modules/hono/dist/cjs/jsx/dom/context.js +39 -67
  1243. package/node_modules/hono/dist/cjs/jsx/dom/css.js +143 -158
  1244. package/node_modules/hono/dist/cjs/jsx/dom/hooks/index.js +55 -64
  1245. package/node_modules/hono/dist/cjs/jsx/dom/index.js +114 -173
  1246. package/node_modules/hono/dist/cjs/jsx/dom/intrinsic-element/components.js +282 -375
  1247. package/node_modules/hono/dist/cjs/jsx/dom/jsx-dev-runtime.js +14 -49
  1248. package/node_modules/hono/dist/cjs/jsx/dom/jsx-runtime.js +5 -32
  1249. package/node_modules/hono/dist/cjs/jsx/dom/render.js +471 -589
  1250. package/node_modules/hono/dist/cjs/jsx/dom/server.js +37 -64
  1251. package/node_modules/hono/dist/cjs/jsx/dom/utils.js +7 -30
  1252. package/node_modules/hono/dist/cjs/jsx/hooks/index.js +225 -318
  1253. package/node_modules/hono/dist/cjs/jsx/index.js +86 -135
  1254. package/node_modules/hono/dist/cjs/jsx/intrinsic-element/common.js +20 -43
  1255. package/node_modules/hono/dist/cjs/jsx/intrinsic-element/components.js +117 -168
  1256. package/node_modules/hono/dist/cjs/jsx/intrinsic-elements.js +0 -15
  1257. package/node_modules/hono/dist/cjs/jsx/jsx-dev-runtime.js +14 -39
  1258. package/node_modules/hono/dist/cjs/jsx/jsx-runtime.js +34 -68
  1259. package/node_modules/hono/dist/cjs/jsx/streaming.js +123 -166
  1260. package/node_modules/hono/dist/cjs/jsx/types.js +0 -15
  1261. package/node_modules/hono/dist/cjs/jsx/utils.js +91 -175
  1262. package/node_modules/hono/dist/cjs/middleware/basic-auth/index.js +98 -86
  1263. package/node_modules/hono/dist/cjs/middleware/bearer-auth/index.js +92 -109
  1264. package/node_modules/hono/dist/cjs/middleware/body-limit/index.js +66 -72
  1265. package/node_modules/hono/dist/cjs/middleware/cache/index.js +153 -199
  1266. package/node_modules/hono/dist/cjs/middleware/combine/index.js +133 -95
  1267. package/node_modules/hono/dist/cjs/middleware/compress/index.js +73 -88
  1268. package/node_modules/hono/dist/cjs/middleware/context-storage/index.js +49 -41
  1269. package/node_modules/hono/dist/cjs/middleware/cors/index.js +107 -107
  1270. package/node_modules/hono/dist/cjs/middleware/csrf/index.js +101 -72
  1271. package/node_modules/hono/dist/cjs/middleware/etag/digest.js +58 -97
  1272. package/node_modules/hono/dist/cjs/middleware/etag/index.js +71 -91
  1273. package/node_modules/hono/dist/cjs/middleware/ip-restriction/index.js +161 -169
  1274. package/node_modules/hono/dist/cjs/middleware/jsx-renderer/index.js +99 -77
  1275. package/node_modules/hono/dist/cjs/middleware/jwk/index.js +3 -27
  1276. package/node_modules/hono/dist/cjs/middleware/jwk/jwk.js +118 -135
  1277. package/node_modules/hono/dist/cjs/middleware/jwt/index.js +9 -38
  1278. package/node_modules/hono/dist/cjs/middleware/jwt/jwt.js +120 -141
  1279. package/node_modules/hono/dist/cjs/middleware/language/index.js +7 -35
  1280. package/node_modules/hono/dist/cjs/middleware/language/language.js +184 -179
  1281. package/node_modules/hono/dist/cjs/middleware/logger/index.js +41 -62
  1282. package/node_modules/hono/dist/cjs/middleware/method-not-allowed/index.js +82 -88
  1283. package/node_modules/hono/dist/cjs/middleware/method-override/index.js +101 -102
  1284. package/node_modules/hono/dist/cjs/middleware/powered-by/index.js +23 -30
  1285. package/node_modules/hono/dist/cjs/middleware/pretty-json/index.js +38 -36
  1286. package/node_modules/hono/dist/cjs/middleware/request-id/index.js +3 -27
  1287. package/node_modules/hono/dist/cjs/middleware/request-id/request-id.js +34 -42
  1288. package/node_modules/hono/dist/cjs/middleware/secure-headers/index.js +4 -29
  1289. package/node_modules/hono/dist/cjs/middleware/secure-headers/permissions-policy.js +0 -15
  1290. package/node_modules/hono/dist/cjs/middleware/secure-headers/secure-headers.js +142 -174
  1291. package/node_modules/hono/dist/cjs/middleware/serve-static/index.js +56 -93
  1292. package/node_modules/hono/dist/cjs/middleware/serve-static/path.js +15 -38
  1293. package/node_modules/hono/dist/cjs/middleware/timeout/index.js +40 -45
  1294. package/node_modules/hono/dist/cjs/middleware/timing/index.js +7 -35
  1295. package/node_modules/hono/dist/cjs/middleware/timing/timing.js +177 -118
  1296. package/node_modules/hono/dist/cjs/middleware/trailing-slash/index.js +85 -58
  1297. package/node_modules/hono/dist/cjs/preset/quick.js +18 -37
  1298. package/node_modules/hono/dist/cjs/preset/tiny.js +15 -33
  1299. package/node_modules/hono/dist/cjs/request/constants.js +5 -27
  1300. package/node_modules/hono/dist/cjs/request.js +334 -343
  1301. package/node_modules/hono/dist/cjs/router/linear-router/index.js +3 -27
  1302. package/node_modules/hono/dist/cjs/router/linear-router/router.js +95 -143
  1303. package/node_modules/hono/dist/cjs/router/pattern-router/index.js +3 -27
  1304. package/node_modules/hono/dist/cjs/router/pattern-router/router.js +41 -63
  1305. package/node_modules/hono/dist/cjs/router/reg-exp-router/index.js +7 -34
  1306. package/node_modules/hono/dist/cjs/router/reg-exp-router/matcher.js +18 -45
  1307. package/node_modules/hono/dist/cjs/router/reg-exp-router/node.js +91 -135
  1308. package/node_modules/hono/dist/cjs/router/reg-exp-router/prepared-router.js +92 -161
  1309. package/node_modules/hono/dist/cjs/router/reg-exp-router/router.js +98 -147
  1310. package/node_modules/hono/dist/cjs/router/reg-exp-router/trie.js +73 -89
  1311. package/node_modules/hono/dist/cjs/router/smart-router/index.js +3 -27
  1312. package/node_modules/hono/dist/cjs/router/smart-router/router.js +49 -79
  1313. package/node_modules/hono/dist/cjs/router/trie-router/index.js +3 -27
  1314. package/node_modules/hono/dist/cjs/router/trie-router/node.js +134 -186
  1315. package/node_modules/hono/dist/cjs/router/trie-router/router.js +15 -39
  1316. package/node_modules/hono/dist/cjs/router/utils.js +5 -27
  1317. package/node_modules/hono/dist/cjs/router.js +37 -37
  1318. package/node_modules/hono/dist/cjs/types.js +5 -28
  1319. package/node_modules/hono/dist/cjs/utils/accept.js +177 -228
  1320. package/node_modules/hono/dist/cjs/utils/basic-auth.js +16 -40
  1321. package/node_modules/hono/dist/cjs/utils/body.js +84 -110
  1322. package/node_modules/hono/dist/cjs/utils/buffer.js +43 -91
  1323. package/node_modules/hono/dist/cjs/utils/color.js +35 -44
  1324. package/node_modules/hono/dist/cjs/utils/compress.js +11 -26
  1325. package/node_modules/hono/dist/cjs/utils/concurrent.js +29 -59
  1326. package/node_modules/hono/dist/cjs/utils/constants.js +7 -26
  1327. package/node_modules/hono/dist/cjs/utils/cookie.js +107 -177
  1328. package/node_modules/hono/dist/cjs/utils/crypto.js +30 -61
  1329. package/node_modules/hono/dist/cjs/utils/encode.js +31 -48
  1330. package/node_modules/hono/dist/cjs/utils/filepath.js +23 -54
  1331. package/node_modules/hono/dist/cjs/utils/handler.js +11 -33
  1332. package/node_modules/hono/dist/cjs/utils/headers.js +0 -15
  1333. package/node_modules/hono/dist/cjs/utils/html.js +96 -137
  1334. package/node_modules/hono/dist/cjs/utils/http-status.js +0 -15
  1335. package/node_modules/hono/dist/cjs/utils/ipaddr.js +213 -286
  1336. package/node_modules/hono/dist/cjs/utils/jwt/index.js +14 -27
  1337. package/node_modules/hono/dist/cjs/utils/jwt/jwa.js +25 -42
  1338. package/node_modules/hono/dist/cjs/utils/jwt/jws.js +119 -199
  1339. package/node_modules/hono/dist/cjs/utils/jwt/jwt.js +122 -205
  1340. package/node_modules/hono/dist/cjs/utils/jwt/types.js +122 -159
  1341. package/node_modules/hono/dist/cjs/utils/jwt/utf8.js +9 -28
  1342. package/node_modules/hono/dist/cjs/utils/mime.js +75 -101
  1343. package/node_modules/hono/dist/cjs/utils/stream.js +88 -111
  1344. package/node_modules/hono/dist/cjs/utils/types.js +0 -15
  1345. package/node_modules/hono/dist/cjs/utils/url.js +185 -234
  1346. package/node_modules/hono/dist/cjs/validator/index.js +3 -27
  1347. package/node_modules/hono/dist/cjs/validator/utils.js +0 -15
  1348. package/node_modules/hono/dist/cjs/validator/validator.js +60 -103
  1349. package/node_modules/hono/dist/client/client.js +138 -197
  1350. package/node_modules/hono/dist/client/fetch-result-please.js +59 -56
  1351. package/node_modules/hono/dist/client/index.js +3 -7
  1352. package/node_modules/hono/dist/client/types.js +1 -0
  1353. package/node_modules/hono/dist/client/utils.js +51 -68
  1354. package/node_modules/hono/dist/compose.js +49 -45
  1355. package/node_modules/hono/dist/context.js +376 -426
  1356. package/node_modules/hono/dist/helper/accepts/accepts.js +47 -49
  1357. package/node_modules/hono/dist/helper/accepts/index.js +1 -4
  1358. package/node_modules/hono/dist/helper/adapter/index.js +33 -52
  1359. package/node_modules/hono/dist/helper/conninfo/index.js +1 -0
  1360. package/node_modules/hono/dist/helper/conninfo/types.js +1 -0
  1361. package/node_modules/hono/dist/helper/cookie/index.js +74 -94
  1362. package/node_modules/hono/dist/helper/css/common.js +167 -225
  1363. package/node_modules/hono/dist/helper/css/index.js +132 -137
  1364. package/node_modules/hono/dist/helper/dev/index.js +44 -49
  1365. package/node_modules/hono/dist/helper/factory/index.js +27 -27
  1366. package/node_modules/hono/dist/helper/html/index.js +30 -39
  1367. package/node_modules/hono/dist/helper/proxy/index.js +116 -88
  1368. package/node_modules/hono/dist/helper/route/index.js +121 -43
  1369. package/node_modules/hono/dist/helper/ssg/index.js +3 -18
  1370. package/node_modules/hono/dist/helper/ssg/middleware.js +53 -40
  1371. package/node_modules/hono/dist/helper/ssg/plugins.js +55 -36
  1372. package/node_modules/hono/dist/helper/ssg/ssg.js +198 -283
  1373. package/node_modules/hono/dist/helper/ssg/utils.js +53 -75
  1374. package/node_modules/hono/dist/helper/streaming/index.js +2 -8
  1375. package/node_modules/hono/dist/helper/streaming/sse.js +50 -61
  1376. package/node_modules/hono/dist/helper/streaming/stream.js +22 -31
  1377. package/node_modules/hono/dist/helper/streaming/text.js +9 -10
  1378. package/node_modules/hono/dist/helper/streaming/utils.js +9 -12
  1379. package/node_modules/hono/dist/helper/testing/index.js +16 -10
  1380. package/node_modules/hono/dist/helper/websocket/index.js +49 -53
  1381. package/node_modules/hono/dist/hono-base.js +342 -379
  1382. package/node_modules/hono/dist/hono.js +27 -20
  1383. package/node_modules/hono/dist/http-exception.js +53 -33
  1384. package/node_modules/hono/dist/index.js +19 -6
  1385. package/node_modules/hono/dist/jsx/base.js +231 -340
  1386. package/node_modules/hono/dist/jsx/children.js +16 -20
  1387. package/node_modules/hono/dist/jsx/components.js +118 -170
  1388. package/node_modules/hono/dist/jsx/constants.js +9 -15
  1389. package/node_modules/hono/dist/jsx/context.js +153 -150
  1390. package/node_modules/hono/dist/jsx/dom/client.js +45 -48
  1391. package/node_modules/hono/dist/jsx/dom/components.js +21 -29
  1392. package/node_modules/hono/dist/jsx/dom/context.js +37 -44
  1393. package/node_modules/hono/dist/jsx/dom/css.js +142 -147
  1394. package/node_modules/hono/dist/jsx/dom/hooks/index.js +52 -40
  1395. package/node_modules/hono/dist/jsx/dom/index.js +71 -134
  1396. package/node_modules/hono/dist/jsx/dom/intrinsic-element/components.js +275 -359
  1397. package/node_modules/hono/dist/jsx/dom/jsx-dev-runtime.js +14 -18
  1398. package/node_modules/hono/dist/jsx/dom/jsx-runtime.js +2 -8
  1399. package/node_modules/hono/dist/jsx/dom/render.js +492 -595
  1400. package/node_modules/hono/dist/jsx/dom/server.js +32 -32
  1401. package/node_modules/hono/dist/jsx/dom/utils.js +6 -8
  1402. package/node_modules/hono/dist/jsx/hooks/index.js +236 -308
  1403. package/node_modules/hono/dist/jsx/index.js +45 -98
  1404. package/node_modules/hono/dist/jsx/intrinsic-element/common.js +20 -22
  1405. package/node_modules/hono/dist/jsx/intrinsic-element/components.js +113 -154
  1406. package/node_modules/hono/dist/jsx/intrinsic-elements.js +1 -0
  1407. package/node_modules/hono/dist/jsx/jsx-dev-runtime.js +12 -16
  1408. package/node_modules/hono/dist/jsx/jsx-runtime.js +29 -42
  1409. package/node_modules/hono/dist/jsx/streaming.js +120 -142
  1410. package/node_modules/hono/dist/jsx/types.js +1 -0
  1411. package/node_modules/hono/dist/jsx/utils.js +105 -168
  1412. package/node_modules/hono/dist/middleware/basic-auth/index.js +96 -63
  1413. package/node_modules/hono/dist/middleware/bearer-auth/index.js +93 -89
  1414. package/node_modules/hono/dist/middleware/body-limit/index.js +66 -51
  1415. package/node_modules/hono/dist/middleware/cache/index.js +165 -190
  1416. package/node_modules/hono/dist/middleware/combine/index.js +132 -73
  1417. package/node_modules/hono/dist/middleware/compress/index.js +75 -69
  1418. package/node_modules/hono/dist/middleware/context-storage/index.js +49 -19
  1419. package/node_modules/hono/dist/middleware/cors/index.js +107 -86
  1420. package/node_modules/hono/dist/middleware/csrf/index.js +103 -53
  1421. package/node_modules/hono/dist/middleware/etag/digest.js +59 -77
  1422. package/node_modules/hono/dist/middleware/etag/index.js +71 -70
  1423. package/node_modules/hono/dist/middleware/ip-restriction/index.js +163 -158
  1424. package/node_modules/hono/dist/middleware/jsx-renderer/index.js +97 -54
  1425. package/node_modules/hono/dist/middleware/jwk/index.js +1 -4
  1426. package/node_modules/hono/dist/middleware/jwk/jwk.js +116 -112
  1427. package/node_modules/hono/dist/middleware/jwt/index.js +2 -10
  1428. package/node_modules/hono/dist/middleware/jwt/jwt.js +114 -114
  1429. package/node_modules/hono/dist/middleware/language/index.js +2 -15
  1430. package/node_modules/hono/dist/middleware/language/language.js +180 -154
  1431. package/node_modules/hono/dist/middleware/logger/index.js +43 -37
  1432. package/node_modules/hono/dist/middleware/method-not-allowed/index.js +81 -66
  1433. package/node_modules/hono/dist/middleware/method-override/index.js +101 -81
  1434. package/node_modules/hono/dist/middleware/powered-by/index.js +23 -9
  1435. package/node_modules/hono/dist/middleware/pretty-json/index.js +39 -16
  1436. package/node_modules/hono/dist/middleware/request-id/index.js +1 -4
  1437. package/node_modules/hono/dist/middleware/request-id/request-id.js +33 -20
  1438. package/node_modules/hono/dist/middleware/secure-headers/index.js +1 -5
  1439. package/node_modules/hono/dist/middleware/secure-headers/permissions-policy.js +1 -0
  1440. package/node_modules/hono/dist/middleware/secure-headers/secure-headers.js +144 -155
  1441. package/node_modules/hono/dist/middleware/serve-static/index.js +56 -72
  1442. package/node_modules/hono/dist/middleware/serve-static/path.js +15 -17
  1443. package/node_modules/hono/dist/middleware/timeout/index.js +40 -23
  1444. package/node_modules/hono/dist/middleware/timing/index.js +2 -9
  1445. package/node_modules/hono/dist/middleware/timing/timing.js +177 -97
  1446. package/node_modules/hono/dist/middleware/trailing-slash/index.js +85 -37
  1447. package/node_modules/hono/dist/preset/quick.js +17 -15
  1448. package/node_modules/hono/dist/preset/tiny.js +14 -11
  1449. package/node_modules/hono/dist/request/constants.js +4 -5
  1450. package/node_modules/hono/dist/request.js +328 -316
  1451. package/node_modules/hono/dist/router/linear-router/index.js +1 -4
  1452. package/node_modules/hono/dist/router/linear-router/router.js +93 -120
  1453. package/node_modules/hono/dist/router/pattern-router/index.js +1 -4
  1454. package/node_modules/hono/dist/router/pattern-router/router.js +39 -40
  1455. package/node_modules/hono/dist/router/reg-exp-router/index.js +1 -7
  1456. package/node_modules/hono/dist/router/reg-exp-router/matcher.js +17 -23
  1457. package/node_modules/hono/dist/router/reg-exp-router/node.js +87 -110
  1458. package/node_modules/hono/dist/router/reg-exp-router/prepared-router.js +89 -137
  1459. package/node_modules/hono/dist/router/reg-exp-router/router.js +92 -129
  1460. package/node_modules/hono/dist/router/reg-exp-router/trie.js +69 -64
  1461. package/node_modules/hono/dist/router/smart-router/index.js +1 -4
  1462. package/node_modules/hono/dist/router/smart-router/router.js +46 -55
  1463. package/node_modules/hono/dist/router/trie-router/index.js +1 -4
  1464. package/node_modules/hono/dist/router/trie-router/node.js +131 -162
  1465. package/node_modules/hono/dist/router/trie-router/router.js +11 -14
  1466. package/node_modules/hono/dist/router/utils.js +4 -5
  1467. package/node_modules/hono/dist/router.js +35 -14
  1468. package/node_modules/hono/dist/types/adapter/aws-lambda/conninfo.d.ts +4 -1
  1469. package/node_modules/hono/dist/types/adapter/aws-lambda/handler.d.ts +150 -105
  1470. package/node_modules/hono/dist/types/adapter/aws-lambda/index.d.ts +4 -8
  1471. package/node_modules/hono/dist/types/adapter/aws-lambda/types.d.ts +152 -123
  1472. package/node_modules/hono/dist/types/adapter/bun/conninfo.d.ts +4 -1
  1473. package/node_modules/hono/dist/types/adapter/bun/index.d.ts +6 -10
  1474. package/node_modules/hono/dist/types/adapter/bun/serve-static.d.ts +7 -2
  1475. package/node_modules/hono/dist/types/adapter/bun/server.d.ts +4 -5
  1476. package/node_modules/hono/dist/types/adapter/bun/ssg.d.ts +5 -1
  1477. package/node_modules/hono/dist/types/adapter/bun/websocket.d.ts +31 -17
  1478. package/node_modules/hono/dist/types/adapter/cloudflare-pages/conninfo.d.ts +4 -1
  1479. package/node_modules/hono/dist/types/adapter/cloudflare-pages/handler.d.ts +29 -18
  1480. package/node_modules/hono/dist/types/adapter/cloudflare-pages/index.d.ts +3 -7
  1481. package/node_modules/hono/dist/types/adapter/cloudflare-workers/conninfo.d.ts +6 -1
  1482. package/node_modules/hono/dist/types/adapter/cloudflare-workers/index.d.ts +4 -7
  1483. package/node_modules/hono/dist/types/adapter/cloudflare-workers/serve-static-module.d.ts +5 -3
  1484. package/node_modules/hono/dist/types/adapter/cloudflare-workers/serve-static.d.ts +10 -5
  1485. package/node_modules/hono/dist/types/adapter/cloudflare-workers/utils.d.ts +10 -2
  1486. package/node_modules/hono/dist/types/adapter/cloudflare-workers/websocket.d.ts +6 -1
  1487. package/node_modules/hono/dist/types/adapter/deno/conninfo.d.ts +4 -1
  1488. package/node_modules/hono/dist/types/adapter/deno/deno.d.ts +1 -0
  1489. package/node_modules/hono/dist/types/adapter/deno/index.d.ts +5 -8
  1490. package/node_modules/hono/dist/types/adapter/deno/serve-static.d.ts +7 -2
  1491. package/node_modules/hono/dist/types/adapter/deno/ssg.d.ts +5 -1
  1492. package/node_modules/hono/dist/types/adapter/deno/websocket.d.ts +6 -1
  1493. package/node_modules/hono/dist/types/adapter/lambda-edge/conninfo.d.ts +6 -1
  1494. package/node_modules/hono/dist/types/adapter/lambda-edge/handler.d.ts +83 -58
  1495. package/node_modules/hono/dist/types/adapter/lambda-edge/index.d.ts +3 -7
  1496. package/node_modules/hono/dist/types/adapter/netlify/conninfo.d.ts +4 -1
  1497. package/node_modules/hono/dist/types/adapter/netlify/handler.d.ts +6 -1
  1498. package/node_modules/hono/dist/types/adapter/netlify/index.d.ts +3 -5
  1499. package/node_modules/hono/dist/types/adapter/netlify/mod.d.ts +3 -2
  1500. package/node_modules/hono/dist/types/adapter/service-worker/handler.d.ts +9 -8
  1501. package/node_modules/hono/dist/types/adapter/service-worker/index.d.ts +6 -9
  1502. package/node_modules/hono/dist/types/adapter/service-worker/types.d.ts +12 -8
  1503. package/node_modules/hono/dist/types/adapter/vercel/conninfo.d.ts +6 -1
  1504. package/node_modules/hono/dist/types/adapter/vercel/handler.d.ts +6 -1
  1505. package/node_modules/hono/dist/types/adapter/vercel/index.d.ts +3 -6
  1506. package/node_modules/hono/dist/types/client/client.d.ts +5 -3
  1507. package/node_modules/hono/dist/types/client/fetch-result-please.d.ts +21 -19
  1508. package/node_modules/hono/dist/types/client/index.d.ts +5 -7
  1509. package/node_modules/hono/dist/types/client/types.d.ts +134 -160
  1510. package/node_modules/hono/dist/types/client/utils.d.ts +6 -4
  1511. package/node_modules/hono/dist/types/compose.d.ts +4 -2
  1512. package/node_modules/hono/dist/types/context.d.ts +335 -336
  1513. package/node_modules/hono/dist/types/helper/accepts/accepts.d.ts +11 -9
  1514. package/node_modules/hono/dist/types/helper/accepts/index.d.ts +2 -5
  1515. package/node_modules/hono/dist/types/helper/adapter/index.d.ts +4 -6
  1516. package/node_modules/hono/dist/types/helper/conninfo/index.d.ts +2 -5
  1517. package/node_modules/hono/dist/types/helper/conninfo/types.d.ts +25 -23
  1518. package/node_modules/hono/dist/types/helper/cookie/index.d.ts +10 -13
  1519. package/node_modules/hono/dist/types/helper/css/common.d.ts +11 -10
  1520. package/node_modules/hono/dist/types/helper/css/index.d.ts +25 -28
  1521. package/node_modules/hono/dist/types/helper/dev/index.d.ts +10 -13
  1522. package/node_modules/hono/dist/types/helper/factory/index.d.ts +26 -74
  1523. package/node_modules/hono/dist/types/helper/html/index.d.ts +4 -7
  1524. package/node_modules/hono/dist/types/helper/proxy/index.d.ts +20 -23
  1525. package/node_modules/hono/dist/types/helper/route/index.d.ts +6 -4
  1526. package/node_modules/hono/dist/types/helper/ssg/index.d.ts +4 -7
  1527. package/node_modules/hono/dist/types/helper/ssg/middleware.d.ts +8 -7
  1528. package/node_modules/hono/dist/types/helper/ssg/plugins.d.ts +3 -1
  1529. package/node_modules/hono/dist/types/helper/ssg/ssg.d.ts +38 -36
  1530. package/node_modules/hono/dist/types/helper/ssg/utils.d.ts +5 -4
  1531. package/node_modules/hono/dist/types/helper/streaming/index.d.ts +4 -8
  1532. package/node_modules/hono/dist/types/helper/streaming/sse.d.ts +10 -8
  1533. package/node_modules/hono/dist/types/helper/streaming/stream.d.ts +4 -2
  1534. package/node_modules/hono/dist/types/helper/streaming/text.d.ts +4 -2
  1535. package/node_modules/hono/dist/types/helper/streaming/utils.d.ts +2 -0
  1536. package/node_modules/hono/dist/types/helper/testing/index.d.ts +7 -10
  1537. package/node_modules/hono/dist/types/helper/websocket/index.d.ts +30 -33
  1538. package/node_modules/hono/dist/types/hono-base.d.ts +208 -211
  1539. package/node_modules/hono/dist/types/hono.d.ts +11 -10
  1540. package/node_modules/hono/dist/types/http-exception.d.ts +20 -23
  1541. package/node_modules/hono/dist/types/index.d.ts +6 -37
  1542. package/node_modules/hono/dist/types/jsx/base.d.ts +36 -35
  1543. package/node_modules/hono/dist/types/jsx/children.d.ts +8 -6
  1544. package/node_modules/hono/dist/types/jsx/components.d.ts +8 -5
  1545. package/node_modules/hono/dist/types/jsx/constants.d.ts +2 -0
  1546. package/node_modules/hono/dist/types/jsx/context.d.ts +9 -7
  1547. package/node_modules/hono/dist/types/jsx/dom/client.d.ts +8 -10
  1548. package/node_modules/hono/dist/types/jsx/dom/components.d.ts +9 -6
  1549. package/node_modules/hono/dist/types/jsx/dom/context.d.ts +3 -1
  1550. package/node_modules/hono/dist/types/jsx/dom/css.d.ts +26 -30
  1551. package/node_modules/hono/dist/types/jsx/dom/hooks/index.d.ts +11 -13
  1552. package/node_modules/hono/dist/types/jsx/dom/index.d.ts +78 -83
  1553. package/node_modules/hono/dist/types/jsx/dom/intrinsic-element/components.d.ts +9 -5
  1554. package/node_modules/hono/dist/types/jsx/dom/jsx-dev-runtime.d.ts +4 -6
  1555. package/node_modules/hono/dist/types/jsx/dom/jsx-runtime.d.ts +3 -7
  1556. package/node_modules/hono/dist/types/jsx/dom/render.d.ts +32 -51
  1557. package/node_modules/hono/dist/types/jsx/dom/server.d.ts +86 -85
  1558. package/node_modules/hono/dist/types/jsx/dom/utils.d.ts +2 -0
  1559. package/node_modules/hono/dist/types/jsx/hooks/index.d.ts +16 -17
  1560. package/node_modules/hono/dist/types/jsx/index.d.ts +70 -73
  1561. package/node_modules/hono/dist/types/jsx/intrinsic-element/common.d.ts +3 -1
  1562. package/node_modules/hono/dist/types/jsx/intrinsic-element/components.d.ts +7 -4
  1563. package/node_modules/hono/dist/types/jsx/intrinsic-elements.d.ts +708 -708
  1564. package/node_modules/hono/dist/types/jsx/jsx-dev-runtime.d.ts +4 -7
  1565. package/node_modules/hono/dist/types/jsx/jsx-runtime.d.ts +7 -10
  1566. package/node_modules/hono/dist/types/jsx/streaming.d.ts +9 -10
  1567. package/node_modules/hono/dist/types/jsx/types.d.ts +11 -13
  1568. package/node_modules/hono/dist/types/jsx/utils.d.ts +2 -0
  1569. package/node_modules/hono/dist/types/middleware/basic-auth/index.d.ts +17 -20
  1570. package/node_modules/hono/dist/types/middleware/bearer-auth/index.d.ts +46 -49
  1571. package/node_modules/hono/dist/types/middleware/body-limit/index.d.ts +6 -9
  1572. package/node_modules/hono/dist/types/middleware/cache/index.d.ts +13 -15
  1573. package/node_modules/hono/dist/types/middleware/combine/index.d.ts +7 -8
  1574. package/node_modules/hono/dist/types/middleware/compress/index.d.ts +8 -10
  1575. package/node_modules/hono/dist/types/middleware/context-storage/index.d.ts +4 -6
  1576. package/node_modules/hono/dist/types/middleware/cors/index.d.ts +10 -13
  1577. package/node_modules/hono/dist/types/middleware/csrf/index.d.ts +6 -9
  1578. package/node_modules/hono/dist/types/middleware/etag/digest.d.ts +2 -0
  1579. package/node_modules/hono/dist/types/middleware/etag/index.d.ts +6 -9
  1580. package/node_modules/hono/dist/types/middleware/ip-restriction/index.d.ts +11 -13
  1581. package/node_modules/hono/dist/types/middleware/jsx-renderer/index.d.ts +11 -12
  1582. package/node_modules/hono/dist/types/middleware/jwk/index.d.ts +2 -1
  1583. package/node_modules/hono/dist/types/middleware/jwk/jwk.d.ts +20 -23
  1584. package/node_modules/hono/dist/types/middleware/jwt/index.d.ts +6 -6
  1585. package/node_modules/hono/dist/types/middleware/jwt/jwt.d.ts +28 -30
  1586. package/node_modules/hono/dist/types/middleware/language/index.d.ts +5 -5
  1587. package/node_modules/hono/dist/types/middleware/language/language.d.ts +42 -44
  1588. package/node_modules/hono/dist/types/middleware/logger/index.d.ts +3 -6
  1589. package/node_modules/hono/dist/types/middleware/method-not-allowed/index.d.ts +7 -10
  1590. package/node_modules/hono/dist/types/middleware/method-override/index.d.ts +14 -17
  1591. package/node_modules/hono/dist/types/middleware/powered-by/index.d.ts +8 -11
  1592. package/node_modules/hono/dist/types/middleware/pretty-json/index.d.ts +18 -21
  1593. package/node_modules/hono/dist/types/middleware/request-id/index.d.ts +5 -5
  1594. package/node_modules/hono/dist/types/middleware/request-id/request-id.d.ts +9 -11
  1595. package/node_modules/hono/dist/types/middleware/secure-headers/index.d.ts +5 -6
  1596. package/node_modules/hono/dist/types/middleware/secure-headers/permissions-policy.d.ts +2 -1
  1597. package/node_modules/hono/dist/types/middleware/secure-headers/secure-headers.d.ts +55 -58
  1598. package/node_modules/hono/dist/types/middleware/serve-static/index.d.ts +24 -24
  1599. package/node_modules/hono/dist/types/middleware/serve-static/path.d.ts +2 -0
  1600. package/node_modules/hono/dist/types/middleware/timeout/index.d.ts +5 -7
  1601. package/node_modules/hono/dist/types/middleware/timing/index.d.ts +5 -5
  1602. package/node_modules/hono/dist/types/middleware/timing/timing.d.ts +17 -21
  1603. package/node_modules/hono/dist/types/middleware/trailing-slash/index.d.ts +35 -38
  1604. package/node_modules/hono/dist/types/preset/quick.d.ts +6 -9
  1605. package/node_modules/hono/dist/types/preset/tiny.d.ts +6 -9
  1606. package/node_modules/hono/dist/types/request/constants.d.ts +2 -0
  1607. package/node_modules/hono/dist/types/request.d.ts +288 -287
  1608. package/node_modules/hono/dist/types/router/linear-router/index.d.ts +2 -5
  1609. package/node_modules/hono/dist/types/router/linear-router/router.d.ts +7 -5
  1610. package/node_modules/hono/dist/types/router/pattern-router/index.d.ts +2 -5
  1611. package/node_modules/hono/dist/types/router/pattern-router/router.d.ts +7 -5
  1612. package/node_modules/hono/dist/types/router/reg-exp-router/index.d.ts +3 -6
  1613. package/node_modules/hono/dist/types/router/reg-exp-router/matcher.d.ts +3 -1
  1614. package/node_modules/hono/dist/types/router/reg-exp-router/node.d.ts +6 -4
  1615. package/node_modules/hono/dist/types/router/reg-exp-router/prepared-router.d.ts +11 -11
  1616. package/node_modules/hono/dist/types/router/reg-exp-router/router.d.ts +10 -9
  1617. package/node_modules/hono/dist/types/router/reg-exp-router/trie.d.ts +7 -5
  1618. package/node_modules/hono/dist/types/router/smart-router/index.d.ts +2 -5
  1619. package/node_modules/hono/dist/types/router/smart-router/router.d.ts +11 -9
  1620. package/node_modules/hono/dist/types/router/trie-router/index.d.ts +2 -5
  1621. package/node_modules/hono/dist/types/router/trie-router/node.d.ts +6 -4
  1622. package/node_modules/hono/dist/types/router/trie-router/router.d.ts +7 -5
  1623. package/node_modules/hono/dist/types/router/utils.d.ts +2 -0
  1624. package/node_modules/hono/dist/types/router.d.ts +23 -22
  1625. package/node_modules/hono/dist/types/types.d.ts +146 -506
  1626. package/node_modules/hono/dist/types/utils/accept.d.ts +5 -3
  1627. package/node_modules/hono/dist/types/utils/basic-auth.d.ts +4 -2
  1628. package/node_modules/hono/dist/types/utils/body.d.ts +46 -51
  1629. package/node_modules/hono/dist/types/utils/buffer.d.ts +7 -6
  1630. package/node_modules/hono/dist/types/utils/color.d.ts +2 -0
  1631. package/node_modules/hono/dist/types/utils/compress.d.ts +2 -0
  1632. package/node_modules/hono/dist/types/utils/concurrent.d.ts +6 -4
  1633. package/node_modules/hono/dist/types/utils/constants.d.ts +2 -0
  1634. package/node_modules/hono/dist/types/utils/cookie.d.ts +20 -19
  1635. package/node_modules/hono/dist/types/utils/crypto.d.ts +5 -8
  1636. package/node_modules/hono/dist/types/utils/encode.d.ts +2 -0
  1637. package/node_modules/hono/dist/types/utils/filepath.d.ts +5 -4
  1638. package/node_modules/hono/dist/types/utils/handler.d.ts +2 -0
  1639. package/node_modules/hono/dist/types/utils/headers.d.ts +2 -0
  1640. package/node_modules/hono/dist/types/utils/html.d.ts +11 -10
  1641. package/node_modules/hono/dist/types/utils/http-status.d.ts +2 -0
  1642. package/node_modules/hono/dist/types/utils/ipaddr.d.ts +4 -6
  1643. package/node_modules/hono/dist/types/utils/jwt/index.d.ts +18 -12
  1644. package/node_modules/hono/dist/types/utils/jwt/jwa.d.ts +15 -13
  1645. package/node_modules/hono/dist/types/utils/jwt/jws.d.ts +4 -7
  1646. package/node_modules/hono/dist/types/utils/jwt/jwt.d.ts +26 -29
  1647. package/node_modules/hono/dist/types/utils/jwt/types.d.ts +48 -45
  1648. package/node_modules/hono/dist/types/utils/jwt/utf8.d.ts +2 -0
  1649. package/node_modules/hono/dist/types/utils/mime.d.ts +59 -57
  1650. package/node_modules/hono/dist/types/utils/stream.d.ts +27 -25
  1651. package/node_modules/hono/dist/types/utils/types.d.ts +15 -28
  1652. package/node_modules/hono/dist/types/utils/url.d.ts +2 -1
  1653. package/node_modules/hono/dist/types/validator/index.d.ts +3 -7
  1654. package/node_modules/hono/dist/types/validator/utils.d.ts +6 -9
  1655. package/node_modules/hono/dist/types/validator/validator.d.ts +11 -10
  1656. package/node_modules/hono/dist/types.js +4 -6
  1657. package/node_modules/hono/dist/utils/accept.js +185 -215
  1658. package/node_modules/hono/dist/utils/basic-auth.js +18 -21
  1659. package/node_modules/hono/dist/utils/body.js +87 -92
  1660. package/node_modules/hono/dist/utils/buffer.js +44 -71
  1661. package/node_modules/hono/dist/utils/color.js +33 -21
  1662. package/node_modules/hono/dist/utils/compress.js +11 -5
  1663. package/node_modules/hono/dist/utils/concurrent.js +29 -38
  1664. package/node_modules/hono/dist/utils/constants.js +7 -5
  1665. package/node_modules/hono/dist/utils/cookie.js +114 -163
  1666. package/node_modules/hono/dist/utils/crypto.js +30 -40
  1667. package/node_modules/hono/dist/utils/encode.js +30 -26
  1668. package/node_modules/hono/dist/utils/filepath.js +23 -33
  1669. package/node_modules/hono/dist/utils/handler.js +10 -11
  1670. package/node_modules/hono/dist/utils/headers.js +1 -0
  1671. package/node_modules/hono/dist/utils/html.js +97 -117
  1672. package/node_modules/hono/dist/utils/http-status.js +1 -0
  1673. package/node_modules/hono/dist/utils/ipaddr.js +227 -279
  1674. package/node_modules/hono/dist/utils/jwt/index.js +12 -4
  1675. package/node_modules/hono/dist/utils/jwt/jwa.js +24 -20
  1676. package/node_modules/hono/dist/utils/jwt/jws.js +115 -174
  1677. package/node_modules/hono/dist/utils/jwt/jwt.js +120 -197
  1678. package/node_modules/hono/dist/utils/jwt/types.js +79 -95
  1679. package/node_modules/hono/dist/utils/jwt/utf8.js +9 -7
  1680. package/node_modules/hono/dist/utils/mime.js +74 -79
  1681. package/node_modules/hono/dist/utils/stream.js +86 -88
  1682. package/node_modules/hono/dist/utils/types.js +1 -0
  1683. package/node_modules/hono/dist/utils/url.js +187 -215
  1684. package/node_modules/hono/dist/validator/index.js +1 -4
  1685. package/node_modules/hono/dist/validator/utils.js +1 -0
  1686. package/node_modules/hono/dist/validator/validator.js +61 -83
  1687. package/node_modules/hono/package.json +27 -27
  1688. package/package.json +7 -8
  1689. package/prepare.mjs +109 -4
  1690. package/runtime-package.json +7 -9
  1691. package/scripts/check-install-toolchain.mjs +64 -40
  1692. package/shipping-sbom.cdx.json +134 -168
  1693. package/shipping-source.json +15 -15
  1694. package/node_modules/@earendil-works/chord/dist/api.d.ts +0 -20
  1695. package/node_modules/@earendil-works/chord/dist/api.d.ts.map +0 -1
  1696. package/node_modules/@earendil-works/chord/dist/api.js +0 -77
  1697. package/node_modules/@earendil-works/chord/dist/api.js.map +0 -1
  1698. package/node_modules/@earendil-works/chord/dist/bundler.d.ts +0 -6
  1699. package/node_modules/@earendil-works/chord/dist/bundler.d.ts.map +0 -1
  1700. package/node_modules/@earendil-works/chord/dist/bundler.js +0 -3
  1701. package/node_modules/@earendil-works/chord/dist/bundler.js.map +0 -1
  1702. package/node_modules/@earendil-works/chord/dist/facets/host.d.ts +0 -12
  1703. package/node_modules/@earendil-works/chord/dist/facets/host.d.ts.map +0 -1
  1704. package/node_modules/@earendil-works/chord/dist/facets/host.js +0 -763
  1705. package/node_modules/@earendil-works/chord/dist/facets/host.js.map +0 -1
  1706. package/node_modules/@earendil-works/chord/dist/facets/loader.d.ts +0 -3
  1707. package/node_modules/@earendil-works/chord/dist/facets/loader.d.ts.map +0 -1
  1708. package/node_modules/@earendil-works/chord/dist/facets/loader.js +0 -5
  1709. package/node_modules/@earendil-works/chord/dist/facets/loader.js.map +0 -1
  1710. package/node_modules/@earendil-works/chord/dist/node/bundle-loader.d.ts +0 -30
  1711. package/node_modules/@earendil-works/chord/dist/node/bundle-loader.d.ts.map +0 -1
  1712. package/node_modules/@earendil-works/chord/dist/node/bundle-loader.js +0 -377
  1713. package/node_modules/@earendil-works/chord/dist/node/bundle-loader.js.map +0 -1
  1714. package/node_modules/@earendil-works/chord/dist/node/bundle.d.ts +0 -26
  1715. package/node_modules/@earendil-works/chord/dist/node/bundle.d.ts.map +0 -1
  1716. package/node_modules/@earendil-works/chord/dist/node/bundle.js +0 -183
  1717. package/node_modules/@earendil-works/chord/dist/node/bundle.js.map +0 -1
  1718. package/node_modules/@earendil-works/chord/dist/node/manifest.d.ts +0 -36
  1719. package/node_modules/@earendil-works/chord/dist/node/manifest.d.ts.map +0 -1
  1720. package/node_modules/@earendil-works/chord/dist/node/manifest.js +0 -6
  1721. package/node_modules/@earendil-works/chord/dist/node/manifest.js.map +0 -1
  1722. package/node_modules/@earendil-works/chord/dist/node/package.d.ts +0 -15
  1723. package/node_modules/@earendil-works/chord/dist/node/package.d.ts.map +0 -1
  1724. package/node_modules/@earendil-works/chord/dist/node/package.js +0 -199
  1725. package/node_modules/@earendil-works/chord/dist/node/package.js.map +0 -1
  1726. package/node_modules/@earendil-works/chord/dist/services/consumer.d.ts +0 -11
  1727. package/node_modules/@earendil-works/chord/dist/services/consumer.d.ts.map +0 -1
  1728. package/node_modules/@earendil-works/chord/dist/services/consumer.js +0 -585
  1729. package/node_modules/@earendil-works/chord/dist/services/consumer.js.map +0 -1
  1730. package/node_modules/@earendil-works/chord/dist/services/errors.d.ts +0 -8
  1731. package/node_modules/@earendil-works/chord/dist/services/errors.d.ts.map +0 -1
  1732. package/node_modules/@earendil-works/chord/dist/services/errors.js +0 -22
  1733. package/node_modules/@earendil-works/chord/dist/services/errors.js.map +0 -1
  1734. package/node_modules/@earendil-works/chord/dist/services/handle.d.ts +0 -15
  1735. package/node_modules/@earendil-works/chord/dist/services/handle.d.ts.map +0 -1
  1736. package/node_modules/@earendil-works/chord/dist/services/handle.js +0 -101
  1737. package/node_modules/@earendil-works/chord/dist/services/handle.js.map +0 -1
  1738. package/node_modules/@earendil-works/chord/dist/services/instances.d.ts +0 -26
  1739. package/node_modules/@earendil-works/chord/dist/services/instances.d.ts.map +0 -1
  1740. package/node_modules/@earendil-works/chord/dist/services/instances.js +0 -140
  1741. package/node_modules/@earendil-works/chord/dist/services/instances.js.map +0 -1
  1742. package/node_modules/@earendil-works/chord/dist/services/loopback.d.ts +0 -5
  1743. package/node_modules/@earendil-works/chord/dist/services/loopback.d.ts.map +0 -1
  1744. package/node_modules/@earendil-works/chord/dist/services/loopback.js +0 -15
  1745. package/node_modules/@earendil-works/chord/dist/services/loopback.js.map +0 -1
  1746. package/node_modules/@earendil-works/chord/dist/services/provider.d.ts +0 -37
  1747. package/node_modules/@earendil-works/chord/dist/services/provider.d.ts.map +0 -1
  1748. package/node_modules/@earendil-works/chord/dist/services/provider.js +0 -521
  1749. package/node_modules/@earendil-works/chord/dist/services/provider.js.map +0 -1
  1750. package/node_modules/@earendil-works/chord/dist/services/state-codec.d.ts +0 -15
  1751. package/node_modules/@earendil-works/chord/dist/services/state-codec.d.ts.map +0 -1
  1752. package/node_modules/@earendil-works/chord/dist/services/state-codec.js +0 -133
  1753. package/node_modules/@earendil-works/chord/dist/services/state-codec.js.map +0 -1
  1754. package/node_modules/@earendil-works/chord/dist/services/state-internals.d.ts +0 -13
  1755. package/node_modules/@earendil-works/chord/dist/services/state-internals.d.ts.map +0 -1
  1756. package/node_modules/@earendil-works/chord/dist/services/state-internals.js +0 -10
  1757. package/node_modules/@earendil-works/chord/dist/services/state-internals.js.map +0 -1
  1758. package/node_modules/@earendil-works/chord/dist/services/state.d.ts +0 -28
  1759. package/node_modules/@earendil-works/chord/dist/services/state.d.ts.map +0 -1
  1760. package/node_modules/@earendil-works/chord/dist/services/state.js.map +0 -1
  1761. package/node_modules/@earendil-works/chord/dist/services/wire.d.ts +0 -63
  1762. package/node_modules/@earendil-works/chord/dist/services/wire.d.ts.map +0 -1
  1763. package/node_modules/@earendil-works/chord/dist/services/wire.js +0 -186
  1764. package/node_modules/@earendil-works/chord/dist/services/wire.js.map +0 -1
  1765. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.d.ts +0 -3
  1766. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.d.ts.map +0 -1
  1767. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js +0 -14
  1768. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js.map +0 -1
  1769. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.d.ts +0 -6
  1770. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.d.ts.map +0 -1
  1771. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.js +0 -8
  1772. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.js.map +0 -1
  1773. package/node_modules/@earendil-works/pi-ai/dist/providers/data/azure-openai-responses.json +0 -1
  1774. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/anthropic-messages-MVG2FL56.js +0 -6
  1775. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/azure-openai-responses-7AMFUIWJ.js +0 -2
  1776. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-6FX7UEPL.js +0 -132
  1777. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-7JGR3GZN.js +0 -11
  1778. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-A3JYRWB6.js +0 -2
  1779. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-IKZJX7ZT.js +0 -2
  1780. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-OSKPX3Z5.js +0 -2
  1781. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-OYBSLV7Y.js +0 -16
  1782. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-PDFMCAOZ.js +0 -19
  1783. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-U7B62NSC.js +0 -2
  1784. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-VIV3CWXG.js +0 -2
  1785. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/chunk-WCQZGZ6I.js +0 -82
  1786. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/cloudflare-workers-ai-system-one-X5PVWWYJ.js +0 -2
  1787. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/easter-egg-3d-T5FFWIBR.js +0 -2
  1788. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/execute-RYVK27GT.js +0 -388
  1789. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/mistral-conversations-7DAUEE4N.js +0 -5
  1790. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/openai-codex-responses-TC3OK7B4.js +0 -10
  1791. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/runtime-D5I2NTIF.js +0 -2
  1792. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/typesafe-system-one-A4CZTQWZ.js +0 -2
  1793. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/virtual-modules-KVWJD3T3.js +0 -2
  1794. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-json.d.ts +0 -85
  1795. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-json.d.ts.map +0 -1
  1796. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-json.js +0 -132
  1797. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-json.js.map +0 -1
  1798. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme-schema.json +0 -361
  1799. package/node_modules/@earendil-works/pi-coding-agent/examples/plugins/pi-example-plugin/README.md +0 -38
  1800. package/node_modules/@earendil-works/pi-coding-agent/examples/plugins/pi-example-plugin/package.json +0 -10
  1801. package/node_modules/@earendil-works/pi-coding-agent/examples/plugins/pi-example-plugin/src/contract.ts +0 -13
  1802. package/node_modules/@earendil-works/pi-coding-agent/examples/plugins/pi-example-plugin/src/session.ts +0 -24
  1803. package/node_modules/@earendil-works/pi-coding-agent/examples/plugins/pi-example-plugin/src/tui.ts +0 -31
  1804. package/node_modules/@esbuild/linux-x64/README.md +0 -3
  1805. package/node_modules/@esbuild/linux-x64/bin/esbuild +0 -0
  1806. package/node_modules/@esbuild/linux-x64/package.json +0 -20
  1807. package/node_modules/esbuild/LICENSE.md +0 -21
  1808. package/node_modules/esbuild/README.md +0 -3
  1809. package/node_modules/esbuild/bin/esbuild +0 -223
  1810. package/node_modules/esbuild/install.js +0 -300
  1811. package/node_modules/esbuild/lib/main.d.ts +0 -720
  1812. package/node_modules/esbuild/lib/main.js +0 -2536
  1813. package/node_modules/esbuild/package.json +0 -74
@@ -0,0 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":["import { contractFromDescription, LOCAL_VARIANT } from \"./contract.ts\";\nimport { type Encoder, encoder } from \"./delta/index.ts\";\nimport { ChordError, invalid } from \"./errors.ts\";\nimport type { HostImpl } from \"./host.ts\";\nimport type { Link } from \"./link.ts\";\nimport { type CtxImpl, HandleImpl, kindOf } from \"./record.ts\";\nimport type { RemoteChannel, RemoteHandle, StateSink } from \"./remote.ts\";\nimport { assertValid } from \"./schema.ts\";\nimport type { Ctx, Principal, Readable, StateEvent } from \"./types.ts\";\nimport { type Frame, fromWireError, isFrame, type RootRef, toWireError } from \"./wire.ts\";\n\nexport interface LinkOptions {\n\t/** Milliseconds between pings (default 15000). */\n\treadonly pingInterval?: number;\n\t/** Close the link when nothing arrived for this long (default 45000). Everything held through it is released. */\n\treadonly pingTimeout?: number;\n}\n\nexport interface AcceptOptions extends LinkOptions {\n\t/** The principal of whatever connects, from the app's authenticator. Every request on the link acts as it. */\n\treadonly principal: Principal;\n\t/**\n\t * What the peer is, decided here and never by its `hello`: `client` (default; a browser: no roots, no epochs, not\n\t * a reload participant, not addressable) or `host` (a child host; needs `name`).\n\t */\n\treadonly kind?: \"host\" | \"client\";\n\t/** A child host's name: its hello must match, and it is reachable `at` this name. */\n\treadonly name?: string;\n\t/** On `invalidatePrincipal`: a new principal keeps the link, `undefined` closes it (default: close). */\n\treadonly restamp?: (principal: Principal) => Principal | undefined;\n}\n\nexport interface Peer {\n\treadonly kind: \"host\" | \"client\";\n\t/** Configured (downstream hosts) or announced by the trusted parent (upstream). */\n\treadonly name: string | undefined;\n}\n\n/** A hold the peer made on this host: served locally or relayed to another link. */\ntype Served =\n\t| { readonly kind: \"local\"; readonly handle: HandleImpl; readonly principal: Principal; readonly feeds: Set<number> }\n\t| { readonly kind: \"relay\"; readonly relay: RelayHold };\n\ntype Pending = { readonly resolve: (value: unknown) => void; readonly reject: (error: unknown) => void };\n\nconst unavailable = (message: string): ChordError => new ChordError(\"unavailable\", message);\n\n// ─── relay ───────────────────────────────────────────────────────────────────\n\n/**\n * A hold relayed from an origin link to a downstream link. It owns everything done through it: subscriptions and\n * calls queued while the route resolves, and the downstream twins once forwarded. `close` undoes all of it exactly\n * once (cancels calls downstream, drops subscriptions, releases the downstream hold, rejects waiters).\n */\nexport class RelayHold {\n\treadonly origin: Connection;\n\treadonly frame: Extract<Frame, { t: \"hold\" }>;\n\treadonly principal: Principal;\n\treadonly client: boolean;\n\t/** The origin's authorization generation when the hold arrived; a revocation bumps it. */\n\treadonly generation: number;\n\tdown: Connection | undefined;\n\tdownId = 0;\n\tclosed = false;\n\treadonly calls = new Map<number, RelayCall>();\n\treadonly subs = new Map<number, { readonly member: string; downId: number | undefined }>();\n\treadonly #waiters = new Set<Pending>();\n\n\tconstructor(origin: Connection, frame: Extract<Frame, { t: \"hold\" }>, principal: Principal, client: boolean) {\n\t\tthis.origin = origin;\n\t\tthis.frame = frame;\n\t\tthis.principal = principal;\n\t\tthis.client = client;\n\t\tthis.generation = origin.generation;\n\t}\n\n\tget originId(): number {\n\t\treturn this.frame.id;\n\t}\n\n\t/** Still authorized as it was when it arrived. */\n\tget current(): boolean {\n\t\treturn !this.closed && this.origin.open && this.origin.generation === this.generation;\n\t}\n\n\t/** The downstream connection once the route resolved; rejects if the relay closes first. */\n\tready(): Promise<Connection> {\n\t\tif (this.closed) return Promise.reject(new ChordError(\"gone\", \"relayed hold closed\"));\n\t\tif (this.down !== undefined) return Promise.resolve(this.down);\n\t\treturn new Promise<Connection>((resolve, reject) => {\n\t\t\tthis.#waiters.add({ resolve: resolve as (value: unknown) => void, reject });\n\t\t});\n\t}\n\n\t/** Forwards the hold (and what queued meanwhile) to `down`. */\n\topen(down: Connection): void {\n\t\tif (this.closed) return;\n\t\tthis.down = down;\n\t\tthis.downId = down.nextId();\n\t\tdown.relayedHolds.set(this.downId, this);\n\t\tdown.send({\n\t\t\t...this.frame,\n\t\t\tid: this.downId,\n\t\t\tprincipal: this.principal,\n\t\t\t...(this.client ? { client: true } : {}),\n\t\t});\n\t\tfor (const [originSubId, entry] of this.subs)\n\t\t\tif (entry.downId === undefined) this.#forwardSub(originSubId, entry);\n\t\tfor (const waiter of this.#waiters) waiter.resolve(down);\n\t\tthis.#waiters.clear();\n\t}\n\n\tsubscribe(originSubId: number, member: string): void {\n\t\tconst entry = { member, downId: undefined as number | undefined };\n\t\tthis.subs.set(originSubId, entry);\n\t\tthis.origin.relaySubs.set(originSubId, this);\n\t\tif (this.down !== undefined) this.#forwardSub(originSubId, entry);\n\t}\n\n\t#forwardSub(originSubId: number, entry: { readonly member: string; downId: number | undefined }): void {\n\t\tconst down = this.down!;\n\t\tentry.downId = down.nextId();\n\t\tdown.relayedSubs.set(entry.downId, { relay: this, originSubId });\n\t\tdown.send({ t: \"sub\", id: entry.downId, hold: this.downId, member: entry.member });\n\t}\n\n\tunsubscribe(originSubId: number, forward = true): void {\n\t\tconst entry = this.subs.get(originSubId);\n\t\tif (entry === undefined) return;\n\t\tthis.subs.delete(originSubId);\n\t\tthis.origin.relaySubs.delete(originSubId);\n\t\tif (entry.downId !== undefined && this.down !== undefined) {\n\t\t\tthis.down.relayedSubs.delete(entry.downId);\n\t\t\tif (forward) this.down.send({ t: \"unsub\", id: entry.downId });\n\t\t}\n\t}\n\n\t/**\n\t * Closes the relay. `releaseDown`: the downstream hold is still there (origin released, disconnected, or was\n\t * revoked): cancel its calls and release it. `notify`: tell the origin the hold is gone.\n\t */\n\tclose(error: unknown, options: { readonly releaseDown: boolean; readonly notify: boolean }): void {\n\t\tif (this.closed) return;\n\t\tthis.closed = true;\n\t\tfor (const call of [...this.calls.values()]) call.cancel(error, options.releaseDown);\n\t\tfor (const originSubId of [...this.subs.keys()]) this.unsubscribe(originSubId, options.releaseDown);\n\t\tif (this.origin.served.get(this.originId)?.kind === \"relay\") this.origin.served.delete(this.originId);\n\t\tif (this.down !== undefined) {\n\t\t\tthis.down.relayedHolds.delete(this.downId);\n\t\t\tif (options.releaseDown) this.down.send({ t: \"release\", id: this.downId });\n\t\t}\n\t\tfor (const waiter of this.#waiters) waiter.reject(error);\n\t\tthis.#waiters.clear();\n\t\tif (options.notify) this.origin.send({ t: \"gone\", id: this.originId, error: toWireError(error) });\n\t}\n}\n\n/** One relayed call: settles once, by result, cancellation or the relay closing; removes both mappings. */\nexport class RelayCall {\n\treadonly relay: RelayHold;\n\treadonly originId: number;\n\treadonly downId: number;\n\treadonly #pending: Pending;\n\t#settled = false;\n\n\tconstructor(relay: RelayHold, originId: number, downId: number, pending: Pending) {\n\t\tthis.relay = relay;\n\t\tthis.originId = originId;\n\t\tthis.downId = downId;\n\t\tthis.#pending = pending;\n\t\trelay.calls.set(originId, this);\n\t\trelay.down?.relayedCalls.set(downId, this);\n\t}\n\n\tfinish(error: unknown, value?: unknown): void {\n\t\tif (this.#settled) return;\n\t\tthis.#settled = true;\n\t\tthis.relay.calls.delete(this.originId);\n\t\tthis.relay.down?.relayedCalls.delete(this.downId);\n\t\tif (error === undefined) this.#pending.resolve(value);\n\t\telse this.#pending.reject(error);\n\t}\n\n\t/** Cancels downstream (when the downstream hold still exists) and settles with `error`. */\n\tcancel(error: unknown, forward: boolean): void {\n\t\tif (this.#settled) return;\n\t\tif (forward) this.relay.down?.send({ t: \"cancel\", id: this.downId });\n\t\tthis.finish(error);\n\t}\n}\n\n// ─── connection ──────────────────────────────────────────────────────────────\n\n/** One end of a link on a host: consumer of remote handles, provider for the peer's holds, and relay. */\nexport class Connection implements RemoteChannel {\n\treadonly host: HostImpl;\n\treadonly link: Link;\n\t/** `upstream`: the link to this host's parent. `downstream`: a link this host accepted. */\n\treadonly role: \"upstream\" | \"downstream\";\n\treadonly peer: Peer;\n\tprincipal: Principal;\n\treadonly restamp: ((principal: Principal) => Principal | undefined) | undefined;\n\t/** Bumped when the stamped principal is revoked or re-stamped: relays from before are refused. */\n\tgeneration = 0;\n\t/** The epoch a downstream host peer runs (from its hello, then from commits). */\n\tpeerEpoch: number | undefined;\n\t/** A downstream host peer is usable once it runs this host's current epoch (see `HostImpl.peerHello`). */\n\tsynced: boolean;\n\t/** Epochs this child announced while behind this host (fenced): this host never ran them. */\n\treadonly fencedEpochs = new Set<number>();\n\t/** Roots of fenced epochs, by the epoch of this host they were admitted in. */\n\treadonly #admitted = new Map<string, number>();\n\t#parentName: string | undefined;\n\treadonly #syncWaiters = new Set<Pending>();\n\t#nextId = 1;\n\t#lastSeen = Date.now();\n\t#pinger: ReturnType<typeof setInterval> | undefined;\n\t// consumer side: what this host asked of the peer\n\treadonly remotes = new Map<number, RemoteHandle>();\n\treadonly calls = new Map<number, Pending>();\n\treadonly subs = new Map<number, (frame: StateSink) => void>();\n\t// provider side: what the peer asked of this host\n\treadonly served = new Map<number, Served>();\n\treadonly incoming = new Map<number, AbortController>();\n\treadonly feeds = new Map<number, () => void>();\n\t/** Origin side of relays: the peer's sub ids that are relayed. */\n\treadonly relaySubs = new Map<number, RelayHold>();\n\t// downstream side of relays: ids this host used on this link\n\treadonly relayedHolds = new Map<number, RelayHold>();\n\treadonly relayedCalls = new Map<number, RelayCall>();\n\treadonly relayedSubs = new Map<number, { readonly relay: RelayHold; readonly originSubId: number }>();\n\t/** Reload votes awaited from this (child) peer. */\n\treadonly votes = new Map<number, Pending>();\n\n\tconstructor(\n\t\thost: HostImpl,\n\t\tlink: Link,\n\t\tconfig: {\n\t\t\treadonly role: \"upstream\" | \"downstream\";\n\t\t\treadonly principal: Principal;\n\t\t\treadonly peer: Peer;\n\t\t\treadonly restamp?: (principal: Principal) => Principal | undefined;\n\t\t} & LinkOptions,\n\t) {\n\t\tthis.host = host;\n\t\tthis.link = link;\n\t\tthis.role = config.role;\n\t\tthis.peer = config.peer;\n\t\tthis.principal = config.principal;\n\t\tthis.restamp = config.restamp;\n\t\tthis.synced = !(this.role === \"downstream\" && this.peer.kind === \"host\");\n\t\tlink.onClose((reason) => this.#closed(reason));\n\t\tlink.receive((frame) => this.#receive(frame));\n\t\tthis.send({ t: \"hello\", name: host.name, kind: host.kind, epoch: host.current.id });\n\t\tconst interval = config.pingInterval ?? 15_000;\n\t\tconst timeout = config.pingTimeout ?? 45_000;\n\t\tlet n = 0;\n\t\tthis.#pinger = setInterval(() => {\n\t\t\tif (Date.now() - this.#lastSeen > timeout) link.close(\"ping timeout\");\n\t\t\telse this.send({ t: \"ping\", n: ++n });\n\t\t}, interval);\n\t\tthis.#pinger.unref?.();\n\t}\n\n\tget open(): boolean {\n\t\treturn !this.link.closed;\n\t}\n\n\t/** The peer's name: configured for downstream hosts, announced by the parent upstream. */\n\tget name(): string | undefined {\n\t\treturn this.role === \"upstream\" ? this.#parentName : this.peer.name;\n\t}\n\n\tsend(frame: Frame): void {\n\t\tthis.link.send(frame);\n\t}\n\n\tnextId(): number {\n\t\treturn this.#nextId++;\n\t}\n\n\t/** Resolves once the peer is usable (a host peer runs this host's epoch); rejects if the link closes first. */\n\twhenSynced(): Promise<void> {\n\t\tif (!this.open) return Promise.reject(unavailable(`link to ${this.name ?? \"peer\"} closed`));\n\t\tif (this.synced) return Promise.resolve();\n\t\treturn new Promise<void>((resolve, reject) => this.#syncWaiters.add({ resolve: resolve as () => void, reject }));\n\t}\n\n\tmarkSynced(epoch: number): void {\n\t\tthis.peerEpoch = epoch;\n\t\tthis.synced = true;\n\t\tfor (const waiter of this.#syncWaiters) waiter.resolve(undefined);\n\t\tthis.#syncWaiters.clear();\n\t}\n\n\t/** Revokes the stamped principal: relays made under it close at once (also those still resolving a route). */\n\trevoke(next: Principal | undefined): void {\n\t\tthis.generation++;\n\t\tconst error = new ChordError(\"gone\", \"principal invalidated\");\n\t\tfor (const served of [...this.served.values()]) {\n\t\t\tif (served.kind === \"relay\") served.relay.close(error, { releaseDown: true, notify: true });\n\t\t}\n\t\tif (next === undefined) this.link.close(\"principal invalidated\");\n\t\telse this.principal = next;\n\t}\n\n\t/** A protocol violation: the peer cannot be trusted with anything on this link any more. */\n\t#violation(reason: string): void {\n\t\tthis.host.report(new ChordError(\"invalid\", `link to ${this.name ?? \"peer\"}: ${reason}`, { reason: \"protocol\" }));\n\t\tthis.link.close(`protocol error: ${reason}`);\n\t}\n\n\t// ─── consumer side (RemoteChannel) ───\n\n\thold(handle: RemoteHandle): number {\n\t\tconst id = this.nextId();\n\t\tthis.remotes.set(id, handle);\n\t\thandle.bound(this, id);\n\t\tconst principal = handle.principal;\n\t\tthis.send({\n\t\t\tt: \"hold\",\n\t\t\tid,\n\t\t\tat: handle.at,\n\t\t\ttoken: handle.contract.description,\n\t\t\tinput: handle.input,\n\t\t\t...(principal === undefined ? {} : { principal }),\n\t\t\t...(handle.owner === \"client\" ? { client: true } : {}),\n\t\t});\n\t\treturn id;\n\t}\n\n\trelease(id: number): void {\n\t\tthis.remotes.delete(id);\n\t\tthis.send({ t: \"release\", id });\n\t}\n\n\tcall(hold: number, member: string, args: unknown, root: RootRef | undefined, signal: AbortSignal): Promise<unknown> {\n\t\tconst id = this.nextId();\n\t\treturn new Promise<unknown>((resolve, reject) => {\n\t\t\tif (signal.aborted) {\n\t\t\t\treject(new ChordError(\"aborted\", \"call aborted\"));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst onAbort = (): void => {\n\t\t\t\tthis.calls.delete(id);\n\t\t\t\tthis.send({ t: \"cancel\", id });\n\t\t\t\treject(new ChordError(\"aborted\", \"call aborted\", { cause: signal.reason }));\n\t\t\t};\n\t\t\tsignal.addEventListener(\"abort\", onAbort, { once: true });\n\t\t\tconst done = (): void => signal.removeEventListener(\"abort\", onAbort);\n\t\t\tthis.calls.set(id, {\n\t\t\t\tresolve: (value) => {\n\t\t\t\t\tdone();\n\t\t\t\t\tresolve(value);\n\t\t\t\t},\n\t\t\t\treject: (error) => {\n\t\t\t\t\tdone();\n\t\t\t\t\treject(error);\n\t\t\t\t},\n\t\t\t});\n\t\t\t// Clients never carry roots or epochs: the server starts roots for them.\n\t\t\tconst carried = root !== undefined && this.host.kind === \"host\";\n\t\t\tif (carried) this.host.rootSent(root.rootId, this);\n\t\t\tthis.send({ t: \"call\", id, hold, member, args, ...(carried ? { root } : {}) });\n\t\t});\n\t}\n\n\tsub(hold: number, member: string, sink: (frame: StateSink) => void): number {\n\t\tconst id = this.nextId();\n\t\tthis.subs.set(id, sink);\n\t\tthis.send({ t: \"sub\", id, hold, member });\n\t\treturn id;\n\t}\n\n\tunsub(id: number): void {\n\t\tif (this.subs.delete(id)) this.send({ t: \"unsub\", id });\n\t}\n\n\t// ─── receiving ───\n\n\t#receive(frame: unknown): void {\n\t\tthis.#lastSeen = Date.now();\n\t\tif (!isFrame(frame)) {\n\t\t\tthis.#violation(\"malformed frame\");\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tthis.#dispatch(frame);\n\t\t} catch (error) {\n\t\t\tthis.host.report(error);\n\t\t}\n\t}\n\n\t#dispatch(frame: Frame): void {\n\t\tswitch (frame.t) {\n\t\t\tcase \"hello\":\n\t\t\t\tthis.#onHello(frame);\n\t\t\t\treturn;\n\t\t\tcase \"ping\":\n\t\t\t\tthis.send({ t: \"pong\", n: frame.n });\n\t\t\t\treturn;\n\t\t\tcase \"pong\":\n\t\t\tcase \"bye\":\n\t\t\t\treturn;\n\t\t\tcase \"hold\":\n\t\t\t\tthis.#onHold(frame);\n\t\t\t\treturn;\n\t\t\tcase \"release\":\n\t\t\t\tthis.#dropServed(frame.id, true);\n\t\t\t\treturn;\n\t\t\tcase \"call\":\n\t\t\t\tthis.#onCall(frame);\n\t\t\t\treturn;\n\t\t\tcase \"cancel\":\n\t\t\t\tthis.incoming.get(frame.id)?.abort(new ChordError(\"aborted\", \"cancelled by caller\"));\n\t\t\t\treturn;\n\t\t\tcase \"sub\":\n\t\t\t\tthis.#onSub(frame);\n\t\t\t\treturn;\n\t\t\tcase \"unsub\":\n\t\t\t\tthis.#onUnsub(frame.id);\n\t\t\t\treturn;\n\t\t\tcase \"shape\":\n\t\t\tcase \"gone\":\n\t\t\t\tthis.#onHoldReply(frame);\n\t\t\t\treturn;\n\t\t\tcase \"result\":\n\t\t\t\tthis.#onResult(frame);\n\t\t\t\treturn;\n\t\t\tcase \"state\":\n\t\t\t\tthis.#onState(frame);\n\t\t\t\treturn;\n\t\t\tcase \"root_end\":\n\t\t\t\t// Honored only from the link the root came over (see HostImpl.foreignRootEnded).\n\t\t\t\tthis.#admitted.delete(frame.rootId);\n\t\t\t\tthis.host.foreignRootEnded(frame.rootId, this);\n\t\t\t\treturn;\n\t\t\tcase \"invalidate\":\n\t\t\tcase \"prepare\":\n\t\t\tcase \"commit\":\n\t\t\tcase \"abort\":\n\t\t\tcase \"retire\":\n\t\t\t\t// Control frames only from the parent.\n\t\t\t\tif (this.role !== \"upstream\") {\n\t\t\t\t\tthis.#violation(`${frame.t} from a child`);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (frame.t === \"invalidate\") {\n\t\t\t\t\tthis.host.invalidatePrincipal(frame.pattern).catch((error: unknown) => this.host.report(error));\n\t\t\t\t} else if (frame.t === \"retire\") this.host.allowRetire(frame.epoch);\n\t\t\t\telse this.host.onReloadFrame(this, frame);\n\t\t\t\treturn;\n\t\t\tcase \"vote\": {\n\t\t\t\tif (this.role !== \"downstream\" || this.peer.kind !== \"host\") {\n\t\t\t\t\tthis.#violation(\"vote from a non-participant\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst vote = this.votes.get(frame.reload);\n\t\t\t\tthis.votes.delete(frame.reload);\n\t\t\t\tif (frame.error === undefined) vote?.resolve(frame.report);\n\t\t\t\telse vote?.reject(fromWireError(frame.error));\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * The peer's hello must agree with what this side decided about it. A downstream host announces its epoch: the\n\t * host either finds it in step or fences and reconciles it (never renumbers).\n\t */\n\t#onHello(frame: Extract<Frame, { t: \"hello\" }>): void {\n\t\tif (this.role === \"upstream\") {\n\t\t\tif (frame.kind !== \"host\") {\n\t\t\t\tthis.#violation(\"parent is not a host\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.#parentName ??= frame.name;\n\t\t\treturn;\n\t\t}\n\t\tif (frame.kind !== this.peer.kind || (this.peer.name !== undefined && frame.name !== this.peer.name)) {\n\t\t\tthis.#violation(\n\t\t\t\t`hello ${frame.kind} ${frame.name} does not match the accepted ${this.peer.kind} ${this.peer.name ?? \"\"}`,\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\t\tif (this.peer.kind === \"host\") this.host.peerHello(this, frame.epoch);\n\t}\n\n\t/**\n\t * Principal stamping: a downstream link acts as the principal it was accepted with, whatever the frame says. Only\n\t * the parent may forward a principal (relayed requests); its own requests act as `{ host: parentName }`.\n\t */\n\t#principalOf(frame: { readonly principal?: Principal }): Principal {\n\t\tif (this.role === \"downstream\") return this.principal;\n\t\treturn frame.principal ?? { host: this.#parentName ?? \"parent\" };\n\t}\n\n\t#isClient(frame: { readonly client?: boolean }): boolean {\n\t\treturn this.role === \"downstream\" ? this.peer.kind === \"client\" : frame.client === true;\n\t}\n\n\t#onHold(frame: Extract<Frame, { t: \"hold\" }>): void {\n\t\tif (this.served.has(frame.id)) {\n\t\t\tthis.#violation(`duplicate hold id ${frame.id}`);\n\t\t\treturn;\n\t\t}\n\t\tconst principal = this.#principalOf(frame);\n\t\tconst client = this.#isClient(frame);\n\t\tif (frame.at !== this.host.name) {\n\t\t\tif (this.role === \"upstream\") {\n\t\t\t\tthis.send({ t: \"gone\", id: frame.id, error: toWireError(unavailable(`${this.host.name} does not relay`)) });\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst relay = new RelayHold(this, frame, principal, client);\n\t\t\tthis.served.set(frame.id, { kind: \"relay\", relay });\n\t\t\tthis.host.relay(relay).catch((error: unknown) => relay.close(error, { releaseDown: true, notify: true }));\n\t\t\treturn;\n\t\t}\n\t\tlet handle: HandleImpl;\n\t\ttry {\n\t\t\tconst token = contractFromDescription(frame.token);\n\t\t\tif (token.scope !== \"remote\") throw invalid(\"token\", `${token.name} is local; only remote types cross links`);\n\t\t\tconst acquired = this.host.acquire(token, frame.input, { principal }, client ? \"client\" : \"connection\");\n\t\t\tif (!(acquired instanceof HandleImpl)) throw unavailable(\"not a local handle\");\n\t\t\thandle = acquired;\n\t\t} catch (error) {\n\t\t\tthis.send({ t: \"gone\", id: frame.id, error: toWireError(client ? clientError(error) : error) });\n\t\t\treturn;\n\t\t}\n\t\tconst served: Served = { kind: \"local\", handle, principal, feeds: new Set() };\n\t\tthis.served.set(frame.id, served);\n\t\tconst shape = (): void => {\n\t\t\tconst current = handle.shape;\n\t\t\tif (current === undefined || this.served.get(frame.id) !== served) return;\n\t\t\tthis.send({\n\t\t\t\tt: \"shape\",\n\t\t\t\tid: frame.id,\n\t\t\t\tkind: current.kind,\n\t\t\t\tmembers: current.members,\n\t\t\t\tcontract: current.contract,\n\t\t\t\tepoch: current.epoch,\n\t\t\t});\n\t\t};\n\t\thandle.onShape(shape);\n\t\thandle.goneListeners.add((error) => {\n\t\t\tif (this.served.get(frame.id) !== served) return;\n\t\t\tthis.#dropServed(frame.id, false);\n\t\t\tthis.send({ t: \"gone\", id: frame.id, error: toWireError(error) });\n\t\t});\n\t\tif (handle.status === \"live\") shape();\n\t}\n\n\t/** Forgets a served hold: unsubscribes its feeds and releases it (locally or downstream). */\n\t#dropServed(id: number, release: boolean): void {\n\t\tconst served = this.served.get(id);\n\t\tif (served === undefined) return;\n\t\tthis.served.delete(id);\n\t\tif (served.kind === \"relay\") {\n\t\t\tserved.relay.close(new ChordError(\"released\", \"relayed hold released\"), {\n\t\t\t\treleaseDown: release,\n\t\t\t\tnotify: false,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tfor (const feed of served.feeds) this.#onUnsub(feed);\n\t\tif (release) served.handle.release();\n\t}\n\n\t#onCall(frame: Extract<Frame, { t: \"call\" }>): void {\n\t\tif (this.incoming.has(frame.id)) {\n\t\t\tthis.#violation(`duplicate call id ${frame.id}`);\n\t\t\treturn;\n\t\t}\n\t\tconst served = this.served.get(frame.hold);\n\t\tif (served === undefined) {\n\t\t\tthis.send({ t: \"result\", id: frame.id, error: toWireError(new ChordError(\"gone\", \"unknown hold\")) });\n\t\t\treturn;\n\t\t}\n\t\tconst controller = new AbortController();\n\t\tthis.incoming.set(frame.id, controller);\n\t\t// Roots are honored from hosts only; a request without one (or from a client) starts one here.\n\t\tconst root = this.peer.kind === \"host\" ? this.#admitRoot(frame.root) : undefined;\n\t\tconst principal = served.kind === \"local\" ? served.principal : served.relay.principal;\n\t\tconst options = { principal, signal: controller.signal };\n\t\tconst run =\n\t\t\tserved.kind === \"local\"\n\t\t\t\t? (ctx: Ctx) => served.handle.record.call(served.handle, frame.member, frame.args, ctx as CtxImpl)\n\t\t\t\t: (ctx: Ctx) =>\n\t\t\t\t\t\trelayCall(\n\t\t\t\t\t\t\tserved.relay,\n\t\t\t\t\t\t\tframe,\n\t\t\t\t\t\t\t{ rootId: ctx.rootId, epoch: ctx.epoch },\n\t\t\t\t\t\t\tcontroller.signal,\n\t\t\t\t\t\t\tthis.host,\n\t\t\t\t\t\t);\n\t\tconst result =\n\t\t\troot === undefined\n\t\t\t\t? this.host.root(run, options)\n\t\t\t\t: this.host.joinRoot(root.rootId, root.epoch, run, { ...options, from: this });\n\t\tresult\n\t\t\t.then(\n\t\t\t\t(value) => this.send({ t: \"result\", id: frame.id, value }),\n\t\t\t\t(error: unknown) => this.send({ t: \"result\", id: frame.id, error: toWireError(error) }),\n\t\t\t)\n\t\t\t.finally(() => this.incoming.delete(frame.id));\n\t}\n\n\t/**\n\t * A child that connected behind this host runs roots of an epoch this host never had (it was fenced and is being,\n\t * or was, reconciled). Such a root is admitted in this host's current epoch at its first call here, and keeps that\n\t * epoch for its later calls (`superseded` once this host retired it). Other unknown epochs stay `superseded`.\n\t */\n\t#admitRoot(root: RootRef | undefined): RootRef | undefined {\n\t\tif (root === undefined || this.role !== \"downstream\" || !this.fencedEpochs.has(root.epoch)) return root;\n\t\tif (this.host.hasEpoch(root.epoch)) return root;\n\t\tlet epoch = this.#admitted.get(root.rootId);\n\t\tif (epoch === undefined) {\n\t\t\tepoch = this.host.current.id;\n\t\t\tthis.#admitted.set(root.rootId, epoch);\n\t\t}\n\t\treturn { rootId: root.rootId, epoch };\n\t}\n\n\t#onSub(frame: Extract<Frame, { t: \"sub\" }>): void {\n\t\tif (this.feeds.has(frame.id) || this.relaySubs.has(frame.id)) {\n\t\t\tthis.#violation(`duplicate sub id ${frame.id}`);\n\t\t\treturn;\n\t\t}\n\t\tconst served = this.served.get(frame.hold);\n\t\tif (served === undefined) {\n\t\t\tthis.send({ t: \"state\", id: frame.id, error: toWireError(new ChordError(\"gone\", \"unknown hold\")) });\n\t\t\treturn;\n\t\t}\n\t\tif (served.kind === \"relay\") {\n\t\t\tserved.relay.subscribe(frame.id, frame.member);\n\t\t\treturn;\n\t\t}\n\t\tconst readable = served.handle.member(frame.member) as Readable<unknown> | undefined;\n\t\tif (readable === undefined || typeof readable.events !== \"function\") {\n\t\t\tthis.send({\n\t\t\t\tt: \"state\",\n\t\t\t\tid: frame.id,\n\t\t\t\terror: toWireError(new ChordError(\"not_in_variant\", `${frame.member} is not state`)),\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tlet stream: Encoder = encoder();\n\t\tconst send = (event: StateEvent<unknown>): void => {\n\t\t\tif (event.type === \"ops\") {\n\t\t\t\tthis.send({ t: \"state\", id: frame.id, ops: stream.encode(event.ops) });\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// A loading provider handle has nothing yet: the hydrated value follows as a reset.\n\t\t\tif (event.value === undefined) return;\n\t\t\t// Snapshots are validated against the effective schema once per (re)subscription; ops only in dev mode.\n\t\t\ttry {\n\t\t\t\tvalidateSnapshot(served.handle, frame.member, event.value);\n\t\t\t} catch (error) {\n\t\t\t\tthis.send({ t: \"state\", id: frame.id, error: toWireError(error) });\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tstream = encoder();\n\t\t\tthis.send(\n\t\t\t\tevent.type === \"snap\"\n\t\t\t\t\t? { t: \"state\", id: frame.id, snap: event.value }\n\t\t\t\t\t: { t: \"state\", id: frame.id, reset: event.value },\n\t\t\t);\n\t\t};\n\t\tconst unsubscribe = readable.events(send);\n\t\tthis.feeds.set(frame.id, unsubscribe);\n\t\tserved.feeds.add(frame.id);\n\t}\n\n\t#onUnsub(id: number): void {\n\t\tconst unsubscribe = this.feeds.get(id);\n\t\tif (unsubscribe !== undefined) {\n\t\t\tthis.feeds.delete(id);\n\t\t\tunsubscribe();\n\t\t}\n\t\tthis.relaySubs.get(id)?.unsubscribe(id);\n\t}\n\n\t#onHoldReply(frame: Extract<Frame, { t: \"shape\" | \"gone\" }>): void {\n\t\tconst relay = this.relayedHolds.get(frame.id);\n\t\tif (relay !== undefined) {\n\t\t\tif (frame.t === \"gone\") relay.close(fromWireError(frame.error), { releaseDown: false, notify: true });\n\t\t\telse if (!relay.closed) relay.origin.send({ ...frame, id: relay.originId });\n\t\t\treturn;\n\t\t}\n\t\tconst handle = this.remotes.get(frame.id);\n\t\tif (handle === undefined) return;\n\t\tif (frame.t === \"gone\") {\n\t\t\tthis.remotes.delete(frame.id);\n\t\t\thandle.gone(fromWireError(frame.error));\n\t\t\treturn;\n\t\t}\n\t\thandle.shaped({ kind: frame.kind, members: frame.members, contract: frame.contract, epoch: frame.epoch });\n\t}\n\n\t#onResult(frame: Extract<Frame, { t: \"result\" }>): void {\n\t\tconst relayed = this.relayedCalls.get(frame.id);\n\t\tif (relayed !== undefined) {\n\t\t\trelayed.finish(frame.error === undefined ? undefined : fromWireError(frame.error), frame.value);\n\t\t\treturn;\n\t\t}\n\t\tconst pending = this.calls.get(frame.id);\n\t\tthis.calls.delete(frame.id);\n\t\tif (frame.error === undefined) pending?.resolve(frame.value);\n\t\telse pending?.reject(fromWireError(frame.error));\n\t}\n\n\t#onState(frame: Extract<Frame, { t: \"state\" }>): void {\n\t\tconst relayed = this.relayedSubs.get(frame.id);\n\t\tif (relayed !== undefined) {\n\t\t\trelayed.relay.origin.send({ ...frame, id: relayed.originSubId });\n\t\t\treturn;\n\t\t}\n\t\tthis.subs.get(frame.id)?.(frame);\n\t}\n\n\t// ─── lifetime ───\n\n\t#closed(reason: string): void {\n\t\tif (this.#pinger !== undefined) clearInterval(this.#pinger);\n\t\tconst error = unavailable(`link to ${this.name ?? \"peer\"} closed: ${reason}`);\n\t\t// As origin: everything the peer held here, relayed or not, is released (downstream calls cancelled).\n\t\tfor (const id of [...this.served.keys()]) this.#dropServed(id, true);\n\t\tfor (const controller of this.incoming.values()) controller.abort(error);\n\t\tthis.incoming.clear();\n\t\tfor (const pending of this.calls.values()) pending.reject(error);\n\t\tthis.calls.clear();\n\t\tthis.subs.clear();\n\t\tfor (const vote of this.votes.values()) vote.reject(error);\n\t\tthis.votes.clear();\n\t\tfor (const waiter of this.#syncWaiters) waiter.reject(error);\n\t\tthis.#syncWaiters.clear();\n\t\t// As downstream of relays: their origins lose the hold.\n\t\tfor (const relay of [...this.relayedHolds.values()]) relay.close(error, { releaseDown: false, notify: true });\n\t\tthis.relayedHolds.clear();\n\t\tthis.relayedCalls.clear();\n\t\tthis.relayedSubs.clear();\n\t\tfor (const handle of this.remotes.values()) {\n\t\t\t// An upstream link may be replaced (reconnect); a downstream host that went away is gone.\n\t\t\tif (this.role === \"upstream\") handle.detached();\n\t\t\telse handle.gone(error);\n\t\t}\n\t\tthis.remotes.clear();\n\t\tthis.host.connectionClosed(this);\n\t}\n}\n\n/**\n * A call through a relay: waits for the route, then forwards with the root it runs in. It settles exactly once; a\n * cancel (or the origin going away) is forwarded downstream and removes both mappings.\n */\nasync function relayCall(\n\trelay: RelayHold,\n\tframe: Extract<Frame, { t: \"call\" }>,\n\troot: RootRef,\n\tsignal: AbortSignal,\n\thost: HostImpl,\n): Promise<unknown> {\n\tconst abortError = (): ChordError => new ChordError(\"aborted\", \"call cancelled\", { cause: signal.reason });\n\tif (signal.aborted) throw abortError();\n\tlet onAbort = (): void => {};\n\tconst aborted = new Promise<never>((_, reject) => {\n\t\tonAbort = () => reject(abortError());\n\t\tsignal.addEventListener(\"abort\", onAbort, { once: true });\n\t});\n\taborted.catch(() => {});\n\ttry {\n\t\tconst down = await Promise.race([relay.ready(), aborted]);\n\t\tif (relay.closed) throw new ChordError(\"gone\", \"relayed hold closed\");\n\t\treturn await new Promise<unknown>((resolve, reject) => {\n\t\t\tconst call = new RelayCall(relay, frame.id, down.nextId(), { resolve, reject });\n\t\t\tsignal.addEventListener(\"abort\", () => call.cancel(abortError(), true), { once: true });\n\t\t\thost.rootSent(root.rootId, down);\n\t\t\tdown.send({ t: \"call\", id: call.downId, hold: relay.downId, member: frame.member, args: frame.args, root });\n\t\t});\n\t} finally {\n\t\tsignal.removeEventListener(\"abort\", onAbort);\n\t}\n}\n\n/**\n * Validates a snapshot against the schema the consumer is promised: the provider's own schema for a direct binding,\n * the consumer's contract for one through an `accepts` adapter (the adapter's view is what the consumer gets).\n */\nfunction validateSnapshot(handle: HandleImpl, member: string, value: unknown): void {\n\tif (value === undefined) return;\n\tconst installed = handle.record.currentInstalled();\n\tif (installed === undefined) return;\n\tconst view = handle.currentView();\n\tconst kind = view === undefined ? kindOf(installed.behavior) : kindOf(view);\n\tconst description =\n\t\tview !== undefined && view !== installed.behavior\n\t\t\t? handle.contract.description.variants[kind ?? LOCAL_VARIANT]?.[member]\n\t\t\t: installed.service.contract.description.variants[kindOf(installed.behavior) ?? LOCAL_VARIANT]?.[member];\n\tif (description?.kind === \"state\") assertValid(\"state\", `${handle.address}.${member}`, description.schema, value);\n}\n\n/** Clients (browsers) holding an outdated contract are told to reload their code. */\nfunction clientError(error: unknown): unknown {\n\tif (error instanceof ChordError && error.code === \"contract_mismatch\") {\n\t\treturn new ChordError(\"upgrade_required\", error.message, { cause: error });\n\t}\n\treturn error;\n}\n"]}
@@ -1,4 +1,15 @@
1
- import type { Context, ContextKey } from "../types.ts";
1
+ /** Typed identity for one value carried by a {@link Context}. */
2
+ export interface ContextKey<T> {
3
+ readonly token: symbol;
4
+ /** Type-only marker that prevents keys with different value types from being interchangeable. */
5
+ readonly valueType?: (value: T) => T;
6
+ }
7
+ /** Immutable invocation-scoped values passed explicitly through operations. */
8
+ export interface Context {
9
+ readonly abortSignal: AbortSignal | undefined;
10
+ value<T>(key: ContextKey<T>): T | undefined;
11
+ toString(): string;
12
+ }
2
13
  export declare const BACKGROUND_CONTEXT: Context;
3
14
  export declare const TODO_CONTEXT: Context;
4
15
  export declare function createContextKey<T>(description: string): ContextKey<T>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAsDvD,eAAO,MAAM,kBAAkB,EAAE,OAA0D,CAAC;AAC5F,eAAO,MAAM,YAAY,EAAE,OAAoD,CAAC;AAEhF,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,CAEtE;AAED,oEAAoE;AACpE,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAE1F;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAI9E;AAED,6GAA6G;AAC7G,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAE5D;AAED,yDAAyD;AACzD,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG;IAC7C,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5C,CAMA;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,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G,CAAC","sourcesContent":["import type { Context, ContextKey } from \"../types.ts\";\n\nconst ABORT_SIGNAL_CONTEXT_KEY: ContextKey<AbortSignal | undefined> = Object.freeze({\n\ttoken: Symbol(\"chord.abortSignal\"),\n});\n\nabstract class BaseContext implements Context {\n\tabstract value<T>(key: ContextKey<T>): T | undefined;\n\tabstract toString(): string;\n\n\tget abortSignal(): AbortSignal | undefined {\n\t\treturn this.value(ABORT_SIGNAL_CONTEXT_KEY);\n\t}\n}\n\nclass EmptyContext extends BaseContext {\n\treadonly #name: string;\n\n\tconstructor(name: string) {\n\t\tsuper();\n\t\tthis.#name = name;\n\t}\n\n\tvalue<T>(_key: ContextKey<T>): T | undefined {\n\t\treturn undefined;\n\t}\n\n\ttoString(): string {\n\t\treturn this.#name;\n\t}\n}\n\nclass ContextValue<T> extends BaseContext {\n\treadonly #parent: Context;\n\treadonly #key: ContextKey<T>;\n\treadonly #value: T;\n\n\tconstructor(parent: Context, key: ContextKey<T>, value: T) {\n\t\tsuper();\n\t\tthis.#parent = parent;\n\t\tthis.#key = key;\n\t\tthis.#value = value;\n\t}\n\n\tvalue<Value>(key: ContextKey<Value>): Value | undefined {\n\t\tif (key.token === this.#key.token) return this.#value as unknown as Value;\n\t\treturn this.#parent.value(key);\n\t}\n\n\ttoString(): string {\n\t\treturn `${this.#parent}.WithValue(${this.#key.token.description ?? \"anonymous\"})`;\n\t}\n}\n\nexport const BACKGROUND_CONTEXT: Context = new EmptyContext(\"[Context BACKGROUND_CONTEXT]\");\nexport const TODO_CONTEXT: Context = new EmptyContext(\"[Context TODO_CONTEXT]\");\n\nexport function createContextKey<T>(description: string): ContextKey<T> {\n\treturn Object.freeze({ token: Symbol(description) });\n}\n\n/** Derive a context containing one additional or replaced value. */\nexport function withContextValue<T>(key: ContextKey<T>, value: T, parent: Context): Context {\n\treturn new ContextValue(parent, key, value);\n}\n\n/**\n * Derive a context cancelled by either the parent signal or the supplied signal.\n * The parent context remains unchanged.\n */\nexport function withAbortSignal(signal: AbortSignal, context: Context): Context {\n\tconst parentSignal = context.abortSignal;\n\tconst combined = parentSignal === undefined ? signal : AbortSignal.any([parentSignal, signal]);\n\treturn withContextValue(ABORT_SIGNAL_CONTEXT_KEY, combined, context);\n}\n\n/** Derive a context retaining all values except caller cancellation. Intended for mandatory cleanup only. */\nexport function withoutAbortSignal(context: Context): Context {\n\treturn withContextValue(ABORT_SIGNAL_CONTEXT_KEY, undefined, context);\n}\n\n/** Derive an independently cancellable child context. */\nexport function withCancel(context: Context): {\n\treadonly context: Context;\n\treadonly cancel: (reason?: unknown) => void;\n} {\n\tconst controller = new AbortController();\n\treturn {\n\t\tcontext: withAbortSignal(controller.signal, context),\n\t\tcancel: (reason?: unknown) => controller.abort(reason),\n\t};\n}\n\n/**\n * Observe a promise until it settles or the invocation is cancelled.\n * Cancellation rejects only this waiter; it does not cancel the underlying promise.\n */\nexport function awaitWithContext<T>(promise: Promise<T>, context: Context): Promise<T> {\n\tconst signal = context.abortSignal;\n\tif (signal === undefined) return promise;\n\tif (signal.aborted) return Promise.reject(abortError(signal));\n\treturn new Promise<T>((resolve, reject) => {\n\t\tconst onAbort = (): void => reject(abortError(signal));\n\t\tsignal.addEventListener(\"abort\", onAbort, { once: true });\n\t\tvoid promise.then(\n\t\t\t(value) => {\n\t\t\t\tsignal.removeEventListener(\"abort\", onAbort);\n\t\t\t\tresolve(value);\n\t\t\t},\n\t\t\t(error: unknown) => {\n\t\t\t\tsignal.removeEventListener(\"abort\", onAbort);\n\t\t\t\treject(error);\n\t\t\t},\n\t\t);\n\t});\n}\n\nfunction abortError(signal: AbortSignal): Error {\n\tconst reason: unknown = signal.reason;\n\treturn reason instanceof Error ? reason : new DOMException(\"The operation was aborted\", \"AbortError\");\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAcA,MAAM,wBAAwB,GAAwC,MAAM,CAAC,MAAM,CAAC;IACnF,KAAK,EAAE,MAAM,CAAC,mB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MAAM,CAAC,OAAO;QAAE,OAAO,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9D,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACzC,MAAM,OAAO,GAAG,GAAS,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;QACvD,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1D,KAAK,OAAO,CAAC,IAAI,CAChB,CAAC,KAAK,EAAE,EAAE;YACT,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC7C,OAAO,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,EACD,CAAC,KAAc,EAAE,EAAE;YAClB,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC7C,MAAM,CAAC,KAAK,CAAC,CAAC;QACf,CAAC,CACD,CAAC;IACH,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,MAAmB;IACtC,MAAM,MAAM,GAAY,MAAM,CAAC,MAAM,CAAC;IACtC,OAAO,MAAM,YAAY,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,YAAY,CAAC,2BAA2B,EAAE,YAAY,CAAC,CAAC;AACvG,CAAC","sourcesContent":["/** Typed identity for one value carried by a {@link Context}. */\nexport interface ContextKey<T> {\n\treadonly token: symbol;\n\t/** Type-only marker that prevents keys with different value types from being interchangeable. */\n\treadonly valueType?: (value: T) => T;\n}\n\n/** Immutable invocation-scoped values passed explicitly through operations. */\nexport interface Context {\n\treadonly abortSignal: AbortSignal | undefined;\n\tvalue<T>(key: ContextKey<T>): T | undefined;\n\ttoString(): string;\n}\n\nconst ABORT_SIGNAL_CONTEXT_KEY: ContextKey<AbortSignal | undefined> = Object.freeze({\n\ttoken: Symbol(\"chord.abortSignal\"),\n});\n\nabstract class BaseContext implements Context {\n\tabstract value<T>(key: ContextKey<T>): T | undefined;\n\tabstract toString(): string;\n\n\tget abortSignal(): AbortSignal | undefined {\n\t\treturn this.value(ABORT_SIGNAL_CONTEXT_KEY);\n\t}\n}\n\nclass EmptyContext extends BaseContext {\n\treadonly #name: string;\n\n\tconstructor(name: string) {\n\t\tsuper();\n\t\tthis.#name = name;\n\t}\n\n\tvalue<T>(_key: ContextKey<T>): T | undefined {\n\t\treturn undefined;\n\t}\n\n\ttoString(): string {\n\t\treturn this.#name;\n\t}\n}\n\nclass ContextValue<T> extends BaseContext {\n\treadonly #parent: Context;\n\treadonly #key: ContextKey<T>;\n\treadonly #value: T;\n\n\tconstructor(parent: Context, key: ContextKey<T>, value: T) {\n\t\tsuper();\n\t\tthis.#parent = parent;\n\t\tthis.#key = key;\n\t\tthis.#value = value;\n\t}\n\n\tvalue<Value>(key: ContextKey<Value>): Value | undefined {\n\t\tif (key.token === this.#key.token) return this.#value as unknown as Value;\n\t\treturn this.#parent.value(key);\n\t}\n\n\ttoString(): string {\n\t\treturn `${this.#parent}.WithValue(${this.#key.token.description ?? \"anonymous\"})`;\n\t}\n}\n\nexport const BACKGROUND_CONTEXT: Context = new EmptyContext(\"[Context BACKGROUND_CONTEXT]\");\nexport const TODO_CONTEXT: Context = new EmptyContext(\"[Context TODO_CONTEXT]\");\n\nexport function createContextKey<T>(description: string): ContextKey<T> {\n\treturn Object.freeze({ token: Symbol(description) });\n}\n\n/** Derive a context containing one additional or replaced value. */\nexport function withContextValue<T>(key: ContextKey<T>, value: T, parent: Context): Context {\n\treturn new ContextValue(parent, key, value);\n}\n\n/**\n * Derive a context cancelled by either the parent signal or the supplied signal.\n * The parent context remains unchanged.\n */\nexport function withAbortSignal(signal: AbortSignal, context: Context): Context {\n\tconst parentSignal = context.abortSignal;\n\tconst combined = parentSignal === undefined ? signal : AbortSignal.any([parentSignal, signal]);\n\treturn withContextValue(ABORT_SIGNAL_CONTEXT_KEY, combined, context);\n}\n\n/** Derive a context retaining all values except caller cancellation. Intended for mandatory cleanup only. */\nexport function withoutAbortSignal(context: Context): Context {\n\treturn withContextValue(ABORT_SIGNAL_CONTEXT_KEY, undefined, context);\n}\n\n/** Derive an independently cancellable child context. */\nexport function withCancel(context: Context): {\n\treadonly context: Context;\n\treadonly cancel: (reason?: unknown) => void;\n} {\n\tconst controller = new AbortController();\n\treturn {\n\t\tcontext: withAbortSignal(controller.signal, context),\n\t\tcancel: (reason?: unknown) => controller.abort(reason),\n\t};\n}\n\n/**\n * Observe a promise until it settles or the invocation is cancelled.\n * Cancellation rejects only this waiter; it does not cancel the underlying promise.\n */\nexport function awaitWithContext<T>(promise: Promise<T>, context: Context): Promise<T> {\n\tconst signal = context.abortSignal;\n\tif (signal === undefined) return promise;\n\tif (signal.aborted) return Promise.reject(abortError(signal));\n\treturn new Promise<T>((resolve, reject) => {\n\t\tconst onAbort = (): void => reject(abortError(signal));\n\t\tsignal.addEventListener(\"abort\", onAbort, { once: true });\n\t\tvoid promise.then(\n\t\t\t(value) => {\n\t\t\t\tsignal.removeEventListener(\"abort\", onAbort);\n\t\t\t\tresolve(value);\n\t\t\t},\n\t\t\t(error: unknown) => {\n\t\t\t\tsignal.removeEventListener(\"abort\", onAbort);\n\t\t\t\treject(error);\n\t\t\t},\n\t\t);\n\t});\n}\n\nfunction abortError(signal: AbortSignal): Error {\n\tconst reason: unknown = signal.reason;\n\treturn reason instanceof Error ? reason : new DOMException(\"The operation was aborted\", \"AbortError\");\n}\n"]}
@@ -0,0 +1,133 @@
1
+ import type { Static, TSchema } from "typebox";
2
+ import type { Ctx, Exposed, HandleBase, Readable, StateSource } from "./types.ts";
3
+ declare const MEMBER: unique symbol;
4
+ export interface MethodSpec<A extends TSchema = TSchema, R extends TSchema = TSchema> {
5
+ readonly [MEMBER]: "method";
6
+ readonly args: A;
7
+ readonly result: R;
8
+ }
9
+ export interface OpaqueSpec<T = unknown> {
10
+ readonly [MEMBER]: "opaque";
11
+ readonly id: string;
12
+ /** Type carrier only; never set. */
13
+ readonly type?: T;
14
+ }
15
+ export declare const method: <A extends TSchema, R extends TSchema>(args: A, result: R) => MethodSpec<A, R>;
16
+ /** A native in-process object identified by `name@version` (local contracts only). */
17
+ export declare const opaque: <T = unknown>(id: string) => OpaqueSpec<T>;
18
+ export interface VariantDef {
19
+ readonly state?: Readonly<Record<string, TSchema>>;
20
+ readonly methods?: Readonly<Record<string, MethodSpec>>;
21
+ }
22
+ export interface RemoteDef {
23
+ readonly version: number;
24
+ readonly input: TSchema;
25
+ readonly variants: Readonly<Record<string, VariantDef>>;
26
+ }
27
+ /** A local member: a method, an opaque native object, or a state member described by its schema. */
28
+ export type LocalMember = MethodSpec | OpaqueSpec | TSchema;
29
+ export interface LocalDef {
30
+ readonly version: number;
31
+ readonly input: TSchema;
32
+ readonly members?: Readonly<Record<string, LocalMember>>;
33
+ }
34
+ export type MemberDescription = {
35
+ readonly kind: "method";
36
+ readonly args: TSchema;
37
+ readonly result: TSchema;
38
+ } | {
39
+ readonly kind: "state";
40
+ readonly schema: TSchema;
41
+ } | {
42
+ readonly kind: "opaque";
43
+ readonly id: string;
44
+ };
45
+ /** Local contracts have one unnamed variant. */
46
+ export declare const LOCAL_VARIANT = "";
47
+ export interface Description {
48
+ readonly name: string;
49
+ readonly scope: "remote" | "local";
50
+ readonly version: number;
51
+ readonly input: TSchema;
52
+ readonly variants: Readonly<Record<string, Readonly<Record<string, MemberDescription>>>>;
53
+ }
54
+ interface ContractBase {
55
+ readonly name: string;
56
+ readonly version: number;
57
+ readonly input: TSchema;
58
+ readonly description: Description;
59
+ readonly fingerprint: string;
60
+ }
61
+ export interface RemoteContract<D extends RemoteDef = RemoteDef> extends ContractBase {
62
+ readonly scope: "remote";
63
+ readonly def: D;
64
+ }
65
+ export interface LocalContract<D extends LocalDef = LocalDef> extends ContractBase {
66
+ readonly scope: "local";
67
+ readonly def: D;
68
+ }
69
+ export type AnyContract = RemoteContract | LocalContract;
70
+ /** Names a handle uses itself; members may not use them. */
71
+ export declare const RESERVED_MEMBERS: ReadonlySet<string>;
72
+ export declare function remote<const D extends RemoteDef>(name: string, def: D): RemoteContract<D>;
73
+ export declare function local<const D extends LocalDef>(name: string, def: D): LocalContract<D>;
74
+ /**
75
+ * A consumer token received over a link (only its description travels). Has no `def`, so it is only good for binding
76
+ * and validation, never for TypeScript types.
77
+ */
78
+ export declare function contractFromDescription(description: Description): AnyContract;
79
+ /** Returns why `provider` does not cover `consumer`, or undefined when it does. */
80
+ export declare function coverage(provider: Description, consumer: Description): string | undefined;
81
+ /** Maps the provider's current behavior to the view a consumer of an older contract version expects. */
82
+ export type Adapter = (current: Record<string, unknown>) => Record<string, unknown>;
83
+ export type Accepts = Readonly<Record<number, Adapter>>;
84
+ /** How a consumer token binds to a provider: directly or through an `accepts` adapter. Throws contract_mismatch. */
85
+ export declare function bind(provider: AnyContract, accepts: Accepts | undefined, consumer: AnyContract): Adapter | undefined;
86
+ type UnionToIntersection<U> = (U extends unknown ? (value: U) => void : never) extends (value: infer I) => void ? I : never;
87
+ type Empty = Record<never, never>;
88
+ type StateOf<V> = V extends {
89
+ readonly state: infer S extends Readonly<Record<string, TSchema>>;
90
+ } ? S : Empty;
91
+ type StaticOf<S> = S extends TSchema ? Static<S> : never;
92
+ type MethodsOf<V> = V extends {
93
+ readonly methods: infer M extends Readonly<Record<string, MethodSpec>>;
94
+ } ? M : Empty;
95
+ export type Implementation<M> = M extends MethodSpec<infer A, infer R> ? (args: Static<A>, ctx: Ctx) => Static<R> | Promise<Static<R>> : never;
96
+ export type Call<M> = M extends MethodSpec<infer A, infer R> ? (args: Static<A>, ctx?: Ctx) => Promise<Static<R>> : never;
97
+ type VariantBehavior<K, V> = {
98
+ readonly kind: K;
99
+ } & {
100
+ readonly [S in keyof StateOf<V>]: StateSource<StaticOf<StateOf<V>[S]>>;
101
+ } & {
102
+ readonly [M in keyof MethodsOf<V>]: Implementation<MethodsOf<V>[M]>;
103
+ };
104
+ type VariantHandle<V> = {
105
+ readonly [S in keyof StateOf<V>]: Readable<StaticOf<StateOf<V>[S]> | undefined>;
106
+ } & {
107
+ readonly [M in keyof MethodsOf<V>]: Call<MethodsOf<V>[M]>;
108
+ };
109
+ type LocalBehaviorMember<M> = M extends MethodSpec ? Implementation<M> : M extends OpaqueSpec<infer T> ? T | Exposed<T> : M extends TSchema ? StateSource<Static<M>> : never;
110
+ type LocalHandleMember<M> = M extends MethodSpec ? Call<M> : M extends OpaqueSpec<infer T> ? T | undefined : M extends TSchema ? Readable<Static<M> | undefined> : never;
111
+ type LocalMembers<D> = D extends {
112
+ readonly members: infer M extends Readonly<Record<string, LocalMember>>;
113
+ } ? M : Empty;
114
+ export type InputOf<C> = C extends {
115
+ readonly def: {
116
+ readonly input: infer I extends TSchema;
117
+ };
118
+ } ? Static<I> : never;
119
+ /** What a factory returns for contract C. */
120
+ export type BehaviorOf<C> = C extends RemoteContract<infer D> ? {
121
+ [K in keyof D["variants"]]: VariantBehavior<K, D["variants"][K]>;
122
+ }[keyof D["variants"]] : C extends LocalContract<infer D> ? {
123
+ readonly [K in keyof LocalMembers<D>]: LocalBehaviorMember<LocalMembers<D>[K]>;
124
+ } & Record<string, unknown> : never;
125
+ /** Late-bound members a handle exposes for contract C (all variants merged). */
126
+ export type MembersOf<C> = C extends RemoteContract<infer D> ? UnionToIntersection<{
127
+ [K in keyof D["variants"]]: VariantHandle<D["variants"][K]>;
128
+ }[keyof D["variants"]]> : C extends LocalContract<infer D> ? {
129
+ readonly [K in keyof LocalMembers<D>]: LocalHandleMember<LocalMembers<D>[K]>;
130
+ } : never;
131
+ export type Handle<C extends AnyContract = AnyContract> = HandleBase<C> & MembersOf<C>;
132
+ export {};
133
+ //# sourceMappingURL=contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,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AAmB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5G,KAAK,CAAC;AAEV,gFAAgF;AAChF,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,GACzD,mBAAmB,CAAC;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,UAAU,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GACzG,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAC/B;IAAE,QAAQ,EAAE,CAAC,IAAI,MAAM,YAAY,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GAChF,KAAK,CAAC;AAEV,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,IAAI,UAAU,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,157 @@
1
+ import { ChordError } from "./errors.js";
2
+ import { canonicalJson, fits, hash64 } from "./schema.js";
3
+ const MEMBER = Symbol("chord.member");
4
+ export const method = (args, result) => ({
5
+ [MEMBER]: "method",
6
+ args,
7
+ result,
8
+ });
9
+ /** A native in-process object identified by `name@version` (local contracts only). */
10
+ export const opaque = (id) => {
11
+ if (!/^[^@\s]+@\d+$/.test(id))
12
+ throw new TypeError(`opaque id must be name@version: ${id}`);
13
+ return { [MEMBER]: "opaque", id };
14
+ };
15
+ /** Local contracts have one unnamed variant. */
16
+ export const LOCAL_VARIANT = "";
17
+ /** Names a handle uses itself; members may not use them. */
18
+ export const RESERVED_MEMBERS = new Set([
19
+ "kind",
20
+ "status",
21
+ "ready",
22
+ "shape",
23
+ "error",
24
+ "onShape",
25
+ "onStatus",
26
+ "release",
27
+ "then",
28
+ "contract",
29
+ ]);
30
+ function describeMember(name, member, scope) {
31
+ if (RESERVED_MEMBERS.has(name))
32
+ throw new TypeError(`member name is reserved: ${name}`);
33
+ const brand = member[MEMBER];
34
+ if (brand === "method") {
35
+ const spec = member;
36
+ return { kind: "method", args: spec.args, result: spec.result };
37
+ }
38
+ if (brand === "opaque") {
39
+ if (scope === "remote")
40
+ throw new TypeError(`remote contracts cannot expose opaque members: ${name}`);
41
+ return { kind: "opaque", id: member.id };
42
+ }
43
+ return { kind: "state", schema: member };
44
+ }
45
+ function finish(contract) {
46
+ return { ...contract, fingerprint: hash64(canonicalJson(contract.description)) };
47
+ }
48
+ function checkHeader(name, version) {
49
+ if (!name)
50
+ throw new TypeError("contract name is empty");
51
+ if (!Number.isInteger(version) || version < 1)
52
+ throw new TypeError(`contract version must be a positive integer`);
53
+ }
54
+ export function remote(name, def) {
55
+ checkHeader(name, def.version);
56
+ const variants = {};
57
+ if (Object.keys(def.variants).length === 0)
58
+ throw new TypeError(`remote contract ${name} has no variants`);
59
+ for (const [kind, variant] of Object.entries(def.variants)) {
60
+ const members = {};
61
+ for (const [key, schema] of Object.entries(variant.state ?? {}))
62
+ members[key] = describeMember(key, schema, "remote");
63
+ for (const [key, spec] of Object.entries(variant.methods ?? {})) {
64
+ if (key in members)
65
+ throw new TypeError(`member ${key} is both state and method in ${name}.${kind}`);
66
+ members[key] = describeMember(key, spec, "remote");
67
+ if (members[key].kind !== "method")
68
+ throw new TypeError(`methods.${key} is not a method()`);
69
+ }
70
+ variants[kind] = members;
71
+ }
72
+ const description = { name, scope: "remote", version: def.version, input: def.input, variants };
73
+ return finish({
74
+ scope: "remote",
75
+ name,
76
+ version: def.version,
77
+ input: def.input,
78
+ def,
79
+ description,
80
+ });
81
+ }
82
+ export function local(name, def) {
83
+ checkHeader(name, def.version);
84
+ const members = {};
85
+ for (const [key, member] of Object.entries(def.members ?? {}))
86
+ members[key] = describeMember(key, member, "local");
87
+ const description = {
88
+ name,
89
+ scope: "local",
90
+ version: def.version,
91
+ input: def.input,
92
+ variants: { [LOCAL_VARIANT]: members },
93
+ };
94
+ return finish({ scope: "local", name, version: def.version, input: def.input, def, description });
95
+ }
96
+ /**
97
+ * A consumer token received over a link (only its description travels). Has no `def`, so it is only good for binding
98
+ * and validation, never for TypeScript types.
99
+ */
100
+ export function contractFromDescription(description) {
101
+ const { name, scope, version, input } = description;
102
+ if (typeof name !== "string" || (scope !== "remote" && scope !== "local") || !Number.isInteger(version)) {
103
+ throw new ChordError("invalid", "malformed contract token", { reason: "token" });
104
+ }
105
+ const base = { name, version, input, description, fingerprint: hash64(canonicalJson(description)) };
106
+ return scope === "remote"
107
+ ? { ...base, scope, def: { version, input, variants: {} } }
108
+ : { ...base, scope, def: { version, input } };
109
+ }
110
+ /** Returns why `provider` does not cover `consumer`, or undefined when it does. */
111
+ export function coverage(provider, consumer) {
112
+ if (provider.name !== consumer.name || provider.scope !== consumer.scope)
113
+ return "different type";
114
+ if (!fits(consumer.input, provider.input))
115
+ return "input";
116
+ for (const [kind, consumerMembers] of Object.entries(consumer.variants)) {
117
+ const providerMembers = provider.variants[kind];
118
+ if (providerMembers === undefined)
119
+ return `variant ${kind} missing`;
120
+ for (const [name, wanted] of Object.entries(consumerMembers)) {
121
+ const offered = providerMembers[name];
122
+ if (offered === undefined || offered.kind !== wanted.kind)
123
+ return `${kind}.${name} missing or of another kind`;
124
+ if (offered.kind === "method" && wanted.kind === "method") {
125
+ if (!fits(wanted.args, offered.args))
126
+ return `${kind}.${name} arguments`;
127
+ if (!fits(offered.result, wanted.result))
128
+ return `${kind}.${name} result`;
129
+ }
130
+ else if (offered.kind === "state" && wanted.kind === "state") {
131
+ if (!fits(offered.schema, wanted.schema))
132
+ return `${kind}.${name} state`;
133
+ }
134
+ else if (offered.kind === "opaque" && wanted.kind === "opaque" && offered.id !== wanted.id) {
135
+ return `${kind}.${name} opaque ${offered.id} != ${wanted.id}`;
136
+ }
137
+ }
138
+ }
139
+ return undefined;
140
+ }
141
+ /** How a consumer token binds to a provider: directly or through an `accepts` adapter. Throws contract_mismatch. */
142
+ export function bind(provider, accepts, consumer) {
143
+ if (provider.fingerprint === consumer.fingerprint)
144
+ return undefined;
145
+ if (provider.version === consumer.version) {
146
+ const reason = coverage(provider.description, consumer.description);
147
+ if (reason === undefined)
148
+ return undefined;
149
+ throw new ChordError("contract_mismatch", `${provider.name}@${provider.version} does not cover the consumer's description (${reason}); forgotten version bump?`);
150
+ }
151
+ const adapter = accepts?.[consumer.version];
152
+ if (adapter === undefined) {
153
+ throw new ChordError("contract_mismatch", `${provider.name}: provider version ${provider.version}, consumer version ${consumer.version}, no accepts adapter`);
154
+ }
155
+ return adapter;
156
+ }
157
+ //# sourceMappingURL=contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1D,MAAM,MAAM,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAetC,MAAM,CAAC,MAAM,MAAM,GAAG,CAAuC,IAAO,EAAE,MAAS,EAAoB,EAAE,CAAC,CAAC;IACtG,CAAC,MAAM,CAAC,EAAE,QAAQ;IAClB,IAAI;IACJ,MAAM;CACN,CAAC,CAAC;AAEH,sFAAsF;AACtF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAc,EAAU,EAAiB,EAAE;IAChE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;QAAE,MAAM,IAAI,SAAS,CAAC,mCAAmC,EAAE,EAAE,CAAC,CAAC;IAC5F,OAAO,EAAE,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;AACnC,CAAC,CAAC;AA2BF,gDAAg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AI,IAAI,WAAW,OAAO,CAAC,EAAE,OAAO,MAAM,CAAC,EAAE,EAAE,CAAC;YAC/D,CAAC;QACF,CAAC;IACF,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC;AAMD,oHAAoH;AACpH,MAAM,UAAU,IAAI,CAAC,QAAqB,EAAE,OAA4B,EAAE,QAAqB;IAC9F,IAAI,QAAQ,CAAC,WAAW,KAAK,QAAQ,CAAC,WAAW;QAAE,OAAO,SAAS,CAAC;IACpE,IAAI,QAAQ,CAAC,OAAO,KAAK,QAAQ,CAAC,OAAO,EAAE,CAAC;QAC3C,MAAM,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC;QACpE,IAAI,MAAM,KAAK,SAAS;YAAE,OAAO,SAAS,CAAC;QAC3C,MAAM,IAAI,UAAU,CACnB,mBAAmB,EACnB,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,OAAO,+CAA+C,MAAM,4BAA4B,CACrH,CAAC;IACH,CAAC;IACD,MAAM,OAAO,GAAG,OAAO,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC5C,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC3B,MAAM,IAAI,UAAU,CACnB,mBAAmB,EACnB,GAAG,QAAQ,CAAC,IAAI,sBAAsB,QAAQ,CAAC,OAAO,sBAAsB,QAAQ,CAAC,OAAO,sBAAsB,CAClH,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AAChB,CAAC","sourcesContent":["import type { Static, TSchema } from \"typebox\";\nimport { ChordError } from \"./errors.ts\";\nimport { canonicalJson, fits, hash64 } from \"./schema.ts\";\nimport type { Ctx, Exposed, HandleBase, Readable, StateSource } from \"./types.ts\";\n\nconst MEMBER = Symbol(\"chord.member\");\n\nexport interface MethodSpec<A extends TSchema = TSchema, R extends TSchema = TSchema> {\n\treadonly [MEMBER]: \"method\";\n\treadonly args: A;\n\treadonly result: R;\n}\n\nexport interface OpaqueSpec<T = unknown> {\n\treadonly [MEMBER]: \"opaque\";\n\treadonly id: string;\n\t/** Type carrier only; never set. */\n\treadonly type?: T;\n}\n\nexport const method = <A extends TSchema, R extends TSchema>(args: A, result: R): MethodSpec<A, R> => ({\n\t[MEMBER]: \"method\",\n\targs,\n\tresult,\n});\n\n/** A native in-process object identified by `name@version` (local contracts only). */\nexport const opaque = <T = unknown>(id: string): OpaqueSpec<T> => {\n\tif (!/^[^@\\s]+@\\d+$/.test(id)) throw new TypeError(`opaque id must be name@version: ${id}`);\n\treturn { [MEMBER]: \"opaque\", id };\n};\n\nexport interface VariantDef {\n\treadonly state?: Readonly<Record<string, TSchema>>;\n\treadonly methods?: Readonly<Record<string, MethodSpec>>;\n}\n\nexport interface RemoteDef {\n\treadonly version: number;\n\treadonly input: TSchema;\n\treadonly variants: Readonly<Record<string, VariantDef>>;\n}\n\n/** A local member: a method, an opaque native object, or a state member described by its schema. */\nexport type LocalMember = MethodSpec | OpaqueSpec | TSchema;\n\nexport interface LocalDef {\n\treadonly version: number;\n\treadonly input: TSchema;\n\treadonly members?: Readonly<Record<string, LocalMember>>;\n}\n\nexport type MemberDescription =\n\t| { readonly kind: \"method\"; readonly args: TSchema; readonly result: TSchema }\n\t| { readonly kind: \"state\"; readonly schema: TSchema }\n\t| { readonly kind: \"opaque\"; readonly id: string };\n\n/** Local contracts have one unnamed variant. */\nexport const LOCAL_VARIANT = \"\";\n\nexport interface Description {\n\treadonly name: string;\n\treadonly scope: \"remote\" | \"local\";\n\treadonly version: number;\n\treadonly input: TSchema;\n\treadonly variants: Readonly<Record<string, Readonly<Record<string, MemberDescription>>>>;\n}\n\ninterface ContractBase {\n\treadonly name: string;\n\treadonly version: number;\n\treadonly input: TSchema;\n\treadonly description: Description;\n\treadonly fingerprint: string;\n}\n\nexport interface RemoteContract<D extends RemoteDef = RemoteDef> extends ContractBase {\n\treadonly scope: \"remote\";\n\treadonly def: D;\n}\n\nexport interface LocalContract<D extends LocalDef = LocalDef> extends ContractBase {\n\treadonly scope: \"local\";\n\treadonly def: D;\n}\n\nexport type AnyContract = RemoteContract | LocalContract;\n\n/** Names a handle uses itself; members may not use them. */\nexport const RESERVED_MEMBERS: ReadonlySet<string> = new Set([\n\t\"kind\",\n\t\"status\",\n\t\"ready\",\n\t\"shape\",\n\t\"error\",\n\t\"onShape\",\n\t\"onStatus\",\n\t\"release\",\n\t\"then\",\n\t\"contract\",\n]);\n\nfunction describeMember(name: string, member: unknown, scope: \"remote\" | \"local\"): MemberDescription {\n\tif (RESERVED_MEMBERS.has(name)) throw new TypeError(`member name is reserved: ${name}`);\n\tconst brand = (member as { [MEMBER]?: string })[MEMBER];\n\tif (brand === \"method\") {\n\t\tconst spec = member as MethodSpec;\n\t\treturn { kind: \"method\", args: spec.args, result: spec.result };\n\t}\n\tif (brand === \"opaque\") {\n\t\tif (scope === \"remote\") throw new TypeError(`remote contracts cannot expose opaque members: ${name}`);\n\t\treturn { kind: \"opaque\", id: (member as OpaqueSpec).id };\n\t}\n\treturn { kind: \"state\", schema: member as TSchema };\n}\n\nfunction finish<C extends AnyContract>(contract: Omit<C, \"fingerprint\">): C {\n\treturn { ...contract, fingerprint: hash64(canonicalJson(contract.description)) } as C;\n}\n\nfunction checkHeader(name: string, version: number): void {\n\tif (!name) throw new TypeError(\"contract name is empty\");\n\tif (!Number.isInteger(version) || version < 1) throw new TypeError(`contract version must be a positive integer`);\n}\n\nexport function remote<const D extends RemoteDef>(name: string, def: D): RemoteContract<D> {\n\tcheckHeader(name, def.version);\n\tconst variants: Record<string, Record<string, MemberDescription>> = {};\n\tif (Object.keys(def.variants).length === 0) throw new TypeError(`remote contract ${name} has no variants`);\n\tfor (const [kind, variant] of Object.entries(def.variants)) {\n\t\tconst members: Record<string, MemberDescription> = {};\n\t\tfor (const [key, schema] of Object.entries(variant.state ?? {}))\n\t\t\tmembers[key] = describeMember(key, schema, \"remote\");\n\t\tfor (const [key, spec] of Object.entries(variant.methods ?? {})) {\n\t\t\tif (key in members) throw new TypeError(`member ${key} is both state and method in ${name}.${kind}`);\n\t\t\tmembers[key] = describeMember(key, spec, \"remote\");\n\t\t\tif (members[key].kind !== \"method\") throw new TypeError(`methods.${key} is not a method()`);\n\t\t}\n\t\tvariants[kind] = members;\n\t}\n\tconst description: Description = { name, scope: \"remote\", version: def.version, input: def.input, variants };\n\treturn finish<RemoteContract<D>>({\n\t\tscope: \"remote\",\n\t\tname,\n\t\tversion: def.version,\n\t\tinput: def.input,\n\t\tdef,\n\t\tdescription,\n\t});\n}\n\nexport function local<const D extends LocalDef>(name: string, def: D): LocalContract<D> {\n\tcheckHeader(name, def.version);\n\tconst members: Record<string, MemberDescription> = {};\n\tfor (const [key, member] of Object.entries(def.members ?? {})) members[key] = describeMember(key, member, \"local\");\n\tconst description: Description = {\n\t\tname,\n\t\tscope: \"local\",\n\t\tversion: def.version,\n\t\tinput: def.input,\n\t\tvariants: { [LOCAL_VARIANT]: members },\n\t};\n\treturn finish<LocalContract<D>>({ scope: \"local\", name, version: def.version, input: def.input, def, description });\n}\n\n/**\n * A consumer token received over a link (only its description travels). Has no `def`, so it is only good for binding\n * and validation, never for TypeScript types.\n */\nexport function contractFromDescription(description: Description): AnyContract {\n\tconst { name, scope, version, input } = description;\n\tif (typeof name !== \"string\" || (scope !== \"remote\" && scope !== \"local\") || !Number.isInteger(version)) {\n\t\tthrow new ChordError(\"invalid\", \"malformed contract token\", { reason: \"token\" });\n\t}\n\tconst base = { name, version, input, description, fingerprint: hash64(canonicalJson(description)) };\n\treturn scope === \"remote\"\n\t\t? { ...base, scope, def: { version, input, variants: {} } }\n\t\t: { ...base, scope, def: { version, input } };\n}\n\n/** Returns why `provider` does not cover `consumer`, or undefined when it does. */\nexport function coverage(provider: Description, consumer: Description): string | undefined {\n\tif (provider.name !== consumer.name || provider.scope !== consumer.scope) return \"different type\";\n\tif (!fits(consumer.input, provider.input)) return \"input\";\n\tfor (const [kind, consumerMembers] of Object.entries(consumer.variants)) {\n\t\tconst providerMembers = provider.variants[kind];\n\t\tif (providerMembers === undefined) return `variant ${kind} missing`;\n\t\tfor (const [name, wanted] of Object.entries(consumerMembers)) {\n\t\t\tconst offered = providerMembers[name];\n\t\t\tif (offered === undefined || offered.kind !== wanted.kind) return `${kind}.${name} missing or of another kind`;\n\t\t\tif (offered.kind === \"method\" && wanted.kind === \"method\") {\n\t\t\t\tif (!fits(wanted.args, offered.args)) return `${kind}.${name} arguments`;\n\t\t\t\tif (!fits(offered.result, wanted.result)) return `${kind}.${name} result`;\n\t\t\t} else if (offered.kind === \"state\" && wanted.kind === \"state\") {\n\t\t\t\tif (!fits(offered.schema, wanted.schema)) return `${kind}.${name} state`;\n\t\t\t} else if (offered.kind === \"opaque\" && wanted.kind === \"opaque\" && offered.id !== wanted.id) {\n\t\t\t\treturn `${kind}.${name} opaque ${offered.id} != ${wanted.id}`;\n\t\t\t}\n\t\t}\n\t}\n\treturn undefined;\n}\n\n/** Maps the provider's current behavior to the view a consumer of an older contract version expects. */\nexport type Adapter = (current: Record<string, unknown>) => Record<string, unknown>;\nexport type Accepts = Readonly<Record<number, Adapter>>;\n\n/** How a consumer token binds to a provider: directly or through an `accepts` adapter. Throws contract_mismatch. */\nexport function bind(provider: AnyContract, accepts: Accepts | undefined, consumer: AnyContract): Adapter | undefined {\n\tif (provider.fingerprint === consumer.fingerprint) return undefined;\n\tif (provider.version === consumer.version) {\n\t\tconst reason = coverage(provider.description, consumer.description);\n\t\tif (reason === undefined) return undefined;\n\t\tthrow new ChordError(\n\t\t\t\"contract_mismatch\",\n\t\t\t`${provider.name}@${provider.version} does not cover the consumer's description (${reason}); forgotten version bump?`,\n\t\t);\n\t}\n\tconst adapter = accepts?.[consumer.version];\n\tif (adapter === undefined) {\n\t\tthrow new ChordError(\n\t\t\t\"contract_mismatch\",\n\t\t\t`${provider.name}: provider version ${provider.version}, consumer version ${consumer.version}, no accepts adapter`,\n\t\t);\n\t}\n\treturn adapter;\n}\n\n// ─── Static types ────────────────────────────────────────────────────────────\n\ntype UnionToIntersection<U> = (U extends unknown ? (value: U) => void : never) extends (value: infer I) => void\n\t? I\n\t: never;\ntype Empty = Record<never, never>;\ntype StateOf<V> = V extends { readonly state: infer S extends Readonly<Record<string, TSchema>> } ? S : Empty;\ntype StaticOf<S> = S extends TSchema ? Static<S> : never;\ntype MethodsOf<V> = V extends { readonly methods: infer M extends Readonly<Record<string, MethodSpec>> } ? M : Empty;\n\nexport type Implementation<M> = M extends MethodSpec<infer A, infer R>\n\t? (args: Static<A>, ctx: Ctx) => Static<R> | Promise<Static<R>>\n\t: never;\nexport type Call<M> = M extends MethodSpec<infer A, infer R>\n\t? (args: Static<A>, ctx?: Ctx) => Promise<Static<R>>\n\t: never;\n\ntype VariantBehavior<K, V> = { readonly kind: K } & {\n\treadonly [S in keyof StateOf<V>]: StateSource<StaticOf<StateOf<V>[S]>>;\n} & {\n\treadonly [M in keyof MethodsOf<V>]: Implementation<MethodsOf<V>[M]>;\n};\ntype VariantHandle<V> = { readonly [S in keyof StateOf<V>]: Readable<StaticOf<StateOf<V>[S]> | undefined> } & {\n\treadonly [M in keyof MethodsOf<V>]: Call<MethodsOf<V>[M]>;\n};\n\ntype LocalBehaviorMember<M> = M extends MethodSpec\n\t? Implementation<M>\n\t: M extends OpaqueSpec<infer T>\n\t\t? T | Exposed<T>\n\t\t: M extends TSchema\n\t\t\t? StateSource<Static<M>>\n\t\t\t: never;\ntype LocalHandleMember<M> = M extends MethodSpec\n\t? Call<M>\n\t: M extends OpaqueSpec<infer T>\n\t\t? T | undefined\n\t\t: M extends TSchema\n\t\t\t? Readable<Static<M> | undefined>\n\t\t\t: never;\ntype LocalMembers<D> = D extends { readonly members: infer M extends Readonly<Record<string, LocalMember>> }\n\t? M\n\t: Empty;\n\nexport type InputOf<C> = C extends { readonly def: { readonly input: infer I extends TSchema } } ? Static<I> : never;\n\n/** What a factory returns for contract C. */\nexport type BehaviorOf<C> = C extends RemoteContract<infer D>\n\t? { [K in keyof D[\"variants\"]]: VariantBehavior<K, D[\"variants\"][K]> }[keyof D[\"variants\"]]\n\t: C extends LocalContract<infer D>\n\t\t? { readonly [K in keyof LocalMembers<D>]: LocalBehaviorMember<LocalMembers<D>[K]> } & Record<string, unknown>\n\t\t: never;\n\n/** Late-bound members a handle exposes for contract C (all variants merged). */\nexport type MembersOf<C> = C extends RemoteContract<infer D>\n\t? UnionToIntersection<{ [K in keyof D[\"variants\"]]: VariantHandle<D[\"variants\"][K]> }[keyof D[\"variants\"]]>\n\t: C extends LocalContract<infer D>\n\t\t? { readonly [K in keyof LocalMembers<D>]: LocalHandleMember<LocalMembers<D>[K]> }\n\t\t: never;\n\nexport type Handle<C extends AnyContract = AnyContract> = HandleBase<C> & MembersOf<C>;\n"]}