@pome-sh/cli 0.20.0 → 0.21.1

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 (2782) hide show
  1. package/README.md +6 -4
  2. package/dist/agent-Q2UTRJYL.js +408 -0
  3. package/dist/build-info.json +3 -3
  4. package/dist/checks-NLPYKDGN.js +290 -0
  5. package/dist/chunk-2Q7AYEUA.js +1207 -0
  6. package/dist/chunk-APAS34RJ.js +6614 -0
  7. package/dist/chunk-BSKITCXD.js +116 -0
  8. package/dist/chunk-CBFKZZBR.js +96 -0
  9. package/dist/chunk-D3GRORLQ.js +1614 -0
  10. package/dist/chunk-GEAGPLZZ.js +57 -0
  11. package/dist/chunk-IY6G5NWT.js +330 -0
  12. package/dist/chunk-LZIPGCQJ.js +1512 -0
  13. package/dist/chunk-NW7HGA2K.js +1 -0
  14. package/dist/chunk-NY55QTVQ.js +120 -0
  15. package/dist/chunk-OHKJGCWS.js +186 -0
  16. package/dist/chunk-OKDJRKJV.js +4390 -0
  17. package/dist/chunk-PPJUFV6S.js +1179 -0
  18. package/dist/chunk-RGZBC7NF.js +90 -0
  19. package/dist/chunk-SG6ZTIMT.js +145 -0
  20. package/dist/chunk-VBATFCWR.js +442 -0
  21. package/dist/chunk-W5EJAOWD.js +462 -0
  22. package/dist/chunk-WVWV7DLA.js +6061 -0
  23. package/dist/chunk-XDU6TD4O.js +20 -0
  24. package/dist/chunk-ZX4WNSZ5.js +71 -0
  25. package/dist/egress-4V6DVJZ7.js +1 -0
  26. package/dist/install-4OATBKG3.js +22 -0
  27. package/dist/render-ZQQ4UMNO.js +40 -0
  28. package/dist/run-CFA4LZWQ.js +203 -0
  29. package/dist/runDemo-VWKBJRSL.js +327 -0
  30. package/dist/runTrialGroup-NCD4Q2QU.js +277 -0
  31. package/dist/server-Y52EIWDP.js +3 -0
  32. package/dist/src/cli/main.js +5381 -1079
  33. package/dist/src-4SVLX7UK.js +4398 -0
  34. package/dist/src-GGRWNJTK.js +2869 -0
  35. package/dist/src-JGOW5WYI.js +5 -0
  36. package/dist/src-KIHABGI5.js +5 -0
  37. package/dist/src-TUX5L2RC.js +4 -0
  38. package/dist/twinHarness-IZC72UQN.js +5 -0
  39. package/dist/twinStart-S2CCEZWQ.js +111 -0
  40. package/package.json +17 -27
  41. package/dist/examples/agents/llm-refund-agent.d.ts +0 -1
  42. package/dist/examples/agents/llm-refund-agent.js +0 -140
  43. package/dist/examples/agents/llm-triage-agent.d.ts +0 -1
  44. package/dist/examples/agents/llm-triage-agent.js +0 -136
  45. package/dist/examples/agents/mcp-loop-agent.d.ts +0 -1
  46. package/dist/examples/agents/mcp-loop-agent.js +0 -61
  47. package/dist/examples/agents/scripted-pr-reviewer-agent.d.ts +0 -1
  48. package/dist/examples/agents/scripted-pr-reviewer-agent.js +0 -77
  49. package/dist/examples/agents/scripted-triage-agent.d.ts +0 -1
  50. package/dist/examples/agents/scripted-triage-agent.js +0 -92
  51. package/dist/src/capture-server/egress.d.ts +0 -19
  52. package/dist/src/capture-server/egress.js +0 -152
  53. package/dist/src/capture-server/index.d.ts +0 -12
  54. package/dist/src/capture-server/index.js +0 -198
  55. package/dist/src/capture-server/run.d.ts +0 -7
  56. package/dist/src/capture-server/run.js +0 -26
  57. package/dist/src/cli/agent-identity.d.ts +0 -20
  58. package/dist/src/cli/agent-identity.js +0 -64
  59. package/dist/src/cli/agent-resolver.d.ts +0 -29
  60. package/dist/src/cli/agent-resolver.js +0 -131
  61. package/dist/src/cli/checks-add.d.ts +0 -27
  62. package/dist/src/cli/checks-add.js +0 -238
  63. package/dist/src/cli/checks-lint.d.ts +0 -1
  64. package/dist/src/cli/checks-lint.js +0 -59
  65. package/dist/src/cli/checks.d.ts +0 -36
  66. package/dist/src/cli/checks.js +0 -197
  67. package/dist/src/cli/compile-seeds.d.ts +0 -7
  68. package/dist/src/cli/compile-seeds.js +0 -260
  69. package/dist/src/cli/credentials.d.ts +0 -32
  70. package/dist/src/cli/credentials.js +0 -121
  71. package/dist/src/cli/criterion-binding.d.ts +0 -41
  72. package/dist/src/cli/criterion-binding.js +0 -111
  73. package/dist/src/cli/default-task.d.ts +0 -38
  74. package/dist/src/cli/default-task.js +0 -141
  75. package/dist/src/cli/defaults.d.ts +0 -4
  76. package/dist/src/cli/defaults.js +0 -5
  77. package/dist/src/cli/docs-topics.d.ts +0 -13
  78. package/dist/src/cli/docs-topics.js +0 -157
  79. package/dist/src/cli/docs.d.ts +0 -7
  80. package/dist/src/cli/docs.js +0 -178
  81. package/dist/src/cli/eval.d.ts +0 -83
  82. package/dist/src/cli/eval.js +0 -443
  83. package/dist/src/cli/frameworks.d.ts +0 -12
  84. package/dist/src/cli/frameworks.js +0 -62
  85. package/dist/src/cli/init-sdk.d.ts +0 -12
  86. package/dist/src/cli/init-sdk.js +0 -140
  87. package/dist/src/cli/install.d.ts +0 -4
  88. package/dist/src/cli/install.js +0 -36
  89. package/dist/src/cli/keychain.d.ts +0 -5
  90. package/dist/src/cli/keychain.js +0 -80
  91. package/dist/src/cli/link-cache.d.ts +0 -23
  92. package/dist/src/cli/link-cache.js +0 -91
  93. package/dist/src/cli/login.d.ts +0 -6
  94. package/dist/src/cli/login.js +0 -195
  95. package/dist/src/cli/main.d.ts +0 -3
  96. package/dist/src/cli/project-config.d.ts +0 -37
  97. package/dist/src/cli/project-config.js +0 -145
  98. package/dist/src/cli/register.d.ts +0 -33
  99. package/dist/src/cli/register.js +0 -194
  100. package/dist/src/cli/resolve-package-root.d.ts +0 -2
  101. package/dist/src/cli/resolve-package-root.js +0 -20
  102. package/dist/src/cli/session.d.ts +0 -35
  103. package/dist/src/cli/session.js +0 -294
  104. package/dist/src/cli/tasks-catalog.d.ts +0 -25
  105. package/dist/src/cli/tasks-catalog.js +0 -196
  106. package/dist/src/cli/tasks.d.ts +0 -13
  107. package/dist/src/cli/tasks.js +0 -144
  108. package/dist/src/cli/vocabulary-skew.d.ts +0 -64
  109. package/dist/src/cli/vocabulary-skew.js +0 -187
  110. package/dist/src/demo/agent.d.ts +0 -30
  111. package/dist/src/demo/agent.js +0 -231
  112. package/dist/src/demo/capacity.d.ts +0 -18
  113. package/dist/src/demo/capacity.js +0 -94
  114. package/dist/src/demo/gateway.d.ts +0 -66
  115. package/dist/src/demo/gateway.js +0 -76
  116. package/dist/src/demo/ids.d.ts +0 -4
  117. package/dist/src/demo/ids.js +0 -28
  118. package/dist/src/demo/mint.d.ts +0 -17
  119. package/dist/src/demo/mint.js +0 -78
  120. package/dist/src/demo/proxyRequest.d.ts +0 -21
  121. package/dist/src/demo/proxyRequest.js +0 -156
  122. package/dist/src/demo/render.d.ts +0 -32
  123. package/dist/src/demo/render.js +0 -96
  124. package/dist/src/demo/runDemo.d.ts +0 -33
  125. package/dist/src/demo/runDemo.js +0 -314
  126. package/dist/src/demo/task.d.ts +0 -10
  127. package/dist/src/demo/task.js +0 -32
  128. package/dist/src/doctor/checks.d.ts +0 -19
  129. package/dist/src/doctor/checks.js +0 -208
  130. package/dist/src/doctor/render.d.ts +0 -17
  131. package/dist/src/doctor/render.js +0 -39
  132. package/dist/src/doctor/scan.d.ts +0 -16
  133. package/dist/src/doctor/scan.js +0 -127
  134. package/dist/src/fix-prompt/index.d.ts +0 -20
  135. package/dist/src/fix-prompt/index.js +0 -31
  136. package/dist/src/fix-prompt/prompt.d.ts +0 -32
  137. package/dist/src/fix-prompt/prompt.js +0 -240
  138. package/dist/src/hosted/client.d.ts +0 -209
  139. package/dist/src/hosted/client.js +0 -722
  140. package/dist/src/hosted/errors.d.ts +0 -60
  141. package/dist/src/hosted/errors.js +0 -120
  142. package/dist/src/hosted/evalResultCache.d.ts +0 -71
  143. package/dist/src/hosted/evalResultCache.js +0 -219
  144. package/dist/src/hosted/evalResultView.d.ts +0 -40
  145. package/dist/src/hosted/evalResultView.js +0 -103
  146. package/dist/src/hosted/uploadAndFinalize.d.ts +0 -85
  147. package/dist/src/hosted/uploadAndFinalize.js +0 -238
  148. package/dist/src/recorder/artifacts.d.ts +0 -34
  149. package/dist/src/recorder/artifacts.js +0 -153
  150. package/dist/src/recorder/inspect.d.ts +0 -37
  151. package/dist/src/recorder/inspect.js +0 -195
  152. package/dist/src/recorder/recorder.d.ts +0 -14
  153. package/dist/src/recorder/recorder.js +0 -16
  154. package/dist/src/recorder/redaction.d.ts +0 -1
  155. package/dist/src/recorder/redaction.js +0 -2
  156. package/dist/src/recorder/specMeta.d.ts +0 -8
  157. package/dist/src/recorder/specMeta.js +0 -79
  158. package/dist/src/runner/agentRunner.d.ts +0 -12
  159. package/dist/src/runner/agentRunner.js +0 -163
  160. package/dist/src/runner/captureServerChild.d.ts +0 -16
  161. package/dist/src/runner/captureServerChild.js +0 -148
  162. package/dist/src/runner/groupRender.d.ts +0 -65
  163. package/dist/src/runner/groupRender.js +0 -144
  164. package/dist/src/runner/mergeAdapterSignals.d.ts +0 -27
  165. package/dist/src/runner/mergeAdapterSignals.js +0 -137
  166. package/dist/src/runner/ports.d.ts +0 -1
  167. package/dist/src/runner/ports.js +0 -21
  168. package/dist/src/runner/runTask.d.ts +0 -831
  169. package/dist/src/runner/runTask.js +0 -275
  170. package/dist/src/runner/runTaskCore.d.ts +0 -21
  171. package/dist/src/runner/runTaskCore.js +0 -26
  172. package/dist/src/runner/runTaskHosted.d.ts +0 -97
  173. package/dist/src/runner/runTaskHosted.js +0 -660
  174. package/dist/src/runner/runTrialGroup.d.ts +0 -49
  175. package/dist/src/runner/runTrialGroup.js +0 -264
  176. package/dist/src/runner/trialCount.d.ts +0 -8
  177. package/dist/src/runner/trialCount.js +0 -32
  178. package/dist/src/scaffolds/mcp-loop/loop.d.ts +0 -47
  179. package/dist/src/scaffolds/mcp-loop/loop.js +0 -331
  180. package/dist/src/scaffolds/mcp-loop/providers.d.ts +0 -29
  181. package/dist/src/scaffolds/mcp-loop/providers.js +0 -142
  182. package/dist/src/task/githubSeedCompat.d.ts +0 -3
  183. package/dist/src/task/githubSeedCompat.js +0 -48
  184. package/dist/src/task/insertCriterion.d.ts +0 -15
  185. package/dist/src/task/insertCriterion.js +0 -67
  186. package/dist/src/task/parseTask.d.ts +0 -35
  187. package/dist/src/task/parseTask.js +0 -398
  188. package/dist/src/task/seed-compiler-hosted.d.ts +0 -8
  189. package/dist/src/task/seed-compiler-hosted.js +0 -122
  190. package/dist/src/task/seed-compiler.d.ts +0 -11
  191. package/dist/src/task/seed-compiler.js +0 -61
  192. package/dist/src/task/seed-verifier.d.ts +0 -1
  193. package/dist/src/task/seed-verifier.js +0 -23
  194. package/dist/src/task/taskSchema.d.ts +0 -1978
  195. package/dist/src/task/taskSchema.js +0 -106
  196. package/dist/src/twin/githubCloneAdapter.d.ts +0 -70
  197. package/dist/src/twin/githubCloneAdapter.js +0 -19
  198. package/dist/src/twin/twinHarness.d.ts +0 -52
  199. package/dist/src/twin/twinHarness.js +0 -186
  200. package/dist/src/twin/twinStart.d.ts +0 -21
  201. package/dist/src/twin/twinStart.js +0 -174
  202. package/dist/src/types/shared.d.ts +0 -1
  203. package/dist/src/types/shared.js +0 -2
  204. package/node_modules/@hono/node-server/LICENSE +0 -21
  205. package/node_modules/@hono/node-server/README.md +0 -437
  206. package/node_modules/@hono/node-server/dist/conninfo.cjs +0 -22
  207. package/node_modules/@hono/node-server/dist/conninfo.d.cts +0 -11
  208. package/node_modules/@hono/node-server/dist/conninfo.d.mts +0 -11
  209. package/node_modules/@hono/node-server/dist/conninfo.mjs +0 -20
  210. package/node_modules/@hono/node-server/dist/constants-BLSFu_RU.mjs +0 -5
  211. package/node_modules/@hono/node-server/dist/constants-BXAKTxRC.cjs +0 -11
  212. package/node_modules/@hono/node-server/dist/early-hints.cjs +0 -35
  213. package/node_modules/@hono/node-server/dist/early-hints.d.cts +0 -16
  214. package/node_modules/@hono/node-server/dist/early-hints.d.mts +0 -16
  215. package/node_modules/@hono/node-server/dist/early-hints.mjs +0 -33
  216. package/node_modules/@hono/node-server/dist/index.cjs +0 -1176
  217. package/node_modules/@hono/node-server/dist/index.d.cts +0 -101
  218. package/node_modules/@hono/node-server/dist/index.d.mts +0 -101
  219. package/node_modules/@hono/node-server/dist/index.mjs +0 -1171
  220. package/node_modules/@hono/node-server/dist/serve-static.cjs +0 -151
  221. package/node_modules/@hono/node-server/dist/serve-static.d.cts +0 -18
  222. package/node_modules/@hono/node-server/dist/serve-static.d.mts +0 -18
  223. package/node_modules/@hono/node-server/dist/serve-static.mjs +0 -150
  224. package/node_modules/@hono/node-server/dist/utils/response.cjs +0 -8
  225. package/node_modules/@hono/node-server/dist/utils/response.d.cts +0 -4
  226. package/node_modules/@hono/node-server/dist/utils/response.d.mts +0 -4
  227. package/node_modules/@hono/node-server/dist/utils/response.mjs +0 -7
  228. package/node_modules/@hono/node-server/dist/utils/stream.cjs +0 -65
  229. package/node_modules/@hono/node-server/dist/utils/stream.d.cts +0 -6
  230. package/node_modules/@hono/node-server/dist/utils/stream.d.mts +0 -6
  231. package/node_modules/@hono/node-server/dist/utils/stream.mjs +0 -64
  232. package/node_modules/@hono/node-server/package.json +0 -127
  233. package/node_modules/@pome-sh/sdk/dist/admin-gate.d.ts +0 -35
  234. package/node_modules/@pome-sh/sdk/dist/admin-gate.js +0 -103
  235. package/node_modules/@pome-sh/sdk/dist/admin-gate.js.map +0 -1
  236. package/node_modules/@pome-sh/sdk/dist/auth.d.ts +0 -100
  237. package/node_modules/@pome-sh/sdk/dist/auth.js +0 -262
  238. package/node_modules/@pome-sh/sdk/dist/auth.js.map +0 -1
  239. package/node_modules/@pome-sh/sdk/dist/build-info.d.ts +0 -7
  240. package/node_modules/@pome-sh/sdk/dist/build-info.js +0 -14
  241. package/node_modules/@pome-sh/sdk/dist/build-info.js.map +0 -1
  242. package/node_modules/@pome-sh/sdk/dist/check-discrimination.d.ts +0 -7
  243. package/node_modules/@pome-sh/sdk/dist/check-discrimination.js +0 -81
  244. package/node_modules/@pome-sh/sdk/dist/check-discrimination.js.map +0 -1
  245. package/node_modules/@pome-sh/sdk/dist/check-state-path.d.ts +0 -71
  246. package/node_modules/@pome-sh/sdk/dist/check-state-path.js +0 -200
  247. package/node_modules/@pome-sh/sdk/dist/check-state-path.js.map +0 -1
  248. package/node_modules/@pome-sh/sdk/dist/checks.d.ts +0 -93
  249. package/node_modules/@pome-sh/sdk/dist/checks.js +0 -218
  250. package/node_modules/@pome-sh/sdk/dist/checks.js.map +0 -1
  251. package/node_modules/@pome-sh/sdk/dist/db.d.ts +0 -44
  252. package/node_modules/@pome-sh/sdk/dist/db.js +0 -113
  253. package/node_modules/@pome-sh/sdk/dist/db.js.map +0 -1
  254. package/node_modules/@pome-sh/sdk/dist/errors.d.ts +0 -24
  255. package/node_modules/@pome-sh/sdk/dist/errors.js +0 -61
  256. package/node_modules/@pome-sh/sdk/dist/errors.js.map +0 -1
  257. package/node_modules/@pome-sh/sdk/dist/failure-injection.d.ts +0 -43
  258. package/node_modules/@pome-sh/sdk/dist/failure-injection.js +0 -167
  259. package/node_modules/@pome-sh/sdk/dist/failure-injection.js.map +0 -1
  260. package/node_modules/@pome-sh/sdk/dist/fidelity-inventory.d.ts +0 -121
  261. package/node_modules/@pome-sh/sdk/dist/fidelity-inventory.js +0 -204
  262. package/node_modules/@pome-sh/sdk/dist/fidelity-inventory.js.map +0 -1
  263. package/node_modules/@pome-sh/sdk/dist/fidelity.d.ts +0 -8
  264. package/node_modules/@pome-sh/sdk/dist/fidelity.js +0 -39
  265. package/node_modules/@pome-sh/sdk/dist/fidelity.js.map +0 -1
  266. package/node_modules/@pome-sh/sdk/dist/index.d.ts +0 -380
  267. package/node_modules/@pome-sh/sdk/dist/index.js +0 -140
  268. package/node_modules/@pome-sh/sdk/dist/index.js.map +0 -1
  269. package/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.d.ts +0 -10
  270. package/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.js +0 -231
  271. package/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.js.map +0 -1
  272. package/node_modules/@pome-sh/sdk/dist/parity.d.ts +0 -61
  273. package/node_modules/@pome-sh/sdk/dist/parity.js +0 -123
  274. package/node_modules/@pome-sh/sdk/dist/parity.js.map +0 -1
  275. package/node_modules/@pome-sh/sdk/dist/recorder.d.ts +0 -129
  276. package/node_modules/@pome-sh/sdk/dist/recorder.js +0 -381
  277. package/node_modules/@pome-sh/sdk/dist/recorder.js.map +0 -1
  278. package/node_modules/@pome-sh/sdk/dist/redaction.d.ts +0 -1
  279. package/node_modules/@pome-sh/sdk/dist/redaction.js +0 -3
  280. package/node_modules/@pome-sh/sdk/dist/redaction.js.map +0 -1
  281. package/node_modules/@pome-sh/sdk/dist/request-capture.d.ts +0 -31
  282. package/node_modules/@pome-sh/sdk/dist/request-capture.js +0 -59
  283. package/node_modules/@pome-sh/sdk/dist/request-capture.js.map +0 -1
  284. package/node_modules/@pome-sh/sdk/dist/server-helpers.d.ts +0 -54
  285. package/node_modules/@pome-sh/sdk/dist/server-helpers.js +0 -181
  286. package/node_modules/@pome-sh/sdk/dist/server-helpers.js.map +0 -1
  287. package/node_modules/@pome-sh/sdk/dist/server.d.ts +0 -47
  288. package/node_modules/@pome-sh/sdk/dist/server.js +0 -407
  289. package/node_modules/@pome-sh/sdk/dist/server.js.map +0 -1
  290. package/node_modules/@pome-sh/sdk/dist/tool-context.d.ts +0 -8
  291. package/node_modules/@pome-sh/sdk/dist/tool-context.js +0 -22
  292. package/node_modules/@pome-sh/sdk/dist/tool-context.js.map +0 -1
  293. package/node_modules/@pome-sh/sdk/package.json +0 -58
  294. package/node_modules/@pome-sh/shared-types/dist/errors.d.ts +0 -39
  295. package/node_modules/@pome-sh/shared-types/dist/errors.js +0 -33
  296. package/node_modules/@pome-sh/shared-types/dist/errors.js.map +0 -1
  297. package/node_modules/@pome-sh/shared-types/dist/finalize-shapes.d.ts +0 -254
  298. package/node_modules/@pome-sh/shared-types/dist/finalize-shapes.js +0 -122
  299. package/node_modules/@pome-sh/shared-types/dist/finalize-shapes.js.map +0 -1
  300. package/node_modules/@pome-sh/shared-types/dist/github-access-control.d.ts +0 -175
  301. package/node_modules/@pome-sh/shared-types/dist/github-access-control.js +0 -182
  302. package/node_modules/@pome-sh/shared-types/dist/github-access-control.js.map +0 -1
  303. package/node_modules/@pome-sh/shared-types/dist/identity.d.ts +0 -90
  304. package/node_modules/@pome-sh/shared-types/dist/identity.js +0 -72
  305. package/node_modules/@pome-sh/shared-types/dist/identity.js.map +0 -1
  306. package/node_modules/@pome-sh/shared-types/dist/index.d.ts +0 -28
  307. package/node_modules/@pome-sh/shared-types/dist/index.js +0 -35
  308. package/node_modules/@pome-sh/shared-types/dist/index.js.map +0 -1
  309. package/node_modules/@pome-sh/shared-types/dist/manifest.d.ts +0 -31
  310. package/node_modules/@pome-sh/shared-types/dist/manifest.js +0 -76
  311. package/node_modules/@pome-sh/shared-types/dist/manifest.js.map +0 -1
  312. package/node_modules/@pome-sh/shared-types/dist/otel/event-schema.d.ts +0 -424
  313. package/node_modules/@pome-sh/shared-types/dist/otel/event-schema.js +0 -33
  314. package/node_modules/@pome-sh/shared-types/dist/otel/event-schema.js.map +0 -1
  315. package/node_modules/@pome-sh/shared-types/dist/otel/fixtures/data.d.ts +0 -65
  316. package/node_modules/@pome-sh/shared-types/dist/otel/fixtures/data.js +0 -455
  317. package/node_modules/@pome-sh/shared-types/dist/otel/fixtures/data.js.map +0 -1
  318. package/node_modules/@pome-sh/shared-types/dist/otel/fixtures/index.d.ts +0 -39
  319. package/node_modules/@pome-sh/shared-types/dist/otel/fixtures/index.js +0 -47
  320. package/node_modules/@pome-sh/shared-types/dist/otel/fixtures/index.js.map +0 -1
  321. package/node_modules/@pome-sh/shared-types/dist/otel/index.d.ts +0 -25
  322. package/node_modules/@pome-sh/shared-types/dist/otel/index.js +0 -27
  323. package/node_modules/@pome-sh/shared-types/dist/otel/index.js.map +0 -1
  324. package/node_modules/@pome-sh/shared-types/dist/otel/legacy-shim.d.ts +0 -105
  325. package/node_modules/@pome-sh/shared-types/dist/otel/legacy-shim.js +0 -198
  326. package/node_modules/@pome-sh/shared-types/dist/otel/legacy-shim.js.map +0 -1
  327. package/node_modules/@pome-sh/shared-types/dist/otel/map-span.d.ts +0 -64
  328. package/node_modules/@pome-sh/shared-types/dist/otel/map-span.js +0 -112
  329. package/node_modules/@pome-sh/shared-types/dist/otel/map-span.js.map +0 -1
  330. package/node_modules/@pome-sh/shared-types/dist/otel/nano.d.ts +0 -26
  331. package/node_modules/@pome-sh/shared-types/dist/otel/nano.js +0 -61
  332. package/node_modules/@pome-sh/shared-types/dist/otel/nano.js.map +0 -1
  333. package/node_modules/@pome-sh/shared-types/dist/otel/project.d.ts +0 -42
  334. package/node_modules/@pome-sh/shared-types/dist/otel/project.js +0 -104
  335. package/node_modules/@pome-sh/shared-types/dist/otel/project.js.map +0 -1
  336. package/node_modules/@pome-sh/shared-types/dist/otel/semconv.d.ts +0 -57
  337. package/node_modules/@pome-sh/shared-types/dist/otel/semconv.js +0 -102
  338. package/node_modules/@pome-sh/shared-types/dist/otel/semconv.js.map +0 -1
  339. package/node_modules/@pome-sh/shared-types/dist/otel/span-event.d.ts +0 -198
  340. package/node_modules/@pome-sh/shared-types/dist/otel/span-event.js +0 -166
  341. package/node_modules/@pome-sh/shared-types/dist/otel/span-event.js.map +0 -1
  342. package/node_modules/@pome-sh/shared-types/dist/recorder-events.d.ts +0 -526
  343. package/node_modules/@pome-sh/shared-types/dist/recorder-events.js +0 -381
  344. package/node_modules/@pome-sh/shared-types/dist/recorder-events.js.map +0 -1
  345. package/node_modules/@pome-sh/shared-types/dist/redaction.d.ts +0 -2
  346. package/node_modules/@pome-sh/shared-types/dist/redaction.js +0 -152
  347. package/node_modules/@pome-sh/shared-types/dist/redaction.js.map +0 -1
  348. package/node_modules/@pome-sh/shared-types/dist/rest.d.ts +0 -259
  349. package/node_modules/@pome-sh/shared-types/dist/rest.js +0 -346
  350. package/node_modules/@pome-sh/shared-types/dist/rest.js.map +0 -1
  351. package/node_modules/@pome-sh/shared-types/dist/run.d.ts +0 -208
  352. package/node_modules/@pome-sh/shared-types/dist/run.js +0 -170
  353. package/node_modules/@pome-sh/shared-types/dist/run.js.map +0 -1
  354. package/node_modules/@pome-sh/shared-types/dist/seed-envelope.d.ts +0 -14
  355. package/node_modules/@pome-sh/shared-types/dist/seed-envelope.js +0 -46
  356. package/node_modules/@pome-sh/shared-types/dist/seed-envelope.js.map +0 -1
  357. package/node_modules/@pome-sh/shared-types/dist/seed-state.d.ts +0 -1506
  358. package/node_modules/@pome-sh/shared-types/dist/seed-state.js +0 -462
  359. package/node_modules/@pome-sh/shared-types/dist/seed-state.js.map +0 -1
  360. package/node_modules/@pome-sh/shared-types/dist/sessions.d.ts +0 -53
  361. package/node_modules/@pome-sh/shared-types/dist/sessions.js +0 -51
  362. package/node_modules/@pome-sh/shared-types/dist/sessions.js.map +0 -1
  363. package/node_modules/@pome-sh/shared-types/dist/task-vocab.d.ts +0 -80
  364. package/node_modules/@pome-sh/shared-types/dist/task-vocab.js +0 -98
  365. package/node_modules/@pome-sh/shared-types/dist/task-vocab.js.map +0 -1
  366. package/node_modules/@pome-sh/shared-types/dist/task.d.ts +0 -1193
  367. package/node_modules/@pome-sh/shared-types/dist/task.js +0 -60
  368. package/node_modules/@pome-sh/shared-types/dist/task.js.map +0 -1
  369. package/node_modules/@pome-sh/shared-types/manifest-schema.json +0 -68
  370. package/node_modules/@pome-sh/shared-types/package.json +0 -55
  371. package/node_modules/@pome-sh/shared-types/trace-contract.json +0 -89
  372. package/node_modules/@pome-sh/twin-github/FIDELITY.md +0 -395
  373. package/node_modules/@pome-sh/twin-github/README.md +0 -254
  374. package/node_modules/@pome-sh/twin-github/dist/examples/claude-github-agent.d.ts +0 -1
  375. package/node_modules/@pome-sh/twin-github/dist/examples/claude-github-agent.js +0 -222
  376. package/node_modules/@pome-sh/twin-github/dist/examples/claude-github-agent.js.map +0 -1
  377. package/node_modules/@pome-sh/twin-github/dist/examples/mcp-node.d.ts +0 -1
  378. package/node_modules/@pome-sh/twin-github/dist/examples/mcp-node.js +0 -15
  379. package/node_modules/@pome-sh/twin-github/dist/examples/mcp-node.js.map +0 -1
  380. package/node_modules/@pome-sh/twin-github/dist/examples/mini-bot-flow.d.ts +0 -1
  381. package/node_modules/@pome-sh/twin-github/dist/examples/mini-bot-flow.js +0 -39
  382. package/node_modules/@pome-sh/twin-github/dist/examples/mini-bot-flow.js.map +0 -1
  383. package/node_modules/@pome-sh/twin-github/dist/src/access-control.d.ts +0 -32
  384. package/node_modules/@pome-sh/twin-github/dist/src/access-control.js +0 -20
  385. package/node_modules/@pome-sh/twin-github/dist/src/access-control.js.map +0 -1
  386. package/node_modules/@pome-sh/twin-github/dist/src/check-issues.d.ts +0 -30
  387. package/node_modules/@pome-sh/twin-github/dist/src/check-issues.js +0 -268
  388. package/node_modules/@pome-sh/twin-github/dist/src/check-issues.js.map +0 -1
  389. package/node_modules/@pome-sh/twin-github/dist/src/check-kind.d.ts +0 -3
  390. package/node_modules/@pome-sh/twin-github/dist/src/check-kind.js +0 -10
  391. package/node_modules/@pome-sh/twin-github/dist/src/check-kind.js.map +0 -1
  392. package/node_modules/@pome-sh/twin-github/dist/src/check-params.d.ts +0 -13
  393. package/node_modules/@pome-sh/twin-github/dist/src/check-params.js +0 -116
  394. package/node_modules/@pome-sh/twin-github/dist/src/check-params.js.map +0 -1
  395. package/node_modules/@pome-sh/twin-github/dist/src/check-pulls.d.ts +0 -15
  396. package/node_modules/@pome-sh/twin-github/dist/src/check-pulls.js +0 -237
  397. package/node_modules/@pome-sh/twin-github/dist/src/check-pulls.js.map +0 -1
  398. package/node_modules/@pome-sh/twin-github/dist/src/check-repos.d.ts +0 -16
  399. package/node_modules/@pome-sh/twin-github/dist/src/check-repos.js +0 -256
  400. package/node_modules/@pome-sh/twin-github/dist/src/check-repos.js.map +0 -1
  401. package/node_modules/@pome-sh/twin-github/dist/src/check-state.d.ts +0 -77
  402. package/node_modules/@pome-sh/twin-github/dist/src/check-state.js +0 -147
  403. package/node_modules/@pome-sh/twin-github/dist/src/check-state.js.map +0 -1
  404. package/node_modules/@pome-sh/twin-github/dist/src/check-tape.d.ts +0 -5
  405. package/node_modules/@pome-sh/twin-github/dist/src/check-tape.js +0 -182
  406. package/node_modules/@pome-sh/twin-github/dist/src/check-tape.js.map +0 -1
  407. package/node_modules/@pome-sh/twin-github/dist/src/check-worlds.d.ts +0 -13
  408. package/node_modules/@pome-sh/twin-github/dist/src/check-worlds.js +0 -33
  409. package/node_modules/@pome-sh/twin-github/dist/src/check-worlds.js.map +0 -1
  410. package/node_modules/@pome-sh/twin-github/dist/src/checks.d.ts +0 -50
  411. package/node_modules/@pome-sh/twin-github/dist/src/checks.js +0 -79
  412. package/node_modules/@pome-sh/twin-github/dist/src/checks.js.map +0 -1
  413. package/node_modules/@pome-sh/twin-github/dist/src/db.d.ts +0 -4
  414. package/node_modules/@pome-sh/twin-github/dist/src/db.js +0 -443
  415. package/node_modules/@pome-sh/twin-github/dist/src/db.js.map +0 -1
  416. package/node_modules/@pome-sh/twin-github/dist/src/domain/checks.d.ts +0 -153
  417. package/node_modules/@pome-sh/twin-github/dist/src/domain/checks.js +0 -66
  418. package/node_modules/@pome-sh/twin-github/dist/src/domain/checks.js.map +0 -1
  419. package/node_modules/@pome-sh/twin-github/dist/src/domain/git.d.ts +0 -567
  420. package/node_modules/@pome-sh/twin-github/dist/src/domain/git.js +0 -198
  421. package/node_modules/@pome-sh/twin-github/dist/src/domain/git.js.map +0 -1
  422. package/node_modules/@pome-sh/twin-github/dist/src/domain/github-domain.d.ts +0 -3106
  423. package/node_modules/@pome-sh/twin-github/dist/src/domain/github-domain.js +0 -842
  424. package/node_modules/@pome-sh/twin-github/dist/src/domain/github-domain.js.map +0 -1
  425. package/node_modules/@pome-sh/twin-github/dist/src/domain/helpers.d.ts +0 -5
  426. package/node_modules/@pome-sh/twin-github/dist/src/domain/helpers.js +0 -15
  427. package/node_modules/@pome-sh/twin-github/dist/src/domain/helpers.js.map +0 -1
  428. package/node_modules/@pome-sh/twin-github/dist/src/domain/index.d.ts +0 -2
  429. package/node_modules/@pome-sh/twin-github/dist/src/domain/index.js +0 -5
  430. package/node_modules/@pome-sh/twin-github/dist/src/domain/index.js.map +0 -1
  431. package/node_modules/@pome-sh/twin-github/dist/src/domain/issues.d.ts +0 -545
  432. package/node_modules/@pome-sh/twin-github/dist/src/domain/issues.js +0 -282
  433. package/node_modules/@pome-sh/twin-github/dist/src/domain/issues.js.map +0 -1
  434. package/node_modules/@pome-sh/twin-github/dist/src/domain/pulls.d.ts +0 -816
  435. package/node_modules/@pome-sh/twin-github/dist/src/domain/pulls.js +0 -256
  436. package/node_modules/@pome-sh/twin-github/dist/src/domain/pulls.js.map +0 -1
  437. package/node_modules/@pome-sh/twin-github/dist/src/domain/releases.d.ts +0 -160
  438. package/node_modules/@pome-sh/twin-github/dist/src/domain/releases.js +0 -63
  439. package/node_modules/@pome-sh/twin-github/dist/src/domain/releases.js.map +0 -1
  440. package/node_modules/@pome-sh/twin-github/dist/src/domain/repos.d.ts +0 -219
  441. package/node_modules/@pome-sh/twin-github/dist/src/domain/repos.js +0 -131
  442. package/node_modules/@pome-sh/twin-github/dist/src/domain/repos.js.map +0 -1
  443. package/node_modules/@pome-sh/twin-github/dist/src/domain/search.d.ts +0 -252
  444. package/node_modules/@pome-sh/twin-github/dist/src/domain/search.js +0 -83
  445. package/node_modules/@pome-sh/twin-github/dist/src/domain/search.js.map +0 -1
  446. package/node_modules/@pome-sh/twin-github/dist/src/domain/types.d.ts +0 -15
  447. package/node_modules/@pome-sh/twin-github/dist/src/domain/types.js +0 -2
  448. package/node_modules/@pome-sh/twin-github/dist/src/domain/types.js.map +0 -1
  449. package/node_modules/@pome-sh/twin-github/dist/src/errors.d.ts +0 -14
  450. package/node_modules/@pome-sh/twin-github/dist/src/errors.js +0 -35
  451. package/node_modules/@pome-sh/twin-github/dist/src/errors.js.map +0 -1
  452. package/node_modules/@pome-sh/twin-github/dist/src/index.d.ts +0 -9
  453. package/node_modules/@pome-sh/twin-github/dist/src/index.js +0 -7
  454. package/node_modules/@pome-sh/twin-github/dist/src/index.js.map +0 -1
  455. package/node_modules/@pome-sh/twin-github/dist/src/routes.d.ts +0 -4
  456. package/node_modules/@pome-sh/twin-github/dist/src/routes.js +0 -372
  457. package/node_modules/@pome-sh/twin-github/dist/src/routes.js.map +0 -1
  458. package/node_modules/@pome-sh/twin-github/dist/src/seed.d.ts +0 -84
  459. package/node_modules/@pome-sh/twin-github/dist/src/seed.js +0 -170
  460. package/node_modules/@pome-sh/twin-github/dist/src/seed.js.map +0 -1
  461. package/node_modules/@pome-sh/twin-github/dist/src/serializers.d.ts +0 -926
  462. package/node_modules/@pome-sh/twin-github/dist/src/serializers.js +0 -685
  463. package/node_modules/@pome-sh/twin-github/dist/src/serializers.js.map +0 -1
  464. package/node_modules/@pome-sh/twin-github/dist/src/server.d.ts +0 -2
  465. package/node_modules/@pome-sh/twin-github/dist/src/server.js +0 -43
  466. package/node_modules/@pome-sh/twin-github/dist/src/server.js.map +0 -1
  467. package/node_modules/@pome-sh/twin-github/dist/src/tools.d.ts +0 -2815
  468. package/node_modules/@pome-sh/twin-github/dist/src/tools.js +0 -621
  469. package/node_modules/@pome-sh/twin-github/dist/src/tools.js.map +0 -1
  470. package/node_modules/@pome-sh/twin-github/dist/src/twin.d.ts +0 -15
  471. package/node_modules/@pome-sh/twin-github/dist/src/twin.js +0 -193
  472. package/node_modules/@pome-sh/twin-github/dist/src/twin.js.map +0 -1
  473. package/node_modules/@pome-sh/twin-github/dist/src/types.d.ts +0 -244
  474. package/node_modules/@pome-sh/twin-github/dist/src/types.js +0 -2
  475. package/node_modules/@pome-sh/twin-github/dist/src/types.js.map +0 -1
  476. package/node_modules/@pome-sh/twin-github/dist/src/unsupported-envelope.d.ts +0 -10
  477. package/node_modules/@pome-sh/twin-github/dist/src/unsupported-envelope.js +0 -27
  478. package/node_modules/@pome-sh/twin-github/dist/src/unsupported-envelope.js.map +0 -1
  479. package/node_modules/@pome-sh/twin-github/dist/src/upstream-types.d.ts +0 -30
  480. package/node_modules/@pome-sh/twin-github/dist/src/upstream-types.js +0 -2
  481. package/node_modules/@pome-sh/twin-github/dist/src/upstream-types.js.map +0 -1
  482. package/node_modules/@pome-sh/twin-github/dist/src/util.d.ts +0 -12
  483. package/node_modules/@pome-sh/twin-github/dist/src/util.js +0 -63
  484. package/node_modules/@pome-sh/twin-github/dist/src/util.js.map +0 -1
  485. package/node_modules/@pome-sh/twin-github/fidelity.inventory.json +0 -773
  486. package/node_modules/@pome-sh/twin-github/package.json +0 -63
  487. package/node_modules/@pome-sh/twin-gmail/CHANGELOG.md +0 -126
  488. package/node_modules/@pome-sh/twin-gmail/HOSTED.md +0 -45
  489. package/node_modules/@pome-sh/twin-gmail/LIMITS.md +0 -51
  490. package/node_modules/@pome-sh/twin-gmail/README.md +0 -150
  491. package/node_modules/@pome-sh/twin-gmail/REFERENCE-DIVERGENCES.md +0 -42
  492. package/node_modules/@pome-sh/twin-gmail/dist/fixtures/mcp-tools-list.canonical.json +0 -1209
  493. package/node_modules/@pome-sh/twin-gmail/dist/src/check-drafts.d.ts +0 -7
  494. package/node_modules/@pome-sh/twin-gmail/dist/src/check-drafts.js +0 -153
  495. package/node_modules/@pome-sh/twin-gmail/dist/src/check-drafts.js.map +0 -1
  496. package/node_modules/@pome-sh/twin-gmail/dist/src/check-kind.d.ts +0 -3
  497. package/node_modules/@pome-sh/twin-gmail/dist/src/check-kind.js +0 -9
  498. package/node_modules/@pome-sh/twin-gmail/dist/src/check-kind.js.map +0 -1
  499. package/node_modules/@pome-sh/twin-gmail/dist/src/check-labels.d.ts +0 -4
  500. package/node_modules/@pome-sh/twin-gmail/dist/src/check-labels.js +0 -67
  501. package/node_modules/@pome-sh/twin-gmail/dist/src/check-labels.js.map +0 -1
  502. package/node_modules/@pome-sh/twin-gmail/dist/src/check-messages.d.ts +0 -14
  503. package/node_modules/@pome-sh/twin-gmail/dist/src/check-messages.js +0 -223
  504. package/node_modules/@pome-sh/twin-gmail/dist/src/check-messages.js.map +0 -1
  505. package/node_modules/@pome-sh/twin-gmail/dist/src/check-params.d.ts +0 -10
  506. package/node_modules/@pome-sh/twin-gmail/dist/src/check-params.js +0 -96
  507. package/node_modules/@pome-sh/twin-gmail/dist/src/check-params.js.map +0 -1
  508. package/node_modules/@pome-sh/twin-gmail/dist/src/check-state.d.ts +0 -138
  509. package/node_modules/@pome-sh/twin-gmail/dist/src/check-state.js +0 -181
  510. package/node_modules/@pome-sh/twin-gmail/dist/src/check-state.js.map +0 -1
  511. package/node_modules/@pome-sh/twin-gmail/dist/src/check-tape.d.ts +0 -2
  512. package/node_modules/@pome-sh/twin-gmail/dist/src/check-tape.js +0 -103
  513. package/node_modules/@pome-sh/twin-gmail/dist/src/check-tape.js.map +0 -1
  514. package/node_modules/@pome-sh/twin-gmail/dist/src/check-worlds.d.ts +0 -17
  515. package/node_modules/@pome-sh/twin-gmail/dist/src/check-worlds.js +0 -62
  516. package/node_modules/@pome-sh/twin-gmail/dist/src/check-worlds.js.map +0 -1
  517. package/node_modules/@pome-sh/twin-gmail/dist/src/checks.d.ts +0 -19
  518. package/node_modules/@pome-sh/twin-gmail/dist/src/checks.js +0 -42
  519. package/node_modules/@pome-sh/twin-gmail/dist/src/checks.js.map +0 -1
  520. package/node_modules/@pome-sh/twin-gmail/dist/src/db.d.ts +0 -4
  521. package/node_modules/@pome-sh/twin-gmail/dist/src/db.js +0 -212
  522. package/node_modules/@pome-sh/twin-gmail/dist/src/db.js.map +0 -1
  523. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/drafts.d.ts +0 -41
  524. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/drafts.js +0 -138
  525. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/drafts.js.map +0 -1
  526. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/filters.d.ts +0 -10
  527. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/filters.js +0 -105
  528. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/filters.js.map +0 -1
  529. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/gmail-domain.d.ts +0 -121
  530. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/gmail-domain.js +0 -174
  531. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/gmail-domain.js.map +0 -1
  532. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/hydrate.d.ts +0 -8
  533. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/hydrate.js +0 -122
  534. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/hydrate.js.map +0 -1
  535. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/index.d.ts +0 -4
  536. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/index.js +0 -5
  537. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/index.js.map +0 -1
  538. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/labels.d.ts +0 -40
  539. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/labels.js +0 -122
  540. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/labels.js.map +0 -1
  541. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/messages.d.ts +0 -49
  542. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/messages.js +0 -276
  543. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/messages.js.map +0 -1
  544. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/search-sql.d.ts +0 -19
  545. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/search-sql.js +0 -179
  546. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/search-sql.js.map +0 -1
  547. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/settings.d.ts +0 -27
  548. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/settings.js +0 -98
  549. package/node_modules/@pome-sh/twin-gmail/dist/src/domain/settings.js.map +0 -1
  550. package/node_modules/@pome-sh/twin-gmail/dist/src/errors.d.ts +0 -12
  551. package/node_modules/@pome-sh/twin-gmail/dist/src/errors.js +0 -117
  552. package/node_modules/@pome-sh/twin-gmail/dist/src/errors.js.map +0 -1
  553. package/node_modules/@pome-sh/twin-gmail/dist/src/faults.d.ts +0 -21
  554. package/node_modules/@pome-sh/twin-gmail/dist/src/faults.js +0 -52
  555. package/node_modules/@pome-sh/twin-gmail/dist/src/faults.js.map +0 -1
  556. package/node_modules/@pome-sh/twin-gmail/dist/src/identity.d.ts +0 -5
  557. package/node_modules/@pome-sh/twin-gmail/dist/src/identity.js +0 -18
  558. package/node_modules/@pome-sh/twin-gmail/dist/src/identity.js.map +0 -1
  559. package/node_modules/@pome-sh/twin-gmail/dist/src/index.d.ts +0 -15
  560. package/node_modules/@pome-sh/twin-gmail/dist/src/index.js +0 -17
  561. package/node_modules/@pome-sh/twin-gmail/dist/src/index.js.map +0 -1
  562. package/node_modules/@pome-sh/twin-gmail/dist/src/mcp-schemas.d.ts +0 -224
  563. package/node_modules/@pome-sh/twin-gmail/dist/src/mcp-schemas.js +0 -185
  564. package/node_modules/@pome-sh/twin-gmail/dist/src/mcp-schemas.js.map +0 -1
  565. package/node_modules/@pome-sh/twin-gmail/dist/src/mcp.d.ts +0 -3
  566. package/node_modules/@pome-sh/twin-gmail/dist/src/mcp.js +0 -306
  567. package/node_modules/@pome-sh/twin-gmail/dist/src/mcp.js.map +0 -1
  568. package/node_modules/@pome-sh/twin-gmail/dist/src/mime.d.ts +0 -49
  569. package/node_modules/@pome-sh/twin-gmail/dist/src/mime.js +0 -315
  570. package/node_modules/@pome-sh/twin-gmail/dist/src/mime.js.map +0 -1
  571. package/node_modules/@pome-sh/twin-gmail/dist/src/page-tokens.d.ts +0 -11
  572. package/node_modules/@pome-sh/twin-gmail/dist/src/page-tokens.js +0 -70
  573. package/node_modules/@pome-sh/twin-gmail/dist/src/page-tokens.js.map +0 -1
  574. package/node_modules/@pome-sh/twin-gmail/dist/src/recording.d.ts +0 -6
  575. package/node_modules/@pome-sh/twin-gmail/dist/src/recording.js +0 -74
  576. package/node_modules/@pome-sh/twin-gmail/dist/src/recording.js.map +0 -1
  577. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-common.d.ts +0 -28
  578. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-common.js +0 -120
  579. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-common.js.map +0 -1
  580. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes-drafts.d.ts +0 -3
  581. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes-drafts.js +0 -84
  582. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes-drafts.js.map +0 -1
  583. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes-kit.d.ts +0 -18
  584. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes-kit.js +0 -52
  585. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes-kit.js.map +0 -1
  586. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes-messages.d.ts +0 -3
  587. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes-messages.js +0 -143
  588. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes-messages.js.map +0 -1
  589. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes-resources.d.ts +0 -3
  590. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes-resources.js +0 -203
  591. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes-resources.js.map +0 -1
  592. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes.d.ts +0 -4
  593. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes.js +0 -11
  594. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes.js.map +0 -1
  595. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-serializers.d.ts +0 -16
  596. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-serializers.js +0 -151
  597. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-serializers.js.map +0 -1
  598. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-upload.d.ts +0 -12
  599. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-upload.js +0 -127
  600. package/node_modules/@pome-sh/twin-gmail/dist/src/rest-upload.js.map +0 -1
  601. package/node_modules/@pome-sh/twin-gmail/dist/src/search-match.d.ts +0 -4
  602. package/node_modules/@pome-sh/twin-gmail/dist/src/search-match.js +0 -179
  603. package/node_modules/@pome-sh/twin-gmail/dist/src/search-match.js.map +0 -1
  604. package/node_modules/@pome-sh/twin-gmail/dist/src/search-parse.d.ts +0 -61
  605. package/node_modules/@pome-sh/twin-gmail/dist/src/search-parse.js +0 -318
  606. package/node_modules/@pome-sh/twin-gmail/dist/src/search-parse.js.map +0 -1
  607. package/node_modules/@pome-sh/twin-gmail/dist/src/search.d.ts +0 -3
  608. package/node_modules/@pome-sh/twin-gmail/dist/src/search.js +0 -3
  609. package/node_modules/@pome-sh/twin-gmail/dist/src/search.js.map +0 -1
  610. package/node_modules/@pome-sh/twin-gmail/dist/src/seed.d.ts +0 -239
  611. package/node_modules/@pome-sh/twin-gmail/dist/src/seed.js +0 -271
  612. package/node_modules/@pome-sh/twin-gmail/dist/src/seed.js.map +0 -1
  613. package/node_modules/@pome-sh/twin-gmail/dist/src/seeding.d.ts +0 -3
  614. package/node_modules/@pome-sh/twin-gmail/dist/src/seeding.js +0 -89
  615. package/node_modules/@pome-sh/twin-gmail/dist/src/seeding.js.map +0 -1
  616. package/node_modules/@pome-sh/twin-gmail/dist/src/server.d.ts +0 -2
  617. package/node_modules/@pome-sh/twin-gmail/dist/src/server.js +0 -21
  618. package/node_modules/@pome-sh/twin-gmail/dist/src/server.js.map +0 -1
  619. package/node_modules/@pome-sh/twin-gmail/dist/src/state.d.ts +0 -55
  620. package/node_modules/@pome-sh/twin-gmail/dist/src/state.js +0 -225
  621. package/node_modules/@pome-sh/twin-gmail/dist/src/state.js.map +0 -1
  622. package/node_modules/@pome-sh/twin-gmail/dist/src/storage.d.ts +0 -20
  623. package/node_modules/@pome-sh/twin-gmail/dist/src/storage.js +0 -171
  624. package/node_modules/@pome-sh/twin-gmail/dist/src/storage.js.map +0 -1
  625. package/node_modules/@pome-sh/twin-gmail/dist/src/twin.d.ts +0 -16
  626. package/node_modules/@pome-sh/twin-gmail/dist/src/twin.js +0 -96
  627. package/node_modules/@pome-sh/twin-gmail/dist/src/twin.js.map +0 -1
  628. package/node_modules/@pome-sh/twin-gmail/dist/src/types.d.ts +0 -150
  629. package/node_modules/@pome-sh/twin-gmail/dist/src/types.js +0 -2
  630. package/node_modules/@pome-sh/twin-gmail/dist/src/types.js.map +0 -1
  631. package/node_modules/@pome-sh/twin-gmail/fidelity.inventory.json +0 -565
  632. package/node_modules/@pome-sh/twin-gmail/fixtures/README.md +0 -28
  633. package/node_modules/@pome-sh/twin-gmail/fixtures/gmail-discovery-v1.meta.json +0 -6
  634. package/node_modules/@pome-sh/twin-gmail/fixtures/gmail-discovery-v1.raw.json +0 -4510
  635. package/node_modules/@pome-sh/twin-gmail/fixtures/mcp-initialize.meta.json +0 -8
  636. package/node_modules/@pome-sh/twin-gmail/fixtures/mcp-initialize.raw.json +0 -1
  637. package/node_modules/@pome-sh/twin-gmail/fixtures/mcp-tools-call-unauth-error.raw.json +0 -1
  638. package/node_modules/@pome-sh/twin-gmail/fixtures/mcp-tools-call.representative.json +0 -508
  639. package/node_modules/@pome-sh/twin-gmail/fixtures/mcp-tools-list.canonical.json +0 -1209
  640. package/node_modules/@pome-sh/twin-gmail/fixtures/mcp-tools-list.meta.json +0 -29
  641. package/node_modules/@pome-sh/twin-gmail/fixtures/mcp-tools-list.raw.json +0 -1
  642. package/node_modules/@pome-sh/twin-gmail/fixtures/rest-surface.json +0 -3502
  643. package/node_modules/@pome-sh/twin-gmail/package.json +0 -76
  644. package/node_modules/@pome-sh/twin-linear/CHANGELOG.md +0 -204
  645. package/node_modules/@pome-sh/twin-linear/FIDELITY.md +0 -62
  646. package/node_modules/@pome-sh/twin-linear/HOSTED.md +0 -46
  647. package/node_modules/@pome-sh/twin-linear/LIMITS.md +0 -54
  648. package/node_modules/@pome-sh/twin-linear/README.md +0 -151
  649. package/node_modules/@pome-sh/twin-linear/REFERENCE-DIVERGENCES.md +0 -50
  650. package/node_modules/@pome-sh/twin-linear/dist/fixtures/mcp-tools-list.canonical.json +0 -353
  651. package/node_modules/@pome-sh/twin-linear/dist/src/auth-credential.d.ts +0 -8
  652. package/node_modules/@pome-sh/twin-linear/dist/src/auth-credential.js +0 -55
  653. package/node_modules/@pome-sh/twin-linear/dist/src/auth-credential.js.map +0 -1
  654. package/node_modules/@pome-sh/twin-linear/dist/src/check-comments.d.ts +0 -10
  655. package/node_modules/@pome-sh/twin-linear/dist/src/check-comments.js +0 -129
  656. package/node_modules/@pome-sh/twin-linear/dist/src/check-comments.js.map +0 -1
  657. package/node_modules/@pome-sh/twin-linear/dist/src/check-issues.d.ts +0 -25
  658. package/node_modules/@pome-sh/twin-linear/dist/src/check-issues.js +0 -238
  659. package/node_modules/@pome-sh/twin-linear/dist/src/check-issues.js.map +0 -1
  660. package/node_modules/@pome-sh/twin-linear/dist/src/check-kind.d.ts +0 -3
  661. package/node_modules/@pome-sh/twin-linear/dist/src/check-kind.js +0 -9
  662. package/node_modules/@pome-sh/twin-linear/dist/src/check-kind.js.map +0 -1
  663. package/node_modules/@pome-sh/twin-linear/dist/src/check-params.d.ts +0 -8
  664. package/node_modules/@pome-sh/twin-linear/dist/src/check-params.js +0 -94
  665. package/node_modules/@pome-sh/twin-linear/dist/src/check-params.js.map +0 -1
  666. package/node_modules/@pome-sh/twin-linear/dist/src/check-state.d.ts +0 -123
  667. package/node_modules/@pome-sh/twin-linear/dist/src/check-state.js +0 -184
  668. package/node_modules/@pome-sh/twin-linear/dist/src/check-state.js.map +0 -1
  669. package/node_modules/@pome-sh/twin-linear/dist/src/check-tape.d.ts +0 -2
  670. package/node_modules/@pome-sh/twin-linear/dist/src/check-tape.js +0 -100
  671. package/node_modules/@pome-sh/twin-linear/dist/src/check-tape.js.map +0 -1
  672. package/node_modules/@pome-sh/twin-linear/dist/src/check-worlds.d.ts +0 -44
  673. package/node_modules/@pome-sh/twin-linear/dist/src/check-worlds.js +0 -93
  674. package/node_modules/@pome-sh/twin-linear/dist/src/check-worlds.js.map +0 -1
  675. package/node_modules/@pome-sh/twin-linear/dist/src/checks.d.ts +0 -29
  676. package/node_modules/@pome-sh/twin-linear/dist/src/checks.js +0 -52
  677. package/node_modules/@pome-sh/twin-linear/dist/src/checks.js.map +0 -1
  678. package/node_modules/@pome-sh/twin-linear/dist/src/db.d.ts +0 -10
  679. package/node_modules/@pome-sh/twin-linear/dist/src/db.js +0 -382
  680. package/node_modules/@pome-sh/twin-linear/dist/src/db.js.map +0 -1
  681. package/node_modules/@pome-sh/twin-linear/dist/src/domain/agents.d.ts +0 -32
  682. package/node_modules/@pome-sh/twin-linear/dist/src/domain/agents.js +0 -107
  683. package/node_modules/@pome-sh/twin-linear/dist/src/domain/agents.js.map +0 -1
  684. package/node_modules/@pome-sh/twin-linear/dist/src/domain/catalog.d.ts +0 -9
  685. package/node_modules/@pome-sh/twin-linear/dist/src/domain/catalog.js +0 -41
  686. package/node_modules/@pome-sh/twin-linear/dist/src/domain/catalog.js.map +0 -1
  687. package/node_modules/@pome-sh/twin-linear/dist/src/domain/comments.d.ts +0 -13
  688. package/node_modules/@pome-sh/twin-linear/dist/src/domain/comments.js +0 -108
  689. package/node_modules/@pome-sh/twin-linear/dist/src/domain/comments.js.map +0 -1
  690. package/node_modules/@pome-sh/twin-linear/dist/src/domain/documents.d.ts +0 -31
  691. package/node_modules/@pome-sh/twin-linear/dist/src/domain/documents.js +0 -113
  692. package/node_modules/@pome-sh/twin-linear/dist/src/domain/documents.js.map +0 -1
  693. package/node_modules/@pome-sh/twin-linear/dist/src/domain/index.d.ts +0 -4
  694. package/node_modules/@pome-sh/twin-linear/dist/src/domain/index.js +0 -6
  695. package/node_modules/@pome-sh/twin-linear/dist/src/domain/index.js.map +0 -1
  696. package/node_modules/@pome-sh/twin-linear/dist/src/domain/issue-relations.d.ts +0 -13
  697. package/node_modules/@pome-sh/twin-linear/dist/src/domain/issue-relations.js +0 -60
  698. package/node_modules/@pome-sh/twin-linear/dist/src/domain/issue-relations.js.map +0 -1
  699. package/node_modules/@pome-sh/twin-linear/dist/src/domain/issues.d.ts +0 -57
  700. package/node_modules/@pome-sh/twin-linear/dist/src/domain/issues.js +0 -359
  701. package/node_modules/@pome-sh/twin-linear/dist/src/domain/issues.js.map +0 -1
  702. package/node_modules/@pome-sh/twin-linear/dist/src/domain/labels.d.ts +0 -18
  703. package/node_modules/@pome-sh/twin-linear/dist/src/domain/labels.js +0 -117
  704. package/node_modules/@pome-sh/twin-linear/dist/src/domain/labels.js.map +0 -1
  705. package/node_modules/@pome-sh/twin-linear/dist/src/domain/linear-domain.d.ts +0 -177
  706. package/node_modules/@pome-sh/twin-linear/dist/src/domain/linear-domain.js +0 -315
  707. package/node_modules/@pome-sh/twin-linear/dist/src/domain/linear-domain.js.map +0 -1
  708. package/node_modules/@pome-sh/twin-linear/dist/src/domain/normalize.d.ts +0 -18
  709. package/node_modules/@pome-sh/twin-linear/dist/src/domain/normalize.js +0 -84
  710. package/node_modules/@pome-sh/twin-linear/dist/src/domain/normalize.js.map +0 -1
  711. package/node_modules/@pome-sh/twin-linear/dist/src/domain/oauth-store.d.ts +0 -55
  712. package/node_modules/@pome-sh/twin-linear/dist/src/domain/oauth-store.js +0 -127
  713. package/node_modules/@pome-sh/twin-linear/dist/src/domain/oauth-store.js.map +0 -1
  714. package/node_modules/@pome-sh/twin-linear/dist/src/domain/projects-cycles.d.ts +0 -17
  715. package/node_modules/@pome-sh/twin-linear/dist/src/domain/projects-cycles.js +0 -51
  716. package/node_modules/@pome-sh/twin-linear/dist/src/domain/projects-cycles.js.map +0 -1
  717. package/node_modules/@pome-sh/twin-linear/dist/src/domain/rows.d.ts +0 -211
  718. package/node_modules/@pome-sh/twin-linear/dist/src/domain/rows.js +0 -217
  719. package/node_modules/@pome-sh/twin-linear/dist/src/domain/rows.js.map +0 -1
  720. package/node_modules/@pome-sh/twin-linear/dist/src/domain/webhooks.d.ts +0 -5
  721. package/node_modules/@pome-sh/twin-linear/dist/src/domain/webhooks.js +0 -12
  722. package/node_modules/@pome-sh/twin-linear/dist/src/domain/webhooks.js.map +0 -1
  723. package/node_modules/@pome-sh/twin-linear/dist/src/errors.d.ts +0 -26
  724. package/node_modules/@pome-sh/twin-linear/dist/src/errors.js +0 -128
  725. package/node_modules/@pome-sh/twin-linear/dist/src/errors.js.map +0 -1
  726. package/node_modules/@pome-sh/twin-linear/dist/src/graphql/formatters.d.ts +0 -27
  727. package/node_modules/@pome-sh/twin-linear/dist/src/graphql/formatters.js +0 -261
  728. package/node_modules/@pome-sh/twin-linear/dist/src/graphql/formatters.js.map +0 -1
  729. package/node_modules/@pome-sh/twin-linear/dist/src/graphql/issue-filter.d.ts +0 -5
  730. package/node_modules/@pome-sh/twin-linear/dist/src/graphql/issue-filter.js +0 -122
  731. package/node_modules/@pome-sh/twin-linear/dist/src/graphql/issue-filter.js.map +0 -1
  732. package/node_modules/@pome-sh/twin-linear/dist/src/graphql/mutation-inputs.d.ts +0 -170
  733. package/node_modules/@pome-sh/twin-linear/dist/src/graphql/mutation-inputs.js +0 -260
  734. package/node_modules/@pome-sh/twin-linear/dist/src/graphql/mutation-inputs.js.map +0 -1
  735. package/node_modules/@pome-sh/twin-linear/dist/src/graphql/resolvers.d.ts +0 -6
  736. package/node_modules/@pome-sh/twin-linear/dist/src/graphql/resolvers.js +0 -169
  737. package/node_modules/@pome-sh/twin-linear/dist/src/graphql/resolvers.js.map +0 -1
  738. package/node_modules/@pome-sh/twin-linear/dist/src/graphql/routes.d.ts +0 -6
  739. package/node_modules/@pome-sh/twin-linear/dist/src/graphql/routes.js +0 -176
  740. package/node_modules/@pome-sh/twin-linear/dist/src/graphql/routes.js.map +0 -1
  741. package/node_modules/@pome-sh/twin-linear/dist/src/graphql/schema.d.ts +0 -3
  742. package/node_modules/@pome-sh/twin-linear/dist/src/graphql/schema.js +0 -522
  743. package/node_modules/@pome-sh/twin-linear/dist/src/graphql/schema.js.map +0 -1
  744. package/node_modules/@pome-sh/twin-linear/dist/src/identity.d.ts +0 -7
  745. package/node_modules/@pome-sh/twin-linear/dist/src/identity.js +0 -14
  746. package/node_modules/@pome-sh/twin-linear/dist/src/identity.js.map +0 -1
  747. package/node_modules/@pome-sh/twin-linear/dist/src/ids.d.ts +0 -5
  748. package/node_modules/@pome-sh/twin-linear/dist/src/ids.js +0 -28
  749. package/node_modules/@pome-sh/twin-linear/dist/src/ids.js.map +0 -1
  750. package/node_modules/@pome-sh/twin-linear/dist/src/index.d.ts +0 -18
  751. package/node_modules/@pome-sh/twin-linear/dist/src/index.js +0 -21
  752. package/node_modules/@pome-sh/twin-linear/dist/src/index.js.map +0 -1
  753. package/node_modules/@pome-sh/twin-linear/dist/src/mcp-schemas.d.ts +0 -121
  754. package/node_modules/@pome-sh/twin-linear/dist/src/mcp-schemas.js +0 -126
  755. package/node_modules/@pome-sh/twin-linear/dist/src/mcp-schemas.js.map +0 -1
  756. package/node_modules/@pome-sh/twin-linear/dist/src/mcp.d.ts +0 -4
  757. package/node_modules/@pome-sh/twin-linear/dist/src/mcp.js +0 -430
  758. package/node_modules/@pome-sh/twin-linear/dist/src/mcp.js.map +0 -1
  759. package/node_modules/@pome-sh/twin-linear/dist/src/oauth/routes.d.ts +0 -5
  760. package/node_modules/@pome-sh/twin-linear/dist/src/oauth/routes.js +0 -340
  761. package/node_modules/@pome-sh/twin-linear/dist/src/oauth/routes.js.map +0 -1
  762. package/node_modules/@pome-sh/twin-linear/dist/src/pagination.d.ts +0 -29
  763. package/node_modules/@pome-sh/twin-linear/dist/src/pagination.js +0 -101
  764. package/node_modules/@pome-sh/twin-linear/dist/src/pagination.js.map +0 -1
  765. package/node_modules/@pome-sh/twin-linear/dist/src/recording.d.ts +0 -2
  766. package/node_modules/@pome-sh/twin-linear/dist/src/recording.js +0 -46
  767. package/node_modules/@pome-sh/twin-linear/dist/src/recording.js.map +0 -1
  768. package/node_modules/@pome-sh/twin-linear/dist/src/routes.d.ts +0 -9
  769. package/node_modules/@pome-sh/twin-linear/dist/src/routes.js +0 -10
  770. package/node_modules/@pome-sh/twin-linear/dist/src/routes.js.map +0 -1
  771. package/node_modules/@pome-sh/twin-linear/dist/src/seed/apply.d.ts +0 -4
  772. package/node_modules/@pome-sh/twin-linear/dist/src/seed/apply.js +0 -186
  773. package/node_modules/@pome-sh/twin-linear/dist/src/seed/apply.js.map +0 -1
  774. package/node_modules/@pome-sh/twin-linear/dist/src/seed.d.ts +0 -158
  775. package/node_modules/@pome-sh/twin-linear/dist/src/seed.js +0 -541
  776. package/node_modules/@pome-sh/twin-linear/dist/src/seed.js.map +0 -1
  777. package/node_modules/@pome-sh/twin-linear/dist/src/serializers/comment.d.ts +0 -29
  778. package/node_modules/@pome-sh/twin-linear/dist/src/serializers/comment.js +0 -47
  779. package/node_modules/@pome-sh/twin-linear/dist/src/serializers/comment.js.map +0 -1
  780. package/node_modules/@pome-sh/twin-linear/dist/src/serializers/document.d.ts +0 -15
  781. package/node_modules/@pome-sh/twin-linear/dist/src/serializers/document.js +0 -17
  782. package/node_modules/@pome-sh/twin-linear/dist/src/serializers/document.js.map +0 -1
  783. package/node_modules/@pome-sh/twin-linear/dist/src/serializers/index.d.ts +0 -3
  784. package/node_modules/@pome-sh/twin-linear/dist/src/serializers/index.js +0 -5
  785. package/node_modules/@pome-sh/twin-linear/dist/src/serializers/index.js.map +0 -1
  786. package/node_modules/@pome-sh/twin-linear/dist/src/serializers/issue.d.ts +0 -86
  787. package/node_modules/@pome-sh/twin-linear/dist/src/serializers/issue.js +0 -102
  788. package/node_modules/@pome-sh/twin-linear/dist/src/serializers/issue.js.map +0 -1
  789. package/node_modules/@pome-sh/twin-linear/dist/src/server.d.ts +0 -2
  790. package/node_modules/@pome-sh/twin-linear/dist/src/server.js +0 -41
  791. package/node_modules/@pome-sh/twin-linear/dist/src/server.js.map +0 -1
  792. package/node_modules/@pome-sh/twin-linear/dist/src/state.d.ts +0 -51
  793. package/node_modules/@pome-sh/twin-linear/dist/src/state.js +0 -211
  794. package/node_modules/@pome-sh/twin-linear/dist/src/state.js.map +0 -1
  795. package/node_modules/@pome-sh/twin-linear/dist/src/twin.d.ts +0 -21
  796. package/node_modules/@pome-sh/twin-linear/dist/src/twin.js +0 -107
  797. package/node_modules/@pome-sh/twin-linear/dist/src/twin.js.map +0 -1
  798. package/node_modules/@pome-sh/twin-linear/dist/src/types.d.ts +0 -366
  799. package/node_modules/@pome-sh/twin-linear/dist/src/types.js +0 -19
  800. package/node_modules/@pome-sh/twin-linear/dist/src/types.js.map +0 -1
  801. package/node_modules/@pome-sh/twin-linear/dist/src/webhook-policy.d.ts +0 -27
  802. package/node_modules/@pome-sh/twin-linear/dist/src/webhook-policy.js +0 -107
  803. package/node_modules/@pome-sh/twin-linear/dist/src/webhook-policy.js.map +0 -1
  804. package/node_modules/@pome-sh/twin-linear/dist/src/webhook-url.d.ts +0 -3
  805. package/node_modules/@pome-sh/twin-linear/dist/src/webhook-url.js +0 -26
  806. package/node_modules/@pome-sh/twin-linear/dist/src/webhook-url.js.map +0 -1
  807. package/node_modules/@pome-sh/twin-linear/dist/src/webhooks/dispatch.d.ts +0 -30
  808. package/node_modules/@pome-sh/twin-linear/dist/src/webhooks/dispatch.js +0 -93
  809. package/node_modules/@pome-sh/twin-linear/dist/src/webhooks/dispatch.js.map +0 -1
  810. package/node_modules/@pome-sh/twin-linear/fidelity.inventory.json +0 -249
  811. package/node_modules/@pome-sh/twin-linear/fixtures/README.md +0 -11
  812. package/node_modules/@pome-sh/twin-linear/fixtures/graphql-surface.json +0 -59
  813. package/node_modules/@pome-sh/twin-linear/fixtures/linear-introspection.json +0 -66
  814. package/node_modules/@pome-sh/twin-linear/fixtures/mcp-tools-list.canonical.json +0 -353
  815. package/node_modules/@pome-sh/twin-linear/package.json +0 -72
  816. package/node_modules/@pome-sh/twin-slack/FIDELITY.md +0 -346
  817. package/node_modules/@pome-sh/twin-slack/README.md +0 -211
  818. package/node_modules/@pome-sh/twin-slack/dist/examples/claude-slack-agent.d.ts +0 -1
  819. package/node_modules/@pome-sh/twin-slack/dist/examples/claude-slack-agent.js +0 -105
  820. package/node_modules/@pome-sh/twin-slack/dist/examples/claude-slack-agent.js.map +0 -1
  821. package/node_modules/@pome-sh/twin-slack/dist/examples/mcp-node.d.ts +0 -1
  822. package/node_modules/@pome-sh/twin-slack/dist/examples/mcp-node.js +0 -20
  823. package/node_modules/@pome-sh/twin-slack/dist/examples/mcp-node.js.map +0 -1
  824. package/node_modules/@pome-sh/twin-slack/dist/examples/mini-bot-flow.d.ts +0 -1
  825. package/node_modules/@pome-sh/twin-slack/dist/examples/mini-bot-flow.js +0 -61
  826. package/node_modules/@pome-sh/twin-slack/dist/examples/mini-bot-flow.js.map +0 -1
  827. package/node_modules/@pome-sh/twin-slack/dist/scripts/fidelity-parity.d.ts +0 -1
  828. package/node_modules/@pome-sh/twin-slack/dist/scripts/fidelity-parity.js +0 -92
  829. package/node_modules/@pome-sh/twin-slack/dist/scripts/fidelity-parity.js.map +0 -1
  830. package/node_modules/@pome-sh/twin-slack/dist/scripts/seed.d.ts +0 -1
  831. package/node_modules/@pome-sh/twin-slack/dist/scripts/seed.js +0 -9
  832. package/node_modules/@pome-sh/twin-slack/dist/scripts/seed.js.map +0 -1
  833. package/node_modules/@pome-sh/twin-slack/dist/scripts/smoke.d.ts +0 -1
  834. package/node_modules/@pome-sh/twin-slack/dist/scripts/smoke.js +0 -209
  835. package/node_modules/@pome-sh/twin-slack/dist/scripts/smoke.js.map +0 -1
  836. package/node_modules/@pome-sh/twin-slack/dist/scripts/validate-mcp.d.ts +0 -1
  837. package/node_modules/@pome-sh/twin-slack/dist/scripts/validate-mcp.js +0 -116
  838. package/node_modules/@pome-sh/twin-slack/dist/scripts/validate-mcp.js.map +0 -1
  839. package/node_modules/@pome-sh/twin-slack/dist/scripts/verify-cloud-token.d.ts +0 -1
  840. package/node_modules/@pome-sh/twin-slack/dist/scripts/verify-cloud-token.js +0 -45
  841. package/node_modules/@pome-sh/twin-slack/dist/scripts/verify-cloud-token.js.map +0 -1
  842. package/node_modules/@pome-sh/twin-slack/dist/src/check-kind.d.ts +0 -3
  843. package/node_modules/@pome-sh/twin-slack/dist/src/check-kind.js +0 -9
  844. package/node_modules/@pome-sh/twin-slack/dist/src/check-kind.js.map +0 -1
  845. package/node_modules/@pome-sh/twin-slack/dist/src/check-messages.d.ts +0 -16
  846. package/node_modules/@pome-sh/twin-slack/dist/src/check-messages.js +0 -207
  847. package/node_modules/@pome-sh/twin-slack/dist/src/check-messages.js.map +0 -1
  848. package/node_modules/@pome-sh/twin-slack/dist/src/check-params.d.ts +0 -5
  849. package/node_modules/@pome-sh/twin-slack/dist/src/check-params.js +0 -56
  850. package/node_modules/@pome-sh/twin-slack/dist/src/check-params.js.map +0 -1
  851. package/node_modules/@pome-sh/twin-slack/dist/src/check-secrets.d.ts +0 -2
  852. package/node_modules/@pome-sh/twin-slack/dist/src/check-secrets.js +0 -138
  853. package/node_modules/@pome-sh/twin-slack/dist/src/check-secrets.js.map +0 -1
  854. package/node_modules/@pome-sh/twin-slack/dist/src/check-state.d.ts +0 -107
  855. package/node_modules/@pome-sh/twin-slack/dist/src/check-state.js +0 -128
  856. package/node_modules/@pome-sh/twin-slack/dist/src/check-state.js.map +0 -1
  857. package/node_modules/@pome-sh/twin-slack/dist/src/check-worlds.d.ts +0 -7
  858. package/node_modules/@pome-sh/twin-slack/dist/src/check-worlds.js +0 -37
  859. package/node_modules/@pome-sh/twin-slack/dist/src/check-worlds.js.map +0 -1
  860. package/node_modules/@pome-sh/twin-slack/dist/src/checks.d.ts +0 -14
  861. package/node_modules/@pome-sh/twin-slack/dist/src/checks.js +0 -39
  862. package/node_modules/@pome-sh/twin-slack/dist/src/checks.js.map +0 -1
  863. package/node_modules/@pome-sh/twin-slack/dist/src/db.d.ts +0 -4
  864. package/node_modules/@pome-sh/twin-slack/dist/src/db.js +0 -231
  865. package/node_modules/@pome-sh/twin-slack/dist/src/db.js.map +0 -1
  866. package/node_modules/@pome-sh/twin-slack/dist/src/domain/bookmarks.d.ts +0 -16
  867. package/node_modules/@pome-sh/twin-slack/dist/src/domain/bookmarks.js +0 -49
  868. package/node_modules/@pome-sh/twin-slack/dist/src/domain/bookmarks.js.map +0 -1
  869. package/node_modules/@pome-sh/twin-slack/dist/src/domain/canvases.d.ts +0 -37
  870. package/node_modules/@pome-sh/twin-slack/dist/src/domain/canvases.js +0 -182
  871. package/node_modules/@pome-sh/twin-slack/dist/src/domain/canvases.js.map +0 -1
  872. package/node_modules/@pome-sh/twin-slack/dist/src/domain/chat.d.ts +0 -40
  873. package/node_modules/@pome-sh/twin-slack/dist/src/domain/chat.js +0 -167
  874. package/node_modules/@pome-sh/twin-slack/dist/src/domain/chat.js.map +0 -1
  875. package/node_modules/@pome-sh/twin-slack/dist/src/domain/conversations.d.ts +0 -61
  876. package/node_modules/@pome-sh/twin-slack/dist/src/domain/conversations.js +0 -360
  877. package/node_modules/@pome-sh/twin-slack/dist/src/domain/conversations.js.map +0 -1
  878. package/node_modules/@pome-sh/twin-slack/dist/src/domain/emoji.d.ts +0 -13
  879. package/node_modules/@pome-sh/twin-slack/dist/src/domain/emoji.js +0 -31
  880. package/node_modules/@pome-sh/twin-slack/dist/src/domain/emoji.js.map +0 -1
  881. package/node_modules/@pome-sh/twin-slack/dist/src/domain/files.d.ts +0 -24
  882. package/node_modules/@pome-sh/twin-slack/dist/src/domain/files.js +0 -101
  883. package/node_modules/@pome-sh/twin-slack/dist/src/domain/files.js.map +0 -1
  884. package/node_modules/@pome-sh/twin-slack/dist/src/domain/helpers.d.ts +0 -5
  885. package/node_modules/@pome-sh/twin-slack/dist/src/domain/helpers.js +0 -42
  886. package/node_modules/@pome-sh/twin-slack/dist/src/domain/helpers.js.map +0 -1
  887. package/node_modules/@pome-sh/twin-slack/dist/src/domain/index.d.ts +0 -2
  888. package/node_modules/@pome-sh/twin-slack/dist/src/domain/index.js +0 -5
  889. package/node_modules/@pome-sh/twin-slack/dist/src/domain/index.js.map +0 -1
  890. package/node_modules/@pome-sh/twin-slack/dist/src/domain/pins.d.ts +0 -12
  891. package/node_modules/@pome-sh/twin-slack/dist/src/domain/pins.js +0 -63
  892. package/node_modules/@pome-sh/twin-slack/dist/src/domain/pins.js.map +0 -1
  893. package/node_modules/@pome-sh/twin-slack/dist/src/domain/reactions.d.ts +0 -16
  894. package/node_modules/@pome-sh/twin-slack/dist/src/domain/reactions.js +0 -73
  895. package/node_modules/@pome-sh/twin-slack/dist/src/domain/reactions.js.map +0 -1
  896. package/node_modules/@pome-sh/twin-slack/dist/src/domain/search.d.ts +0 -9
  897. package/node_modules/@pome-sh/twin-slack/dist/src/domain/search.js +0 -68
  898. package/node_modules/@pome-sh/twin-slack/dist/src/domain/search.js.map +0 -1
  899. package/node_modules/@pome-sh/twin-slack/dist/src/domain/slack-domain.d.ts +0 -258
  900. package/node_modules/@pome-sh/twin-slack/dist/src/domain/slack-domain.js +0 -510
  901. package/node_modules/@pome-sh/twin-slack/dist/src/domain/slack-domain.js.map +0 -1
  902. package/node_modules/@pome-sh/twin-slack/dist/src/domain/team.d.ts +0 -5
  903. package/node_modules/@pome-sh/twin-slack/dist/src/domain/team.js +0 -25
  904. package/node_modules/@pome-sh/twin-slack/dist/src/domain/team.js.map +0 -1
  905. package/node_modules/@pome-sh/twin-slack/dist/src/domain/topic.d.ts +0 -19
  906. package/node_modules/@pome-sh/twin-slack/dist/src/domain/topic.js +0 -43
  907. package/node_modules/@pome-sh/twin-slack/dist/src/domain/topic.js.map +0 -1
  908. package/node_modules/@pome-sh/twin-slack/dist/src/domain/users.d.ts +0 -24
  909. package/node_modules/@pome-sh/twin-slack/dist/src/domain/users.js +0 -82
  910. package/node_modules/@pome-sh/twin-slack/dist/src/domain/users.js.map +0 -1
  911. package/node_modules/@pome-sh/twin-slack/dist/src/errors.d.ts +0 -16
  912. package/node_modules/@pome-sh/twin-slack/dist/src/errors.js +0 -61
  913. package/node_modules/@pome-sh/twin-slack/dist/src/errors.js.map +0 -1
  914. package/node_modules/@pome-sh/twin-slack/dist/src/index.d.ts +0 -8
  915. package/node_modules/@pome-sh/twin-slack/dist/src/index.js +0 -8
  916. package/node_modules/@pome-sh/twin-slack/dist/src/index.js.map +0 -1
  917. package/node_modules/@pome-sh/twin-slack/dist/src/routes.d.ts +0 -4
  918. package/node_modules/@pome-sh/twin-slack/dist/src/routes.js +0 -211
  919. package/node_modules/@pome-sh/twin-slack/dist/src/routes.js.map +0 -1
  920. package/node_modules/@pome-sh/twin-slack/dist/src/seed.d.ts +0 -54
  921. package/node_modules/@pome-sh/twin-slack/dist/src/seed.js +0 -152
  922. package/node_modules/@pome-sh/twin-slack/dist/src/seed.js.map +0 -1
  923. package/node_modules/@pome-sh/twin-slack/dist/src/serializers.d.ts +0 -141
  924. package/node_modules/@pome-sh/twin-slack/dist/src/serializers.js +0 -378
  925. package/node_modules/@pome-sh/twin-slack/dist/src/serializers.js.map +0 -1
  926. package/node_modules/@pome-sh/twin-slack/dist/src/server.d.ts +0 -2
  927. package/node_modules/@pome-sh/twin-slack/dist/src/server.js +0 -42
  928. package/node_modules/@pome-sh/twin-slack/dist/src/server.js.map +0 -1
  929. package/node_modules/@pome-sh/twin-slack/dist/src/tools.d.ts +0 -123
  930. package/node_modules/@pome-sh/twin-slack/dist/src/tools.js +0 -219
  931. package/node_modules/@pome-sh/twin-slack/dist/src/tools.js.map +0 -1
  932. package/node_modules/@pome-sh/twin-slack/dist/src/twin.d.ts +0 -22
  933. package/node_modules/@pome-sh/twin-slack/dist/src/twin.js +0 -179
  934. package/node_modules/@pome-sh/twin-slack/dist/src/twin.js.map +0 -1
  935. package/node_modules/@pome-sh/twin-slack/dist/src/types.d.ts +0 -182
  936. package/node_modules/@pome-sh/twin-slack/dist/src/types.js +0 -2
  937. package/node_modules/@pome-sh/twin-slack/dist/src/types.js.map +0 -1
  938. package/node_modules/@pome-sh/twin-slack/dist/src/unsupported-envelope.d.ts +0 -12
  939. package/node_modules/@pome-sh/twin-slack/dist/src/unsupported-envelope.js +0 -68
  940. package/node_modules/@pome-sh/twin-slack/dist/src/unsupported-envelope.js.map +0 -1
  941. package/node_modules/@pome-sh/twin-slack/dist/src/upstream-types.d.ts +0 -16
  942. package/node_modules/@pome-sh/twin-slack/dist/src/upstream-types.js +0 -2
  943. package/node_modules/@pome-sh/twin-slack/dist/src/upstream-types.js.map +0 -1
  944. package/node_modules/@pome-sh/twin-slack/dist/src/util.d.ts +0 -30
  945. package/node_modules/@pome-sh/twin-slack/dist/src/util.js +0 -132
  946. package/node_modules/@pome-sh/twin-slack/dist/src/util.js.map +0 -1
  947. package/node_modules/@pome-sh/twin-slack/fidelity.inventory.json +0 -377
  948. package/node_modules/@pome-sh/twin-slack/package.json +0 -63
  949. package/node_modules/@pome-sh/twin-stripe/FIDELITY.md +0 -380
  950. package/node_modules/@pome-sh/twin-stripe/README.md +0 -280
  951. package/node_modules/@pome-sh/twin-stripe/dist/scripts/fidelity-parity.d.ts +0 -1
  952. package/node_modules/@pome-sh/twin-stripe/dist/scripts/fidelity-parity.js +0 -186
  953. package/node_modules/@pome-sh/twin-stripe/dist/scripts/fidelity-parity.js.map +0 -1
  954. package/node_modules/@pome-sh/twin-stripe/dist/scripts/seed.d.ts +0 -1
  955. package/node_modules/@pome-sh/twin-stripe/dist/scripts/seed.js +0 -9
  956. package/node_modules/@pome-sh/twin-stripe/dist/scripts/seed.js.map +0 -1
  957. package/node_modules/@pome-sh/twin-stripe/dist/scripts/smoke.d.ts +0 -1
  958. package/node_modules/@pome-sh/twin-stripe/dist/scripts/smoke.js +0 -224
  959. package/node_modules/@pome-sh/twin-stripe/dist/scripts/smoke.js.map +0 -1
  960. package/node_modules/@pome-sh/twin-stripe/dist/src/api-keys.d.ts +0 -27
  961. package/node_modules/@pome-sh/twin-stripe/dist/src/api-keys.js +0 -49
  962. package/node_modules/@pome-sh/twin-stripe/dist/src/api-keys.js.map +0 -1
  963. package/node_modules/@pome-sh/twin-stripe/dist/src/check-kind.d.ts +0 -3
  964. package/node_modules/@pome-sh/twin-stripe/dist/src/check-kind.js +0 -9
  965. package/node_modules/@pome-sh/twin-stripe/dist/src/check-kind.js.map +0 -1
  966. package/node_modules/@pome-sh/twin-stripe/dist/src/check-params.d.ts +0 -8
  967. package/node_modules/@pome-sh/twin-stripe/dist/src/check-params.js +0 -123
  968. package/node_modules/@pome-sh/twin-stripe/dist/src/check-params.js.map +0 -1
  969. package/node_modules/@pome-sh/twin-stripe/dist/src/check-payments.d.ts +0 -18
  970. package/node_modules/@pome-sh/twin-stripe/dist/src/check-payments.js +0 -280
  971. package/node_modules/@pome-sh/twin-stripe/dist/src/check-payments.js.map +0 -1
  972. package/node_modules/@pome-sh/twin-stripe/dist/src/check-refunds.d.ts +0 -8
  973. package/node_modules/@pome-sh/twin-stripe/dist/src/check-refunds.js +0 -130
  974. package/node_modules/@pome-sh/twin-stripe/dist/src/check-refunds.js.map +0 -1
  975. package/node_modules/@pome-sh/twin-stripe/dist/src/check-state.d.ts +0 -107
  976. package/node_modules/@pome-sh/twin-stripe/dist/src/check-state.js +0 -123
  977. package/node_modules/@pome-sh/twin-stripe/dist/src/check-state.js.map +0 -1
  978. package/node_modules/@pome-sh/twin-stripe/dist/src/check-tape.d.ts +0 -9
  979. package/node_modules/@pome-sh/twin-stripe/dist/src/check-tape.js +0 -338
  980. package/node_modules/@pome-sh/twin-stripe/dist/src/check-tape.js.map +0 -1
  981. package/node_modules/@pome-sh/twin-stripe/dist/src/check-worlds.d.ts +0 -24
  982. package/node_modules/@pome-sh/twin-stripe/dist/src/check-worlds.js +0 -131
  983. package/node_modules/@pome-sh/twin-stripe/dist/src/check-worlds.js.map +0 -1
  984. package/node_modules/@pome-sh/twin-stripe/dist/src/checks.d.ts +0 -22
  985. package/node_modules/@pome-sh/twin-stripe/dist/src/checks.js +0 -97
  986. package/node_modules/@pome-sh/twin-stripe/dist/src/checks.js.map +0 -1
  987. package/node_modules/@pome-sh/twin-stripe/dist/src/db.d.ts +0 -4
  988. package/node_modules/@pome-sh/twin-stripe/dist/src/db.js +0 -167
  989. package/node_modules/@pome-sh/twin-stripe/dist/src/db.js.map +0 -1
  990. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/balance.d.ts +0 -53
  991. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/balance.js +0 -77
  992. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/balance.js.map +0 -1
  993. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/billing.d.ts +0 -101
  994. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/billing.js +0 -195
  995. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/billing.js.map +0 -1
  996. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/charges.d.ts +0 -45
  997. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/charges.js +0 -59
  998. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/charges.js.map +0 -1
  999. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/constants.d.ts +0 -25
  1000. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/constants.js +0 -26
  1001. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/constants.js.map +0 -1
  1002. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/customers.d.ts +0 -47
  1003. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/customers.js +0 -103
  1004. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/customers.js.map +0 -1
  1005. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/events.d.ts +0 -27
  1006. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/events.js +0 -45
  1007. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/events.js.map +0 -1
  1008. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/index.d.ts +0 -18
  1009. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/index.js +0 -16
  1010. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/index.js.map +0 -1
  1011. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/payment-intents.d.ts +0 -150
  1012. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/payment-intents.js +0 -449
  1013. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/payment-intents.js.map +0 -1
  1014. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/payment-methods.d.ts +0 -45
  1015. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/payment-methods.js +0 -159
  1016. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/payment-methods.js.map +0 -1
  1017. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/refunds.d.ts +0 -48
  1018. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/refunds.js +0 -111
  1019. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/refunds.js.map +0 -1
  1020. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/schema.d.ts +0 -9
  1021. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/schema.js +0 -275
  1022. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/schema.js.map +0 -1
  1023. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/stripe-domain.d.ts +0 -779
  1024. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/stripe-domain.js +0 -670
  1025. package/node_modules/@pome-sh/twin-stripe/dist/src/domain/stripe-domain.js.map +0 -1
  1026. package/node_modules/@pome-sh/twin-stripe/dist/src/errors.d.ts +0 -76
  1027. package/node_modules/@pome-sh/twin-stripe/dist/src/errors.js +0 -99
  1028. package/node_modules/@pome-sh/twin-stripe/dist/src/errors.js.map +0 -1
  1029. package/node_modules/@pome-sh/twin-stripe/dist/src/idempotency.d.ts +0 -25
  1030. package/node_modules/@pome-sh/twin-stripe/dist/src/idempotency.js +0 -235
  1031. package/node_modules/@pome-sh/twin-stripe/dist/src/idempotency.js.map +0 -1
  1032. package/node_modules/@pome-sh/twin-stripe/dist/src/ids.d.ts +0 -30
  1033. package/node_modules/@pome-sh/twin-stripe/dist/src/ids.js +0 -58
  1034. package/node_modules/@pome-sh/twin-stripe/dist/src/ids.js.map +0 -1
  1035. package/node_modules/@pome-sh/twin-stripe/dist/src/index.d.ts +0 -11
  1036. package/node_modules/@pome-sh/twin-stripe/dist/src/index.js +0 -16
  1037. package/node_modules/@pome-sh/twin-stripe/dist/src/index.js.map +0 -1
  1038. package/node_modules/@pome-sh/twin-stripe/dist/src/routes/_helpers.d.ts +0 -37
  1039. package/node_modules/@pome-sh/twin-stripe/dist/src/routes/_helpers.js +0 -264
  1040. package/node_modules/@pome-sh/twin-stripe/dist/src/routes/_helpers.js.map +0 -1
  1041. package/node_modules/@pome-sh/twin-stripe/dist/src/routes/balance.d.ts +0 -4
  1042. package/node_modules/@pome-sh/twin-stripe/dist/src/routes/balance.js +0 -14
  1043. package/node_modules/@pome-sh/twin-stripe/dist/src/routes/balance.js.map +0 -1
  1044. package/node_modules/@pome-sh/twin-stripe/dist/src/routes/billing.d.ts +0 -4
  1045. package/node_modules/@pome-sh/twin-stripe/dist/src/routes/billing.js +0 -117
  1046. package/node_modules/@pome-sh/twin-stripe/dist/src/routes/billing.js.map +0 -1
  1047. package/node_modules/@pome-sh/twin-stripe/dist/src/routes/charges.d.ts +0 -4
  1048. package/node_modules/@pome-sh/twin-stripe/dist/src/routes/charges.js +0 -15
  1049. package/node_modules/@pome-sh/twin-stripe/dist/src/routes/charges.js.map +0 -1
  1050. package/node_modules/@pome-sh/twin-stripe/dist/src/routes/customers.d.ts +0 -4
  1051. package/node_modules/@pome-sh/twin-stripe/dist/src/routes/customers.js +0 -47
  1052. package/node_modules/@pome-sh/twin-stripe/dist/src/routes/customers.js.map +0 -1
  1053. package/node_modules/@pome-sh/twin-stripe/dist/src/routes/events.d.ts +0 -4
  1054. package/node_modules/@pome-sh/twin-stripe/dist/src/routes/events.js +0 -14
  1055. package/node_modules/@pome-sh/twin-stripe/dist/src/routes/events.js.map +0 -1
  1056. package/node_modules/@pome-sh/twin-stripe/dist/src/routes/index.d.ts +0 -4
  1057. package/node_modules/@pome-sh/twin-stripe/dist/src/routes/index.js +0 -36
  1058. package/node_modules/@pome-sh/twin-stripe/dist/src/routes/index.js.map +0 -1
  1059. package/node_modules/@pome-sh/twin-stripe/dist/src/routes/payment-intents.d.ts +0 -4
  1060. package/node_modules/@pome-sh/twin-stripe/dist/src/routes/payment-intents.js +0 -81
  1061. package/node_modules/@pome-sh/twin-stripe/dist/src/routes/payment-intents.js.map +0 -1
  1062. package/node_modules/@pome-sh/twin-stripe/dist/src/routes/payment-methods.d.ts +0 -4
  1063. package/node_modules/@pome-sh/twin-stripe/dist/src/routes/payment-methods.js +0 -33
  1064. package/node_modules/@pome-sh/twin-stripe/dist/src/routes/payment-methods.js.map +0 -1
  1065. package/node_modules/@pome-sh/twin-stripe/dist/src/routes/refunds.d.ts +0 -4
  1066. package/node_modules/@pome-sh/twin-stripe/dist/src/routes/refunds.js +0 -63
  1067. package/node_modules/@pome-sh/twin-stripe/dist/src/routes/refunds.js.map +0 -1
  1068. package/node_modules/@pome-sh/twin-stripe/dist/src/seed.d.ts +0 -205
  1069. package/node_modules/@pome-sh/twin-stripe/dist/src/seed.js +0 -226
  1070. package/node_modules/@pome-sh/twin-stripe/dist/src/seed.js.map +0 -1
  1071. package/node_modules/@pome-sh/twin-stripe/dist/src/serializers.d.ts +0 -347
  1072. package/node_modules/@pome-sh/twin-stripe/dist/src/serializers.js +0 -483
  1073. package/node_modules/@pome-sh/twin-stripe/dist/src/serializers.js.map +0 -1
  1074. package/node_modules/@pome-sh/twin-stripe/dist/src/server.d.ts +0 -2
  1075. package/node_modules/@pome-sh/twin-stripe/dist/src/server.js +0 -53
  1076. package/node_modules/@pome-sh/twin-stripe/dist/src/server.js.map +0 -1
  1077. package/node_modules/@pome-sh/twin-stripe/dist/src/session.d.ts +0 -8
  1078. package/node_modules/@pome-sh/twin-stripe/dist/src/session.js +0 -113
  1079. package/node_modules/@pome-sh/twin-stripe/dist/src/session.js.map +0 -1
  1080. package/node_modules/@pome-sh/twin-stripe/dist/src/tools.d.ts +0 -254
  1081. package/node_modules/@pome-sh/twin-stripe/dist/src/tools.js +0 -375
  1082. package/node_modules/@pome-sh/twin-stripe/dist/src/tools.js.map +0 -1
  1083. package/node_modules/@pome-sh/twin-stripe/dist/src/twin.d.ts +0 -42
  1084. package/node_modules/@pome-sh/twin-stripe/dist/src/twin.js +0 -286
  1085. package/node_modules/@pome-sh/twin-stripe/dist/src/twin.js.map +0 -1
  1086. package/node_modules/@pome-sh/twin-stripe/dist/src/types.d.ts +0 -252
  1087. package/node_modules/@pome-sh/twin-stripe/dist/src/types.js +0 -2
  1088. package/node_modules/@pome-sh/twin-stripe/dist/src/types.js.map +0 -1
  1089. package/node_modules/@pome-sh/twin-stripe/dist/src/upstream-types.d.ts +0 -22
  1090. package/node_modules/@pome-sh/twin-stripe/dist/src/upstream-types.js +0 -2
  1091. package/node_modules/@pome-sh/twin-stripe/dist/src/upstream-types.js.map +0 -1
  1092. package/node_modules/@pome-sh/twin-stripe/dist/src/util.d.ts +0 -3
  1093. package/node_modules/@pome-sh/twin-stripe/dist/src/util.js +0 -12
  1094. package/node_modules/@pome-sh/twin-stripe/dist/src/util.js.map +0 -1
  1095. package/node_modules/@pome-sh/twin-stripe/dist/src/x402.d.ts +0 -162
  1096. package/node_modules/@pome-sh/twin-stripe/dist/src/x402.js +0 -506
  1097. package/node_modules/@pome-sh/twin-stripe/dist/src/x402.js.map +0 -1
  1098. package/node_modules/@pome-sh/twin-stripe/fidelity.inventory.json +0 -425
  1099. package/node_modules/@pome-sh/twin-stripe/package.json +0 -64
  1100. package/node_modules/graphql/LICENSE +0 -21
  1101. package/node_modules/graphql/NotSupportedTSVersion.d.ts +0 -1
  1102. package/node_modules/graphql/README.md +0 -203
  1103. package/node_modules/graphql/error/GraphQLError.d.ts +0 -288
  1104. package/node_modules/graphql/error/GraphQLError.js +0 -398
  1105. package/node_modules/graphql/error/GraphQLError.mjs +0 -384
  1106. package/node_modules/graphql/error/index.d.ts +0 -15
  1107. package/node_modules/graphql/error/index.js +0 -41
  1108. package/node_modules/graphql/error/index.mjs +0 -9
  1109. package/node_modules/graphql/error/locatedError.d.ts +0 -33
  1110. package/node_modules/graphql/error/locatedError.js +0 -61
  1111. package/node_modules/graphql/error/locatedError.mjs +0 -52
  1112. package/node_modules/graphql/error/syntaxError.d.ts +0 -26
  1113. package/node_modules/graphql/error/syntaxError.js +0 -35
  1114. package/node_modules/graphql/error/syntaxError.mjs +0 -27
  1115. package/node_modules/graphql/execution/collectFields.d.ts +0 -45
  1116. package/node_modules/graphql/execution/collectFields.js +0 -235
  1117. package/node_modules/graphql/execution/collectFields.mjs +0 -219
  1118. package/node_modules/graphql/execution/execute.d.ts +0 -402
  1119. package/node_modules/graphql/execution/execute.js +0 -1295
  1120. package/node_modules/graphql/execution/execute.mjs +0 -1266
  1121. package/node_modules/graphql/execution/index.d.ts +0 -24
  1122. package/node_modules/graphql/execution/index.js +0 -73
  1123. package/node_modules/graphql/execution/index.mjs +0 -19
  1124. package/node_modules/graphql/execution/mapAsyncIterator.d.ts +0 -11
  1125. package/node_modules/graphql/execution/mapAsyncIterator.js +0 -70
  1126. package/node_modules/graphql/execution/mapAsyncIterator.mjs +0 -63
  1127. package/node_modules/graphql/execution/subscribe.d.ts +0 -262
  1128. package/node_modules/graphql/execution/subscribe.js +0 -388
  1129. package/node_modules/graphql/execution/subscribe.mjs +0 -366
  1130. package/node_modules/graphql/execution/values.d.ts +0 -236
  1131. package/node_modules/graphql/execution/values.js +0 -444
  1132. package/node_modules/graphql/execution/values.mjs +0 -406
  1133. package/node_modules/graphql/graphql.d.ts +0 -189
  1134. package/node_modules/graphql/graphql.js +0 -218
  1135. package/node_modules/graphql/graphql.mjs +0 -212
  1136. package/node_modules/graphql/index.d.ts +0 -423
  1137. package/node_modules/graphql/index.js +0 -1311
  1138. package/node_modules/graphql/index.mjs +0 -256
  1139. package/node_modules/graphql/jsutils/Maybe.d.ts +0 -6
  1140. package/node_modules/graphql/jsutils/Maybe.js +0 -5
  1141. package/node_modules/graphql/jsutils/Maybe.mjs +0 -1
  1142. package/node_modules/graphql/jsutils/ObjMap.d.ts +0 -20
  1143. package/node_modules/graphql/jsutils/ObjMap.js +0 -5
  1144. package/node_modules/graphql/jsutils/ObjMap.mjs +0 -1
  1145. package/node_modules/graphql/jsutils/Path.d.ts +0 -50
  1146. package/node_modules/graphql/jsutils/Path.js +0 -62
  1147. package/node_modules/graphql/jsutils/Path.mjs +0 -54
  1148. package/node_modules/graphql/jsutils/PromiseOrValue.d.ts +0 -2
  1149. package/node_modules/graphql/jsutils/PromiseOrValue.js +0 -5
  1150. package/node_modules/graphql/jsutils/PromiseOrValue.mjs +0 -1
  1151. package/node_modules/graphql/jsutils/devAssert.d.ts +0 -2
  1152. package/node_modules/graphql/jsutils/devAssert.js +0 -15
  1153. package/node_modules/graphql/jsutils/devAssert.mjs +0 -8
  1154. package/node_modules/graphql/jsutils/didYouMean.d.ts +0 -11
  1155. package/node_modules/graphql/jsutils/didYouMean.js +0 -41
  1156. package/node_modules/graphql/jsutils/didYouMean.mjs +0 -35
  1157. package/node_modules/graphql/jsutils/groupBy.d.ts +0 -9
  1158. package/node_modules/graphql/jsutils/groupBy.js +0 -28
  1159. package/node_modules/graphql/jsutils/groupBy.mjs +0 -21
  1160. package/node_modules/graphql/jsutils/identityFunc.d.ts +0 -6
  1161. package/node_modules/graphql/jsutils/identityFunc.js +0 -15
  1162. package/node_modules/graphql/jsutils/identityFunc.mjs +0 -8
  1163. package/node_modules/graphql/jsutils/inspect.d.ts +0 -6
  1164. package/node_modules/graphql/jsutils/inspect.js +0 -123
  1165. package/node_modules/graphql/jsutils/inspect.mjs +0 -117
  1166. package/node_modules/graphql/jsutils/instanceOf.d.ts +0 -18
  1167. package/node_modules/graphql/jsutils/instanceOf.js +0 -67
  1168. package/node_modules/graphql/jsutils/instanceOf.mjs +0 -59
  1169. package/node_modules/graphql/jsutils/invariant.d.ts +0 -5
  1170. package/node_modules/graphql/jsutils/invariant.js +0 -17
  1171. package/node_modules/graphql/jsutils/invariant.mjs +0 -10
  1172. package/node_modules/graphql/jsutils/isAsyncIterable.d.ts +0 -9
  1173. package/node_modules/graphql/jsutils/isAsyncIterable.js +0 -20
  1174. package/node_modules/graphql/jsutils/isAsyncIterable.mjs +0 -13
  1175. package/node_modules/graphql/jsutils/isIterableObject.d.ts +0 -21
  1176. package/node_modules/graphql/jsutils/isIterableObject.js +0 -33
  1177. package/node_modules/graphql/jsutils/isIterableObject.mjs +0 -26
  1178. package/node_modules/graphql/jsutils/isObjectLike.d.ts +0 -9
  1179. package/node_modules/graphql/jsutils/isObjectLike.js +0 -16
  1180. package/node_modules/graphql/jsutils/isObjectLike.mjs +0 -9
  1181. package/node_modules/graphql/jsutils/isPromise.d.ts +0 -7
  1182. package/node_modules/graphql/jsutils/isPromise.js +0 -19
  1183. package/node_modules/graphql/jsutils/isPromise.mjs +0 -12
  1184. package/node_modules/graphql/jsutils/keyMap.d.ts +0 -25
  1185. package/node_modules/graphql/jsutils/keyMap.js +0 -36
  1186. package/node_modules/graphql/jsutils/keyMap.mjs +0 -29
  1187. package/node_modules/graphql/jsutils/keyValMap.d.ts +0 -26
  1188. package/node_modules/graphql/jsutils/keyValMap.js +0 -36
  1189. package/node_modules/graphql/jsutils/keyValMap.mjs +0 -29
  1190. package/node_modules/graphql/jsutils/mapValue.d.ts +0 -11
  1191. package/node_modules/graphql/jsutils/mapValue.js +0 -22
  1192. package/node_modules/graphql/jsutils/mapValue.mjs +0 -15
  1193. package/node_modules/graphql/jsutils/memoize3.d.ts +0 -11
  1194. package/node_modules/graphql/jsutils/memoize3.js +0 -43
  1195. package/node_modules/graphql/jsutils/memoize3.mjs +0 -36
  1196. package/node_modules/graphql/jsutils/naturalCompare.d.ts +0 -10
  1197. package/node_modules/graphql/jsutils/naturalCompare.js +0 -71
  1198. package/node_modules/graphql/jsutils/naturalCompare.mjs +0 -63
  1199. package/node_modules/graphql/jsutils/printPathArray.d.ts +0 -8
  1200. package/node_modules/graphql/jsutils/printPathArray.js +0 -19
  1201. package/node_modules/graphql/jsutils/printPathArray.mjs +0 -12
  1202. package/node_modules/graphql/jsutils/promiseForObject.d.ts +0 -13
  1203. package/node_modules/graphql/jsutils/promiseForObject.js +0 -27
  1204. package/node_modules/graphql/jsutils/promiseForObject.mjs +0 -20
  1205. package/node_modules/graphql/jsutils/promiseReduce.d.ts +0 -15
  1206. package/node_modules/graphql/jsutils/promiseReduce.js +0 -29
  1207. package/node_modules/graphql/jsutils/promiseReduce.mjs +0 -22
  1208. package/node_modules/graphql/jsutils/suggestionList.d.ts +0 -10
  1209. package/node_modules/graphql/jsutils/suggestionList.js +0 -143
  1210. package/node_modules/graphql/jsutils/suggestionList.mjs +0 -134
  1211. package/node_modules/graphql/jsutils/toError.d.ts +0 -6
  1212. package/node_modules/graphql/jsutils/toError.js +0 -27
  1213. package/node_modules/graphql/jsutils/toError.mjs +0 -20
  1214. package/node_modules/graphql/jsutils/toObjMap.d.ts +0 -6
  1215. package/node_modules/graphql/jsutils/toObjMap.js +0 -25
  1216. package/node_modules/graphql/jsutils/toObjMap.mjs +0 -18
  1217. package/node_modules/graphql/language/ast.d.ts +0 -949
  1218. package/node_modules/graphql/language/ast.js +0 -301
  1219. package/node_modules/graphql/language/ast.mjs +0 -285
  1220. package/node_modules/graphql/language/blockString.d.ts +0 -26
  1221. package/node_modules/graphql/language/blockString.js +0 -193
  1222. package/node_modules/graphql/language/blockString.mjs +0 -176
  1223. package/node_modules/graphql/language/characterClasses.d.ts +0 -47
  1224. package/node_modules/graphql/language/characterClasses.js +0 -75
  1225. package/node_modules/graphql/language/characterClasses.mjs +0 -64
  1226. package/node_modules/graphql/language/directiveLocation.d.ts +0 -54
  1227. package/node_modules/graphql/language/directiveLocation.js +0 -43
  1228. package/node_modules/graphql/language/directiveLocation.mjs +0 -37
  1229. package/node_modules/graphql/language/index.d.ts +0 -117
  1230. package/node_modules/graphql/language/index.js +0 -227
  1231. package/node_modules/graphql/language/index.mjs +0 -42
  1232. package/node_modules/graphql/language/kinds.d.ts +0 -112
  1233. package/node_modules/graphql/language/kinds.js +0 -72
  1234. package/node_modules/graphql/language/kinds.mjs +0 -66
  1235. package/node_modules/graphql/language/lexer.d.ts +0 -129
  1236. package/node_modules/graphql/language/lexer.js +0 -1074
  1237. package/node_modules/graphql/language/lexer.mjs +0 -972
  1238. package/node_modules/graphql/language/location.d.ts +0 -29
  1239. package/node_modules/graphql/language/location.js +0 -49
  1240. package/node_modules/graphql/language/location.mjs +0 -41
  1241. package/node_modules/graphql/language/parser.d.ts +0 -829
  1242. package/node_modules/graphql/language/parser.js +0 -1949
  1243. package/node_modules/graphql/language/parser.mjs +0 -1899
  1244. package/node_modules/graphql/language/predicates.d.ts +0 -206
  1245. package/node_modules/graphql/language/predicates.js +0 -292
  1246. package/node_modules/graphql/language/predicates.mjs +0 -274
  1247. package/node_modules/graphql/language/printLocation.d.ts +0 -42
  1248. package/node_modules/graphql/language/printLocation.js +0 -103
  1249. package/node_modules/graphql/language/printLocation.mjs +0 -94
  1250. package/node_modules/graphql/language/printString.d.ts +0 -7
  1251. package/node_modules/graphql/language/printString.js +0 -187
  1252. package/node_modules/graphql/language/printString.mjs +0 -180
  1253. package/node_modules/graphql/language/printer.d.ts +0 -18
  1254. package/node_modules/graphql/language/printer.js +0 -411
  1255. package/node_modules/graphql/language/printer.mjs +0 -398
  1256. package/node_modules/graphql/language/schemaCoordinateLexer.d.ts +0 -45
  1257. package/node_modules/graphql/language/schemaCoordinateLexer.js +0 -175
  1258. package/node_modules/graphql/language/schemaCoordinateLexer.mjs +0 -126
  1259. package/node_modules/graphql/language/source.d.ts +0 -53
  1260. package/node_modules/graphql/language/source.js +0 -97
  1261. package/node_modules/graphql/language/source.mjs +0 -81
  1262. package/node_modules/graphql/language/tokenKind.d.ts +0 -63
  1263. package/node_modules/graphql/language/tokenKind.js +0 -49
  1264. package/node_modules/graphql/language/tokenKind.mjs +0 -43
  1265. package/node_modules/graphql/language/visitor.d.ts +0 -322
  1266. package/node_modules/graphql/language/visitor.js +0 -446
  1267. package/node_modules/graphql/language/visitor.mjs +0 -426
  1268. package/node_modules/graphql/package.json +0 -39
  1269. package/node_modules/graphql/subscription/index.d.ts +0 -25
  1270. package/node_modules/graphql/subscription/index.js +0 -19
  1271. package/node_modules/graphql/subscription/index.mjs +0 -25
  1272. package/node_modules/graphql/type/assertName.d.ts +0 -27
  1273. package/node_modules/graphql/type/assertName.js +0 -77
  1274. package/node_modules/graphql/type/assertName.mjs +0 -61
  1275. package/node_modules/graphql/type/definition.d.ts +0 -3387
  1276. package/node_modules/graphql/type/definition.js +0 -3515
  1277. package/node_modules/graphql/type/definition.mjs +0 -3378
  1278. package/node_modules/graphql/type/directives.d.ts +0 -273
  1279. package/node_modules/graphql/type/directives.js +0 -424
  1280. package/node_modules/graphql/type/directives.mjs +0 -388
  1281. package/node_modules/graphql/type/index.d.ts +0 -157
  1282. package/node_modules/graphql/type/index.js +0 -553
  1283. package/node_modules/graphql/type/index.mjs +0 -110
  1284. package/node_modules/graphql/type/introspection.d.ts +0 -66
  1285. package/node_modules/graphql/type/introspection.js +0 -681
  1286. package/node_modules/graphql/type/introspection.mjs +0 -623
  1287. package/node_modules/graphql/type/scalars.d.ts +0 -46
  1288. package/node_modules/graphql/type/scalars.js +0 -404
  1289. package/node_modules/graphql/type/scalars.mjs +0 -343
  1290. package/node_modules/graphql/type/schema.d.ts +0 -632
  1291. package/node_modules/graphql/type/schema.js +0 -860
  1292. package/node_modules/graphql/type/schema.mjs +0 -839
  1293. package/node_modules/graphql/type/validate.d.ts +0 -48
  1294. package/node_modules/graphql/type/validate.js +0 -738
  1295. package/node_modules/graphql/type/validate.mjs +0 -712
  1296. package/node_modules/graphql/utilities/TypeInfo.d.ts +0 -507
  1297. package/node_modules/graphql/utilities/TypeInfo.js +0 -861
  1298. package/node_modules/graphql/utilities/TypeInfo.mjs +0 -837
  1299. package/node_modules/graphql/utilities/assertValidName.d.ts +0 -38
  1300. package/node_modules/graphql/utilities/assertValidName.js +0 -77
  1301. package/node_modules/graphql/utilities/assertValidName.mjs +0 -65
  1302. package/node_modules/graphql/utilities/astFromValue.d.ts +0 -58
  1303. package/node_modules/graphql/utilities/astFromValue.js +0 -223
  1304. package/node_modules/graphql/utilities/astFromValue.mjs +0 -209
  1305. package/node_modules/graphql/utilities/buildASTSchema.d.ts +0 -94
  1306. package/node_modules/graphql/utilities/buildASTSchema.js +0 -178
  1307. package/node_modules/graphql/utilities/buildASTSchema.mjs +0 -160
  1308. package/node_modules/graphql/utilities/buildClientSchema.d.ts +0 -34
  1309. package/node_modules/graphql/utilities/buildClientSchema.js +0 -404
  1310. package/node_modules/graphql/utilities/buildClientSchema.mjs +0 -380
  1311. package/node_modules/graphql/utilities/coerceInputValue.d.ts +0 -62
  1312. package/node_modules/graphql/utilities/coerceInputValue.js +0 -264
  1313. package/node_modules/graphql/utilities/coerceInputValue.mjs +0 -238
  1314. package/node_modules/graphql/utilities/concatAST.d.ts +0 -21
  1315. package/node_modules/graphql/utilities/concatAST.js +0 -39
  1316. package/node_modules/graphql/utilities/concatAST.mjs +0 -31
  1317. package/node_modules/graphql/utilities/extendSchema.d.ts +0 -93
  1318. package/node_modules/graphql/utilities/extendSchema.js +0 -923
  1319. package/node_modules/graphql/utilities/extendSchema.mjs +0 -912
  1320. package/node_modules/graphql/utilities/findBreakingChanges.d.ts +0 -148
  1321. package/node_modules/graphql/utilities/findBreakingChanges.js +0 -615
  1322. package/node_modules/graphql/utilities/findBreakingChanges.mjs +0 -589
  1323. package/node_modules/graphql/utilities/getIntrospectionQuery.d.ts +0 -336
  1324. package/node_modules/graphql/utilities/getIntrospectionQuery.js +0 -179
  1325. package/node_modules/graphql/utilities/getIntrospectionQuery.mjs +0 -172
  1326. package/node_modules/graphql/utilities/getOperationAST.d.ts +0 -26
  1327. package/node_modules/graphql/utilities/getOperationAST.js +0 -59
  1328. package/node_modules/graphql/utilities/getOperationAST.mjs +0 -51
  1329. package/node_modules/graphql/utilities/getOperationRootType.d.ts +0 -32
  1330. package/node_modules/graphql/utilities/getOperationRootType.js +0 -85
  1331. package/node_modules/graphql/utilities/getOperationRootType.mjs +0 -71
  1332. package/node_modules/graphql/utilities/index.d.ts +0 -73
  1333. package/node_modules/graphql/utilities/index.js +0 -247
  1334. package/node_modules/graphql/utilities/index.mjs +0 -67
  1335. package/node_modules/graphql/utilities/introspectionFromSchema.d.ts +0 -72
  1336. package/node_modules/graphql/utilities/introspectionFromSchema.js +0 -99
  1337. package/node_modules/graphql/utilities/introspectionFromSchema.mjs +0 -86
  1338. package/node_modules/graphql/utilities/lexicographicSortSchema.d.ts +0 -44
  1339. package/node_modules/graphql/utilities/lexicographicSortSchema.js +0 -213
  1340. package/node_modules/graphql/utilities/lexicographicSortSchema.mjs +0 -207
  1341. package/node_modules/graphql/utilities/printSchema.d.ts +0 -68
  1342. package/node_modules/graphql/utilities/printSchema.js +0 -405
  1343. package/node_modules/graphql/utilities/printSchema.mjs +0 -382
  1344. package/node_modules/graphql/utilities/resolveSchemaCoordinate.d.ts +0 -142
  1345. package/node_modules/graphql/utilities/resolveSchemaCoordinate.js +0 -324
  1346. package/node_modules/graphql/utilities/resolveSchemaCoordinate.mjs +0 -306
  1347. package/node_modules/graphql/utilities/separateOperations.d.ts +0 -41
  1348. package/node_modules/graphql/utilities/separateOperations.js +0 -119
  1349. package/node_modules/graphql/utilities/separateOperations.mjs +0 -110
  1350. package/node_modules/graphql/utilities/sortValueNode.d.ts +0 -9
  1351. package/node_modules/graphql/utilities/sortValueNode.js +0 -47
  1352. package/node_modules/graphql/utilities/sortValueNode.mjs +0 -39
  1353. package/node_modules/graphql/utilities/stripIgnoredCharacters.d.ts +0 -69
  1354. package/node_modules/graphql/utilities/stripIgnoredCharacters.js +0 -131
  1355. package/node_modules/graphql/utilities/stripIgnoredCharacters.mjs +0 -113
  1356. package/node_modules/graphql/utilities/typeComparators.d.ts +0 -116
  1357. package/node_modules/graphql/utilities/typeComparators.js +0 -201
  1358. package/node_modules/graphql/utilities/typeComparators.mjs +0 -190
  1359. package/node_modules/graphql/utilities/typeFromAST.d.ts +0 -118
  1360. package/node_modules/graphql/utilities/typeFromAST.js +0 -30
  1361. package/node_modules/graphql/utilities/typeFromAST.mjs +0 -21
  1362. package/node_modules/graphql/utilities/typedQueryDocumentNode.d.ts +0 -26
  1363. package/node_modules/graphql/utilities/typedQueryDocumentNode.js +0 -5
  1364. package/node_modules/graphql/utilities/typedQueryDocumentNode.mjs +0 -1
  1365. package/node_modules/graphql/utilities/valueFromAST.d.ts +0 -67
  1366. package/node_modules/graphql/utilities/valueFromAST.js +0 -246
  1367. package/node_modules/graphql/utilities/valueFromAST.mjs +0 -232
  1368. package/node_modules/graphql/utilities/valueFromASTUntyped.d.ts +0 -36
  1369. package/node_modules/graphql/utilities/valueFromASTUntyped.js +0 -75
  1370. package/node_modules/graphql/utilities/valueFromASTUntyped.mjs +0 -66
  1371. package/node_modules/graphql/validation/ValidationContext.d.ts +0 -495
  1372. package/node_modules/graphql/validation/ValidationContext.js +0 -633
  1373. package/node_modules/graphql/validation/ValidationContext.mjs +0 -614
  1374. package/node_modules/graphql/validation/index.d.ts +0 -47
  1375. package/node_modules/graphql/validation/index.js +0 -331
  1376. package/node_modules/graphql/validation/index.mjs +0 -75
  1377. package/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.d.ts +0 -41
  1378. package/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.js +0 -75
  1379. package/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.mjs +0 -62
  1380. package/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.d.ts +0 -41
  1381. package/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.js +0 -178
  1382. package/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.mjs +0 -159
  1383. package/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.d.ts +0 -42
  1384. package/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.js +0 -98
  1385. package/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.mjs +0 -81
  1386. package/node_modules/graphql/validation/rules/KnownArgumentNamesRule.d.ts +0 -49
  1387. package/node_modules/graphql/validation/rules/KnownArgumentNamesRule.js +0 -147
  1388. package/node_modules/graphql/validation/rules/KnownArgumentNamesRule.mjs +0 -128
  1389. package/node_modules/graphql/validation/rules/KnownDirectivesRule.d.ts +0 -44
  1390. package/node_modules/graphql/validation/rules/KnownDirectivesRule.js +0 -200
  1391. package/node_modules/graphql/validation/rules/KnownDirectivesRule.mjs +0 -182
  1392. package/node_modules/graphql/validation/rules/KnownFragmentNamesRule.d.ts +0 -41
  1393. package/node_modules/graphql/validation/rules/KnownFragmentNamesRule.js +0 -65
  1394. package/node_modules/graphql/validation/rules/KnownFragmentNamesRule.mjs +0 -54
  1395. package/node_modules/graphql/validation/rules/KnownTypeNamesRule.d.ts +0 -44
  1396. package/node_modules/graphql/validation/rules/KnownTypeNamesRule.js +0 -118
  1397. package/node_modules/graphql/validation/rules/KnownTypeNamesRule.mjs +0 -105
  1398. package/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.d.ts +0 -41
  1399. package/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.js +0 -71
  1400. package/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.mjs +0 -62
  1401. package/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.d.ts +0 -31
  1402. package/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.js +0 -89
  1403. package/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.mjs +0 -78
  1404. package/node_modules/graphql/validation/rules/MaxIntrospectionDepthRule.d.ts +0 -36
  1405. package/node_modules/graphql/validation/rules/MaxIntrospectionDepthRule.js +0 -123
  1406. package/node_modules/graphql/validation/rules/MaxIntrospectionDepthRule.mjs +0 -111
  1407. package/node_modules/graphql/validation/rules/NoFragmentCyclesRule.d.ts +0 -41
  1408. package/node_modules/graphql/validation/rules/NoFragmentCyclesRule.js +0 -114
  1409. package/node_modules/graphql/validation/rules/NoFragmentCyclesRule.mjs +0 -106
  1410. package/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.d.ts +0 -41
  1411. package/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.js +0 -81
  1412. package/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.mjs +0 -73
  1413. package/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.d.ts +0 -41
  1414. package/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.js +0 -90
  1415. package/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.mjs +0 -79
  1416. package/node_modules/graphql/validation/rules/NoUnusedVariablesRule.d.ts +0 -42
  1417. package/node_modules/graphql/validation/rules/NoUnusedVariablesRule.js +0 -87
  1418. package/node_modules/graphql/validation/rules/NoUnusedVariablesRule.mjs +0 -79
  1419. package/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.d.ts +0 -47
  1420. package/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.js +0 -907
  1421. package/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.mjs +0 -892
  1422. package/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.d.ts +0 -48
  1423. package/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.js +0 -132
  1424. package/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.mjs +0 -109
  1425. package/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.d.ts +0 -31
  1426. package/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.js +0 -193
  1427. package/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.mjs +0 -169
  1428. package/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.d.ts +0 -46
  1429. package/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.js +0 -189
  1430. package/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.mjs +0 -168
  1431. package/node_modules/graphql/validation/rules/ScalarLeafsRule.d.ts +0 -37
  1432. package/node_modules/graphql/validation/rules/ScalarLeafsRule.js +0 -95
  1433. package/node_modules/graphql/validation/rules/ScalarLeafsRule.mjs +0 -85
  1434. package/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.d.ts +0 -46
  1435. package/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.js +0 -120
  1436. package/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.mjs +0 -110
  1437. package/node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.d.ts +0 -32
  1438. package/node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.js +0 -114
  1439. package/node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.mjs +0 -102
  1440. package/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.d.ts +0 -41
  1441. package/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.js +0 -84
  1442. package/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.mjs +0 -72
  1443. package/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.d.ts +0 -31
  1444. package/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.js +0 -76
  1445. package/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.mjs +0 -68
  1446. package/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.d.ts +0 -44
  1447. package/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.js +0 -136
  1448. package/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.mjs +0 -125
  1449. package/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.d.ts +0 -31
  1450. package/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.js +0 -97
  1451. package/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.mjs +0 -85
  1452. package/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.d.ts +0 -31
  1453. package/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.js +0 -109
  1454. package/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.mjs +0 -100
  1455. package/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.d.ts +0 -40
  1456. package/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.js +0 -70
  1457. package/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.mjs +0 -62
  1458. package/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.d.ts +0 -45
  1459. package/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.js +0 -87
  1460. package/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.mjs +0 -78
  1461. package/node_modules/graphql/validation/rules/UniqueOperationNamesRule.d.ts +0 -40
  1462. package/node_modules/graphql/validation/rules/UniqueOperationNamesRule.js +0 -75
  1463. package/node_modules/graphql/validation/rules/UniqueOperationNamesRule.mjs +0 -67
  1464. package/node_modules/graphql/validation/rules/UniqueOperationTypesRule.d.ts +0 -31
  1465. package/node_modules/graphql/validation/rules/UniqueOperationTypesRule.js +0 -93
  1466. package/node_modules/graphql/validation/rules/UniqueOperationTypesRule.mjs +0 -85
  1467. package/node_modules/graphql/validation/rules/UniqueTypeNamesRule.d.ts +0 -31
  1468. package/node_modules/graphql/validation/rules/UniqueTypeNamesRule.js +0 -79
  1469. package/node_modules/graphql/validation/rules/UniqueTypeNamesRule.mjs +0 -68
  1470. package/node_modules/graphql/validation/rules/UniqueVariableNamesRule.d.ts +0 -38
  1471. package/node_modules/graphql/validation/rules/UniqueVariableNamesRule.js +0 -78
  1472. package/node_modules/graphql/validation/rules/UniqueVariableNamesRule.mjs +0 -69
  1473. package/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.d.ts +0 -41
  1474. package/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.js +0 -271
  1475. package/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.mjs +0 -247
  1476. package/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.d.ts +0 -45
  1477. package/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.js +0 -79
  1478. package/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.mjs +0 -65
  1479. package/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.d.ts +0 -40
  1480. package/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.js +0 -165
  1481. package/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.mjs +0 -149
  1482. package/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.d.ts +0 -56
  1483. package/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.js +0 -173
  1484. package/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.mjs +0 -158
  1485. package/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.d.ts +0 -43
  1486. package/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.js +0 -70
  1487. package/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.mjs +0 -60
  1488. package/node_modules/graphql/validation/specifiedRules.d.ts +0 -17
  1489. package/node_modules/graphql/validation/specifiedRules.js +0 -175
  1490. package/node_modules/graphql/validation/specifiedRules.mjs +0 -131
  1491. package/node_modules/graphql/validation/validate.d.ts +0 -122
  1492. package/node_modules/graphql/validation/validate.js +0 -219
  1493. package/node_modules/graphql/validation/validate.mjs +0 -200
  1494. package/node_modules/graphql/version.d.ts +0 -10
  1495. package/node_modules/graphql/version.js +0 -23
  1496. package/node_modules/graphql/version.mjs +0 -14
  1497. package/node_modules/hono/LICENSE +0 -21
  1498. package/node_modules/hono/README.md +0 -85
  1499. package/node_modules/hono/dist/adapter/aws-lambda/conninfo.js +0 -24
  1500. package/node_modules/hono/dist/adapter/aws-lambda/handler.js +0 -364
  1501. package/node_modules/hono/dist/adapter/aws-lambda/index.js +0 -9
  1502. package/node_modules/hono/dist/adapter/aws-lambda/types.js +0 -0
  1503. package/node_modules/hono/dist/adapter/bun/conninfo.js +0 -27
  1504. package/node_modules/hono/dist/adapter/bun/index.js +0 -16
  1505. package/node_modules/hono/dist/adapter/bun/serve-static.js +0 -30
  1506. package/node_modules/hono/dist/adapter/bun/server.js +0 -5
  1507. package/node_modules/hono/dist/adapter/bun/ssg.js +0 -17
  1508. package/node_modules/hono/dist/adapter/bun/websocket.js +0 -73
  1509. package/node_modules/hono/dist/adapter/cloudflare-pages/conninfo.js +0 -9
  1510. package/node_modules/hono/dist/adapter/cloudflare-pages/handler.js +0 -67
  1511. package/node_modules/hono/dist/adapter/cloudflare-pages/index.js +0 -9
  1512. package/node_modules/hono/dist/adapter/cloudflare-workers/conninfo.js +0 -9
  1513. package/node_modules/hono/dist/adapter/cloudflare-workers/index.js +0 -9
  1514. package/node_modules/hono/dist/adapter/cloudflare-workers/serve-static-module.js +0 -8
  1515. package/node_modules/hono/dist/adapter/cloudflare-workers/serve-static.js +0 -22
  1516. package/node_modules/hono/dist/adapter/cloudflare-workers/utils.js +0 -35
  1517. package/node_modules/hono/dist/adapter/cloudflare-workers/websocket.js +0 -41
  1518. package/node_modules/hono/dist/adapter/deno/conninfo.js +0 -14
  1519. package/node_modules/hono/dist/adapter/deno/deno.d.js +0 -0
  1520. package/node_modules/hono/dist/adapter/deno/index.js +0 -12
  1521. package/node_modules/hono/dist/adapter/deno/serve-static.js +0 -40
  1522. package/node_modules/hono/dist/adapter/deno/ssg.js +0 -18
  1523. package/node_modules/hono/dist/adapter/deno/websocket.js +0 -32
  1524. package/node_modules/hono/dist/adapter/lambda-edge/conninfo.js +0 -9
  1525. package/node_modules/hono/dist/adapter/lambda-edge/handler.js +0 -96
  1526. package/node_modules/hono/dist/adapter/lambda-edge/index.js +0 -7
  1527. package/node_modules/hono/dist/adapter/netlify/conninfo.js +0 -9
  1528. package/node_modules/hono/dist/adapter/netlify/handler.js +0 -9
  1529. package/node_modules/hono/dist/adapter/netlify/index.js +0 -2
  1530. package/node_modules/hono/dist/adapter/netlify/mod.js +0 -7
  1531. package/node_modules/hono/dist/adapter/service-worker/handler.js +0 -20
  1532. package/node_modules/hono/dist/adapter/service-worker/index.js +0 -9
  1533. package/node_modules/hono/dist/adapter/service-worker/types.js +0 -0
  1534. package/node_modules/hono/dist/adapter/vercel/conninfo.js +0 -10
  1535. package/node_modules/hono/dist/adapter/vercel/handler.js +0 -7
  1536. package/node_modules/hono/dist/adapter/vercel/index.js +0 -7
  1537. package/node_modules/hono/dist/cjs/adapter/aws-lambda/conninfo.js +0 -46
  1538. package/node_modules/hono/dist/cjs/adapter/aws-lambda/handler.js +0 -395
  1539. package/node_modules/hono/dist/cjs/adapter/aws-lambda/index.js +0 -34
  1540. package/node_modules/hono/dist/cjs/adapter/aws-lambda/types.js +0 -15
  1541. package/node_modules/hono/dist/cjs/adapter/bun/conninfo.js +0 -49
  1542. package/node_modules/hono/dist/cjs/adapter/bun/index.js +0 -45
  1543. package/node_modules/hono/dist/cjs/adapter/bun/serve-static.js +0 -52
  1544. package/node_modules/hono/dist/cjs/adapter/bun/server.js +0 -27
  1545. package/node_modules/hono/dist/cjs/adapter/bun/ssg.js +0 -40
  1546. package/node_modules/hono/dist/cjs/adapter/bun/websocket.js +0 -98
  1547. package/node_modules/hono/dist/cjs/adapter/cloudflare-pages/conninfo.js +0 -31
  1548. package/node_modules/hono/dist/cjs/adapter/cloudflare-pages/handler.js +0 -91
  1549. package/node_modules/hono/dist/cjs/adapter/cloudflare-pages/index.js +0 -34
  1550. package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/conninfo.js +0 -31
  1551. package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/index.js +0 -33
  1552. package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/serve-static-module.js +0 -30
  1553. package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/serve-static.js +0 -44
  1554. package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/utils.js +0 -57
  1555. package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/websocket.js +0 -63
  1556. package/node_modules/hono/dist/cjs/adapter/deno/conninfo.js +0 -36
  1557. package/node_modules/hono/dist/cjs/adapter/deno/deno.d.js +0 -0
  1558. package/node_modules/hono/dist/cjs/adapter/deno/index.js +0 -38
  1559. package/node_modules/hono/dist/cjs/adapter/deno/serve-static.js +0 -62
  1560. package/node_modules/hono/dist/cjs/adapter/deno/ssg.js +0 -41
  1561. package/node_modules/hono/dist/cjs/adapter/deno/websocket.js +0 -54
  1562. package/node_modules/hono/dist/cjs/adapter/lambda-edge/conninfo.js +0 -31
  1563. package/node_modules/hono/dist/cjs/adapter/lambda-edge/handler.js +0 -130
  1564. package/node_modules/hono/dist/cjs/adapter/lambda-edge/index.js +0 -30
  1565. package/node_modules/hono/dist/cjs/adapter/netlify/conninfo.js +0 -31
  1566. package/node_modules/hono/dist/cjs/adapter/netlify/handler.js +0 -31
  1567. package/node_modules/hono/dist/cjs/adapter/netlify/index.js +0 -21
  1568. package/node_modules/hono/dist/cjs/adapter/netlify/mod.js +0 -30
  1569. package/node_modules/hono/dist/cjs/adapter/service-worker/handler.js +0 -42
  1570. package/node_modules/hono/dist/cjs/adapter/service-worker/index.js +0 -32
  1571. package/node_modules/hono/dist/cjs/adapter/service-worker/types.js +0 -15
  1572. package/node_modules/hono/dist/cjs/adapter/vercel/conninfo.js +0 -32
  1573. package/node_modules/hono/dist/cjs/adapter/vercel/handler.js +0 -29
  1574. package/node_modules/hono/dist/cjs/adapter/vercel/index.js +0 -30
  1575. package/node_modules/hono/dist/cjs/client/client.js +0 -204
  1576. package/node_modules/hono/dist/cjs/client/fetch-result-please.js +0 -85
  1577. package/node_modules/hono/dist/cjs/client/index.js +0 -32
  1578. package/node_modules/hono/dist/cjs/client/types.js +0 -15
  1579. package/node_modules/hono/dist/cjs/client/utils.js +0 -105
  1580. package/node_modules/hono/dist/cjs/compose.js +0 -68
  1581. package/node_modules/hono/dist/cjs/context.js +0 -450
  1582. package/node_modules/hono/dist/cjs/helper/accepts/accepts.js +0 -43
  1583. package/node_modules/hono/dist/cjs/helper/accepts/index.js +0 -27
  1584. package/node_modules/hono/dist/cjs/helper/adapter/index.js +0 -81
  1585. package/node_modules/hono/dist/cjs/helper/conninfo/index.js +0 -15
  1586. package/node_modules/hono/dist/cjs/helper/conninfo/types.js +0 -15
  1587. package/node_modules/hono/dist/cjs/helper/cookie/index.js +0 -130
  1588. package/node_modules/hono/dist/cjs/helper/css/common.js +0 -273
  1589. package/node_modules/hono/dist/cjs/helper/css/index.js +0 -157
  1590. package/node_modules/hono/dist/cjs/helper/dev/index.js +0 -79
  1591. package/node_modules/hono/dist/cjs/helper/factory/index.js +0 -54
  1592. package/node_modules/hono/dist/cjs/helper/html/index.js +0 -64
  1593. package/node_modules/hono/dist/cjs/helper/proxy/index.js +0 -115
  1594. package/node_modules/hono/dist/cjs/helper/route/index.js +0 -71
  1595. package/node_modules/hono/dist/cjs/helper/ssg/index.js +0 -43
  1596. package/node_modules/hono/dist/cjs/helper/ssg/middleware.js +0 -73
  1597. package/node_modules/hono/dist/cjs/helper/ssg/plugins.js +0 -70
  1598. package/node_modules/hono/dist/cjs/helper/ssg/ssg.js +0 -320
  1599. package/node_modules/hono/dist/cjs/helper/ssg/utils.js +0 -93
  1600. package/node_modules/hono/dist/cjs/helper/streaming/index.js +0 -35
  1601. package/node_modules/hono/dist/cjs/helper/streaming/sse.js +0 -91
  1602. package/node_modules/hono/dist/cjs/helper/streaming/stream.js +0 -56
  1603. package/node_modules/hono/dist/cjs/helper/streaming/text.js +0 -34
  1604. package/node_modules/hono/dist/cjs/helper/streaming/utils.js +0 -35
  1605. package/node_modules/hono/dist/cjs/helper/testing/index.js +0 -33
  1606. package/node_modules/hono/dist/cjs/helper/websocket/index.js +0 -81
  1607. package/node_modules/hono/dist/cjs/hono-base.js +0 -406
  1608. package/node_modules/hono/dist/cjs/hono.js +0 -43
  1609. package/node_modules/hono/dist/cjs/http-exception.js +0 -57
  1610. package/node_modules/hono/dist/cjs/index.js +0 -30
  1611. package/node_modules/hono/dist/cjs/jsx/base.js +0 -378
  1612. package/node_modules/hono/dist/cjs/jsx/children.js +0 -44
  1613. package/node_modules/hono/dist/cjs/jsx/components.js +0 -221
  1614. package/node_modules/hono/dist/cjs/jsx/constants.js +0 -42
  1615. package/node_modules/hono/dist/cjs/jsx/context.js +0 -188
  1616. package/node_modules/hono/dist/cjs/jsx/dom/client.js +0 -76
  1617. package/node_modules/hono/dist/cjs/jsx/dom/components.js +0 -55
  1618. package/node_modules/hono/dist/cjs/jsx/dom/context.js +0 -71
  1619. package/node_modules/hono/dist/cjs/jsx/dom/css.js +0 -168
  1620. package/node_modules/hono/dist/cjs/jsx/dom/hooks/index.js +0 -74
  1621. package/node_modules/hono/dist/cjs/jsx/dom/index.js +0 -181
  1622. package/node_modules/hono/dist/cjs/jsx/dom/intrinsic-element/components.js +0 -399
  1623. package/node_modules/hono/dist/cjs/jsx/dom/jsx-dev-runtime.js +0 -52
  1624. package/node_modules/hono/dist/cjs/jsx/dom/jsx-runtime.js +0 -32
  1625. package/node_modules/hono/dist/cjs/jsx/dom/render.js +0 -641
  1626. package/node_modules/hono/dist/cjs/jsx/dom/server.js +0 -67
  1627. package/node_modules/hono/dist/cjs/jsx/dom/utils.js +0 -32
  1628. package/node_modules/hono/dist/cjs/jsx/hooks/index.js +0 -373
  1629. package/node_modules/hono/dist/cjs/jsx/index.js +0 -138
  1630. package/node_modules/hono/dist/cjs/jsx/intrinsic-element/common.js +0 -50
  1631. package/node_modules/hono/dist/cjs/jsx/intrinsic-element/components.js +0 -189
  1632. package/node_modules/hono/dist/cjs/jsx/intrinsic-elements.js +0 -15
  1633. package/node_modules/hono/dist/cjs/jsx/jsx-dev-runtime.js +0 -41
  1634. package/node_modules/hono/dist/cjs/jsx/jsx-runtime.js +0 -71
  1635. package/node_modules/hono/dist/cjs/jsx/streaming.js +0 -179
  1636. package/node_modules/hono/dist/cjs/jsx/types.js +0 -15
  1637. package/node_modules/hono/dist/cjs/jsx/utils.js +0 -200
  1638. package/node_modules/hono/dist/cjs/middleware/basic-auth/index.js +0 -88
  1639. package/node_modules/hono/dist/cjs/middleware/bearer-auth/index.js +0 -114
  1640. package/node_modules/hono/dist/cjs/middleware/body-limit/index.js +0 -75
  1641. package/node_modules/hono/dist/cjs/middleware/cache/index.js +0 -219
  1642. package/node_modules/hono/dist/cjs/middleware/combine/index.js +0 -101
  1643. package/node_modules/hono/dist/cjs/middleware/compress/index.js +0 -97
  1644. package/node_modules/hono/dist/cjs/middleware/context-storage/index.js +0 -47
  1645. package/node_modules/hono/dist/cjs/middleware/cors/index.js +0 -106
  1646. package/node_modules/hono/dist/cjs/middleware/csrf/index.js +0 -77
  1647. package/node_modules/hono/dist/cjs/middleware/etag/digest.js +0 -55
  1648. package/node_modules/hono/dist/cjs/middleware/etag/index.js +0 -96
  1649. package/node_modules/hono/dist/cjs/middleware/ip-restriction/index.js +0 -176
  1650. package/node_modules/hono/dist/cjs/middleware/jsx-renderer/index.js +0 -82
  1651. package/node_modules/hono/dist/cjs/middleware/jwk/index.js +0 -27
  1652. package/node_modules/hono/dist/cjs/middleware/jwk/jwk.js +0 -139
  1653. package/node_modules/hono/dist/cjs/middleware/jwt/index.js +0 -38
  1654. package/node_modules/hono/dist/cjs/middleware/jwt/jwt.js +0 -145
  1655. package/node_modules/hono/dist/cjs/middleware/language/index.js +0 -35
  1656. package/node_modules/hono/dist/cjs/middleware/language/language.js +0 -203
  1657. package/node_modules/hono/dist/cjs/middleware/logger/index.js +0 -72
  1658. package/node_modules/hono/dist/cjs/middleware/method-not-allowed/index.js +0 -90
  1659. package/node_modules/hono/dist/cjs/middleware/method-override/index.js +0 -106
  1660. package/node_modules/hono/dist/cjs/middleware/powered-by/index.js +0 -32
  1661. package/node_modules/hono/dist/cjs/middleware/pretty-json/index.js +0 -37
  1662. package/node_modules/hono/dist/cjs/middleware/request-id/index.js +0 -27
  1663. package/node_modules/hono/dist/cjs/middleware/request-id/request-id.js +0 -43
  1664. package/node_modules/hono/dist/cjs/middleware/secure-headers/index.js +0 -29
  1665. package/node_modules/hono/dist/cjs/middleware/secure-headers/permissions-policy.js +0 -15
  1666. package/node_modules/hono/dist/cjs/middleware/secure-headers/secure-headers.js +0 -195
  1667. package/node_modules/hono/dist/cjs/middleware/serve-static/index.js +0 -99
  1668. package/node_modules/hono/dist/cjs/middleware/serve-static/path.js +0 -40
  1669. package/node_modules/hono/dist/cjs/middleware/timeout/index.js +0 -47
  1670. package/node_modules/hono/dist/cjs/middleware/timing/index.js +0 -35
  1671. package/node_modules/hono/dist/cjs/middleware/timing/timing.js +0 -130
  1672. package/node_modules/hono/dist/cjs/middleware/trailing-slash/index.js +0 -62
  1673. package/node_modules/hono/dist/cjs/package.json +0 -3
  1674. package/node_modules/hono/dist/cjs/preset/quick.js +0 -38
  1675. package/node_modules/hono/dist/cjs/preset/tiny.js +0 -34
  1676. package/node_modules/hono/dist/cjs/request/constants.js +0 -27
  1677. package/node_modules/hono/dist/cjs/request.js +0 -342
  1678. package/node_modules/hono/dist/cjs/router/linear-router/index.js +0 -27
  1679. package/node_modules/hono/dist/cjs/router/linear-router/router.js +0 -140
  1680. package/node_modules/hono/dist/cjs/router/pattern-router/index.js +0 -27
  1681. package/node_modules/hono/dist/cjs/router/pattern-router/router.js +0 -70
  1682. package/node_modules/hono/dist/cjs/router/reg-exp-router/index.js +0 -34
  1683. package/node_modules/hono/dist/cjs/router/reg-exp-router/matcher.js +0 -48
  1684. package/node_modules/hono/dist/cjs/router/reg-exp-router/node.js +0 -133
  1685. package/node_modules/hono/dist/cjs/router/reg-exp-router/prepared-router.js +0 -166
  1686. package/node_modules/hono/dist/cjs/router/reg-exp-router/router.js +0 -187
  1687. package/node_modules/hono/dist/cjs/router/reg-exp-router/trie.js +0 -89
  1688. package/node_modules/hono/dist/cjs/router/smart-router/index.js +0 -27
  1689. package/node_modules/hono/dist/cjs/router/smart-router/router.js +0 -80
  1690. package/node_modules/hono/dist/cjs/router/trie-router/index.js +0 -27
  1691. package/node_modules/hono/dist/cjs/router/trie-router/node.js +0 -210
  1692. package/node_modules/hono/dist/cjs/router/trie-router/router.js +0 -48
  1693. package/node_modules/hono/dist/cjs/router.js +0 -40
  1694. package/node_modules/hono/dist/cjs/types.js +0 -28
  1695. package/node_modules/hono/dist/cjs/utils/accept.js +0 -245
  1696. package/node_modules/hono/dist/cjs/utils/basic-auth.js +0 -45
  1697. package/node_modules/hono/dist/cjs/utils/body.js +0 -111
  1698. package/node_modules/hono/dist/cjs/utils/buffer.js +0 -103
  1699. package/node_modules/hono/dist/cjs/utils/color.js +0 -48
  1700. package/node_modules/hono/dist/cjs/utils/compress.js +0 -27
  1701. package/node_modules/hono/dist/cjs/utils/concurrent.js +0 -61
  1702. package/node_modules/hono/dist/cjs/utils/constants.js +0 -27
  1703. package/node_modules/hono/dist/cjs/utils/cookie.js +0 -199
  1704. package/node_modules/hono/dist/cjs/utils/crypto.js +0 -69
  1705. package/node_modules/hono/dist/cjs/utils/encode.js +0 -54
  1706. package/node_modules/hono/dist/cjs/utils/filepath.js +0 -58
  1707. package/node_modules/hono/dist/cjs/utils/handler.js +0 -36
  1708. package/node_modules/hono/dist/cjs/utils/headers.js +0 -15
  1709. package/node_modules/hono/dist/cjs/utils/html.js +0 -150
  1710. package/node_modules/hono/dist/cjs/utils/http-status.js +0 -15
  1711. package/node_modules/hono/dist/cjs/utils/ipaddr.js +0 -318
  1712. package/node_modules/hono/dist/cjs/utils/jwt/index.js +0 -28
  1713. package/node_modules/hono/dist/cjs/utils/jwt/jwa.js +0 -42
  1714. package/node_modules/hono/dist/cjs/utils/jwt/jws.js +0 -215
  1715. package/node_modules/hono/dist/cjs/utils/jwt/jwt.js +0 -219
  1716. package/node_modules/hono/dist/cjs/utils/jwt/types.js +0 -161
  1717. package/node_modules/hono/dist/cjs/utils/jwt/utf8.js +0 -30
  1718. package/node_modules/hono/dist/cjs/utils/mime.js +0 -106
  1719. package/node_modules/hono/dist/cjs/utils/stream.js +0 -103
  1720. package/node_modules/hono/dist/cjs/utils/types.js +0 -15
  1721. package/node_modules/hono/dist/cjs/utils/url.js +0 -256
  1722. package/node_modules/hono/dist/cjs/validator/index.js +0 -27
  1723. package/node_modules/hono/dist/cjs/validator/utils.js +0 -15
  1724. package/node_modules/hono/dist/cjs/validator/validator.js +0 -108
  1725. package/node_modules/hono/dist/client/client.js +0 -189
  1726. package/node_modules/hono/dist/client/fetch-result-please.js +0 -62
  1727. package/node_modules/hono/dist/client/index.js +0 -8
  1728. package/node_modules/hono/dist/client/types.js +0 -0
  1729. package/node_modules/hono/dist/client/utils.js +0 -76
  1730. package/node_modules/hono/dist/compose.js +0 -46
  1731. package/node_modules/hono/dist/context.js +0 -427
  1732. package/node_modules/hono/dist/helper/accepts/accepts.js +0 -20
  1733. package/node_modules/hono/dist/helper/accepts/index.js +0 -5
  1734. package/node_modules/hono/dist/helper/adapter/index.js +0 -56
  1735. package/node_modules/hono/dist/helper/conninfo/index.js +0 -0
  1736. package/node_modules/hono/dist/helper/conninfo/types.js +0 -0
  1737. package/node_modules/hono/dist/helper/cookie/index.js +0 -102
  1738. package/node_modules/hono/dist/helper/css/common.js +0 -236
  1739. package/node_modules/hono/dist/helper/css/index.js +0 -140
  1740. package/node_modules/hono/dist/helper/dev/index.js +0 -55
  1741. package/node_modules/hono/dist/helper/factory/index.js +0 -30
  1742. package/node_modules/hono/dist/helper/html/index.js +0 -41
  1743. package/node_modules/hono/dist/helper/proxy/index.js +0 -93
  1744. package/node_modules/hono/dist/helper/route/index.js +0 -46
  1745. package/node_modules/hono/dist/helper/ssg/index.js +0 -19
  1746. package/node_modules/hono/dist/helper/ssg/middleware.js +0 -45
  1747. package/node_modules/hono/dist/helper/ssg/plugins.js +0 -47
  1748. package/node_modules/hono/dist/helper/ssg/ssg.js +0 -297
  1749. package/node_modules/hono/dist/helper/ssg/utils.js +0 -67
  1750. package/node_modules/hono/dist/helper/streaming/index.js +0 -10
  1751. package/node_modules/hono/dist/helper/streaming/sse.js +0 -68
  1752. package/node_modules/hono/dist/helper/streaming/stream.js +0 -34
  1753. package/node_modules/hono/dist/helper/streaming/text.js +0 -12
  1754. package/node_modules/hono/dist/helper/streaming/utils.js +0 -13
  1755. package/node_modules/hono/dist/helper/testing/index.js +0 -11
  1756. package/node_modules/hono/dist/helper/websocket/index.js +0 -57
  1757. package/node_modules/hono/dist/hono-base.js +0 -384
  1758. package/node_modules/hono/dist/hono.js +0 -21
  1759. package/node_modules/hono/dist/http-exception.js +0 -35
  1760. package/node_modules/hono/dist/index.js +0 -7
  1761. package/node_modules/hono/dist/jsx/base.js +0 -346
  1762. package/node_modules/hono/dist/jsx/children.js +0 -21
  1763. package/node_modules/hono/dist/jsx/components.js +0 -198
  1764. package/node_modules/hono/dist/jsx/constants.js +0 -15
  1765. package/node_modules/hono/dist/jsx/context.js +0 -162
  1766. package/node_modules/hono/dist/jsx/dom/client.js +0 -53
  1767. package/node_modules/hono/dist/jsx/dom/components.js +0 -32
  1768. package/node_modules/hono/dist/jsx/dom/context.js +0 -48
  1769. package/node_modules/hono/dist/jsx/dom/css.js +0 -150
  1770. package/node_modules/hono/dist/jsx/dom/hooks/index.js +0 -48
  1771. package/node_modules/hono/dist/jsx/dom/index.js +0 -142
  1772. package/node_modules/hono/dist/jsx/dom/intrinsic-element/components.js +0 -374
  1773. package/node_modules/hono/dist/jsx/dom/jsx-dev-runtime.js +0 -19
  1774. package/node_modules/hono/dist/jsx/dom/jsx-runtime.js +0 -8
  1775. package/node_modules/hono/dist/jsx/dom/render.js +0 -617
  1776. package/node_modules/hono/dist/jsx/dom/server.js +0 -33
  1777. package/node_modules/hono/dist/jsx/dom/utils.js +0 -10
  1778. package/node_modules/hono/dist/jsx/hooks/index.js +0 -331
  1779. package/node_modules/hono/dist/jsx/index.js +0 -103
  1780. package/node_modules/hono/dist/jsx/intrinsic-element/common.js +0 -24
  1781. package/node_modules/hono/dist/jsx/intrinsic-element/components.js +0 -165
  1782. package/node_modules/hono/dist/jsx/intrinsic-elements.js +0 -0
  1783. package/node_modules/hono/dist/jsx/jsx-dev-runtime.js +0 -18
  1784. package/node_modules/hono/dist/jsx/jsx-runtime.js +0 -44
  1785. package/node_modules/hono/dist/jsx/streaming.js +0 -155
  1786. package/node_modules/hono/dist/jsx/types.js +0 -0
  1787. package/node_modules/hono/dist/jsx/utils.js +0 -175
  1788. package/node_modules/hono/dist/middleware/basic-auth/index.js +0 -66
  1789. package/node_modules/hono/dist/middleware/bearer-auth/index.js +0 -92
  1790. package/node_modules/hono/dist/middleware/body-limit/index.js +0 -53
  1791. package/node_modules/hono/dist/middleware/cache/index.js +0 -197
  1792. package/node_modules/hono/dist/middleware/combine/index.js +0 -77
  1793. package/node_modules/hono/dist/middleware/compress/index.js +0 -74
  1794. package/node_modules/hono/dist/middleware/context-storage/index.js +0 -23
  1795. package/node_modules/hono/dist/middleware/cors/index.js +0 -84
  1796. package/node_modules/hono/dist/middleware/csrf/index.js +0 -55
  1797. package/node_modules/hono/dist/middleware/etag/digest.js +0 -33
  1798. package/node_modules/hono/dist/middleware/etag/index.js +0 -73
  1799. package/node_modules/hono/dist/middleware/ip-restriction/index.js +0 -162
  1800. package/node_modules/hono/dist/middleware/jsx-renderer/index.js +0 -58
  1801. package/node_modules/hono/dist/middleware/jwk/index.js +0 -5
  1802. package/node_modules/hono/dist/middleware/jwk/jwk.js +0 -117
  1803. package/node_modules/hono/dist/middleware/jwt/index.js +0 -11
  1804. package/node_modules/hono/dist/middleware/jwt/jwt.js +0 -119
  1805. package/node_modules/hono/dist/middleware/language/index.js +0 -15
  1806. package/node_modules/hono/dist/middleware/language/language.js +0 -172
  1807. package/node_modules/hono/dist/middleware/logger/index.js +0 -44
  1808. package/node_modules/hono/dist/middleware/method-not-allowed/index.js +0 -68
  1809. package/node_modules/hono/dist/middleware/method-override/index.js +0 -84
  1810. package/node_modules/hono/dist/middleware/powered-by/index.js +0 -10
  1811. package/node_modules/hono/dist/middleware/pretty-json/index.js +0 -15
  1812. package/node_modules/hono/dist/middleware/request-id/index.js +0 -5
  1813. package/node_modules/hono/dist/middleware/request-id/request-id.js +0 -21
  1814. package/node_modules/hono/dist/middleware/secure-headers/index.js +0 -6
  1815. package/node_modules/hono/dist/middleware/secure-headers/permissions-policy.js +0 -0
  1816. package/node_modules/hono/dist/middleware/secure-headers/secure-headers.js +0 -172
  1817. package/node_modules/hono/dist/middleware/serve-static/index.js +0 -77
  1818. package/node_modules/hono/dist/middleware/serve-static/path.js +0 -18
  1819. package/node_modules/hono/dist/middleware/timeout/index.js +0 -25
  1820. package/node_modules/hono/dist/middleware/timing/index.js +0 -9
  1821. package/node_modules/hono/dist/middleware/timing/timing.js +0 -104
  1822. package/node_modules/hono/dist/middleware/trailing-slash/index.js +0 -39
  1823. package/node_modules/hono/dist/preset/quick.js +0 -16
  1824. package/node_modules/hono/dist/preset/tiny.js +0 -12
  1825. package/node_modules/hono/dist/request/constants.js +0 -5
  1826. package/node_modules/hono/dist/request.js +0 -319
  1827. package/node_modules/hono/dist/router/linear-router/index.js +0 -5
  1828. package/node_modules/hono/dist/router/linear-router/router.js +0 -118
  1829. package/node_modules/hono/dist/router/pattern-router/index.js +0 -5
  1830. package/node_modules/hono/dist/router/pattern-router/router.js +0 -48
  1831. package/node_modules/hono/dist/router/reg-exp-router/index.js +0 -9
  1832. package/node_modules/hono/dist/router/reg-exp-router/matcher.js +0 -25
  1833. package/node_modules/hono/dist/router/reg-exp-router/node.js +0 -110
  1834. package/node_modules/hono/dist/router/reg-exp-router/prepared-router.js +0 -142
  1835. package/node_modules/hono/dist/router/reg-exp-router/router.js +0 -169
  1836. package/node_modules/hono/dist/router/reg-exp-router/trie.js +0 -67
  1837. package/node_modules/hono/dist/router/smart-router/index.js +0 -5
  1838. package/node_modules/hono/dist/router/smart-router/router.js +0 -58
  1839. package/node_modules/hono/dist/router/trie-router/index.js +0 -5
  1840. package/node_modules/hono/dist/router/trie-router/node.js +0 -188
  1841. package/node_modules/hono/dist/router/trie-router/router.js +0 -26
  1842. package/node_modules/hono/dist/router.js +0 -14
  1843. package/node_modules/hono/dist/types/adapter/aws-lambda/conninfo.d.ts +0 -27
  1844. package/node_modules/hono/dist/types/adapter/aws-lambda/handler.d.ts +0 -184
  1845. package/node_modules/hono/dist/types/adapter/aws-lambda/index.d.ts +0 -8
  1846. package/node_modules/hono/dist/types/adapter/aws-lambda/types.d.ts +0 -153
  1847. package/node_modules/hono/dist/types/adapter/bun/conninfo.d.ts +0 -7
  1848. package/node_modules/hono/dist/types/adapter/bun/index.d.ts +0 -10
  1849. package/node_modules/hono/dist/types/adapter/bun/serve-static.d.ts +0 -3
  1850. package/node_modules/hono/dist/types/adapter/bun/server.d.ts +0 -12
  1851. package/node_modules/hono/dist/types/adapter/bun/ssg.d.ts +0 -13
  1852. package/node_modules/hono/dist/types/adapter/bun/websocket.d.ts +0 -39
  1853. package/node_modules/hono/dist/types/adapter/cloudflare-pages/conninfo.d.ts +0 -21
  1854. package/node_modules/hono/dist/types/adapter/cloudflare-pages/handler.d.ts +0 -33
  1855. package/node_modules/hono/dist/types/adapter/cloudflare-pages/index.d.ts +0 -7
  1856. package/node_modules/hono/dist/types/adapter/cloudflare-workers/conninfo.d.ts +0 -2
  1857. package/node_modules/hono/dist/types/adapter/cloudflare-workers/index.d.ts +0 -7
  1858. package/node_modules/hono/dist/types/adapter/cloudflare-workers/serve-static-module.d.ts +0 -4
  1859. package/node_modules/hono/dist/types/adapter/cloudflare-workers/serve-static.d.ts +0 -16
  1860. package/node_modules/hono/dist/types/adapter/cloudflare-workers/utils.d.ts +0 -5
  1861. package/node_modules/hono/dist/types/adapter/cloudflare-workers/websocket.d.ts +0 -2
  1862. package/node_modules/hono/dist/types/adapter/deno/conninfo.d.ts +0 -7
  1863. package/node_modules/hono/dist/types/adapter/deno/index.d.ts +0 -8
  1864. package/node_modules/hono/dist/types/adapter/deno/serve-static.d.ts +0 -3
  1865. package/node_modules/hono/dist/types/adapter/deno/ssg.d.ts +0 -13
  1866. package/node_modules/hono/dist/types/adapter/deno/websocket.d.ts +0 -2
  1867. package/node_modules/hono/dist/types/adapter/lambda-edge/conninfo.d.ts +0 -2
  1868. package/node_modules/hono/dist/types/adapter/lambda-edge/handler.d.ts +0 -87
  1869. package/node_modules/hono/dist/types/adapter/lambda-edge/index.d.ts +0 -7
  1870. package/node_modules/hono/dist/types/adapter/netlify/conninfo.d.ts +0 -21
  1871. package/node_modules/hono/dist/types/adapter/netlify/handler.d.ts +0 -2
  1872. package/node_modules/hono/dist/types/adapter/netlify/index.d.ts +0 -5
  1873. package/node_modules/hono/dist/types/adapter/netlify/mod.d.ts +0 -2
  1874. package/node_modules/hono/dist/types/adapter/service-worker/handler.d.ts +0 -16
  1875. package/node_modules/hono/dist/types/adapter/service-worker/index.d.ts +0 -28
  1876. package/node_modules/hono/dist/types/adapter/service-worker/types.d.ts +0 -12
  1877. package/node_modules/hono/dist/types/adapter/vercel/conninfo.d.ts +0 -2
  1878. package/node_modules/hono/dist/types/adapter/vercel/handler.d.ts +0 -2
  1879. package/node_modules/hono/dist/types/adapter/vercel/index.d.ts +0 -6
  1880. package/node_modules/hono/dist/types/client/client.d.ts +0 -4
  1881. package/node_modules/hono/dist/types/client/fetch-result-please.d.ts +0 -35
  1882. package/node_modules/hono/dist/types/client/index.d.ts +0 -7
  1883. package/node_modules/hono/dist/types/client/types.d.ts +0 -229
  1884. package/node_modules/hono/dist/types/client/utils.d.ts +0 -18
  1885. package/node_modules/hono/dist/types/compose.d.ts +0 -14
  1886. package/node_modules/hono/dist/types/context.d.ts +0 -455
  1887. package/node_modules/hono/dist/types/helper/accepts/accepts.d.ts +0 -30
  1888. package/node_modules/hono/dist/types/helper/accepts/index.d.ts +0 -5
  1889. package/node_modules/hono/dist/types/helper/adapter/index.d.ts +0 -12
  1890. package/node_modules/hono/dist/types/helper/conninfo/index.d.ts +0 -5
  1891. package/node_modules/hono/dist/types/helper/conninfo/types.d.ts +0 -36
  1892. package/node_modules/hono/dist/types/helper/cookie/index.d.ts +0 -24
  1893. package/node_modules/hono/dist/types/helper/css/common.d.ts +0 -59
  1894. package/node_modules/hono/dist/types/helper/css/index.d.ts +0 -80
  1895. package/node_modules/hono/dist/types/helper/dev/index.d.ts +0 -20
  1896. package/node_modules/hono/dist/types/helper/factory/index.d.ts +0 -82
  1897. package/node_modules/hono/dist/types/helper/html/index.d.ts +0 -8
  1898. package/node_modules/hono/dist/types/helper/proxy/index.d.ts +0 -72
  1899. package/node_modules/hono/dist/types/helper/route/index.d.ts +0 -75
  1900. package/node_modules/hono/dist/types/helper/ssg/index.d.ts +0 -7
  1901. package/node_modules/hono/dist/types/helper/ssg/middleware.d.ts +0 -44
  1902. package/node_modules/hono/dist/types/helper/ssg/plugins.d.ts +0 -27
  1903. package/node_modules/hono/dist/types/helper/ssg/ssg.d.ts +0 -91
  1904. package/node_modules/hono/dist/types/helper/ssg/utils.d.ts +0 -16
  1905. package/node_modules/hono/dist/types/helper/streaming/index.d.ts +0 -8
  1906. package/node_modules/hono/dist/types/helper/streaming/sse.d.ts +0 -13
  1907. package/node_modules/hono/dist/types/helper/streaming/stream.d.ts +0 -3
  1908. package/node_modules/hono/dist/types/helper/streaming/text.d.ts +0 -3
  1909. package/node_modules/hono/dist/types/helper/streaming/utils.d.ts +0 -1
  1910. package/node_modules/hono/dist/types/helper/testing/index.d.ts +0 -12
  1911. package/node_modules/hono/dist/types/helper/websocket/index.d.ts +0 -69
  1912. package/node_modules/hono/dist/types/hono-base.d.ts +0 -221
  1913. package/node_modules/hono/dist/types/hono.d.ts +0 -19
  1914. package/node_modules/hono/dist/types/http-exception.d.ts +0 -59
  1915. package/node_modules/hono/dist/types/index.d.ts +0 -37
  1916. package/node_modules/hono/dist/types/jsx/base.d.ts +0 -58
  1917. package/node_modules/hono/dist/types/jsx/children.d.ts +0 -9
  1918. package/node_modules/hono/dist/types/jsx/components.d.ts +0 -15
  1919. package/node_modules/hono/dist/types/jsx/constants.d.ts +0 -6
  1920. package/node_modules/hono/dist/types/jsx/context.d.ts +0 -51
  1921. package/node_modules/hono/dist/types/jsx/dom/client.d.ts +0 -31
  1922. package/node_modules/hono/dist/types/jsx/dom/components.d.ts +0 -10
  1923. package/node_modules/hono/dist/types/jsx/dom/context.d.ts +0 -3
  1924. package/node_modules/hono/dist/types/jsx/dom/css.d.ts +0 -83
  1925. package/node_modules/hono/dist/types/jsx/dom/hooks/index.d.ts +0 -39
  1926. package/node_modules/hono/dist/types/jsx/dom/index.d.ts +0 -88
  1927. package/node_modules/hono/dist/types/jsx/dom/intrinsic-element/components.d.ts +0 -16
  1928. package/node_modules/hono/dist/types/jsx/dom/jsx-dev-runtime.d.ts +0 -8
  1929. package/node_modules/hono/dist/types/jsx/dom/jsx-runtime.d.ts +0 -7
  1930. package/node_modules/hono/dist/types/jsx/dom/render.d.ts +0 -73
  1931. package/node_modules/hono/dist/types/jsx/dom/server.d.ts +0 -106
  1932. package/node_modules/hono/dist/types/jsx/dom/utils.d.ts +0 -1
  1933. package/node_modules/hono/dist/types/jsx/hooks/index.d.ts +0 -47
  1934. package/node_modules/hono/dist/types/jsx/index.d.ts +0 -75
  1935. package/node_modules/hono/dist/types/jsx/intrinsic-element/common.d.ts +0 -6
  1936. package/node_modules/hono/dist/types/jsx/intrinsic-element/components.d.ts +0 -13
  1937. package/node_modules/hono/dist/types/jsx/intrinsic-elements.d.ts +0 -722
  1938. package/node_modules/hono/dist/types/jsx/jsx-dev-runtime.d.ts +0 -8
  1939. package/node_modules/hono/dist/types/jsx/jsx-runtime.d.ts +0 -12
  1940. package/node_modules/hono/dist/types/jsx/streaming.d.ts +0 -36
  1941. package/node_modules/hono/dist/types/jsx/types.d.ts +0 -35
  1942. package/node_modules/hono/dist/types/jsx/utils.d.ts +0 -4
  1943. package/node_modules/hono/dist/types/middleware/basic-auth/index.d.ts +0 -75
  1944. package/node_modules/hono/dist/types/middleware/bearer-auth/index.d.ts +0 -92
  1945. package/node_modules/hono/dist/types/middleware/body-limit/index.d.ts +0 -45
  1946. package/node_modules/hono/dist/types/middleware/cache/index.d.ts +0 -45
  1947. package/node_modules/hono/dist/types/middleware/combine/index.d.ts +0 -85
  1948. package/node_modules/hono/dist/types/middleware/compress/index.d.ts +0 -40
  1949. package/node_modules/hono/dist/types/middleware/context-storage/index.d.ts +0 -40
  1950. package/node_modules/hono/dist/types/middleware/cors/index.d.ts +0 -55
  1951. package/node_modules/hono/dist/types/middleware/csrf/index.d.ts +0 -78
  1952. package/node_modules/hono/dist/types/middleware/etag/digest.d.ts +0 -1
  1953. package/node_modules/hono/dist/types/middleware/etag/index.d.ts +0 -42
  1954. package/node_modules/hono/dist/types/middleware/ip-restriction/index.d.ts +0 -67
  1955. package/node_modules/hono/dist/types/middleware/jsx-renderer/index.d.ts +0 -77
  1956. package/node_modules/hono/dist/types/middleware/jwk/index.d.ts +0 -1
  1957. package/node_modules/hono/dist/types/middleware/jwk/jwk.d.ts +0 -56
  1958. package/node_modules/hono/dist/types/middleware/jwt/index.d.ts +0 -8
  1959. package/node_modules/hono/dist/types/middleware/jwt/jwt.d.ts +0 -69
  1960. package/node_modules/hono/dist/types/middleware/language/index.d.ts +0 -7
  1961. package/node_modules/hono/dist/types/middleware/language/language.d.ts +0 -120
  1962. package/node_modules/hono/dist/types/middleware/logger/index.d.ts +0 -24
  1963. package/node_modules/hono/dist/types/middleware/method-not-allowed/index.d.ts +0 -49
  1964. package/node_modules/hono/dist/types/middleware/method-override/index.d.ts +0 -48
  1965. package/node_modules/hono/dist/types/middleware/powered-by/index.d.ts +0 -29
  1966. package/node_modules/hono/dist/types/middleware/pretty-json/index.d.ts +0 -42
  1967. package/node_modules/hono/dist/types/middleware/request-id/index.d.ts +0 -7
  1968. package/node_modules/hono/dist/types/middleware/request-id/request-id.d.ts +0 -37
  1969. package/node_modules/hono/dist/types/middleware/secure-headers/index.d.ts +0 -8
  1970. package/node_modules/hono/dist/types/middleware/secure-headers/permissions-policy.d.ts +0 -14
  1971. package/node_modules/hono/dist/types/middleware/secure-headers/secure-headers.d.ts +0 -109
  1972. package/node_modules/hono/dist/types/middleware/serve-static/index.d.ts +0 -31
  1973. package/node_modules/hono/dist/types/middleware/serve-static/path.d.ts +0 -5
  1974. package/node_modules/hono/dist/types/middleware/timeout/index.d.ts +0 -31
  1975. package/node_modules/hono/dist/types/middleware/timing/index.d.ts +0 -7
  1976. package/node_modules/hono/dist/types/middleware/timing/timing.d.ts +0 -129
  1977. package/node_modules/hono/dist/types/middleware/trailing-slash/index.d.ts +0 -94
  1978. package/node_modules/hono/dist/types/package.json +0 -3
  1979. package/node_modules/hono/dist/types/preset/quick.d.ts +0 -10
  1980. package/node_modules/hono/dist/types/preset/tiny.d.ts +0 -10
  1981. package/node_modules/hono/dist/types/request/constants.d.ts +0 -1
  1982. package/node_modules/hono/dist/types/request.d.ts +0 -324
  1983. package/node_modules/hono/dist/types/router/linear-router/index.d.ts +0 -5
  1984. package/node_modules/hono/dist/types/router/linear-router/router.d.ts +0 -7
  1985. package/node_modules/hono/dist/types/router/pattern-router/index.d.ts +0 -5
  1986. package/node_modules/hono/dist/types/router/pattern-router/router.d.ts +0 -7
  1987. package/node_modules/hono/dist/types/router/reg-exp-router/index.d.ts +0 -6
  1988. package/node_modules/hono/dist/types/router/reg-exp-router/matcher.d.ts +0 -7
  1989. package/node_modules/hono/dist/types/router/reg-exp-router/node.d.ts +0 -10
  1990. package/node_modules/hono/dist/types/router/reg-exp-router/prepared-router.d.ts +0 -17
  1991. package/node_modules/hono/dist/types/router/reg-exp-router/router.d.ts +0 -11
  1992. package/node_modules/hono/dist/types/router/reg-exp-router/trie.d.ts +0 -8
  1993. package/node_modules/hono/dist/types/router/smart-router/index.d.ts +0 -5
  1994. package/node_modules/hono/dist/types/router/smart-router/router.d.ts +0 -11
  1995. package/node_modules/hono/dist/types/router/trie-router/index.d.ts +0 -5
  1996. package/node_modules/hono/dist/types/router/trie-router/node.d.ts +0 -7
  1997. package/node_modules/hono/dist/types/router/trie-router/router.d.ts +0 -8
  1998. package/node_modules/hono/dist/types/router.d.ts +0 -97
  1999. package/node_modules/hono/dist/types/types.d.ts +0 -573
  2000. package/node_modules/hono/dist/types/utils/accept.d.ts +0 -6
  2001. package/node_modules/hono/dist/types/utils/basic-auth.d.ts +0 -5
  2002. package/node_modules/hono/dist/types/utils/body.d.ts +0 -79
  2003. package/node_modules/hono/dist/types/utils/buffer.d.ts +0 -17
  2004. package/node_modules/hono/dist/types/utils/color.d.ts +0 -21
  2005. package/node_modules/hono/dist/types/utils/compress.d.ts +0 -8
  2006. package/node_modules/hono/dist/types/utils/concurrent.d.ts +0 -11
  2007. package/node_modules/hono/dist/types/utils/constants.d.ts +0 -4
  2008. package/node_modules/hono/dist/types/utils/cookie.d.ts +0 -40
  2009. package/node_modules/hono/dist/types/utils/crypto.d.ts +0 -15
  2010. package/node_modules/hono/dist/types/utils/encode.d.ts +0 -8
  2011. package/node_modules/hono/dist/types/utils/filepath.d.ts +0 -12
  2012. package/node_modules/hono/dist/types/utils/handler.d.ts +0 -6
  2013. package/node_modules/hono/dist/types/utils/headers.d.ts +0 -8
  2014. package/node_modules/hono/dist/types/utils/html.d.ts +0 -44
  2015. package/node_modules/hono/dist/types/utils/http-status.d.ts +0 -32
  2016. package/node_modules/hono/dist/types/utils/ipaddr.d.ts +0 -56
  2017. package/node_modules/hono/dist/types/utils/jwt/index.d.ts +0 -18
  2018. package/node_modules/hono/dist/types/utils/jwt/jwa.d.ts +0 -23
  2019. package/node_modules/hono/dist/types/utils/jwt/jws.d.ts +0 -12
  2020. package/node_modules/hono/dist/types/utils/jwt/jwt.d.ts +0 -43
  2021. package/node_modules/hono/dist/types/utils/jwt/types.d.ts +0 -86
  2022. package/node_modules/hono/dist/types/utils/jwt/utf8.d.ts +0 -6
  2023. package/node_modules/hono/dist/types/utils/mime.d.ts +0 -70
  2024. package/node_modules/hono/dist/types/utils/stream.d.ts +0 -31
  2025. package/node_modules/hono/dist/types/utils/types.d.ts +0 -74
  2026. package/node_modules/hono/dist/types/utils/url.d.ts +0 -40
  2027. package/node_modules/hono/dist/types/validator/index.d.ts +0 -7
  2028. package/node_modules/hono/dist/types/validator/utils.d.ts +0 -29
  2029. package/node_modules/hono/dist/types/validator/validator.d.ts +0 -16
  2030. package/node_modules/hono/dist/types.js +0 -6
  2031. package/node_modules/hono/dist/utils/accept.js +0 -223
  2032. package/node_modules/hono/dist/utils/basic-auth.js +0 -23
  2033. package/node_modules/hono/dist/utils/body.js +0 -89
  2034. package/node_modules/hono/dist/utils/buffer.js +0 -78
  2035. package/node_modules/hono/dist/utils/color.js +0 -25
  2036. package/node_modules/hono/dist/utils/compress.js +0 -5
  2037. package/node_modules/hono/dist/utils/concurrent.js +0 -39
  2038. package/node_modules/hono/dist/utils/constants.js +0 -5
  2039. package/node_modules/hono/dist/utils/cookie.js +0 -174
  2040. package/node_modules/hono/dist/utils/crypto.js +0 -44
  2041. package/node_modules/hono/dist/utils/encode.js +0 -29
  2042. package/node_modules/hono/dist/utils/filepath.js +0 -35
  2043. package/node_modules/hono/dist/utils/handler.js +0 -13
  2044. package/node_modules/hono/dist/utils/headers.js +0 -0
  2045. package/node_modules/hono/dist/utils/html.js +0 -123
  2046. package/node_modules/hono/dist/utils/http-status.js +0 -0
  2047. package/node_modules/hono/dist/utils/ipaddr.js +0 -288
  2048. package/node_modules/hono/dist/utils/jwt/index.js +0 -6
  2049. package/node_modules/hono/dist/utils/jwt/jwa.js +0 -20
  2050. package/node_modules/hono/dist/utils/jwt/jws.js +0 -192
  2051. package/node_modules/hono/dist/utils/jwt/jwt.js +0 -207
  2052. package/node_modules/hono/dist/utils/jwt/types.js +0 -124
  2053. package/node_modules/hono/dist/utils/jwt/utf8.js +0 -7
  2054. package/node_modules/hono/dist/utils/mime.js +0 -82
  2055. package/node_modules/hono/dist/utils/stream.js +0 -81
  2056. package/node_modules/hono/dist/utils/types.js +0 -0
  2057. package/node_modules/hono/dist/utils/url.js +0 -221
  2058. package/node_modules/hono/dist/validator/index.js +0 -5
  2059. package/node_modules/hono/dist/validator/utils.js +0 -0
  2060. package/node_modules/hono/dist/validator/validator.js +0 -86
  2061. package/node_modules/hono/package.json +0 -706
  2062. package/node_modules/zod/LICENSE +0 -21
  2063. package/node_modules/zod/README.md +0 -191
  2064. package/node_modules/zod/index.cjs +0 -33
  2065. package/node_modules/zod/index.d.cts +0 -4
  2066. package/node_modules/zod/index.d.ts +0 -4
  2067. package/node_modules/zod/index.js +0 -4
  2068. package/node_modules/zod/locales/index.cjs +0 -17
  2069. package/node_modules/zod/locales/index.d.cts +0 -1
  2070. package/node_modules/zod/locales/index.d.ts +0 -1
  2071. package/node_modules/zod/locales/index.js +0 -1
  2072. package/node_modules/zod/locales/package.json +0 -7
  2073. package/node_modules/zod/mini/index.cjs +0 -32
  2074. package/node_modules/zod/mini/index.d.cts +0 -3
  2075. package/node_modules/zod/mini/index.d.ts +0 -3
  2076. package/node_modules/zod/mini/index.js +0 -3
  2077. package/node_modules/zod/mini/package.json +0 -7
  2078. package/node_modules/zod/package.json +0 -135
  2079. package/node_modules/zod/src/index.ts +0 -4
  2080. package/node_modules/zod/src/locales/index.ts +0 -1
  2081. package/node_modules/zod/src/mini/index.ts +0 -3
  2082. package/node_modules/zod/src/v3/ZodError.ts +0 -330
  2083. package/node_modules/zod/src/v3/benchmarks/datetime.ts +0 -58
  2084. package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +0 -80
  2085. package/node_modules/zod/src/v3/benchmarks/index.ts +0 -59
  2086. package/node_modules/zod/src/v3/benchmarks/ipv4.ts +0 -57
  2087. package/node_modules/zod/src/v3/benchmarks/object.ts +0 -69
  2088. package/node_modules/zod/src/v3/benchmarks/primitives.ts +0 -162
  2089. package/node_modules/zod/src/v3/benchmarks/realworld.ts +0 -63
  2090. package/node_modules/zod/src/v3/benchmarks/string.ts +0 -55
  2091. package/node_modules/zod/src/v3/benchmarks/union.ts +0 -80
  2092. package/node_modules/zod/src/v3/errors.ts +0 -13
  2093. package/node_modules/zod/src/v3/external.ts +0 -6
  2094. package/node_modules/zod/src/v3/helpers/enumUtil.ts +0 -17
  2095. package/node_modules/zod/src/v3/helpers/errorUtil.ts +0 -8
  2096. package/node_modules/zod/src/v3/helpers/parseUtil.ts +0 -176
  2097. package/node_modules/zod/src/v3/helpers/partialUtil.ts +0 -34
  2098. package/node_modules/zod/src/v3/helpers/typeAliases.ts +0 -2
  2099. package/node_modules/zod/src/v3/helpers/util.ts +0 -224
  2100. package/node_modules/zod/src/v3/index.ts +0 -4
  2101. package/node_modules/zod/src/v3/locales/en.ts +0 -124
  2102. package/node_modules/zod/src/v3/standard-schema.ts +0 -113
  2103. package/node_modules/zod/src/v3/tests/Mocker.ts +0 -54
  2104. package/node_modules/zod/src/v3/tests/all-errors.test.ts +0 -157
  2105. package/node_modules/zod/src/v3/tests/anyunknown.test.ts +0 -28
  2106. package/node_modules/zod/src/v3/tests/array.test.ts +0 -71
  2107. package/node_modules/zod/src/v3/tests/async-parsing.test.ts +0 -388
  2108. package/node_modules/zod/src/v3/tests/async-refinements.test.ts +0 -46
  2109. package/node_modules/zod/src/v3/tests/base.test.ts +0 -29
  2110. package/node_modules/zod/src/v3/tests/bigint.test.ts +0 -55
  2111. package/node_modules/zod/src/v3/tests/branded.test.ts +0 -53
  2112. package/node_modules/zod/src/v3/tests/catch.test.ts +0 -220
  2113. package/node_modules/zod/src/v3/tests/coerce.test.ts +0 -133
  2114. package/node_modules/zod/src/v3/tests/complex.test.ts +0 -70
  2115. package/node_modules/zod/src/v3/tests/custom.test.ts +0 -31
  2116. package/node_modules/zod/src/v3/tests/date.test.ts +0 -32
  2117. package/node_modules/zod/src/v3/tests/deepmasking.test.ts +0 -186
  2118. package/node_modules/zod/src/v3/tests/default.test.ts +0 -112
  2119. package/node_modules/zod/src/v3/tests/description.test.ts +0 -33
  2120. package/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +0 -315
  2121. package/node_modules/zod/src/v3/tests/enum.test.ts +0 -80
  2122. package/node_modules/zod/src/v3/tests/error.test.ts +0 -551
  2123. package/node_modules/zod/src/v3/tests/firstparty.test.ts +0 -87
  2124. package/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +0 -21
  2125. package/node_modules/zod/src/v3/tests/function.test.ts +0 -261
  2126. package/node_modules/zod/src/v3/tests/generics.test.ts +0 -48
  2127. package/node_modules/zod/src/v3/tests/instanceof.test.ts +0 -37
  2128. package/node_modules/zod/src/v3/tests/intersection.test.ts +0 -110
  2129. package/node_modules/zod/src/v3/tests/language-server.source.ts +0 -76
  2130. package/node_modules/zod/src/v3/tests/language-server.test.ts +0 -207
  2131. package/node_modules/zod/src/v3/tests/literal.test.ts +0 -36
  2132. package/node_modules/zod/src/v3/tests/map.test.ts +0 -110
  2133. package/node_modules/zod/src/v3/tests/masking.test.ts +0 -4
  2134. package/node_modules/zod/src/v3/tests/mocker.test.ts +0 -19
  2135. package/node_modules/zod/src/v3/tests/nan.test.ts +0 -24
  2136. package/node_modules/zod/src/v3/tests/nativeEnum.test.ts +0 -87
  2137. package/node_modules/zod/src/v3/tests/nullable.test.ts +0 -42
  2138. package/node_modules/zod/src/v3/tests/number.test.ts +0 -176
  2139. package/node_modules/zod/src/v3/tests/object-augmentation.test.ts +0 -29
  2140. package/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +0 -29
  2141. package/node_modules/zod/src/v3/tests/object.test.ts +0 -434
  2142. package/node_modules/zod/src/v3/tests/optional.test.ts +0 -42
  2143. package/node_modules/zod/src/v3/tests/parseUtil.test.ts +0 -23
  2144. package/node_modules/zod/src/v3/tests/parser.test.ts +0 -41
  2145. package/node_modules/zod/src/v3/tests/partials.test.ts +0 -243
  2146. package/node_modules/zod/src/v3/tests/pickomit.test.ts +0 -111
  2147. package/node_modules/zod/src/v3/tests/pipeline.test.ts +0 -29
  2148. package/node_modules/zod/src/v3/tests/preprocess.test.ts +0 -186
  2149. package/node_modules/zod/src/v3/tests/primitive.test.ts +0 -440
  2150. package/node_modules/zod/src/v3/tests/promise.test.ts +0 -90
  2151. package/node_modules/zod/src/v3/tests/readonly.test.ts +0 -194
  2152. package/node_modules/zod/src/v3/tests/record.test.ts +0 -171
  2153. package/node_modules/zod/src/v3/tests/recursive.test.ts +0 -197
  2154. package/node_modules/zod/src/v3/tests/refine.test.ts +0 -313
  2155. package/node_modules/zod/src/v3/tests/safeparse.test.ts +0 -27
  2156. package/node_modules/zod/src/v3/tests/set.test.ts +0 -142
  2157. package/node_modules/zod/src/v3/tests/standard-schema.test.ts +0 -83
  2158. package/node_modules/zod/src/v3/tests/string.test.ts +0 -916
  2159. package/node_modules/zod/src/v3/tests/transformer.test.ts +0 -233
  2160. package/node_modules/zod/src/v3/tests/tuple.test.ts +0 -90
  2161. package/node_modules/zod/src/v3/tests/unions.test.ts +0 -57
  2162. package/node_modules/zod/src/v3/tests/validations.test.ts +0 -133
  2163. package/node_modules/zod/src/v3/tests/void.test.ts +0 -15
  2164. package/node_modules/zod/src/v3/types.ts +0 -5138
  2165. package/node_modules/zod/src/v4/classic/checks.ts +0 -32
  2166. package/node_modules/zod/src/v4/classic/coerce.ts +0 -27
  2167. package/node_modules/zod/src/v4/classic/compat.ts +0 -70
  2168. package/node_modules/zod/src/v4/classic/errors.ts +0 -82
  2169. package/node_modules/zod/src/v4/classic/external.ts +0 -52
  2170. package/node_modules/zod/src/v4/classic/from-json-schema.ts +0 -659
  2171. package/node_modules/zod/src/v4/classic/index.ts +0 -5
  2172. package/node_modules/zod/src/v4/classic/iso.ts +0 -90
  2173. package/node_modules/zod/src/v4/classic/parse.ts +0 -82
  2174. package/node_modules/zod/src/v4/classic/schemas.ts +0 -2672
  2175. package/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +0 -26
  2176. package/node_modules/zod/src/v4/classic/tests/apply.test.ts +0 -59
  2177. package/node_modules/zod/src/v4/classic/tests/array.test.ts +0 -264
  2178. package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +0 -216
  2179. package/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +0 -381
  2180. package/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +0 -68
  2181. package/node_modules/zod/src/v4/classic/tests/base.test.ts +0 -7
  2182. package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +0 -54
  2183. package/node_modules/zod/src/v4/classic/tests/brand.test.ts +0 -106
  2184. package/node_modules/zod/src/v4/classic/tests/catch.test.ts +0 -326
  2185. package/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +0 -20
  2186. package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +0 -573
  2187. package/node_modules/zod/src/v4/classic/tests/codec.test.ts +0 -703
  2188. package/node_modules/zod/src/v4/classic/tests/coerce.test.ts +0 -160
  2189. package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +0 -374
  2190. package/node_modules/zod/src/v4/classic/tests/custom.test.ts +0 -40
  2191. package/node_modules/zod/src/v4/classic/tests/date.test.ts +0 -62
  2192. package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +0 -302
  2193. package/node_modules/zod/src/v4/classic/tests/default.test.ts +0 -409
  2194. package/node_modules/zod/src/v4/classic/tests/describe-meta-checks.test.ts +0 -27
  2195. package/node_modules/zod/src/v4/classic/tests/description.test.ts +0 -32
  2196. package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +0 -197
  2197. package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +0 -694
  2198. package/node_modules/zod/src/v4/classic/tests/enum.test.ts +0 -285
  2199. package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +0 -807
  2200. package/node_modules/zod/src/v4/classic/tests/error.test.ts +0 -711
  2201. package/node_modules/zod/src/v4/classic/tests/file.test.ts +0 -96
  2202. package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +0 -179
  2203. package/node_modules/zod/src/v4/classic/tests/fix-json-issue.test.ts +0 -26
  2204. package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +0 -895
  2205. package/node_modules/zod/src/v4/classic/tests/function.test.ts +0 -360
  2206. package/node_modules/zod/src/v4/classic/tests/generics.test.ts +0 -72
  2207. package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +0 -39
  2208. package/node_modules/zod/src/v4/classic/tests/hash.test.ts +0 -68
  2209. package/node_modules/zod/src/v4/classic/tests/index.test.ts +0 -939
  2210. package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +0 -60
  2211. package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +0 -198
  2212. package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +0 -46
  2213. package/node_modules/zod/src/v4/classic/tests/json.test.ts +0 -109
  2214. package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +0 -227
  2215. package/node_modules/zod/src/v4/classic/tests/literal.test.ts +0 -117
  2216. package/node_modules/zod/src/v4/classic/tests/locales_ka.test.ts +0 -29
  2217. package/node_modules/zod/src/v4/classic/tests/locales_ro.test.ts +0 -24
  2218. package/node_modules/zod/src/v4/classic/tests/map.test.ts +0 -330
  2219. package/node_modules/zod/src/v4/classic/tests/nan.test.ts +0 -21
  2220. package/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +0 -168
  2221. package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +0 -101
  2222. package/node_modules/zod/src/v4/classic/tests/nullable.test.ts +0 -22
  2223. package/node_modules/zod/src/v4/classic/tests/number.test.ts +0 -325
  2224. package/node_modules/zod/src/v4/classic/tests/object.test.ts +0 -717
  2225. package/node_modules/zod/src/v4/classic/tests/optional.test.ts +0 -333
  2226. package/node_modules/zod/src/v4/classic/tests/partial.test.ts +0 -450
  2227. package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +0 -211
  2228. package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +0 -101
  2229. package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +0 -74
  2230. package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +0 -26
  2231. package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +0 -351
  2232. package/node_modules/zod/src/v4/classic/tests/primitive.test.ts +0 -175
  2233. package/node_modules/zod/src/v4/classic/tests/promise.test.ts +0 -81
  2234. package/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +0 -23
  2235. package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +0 -252
  2236. package/node_modules/zod/src/v4/classic/tests/record.test.ts +0 -717
  2237. package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +0 -631
  2238. package/node_modules/zod/src/v4/classic/tests/refine.test.ts +0 -633
  2239. package/node_modules/zod/src/v4/classic/tests/registries.test.ts +0 -243
  2240. package/node_modules/zod/src/v4/classic/tests/set.test.ts +0 -181
  2241. package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +0 -134
  2242. package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +0 -125
  2243. package/node_modules/zod/src/v4/classic/tests/string.test.ts +0 -1224
  2244. package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +0 -106
  2245. package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +0 -771
  2246. package/node_modules/zod/src/v4/classic/tests/to-json-schema-methods.test.ts +0 -438
  2247. package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +0 -3125
  2248. package/node_modules/zod/src/v4/classic/tests/transform.test.ts +0 -378
  2249. package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +0 -496
  2250. package/node_modules/zod/src/v4/classic/tests/union.test.ts +0 -273
  2251. package/node_modules/zod/src/v4/classic/tests/url.test.ts +0 -13
  2252. package/node_modules/zod/src/v4/classic/tests/validations.test.ts +0 -283
  2253. package/node_modules/zod/src/v4/classic/tests/void.test.ts +0 -12
  2254. package/node_modules/zod/src/v4/core/api.ts +0 -1823
  2255. package/node_modules/zod/src/v4/core/checks.ts +0 -1293
  2256. package/node_modules/zod/src/v4/core/config.ts +0 -15
  2257. package/node_modules/zod/src/v4/core/core.ts +0 -153
  2258. package/node_modules/zod/src/v4/core/doc.ts +0 -44
  2259. package/node_modules/zod/src/v4/core/errors.ts +0 -455
  2260. package/node_modules/zod/src/v4/core/index.ts +0 -16
  2261. package/node_modules/zod/src/v4/core/json-schema-generator.ts +0 -126
  2262. package/node_modules/zod/src/v4/core/json-schema-processors.ts +0 -666
  2263. package/node_modules/zod/src/v4/core/json-schema.ts +0 -147
  2264. package/node_modules/zod/src/v4/core/parse.ts +0 -195
  2265. package/node_modules/zod/src/v4/core/regexes.ts +0 -190
  2266. package/node_modules/zod/src/v4/core/registries.ts +0 -105
  2267. package/node_modules/zod/src/v4/core/schemas.ts +0 -4730
  2268. package/node_modules/zod/src/v4/core/standard-schema.ts +0 -159
  2269. package/node_modules/zod/src/v4/core/tests/extend.test.ts +0 -59
  2270. package/node_modules/zod/src/v4/core/tests/index.test.ts +0 -46
  2271. package/node_modules/zod/src/v4/core/tests/locales/be.test.ts +0 -124
  2272. package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +0 -215
  2273. package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +0 -22
  2274. package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +0 -181
  2275. package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +0 -72
  2276. package/node_modules/zod/src/v4/core/tests/locales/he.test.ts +0 -379
  2277. package/node_modules/zod/src/v4/core/tests/locales/hr.test.ts +0 -163
  2278. package/node_modules/zod/src/v4/core/tests/locales/nl.test.ts +0 -46
  2279. package/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +0 -128
  2280. package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +0 -69
  2281. package/node_modules/zod/src/v4/core/tests/locales/uz.test.ts +0 -105
  2282. package/node_modules/zod/src/v4/core/tests/record-constructor.test.ts +0 -125
  2283. package/node_modules/zod/src/v4/core/tests/recursive-tuples.test.ts +0 -45
  2284. package/node_modules/zod/src/v4/core/to-json-schema.ts +0 -622
  2285. package/node_modules/zod/src/v4/core/util.ts +0 -983
  2286. package/node_modules/zod/src/v4/core/versions.ts +0 -5
  2287. package/node_modules/zod/src/v4/core/zsf.ts +0 -323
  2288. package/node_modules/zod/src/v4/index.ts +0 -4
  2289. package/node_modules/zod/src/v4/locales/ar.ts +0 -115
  2290. package/node_modules/zod/src/v4/locales/az.ts +0 -111
  2291. package/node_modules/zod/src/v4/locales/be.ts +0 -176
  2292. package/node_modules/zod/src/v4/locales/bg.ts +0 -128
  2293. package/node_modules/zod/src/v4/locales/ca.ts +0 -116
  2294. package/node_modules/zod/src/v4/locales/cs.ts +0 -118
  2295. package/node_modules/zod/src/v4/locales/da.ts +0 -123
  2296. package/node_modules/zod/src/v4/locales/de.ts +0 -116
  2297. package/node_modules/zod/src/v4/locales/el.ts +0 -121
  2298. package/node_modules/zod/src/v4/locales/en.ts +0 -123
  2299. package/node_modules/zod/src/v4/locales/eo.ts +0 -118
  2300. package/node_modules/zod/src/v4/locales/es.ts +0 -141
  2301. package/node_modules/zod/src/v4/locales/fa.ts +0 -126
  2302. package/node_modules/zod/src/v4/locales/fi.ts +0 -121
  2303. package/node_modules/zod/src/v4/locales/fr-CA.ts +0 -116
  2304. package/node_modules/zod/src/v4/locales/fr.ts +0 -132
  2305. package/node_modules/zod/src/v4/locales/he.ts +0 -246
  2306. package/node_modules/zod/src/v4/locales/hr.ts +0 -131
  2307. package/node_modules/zod/src/v4/locales/hu.ts +0 -117
  2308. package/node_modules/zod/src/v4/locales/hy.ts +0 -164
  2309. package/node_modules/zod/src/v4/locales/id.ts +0 -115
  2310. package/node_modules/zod/src/v4/locales/index.ts +0 -52
  2311. package/node_modules/zod/src/v4/locales/is.ts +0 -119
  2312. package/node_modules/zod/src/v4/locales/it.ts +0 -116
  2313. package/node_modules/zod/src/v4/locales/ja.ts +0 -114
  2314. package/node_modules/zod/src/v4/locales/ka.ts +0 -123
  2315. package/node_modules/zod/src/v4/locales/kh.ts +0 -7
  2316. package/node_modules/zod/src/v4/locales/km.ts +0 -119
  2317. package/node_modules/zod/src/v4/locales/ko.ts +0 -121
  2318. package/node_modules/zod/src/v4/locales/lt.ts +0 -239
  2319. package/node_modules/zod/src/v4/locales/mk.ts +0 -118
  2320. package/node_modules/zod/src/v4/locales/ms.ts +0 -115
  2321. package/node_modules/zod/src/v4/locales/nl.ts +0 -121
  2322. package/node_modules/zod/src/v4/locales/no.ts +0 -116
  2323. package/node_modules/zod/src/v4/locales/ota.ts +0 -117
  2324. package/node_modules/zod/src/v4/locales/pl.ts +0 -118
  2325. package/node_modules/zod/src/v4/locales/ps.ts +0 -126
  2326. package/node_modules/zod/src/v4/locales/pt.ts +0 -116
  2327. package/node_modules/zod/src/v4/locales/ro.ts +0 -129
  2328. package/node_modules/zod/src/v4/locales/ru.ts +0 -176
  2329. package/node_modules/zod/src/v4/locales/sl.ts +0 -118
  2330. package/node_modules/zod/src/v4/locales/sv.ts +0 -119
  2331. package/node_modules/zod/src/v4/locales/ta.ts +0 -118
  2332. package/node_modules/zod/src/v4/locales/th.ts +0 -119
  2333. package/node_modules/zod/src/v4/locales/tr.ts +0 -111
  2334. package/node_modules/zod/src/v4/locales/ua.ts +0 -7
  2335. package/node_modules/zod/src/v4/locales/uk.ts +0 -117
  2336. package/node_modules/zod/src/v4/locales/ur.ts +0 -119
  2337. package/node_modules/zod/src/v4/locales/uz.ts +0 -117
  2338. package/node_modules/zod/src/v4/locales/vi.ts +0 -117
  2339. package/node_modules/zod/src/v4/locales/yo.ts +0 -124
  2340. package/node_modules/zod/src/v4/locales/zh-CN.ts +0 -116
  2341. package/node_modules/zod/src/v4/locales/zh-TW.ts +0 -115
  2342. package/node_modules/zod/src/v4/mini/checks.ts +0 -32
  2343. package/node_modules/zod/src/v4/mini/coerce.ts +0 -27
  2344. package/node_modules/zod/src/v4/mini/external.ts +0 -41
  2345. package/node_modules/zod/src/v4/mini/index.ts +0 -3
  2346. package/node_modules/zod/src/v4/mini/iso.ts +0 -66
  2347. package/node_modules/zod/src/v4/mini/parse.ts +0 -14
  2348. package/node_modules/zod/src/v4/mini/schemas.ts +0 -1947
  2349. package/node_modules/zod/src/v4/mini/tests/apply.test.ts +0 -24
  2350. package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +0 -129
  2351. package/node_modules/zod/src/v4/mini/tests/brand.test.ts +0 -94
  2352. package/node_modules/zod/src/v4/mini/tests/checks.test.ts +0 -144
  2353. package/node_modules/zod/src/v4/mini/tests/codec.test.ts +0 -548
  2354. package/node_modules/zod/src/v4/mini/tests/computed.test.ts +0 -36
  2355. package/node_modules/zod/src/v4/mini/tests/error.test.ts +0 -22
  2356. package/node_modules/zod/src/v4/mini/tests/functions.test.ts +0 -5
  2357. package/node_modules/zod/src/v4/mini/tests/index.test.ts +0 -993
  2358. package/node_modules/zod/src/v4/mini/tests/number.test.ts +0 -95
  2359. package/node_modules/zod/src/v4/mini/tests/object.test.ts +0 -227
  2360. package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +0 -43
  2361. package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +0 -325
  2362. package/node_modules/zod/src/v4/mini/tests/standard-schema.test.ts +0 -50
  2363. package/node_modules/zod/src/v4/mini/tests/string.test.ts +0 -352
  2364. package/node_modules/zod/src/v4-mini/index.ts +0 -3
  2365. package/node_modules/zod/v3/ZodError.cjs +0 -138
  2366. package/node_modules/zod/v3/ZodError.d.cts +0 -164
  2367. package/node_modules/zod/v3/ZodError.d.ts +0 -164
  2368. package/node_modules/zod/v3/ZodError.js +0 -133
  2369. package/node_modules/zod/v3/errors.cjs +0 -17
  2370. package/node_modules/zod/v3/errors.d.cts +0 -5
  2371. package/node_modules/zod/v3/errors.d.ts +0 -5
  2372. package/node_modules/zod/v3/errors.js +0 -9
  2373. package/node_modules/zod/v3/external.cjs +0 -22
  2374. package/node_modules/zod/v3/external.d.cts +0 -6
  2375. package/node_modules/zod/v3/external.d.ts +0 -6
  2376. package/node_modules/zod/v3/external.js +0 -6
  2377. package/node_modules/zod/v3/helpers/enumUtil.cjs +0 -2
  2378. package/node_modules/zod/v3/helpers/enumUtil.d.cts +0 -8
  2379. package/node_modules/zod/v3/helpers/enumUtil.d.ts +0 -8
  2380. package/node_modules/zod/v3/helpers/enumUtil.js +0 -1
  2381. package/node_modules/zod/v3/helpers/errorUtil.cjs +0 -9
  2382. package/node_modules/zod/v3/helpers/errorUtil.d.cts +0 -9
  2383. package/node_modules/zod/v3/helpers/errorUtil.d.ts +0 -9
  2384. package/node_modules/zod/v3/helpers/errorUtil.js +0 -6
  2385. package/node_modules/zod/v3/helpers/parseUtil.cjs +0 -124
  2386. package/node_modules/zod/v3/helpers/parseUtil.d.cts +0 -78
  2387. package/node_modules/zod/v3/helpers/parseUtil.d.ts +0 -78
  2388. package/node_modules/zod/v3/helpers/parseUtil.js +0 -109
  2389. package/node_modules/zod/v3/helpers/partialUtil.cjs +0 -2
  2390. package/node_modules/zod/v3/helpers/partialUtil.d.cts +0 -8
  2391. package/node_modules/zod/v3/helpers/partialUtil.d.ts +0 -8
  2392. package/node_modules/zod/v3/helpers/partialUtil.js +0 -1
  2393. package/node_modules/zod/v3/helpers/typeAliases.cjs +0 -2
  2394. package/node_modules/zod/v3/helpers/typeAliases.d.cts +0 -2
  2395. package/node_modules/zod/v3/helpers/typeAliases.d.ts +0 -2
  2396. package/node_modules/zod/v3/helpers/typeAliases.js +0 -1
  2397. package/node_modules/zod/v3/helpers/util.cjs +0 -137
  2398. package/node_modules/zod/v3/helpers/util.d.cts +0 -85
  2399. package/node_modules/zod/v3/helpers/util.d.ts +0 -85
  2400. package/node_modules/zod/v3/helpers/util.js +0 -133
  2401. package/node_modules/zod/v3/index.cjs +0 -33
  2402. package/node_modules/zod/v3/index.d.cts +0 -4
  2403. package/node_modules/zod/v3/index.d.ts +0 -4
  2404. package/node_modules/zod/v3/index.js +0 -4
  2405. package/node_modules/zod/v3/locales/en.cjs +0 -112
  2406. package/node_modules/zod/v3/locales/en.d.cts +0 -3
  2407. package/node_modules/zod/v3/locales/en.d.ts +0 -3
  2408. package/node_modules/zod/v3/locales/en.js +0 -109
  2409. package/node_modules/zod/v3/package.json +0 -7
  2410. package/node_modules/zod/v3/standard-schema.cjs +0 -2
  2411. package/node_modules/zod/v3/standard-schema.d.cts +0 -102
  2412. package/node_modules/zod/v3/standard-schema.d.ts +0 -102
  2413. package/node_modules/zod/v3/standard-schema.js +0 -1
  2414. package/node_modules/zod/v3/types.cjs +0 -3777
  2415. package/node_modules/zod/v3/types.d.cts +0 -1034
  2416. package/node_modules/zod/v3/types.d.ts +0 -1034
  2417. package/node_modules/zod/v3/types.js +0 -3695
  2418. package/node_modules/zod/v4/classic/checks.cjs +0 -33
  2419. package/node_modules/zod/v4/classic/checks.d.cts +0 -1
  2420. package/node_modules/zod/v4/classic/checks.d.ts +0 -1
  2421. package/node_modules/zod/v4/classic/checks.js +0 -1
  2422. package/node_modules/zod/v4/classic/coerce.cjs +0 -47
  2423. package/node_modules/zod/v4/classic/coerce.d.cts +0 -17
  2424. package/node_modules/zod/v4/classic/coerce.d.ts +0 -17
  2425. package/node_modules/zod/v4/classic/coerce.js +0 -17
  2426. package/node_modules/zod/v4/classic/compat.cjs +0 -61
  2427. package/node_modules/zod/v4/classic/compat.d.cts +0 -50
  2428. package/node_modules/zod/v4/classic/compat.d.ts +0 -50
  2429. package/node_modules/zod/v4/classic/compat.js +0 -31
  2430. package/node_modules/zod/v4/classic/errors.cjs +0 -74
  2431. package/node_modules/zod/v4/classic/errors.d.cts +0 -30
  2432. package/node_modules/zod/v4/classic/errors.d.ts +0 -30
  2433. package/node_modules/zod/v4/classic/errors.js +0 -48
  2434. package/node_modules/zod/v4/classic/external.cjs +0 -73
  2435. package/node_modules/zod/v4/classic/external.d.cts +0 -16
  2436. package/node_modules/zod/v4/classic/external.d.ts +0 -16
  2437. package/node_modules/zod/v4/classic/external.js +0 -20
  2438. package/node_modules/zod/v4/classic/from-json-schema.cjs +0 -625
  2439. package/node_modules/zod/v4/classic/from-json-schema.d.cts +0 -12
  2440. package/node_modules/zod/v4/classic/from-json-schema.d.ts +0 -12
  2441. package/node_modules/zod/v4/classic/from-json-schema.js +0 -599
  2442. package/node_modules/zod/v4/classic/index.cjs +0 -33
  2443. package/node_modules/zod/v4/classic/index.d.cts +0 -4
  2444. package/node_modules/zod/v4/classic/index.d.ts +0 -4
  2445. package/node_modules/zod/v4/classic/index.js +0 -4
  2446. package/node_modules/zod/v4/classic/iso.cjs +0 -60
  2447. package/node_modules/zod/v4/classic/iso.d.cts +0 -22
  2448. package/node_modules/zod/v4/classic/iso.d.ts +0 -22
  2449. package/node_modules/zod/v4/classic/iso.js +0 -30
  2450. package/node_modules/zod/v4/classic/package.json +0 -7
  2451. package/node_modules/zod/v4/classic/parse.cjs +0 -41
  2452. package/node_modules/zod/v4/classic/parse.d.cts +0 -31
  2453. package/node_modules/zod/v4/classic/parse.d.ts +0 -31
  2454. package/node_modules/zod/v4/classic/parse.js +0 -15
  2455. package/node_modules/zod/v4/classic/schemas.cjs +0 -1511
  2456. package/node_modules/zod/v4/classic/schemas.d.cts +0 -767
  2457. package/node_modules/zod/v4/classic/schemas.d.ts +0 -767
  2458. package/node_modules/zod/v4/classic/schemas.js +0 -1395
  2459. package/node_modules/zod/v4/core/api.cjs +0 -1227
  2460. package/node_modules/zod/v4/core/api.d.cts +0 -325
  2461. package/node_modules/zod/v4/core/api.d.ts +0 -325
  2462. package/node_modules/zod/v4/core/api.js +0 -1087
  2463. package/node_modules/zod/v4/core/checks.cjs +0 -601
  2464. package/node_modules/zod/v4/core/checks.d.cts +0 -278
  2465. package/node_modules/zod/v4/core/checks.d.ts +0 -278
  2466. package/node_modules/zod/v4/core/checks.js +0 -575
  2467. package/node_modules/zod/v4/core/core.cjs +0 -85
  2468. package/node_modules/zod/v4/core/core.d.cts +0 -70
  2469. package/node_modules/zod/v4/core/core.d.ts +0 -70
  2470. package/node_modules/zod/v4/core/core.js +0 -78
  2471. package/node_modules/zod/v4/core/doc.cjs +0 -39
  2472. package/node_modules/zod/v4/core/doc.d.cts +0 -14
  2473. package/node_modules/zod/v4/core/doc.d.ts +0 -14
  2474. package/node_modules/zod/v4/core/doc.js +0 -35
  2475. package/node_modules/zod/v4/core/errors.cjs +0 -216
  2476. package/node_modules/zod/v4/core/errors.d.cts +0 -221
  2477. package/node_modules/zod/v4/core/errors.d.ts +0 -221
  2478. package/node_modules/zod/v4/core/errors.js +0 -185
  2479. package/node_modules/zod/v4/core/index.cjs +0 -47
  2480. package/node_modules/zod/v4/core/index.d.cts +0 -16
  2481. package/node_modules/zod/v4/core/index.d.ts +0 -16
  2482. package/node_modules/zod/v4/core/index.js +0 -16
  2483. package/node_modules/zod/v4/core/json-schema-generator.cjs +0 -99
  2484. package/node_modules/zod/v4/core/json-schema-generator.d.cts +0 -65
  2485. package/node_modules/zod/v4/core/json-schema-generator.d.ts +0 -65
  2486. package/node_modules/zod/v4/core/json-schema-generator.js +0 -95
  2487. package/node_modules/zod/v4/core/json-schema-processors.cjs +0 -644
  2488. package/node_modules/zod/v4/core/json-schema-processors.d.cts +0 -49
  2489. package/node_modules/zod/v4/core/json-schema-processors.d.ts +0 -49
  2490. package/node_modules/zod/v4/core/json-schema-processors.js +0 -601
  2491. package/node_modules/zod/v4/core/json-schema.cjs +0 -2
  2492. package/node_modules/zod/v4/core/json-schema.d.cts +0 -88
  2493. package/node_modules/zod/v4/core/json-schema.d.ts +0 -88
  2494. package/node_modules/zod/v4/core/json-schema.js +0 -1
  2495. package/node_modules/zod/v4/core/package.json +0 -7
  2496. package/node_modules/zod/v4/core/parse.cjs +0 -131
  2497. package/node_modules/zod/v4/core/parse.d.cts +0 -49
  2498. package/node_modules/zod/v4/core/parse.d.ts +0 -49
  2499. package/node_modules/zod/v4/core/parse.js +0 -93
  2500. package/node_modules/zod/v4/core/regexes.cjs +0 -172
  2501. package/node_modules/zod/v4/core/regexes.d.cts +0 -85
  2502. package/node_modules/zod/v4/core/regexes.d.ts +0 -85
  2503. package/node_modules/zod/v4/core/regexes.js +0 -139
  2504. package/node_modules/zod/v4/core/registries.cjs +0 -56
  2505. package/node_modules/zod/v4/core/registries.d.cts +0 -35
  2506. package/node_modules/zod/v4/core/registries.d.ts +0 -35
  2507. package/node_modules/zod/v4/core/registries.js +0 -51
  2508. package/node_modules/zod/v4/core/schemas.cjs +0 -2270
  2509. package/node_modules/zod/v4/core/schemas.d.cts +0 -1184
  2510. package/node_modules/zod/v4/core/schemas.d.ts +0 -1184
  2511. package/node_modules/zod/v4/core/schemas.js +0 -2239
  2512. package/node_modules/zod/v4/core/standard-schema.cjs +0 -2
  2513. package/node_modules/zod/v4/core/standard-schema.d.cts +0 -126
  2514. package/node_modules/zod/v4/core/standard-schema.d.ts +0 -126
  2515. package/node_modules/zod/v4/core/standard-schema.js +0 -1
  2516. package/node_modules/zod/v4/core/to-json-schema.cjs +0 -457
  2517. package/node_modules/zod/v4/core/to-json-schema.d.cts +0 -114
  2518. package/node_modules/zod/v4/core/to-json-schema.d.ts +0 -114
  2519. package/node_modules/zod/v4/core/to-json-schema.js +0 -448
  2520. package/node_modules/zod/v4/core/util.cjs +0 -734
  2521. package/node_modules/zod/v4/core/util.d.cts +0 -200
  2522. package/node_modules/zod/v4/core/util.d.ts +0 -200
  2523. package/node_modules/zod/v4/core/util.js +0 -674
  2524. package/node_modules/zod/v4/core/versions.cjs +0 -8
  2525. package/node_modules/zod/v4/core/versions.d.cts +0 -5
  2526. package/node_modules/zod/v4/core/versions.d.ts +0 -5
  2527. package/node_modules/zod/v4/core/versions.js +0 -5
  2528. package/node_modules/zod/v4/index.cjs +0 -22
  2529. package/node_modules/zod/v4/index.d.cts +0 -3
  2530. package/node_modules/zod/v4/index.d.ts +0 -3
  2531. package/node_modules/zod/v4/index.js +0 -3
  2532. package/node_modules/zod/v4/locales/ar.cjs +0 -133
  2533. package/node_modules/zod/v4/locales/ar.d.cts +0 -5
  2534. package/node_modules/zod/v4/locales/ar.d.ts +0 -4
  2535. package/node_modules/zod/v4/locales/ar.js +0 -106
  2536. package/node_modules/zod/v4/locales/az.cjs +0 -132
  2537. package/node_modules/zod/v4/locales/az.d.cts +0 -5
  2538. package/node_modules/zod/v4/locales/az.d.ts +0 -4
  2539. package/node_modules/zod/v4/locales/az.js +0 -105
  2540. package/node_modules/zod/v4/locales/be.cjs +0 -183
  2541. package/node_modules/zod/v4/locales/be.d.cts +0 -5
  2542. package/node_modules/zod/v4/locales/be.d.ts +0 -4
  2543. package/node_modules/zod/v4/locales/be.js +0 -156
  2544. package/node_modules/zod/v4/locales/bg.cjs +0 -147
  2545. package/node_modules/zod/v4/locales/bg.d.cts +0 -5
  2546. package/node_modules/zod/v4/locales/bg.d.ts +0 -4
  2547. package/node_modules/zod/v4/locales/bg.js +0 -120
  2548. package/node_modules/zod/v4/locales/ca.cjs +0 -134
  2549. package/node_modules/zod/v4/locales/ca.d.cts +0 -5
  2550. package/node_modules/zod/v4/locales/ca.d.ts +0 -4
  2551. package/node_modules/zod/v4/locales/ca.js +0 -107
  2552. package/node_modules/zod/v4/locales/cs.cjs +0 -138
  2553. package/node_modules/zod/v4/locales/cs.d.cts +0 -5
  2554. package/node_modules/zod/v4/locales/cs.d.ts +0 -4
  2555. package/node_modules/zod/v4/locales/cs.js +0 -111
  2556. package/node_modules/zod/v4/locales/da.cjs +0 -142
  2557. package/node_modules/zod/v4/locales/da.d.cts +0 -5
  2558. package/node_modules/zod/v4/locales/da.d.ts +0 -4
  2559. package/node_modules/zod/v4/locales/da.js +0 -115
  2560. package/node_modules/zod/v4/locales/de.cjs +0 -135
  2561. package/node_modules/zod/v4/locales/de.d.cts +0 -5
  2562. package/node_modules/zod/v4/locales/de.d.ts +0 -4
  2563. package/node_modules/zod/v4/locales/de.js +0 -108
  2564. package/node_modules/zod/v4/locales/el.cjs +0 -136
  2565. package/node_modules/zod/v4/locales/el.d.cts +0 -5
  2566. package/node_modules/zod/v4/locales/el.d.ts +0 -4
  2567. package/node_modules/zod/v4/locales/el.js +0 -109
  2568. package/node_modules/zod/v4/locales/en.cjs +0 -140
  2569. package/node_modules/zod/v4/locales/en.d.cts +0 -5
  2570. package/node_modules/zod/v4/locales/en.d.ts +0 -4
  2571. package/node_modules/zod/v4/locales/en.js +0 -113
  2572. package/node_modules/zod/v4/locales/eo.cjs +0 -136
  2573. package/node_modules/zod/v4/locales/eo.d.cts +0 -5
  2574. package/node_modules/zod/v4/locales/eo.d.ts +0 -4
  2575. package/node_modules/zod/v4/locales/eo.js +0 -109
  2576. package/node_modules/zod/v4/locales/es.cjs +0 -159
  2577. package/node_modules/zod/v4/locales/es.d.cts +0 -5
  2578. package/node_modules/zod/v4/locales/es.d.ts +0 -4
  2579. package/node_modules/zod/v4/locales/es.js +0 -132
  2580. package/node_modules/zod/v4/locales/fa.cjs +0 -141
  2581. package/node_modules/zod/v4/locales/fa.d.cts +0 -5
  2582. package/node_modules/zod/v4/locales/fa.d.ts +0 -4
  2583. package/node_modules/zod/v4/locales/fa.js +0 -114
  2584. package/node_modules/zod/v4/locales/fi.cjs +0 -139
  2585. package/node_modules/zod/v4/locales/fi.d.cts +0 -5
  2586. package/node_modules/zod/v4/locales/fi.d.ts +0 -4
  2587. package/node_modules/zod/v4/locales/fi.js +0 -112
  2588. package/node_modules/zod/v4/locales/fr-CA.cjs +0 -134
  2589. package/node_modules/zod/v4/locales/fr-CA.d.cts +0 -5
  2590. package/node_modules/zod/v4/locales/fr-CA.d.ts +0 -4
  2591. package/node_modules/zod/v4/locales/fr-CA.js +0 -107
  2592. package/node_modules/zod/v4/locales/fr.cjs +0 -152
  2593. package/node_modules/zod/v4/locales/fr.d.cts +0 -5
  2594. package/node_modules/zod/v4/locales/fr.d.ts +0 -4
  2595. package/node_modules/zod/v4/locales/fr.js +0 -125
  2596. package/node_modules/zod/v4/locales/he.cjs +0 -241
  2597. package/node_modules/zod/v4/locales/he.d.cts +0 -5
  2598. package/node_modules/zod/v4/locales/he.d.ts +0 -4
  2599. package/node_modules/zod/v4/locales/he.js +0 -214
  2600. package/node_modules/zod/v4/locales/hr.cjs +0 -149
  2601. package/node_modules/zod/v4/locales/hr.d.cts +0 -5
  2602. package/node_modules/zod/v4/locales/hr.d.ts +0 -4
  2603. package/node_modules/zod/v4/locales/hr.js +0 -122
  2604. package/node_modules/zod/v4/locales/hu.cjs +0 -135
  2605. package/node_modules/zod/v4/locales/hu.d.cts +0 -5
  2606. package/node_modules/zod/v4/locales/hu.d.ts +0 -4
  2607. package/node_modules/zod/v4/locales/hu.js +0 -108
  2608. package/node_modules/zod/v4/locales/hy.cjs +0 -174
  2609. package/node_modules/zod/v4/locales/hy.d.cts +0 -5
  2610. package/node_modules/zod/v4/locales/hy.d.ts +0 -4
  2611. package/node_modules/zod/v4/locales/hy.js +0 -147
  2612. package/node_modules/zod/v4/locales/id.cjs +0 -133
  2613. package/node_modules/zod/v4/locales/id.d.cts +0 -5
  2614. package/node_modules/zod/v4/locales/id.d.ts +0 -4
  2615. package/node_modules/zod/v4/locales/id.js +0 -106
  2616. package/node_modules/zod/v4/locales/index.cjs +0 -111
  2617. package/node_modules/zod/v4/locales/index.d.cts +0 -52
  2618. package/node_modules/zod/v4/locales/index.d.ts +0 -52
  2619. package/node_modules/zod/v4/locales/index.js +0 -52
  2620. package/node_modules/zod/v4/locales/is.cjs +0 -136
  2621. package/node_modules/zod/v4/locales/is.d.cts +0 -5
  2622. package/node_modules/zod/v4/locales/is.d.ts +0 -4
  2623. package/node_modules/zod/v4/locales/is.js +0 -109
  2624. package/node_modules/zod/v4/locales/it.cjs +0 -135
  2625. package/node_modules/zod/v4/locales/it.d.cts +0 -5
  2626. package/node_modules/zod/v4/locales/it.d.ts +0 -4
  2627. package/node_modules/zod/v4/locales/it.js +0 -108
  2628. package/node_modules/zod/v4/locales/ja.cjs +0 -134
  2629. package/node_modules/zod/v4/locales/ja.d.cts +0 -5
  2630. package/node_modules/zod/v4/locales/ja.d.ts +0 -4
  2631. package/node_modules/zod/v4/locales/ja.js +0 -107
  2632. package/node_modules/zod/v4/locales/ka.cjs +0 -139
  2633. package/node_modules/zod/v4/locales/ka.d.cts +0 -5
  2634. package/node_modules/zod/v4/locales/ka.d.ts +0 -4
  2635. package/node_modules/zod/v4/locales/ka.js +0 -112
  2636. package/node_modules/zod/v4/locales/kh.cjs +0 -12
  2637. package/node_modules/zod/v4/locales/kh.d.cts +0 -5
  2638. package/node_modules/zod/v4/locales/kh.d.ts +0 -5
  2639. package/node_modules/zod/v4/locales/kh.js +0 -5
  2640. package/node_modules/zod/v4/locales/km.cjs +0 -137
  2641. package/node_modules/zod/v4/locales/km.d.cts +0 -5
  2642. package/node_modules/zod/v4/locales/km.d.ts +0 -4
  2643. package/node_modules/zod/v4/locales/km.js +0 -110
  2644. package/node_modules/zod/v4/locales/ko.cjs +0 -138
  2645. package/node_modules/zod/v4/locales/ko.d.cts +0 -5
  2646. package/node_modules/zod/v4/locales/ko.d.ts +0 -4
  2647. package/node_modules/zod/v4/locales/ko.js +0 -111
  2648. package/node_modules/zod/v4/locales/lt.cjs +0 -230
  2649. package/node_modules/zod/v4/locales/lt.d.cts +0 -5
  2650. package/node_modules/zod/v4/locales/lt.d.ts +0 -4
  2651. package/node_modules/zod/v4/locales/lt.js +0 -203
  2652. package/node_modules/zod/v4/locales/mk.cjs +0 -136
  2653. package/node_modules/zod/v4/locales/mk.d.cts +0 -5
  2654. package/node_modules/zod/v4/locales/mk.d.ts +0 -4
  2655. package/node_modules/zod/v4/locales/mk.js +0 -109
  2656. package/node_modules/zod/v4/locales/ms.cjs +0 -134
  2657. package/node_modules/zod/v4/locales/ms.d.cts +0 -5
  2658. package/node_modules/zod/v4/locales/ms.d.ts +0 -4
  2659. package/node_modules/zod/v4/locales/ms.js +0 -107
  2660. package/node_modules/zod/v4/locales/nl.cjs +0 -137
  2661. package/node_modules/zod/v4/locales/nl.d.cts +0 -5
  2662. package/node_modules/zod/v4/locales/nl.d.ts +0 -4
  2663. package/node_modules/zod/v4/locales/nl.js +0 -110
  2664. package/node_modules/zod/v4/locales/no.cjs +0 -135
  2665. package/node_modules/zod/v4/locales/no.d.cts +0 -5
  2666. package/node_modules/zod/v4/locales/no.d.ts +0 -4
  2667. package/node_modules/zod/v4/locales/no.js +0 -108
  2668. package/node_modules/zod/v4/locales/ota.cjs +0 -136
  2669. package/node_modules/zod/v4/locales/ota.d.cts +0 -5
  2670. package/node_modules/zod/v4/locales/ota.d.ts +0 -4
  2671. package/node_modules/zod/v4/locales/ota.js +0 -109
  2672. package/node_modules/zod/v4/locales/package.json +0 -7
  2673. package/node_modules/zod/v4/locales/pl.cjs +0 -136
  2674. package/node_modules/zod/v4/locales/pl.d.cts +0 -5
  2675. package/node_modules/zod/v4/locales/pl.d.ts +0 -4
  2676. package/node_modules/zod/v4/locales/pl.js +0 -109
  2677. package/node_modules/zod/v4/locales/ps.cjs +0 -141
  2678. package/node_modules/zod/v4/locales/ps.d.cts +0 -5
  2679. package/node_modules/zod/v4/locales/ps.d.ts +0 -4
  2680. package/node_modules/zod/v4/locales/ps.js +0 -114
  2681. package/node_modules/zod/v4/locales/pt.cjs +0 -135
  2682. package/node_modules/zod/v4/locales/pt.d.cts +0 -5
  2683. package/node_modules/zod/v4/locales/pt.d.ts +0 -4
  2684. package/node_modules/zod/v4/locales/pt.js +0 -108
  2685. package/node_modules/zod/v4/locales/ro.cjs +0 -146
  2686. package/node_modules/zod/v4/locales/ro.d.cts +0 -5
  2687. package/node_modules/zod/v4/locales/ro.d.ts +0 -4
  2688. package/node_modules/zod/v4/locales/ro.js +0 -119
  2689. package/node_modules/zod/v4/locales/ru.cjs +0 -183
  2690. package/node_modules/zod/v4/locales/ru.d.cts +0 -5
  2691. package/node_modules/zod/v4/locales/ru.d.ts +0 -4
  2692. package/node_modules/zod/v4/locales/ru.js +0 -156
  2693. package/node_modules/zod/v4/locales/sl.cjs +0 -136
  2694. package/node_modules/zod/v4/locales/sl.d.cts +0 -5
  2695. package/node_modules/zod/v4/locales/sl.d.ts +0 -4
  2696. package/node_modules/zod/v4/locales/sl.js +0 -109
  2697. package/node_modules/zod/v4/locales/sv.cjs +0 -137
  2698. package/node_modules/zod/v4/locales/sv.d.cts +0 -5
  2699. package/node_modules/zod/v4/locales/sv.d.ts +0 -4
  2700. package/node_modules/zod/v4/locales/sv.js +0 -110
  2701. package/node_modules/zod/v4/locales/ta.cjs +0 -137
  2702. package/node_modules/zod/v4/locales/ta.d.cts +0 -5
  2703. package/node_modules/zod/v4/locales/ta.d.ts +0 -4
  2704. package/node_modules/zod/v4/locales/ta.js +0 -110
  2705. package/node_modules/zod/v4/locales/th.cjs +0 -137
  2706. package/node_modules/zod/v4/locales/th.d.cts +0 -5
  2707. package/node_modules/zod/v4/locales/th.d.ts +0 -4
  2708. package/node_modules/zod/v4/locales/th.js +0 -110
  2709. package/node_modules/zod/v4/locales/tr.cjs +0 -132
  2710. package/node_modules/zod/v4/locales/tr.d.cts +0 -5
  2711. package/node_modules/zod/v4/locales/tr.d.ts +0 -4
  2712. package/node_modules/zod/v4/locales/tr.js +0 -105
  2713. package/node_modules/zod/v4/locales/ua.cjs +0 -12
  2714. package/node_modules/zod/v4/locales/ua.d.cts +0 -5
  2715. package/node_modules/zod/v4/locales/ua.d.ts +0 -5
  2716. package/node_modules/zod/v4/locales/ua.js +0 -5
  2717. package/node_modules/zod/v4/locales/uk.cjs +0 -135
  2718. package/node_modules/zod/v4/locales/uk.d.cts +0 -5
  2719. package/node_modules/zod/v4/locales/uk.d.ts +0 -4
  2720. package/node_modules/zod/v4/locales/uk.js +0 -108
  2721. package/node_modules/zod/v4/locales/ur.cjs +0 -137
  2722. package/node_modules/zod/v4/locales/ur.d.cts +0 -5
  2723. package/node_modules/zod/v4/locales/ur.d.ts +0 -4
  2724. package/node_modules/zod/v4/locales/ur.js +0 -110
  2725. package/node_modules/zod/v4/locales/uz.cjs +0 -137
  2726. package/node_modules/zod/v4/locales/uz.d.cts +0 -5
  2727. package/node_modules/zod/v4/locales/uz.d.ts +0 -4
  2728. package/node_modules/zod/v4/locales/uz.js +0 -110
  2729. package/node_modules/zod/v4/locales/vi.cjs +0 -135
  2730. package/node_modules/zod/v4/locales/vi.d.cts +0 -5
  2731. package/node_modules/zod/v4/locales/vi.d.ts +0 -4
  2732. package/node_modules/zod/v4/locales/vi.js +0 -108
  2733. package/node_modules/zod/v4/locales/yo.cjs +0 -134
  2734. package/node_modules/zod/v4/locales/yo.d.cts +0 -5
  2735. package/node_modules/zod/v4/locales/yo.d.ts +0 -4
  2736. package/node_modules/zod/v4/locales/yo.js +0 -107
  2737. package/node_modules/zod/v4/locales/zh-CN.cjs +0 -136
  2738. package/node_modules/zod/v4/locales/zh-CN.d.cts +0 -5
  2739. package/node_modules/zod/v4/locales/zh-CN.d.ts +0 -4
  2740. package/node_modules/zod/v4/locales/zh-CN.js +0 -109
  2741. package/node_modules/zod/v4/locales/zh-TW.cjs +0 -134
  2742. package/node_modules/zod/v4/locales/zh-TW.d.cts +0 -5
  2743. package/node_modules/zod/v4/locales/zh-TW.d.ts +0 -4
  2744. package/node_modules/zod/v4/locales/zh-TW.js +0 -107
  2745. package/node_modules/zod/v4/mini/checks.cjs +0 -34
  2746. package/node_modules/zod/v4/mini/checks.d.cts +0 -1
  2747. package/node_modules/zod/v4/mini/checks.d.ts +0 -1
  2748. package/node_modules/zod/v4/mini/checks.js +0 -1
  2749. package/node_modules/zod/v4/mini/coerce.cjs +0 -52
  2750. package/node_modules/zod/v4/mini/coerce.d.cts +0 -7
  2751. package/node_modules/zod/v4/mini/coerce.d.ts +0 -7
  2752. package/node_modules/zod/v4/mini/coerce.js +0 -22
  2753. package/node_modules/zod/v4/mini/external.cjs +0 -63
  2754. package/node_modules/zod/v4/mini/external.d.cts +0 -13
  2755. package/node_modules/zod/v4/mini/external.d.ts +0 -13
  2756. package/node_modules/zod/v4/mini/external.js +0 -14
  2757. package/node_modules/zod/v4/mini/index.cjs +0 -32
  2758. package/node_modules/zod/v4/mini/index.d.cts +0 -3
  2759. package/node_modules/zod/v4/mini/index.d.ts +0 -3
  2760. package/node_modules/zod/v4/mini/index.js +0 -3
  2761. package/node_modules/zod/v4/mini/iso.cjs +0 -64
  2762. package/node_modules/zod/v4/mini/iso.d.cts +0 -22
  2763. package/node_modules/zod/v4/mini/iso.d.ts +0 -22
  2764. package/node_modules/zod/v4/mini/iso.js +0 -34
  2765. package/node_modules/zod/v4/mini/package.json +0 -7
  2766. package/node_modules/zod/v4/mini/parse.cjs +0 -16
  2767. package/node_modules/zod/v4/mini/parse.d.cts +0 -1
  2768. package/node_modules/zod/v4/mini/parse.d.ts +0 -1
  2769. package/node_modules/zod/v4/mini/parse.js +0 -1
  2770. package/node_modules/zod/v4/mini/schemas.cjs +0 -1083
  2771. package/node_modules/zod/v4/mini/schemas.d.cts +0 -445
  2772. package/node_modules/zod/v4/mini/schemas.d.ts +0 -445
  2773. package/node_modules/zod/v4/mini/schemas.js +0 -961
  2774. package/node_modules/zod/v4/package.json +0 -7
  2775. package/node_modules/zod/v4-mini/index.cjs +0 -32
  2776. package/node_modules/zod/v4-mini/index.d.cts +0 -3
  2777. package/node_modules/zod/v4-mini/index.d.ts +0 -3
  2778. package/node_modules/zod/v4-mini/index.js +0 -3
  2779. package/node_modules/zod/v4-mini/package.json +0 -7
  2780. /package/{dist/src → assets}/demo/first-run-demo.md +0 -0
  2781. /package/{dist/src → assets}/demo/first-run-demo.seed.json +0 -0
  2782. /package/{dist/src → assets}/fix-prompt/prompts/fix-prompt-v1.md +0 -0
@@ -0,0 +1,4398 @@
1
+ import { failureInjectionRuleSchema, openTwinDatabase, createFailureInjectionStore, defineTwin, twinBuildInfo, failureInjectionMiddleware, createApp, FAILURE_INJECTION_OVERRIDE_KEY, recordedRequestHeaders, UnknownToolError } from './chunk-LZIPGCQJ.js';
2
+ import './chunk-VBATFCWR.js';
3
+ import './chunk-SG6ZTIMT.js';
4
+ import { z, ZodError } from 'zod';
5
+ import { createHash, randomUUID, randomBytes } from 'node:crypto';
6
+
7
+ var BASE62 = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
8
+ var ID_PREFIXES = {
9
+ customer: "cus_",
10
+ payment_method: "pm_",
11
+ payment_intent: "pi_",
12
+ charge: "ch_",
13
+ refund: "re_",
14
+ product: "prod_",
15
+ price: "price_",
16
+ subscription: "sub_",
17
+ subscription_item: "si_",
18
+ setup_intent: "seti_",
19
+ checkout_session: "cs_test_",
20
+ webhook_endpoint: "we_",
21
+ event: "evt_",
22
+ shared_payment_issued: "spt_",
23
+ shared_payment_granted: "spt_",
24
+ profile: "profile_",
25
+ balance_transaction: "txn_",
26
+ // API keys are minted via api-keys.ts but the prefix lives here for parity.
27
+ api_key: "sk_test_pome_",
28
+ api_key_restricted: "rk_test_pome_"
29
+ };
30
+ function randomBase62(count) {
31
+ const buf = randomBytes(count * 2);
32
+ let out = "";
33
+ let i = 0;
34
+ while (out.length < count && i < buf.length) {
35
+ const byte = buf[i++];
36
+ if (byte < 248) {
37
+ out += BASE62[byte % 62];
38
+ }
39
+ }
40
+ if (out.length < count) {
41
+ out += randomBase62(count - out.length);
42
+ }
43
+ return out;
44
+ }
45
+ function newId(kind) {
46
+ return `${ID_PREFIXES[kind]}${randomBase62(24)}`;
47
+ }
48
+ function newClientSecret(piId) {
49
+ return `${piId}_secret_${randomBase62(24)}`;
50
+ }
51
+ function newApiKey() {
52
+ return newId("api_key");
53
+ }
54
+ function nowIso() {
55
+ return (/* @__PURE__ */ new Date()).toISOString();
56
+ }
57
+ function nowUnix() {
58
+ return Math.floor(Date.now() / 1e3);
59
+ }
60
+ function requestId() {
61
+ return `req_${randomUUID()}`;
62
+ }
63
+
64
+ // ../packages/twin-stripe/dist/src/api-keys.js
65
+ function mintApiKey(db, input) {
66
+ const key = input.key ?? newApiKey();
67
+ const account_id = input.account_id ?? `acct_${input.sid}`;
68
+ const created_at = nowIso();
69
+ db.prepare(`INSERT INTO api_keys (key, sid, account_id, created_at, revoked_at)
70
+ VALUES (?, ?, ?, ?, NULL)
71
+ ON CONFLICT(key) DO UPDATE SET
72
+ sid = excluded.sid,
73
+ account_id = excluded.account_id,
74
+ revoked_at = NULL`).run(key, input.sid, account_id, created_at);
75
+ return { key, sid: input.sid, account_id, created_at, revoked_at: null };
76
+ }
77
+ function revokeApiKey(db, key) {
78
+ db.prepare(`UPDATE api_keys SET revoked_at = ? WHERE key = ?`).run(nowIso(), key);
79
+ }
80
+ function resolveSidFromKey(db, token) {
81
+ const row = db.prepare(`SELECT key, sid, account_id, created_at, revoked_at
82
+ FROM api_keys
83
+ WHERE key = ? AND revoked_at IS NULL`).get(token);
84
+ if (!row)
85
+ return void 0;
86
+ return { sid: row.sid, account_id: row.account_id };
87
+ }
88
+ function looksLikeApiKey(token) {
89
+ return token.startsWith("sk_test_pome_") || token.startsWith("rk_test_pome_") || // Tolerate raw Stripe-style sk_test_* / rk_test_* in case a downstream
90
+ // user mints their own non-pome-prefixed test keys via the admin API.
91
+ token.startsWith("sk_test_") || token.startsWith("rk_test_");
92
+ }
93
+
94
+ // ../packages/twin-stripe/dist/src/domain/schema.js
95
+ var STRIPE_TABLES_SQL = `
96
+ CREATE TABLE IF NOT EXISTS payment_intents (
97
+ id TEXT PRIMARY KEY,
98
+ account_id TEXT NOT NULL,
99
+ amount INTEGER NOT NULL,
100
+ currency TEXT NOT NULL,
101
+ status TEXT NOT NULL,
102
+ payment_method_types_json TEXT NOT NULL,
103
+ next_action_json TEXT,
104
+ latest_charge_id TEXT,
105
+ capture_method TEXT NOT NULL DEFAULT 'automatic',
106
+ confirmation_method TEXT NOT NULL DEFAULT 'automatic',
107
+ idempotency_key TEXT,
108
+ metadata_json TEXT NOT NULL DEFAULT '{}',
109
+ crypto_deposit_json TEXT,
110
+ client_secret TEXT NOT NULL,
111
+ created INTEGER NOT NULL,
112
+ updated INTEGER NOT NULL,
113
+ canceled_at INTEGER,
114
+ captured_at INTEGER,
115
+ payment_method_id TEXT,
116
+ customer_id TEXT,
117
+ last_payment_error_json TEXT
118
+ );
119
+
120
+ CREATE INDEX IF NOT EXISTS idx_payment_intents_created ON payment_intents(created);
121
+ CREATE INDEX IF NOT EXISTS idx_payment_intents_status ON payment_intents(status);
122
+ CREATE INDEX IF NOT EXISTS idx_payment_intents_account_id ON payment_intents(account_id);
123
+
124
+ CREATE TABLE IF NOT EXISTS charges (
125
+ id TEXT PRIMARY KEY,
126
+ account_id TEXT NOT NULL,
127
+ payment_intent_id TEXT NOT NULL,
128
+ amount INTEGER NOT NULL,
129
+ amount_captured INTEGER NOT NULL DEFAULT 0,
130
+ amount_refunded INTEGER NOT NULL DEFAULT 0,
131
+ status TEXT NOT NULL,
132
+ balance_transaction_id TEXT,
133
+ captured INTEGER NOT NULL DEFAULT 0,
134
+ currency TEXT NOT NULL,
135
+ created INTEGER NOT NULL,
136
+ payment_method_id TEXT,
137
+ payment_method_details_json TEXT,
138
+ failure_code TEXT,
139
+ failure_decline_code TEXT,
140
+ failure_message TEXT,
141
+ customer_id TEXT,
142
+ FOREIGN KEY (payment_intent_id) REFERENCES payment_intents(id) ON DELETE CASCADE
143
+ );
144
+
145
+ CREATE INDEX IF NOT EXISTS idx_charges_pi ON charges(payment_intent_id);
146
+ CREATE INDEX IF NOT EXISTS idx_charges_created ON charges(created);
147
+ CREATE INDEX IF NOT EXISTS idx_charges_account_id ON charges(account_id);
148
+
149
+ CREATE TABLE IF NOT EXISTS balance_transactions (
150
+ id TEXT PRIMARY KEY,
151
+ account_id TEXT NOT NULL,
152
+ type TEXT NOT NULL,
153
+ amount INTEGER NOT NULL,
154
+ fee INTEGER NOT NULL DEFAULT 0,
155
+ net INTEGER NOT NULL,
156
+ currency TEXT NOT NULL,
157
+ source_id TEXT,
158
+ source_type TEXT,
159
+ available_on INTEGER NOT NULL,
160
+ status TEXT NOT NULL DEFAULT 'available',
161
+ created INTEGER NOT NULL
162
+ );
163
+
164
+ CREATE INDEX IF NOT EXISTS idx_balance_tx_created ON balance_transactions(created);
165
+ CREATE INDEX IF NOT EXISTS idx_balance_tx_source ON balance_transactions(source_id);
166
+ CREATE INDEX IF NOT EXISTS idx_balance_tx_account_id ON balance_transactions(account_id);
167
+
168
+ CREATE TABLE IF NOT EXISTS events (
169
+ id TEXT PRIMARY KEY,
170
+ account_id TEXT NOT NULL,
171
+ type TEXT NOT NULL,
172
+ data_json TEXT NOT NULL,
173
+ request_idempotency_key TEXT,
174
+ livemode INTEGER NOT NULL DEFAULT 0,
175
+ api_version TEXT NOT NULL,
176
+ created INTEGER NOT NULL
177
+ );
178
+
179
+ CREATE INDEX IF NOT EXISTS idx_events_type ON events(type);
180
+ CREATE INDEX IF NOT EXISTS idx_events_created ON events(created);
181
+ CREATE INDEX IF NOT EXISTS idx_events_account_id ON events(account_id);
182
+
183
+ CREATE TABLE IF NOT EXISTS refunds (
184
+ id TEXT PRIMARY KEY,
185
+ account_id TEXT NOT NULL,
186
+ charge_id TEXT NOT NULL,
187
+ payment_intent_id TEXT NOT NULL,
188
+ amount INTEGER NOT NULL,
189
+ currency TEXT NOT NULL,
190
+ status TEXT NOT NULL,
191
+ reason TEXT,
192
+ balance_transaction_id TEXT,
193
+ idempotency_key TEXT,
194
+ created INTEGER NOT NULL,
195
+ FOREIGN KEY (charge_id) REFERENCES charges(id) ON DELETE CASCADE
196
+ );
197
+
198
+ CREATE INDEX IF NOT EXISTS idx_refunds_charge ON refunds(charge_id);
199
+ CREATE INDEX IF NOT EXISTS idx_refunds_payment_intent ON refunds(payment_intent_id);
200
+ CREATE INDEX IF NOT EXISTS idx_refunds_created ON refunds(created);
201
+ CREATE INDEX IF NOT EXISTS idx_refunds_account_id ON refunds(account_id);
202
+
203
+ CREATE TABLE IF NOT EXISTS customers (
204
+ id TEXT PRIMARY KEY,
205
+ account_id TEXT NOT NULL,
206
+ name TEXT,
207
+ email TEXT,
208
+ description TEXT,
209
+ phone TEXT,
210
+ metadata_json TEXT NOT NULL DEFAULT '{}',
211
+ deleted INTEGER NOT NULL DEFAULT 0,
212
+ created INTEGER NOT NULL
213
+ );
214
+
215
+ CREATE INDEX IF NOT EXISTS idx_customers_created ON customers(created);
216
+ CREATE INDEX IF NOT EXISTS idx_customers_email ON customers(email);
217
+ CREATE INDEX IF NOT EXISTS idx_customers_account_id ON customers(account_id);
218
+
219
+ CREATE TABLE IF NOT EXISTS payment_methods (
220
+ id TEXT PRIMARY KEY,
221
+ account_id TEXT NOT NULL,
222
+ type TEXT NOT NULL,
223
+ card_brand TEXT NOT NULL,
224
+ card_last4 TEXT NOT NULL,
225
+ card_exp_month INTEGER NOT NULL,
226
+ card_exp_year INTEGER NOT NULL,
227
+ card_fingerprint TEXT NOT NULL,
228
+ customer_id TEXT,
229
+ detached INTEGER NOT NULL DEFAULT 0,
230
+ created INTEGER NOT NULL
231
+ );
232
+
233
+ CREATE INDEX IF NOT EXISTS idx_payment_methods_customer ON payment_methods(customer_id);
234
+ CREATE INDEX IF NOT EXISTS idx_payment_methods_created ON payment_methods(created);
235
+ CREATE INDEX IF NOT EXISTS idx_payment_methods_account_id ON payment_methods(account_id);
236
+
237
+ -- F-734 billing tables (warm surfaces, shape tier): plain stored rows served
238
+ -- back in Stripe shape. No invoices table \u2014 invoices are reads-only and
239
+ -- nothing in the twin mints one (loud shape divergence, see FIDELITY.md).
240
+
241
+ CREATE TABLE IF NOT EXISTS products (
242
+ id TEXT PRIMARY KEY,
243
+ account_id TEXT NOT NULL,
244
+ name TEXT NOT NULL,
245
+ description TEXT,
246
+ active INTEGER NOT NULL DEFAULT 1,
247
+ metadata_json TEXT NOT NULL DEFAULT '{}',
248
+ created INTEGER NOT NULL,
249
+ updated INTEGER NOT NULL
250
+ );
251
+
252
+ CREATE INDEX IF NOT EXISTS idx_products_created ON products(created);
253
+ CREATE INDEX IF NOT EXISTS idx_products_account_id ON products(account_id);
254
+
255
+ CREATE TABLE IF NOT EXISTS prices (
256
+ id TEXT PRIMARY KEY,
257
+ account_id TEXT NOT NULL,
258
+ product_id TEXT NOT NULL,
259
+ currency TEXT NOT NULL,
260
+ unit_amount INTEGER,
261
+ recurring_interval TEXT,
262
+ recurring_interval_count INTEGER,
263
+ active INTEGER NOT NULL DEFAULT 1,
264
+ nickname TEXT,
265
+ lookup_key TEXT,
266
+ metadata_json TEXT NOT NULL DEFAULT '{}',
267
+ created INTEGER NOT NULL
268
+ );
269
+
270
+ CREATE INDEX IF NOT EXISTS idx_prices_created ON prices(created);
271
+ CREATE INDEX IF NOT EXISTS idx_prices_product ON prices(product_id);
272
+ CREATE INDEX IF NOT EXISTS idx_prices_account_id ON prices(account_id);
273
+
274
+ CREATE TABLE IF NOT EXISTS subscriptions (
275
+ id TEXT PRIMARY KEY,
276
+ account_id TEXT NOT NULL,
277
+ customer_id TEXT NOT NULL,
278
+ status TEXT NOT NULL,
279
+ items_json TEXT NOT NULL,
280
+ cancel_at_period_end INTEGER NOT NULL DEFAULT 0,
281
+ canceled_at INTEGER,
282
+ ended_at INTEGER,
283
+ metadata_json TEXT NOT NULL DEFAULT '{}',
284
+ created INTEGER NOT NULL
285
+ );
286
+
287
+ CREATE INDEX IF NOT EXISTS idx_subscriptions_created ON subscriptions(created);
288
+ CREATE INDEX IF NOT EXISTS idx_subscriptions_customer ON subscriptions(customer_id);
289
+ CREATE INDEX IF NOT EXISTS idx_subscriptions_account_id ON subscriptions(account_id);
290
+ `;
291
+ var STRIPE_TABLES = [
292
+ "refunds",
293
+ "events",
294
+ "balance_transactions",
295
+ "charges",
296
+ "payment_intents",
297
+ "payment_methods",
298
+ "customers",
299
+ "subscriptions",
300
+ "prices",
301
+ "products"
302
+ ];
303
+ function ensureStripeTables(db) {
304
+ db.pragma("busy_timeout = 5000");
305
+ db.pragma("journal_mode = WAL");
306
+ db.pragma("foreign_keys = ON");
307
+ db.exec(STRIPE_TABLES_SQL);
308
+ ensureMigratedColumns(db);
309
+ }
310
+ var MIGRATED_COLUMNS = {
311
+ payment_intents: [
312
+ ["payment_method_id", "payment_method_id TEXT"],
313
+ ["customer_id", "customer_id TEXT"],
314
+ ["last_payment_error_json", "last_payment_error_json TEXT"]
315
+ ],
316
+ charges: [
317
+ ["payment_method_id", "payment_method_id TEXT"],
318
+ ["payment_method_details_json", "payment_method_details_json TEXT"],
319
+ ["failure_code", "failure_code TEXT"],
320
+ ["failure_decline_code", "failure_decline_code TEXT"],
321
+ ["failure_message", "failure_message TEXT"],
322
+ ["customer_id", "customer_id TEXT"]
323
+ ],
324
+ refunds: [["balance_transaction_id", "balance_transaction_id TEXT"]]
325
+ };
326
+ function ensureMigratedColumns(db) {
327
+ for (const [table, columns] of Object.entries(MIGRATED_COLUMNS)) {
328
+ const existing = new Set(db.prepare(`SELECT name FROM pragma_table_info(?)`).all(table).map((row) => row.name));
329
+ if (existing.size === 0)
330
+ continue;
331
+ for (const [column, ddl] of columns) {
332
+ if (!existing.has(column))
333
+ db.exec(`ALTER TABLE ${table} ADD COLUMN ${ddl};`);
334
+ }
335
+ }
336
+ }
337
+ function resetStripeTables(db) {
338
+ for (const table of STRIPE_TABLES) {
339
+ db.exec(`DELETE FROM ${table};`);
340
+ }
341
+ }
342
+
343
+ // ../packages/twin-stripe/dist/src/db.js
344
+ var MIGRATION_SQL = `
345
+ -- ----- chassis tables -------------------------------------------------------
346
+
347
+ CREATE TABLE IF NOT EXISTS api_keys (
348
+ key TEXT PRIMARY KEY,
349
+ sid TEXT NOT NULL,
350
+ account_id TEXT NOT NULL,
351
+ created_at TEXT NOT NULL,
352
+ revoked_at TEXT
353
+ );
354
+
355
+ CREATE INDEX IF NOT EXISTS idx_api_keys_sid ON api_keys(sid);
356
+
357
+ CREATE TABLE IF NOT EXISTS idempotency_keys (
358
+ key TEXT NOT NULL,
359
+ account_id TEXT NOT NULL,
360
+ method TEXT NOT NULL,
361
+ path TEXT NOT NULL,
362
+ request_hash TEXT NOT NULL,
363
+ response_status INTEGER NOT NULL,
364
+ response_body_json TEXT NOT NULL,
365
+ created_at TEXT NOT NULL,
366
+ PRIMARY KEY (key, account_id, method, path)
367
+ );
368
+
369
+ -- ----- v1 Stripe domain tables ---------------------------------------------
370
+
371
+ CREATE TABLE IF NOT EXISTS payment_intents (
372
+ id TEXT PRIMARY KEY,
373
+ account_id TEXT NOT NULL,
374
+ amount INTEGER NOT NULL,
375
+ currency TEXT NOT NULL,
376
+ status TEXT NOT NULL,
377
+ payment_method_types_json TEXT NOT NULL DEFAULT '[]',
378
+ next_action_json TEXT,
379
+ latest_charge_id TEXT,
380
+ capture_method TEXT NOT NULL DEFAULT 'automatic',
381
+ confirmation_method TEXT NOT NULL DEFAULT 'automatic',
382
+ idempotency_key TEXT,
383
+ metadata_json TEXT NOT NULL DEFAULT '{}',
384
+ crypto_deposit_json TEXT,
385
+ client_secret TEXT NOT NULL,
386
+ created INTEGER NOT NULL,
387
+ updated INTEGER NOT NULL,
388
+ canceled_at INTEGER,
389
+ captured_at INTEGER,
390
+ payment_method_id TEXT,
391
+ customer_id TEXT,
392
+ last_payment_error_json TEXT
393
+ );
394
+
395
+ CREATE INDEX IF NOT EXISTS idx_payment_intents_created ON payment_intents(created);
396
+ CREATE INDEX IF NOT EXISTS idx_payment_intents_status ON payment_intents(status);
397
+ CREATE INDEX IF NOT EXISTS idx_payment_intents_account_id ON payment_intents(account_id);
398
+
399
+ CREATE TABLE IF NOT EXISTS charges (
400
+ id TEXT PRIMARY KEY,
401
+ account_id TEXT NOT NULL,
402
+ payment_intent_id TEXT NOT NULL,
403
+ amount INTEGER NOT NULL,
404
+ amount_captured INTEGER NOT NULL DEFAULT 0,
405
+ amount_refunded INTEGER NOT NULL DEFAULT 0,
406
+ status TEXT NOT NULL,
407
+ balance_transaction_id TEXT,
408
+ captured INTEGER NOT NULL DEFAULT 0,
409
+ created INTEGER NOT NULL,
410
+ currency TEXT NOT NULL,
411
+ payment_method_id TEXT,
412
+ payment_method_details_json TEXT,
413
+ failure_code TEXT,
414
+ failure_decline_code TEXT,
415
+ failure_message TEXT,
416
+ customer_id TEXT
417
+ );
418
+
419
+ CREATE INDEX IF NOT EXISTS idx_charges_payment_intent ON charges(payment_intent_id);
420
+ CREATE INDEX IF NOT EXISTS idx_charges_created ON charges(created);
421
+ CREATE INDEX IF NOT EXISTS idx_charges_account_id ON charges(account_id);
422
+
423
+ CREATE TABLE IF NOT EXISTS balance_transactions (
424
+ id TEXT PRIMARY KEY,
425
+ account_id TEXT NOT NULL,
426
+ type TEXT NOT NULL,
427
+ amount INTEGER NOT NULL,
428
+ fee INTEGER NOT NULL DEFAULT 0,
429
+ net INTEGER NOT NULL,
430
+ currency TEXT NOT NULL,
431
+ source_id TEXT,
432
+ source_type TEXT,
433
+ available_on INTEGER NOT NULL,
434
+ created INTEGER NOT NULL,
435
+ status TEXT NOT NULL DEFAULT 'pending'
436
+ );
437
+
438
+ CREATE INDEX IF NOT EXISTS idx_balance_transactions_created ON balance_transactions(created);
439
+ CREATE INDEX IF NOT EXISTS idx_balance_transactions_source ON balance_transactions(source_id);
440
+ CREATE INDEX IF NOT EXISTS idx_balance_transactions_account_id ON balance_transactions(account_id);
441
+
442
+ CREATE TABLE IF NOT EXISTS events (
443
+ id TEXT PRIMARY KEY,
444
+ account_id TEXT NOT NULL,
445
+ type TEXT NOT NULL,
446
+ data_json TEXT NOT NULL,
447
+ request_idempotency_key TEXT,
448
+ livemode INTEGER NOT NULL DEFAULT 0,
449
+ created INTEGER NOT NULL,
450
+ api_version TEXT NOT NULL
451
+ );
452
+
453
+ CREATE INDEX IF NOT EXISTS idx_events_type ON events(type);
454
+ CREATE INDEX IF NOT EXISTS idx_events_created ON events(created);
455
+ CREATE INDEX IF NOT EXISTS idx_events_account_id ON events(account_id);
456
+
457
+ -- ----- audit log (writes through admin/seed/reset) ------------------------
458
+
459
+ CREATE TABLE IF NOT EXISTS audit_log (
460
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
461
+ ts TEXT NOT NULL,
462
+ action TEXT NOT NULL,
463
+ payload_json TEXT NOT NULL
464
+ );
465
+ `;
466
+ var RESET_SQL = `
467
+ DELETE FROM audit_log;
468
+ DELETE FROM refunds;
469
+ DELETE FROM events;
470
+ DELETE FROM balance_transactions;
471
+ DELETE FROM charges;
472
+ DELETE FROM payment_intents;
473
+ DELETE FROM payment_methods;
474
+ DELETE FROM customers;
475
+ DELETE FROM subscriptions;
476
+ DELETE FROM prices;
477
+ DELETE FROM products;
478
+ DELETE FROM idempotency_keys;
479
+ DELETE FROM api_keys;
480
+ `;
481
+ function openTwinStripeDatabase(path = process.env.STRIPE_CLONE_DB ?? ":memory:") {
482
+ return openTwinDatabase(path, { migrate });
483
+ }
484
+ function migrate(db) {
485
+ db.exec(MIGRATION_SQL);
486
+ ensureMigratedColumns(db);
487
+ }
488
+ function resetDatabase(db) {
489
+ ensureStripeTables(db);
490
+ db.exec(RESET_SQL);
491
+ }
492
+
493
+ // ../packages/twin-stripe/dist/src/errors.js
494
+ var TwinError = class extends Error {
495
+ status;
496
+ type;
497
+ code;
498
+ param;
499
+ doc_url;
500
+ fidelity;
501
+ supported_surfaces;
502
+ decline_code;
503
+ payment_intent;
504
+ state_mutation;
505
+ state_delta;
506
+ constructor(type, code, message, opts = {}) {
507
+ super(message);
508
+ this.type = type;
509
+ this.code = code;
510
+ this.status = opts.statusCode ?? 400;
511
+ this.param = opts.param;
512
+ this.doc_url = opts.doc_url;
513
+ this.fidelity = opts.fidelity;
514
+ this.supported_surfaces = opts.supported_surfaces;
515
+ this.decline_code = opts.decline_code;
516
+ this.payment_intent = opts.payment_intent;
517
+ this.state_mutation = opts.state_mutation;
518
+ this.state_delta = opts.state_delta;
519
+ }
520
+ toEnvelope() {
521
+ return stripeError(this.type, this.code, this.message, {
522
+ param: this.param,
523
+ doc_url: this.doc_url,
524
+ fidelity: this.fidelity,
525
+ supported_surfaces: this.supported_surfaces,
526
+ decline_code: this.decline_code,
527
+ payment_intent: this.payment_intent
528
+ }).body;
529
+ }
530
+ };
531
+ function stripeError(type, code, message, opts = {}) {
532
+ const error = { type, code, message };
533
+ if (opts.param !== void 0)
534
+ error.param = opts.param;
535
+ if (opts.doc_url !== void 0)
536
+ error.doc_url = opts.doc_url;
537
+ if (opts.fidelity !== void 0)
538
+ error.fidelity = opts.fidelity;
539
+ if (opts.supported_surfaces !== void 0) {
540
+ error.supported_surfaces = opts.supported_surfaces;
541
+ }
542
+ if (opts.decline_code !== void 0)
543
+ error.decline_code = opts.decline_code;
544
+ if (opts.payment_intent !== void 0)
545
+ error.payment_intent = opts.payment_intent;
546
+ return {
547
+ status: opts.statusCode ?? 400,
548
+ body: { error }
549
+ };
550
+ }
551
+ function unauthorized(message = "Invalid API Key provided.") {
552
+ return stripeError("invalid_request_error", "unauthorized", message, {
553
+ statusCode: 401
554
+ });
555
+ }
556
+ function forbidden(message = "Forbidden") {
557
+ return stripeError("invalid_request_error", "forbidden", message, {
558
+ statusCode: 403
559
+ });
560
+ }
561
+ function unsupported() {
562
+ return stripeError("invalid_request_error", "endpoint_not_supported", "This endpoint is not supported by this Stripe twin clone.", {
563
+ statusCode: 501,
564
+ fidelity: "unsupported",
565
+ supported_surfaces: [
566
+ "Stripe-shaped REST under /v1/*",
567
+ "GET /s/:sid/mcp/tools",
568
+ "POST /s/:sid/mcp/call",
569
+ "POST /s/:sid/mcp/tools/:name"
570
+ ]
571
+ });
572
+ }
573
+
574
+ // ../packages/twin-stripe/dist/src/domain/constants.js
575
+ var STRIPE_API_VERSION = "2026-03-04.preview";
576
+ var DEFAULT_CAPTURE_METHOD = "automatic";
577
+ var DEFAULT_CONFIRMATION_METHOD = "automatic";
578
+ var BASE_USDC_CONTRACT_ADDRESS = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
579
+ var SUPPORTED_NETWORKS = ["base"];
580
+ var CRYPTO_CURRENCIES = ["usd"];
581
+
582
+ // ../packages/twin-stripe/dist/src/domain/payment-intents.js
583
+ var PaymentIntentsDomain = class {
584
+ db;
585
+ constructor(db) {
586
+ this.db = db;
587
+ ensureStripeTables(db);
588
+ }
589
+ // ---------- create ----------
590
+ /**
591
+ * Insert a fresh PI. The caller (StripeDomain) has already resolved and
592
+ * cross-validated `payment_method` / `customer` for the card rail —
593
+ * `resolved` carries the validated ids so this module stays free of the
594
+ * sibling domains.
595
+ */
596
+ create(accountId2, input, resolved) {
597
+ if (!Number.isInteger(input.amount) || input.amount <= 0) {
598
+ throw new TwinError("invalid_request_error", "parameter_invalid_integer", "Amount must be a positive integer.", { param: "amount", statusCode: 400 });
599
+ }
600
+ const currency = (input.currency ?? "").toLowerCase();
601
+ if (!currency) {
602
+ throw new TwinError("invalid_request_error", "parameter_missing", "Missing required param: currency.", { param: "currency", statusCode: 400 });
603
+ }
604
+ if (!CRYPTO_CURRENCIES.includes(currency)) {
605
+ throw new TwinError("invalid_request_error", "currency_not_supported", `Currency '${currency}' is not supported by this twin (v1 supports: ${CRYPTO_CURRENCIES.join(", ")}).`, { param: "currency", statusCode: 400 });
606
+ }
607
+ const pmTypes = input.payment_method_types ?? [];
608
+ const pmType = pmTypes.length === 1 ? pmTypes[0] : void 0;
609
+ if (pmType !== "crypto" && pmType !== "card") {
610
+ throw new TwinError("invalid_request_error", "parameter_invalid_string", 'payment_method_types must be exactly ["crypto"] or ["card"] for this twin.', { param: "payment_method_types", statusCode: 400 });
611
+ }
612
+ const id = newId("payment_intent");
613
+ const clientSecret = newClientSecret(id);
614
+ const now = nowUnix();
615
+ let status;
616
+ let nextActionJson = null;
617
+ let cryptoDepositJson = null;
618
+ if (pmType === "crypto") {
619
+ if (input.payment_method || input.customer || input.confirm) {
620
+ throw new TwinError("invalid_request_error", "parameter_invalid_string", 'payment_method, customer, and confirm are only valid with payment_method_types ["card"].', { param: "payment_method", statusCode: 400 });
621
+ }
622
+ const cryptoOpts = input.payment_method_options?.crypto;
623
+ if (!cryptoOpts || cryptoOpts.mode !== "deposit") {
624
+ throw new TwinError("invalid_request_error", "parameter_invalid_string", 'payment_method_options.crypto.mode must be "deposit" for crypto PaymentIntents.', { param: "payment_method_options[crypto][mode]", statusCode: 400 });
625
+ }
626
+ const networks = cryptoOpts.deposit_options?.networks ?? [];
627
+ const network = networks[0];
628
+ if (!network || !SUPPORTED_NETWORKS.includes(network)) {
629
+ throw new TwinError("invalid_request_error", "parameter_invalid_string", `payment_method_options.crypto.deposit_options.networks must include one of: ${SUPPORTED_NETWORKS.join(", ")}.`, { param: "payment_method_options[crypto][deposit_options][networks]", statusCode: 400 });
630
+ }
631
+ const address = depositAddressFromId(id);
632
+ const cryptoDeposit = {
633
+ deposit_addresses: {
634
+ [network]: {
635
+ address,
636
+ supported_tokens: [
637
+ {
638
+ token_currency: "usdc",
639
+ token_contract_address: BASE_USDC_CONTRACT_ADDRESS
640
+ }
641
+ ]
642
+ }
643
+ }
644
+ };
645
+ status = "requires_action";
646
+ nextActionJson = JSON.stringify({
647
+ type: "display_crypto_deposit_information",
648
+ crypto_display_details: cryptoDeposit
649
+ });
650
+ cryptoDepositJson = JSON.stringify(cryptoDeposit);
651
+ } else {
652
+ if (input.payment_method_options?.crypto) {
653
+ throw new TwinError("invalid_request_error", "parameter_invalid_string", 'payment_method_options.crypto is only valid with payment_method_types ["crypto"].', { param: "payment_method_options[crypto]", statusCode: 400 });
654
+ }
655
+ status = resolved.paymentMethodId ? "requires_confirmation" : "requires_payment_method";
656
+ }
657
+ this.db.prepare(`INSERT INTO payment_intents (
658
+ id, account_id, amount, currency, status,
659
+ payment_method_types_json, next_action_json,
660
+ latest_charge_id, capture_method, confirmation_method,
661
+ idempotency_key, metadata_json, crypto_deposit_json,
662
+ client_secret, created, updated, canceled_at, captured_at,
663
+ payment_method_id, customer_id, last_payment_error_json
664
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, NULL, ?, ?, ?, ?, ?, ?, ?, ?, NULL, NULL, ?, ?, NULL)`).run(id, accountId2, input.amount, currency, status, JSON.stringify(pmTypes), nextActionJson, input.capture_method ?? DEFAULT_CAPTURE_METHOD, input.confirmation_method ?? DEFAULT_CONFIRMATION_METHOD, input.idempotency_key ?? null, JSON.stringify(input.metadata ?? {}), cryptoDepositJson, clientSecret, now, now, resolved.paymentMethodId, resolved.customerId);
665
+ return this.requireById(accountId2, id);
666
+ }
667
+ // ---------- confirm ----------
668
+ /**
669
+ * Crypto-deposit confirm is idempotent. If the PI is already in
670
+ * `requires_action`, return it unchanged. If it's mid- or post-flight
671
+ * (`processing` / `succeeded`), return it. Only `canceled` is rejected.
672
+ */
673
+ confirm(accountId2, id) {
674
+ const pi = this.requireById(accountId2, id);
675
+ if (pi.status === "canceled") {
676
+ throw piUnexpectedState(pi.status);
677
+ }
678
+ return pi;
679
+ }
680
+ /**
681
+ * Card confirm leg 1: CAS the observed pre-confirm status
682
+ * (`requires_confirmation` or `requires_payment_method`) → `processing`,
683
+ * stamping the PM being attempted. Exactly one of N parallel confirms
684
+ * wins this CAS; losers see `payment_intent_unexpected_state`.
685
+ */
686
+ confirmCardLeg1(accountId2, id, expected, paymentMethodId) {
687
+ return this.casStatusOrThrow(accountId2, id, expected, "processing", {
688
+ payment_method_id: paymentMethodId
689
+ });
690
+ }
691
+ /** Card confirm leg 2, success: processing → succeeded with the charge. */
692
+ finalizeCardSuccess(accountId2, id, latestChargeId) {
693
+ return this.casStatusOrThrow(accountId2, id, "processing", "succeeded", {
694
+ latest_charge_id: latestChargeId,
695
+ captured_at: nowUnix(),
696
+ last_payment_error_json: null
697
+ });
698
+ }
699
+ /**
700
+ * Card confirm leg 2, decline: processing → requires_payment_method with
701
+ * the failed charge and `last_payment_error` on the record. The declined
702
+ * PM is dropped from the PI, like real Stripe.
703
+ */
704
+ finalizeCardDecline(accountId2, id, failedChargeId, lastPaymentErrorJson) {
705
+ return this.casStatusOrThrow(accountId2, id, "processing", "requires_payment_method", {
706
+ latest_charge_id: failedChargeId,
707
+ payment_method_id: null,
708
+ last_payment_error_json: lastPaymentErrorJson
709
+ });
710
+ }
711
+ // ---------- update (POST /v1/payment_intents/:id, F-731) ----------
712
+ /**
713
+ * Update a non-terminal PI. Metadata merges per-key (empty/null unsets,
714
+ * Stripe's metadata contract). `payment_method` / `customer` are only
715
+ * valid on the card rail and have been resolved by the caller;
716
+ * attaching a PM moves requires_payment_method → requires_confirmation.
717
+ * The UPDATE is guarded on the observed status so a racing confirm wins.
718
+ */
719
+ update(accountId2, id, input, resolved = {}) {
720
+ const pi = this.requireById(accountId2, id);
721
+ const updatable = /* @__PURE__ */ new Set([
722
+ "requires_payment_method",
723
+ "requires_confirmation",
724
+ "requires_action"
725
+ ]);
726
+ if (!updatable.has(pi.status)) {
727
+ throw piUnexpectedState(pi.status);
728
+ }
729
+ const isCard = piTypes(pi).includes("card");
730
+ if (!isCard && (input.amount !== void 0 || input.payment_method !== void 0 || input.customer !== void 0)) {
731
+ throw new TwinError("invalid_request_error", "parameter_invalid_string", "Only metadata can be updated on crypto PaymentIntents.", { param: "payment_method", statusCode: 400 });
732
+ }
733
+ if (input.amount !== void 0 && (!Number.isInteger(input.amount) || input.amount <= 0)) {
734
+ throw new TwinError("invalid_request_error", "parameter_invalid_integer", "Amount must be a positive integer.", { param: "amount", statusCode: 400 });
735
+ }
736
+ const metadata = JSON.parse(pi.metadata_json);
737
+ for (const [key, value] of Object.entries(input.metadata ?? {})) {
738
+ if (value === null || value === "")
739
+ delete metadata[key];
740
+ else
741
+ metadata[key] = value;
742
+ }
743
+ const nextPaymentMethodId = input.payment_method !== void 0 ? resolved.paymentMethodId ?? null : pi.payment_method_id;
744
+ const nextCustomerId = input.customer !== void 0 ? resolved.customerId ?? null : pi.customer_id;
745
+ let nextStatus = pi.status;
746
+ if (isCard) {
747
+ if (nextPaymentMethodId && pi.status === "requires_payment_method") {
748
+ nextStatus = "requires_confirmation";
749
+ } else if (!nextPaymentMethodId && pi.status === "requires_confirmation") {
750
+ nextStatus = "requires_payment_method";
751
+ }
752
+ }
753
+ const updated = this.db.prepare(`UPDATE payment_intents SET
754
+ amount = ?, metadata_json = ?, payment_method_id = ?, customer_id = ?,
755
+ status = ?, updated = ?
756
+ WHERE id = ? AND account_id = ? AND status = ? RETURNING *`).get(input.amount ?? pi.amount, JSON.stringify(metadata), nextPaymentMethodId, nextCustomerId, nextStatus, nowUnix(), id, accountId2, pi.status);
757
+ if (!updated) {
758
+ const fresh = this.requireById(accountId2, id);
759
+ throw piUnexpectedState(fresh.status);
760
+ }
761
+ return updated;
762
+ }
763
+ // ---------- cancel ----------
764
+ cancel(accountId2, id) {
765
+ const pi = this.requireById(accountId2, id);
766
+ if (pi.status === "succeeded") {
767
+ throw piUnexpectedState(pi.status, "Cannot cancel a succeeded PaymentIntent.");
768
+ }
769
+ if (pi.status === "canceled") {
770
+ return pi;
771
+ }
772
+ const updated = this.casStatus(accountId2, id, pi.status, "canceled", { canceled_at: nowUnix() });
773
+ if (!updated)
774
+ throw piUnexpectedState(pi.status);
775
+ return updated;
776
+ }
777
+ // ---------- simulate_crypto_deposit (test_helpers) ----------
778
+ /**
779
+ * Drive a PI from requires_action → processing → succeeded.
780
+ * Both transitions are CAS — exactly one parallel call wins each leg.
781
+ * Returns { pi, charge, balanceTx, events: rows of side-effect ids }.
782
+ * Side-effect emission (events, charge mint, balance txn) is the
783
+ * caller's job — `simulate` is the bare state-advancement here. To keep
784
+ * the routes simple we colocate it. See routes/payment-intents.ts.
785
+ */
786
+ simulateCryptoDepositLeg1(accountId2, id) {
787
+ const pi = this.requireById(accountId2, id);
788
+ if (pi.status === "succeeded" || pi.status === "canceled") {
789
+ throw piUnexpectedState(pi.status, `PaymentIntent is in terminal state '${pi.status}' and cannot be advanced.`);
790
+ }
791
+ if (pi.status !== "requires_action") {
792
+ throw piUnexpectedState(pi.status);
793
+ }
794
+ return this.casStatusOrThrow(accountId2, id, "requires_action", "processing");
795
+ }
796
+ /** Second CAS leg: processing → succeeded. */
797
+ simulateCryptoDepositLeg2(accountId2, id, latestChargeId) {
798
+ return this.casStatusOrThrow(accountId2, id, "processing", "succeeded", {
799
+ latest_charge_id: latestChargeId,
800
+ captured_at: nowUnix()
801
+ });
802
+ }
803
+ // ---------- read ----------
804
+ getById(accountId2, id) {
805
+ return this.db.prepare("SELECT * FROM payment_intents WHERE id = ? AND account_id = ?").get(id, accountId2) ?? null;
806
+ }
807
+ requireById(accountId2, id) {
808
+ const pi = this.getById(accountId2, id);
809
+ if (!pi) {
810
+ throw new TwinError("invalid_request_error", "resource_missing", `No such payment_intent: '${id}'.`, { param: "intent", statusCode: 404 });
811
+ }
812
+ return pi;
813
+ }
814
+ list(accountId2, input) {
815
+ return listPaginated(this.db, "payment_intents", accountId2, input);
816
+ }
817
+ // ---------- internals ----------
818
+ /**
819
+ * casStatus + the shared lost-the-race contract: re-read the fresh row
820
+ * so the loser's `payment_intent_unexpected_state` names the status that
821
+ * actually beat it. Every CAS leg on both rails goes through here.
822
+ */
823
+ casStatusOrThrow(accountId2, id, expected, next, extras = {}) {
824
+ const updated = this.casStatus(accountId2, id, expected, next, extras);
825
+ if (!updated) {
826
+ const fresh = this.requireById(accountId2, id);
827
+ throw piUnexpectedState(fresh.status);
828
+ }
829
+ return updated;
830
+ }
831
+ /**
832
+ * Compare-and-swap on `status`. Returns the new row, or `null` if no row
833
+ * matched the predicate. The predicate is `(id = ? AND account_id = ? AND status = ?)`.
834
+ */
835
+ casStatus(accountId2, id, expected, next, extras = {}) {
836
+ const sets = ["status = ?", "updated = ?"];
837
+ const values = [next, nowUnix()];
838
+ if ("latest_charge_id" in extras) {
839
+ sets.push("latest_charge_id = ?");
840
+ values.push(extras.latest_charge_id ?? null);
841
+ }
842
+ if ("canceled_at" in extras) {
843
+ sets.push("canceled_at = ?");
844
+ values.push(extras.canceled_at ?? null);
845
+ }
846
+ if ("captured_at" in extras) {
847
+ sets.push("captured_at = ?");
848
+ values.push(extras.captured_at ?? null);
849
+ }
850
+ if ("payment_method_id" in extras) {
851
+ sets.push("payment_method_id = ?");
852
+ values.push(extras.payment_method_id ?? null);
853
+ }
854
+ if ("last_payment_error_json" in extras) {
855
+ sets.push("last_payment_error_json = ?");
856
+ values.push(extras.last_payment_error_json ?? null);
857
+ }
858
+ const sql = `UPDATE payment_intents SET ${sets.join(", ")} WHERE id = ? AND account_id = ? AND status = ? RETURNING *`;
859
+ values.push(id, accountId2, expected);
860
+ return this.db.prepare(sql).get(...values) ?? null;
861
+ }
862
+ };
863
+ function piTypes(pi) {
864
+ try {
865
+ const parsed = JSON.parse(pi.payment_method_types_json);
866
+ return Array.isArray(parsed) ? parsed : ["crypto"];
867
+ } catch {
868
+ return ["crypto"];
869
+ }
870
+ }
871
+ function piUnexpectedState(currentStatus, message) {
872
+ return new TwinError("invalid_request_error", "payment_intent_unexpected_state", message ?? `The PaymentIntent has a status of '${currentStatus}'. The requested action could not be performed.`, { statusCode: 400 });
873
+ }
874
+ function depositAddressFromId(id) {
875
+ const digest = createHash("sha256").update(id).digest("hex");
876
+ return `0x${digest.slice(0, 40)}`;
877
+ }
878
+ function listPaginated(db, table, accountId2, input, extraWheres = []) {
879
+ const limitRaw = input.limit ?? 10;
880
+ const limit = Math.min(100, Math.max(1, Math.floor(limitRaw)));
881
+ const wheres = ["account_id = ?"];
882
+ const args = [accountId2];
883
+ if (input.starting_after) {
884
+ const cursor = cursorRow(db, table, accountId2, input.starting_after);
885
+ if (cursor) {
886
+ wheres.push("(created < ? OR (created = ? AND id < ?))");
887
+ args.push(cursor.created, cursor.created, cursor.id);
888
+ }
889
+ }
890
+ if (input.ending_before) {
891
+ const cursor = cursorRow(db, table, accountId2, input.ending_before);
892
+ if (cursor) {
893
+ wheres.push("(created > ? OR (created = ? AND id > ?))");
894
+ args.push(cursor.created, cursor.created, cursor.id);
895
+ }
896
+ }
897
+ if (typeof input.created_gt === "number") {
898
+ wheres.push("created > ?");
899
+ args.push(input.created_gt);
900
+ }
901
+ if (typeof input.created_gte === "number") {
902
+ wheres.push("created >= ?");
903
+ args.push(input.created_gte);
904
+ }
905
+ if (typeof input.created_lt === "number") {
906
+ wheres.push("created < ?");
907
+ args.push(input.created_lt);
908
+ }
909
+ if (typeof input.created_lte === "number") {
910
+ wheres.push("created <= ?");
911
+ args.push(input.created_lte);
912
+ }
913
+ if (input.type) {
914
+ wheres.push("type = ?");
915
+ args.push(input.type);
916
+ }
917
+ if (input.payment_intent) {
918
+ wheres.push("payment_intent_id = ?");
919
+ args.push(input.payment_intent);
920
+ }
921
+ for (const extra of extraWheres) {
922
+ wheres.push(extra.sql);
923
+ args.push(...extra.args);
924
+ }
925
+ const where = `WHERE ${wheres.join(" AND ")}`;
926
+ const sql = `SELECT * FROM ${table} ${where} ORDER BY created DESC, id DESC LIMIT ?`;
927
+ const rows = db.prepare(sql).all(...args, limit + 1);
928
+ const hasMore = rows.length > limit;
929
+ return { rows: hasMore ? rows.slice(0, limit) : rows, hasMore, limit };
930
+ }
931
+ function cursorRow(db, table, accountId2, id) {
932
+ return db.prepare(`SELECT id, created FROM ${table} WHERE id = ? AND account_id = ?`).get(id, accountId2) ?? null;
933
+ }
934
+ var PaymentMethodsDomain = class {
935
+ db;
936
+ constructor(db) {
937
+ this.db = db;
938
+ ensureStripeTables(db);
939
+ }
940
+ create(accountId2, input) {
941
+ if (typeof input.type !== "string" || input.type.length === 0) {
942
+ throw new TwinError("invalid_request_error", "parameter_missing", "Missing required param: type.", { param: "type", statusCode: 400 });
943
+ }
944
+ if (input.type !== "card") {
945
+ throw new TwinError("invalid_request_error", "parameter_invalid_string", `payment method type must be "card" for v1 of this twin (got '${input.type}').`, { param: "type", statusCode: 400 });
946
+ }
947
+ const card = input.card;
948
+ if (!card || typeof card !== "object") {
949
+ throw new TwinError("invalid_request_error", "parameter_missing", "Missing required param: card.", { param: "card", statusCode: 400 });
950
+ }
951
+ const number = typeof card.number === "string" ? card.number.replace(/[\s-]/g, "") : "";
952
+ if (!/^\d{12,19}$/.test(number) || !passesLuhn(number)) {
953
+ throw new TwinError("card_error", "incorrect_number", "Your card number is incorrect.", {
954
+ param: "card[number]",
955
+ statusCode: 402
956
+ });
957
+ }
958
+ const expMonth = Number(card.exp_month);
959
+ if (!Number.isInteger(expMonth) || expMonth < 1 || expMonth > 12) {
960
+ throw new TwinError("card_error", "invalid_expiry_month", "Your card's expiration month is invalid.", { param: "card[exp_month]", statusCode: 402 });
961
+ }
962
+ const expYear = Number(card.exp_year);
963
+ const now = new Date(nowUnix() * 1e3);
964
+ const currentYear = now.getUTCFullYear();
965
+ if (!Number.isInteger(expYear) || expYear < currentYear) {
966
+ throw new TwinError("card_error", "invalid_expiry_year", "Your card's expiration year is invalid.", { param: "card[exp_year]", statusCode: 402 });
967
+ }
968
+ if (expYear === currentYear && expMonth < now.getUTCMonth() + 1) {
969
+ throw new TwinError("card_error", "invalid_expiry_month", "Your card's expiration month is invalid.", { param: "card[exp_month]", statusCode: 402 });
970
+ }
971
+ const id = newId("payment_method");
972
+ this.db.prepare(`INSERT INTO payment_methods (
973
+ id, account_id, type, card_brand, card_last4, card_exp_month,
974
+ card_exp_year, card_fingerprint, customer_id, detached, created
975
+ ) VALUES (?, ?, 'card', ?, ?, ?, ?, ?, NULL, 0, ?)`).run(
976
+ id,
977
+ accountId2,
978
+ brandFromNumber(number),
979
+ number.slice(-4),
980
+ expMonth,
981
+ expYear,
982
+ // Stable per PAN, like Stripe's card fingerprint — but derived, so
983
+ // the PAN itself is never persisted anywhere.
984
+ fingerprintOf(number),
985
+ nowUnix()
986
+ );
987
+ return this.requireById(accountId2, id);
988
+ }
989
+ getById(accountId2, id) {
990
+ return this.db.prepare("SELECT * FROM payment_methods WHERE id = ? AND account_id = ?").get(id, accountId2) ?? null;
991
+ }
992
+ requireById(accountId2, id) {
993
+ const row = this.getById(accountId2, id);
994
+ if (!row) {
995
+ throw new TwinError("invalid_request_error", "resource_missing", `No such payment_method: '${id}'.`, { param: "payment_method", statusCode: 404 });
996
+ }
997
+ return row;
998
+ }
999
+ /**
1000
+ * Attach to a customer. Caller has already resolved the customer as live.
1001
+ * Stripe rules: one customer per PM, and a previously-detached PM may
1002
+ * never be reattached.
1003
+ */
1004
+ attach(accountId2, id, customerId) {
1005
+ const pm = this.requireById(accountId2, id);
1006
+ if (pm.customer_id) {
1007
+ throw new TwinError("invalid_request_error", "payment_method_already_attached", "This PaymentMethod has already been attached to a customer.", { param: "payment_method", statusCode: 400 });
1008
+ }
1009
+ if (pm.detached) {
1010
+ throw new TwinError("invalid_request_error", "payment_method_previously_detached", "A payment method that has been previously detached from a customer may not be reattached.", { param: "payment_method", statusCode: 400 });
1011
+ }
1012
+ this.db.prepare("UPDATE payment_methods SET customer_id = ? WHERE id = ? AND account_id = ?").run(customerId, id, accountId2);
1013
+ return this.requireById(accountId2, id);
1014
+ }
1015
+ detach(accountId2, id) {
1016
+ const pm = this.requireById(accountId2, id);
1017
+ if (!pm.customer_id) {
1018
+ throw new TwinError("invalid_request_error", "payment_method_not_attached", "The payment method you provided is not attached to a customer.", { param: "payment_method", statusCode: 400 });
1019
+ }
1020
+ this.db.prepare("UPDATE payment_methods SET customer_id = NULL, detached = 1 WHERE id = ? AND account_id = ?").run(id, accountId2);
1021
+ return this.requireById(accountId2, id);
1022
+ }
1023
+ /** All PMs currently attached to a customer (no pagination — used by
1024
+ * customer deletion to emit one detached event per PM). */
1025
+ allAttachedToCustomer(accountId2, customerId) {
1026
+ return this.db.prepare("SELECT * FROM payment_methods WHERE customer_id = ? AND account_id = ?").all(customerId, accountId2);
1027
+ }
1028
+ listForCustomer(accountId2, customerId, input) {
1029
+ return listPaginated(this.db, "payment_methods", accountId2, input, [
1030
+ { sql: "customer_id = ?", args: [customerId] }
1031
+ ]);
1032
+ }
1033
+ };
1034
+ var MAGIC_DECLINES = [
1035
+ ["4000000000000002", { code: "card_declined", decline_code: "generic_decline", message: "Your card was declined." }],
1036
+ ["4000000000009995", { code: "card_declined", decline_code: "insufficient_funds", message: "Your card has insufficient funds." }],
1037
+ ["4000000000000069", { code: "expired_card", decline_code: "expired_card", message: "Your card has expired." }],
1038
+ ["4000000000000127", { code: "incorrect_cvc", decline_code: "incorrect_cvc", message: "Your card's security code is incorrect." }]
1039
+ ];
1040
+ var DECLINE_BY_FINGERPRINT = new Map(MAGIC_DECLINES.map(([pan, decline]) => [fingerprintOf(pan), decline]));
1041
+ function fingerprintOf(number) {
1042
+ return createHash("sha256").update(number).digest("hex").slice(0, 16);
1043
+ }
1044
+ function declineForFingerprint(fingerprint) {
1045
+ return DECLINE_BY_FINGERPRINT.get(fingerprint) ?? null;
1046
+ }
1047
+ function passesLuhn(number) {
1048
+ let sum = 0;
1049
+ let double = false;
1050
+ for (let i = number.length - 1; i >= 0; i--) {
1051
+ let digit = number.charCodeAt(i) - 48;
1052
+ if (double) {
1053
+ digit *= 2;
1054
+ if (digit > 9)
1055
+ digit -= 9;
1056
+ }
1057
+ sum += digit;
1058
+ double = !double;
1059
+ }
1060
+ return sum % 10 === 0;
1061
+ }
1062
+ function brandFromNumber(number) {
1063
+ if (/^4/.test(number))
1064
+ return "visa";
1065
+ if (/^(5[1-5]|2[2-7])/.test(number))
1066
+ return "mastercard";
1067
+ if (/^3[47]/.test(number))
1068
+ return "amex";
1069
+ if (/^6(011|5)/.test(number))
1070
+ return "discover";
1071
+ return "unknown";
1072
+ }
1073
+
1074
+ // ../packages/twin-stripe/dist/src/domain/charges.js
1075
+ var ChargesDomain = class {
1076
+ db;
1077
+ constructor(db) {
1078
+ this.db = db;
1079
+ ensureStripeTables(db);
1080
+ }
1081
+ /**
1082
+ * Mint a fresh charge attached to a PI. Defaults to `succeeded` +
1083
+ * `captured` (the settle paths); a declined card attempt passes
1084
+ * `status: "failed"` and the failure columns instead.
1085
+ */
1086
+ createForPI(accountId2, input) {
1087
+ const id = newId("charge");
1088
+ const now = nowUnix();
1089
+ const status = input.status ?? "succeeded";
1090
+ const succeeded = status === "succeeded";
1091
+ this.db.prepare(`INSERT INTO charges (
1092
+ id, account_id, payment_intent_id, amount, amount_captured, amount_refunded,
1093
+ status, balance_transaction_id, captured, currency, created,
1094
+ payment_method_id, payment_method_details_json,
1095
+ failure_code, failure_decline_code, failure_message, customer_id
1096
+ ) VALUES (?, ?, ?, ?, ?, 0, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(id, accountId2, input.payment_intent_id, input.amount, succeeded ? input.amount : 0, status, input.balance_transaction_id ?? null, succeeded ? 1 : 0, input.currency, now, input.payment_method_id ?? null, input.payment_method_details_json ?? null, input.failure_code ?? null, input.failure_decline_code ?? null, input.failure_message ?? null, input.customer_id ?? null);
1097
+ return this.requireById(accountId2, id);
1098
+ }
1099
+ getById(accountId2, id) {
1100
+ return this.db.prepare("SELECT * FROM charges WHERE id = ? AND account_id = ?").get(id, accountId2) ?? null;
1101
+ }
1102
+ requireById(accountId2, id) {
1103
+ const row = this.getById(accountId2, id);
1104
+ if (!row) {
1105
+ throw new TwinError("invalid_request_error", "resource_missing", `No such charge: '${id}'.`, { param: "charge", statusCode: 404 });
1106
+ }
1107
+ return row;
1108
+ }
1109
+ list(accountId2, input) {
1110
+ const { customer, ...rest } = input;
1111
+ const extra = customer ? [{ sql: "customer_id = ?", args: [customer] }] : [];
1112
+ return listPaginated(this.db, "charges", accountId2, rest, extra);
1113
+ }
1114
+ /** Count charges for a PI. Used by the concurrency test. */
1115
+ countForPI(accountId2, piId) {
1116
+ const row = this.db.prepare("SELECT COUNT(*) as n FROM charges WHERE payment_intent_id = ? AND account_id = ?").get(piId, accountId2);
1117
+ return row.n;
1118
+ }
1119
+ };
1120
+
1121
+ // ../packages/twin-stripe/dist/src/domain/balance.js
1122
+ var BalanceDomain = class {
1123
+ db;
1124
+ constructor(db) {
1125
+ this.db = db;
1126
+ ensureStripeTables(db);
1127
+ }
1128
+ create(accountId2, input) {
1129
+ const id = newId("balance_transaction");
1130
+ const now = nowUnix();
1131
+ const fee = input.fee ?? 0;
1132
+ const net = input.amount - fee;
1133
+ this.db.prepare(`INSERT INTO balance_transactions (
1134
+ id, account_id, type, amount, fee, net, currency, source_id, source_type,
1135
+ available_on, status, created
1136
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'available', ?)`).run(id, accountId2, input.type, input.amount, fee, net, input.currency, input.source_id ?? null, input.source_type ?? null, now, now);
1137
+ return this.requireById(accountId2, id);
1138
+ }
1139
+ getById(accountId2, id) {
1140
+ return this.db.prepare("SELECT * FROM balance_transactions WHERE id = ? AND account_id = ?").get(id, accountId2) ?? null;
1141
+ }
1142
+ requireById(accountId2, id) {
1143
+ const row = this.getById(accountId2, id);
1144
+ if (!row) {
1145
+ throw new TwinError("invalid_request_error", "resource_missing", `No such balance_transaction: '${id}'.`, { param: "balance_transaction", statusCode: 404 });
1146
+ }
1147
+ return row;
1148
+ }
1149
+ list(accountId2, input) {
1150
+ return listPaginated(this.db, "balance_transactions", accountId2, input);
1151
+ }
1152
+ /**
1153
+ * Compute current balance grouped by currency. v1 deviation: we lump
1154
+ * everything into `available`; `pending` is always [].
1155
+ */
1156
+ current(accountId2) {
1157
+ const rows = this.db.prepare("SELECT currency, COALESCE(SUM(net), 0) AS amount FROM balance_transactions WHERE account_id = ? GROUP BY currency").all(accountId2);
1158
+ const available = rows.map((row) => ({
1159
+ currency: row.currency,
1160
+ amount: row.amount,
1161
+ source_types: { card: 0 }
1162
+ }));
1163
+ return { available, pending: [] };
1164
+ }
1165
+ /** Count balance txns for a given source (PI). Used by concurrency test. */
1166
+ countForSource(accountId2, sourceId) {
1167
+ const row = this.db.prepare("SELECT COUNT(*) as n FROM balance_transactions WHERE source_id = ? AND account_id = ?").get(sourceId, accountId2);
1168
+ return row.n;
1169
+ }
1170
+ /** Sum of all `net` amounts. Used by concurrency test (assert total == PI amount). */
1171
+ totalNet(accountId2, currency = "usd") {
1172
+ const row = this.db.prepare("SELECT COALESCE(SUM(net), 0) AS total FROM balance_transactions WHERE currency = ? AND account_id = ?").get(currency, accountId2);
1173
+ return row.total;
1174
+ }
1175
+ };
1176
+
1177
+ // ../packages/twin-stripe/dist/src/domain/events.js
1178
+ var EventsDomain = class {
1179
+ db;
1180
+ constructor(db) {
1181
+ this.db = db;
1182
+ ensureStripeTables(db);
1183
+ }
1184
+ create(accountId2, input) {
1185
+ const id = newId("event");
1186
+ const now = nowUnix();
1187
+ this.db.prepare(`INSERT INTO events (
1188
+ id, account_id, type, data_json, request_idempotency_key, livemode,
1189
+ api_version, created
1190
+ ) VALUES (?, ?, ?, ?, ?, 0, ?, ?)`).run(id, accountId2, input.type, JSON.stringify({ object: input.object }), input.request_idempotency_key ?? null, STRIPE_API_VERSION, now);
1191
+ return this.requireById(accountId2, id);
1192
+ }
1193
+ getById(accountId2, id) {
1194
+ return this.db.prepare("SELECT * FROM events WHERE id = ? AND account_id = ?").get(id, accountId2) ?? null;
1195
+ }
1196
+ requireById(accountId2, id) {
1197
+ const row = this.getById(accountId2, id);
1198
+ if (!row) {
1199
+ throw new TwinError("invalid_request_error", "resource_missing", `No such event: '${id}'.`, { param: "event", statusCode: 404 });
1200
+ }
1201
+ return row;
1202
+ }
1203
+ list(accountId2, input) {
1204
+ return listPaginated(this.db, "events", accountId2, input);
1205
+ }
1206
+ };
1207
+
1208
+ // ../packages/twin-stripe/dist/src/domain/refunds.js
1209
+ var RefundsDomain = class {
1210
+ db;
1211
+ constructor(db) {
1212
+ this.db = db;
1213
+ ensureStripeTables(db);
1214
+ }
1215
+ /**
1216
+ * Create a refund against an existing charge. The INSERT into `refunds`
1217
+ * and the UPDATE of `charges.amount_refunded` run inside a single
1218
+ * better-sqlite3 transaction (synchronous + atomic). Returns the new
1219
+ * refund row alongside the post-update charge row so the route can
1220
+ * emit the recorder `state_delta`.
1221
+ */
1222
+ create(accountId2, input) {
1223
+ if (!input.charge) {
1224
+ throw new TwinError("invalid_request_error", "parameter_missing", "Missing required param: charge.", { param: "charge", statusCode: 400 });
1225
+ }
1226
+ if (input.amount !== void 0) {
1227
+ if (!Number.isInteger(input.amount) || input.amount <= 0) {
1228
+ throw new TwinError("invalid_request_error", "parameter_invalid_integer", "Amount must be a positive integer.", { param: "amount", statusCode: 400 });
1229
+ }
1230
+ }
1231
+ const tx = this.db.transaction(() => {
1232
+ const charge = this.requireCharge(accountId2, input.charge);
1233
+ if (charge.status !== "succeeded") {
1234
+ throw new TwinError("invalid_request_error", "charge_not_refundable", `This charge (${charge.id}) has a status of '${charge.status}' and cannot be refunded.`, { param: "charge", statusCode: 400 });
1235
+ }
1236
+ const refundable = charge.amount - charge.amount_refunded;
1237
+ const amount = input.amount ?? refundable;
1238
+ if (amount <= 0 || amount > refundable) {
1239
+ throw new TwinError("invalid_request_error", "charge_already_refunded", amount <= 0 ? "Refund amount must be positive." : `Refund amount exceeds the remaining refundable balance of ${refundable}.`, { param: "amount", statusCode: 400 });
1240
+ }
1241
+ const id = newId("refund");
1242
+ const now = nowUnix();
1243
+ this.db.prepare(`INSERT INTO refunds (
1244
+ id, account_id, charge_id, payment_intent_id, amount, currency,
1245
+ status, reason, idempotency_key, created
1246
+ ) VALUES (?, ?, ?, ?, ?, ?, 'succeeded', ?, ?, ?)`).run(id, accountId2, charge.id, charge.payment_intent_id, amount, charge.currency, input.reason ?? null, input.idempotency_key ?? null, now);
1247
+ this.db.prepare("UPDATE charges SET amount_refunded = amount_refunded + ? WHERE id = ? AND account_id = ?").run(amount, charge.id, accountId2);
1248
+ const row = this.requireById(accountId2, id);
1249
+ const updatedCharge = this.requireCharge(accountId2, charge.id);
1250
+ return { row, charge: updatedCharge };
1251
+ });
1252
+ return tx();
1253
+ }
1254
+ /**
1255
+ * Backfill the ledger link after StripeDomain mints the refund's balance
1256
+ * transaction (the txn needs the refund row's id/amount first, so the two
1257
+ * inserts can't be reordered). Runs inside the coordinator's transaction.
1258
+ */
1259
+ linkBalanceTransaction(accountId2, id, balanceTransactionId) {
1260
+ this.db.prepare("UPDATE refunds SET balance_transaction_id = ? WHERE id = ? AND account_id = ?").run(balanceTransactionId, id, accountId2);
1261
+ return this.requireById(accountId2, id);
1262
+ }
1263
+ getById(accountId2, id) {
1264
+ return this.db.prepare("SELECT * FROM refunds WHERE id = ? AND account_id = ?").get(id, accountId2) ?? null;
1265
+ }
1266
+ requireById(accountId2, id) {
1267
+ const row = this.getById(accountId2, id);
1268
+ if (!row) {
1269
+ throw new TwinError("invalid_request_error", "resource_missing", `No such refund: '${id}'.`, { param: "refund", statusCode: 404 });
1270
+ }
1271
+ return row;
1272
+ }
1273
+ list(accountId2, input) {
1274
+ if (input.charge) {
1275
+ const wide = listPaginated(this.db, "refunds", accountId2, input);
1276
+ const filtered = wide.rows.filter((r) => r.charge_id === input.charge);
1277
+ return { rows: filtered, hasMore: wide.hasMore, limit: wide.limit };
1278
+ }
1279
+ return listPaginated(this.db, "refunds", accountId2, input);
1280
+ }
1281
+ requireCharge(accountId2, id) {
1282
+ const row = this.db.prepare("SELECT * FROM charges WHERE id = ? AND account_id = ?").get(id, accountId2);
1283
+ if (!row) {
1284
+ throw new TwinError("invalid_request_error", "resource_missing", `No such charge: '${id}'.`, { param: "charge", statusCode: 404 });
1285
+ }
1286
+ return row;
1287
+ }
1288
+ };
1289
+
1290
+ // ../packages/twin-stripe/dist/src/domain/customers.js
1291
+ var CustomersDomain = class {
1292
+ db;
1293
+ constructor(db) {
1294
+ this.db = db;
1295
+ ensureStripeTables(db);
1296
+ }
1297
+ create(accountId2, input) {
1298
+ const id = newId("customer");
1299
+ const metadata = {};
1300
+ for (const [key, value] of Object.entries(input.metadata ?? {})) {
1301
+ if (value !== null && value !== "")
1302
+ metadata[key] = value;
1303
+ }
1304
+ this.db.prepare(`INSERT INTO customers (
1305
+ id, account_id, name, email, description, phone, metadata_json, deleted, created
1306
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, 0, ?)`).run(id, accountId2, input.name ?? null, input.email ?? null, input.description ?? null, input.phone ?? null, JSON.stringify(metadata), nowUnix());
1307
+ return this.requireById(accountId2, id);
1308
+ }
1309
+ getById(accountId2, id) {
1310
+ return this.db.prepare("SELECT * FROM customers WHERE id = ? AND account_id = ?").get(id, accountId2) ?? null;
1311
+ }
1312
+ /** Any row, deleted or live. Missing id → Stripe's 404 resource_missing. */
1313
+ requireById(accountId2, id) {
1314
+ const row = this.getById(accountId2, id);
1315
+ if (!row)
1316
+ throw noSuchCustomer(id);
1317
+ return row;
1318
+ }
1319
+ /** Live row only. Deleted customers 404 for writes and sub-resources. */
1320
+ requireLive(accountId2, id) {
1321
+ const row = this.requireById(accountId2, id);
1322
+ if (row.deleted)
1323
+ throw noSuchCustomer(id);
1324
+ return row;
1325
+ }
1326
+ /**
1327
+ * Update fields; metadata merges per-key, an empty/null value unsets the
1328
+ * key (real Stripe's metadata contract).
1329
+ */
1330
+ update(accountId2, id, input) {
1331
+ const existing = this.requireLive(accountId2, id);
1332
+ const metadata = JSON.parse(existing.metadata_json);
1333
+ for (const [key, value] of Object.entries(input.metadata ?? {})) {
1334
+ if (value === null || value === "")
1335
+ delete metadata[key];
1336
+ else
1337
+ metadata[key] = value;
1338
+ }
1339
+ this.db.prepare(`UPDATE customers SET name = ?, email = ?, description = ?, phone = ?, metadata_json = ?
1340
+ WHERE id = ? AND account_id = ?`).run(input.name !== void 0 ? input.name : existing.name, input.email !== void 0 ? input.email : existing.email, input.description !== void 0 ? input.description : existing.description, input.phone !== void 0 ? input.phone : existing.phone, JSON.stringify(metadata), id, accountId2);
1341
+ return this.requireById(accountId2, id);
1342
+ }
1343
+ /**
1344
+ * Soft-delete. Detaches the customer's payment methods in the same
1345
+ * transaction (real Stripe invalidates them on customer deletion).
1346
+ * Idempotent: deleting an already-deleted customer returns the row.
1347
+ */
1348
+ delete(accountId2, id) {
1349
+ const tx = this.db.transaction(() => {
1350
+ const existing = this.requireById(accountId2, id);
1351
+ if (existing.deleted)
1352
+ return { row: existing, alreadyDeleted: true };
1353
+ this.db.prepare("UPDATE customers SET deleted = 1 WHERE id = ? AND account_id = ?").run(id, accountId2);
1354
+ this.db.prepare("UPDATE payment_methods SET customer_id = NULL, detached = 1 WHERE customer_id = ? AND account_id = ?").run(id, accountId2);
1355
+ return { row: this.requireById(accountId2, id), alreadyDeleted: false };
1356
+ });
1357
+ return tx();
1358
+ }
1359
+ list(accountId2, input) {
1360
+ const extra = [{ sql: "deleted = 0", args: [] }];
1361
+ if (input.email)
1362
+ extra.push({ sql: "email = ?", args: [input.email] });
1363
+ return listPaginated(this.db, "customers", accountId2, input, extra);
1364
+ }
1365
+ };
1366
+ function noSuchCustomer(id) {
1367
+ return new TwinError("invalid_request_error", "resource_missing", `No such customer: '${id}'.`, { param: "customer", statusCode: 404 });
1368
+ }
1369
+
1370
+ // ../packages/twin-stripe/dist/src/domain/billing.js
1371
+ var BillingDomain = class {
1372
+ db;
1373
+ constructor(db) {
1374
+ this.db = db;
1375
+ ensureStripeTables(db);
1376
+ }
1377
+ // ---------- Products ----------
1378
+ createProduct(accountId2, input) {
1379
+ if (!input.name)
1380
+ throw missingParam("name");
1381
+ const now = nowUnix();
1382
+ const id = newId("product");
1383
+ this.db.prepare(`INSERT INTO products (id, account_id, name, description, active, metadata_json, created, updated)
1384
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)`).run(id, accountId2, input.name, input.description ?? null, input.active === false ? 0 : 1, JSON.stringify(liveMetadata(input.metadata)), now, now);
1385
+ return this.requireProduct(accountId2, id);
1386
+ }
1387
+ requireProduct(accountId2, id) {
1388
+ const row = this.db.prepare("SELECT * FROM products WHERE id = ? AND account_id = ?").get(id, accountId2);
1389
+ if (!row)
1390
+ throw noSuch("product", id);
1391
+ return row;
1392
+ }
1393
+ listProducts(accountId2, input) {
1394
+ const extra = [];
1395
+ if (input.active !== void 0) {
1396
+ extra.push({ sql: "active = ?", args: [input.active ? 1 : 0] });
1397
+ }
1398
+ return listPaginated(this.db, "products", accountId2, input, extra);
1399
+ }
1400
+ // ---------- Prices ----------
1401
+ createPrice(accountId2, input) {
1402
+ if (!input.currency)
1403
+ throw missingParam("currency");
1404
+ if (!input.product)
1405
+ throw missingParam("product");
1406
+ this.requireProduct(accountId2, input.product);
1407
+ const id = newId("price");
1408
+ this.db.prepare(`INSERT INTO prices (
1409
+ id, account_id, product_id, currency, unit_amount, recurring_interval,
1410
+ recurring_interval_count, active, nickname, lookup_key, metadata_json, created
1411
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(id, accountId2, input.product, input.currency.toLowerCase(), input.unit_amount ?? null, input.recurring?.interval ?? null, input.recurring ? input.recurring.interval_count ?? 1 : null, input.active === false ? 0 : 1, input.nickname ?? null, input.lookup_key ?? null, JSON.stringify(liveMetadata(input.metadata)), nowUnix());
1412
+ return this.requirePrice(accountId2, id);
1413
+ }
1414
+ requirePrice(accountId2, id) {
1415
+ const row = this.db.prepare("SELECT * FROM prices WHERE id = ? AND account_id = ?").get(id, accountId2);
1416
+ if (!row)
1417
+ throw noSuch("price", id);
1418
+ return row;
1419
+ }
1420
+ listPrices(accountId2, input) {
1421
+ const extra = [];
1422
+ if (input.product)
1423
+ extra.push({ sql: "product_id = ?", args: [input.product] });
1424
+ if (input.active !== void 0) {
1425
+ extra.push({ sql: "active = ?", args: [input.active ? 1 : 0] });
1426
+ }
1427
+ return listPaginated(this.db, "prices", accountId2, input, extra);
1428
+ }
1429
+ // ---------- Subscriptions ----------
1430
+ createSubscription(accountId2, input) {
1431
+ if (!input.customer)
1432
+ throw missingParam("customer");
1433
+ if (!Array.isArray(input.items) || input.items.length === 0) {
1434
+ throw missingParam("items");
1435
+ }
1436
+ const items = input.items.map((item, index) => {
1437
+ if (!item.price)
1438
+ throw missingParam(`items[${index}][price]`);
1439
+ this.requirePrice(accountId2, item.price);
1440
+ return {
1441
+ id: newId("subscription_item"),
1442
+ price: item.price,
1443
+ quantity: item.quantity ?? 1
1444
+ };
1445
+ });
1446
+ const id = newId("subscription");
1447
+ this.db.prepare(`INSERT INTO subscriptions (
1448
+ id, account_id, customer_id, status, items_json, cancel_at_period_end,
1449
+ canceled_at, ended_at, metadata_json, created
1450
+ ) VALUES (?, ?, ?, 'active', ?, ?, NULL, NULL, ?, ?)`).run(id, accountId2, input.customer, JSON.stringify(items), input.cancel_at_period_end ? 1 : 0, JSON.stringify(liveMetadata(input.metadata)), nowUnix());
1451
+ return this.requireSubscription(accountId2, id);
1452
+ }
1453
+ requireSubscription(accountId2, id) {
1454
+ const row = this.db.prepare("SELECT * FROM subscriptions WHERE id = ? AND account_id = ?").get(id, accountId2);
1455
+ if (!row)
1456
+ throw noSuch("subscription", id);
1457
+ return row;
1458
+ }
1459
+ /**
1460
+ * Update: metadata merges per-key (empty/null unsets — Stripe's metadata
1461
+ * contract, same as customers), cancel_at_period_end flips. A canceled
1462
+ * subscription accepts metadata-only updates and refuses everything else,
1463
+ * like real Stripe.
1464
+ */
1465
+ updateSubscription(accountId2, id, input) {
1466
+ const existing = this.requireSubscription(accountId2, id);
1467
+ if (existing.status === "canceled" && input.cancel_at_period_end !== void 0) {
1468
+ throw new TwinError("invalid_request_error", "subscription_canceled", "You cannot update a subscription that is `canceled` or `incomplete_expired`.", { param: "subscription", statusCode: 400 });
1469
+ }
1470
+ const metadata = JSON.parse(existing.metadata_json);
1471
+ for (const [key, value] of Object.entries(input.metadata ?? {})) {
1472
+ if (value === null || value === "")
1473
+ delete metadata[key];
1474
+ else
1475
+ metadata[key] = value;
1476
+ }
1477
+ this.db.prepare("UPDATE subscriptions SET cancel_at_period_end = ?, metadata_json = ? WHERE id = ? AND account_id = ?").run(input.cancel_at_period_end === void 0 ? existing.cancel_at_period_end : input.cancel_at_period_end ? 1 : 0, JSON.stringify(metadata), id, accountId2);
1478
+ return this.requireSubscription(accountId2, id);
1479
+ }
1480
+ /**
1481
+ * DELETE /v1/subscriptions/:id — immediate cancel: status → canceled with
1482
+ * canceled_at/ended_at stamped. Idempotent (re-cancel returns the row);
1483
+ * shape tier, so no invoice settlement or proration runs.
1484
+ */
1485
+ cancelSubscription(accountId2, id) {
1486
+ const existing = this.requireSubscription(accountId2, id);
1487
+ if (existing.status === "canceled")
1488
+ return existing;
1489
+ const now = nowUnix();
1490
+ this.db.prepare("UPDATE subscriptions SET status = 'canceled', canceled_at = ?, ended_at = ? WHERE id = ? AND account_id = ?").run(now, now, id, accountId2);
1491
+ return this.requireSubscription(accountId2, id);
1492
+ }
1493
+ /**
1494
+ * Like real Stripe, the default list excludes canceled subscriptions;
1495
+ * `status=canceled` selects them and `status=all` lifts the filter.
1496
+ */
1497
+ listSubscriptions(accountId2, input) {
1498
+ const extra = [];
1499
+ if (input.customer)
1500
+ extra.push({ sql: "customer_id = ?", args: [input.customer] });
1501
+ if (input.status === void 0) {
1502
+ extra.push({ sql: "status != 'canceled'", args: [] });
1503
+ } else if (input.status !== "all") {
1504
+ extra.push({ sql: "status = ?", args: [input.status] });
1505
+ }
1506
+ return listPaginated(this.db, "subscriptions", accountId2, input, extra);
1507
+ }
1508
+ };
1509
+ function liveMetadata(metadata) {
1510
+ const out = {};
1511
+ for (const [key, value] of Object.entries(metadata ?? {})) {
1512
+ if (value !== null && value !== "")
1513
+ out[key] = value;
1514
+ }
1515
+ return out;
1516
+ }
1517
+ function missingParam(param) {
1518
+ return new TwinError("invalid_request_error", "parameter_missing", `Missing required param: ${param}.`, { param, statusCode: 400 });
1519
+ }
1520
+ function noSuch(kind, id) {
1521
+ return new TwinError("invalid_request_error", "resource_missing", `No such ${kind}: '${id}'.`, { param: kind, statusCode: 404 });
1522
+ }
1523
+
1524
+ // ../packages/twin-stripe/dist/src/serializers.js
1525
+ function paymentIntentJson(row) {
1526
+ const types = piTypes(row);
1527
+ const wireLift = {
1528
+ payment_method_options: types.includes("card") ? {
1529
+ card: {
1530
+ installments: null,
1531
+ mandate_options: null,
1532
+ network: null,
1533
+ request_three_d_secure: "automatic"
1534
+ }
1535
+ } : {
1536
+ crypto: {
1537
+ mode: "deposit",
1538
+ deposit_options: { networks: ["base"] }
1539
+ }
1540
+ },
1541
+ invoice: null
1542
+ };
1543
+ return {
1544
+ id: row.id,
1545
+ object: "payment_intent",
1546
+ amount: row.amount,
1547
+ amount_capturable: 0,
1548
+ amount_received: row.status === "succeeded" ? row.amount : 0,
1549
+ amount_details: { tip: {} },
1550
+ application: null,
1551
+ application_fee_amount: null,
1552
+ automatic_payment_methods: null,
1553
+ canceled_at: row.canceled_at,
1554
+ cancellation_reason: null,
1555
+ // Twin row columns carry the literal Stripe values; the row type is a free
1556
+ // `string`. Narrow to the upstream literal union for the type anchor only
1557
+ // (FDRS-454: the twin faithfully emits a real upstream value), runtime unchanged.
1558
+ capture_method: row.capture_method,
1559
+ client_secret: row.client_secret,
1560
+ confirmation_method: row.confirmation_method,
1561
+ created: row.created,
1562
+ currency: row.currency,
1563
+ customer: row.customer_id,
1564
+ description: null,
1565
+ // Card declines (F-731): the last failed attempt, parsed from the row.
1566
+ // The stored blob is Stripe's LastPaymentError shape; narrow for the
1567
+ // type anchor only (FDRS-454), runtime unchanged.
1568
+ last_payment_error: parseJson(row.last_payment_error_json, null),
1569
+ latest_charge: row.latest_charge_id,
1570
+ livemode: false,
1571
+ metadata: parseJson(row.metadata_json, {}),
1572
+ next_action: row.status === "requires_action" ? parseJson(row.next_action_json, null) : null,
1573
+ on_behalf_of: null,
1574
+ payment_method: row.payment_method_id,
1575
+ payment_method_configuration_details: null,
1576
+ payment_method_types: types,
1577
+ processing: null,
1578
+ receipt_email: null,
1579
+ review: null,
1580
+ setup_future_usage: null,
1581
+ shipping: null,
1582
+ statement_descriptor: null,
1583
+ statement_descriptor_suffix: null,
1584
+ status: row.status,
1585
+ transfer_data: null,
1586
+ transfer_group: null,
1587
+ ...wireLift
1588
+ };
1589
+ }
1590
+ function chargeJson(row) {
1591
+ const wireLift = { invoice: null };
1592
+ const failed = row.status === "failed";
1593
+ const paymentMethodDetails = parseJson(row.payment_method_details_json, {
1594
+ type: "crypto",
1595
+ crypto: {
1596
+ // Upstream `Charge.PaymentMethodDetails.Crypto.{buyer_address,transaction_hash}`
1597
+ // are `string | undefined`; the twin surfaces `null` pre-settlement (no
1598
+ // on-chain tx yet). Narrow the pre-resolution null for the type anchor only
1599
+ // (FDRS-454), runtime value (null) unchanged.
1600
+ buyer_address: null,
1601
+ network: "base",
1602
+ token_currency: "usdc",
1603
+ transaction_hash: null
1604
+ }
1605
+ });
1606
+ return {
1607
+ id: row.id,
1608
+ object: "charge",
1609
+ amount: row.amount,
1610
+ amount_captured: row.amount_captured,
1611
+ amount_refunded: row.amount_refunded,
1612
+ application: null,
1613
+ application_fee: null,
1614
+ application_fee_amount: null,
1615
+ balance_transaction: row.balance_transaction_id,
1616
+ billing_details: {
1617
+ address: { city: null, country: null, line1: null, line2: null, postal_code: null, state: null },
1618
+ email: null,
1619
+ name: null,
1620
+ phone: null
1621
+ },
1622
+ calculated_statement_descriptor: null,
1623
+ captured: Boolean(row.captured),
1624
+ created: row.created,
1625
+ currency: row.currency,
1626
+ customer: row.customer_id,
1627
+ description: null,
1628
+ disputed: false,
1629
+ failure_balance_transaction: null,
1630
+ // Twin failure columns carry Stripe's literal decline codes; the row
1631
+ // type is a free `string`. Narrow for the type anchor only (FDRS-454).
1632
+ failure_code: row.failure_code,
1633
+ failure_message: row.failure_message,
1634
+ fraud_details: {},
1635
+ livemode: false,
1636
+ metadata: {},
1637
+ on_behalf_of: null,
1638
+ outcome: failed ? {
1639
+ network_status: "declined_by_network",
1640
+ reason: row.failure_decline_code,
1641
+ risk_level: "normal",
1642
+ seller_message: "The bank did not return any further details with this decline.",
1643
+ type: "issuer_declined"
1644
+ } : {
1645
+ network_status: "approved_by_network",
1646
+ reason: null,
1647
+ risk_level: "normal",
1648
+ seller_message: "Payment complete.",
1649
+ type: "authorized"
1650
+ },
1651
+ paid: row.status === "succeeded",
1652
+ payment_intent: row.payment_intent_id,
1653
+ payment_method: row.payment_method_id,
1654
+ // Stored blob is spec-faithful (built from the PM row at mint time);
1655
+ // narrow for the type anchor only (FDRS-454).
1656
+ payment_method_details: paymentMethodDetails,
1657
+ receipt_email: null,
1658
+ receipt_number: null,
1659
+ receipt_url: null,
1660
+ // Stripe semantics: `refunded` is true iff the charge is FULLY refunded.
1661
+ // Partial refunds leave `amount_refunded > 0` but `refunded === false`.
1662
+ refunded: row.amount_refunded >= row.amount,
1663
+ review: null,
1664
+ shipping: null,
1665
+ source_transfer: null,
1666
+ statement_descriptor: null,
1667
+ statement_descriptor_suffix: null,
1668
+ status: row.status,
1669
+ transfer_data: null,
1670
+ transfer_group: null,
1671
+ ...wireLift
1672
+ };
1673
+ }
1674
+ function refundJson(row) {
1675
+ return {
1676
+ id: row.id,
1677
+ object: "refund",
1678
+ amount: row.amount,
1679
+ balance_transaction: row.balance_transaction_id,
1680
+ charge: row.charge_id,
1681
+ created: row.created,
1682
+ currency: row.currency,
1683
+ metadata: {},
1684
+ payment_intent: row.payment_intent_id,
1685
+ // Twin row `reason` is a free `string`; upstream `Refund.Reason` is a literal
1686
+ // union. Narrow for the type anchor only (FDRS-454), runtime unchanged.
1687
+ reason: row.reason,
1688
+ receipt_number: null,
1689
+ source_transfer_reversal: null,
1690
+ status: row.status,
1691
+ transfer_reversal: null
1692
+ };
1693
+ }
1694
+ function customerJson(row) {
1695
+ return {
1696
+ id: row.id,
1697
+ object: "customer",
1698
+ address: null,
1699
+ balance: 0,
1700
+ created: row.created,
1701
+ currency: null,
1702
+ default_source: null,
1703
+ delinquent: false,
1704
+ description: row.description,
1705
+ discount: null,
1706
+ email: row.email,
1707
+ invoice_settings: {
1708
+ custom_fields: null,
1709
+ default_payment_method: null,
1710
+ footer: null,
1711
+ rendering_options: null
1712
+ },
1713
+ livemode: false,
1714
+ metadata: parseJson(row.metadata_json, {}),
1715
+ name: row.name,
1716
+ phone: row.phone,
1717
+ preferred_locales: [],
1718
+ shipping: null,
1719
+ tax_exempt: "none",
1720
+ test_clock: null
1721
+ };
1722
+ }
1723
+ function deletedCustomerJson(row) {
1724
+ return {
1725
+ id: row.id,
1726
+ object: "customer",
1727
+ deleted: true
1728
+ };
1729
+ }
1730
+ function cardJson(row) {
1731
+ return {
1732
+ brand: row.card_brand,
1733
+ exp_month: row.card_exp_month,
1734
+ exp_year: row.card_exp_year,
1735
+ fingerprint: row.card_fingerprint,
1736
+ funding: "credit",
1737
+ last4: row.card_last4
1738
+ };
1739
+ }
1740
+ function paymentMethodJson(row) {
1741
+ return {
1742
+ id: row.id,
1743
+ object: "payment_method",
1744
+ billing_details: {
1745
+ address: { city: null, country: null, line1: null, line2: null, postal_code: null, state: null },
1746
+ email: null,
1747
+ name: null,
1748
+ phone: null
1749
+ },
1750
+ card: cardJson(row),
1751
+ created: row.created,
1752
+ customer: row.customer_id,
1753
+ livemode: false,
1754
+ metadata: {},
1755
+ // Twin row `type` is a free `string`; upstream `PaymentMethod.type` is a
1756
+ // literal union. Narrow for the type anchor only (FDRS-454), runtime
1757
+ // value ("card") unchanged.
1758
+ type: row.type
1759
+ };
1760
+ }
1761
+ function balanceTransactionJson(row) {
1762
+ return {
1763
+ id: row.id,
1764
+ object: "balance_transaction",
1765
+ amount: row.amount,
1766
+ available_on: row.available_on,
1767
+ created: row.created,
1768
+ currency: row.currency,
1769
+ description: null,
1770
+ exchange_rate: null,
1771
+ fee: row.fee,
1772
+ fee_details: [],
1773
+ net: row.net,
1774
+ reporting_category: row.type,
1775
+ source: row.source_id,
1776
+ status: row.status,
1777
+ // Upstream `BalanceTransaction.Type` is a literal union; the twin's ledger
1778
+ // `type` column is a free `string` (carries the x402 deposit categories).
1779
+ // Narrow for the type anchor only (FDRS-454), runtime value unchanged.
1780
+ type: row.type
1781
+ };
1782
+ }
1783
+ function eventJson(row) {
1784
+ const parsedData = parseJson(row.data_json, { object: null });
1785
+ return {
1786
+ id: row.id,
1787
+ object: "event",
1788
+ api_version: row.api_version,
1789
+ created: row.created,
1790
+ // LIFT (ST-DIV-014): the twin stores the event payload as an opaque parsed
1791
+ // JSON blob (`data.object: unknown`); upstream `Event.Data.object` is a typed
1792
+ // resource union. Narrow for the type anchor only (FDRS-454), runtime unchanged.
1793
+ data: parsedData,
1794
+ livemode: Boolean(row.livemode),
1795
+ pending_webhooks: 0,
1796
+ request: {
1797
+ id: null,
1798
+ idempotency_key: row.request_idempotency_key
1799
+ },
1800
+ // LIFT (ST-DIV-014): twin emits a free `string`; official `EventBase.type`
1801
+ // is the `Event.Type` literal union. Narrow for the anchor only (FDRS-454).
1802
+ type: row.type
1803
+ };
1804
+ }
1805
+ function productJson(row) {
1806
+ return {
1807
+ id: row.id,
1808
+ object: "product",
1809
+ active: Boolean(row.active),
1810
+ created: row.created,
1811
+ default_price: null,
1812
+ description: row.description,
1813
+ images: [],
1814
+ livemode: false,
1815
+ marketing_features: [],
1816
+ metadata: parseJson(row.metadata_json, {}),
1817
+ name: row.name,
1818
+ package_dimensions: null,
1819
+ shippable: null,
1820
+ tax_code: null,
1821
+ type: "service",
1822
+ unit_label: null,
1823
+ updated: row.updated,
1824
+ url: null
1825
+ };
1826
+ }
1827
+ function priceJson(row) {
1828
+ const recurring = row.recurring_interval ? {
1829
+ // Twin row `recurring_interval` is a free `string`; upstream
1830
+ // `Price.Recurring.interval` is a literal union. Narrow for the type
1831
+ // anchor only (FDRS-454), runtime unchanged.
1832
+ interval: row.recurring_interval,
1833
+ interval_count: row.recurring_interval_count ?? 1,
1834
+ meter: null,
1835
+ usage_type: "licensed"
1836
+ } : null;
1837
+ return {
1838
+ id: row.id,
1839
+ object: "price",
1840
+ active: Boolean(row.active),
1841
+ billing_scheme: "per_unit",
1842
+ created: row.created,
1843
+ currency: row.currency,
1844
+ custom_unit_amount: null,
1845
+ livemode: false,
1846
+ lookup_key: row.lookup_key,
1847
+ metadata: parseJson(row.metadata_json, {}),
1848
+ nickname: row.nickname,
1849
+ product: row.product_id,
1850
+ recurring,
1851
+ tax_behavior: "unspecified",
1852
+ tiers_mode: null,
1853
+ transform_quantity: null,
1854
+ type: recurring ? "recurring" : "one_time",
1855
+ unit_amount: row.unit_amount,
1856
+ unit_amount_decimal: row.unit_amount === null ? null : String(row.unit_amount)
1857
+ };
1858
+ }
1859
+ function subscriptionJson(row, itemPrices) {
1860
+ const items = parseJson(row.items_json, []);
1861
+ const firstPrice = items[0] ? itemPrices.get(items[0].price) : void 0;
1862
+ const itemsData = items.map((item) => {
1863
+ const price = itemPrices.get(item.price);
1864
+ return {
1865
+ id: item.id,
1866
+ object: "subscription_item",
1867
+ created: row.created,
1868
+ metadata: {},
1869
+ // Anchor bridge: every stored item price resolves (referential check at
1870
+ // create time); the Map lookup type keeps `undefined` in the signature.
1871
+ price: price ? priceJson(price) : void 0,
1872
+ quantity: item.quantity,
1873
+ subscription: row.id
1874
+ };
1875
+ });
1876
+ return {
1877
+ id: row.id,
1878
+ object: "subscription",
1879
+ billing_cycle_anchor: row.created,
1880
+ cancel_at: null,
1881
+ cancel_at_period_end: Boolean(row.cancel_at_period_end),
1882
+ canceled_at: row.canceled_at,
1883
+ collection_method: "charge_automatically",
1884
+ created: row.created,
1885
+ currency: firstPrice?.currency ?? "usd",
1886
+ customer: row.customer_id,
1887
+ days_until_due: null,
1888
+ default_payment_method: null,
1889
+ description: null,
1890
+ ended_at: row.ended_at,
1891
+ items: {
1892
+ object: "list",
1893
+ data: itemsData,
1894
+ has_more: false,
1895
+ url: `/v1/subscription_items?subscription=${row.id}`
1896
+ },
1897
+ latest_invoice: null,
1898
+ livemode: false,
1899
+ metadata: parseJson(row.metadata_json, {}),
1900
+ start_date: row.created,
1901
+ status: row.status,
1902
+ trial_end: null,
1903
+ trial_start: null
1904
+ };
1905
+ }
1906
+ function serializedList(data, hasMore, _limit, url) {
1907
+ const envelope = {
1908
+ object: "list",
1909
+ data,
1910
+ has_more: hasMore,
1911
+ url
1912
+ };
1913
+ return envelope;
1914
+ }
1915
+ function balanceJson(available, pending) {
1916
+ return {
1917
+ object: "balance",
1918
+ // The twin's per-currency balance entries are spec-faithful {amount, currency}
1919
+ // shapes; bridge the domain layer's opaque arrays to the upstream entry type.
1920
+ available,
1921
+ pending,
1922
+ livemode: false
1923
+ };
1924
+ }
1925
+ function parseJson(value, fallback) {
1926
+ if (!value)
1927
+ return fallback;
1928
+ try {
1929
+ return JSON.parse(value);
1930
+ } catch {
1931
+ return fallback;
1932
+ }
1933
+ }
1934
+
1935
+ // ../packages/twin-stripe/dist/src/domain/stripe-domain.js
1936
+ var StripeDomain = class {
1937
+ db;
1938
+ paymentIntents;
1939
+ charges;
1940
+ balance;
1941
+ events;
1942
+ refunds;
1943
+ customers;
1944
+ paymentMethods;
1945
+ billing;
1946
+ constructor(db) {
1947
+ this.db = db;
1948
+ ensureStripeTables(db);
1949
+ this.paymentIntents = new PaymentIntentsDomain(db);
1950
+ this.charges = new ChargesDomain(db);
1951
+ this.balance = new BalanceDomain(db);
1952
+ this.events = new EventsDomain(db);
1953
+ this.refunds = new RefundsDomain(db);
1954
+ this.customers = new CustomersDomain(db);
1955
+ this.paymentMethods = new PaymentMethodsDomain(db);
1956
+ this.billing = new BillingDomain(db);
1957
+ }
1958
+ /** Reset Stripe-domain state. Used by `/admin/reset`. */
1959
+ reset() {
1960
+ resetStripeTables(this.db);
1961
+ }
1962
+ // ---------- PI flows ----------
1963
+ createPaymentIntent(accountId2, input) {
1964
+ const isCard = Array.isArray(input.payment_method_types) && input.payment_method_types.length === 1 && input.payment_method_types[0] === "card";
1965
+ let resolved = {
1966
+ paymentMethodId: null,
1967
+ customerId: null
1968
+ };
1969
+ if (isCard) {
1970
+ const customerId = input.customer ? this.customers.requireLive(accountId2, input.customer).id : null;
1971
+ let paymentMethodId = null;
1972
+ if (input.payment_method) {
1973
+ const pm = this.paymentMethods.requireById(accountId2, input.payment_method);
1974
+ assertPMUsable(pm, customerId);
1975
+ paymentMethodId = pm.id;
1976
+ }
1977
+ resolved = { paymentMethodId, customerId };
1978
+ if (input.confirm && !resolved.paymentMethodId) {
1979
+ throw missingPaymentMethod();
1980
+ }
1981
+ }
1982
+ const pi = this.paymentIntents.create(accountId2, input, resolved);
1983
+ this.events.create(accountId2, { type: "payment_intent.created", object: paymentIntentJson(pi) });
1984
+ if (pi.status === "requires_action") {
1985
+ this.events.create(accountId2, {
1986
+ type: "payment_intent.requires_action",
1987
+ object: paymentIntentJson(pi)
1988
+ });
1989
+ }
1990
+ if (isCard && input.confirm) {
1991
+ const confirmed = this.confirmPaymentIntent(accountId2, pi.id);
1992
+ return {
1993
+ body: confirmed.body,
1994
+ delta: { before: null, after: confirmed.delta?.after ?? rowToRecord(pi) }
1995
+ };
1996
+ }
1997
+ return {
1998
+ body: paymentIntentJson(pi),
1999
+ delta: { before: null, after: rowToRecord(pi) }
2000
+ };
2001
+ }
2002
+ retrievePaymentIntent(accountId2, id) {
2003
+ return paymentIntentJson(this.paymentIntents.requireById(accountId2, id));
2004
+ }
2005
+ listPaymentIntents(accountId2, input) {
2006
+ const { rows, hasMore, limit } = this.paymentIntents.list(accountId2, input);
2007
+ return serializedList(rows.map(paymentIntentJson), hasMore, limit, "/v1/payment_intents");
2008
+ }
2009
+ confirmPaymentIntent(accountId2, id, opts = {}) {
2010
+ const before = this.paymentIntents.requireById(accountId2, id);
2011
+ if (!piTypes(before).includes("card")) {
2012
+ const pi = this.paymentIntents.confirm(accountId2, id);
2013
+ return {
2014
+ body: paymentIntentJson(pi),
2015
+ delta: { before: rowToRecord(before), after: rowToRecord(pi) }
2016
+ };
2017
+ }
2018
+ if (before.status !== "requires_confirmation" && before.status !== "requires_payment_method") {
2019
+ throw piUnexpectedState(before.status);
2020
+ }
2021
+ const pmId = (opts.payment_method || void 0) ?? before.payment_method_id;
2022
+ if (!pmId) {
2023
+ throw missingPaymentMethod();
2024
+ }
2025
+ const pm = this.paymentMethods.requireById(accountId2, pmId);
2026
+ assertPMUsable(pm, before.customer_id);
2027
+ const decline = declineForFingerprint(pm.card_fingerprint);
2028
+ const tx = this.db.transaction(() => {
2029
+ const inFlight = this.paymentIntents.confirmCardLeg1(accountId2, id, before.status, pm.id);
2030
+ const detailsJson = JSON.stringify(cardChargeDetails(pm));
2031
+ if (decline) {
2032
+ const failedCharge = this.charges.createForPI(accountId2, {
2033
+ payment_intent_id: id,
2034
+ amount: inFlight.amount,
2035
+ currency: inFlight.currency,
2036
+ payment_method_id: pm.id,
2037
+ payment_method_details_json: detailsJson,
2038
+ customer_id: inFlight.customer_id,
2039
+ status: "failed",
2040
+ failure_code: decline.code,
2041
+ failure_decline_code: decline.decline_code,
2042
+ failure_message: decline.message
2043
+ });
2044
+ const lastPaymentError = {
2045
+ type: "card_error",
2046
+ code: decline.code,
2047
+ decline_code: decline.decline_code,
2048
+ message: decline.message,
2049
+ payment_method: paymentMethodJson(pm)
2050
+ };
2051
+ const pi2 = this.paymentIntents.finalizeCardDecline(accountId2, id, failedCharge.id, JSON.stringify(lastPaymentError));
2052
+ this.events.create(accountId2, {
2053
+ type: "payment_intent.payment_failed",
2054
+ object: paymentIntentJson(pi2)
2055
+ });
2056
+ this.events.create(accountId2, {
2057
+ type: "charge.failed",
2058
+ object: chargeJson(failedCharge)
2059
+ });
2060
+ return { declined: decline, pi: pi2 };
2061
+ }
2062
+ const balanceTx = this.balance.create(accountId2, {
2063
+ type: "charge",
2064
+ amount: inFlight.amount,
2065
+ fee: 0,
2066
+ currency: inFlight.currency,
2067
+ source_id: id,
2068
+ source_type: "payment_intent"
2069
+ });
2070
+ const charge = this.charges.createForPI(accountId2, {
2071
+ payment_intent_id: id,
2072
+ amount: inFlight.amount,
2073
+ currency: inFlight.currency,
2074
+ balance_transaction_id: balanceTx.id,
2075
+ payment_method_id: pm.id,
2076
+ payment_method_details_json: detailsJson,
2077
+ customer_id: inFlight.customer_id
2078
+ });
2079
+ const pi = this.paymentIntents.finalizeCardSuccess(accountId2, id, charge.id);
2080
+ this.events.create(accountId2, {
2081
+ type: "payment_intent.succeeded",
2082
+ object: paymentIntentJson(pi)
2083
+ });
2084
+ this.events.create(accountId2, {
2085
+ type: "charge.succeeded",
2086
+ object: chargeJson(charge)
2087
+ });
2088
+ return { declined: null, pi };
2089
+ });
2090
+ const result = tx();
2091
+ if (result.declined) {
2092
+ throw new TwinError("card_error", result.declined.code, result.declined.message, {
2093
+ statusCode: 402,
2094
+ decline_code: result.declined.decline_code,
2095
+ payment_intent: paymentIntentJson(result.pi),
2096
+ state_mutation: true,
2097
+ state_delta: { before: rowToRecord(before), after: rowToRecord(result.pi) }
2098
+ });
2099
+ }
2100
+ return {
2101
+ body: paymentIntentJson(result.pi),
2102
+ delta: { before: rowToRecord(before), after: rowToRecord(result.pi) }
2103
+ };
2104
+ }
2105
+ /**
2106
+ * POST /v1/payment_intents/:id (F-731). The ruled retry-with-new-PM step:
2107
+ * metadata merges per-key, and attaching a PM moves the card PI back to
2108
+ * requires_confirmation. PM/customer resolution happens here so unknown
2109
+ * ids 404 with Stripe's resource_missing before any state gate fires.
2110
+ */
2111
+ updatePaymentIntent(accountId2, id, input) {
2112
+ const before = this.paymentIntents.requireById(accountId2, id);
2113
+ const resolved = {};
2114
+ if (input.customer !== void 0) {
2115
+ resolved.customerId = input.customer ? this.customers.requireLive(accountId2, input.customer).id : null;
2116
+ }
2117
+ const effectiveCustomerId = resolved.customerId !== void 0 ? resolved.customerId : before.customer_id;
2118
+ if (input.payment_method !== void 0) {
2119
+ if (input.payment_method) {
2120
+ const pm = this.paymentMethods.requireById(accountId2, input.payment_method);
2121
+ assertPMUsable(pm, effectiveCustomerId);
2122
+ resolved.paymentMethodId = pm.id;
2123
+ } else {
2124
+ resolved.paymentMethodId = null;
2125
+ }
2126
+ } else if (input.customer !== void 0 && before.payment_method_id) {
2127
+ assertPMUsable(this.paymentMethods.requireById(accountId2, before.payment_method_id), effectiveCustomerId);
2128
+ }
2129
+ const pi = this.paymentIntents.update(accountId2, id, input, resolved);
2130
+ return {
2131
+ body: paymentIntentJson(pi),
2132
+ delta: { before: rowToRecord(before), after: rowToRecord(pi) }
2133
+ };
2134
+ }
2135
+ cancelPaymentIntent(accountId2, id) {
2136
+ const before = this.paymentIntents.requireById(accountId2, id);
2137
+ if (before.status === "canceled") {
2138
+ return {
2139
+ body: paymentIntentJson(before),
2140
+ delta: { before: rowToRecord(before), after: rowToRecord(before) }
2141
+ };
2142
+ }
2143
+ const pi = this.paymentIntents.cancel(accountId2, id);
2144
+ this.events.create(accountId2, { type: "payment_intent.canceled", object: paymentIntentJson(pi) });
2145
+ return {
2146
+ body: paymentIntentJson(pi),
2147
+ delta: { before: rowToRecord(before), after: rowToRecord(pi) }
2148
+ };
2149
+ }
2150
+ /**
2151
+ * Drive a PI through requires_action → processing → succeeded.
2152
+ * Emits payment_intent.processing, payment_intent.succeeded,
2153
+ * charge.succeeded events. Mints exactly one charge + one
2154
+ * balance_transaction. CAS guarantees only one parallel caller wins.
2155
+ *
2156
+ * F2: the entire flow runs inside a single better-sqlite3 transaction.
2157
+ * If anything throws between Leg 1 and the final event emit, the
2158
+ * transaction rolls back — no orphan charges/balance txns and no PI
2159
+ * stuck in `processing`. better-sqlite3 transactions are synchronous
2160
+ * and atomic, and the CAS works inside the transaction the same way it
2161
+ * does outside it.
2162
+ */
2163
+ simulateCryptoDeposit(accountId2, id) {
2164
+ const before = this.paymentIntents.requireById(accountId2, id);
2165
+ const tx = this.db.transaction(() => {
2166
+ let pi = this.paymentIntents.simulateCryptoDepositLeg1(accountId2, id);
2167
+ this.events.create(accountId2, {
2168
+ type: "payment_intent.processing",
2169
+ object: paymentIntentJson(pi)
2170
+ });
2171
+ const balanceTx = this.balance.create(accountId2, {
2172
+ type: "charge",
2173
+ amount: pi.amount,
2174
+ fee: 0,
2175
+ currency: pi.currency,
2176
+ source_id: pi.id,
2177
+ source_type: "payment_intent"
2178
+ });
2179
+ const charge = this.charges.createForPI(accountId2, {
2180
+ payment_intent_id: pi.id,
2181
+ amount: pi.amount,
2182
+ currency: pi.currency,
2183
+ balance_transaction_id: balanceTx.id
2184
+ });
2185
+ pi = this.paymentIntents.simulateCryptoDepositLeg2(accountId2, id, charge.id);
2186
+ const finalCharge = this.charges.requireById(accountId2, charge.id);
2187
+ this.events.create(accountId2, {
2188
+ type: "payment_intent.succeeded",
2189
+ object: paymentIntentJson(pi)
2190
+ });
2191
+ this.events.create(accountId2, {
2192
+ type: "charge.succeeded",
2193
+ object: chargeJson(finalCharge)
2194
+ });
2195
+ return { body: paymentIntentJson(pi), after: pi };
2196
+ });
2197
+ const result = tx();
2198
+ return {
2199
+ body: result.body,
2200
+ delta: { before: rowToRecord(before), after: rowToRecord(result.after) }
2201
+ };
2202
+ }
2203
+ // ---------- Refunds ----------
2204
+ /**
2205
+ * Create a refund. Returns the serialized API shape plus a canonical
2206
+ * `state_delta` so the route can hand both to `respond()`.
2207
+ *
2208
+ * F-733: the whole flow — refund INSERT + charges.amount_refunded UPDATE
2209
+ * (inside `refunds.create()`, nested as a savepoint), the negative
2210
+ * refund-type balance transaction, the ledger link backfill, and the
2211
+ * charge.refunded / refund.created events — commits in one better-sqlite3
2212
+ * transaction, mirroring the settle flows.
2213
+ */
2214
+ createRefund(accountId2, input) {
2215
+ const tx = this.db.transaction(() => {
2216
+ const { row: row2, charge } = this.refunds.create(accountId2, input);
2217
+ const balanceTx = this.balance.create(accountId2, {
2218
+ type: "refund",
2219
+ amount: -row2.amount,
2220
+ fee: 0,
2221
+ currency: row2.currency,
2222
+ source_id: row2.id,
2223
+ source_type: "refund"
2224
+ });
2225
+ const linked = this.refunds.linkBalanceTransaction(accountId2, row2.id, balanceTx.id);
2226
+ this.events.create(accountId2, { type: "charge.refunded", object: chargeJson(charge) });
2227
+ this.events.create(accountId2, { type: "refund.created", object: refundJson(linked) });
2228
+ return linked;
2229
+ });
2230
+ const row = tx();
2231
+ return {
2232
+ body: refundJson(row),
2233
+ delta: { before: null, after: rowToRecord(row) }
2234
+ };
2235
+ }
2236
+ retrieveRefund(accountId2, id) {
2237
+ return refundJson(this.refunds.requireById(accountId2, id));
2238
+ }
2239
+ listRefunds(accountId2, input) {
2240
+ const { rows, hasMore, limit } = this.refunds.list(accountId2, input);
2241
+ return serializedList(rows.map(refundJson), hasMore, limit, "/v1/refunds");
2242
+ }
2243
+ // ---------- Customers ----------
2244
+ createCustomer(accountId2, input) {
2245
+ const row = this.customers.create(accountId2, input);
2246
+ this.events.create(accountId2, { type: "customer.created", object: customerJson(row) });
2247
+ return {
2248
+ body: customerJson(row),
2249
+ delta: { before: null, after: rowToRecord(row) }
2250
+ };
2251
+ }
2252
+ /** Deleted customers serve the `{deleted: true}` stub, like real Stripe. */
2253
+ retrieveCustomer(accountId2, id) {
2254
+ const row = this.customers.requireById(accountId2, id);
2255
+ return row.deleted ? deletedCustomerJson(row) : customerJson(row);
2256
+ }
2257
+ updateCustomer(accountId2, id, input) {
2258
+ const before = this.customers.requireLive(accountId2, id);
2259
+ const row = this.customers.update(accountId2, id, input);
2260
+ this.events.create(accountId2, { type: "customer.updated", object: customerJson(row) });
2261
+ return {
2262
+ body: customerJson(row),
2263
+ delta: { before: rowToRecord(before), after: rowToRecord(row) }
2264
+ };
2265
+ }
2266
+ deleteCustomer(accountId2, id) {
2267
+ const before = this.customers.requireById(accountId2, id);
2268
+ const attached = this.paymentMethods.allAttachedToCustomer(accountId2, id);
2269
+ const { row, alreadyDeleted } = this.customers.delete(accountId2, id);
2270
+ if (!alreadyDeleted) {
2271
+ this.events.create(accountId2, { type: "customer.deleted", object: deletedCustomerJson(row) });
2272
+ for (const pm of attached) {
2273
+ this.events.create(accountId2, {
2274
+ type: "payment_method.detached",
2275
+ object: paymentMethodJson(this.paymentMethods.requireById(accountId2, pm.id))
2276
+ });
2277
+ }
2278
+ }
2279
+ return {
2280
+ body: deletedCustomerJson(row),
2281
+ delta: { before: rowToRecord(before), after: rowToRecord(row) }
2282
+ };
2283
+ }
2284
+ listCustomers(accountId2, input) {
2285
+ const { rows, hasMore, limit } = this.customers.list(accountId2, input);
2286
+ return serializedList(rows.map(customerJson), hasMore, limit, "/v1/customers");
2287
+ }
2288
+ listCustomerPaymentMethods(accountId2, customerId, input) {
2289
+ this.customers.requireLive(accountId2, customerId);
2290
+ const { rows, hasMore, limit } = this.paymentMethods.listForCustomer(accountId2, customerId, input);
2291
+ return serializedList(rows.map(paymentMethodJson), hasMore, limit, `/v1/customers/${customerId}/payment_methods`);
2292
+ }
2293
+ // ---------- Payment methods ----------
2294
+ createPaymentMethod(accountId2, input) {
2295
+ const row = this.paymentMethods.create(accountId2, input);
2296
+ return {
2297
+ body: paymentMethodJson(row),
2298
+ delta: { before: null, after: rowToRecord(row) }
2299
+ };
2300
+ }
2301
+ retrievePaymentMethod(accountId2, id) {
2302
+ return paymentMethodJson(this.paymentMethods.requireById(accountId2, id));
2303
+ }
2304
+ attachPaymentMethod(accountId2, id, customerId) {
2305
+ this.customers.requireLive(accountId2, customerId);
2306
+ const before = this.paymentMethods.requireById(accountId2, id);
2307
+ const row = this.paymentMethods.attach(accountId2, id, customerId);
2308
+ this.events.create(accountId2, {
2309
+ type: "payment_method.attached",
2310
+ object: paymentMethodJson(row)
2311
+ });
2312
+ return {
2313
+ body: paymentMethodJson(row),
2314
+ delta: { before: rowToRecord(before), after: rowToRecord(row) }
2315
+ };
2316
+ }
2317
+ detachPaymentMethod(accountId2, id) {
2318
+ const before = this.paymentMethods.requireById(accountId2, id);
2319
+ const row = this.paymentMethods.detach(accountId2, id);
2320
+ this.events.create(accountId2, {
2321
+ type: "payment_method.detached",
2322
+ object: paymentMethodJson(row)
2323
+ });
2324
+ return {
2325
+ body: paymentMethodJson(row),
2326
+ delta: { before: rowToRecord(before), after: rowToRecord(row) }
2327
+ };
2328
+ }
2329
+ // ---------- Charges ----------
2330
+ retrieveCharge(accountId2, id) {
2331
+ return chargeJson(this.charges.requireById(accountId2, id));
2332
+ }
2333
+ listCharges(accountId2, input) {
2334
+ const { rows, hasMore, limit } = this.charges.list(accountId2, input);
2335
+ return serializedList(rows.map(chargeJson), hasMore, limit, "/v1/charges");
2336
+ }
2337
+ // ---------- Balance ----------
2338
+ retrieveBalance(accountId2) {
2339
+ const { available, pending } = this.balance.current(accountId2);
2340
+ return balanceJson(available, pending);
2341
+ }
2342
+ listBalanceTransactions(accountId2, input) {
2343
+ const { rows, hasMore, limit } = this.balance.list(accountId2, input);
2344
+ return serializedList(rows.map(balanceTransactionJson), hasMore, limit, "/v1/balance_transactions");
2345
+ }
2346
+ // ---------- Events ----------
2347
+ retrieveEvent(accountId2, id) {
2348
+ return eventJson(this.events.requireById(accountId2, id));
2349
+ }
2350
+ listEvents(accountId2, input) {
2351
+ const { rows, hasMore, limit } = this.events.list(accountId2, input);
2352
+ return serializedList(rows.map(eventJson), hasMore, limit, "/v1/events");
2353
+ }
2354
+ // ---------- Billing (F-734, shape tier) ----------
2355
+ //
2356
+ // Warm surfaces per the F-729 ruling: stored rows served in Stripe shape,
2357
+ // deliberately WITHOUT the semantic billing machine — creating a product,
2358
+ // price, or subscription emits no events and mints no invoices; the
2359
+ // recorder deltas stay truthful to the single-row writes.
2360
+ createProduct(accountId2, input) {
2361
+ const row = this.billing.createProduct(accountId2, input);
2362
+ return { body: productJson(row), delta: { before: null, after: rowToRecord(row) } };
2363
+ }
2364
+ retrieveProduct(accountId2, id) {
2365
+ return productJson(this.billing.requireProduct(accountId2, id));
2366
+ }
2367
+ listProducts(accountId2, input) {
2368
+ const { rows, hasMore, limit } = this.billing.listProducts(accountId2, input);
2369
+ return serializedList(rows.map(productJson), hasMore, limit, "/v1/products");
2370
+ }
2371
+ createPrice(accountId2, input) {
2372
+ const row = this.billing.createPrice(accountId2, input);
2373
+ return { body: priceJson(row), delta: { before: null, after: rowToRecord(row) } };
2374
+ }
2375
+ retrievePrice(accountId2, id) {
2376
+ return priceJson(this.billing.requirePrice(accountId2, id));
2377
+ }
2378
+ listPrices(accountId2, input) {
2379
+ const { rows, hasMore, limit } = this.billing.listPrices(accountId2, input);
2380
+ return serializedList(rows.map(priceJson), hasMore, limit, "/v1/prices");
2381
+ }
2382
+ createSubscription(accountId2, input) {
2383
+ if (input.customer)
2384
+ this.customers.requireLive(accountId2, input.customer);
2385
+ const row = this.billing.createSubscription(accountId2, input);
2386
+ return {
2387
+ body: this.subscriptionBody(accountId2, row),
2388
+ delta: { before: null, after: rowToRecord(row) }
2389
+ };
2390
+ }
2391
+ retrieveSubscription(accountId2, id) {
2392
+ return this.subscriptionBody(accountId2, this.billing.requireSubscription(accountId2, id));
2393
+ }
2394
+ updateSubscription(accountId2, id, input) {
2395
+ const before = this.billing.requireSubscription(accountId2, id);
2396
+ const row = this.billing.updateSubscription(accountId2, id, input);
2397
+ return {
2398
+ body: this.subscriptionBody(accountId2, row),
2399
+ delta: { before: rowToRecord(before), after: rowToRecord(row) }
2400
+ };
2401
+ }
2402
+ cancelSubscription(accountId2, id) {
2403
+ const before = this.billing.requireSubscription(accountId2, id);
2404
+ const row = this.billing.cancelSubscription(accountId2, id);
2405
+ return {
2406
+ body: this.subscriptionBody(accountId2, row),
2407
+ delta: { before: rowToRecord(before), after: rowToRecord(row) }
2408
+ };
2409
+ }
2410
+ listSubscriptions(accountId2, input) {
2411
+ const { rows, hasMore, limit } = this.billing.listSubscriptions(accountId2, input);
2412
+ return serializedList(rows.map((row) => this.subscriptionBody(accountId2, row)), hasMore, limit, "/v1/subscriptions");
2413
+ }
2414
+ /** Resolve item price rows so the serializer can expand SubscriptionItem.price. */
2415
+ subscriptionBody(accountId2, row) {
2416
+ const items = JSON.parse(row.items_json);
2417
+ const prices = /* @__PURE__ */ new Map();
2418
+ for (const item of items) {
2419
+ if (!prices.has(item.price)) {
2420
+ prices.set(item.price, this.billing.requirePrice(accountId2, item.price));
2421
+ }
2422
+ }
2423
+ return subscriptionJson(row, prices);
2424
+ }
2425
+ // Invoices are reads-only (F-729 ruling point 2: create/finalize/pay stay
2426
+ // unlisted-cold) and nothing in the twin mints one, so the list is always
2427
+ // empty and retrieve always 404s — loud, Stripe-shaped, documented.
2428
+ retrieveInvoice(accountId2, id) {
2429
+ throw noSuch("invoice", id);
2430
+ }
2431
+ listInvoices(accountId2, input) {
2432
+ const limit = Math.min(100, Math.max(1, Math.floor(input.limit ?? 10)));
2433
+ return serializedList([], false, limit, "/v1/invoices");
2434
+ }
2435
+ // ---------- State export (for _pome/state) ----------
2436
+ /**
2437
+ * Account-scoped state export. Used by `/_pome/state` to surface only
2438
+ * the calling session's data. Two sessions hitting `_pome/state` see
2439
+ * disjoint views of the same DB.
2440
+ *
2441
+ * Ordering is `created DESC, rowid DESC`: `created` has unix-second
2442
+ * resolution, so rows minted within the same second tied and flipped
2443
+ * order run-to-run (the F-683 export-race class). The insertion-order
2444
+ * tiebreak keeps the export deterministic — same seed + same ops =>
2445
+ * same state (test/state-export.test.ts).
2446
+ */
2447
+ exportState(accountId2) {
2448
+ const pis = this.db.prepare("SELECT * FROM payment_intents WHERE account_id = ? ORDER BY created DESC, rowid DESC").all(accountId2);
2449
+ const charges = this.db.prepare("SELECT * FROM charges WHERE account_id = ? ORDER BY created DESC, rowid DESC").all(accountId2);
2450
+ const balanceTxs = this.db.prepare("SELECT * FROM balance_transactions WHERE account_id = ? ORDER BY created DESC, rowid DESC").all(accountId2);
2451
+ const events = this.db.prepare("SELECT * FROM events WHERE account_id = ? ORDER BY created DESC, rowid DESC").all(accountId2);
2452
+ const refunds = this.db.prepare("SELECT * FROM refunds WHERE account_id = ? ORDER BY created DESC, rowid DESC").all(accountId2);
2453
+ const customers = this.db.prepare("SELECT * FROM customers WHERE account_id = ? ORDER BY created DESC, rowid DESC").all(accountId2);
2454
+ const paymentMethods = this.db.prepare("SELECT * FROM payment_methods WHERE account_id = ? ORDER BY created DESC, rowid DESC").all(accountId2);
2455
+ const products = this.db.prepare("SELECT * FROM products WHERE account_id = ? ORDER BY created DESC, rowid DESC").all(accountId2);
2456
+ const prices = this.db.prepare("SELECT * FROM prices WHERE account_id = ? ORDER BY created DESC, rowid DESC").all(accountId2);
2457
+ const subscriptions = this.db.prepare("SELECT * FROM subscriptions WHERE account_id = ? ORDER BY created DESC, rowid DESC").all(accountId2);
2458
+ return {
2459
+ payment_intents: pis.map(paymentIntentJson),
2460
+ charges: charges.map(chargeJson),
2461
+ balance_transactions: balanceTxs.map(balanceTransactionJson),
2462
+ events: events.map(eventJson),
2463
+ refunds: refunds.map(refundJson),
2464
+ customers: customers.map((row) => row.deleted ? deletedCustomerJson(row) : customerJson(row)),
2465
+ payment_methods: paymentMethods.map(paymentMethodJson),
2466
+ products: products.map(productJson),
2467
+ prices: prices.map(priceJson),
2468
+ subscriptions: subscriptions.map((row) => this.subscriptionBody(accountId2, row))
2469
+ };
2470
+ }
2471
+ };
2472
+ function rowToRecord(row) {
2473
+ return { ...row };
2474
+ }
2475
+ function missingPaymentMethod() {
2476
+ return new TwinError("invalid_request_error", "payment_intent_unexpected_state", "You cannot confirm this PaymentIntent because it's missing a payment method. Update the PaymentIntent with a payment_method and then confirm it again.", { statusCode: 400 });
2477
+ }
2478
+ function assertPMUsable(pm, customerId) {
2479
+ if (pm.detached) {
2480
+ throw new TwinError("invalid_request_error", "payment_method_previously_detached", "A payment method that has been previously detached from a customer may not be used again.", { param: "payment_method", statusCode: 400 });
2481
+ }
2482
+ if (pm.customer_id && pm.customer_id !== customerId) {
2483
+ throw new TwinError("invalid_request_error", "payment_method_customer_mismatch", "The payment method you provided is attached to a customer. You may only use it with that customer via the `customer` parameter.", { param: "payment_method", statusCode: 400 });
2484
+ }
2485
+ }
2486
+ function cardChargeDetails(pm) {
2487
+ return { type: "card", card: cardJson(pm) };
2488
+ }
2489
+ var CACHEABLE_METHODS = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH", "DELETE"]);
2490
+ var HANDLER_RESULT_KEY = "twinStripeHandlerResult";
2491
+ function setHandlerResult(c, result) {
2492
+ c.set(HANDLER_RESULT_KEY, result);
2493
+ }
2494
+ function getHandlerResult(c) {
2495
+ return c.get(HANDLER_RESULT_KEY) ?? null;
2496
+ }
2497
+ function hashRequest(method, path, body) {
2498
+ return createHash("sha256").update(method).update("\0").update(path).update("\0").update(body).digest("hex");
2499
+ }
2500
+ function getAccountId(c) {
2501
+ const session = c.get("session");
2502
+ if (session)
2503
+ return session.account_id;
2504
+ const sid = c.req.param("sid");
2505
+ return sid ? `acct_${sid}` : "_anon";
2506
+ }
2507
+ function idempotencyMiddleware(db, recorder, runId = "local") {
2508
+ const select = db.prepare(`SELECT key, account_id, method, path, request_hash, response_status, response_body_json, created_at
2509
+ FROM idempotency_keys
2510
+ WHERE key = ? AND account_id = ? AND method = ? AND path = ?`);
2511
+ const insert = db.prepare(`INSERT INTO idempotency_keys
2512
+ (key, account_id, method, path, request_hash, response_status, response_body_json, created_at)
2513
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)
2514
+ ON CONFLICT(key, account_id, method, path) DO NOTHING`);
2515
+ const pending = /* @__PURE__ */ new Map();
2516
+ return async (c, next) => {
2517
+ const method = c.req.method.toUpperCase();
2518
+ if (!CACHEABLE_METHODS.has(method)) {
2519
+ await next();
2520
+ return;
2521
+ }
2522
+ const headerKey = c.req.header("Idempotency-Key") ?? c.req.header("idempotency-key");
2523
+ if (!headerKey) {
2524
+ await next();
2525
+ return;
2526
+ }
2527
+ const startedAt = Date.now();
2528
+ const account_id = getAccountId(c);
2529
+ const path = new URL(c.req.url).pathname;
2530
+ const rawBody = await c.req.raw.clone().text().catch(() => "");
2531
+ const requestHash = hashRequest(method, path, rawBody);
2532
+ const pendingKey = [headerKey, account_id, method, path].join("\0");
2533
+ const existing = select.get(headerKey, account_id, method, path);
2534
+ if (existing) {
2535
+ if (existing.request_hash !== requestHash) {
2536
+ const env = stripeError("idempotency_error", "idempotency_key_in_use", `Keys for idempotent requests can only be used with the same parameters they were first used with. Try using a key other than '${headerKey}'.`, { statusCode: 400 });
2537
+ return c.json(env.body, env.status);
2538
+ }
2539
+ let cachedBody;
2540
+ try {
2541
+ cachedBody = JSON.parse(existing.response_body_json);
2542
+ } catch {
2543
+ cachedBody = null;
2544
+ }
2545
+ recordDedupeEvent(c, recorder, runId, startedAt, rawBody, {
2546
+ status: existing.response_status,
2547
+ body: cachedBody
2548
+ });
2549
+ return c.json(cachedBody, existing.response_status);
2550
+ }
2551
+ const inFlight = pending.get(pendingKey);
2552
+ if (inFlight) {
2553
+ if (inFlight.requestHash !== requestHash) {
2554
+ const env = stripeError("idempotency_error", "idempotency_key_in_use", `Keys for idempotent requests can only be used with the same parameters they were first used with. Try using a key other than '${headerKey}'.`, { statusCode: 400 });
2555
+ return c.json(env.body, env.status);
2556
+ }
2557
+ const cached = await inFlight.promise;
2558
+ if (cached.status < 400) {
2559
+ const cachedBody = parseCachedBody(cached.bodyText);
2560
+ recordDedupeEvent(c, recorder, runId, startedAt, rawBody, {
2561
+ status: cached.status,
2562
+ body: cachedBody
2563
+ });
2564
+ return c.json(cachedBody, cached.status);
2565
+ }
2566
+ await next();
2567
+ return;
2568
+ }
2569
+ let resolvePending;
2570
+ let rejectPending;
2571
+ const promise = new Promise((resolve, reject) => {
2572
+ resolvePending = resolve;
2573
+ rejectPending = reject;
2574
+ });
2575
+ pending.set(pendingKey, { requestHash, promise });
2576
+ try {
2577
+ await next();
2578
+ } catch (error) {
2579
+ rejectPending(error);
2580
+ pending.delete(pendingKey);
2581
+ throw error;
2582
+ }
2583
+ try {
2584
+ const handled = getHandlerResult(c);
2585
+ const status = handled ? handled.status : c.res.status;
2586
+ if (status >= 400) {
2587
+ resolvePending({ status, bodyText: "null" });
2588
+ return;
2589
+ }
2590
+ let bodyText = "";
2591
+ if (handled) {
2592
+ bodyText = JSON.stringify(handled.body);
2593
+ } else {
2594
+ const cloned = c.res.clone();
2595
+ try {
2596
+ bodyText = await cloned.text();
2597
+ } catch {
2598
+ bodyText = "";
2599
+ }
2600
+ }
2601
+ try {
2602
+ JSON.parse(bodyText);
2603
+ } catch {
2604
+ bodyText = "null";
2605
+ }
2606
+ insert.run(headerKey, account_id, method, path, requestHash, status, bodyText, nowIso());
2607
+ resolvePending({ status, bodyText });
2608
+ } catch (error) {
2609
+ rejectPending(error);
2610
+ throw error;
2611
+ } finally {
2612
+ pending.delete(pendingKey);
2613
+ }
2614
+ };
2615
+ }
2616
+ function recordDedupeEvent(c, recorder, runId, startedAt, rawBody, cached) {
2617
+ if (!recorder)
2618
+ return;
2619
+ const reqId = requestId();
2620
+ const stepId = c.req.header("x-pome-scenario-step-id") ?? null;
2621
+ recorder.record({
2622
+ ts: (/* @__PURE__ */ new Date()).toISOString(),
2623
+ run_id: runId,
2624
+ twin: "stripe",
2625
+ request_id: reqId,
2626
+ correlation_id: c.req.header("x-pome-correlation-id") ?? reqId,
2627
+ task_step_id: stepId,
2628
+ scenario_step_id: stepId,
2629
+ step_id: null,
2630
+ tool_call_id: null,
2631
+ method: c.req.method,
2632
+ path: new URL(c.req.url).pathname,
2633
+ request_body: rawBody === "" ? null : rawBody,
2634
+ // F-1125 — the replay's own headers, which is where `Idempotency-Key`
2635
+ // lives. Recording the dedupe outcome while hiding the key that caused it
2636
+ // would leave the reason unreadable on the one row that is about it.
2637
+ request_headers: recordedRequestHeaders(c),
2638
+ tool: null,
2639
+ status: cached.status,
2640
+ response_body: cached.body,
2641
+ latency_ms: Date.now() - startedAt,
2642
+ fidelity: "semantic",
2643
+ state_mutation: false,
2644
+ state_delta: null,
2645
+ idempotency_dedupe: true,
2646
+ error: null
2647
+ });
2648
+ }
2649
+ function parseCachedBody(bodyText) {
2650
+ try {
2651
+ return JSON.parse(bodyText);
2652
+ } catch {
2653
+ return null;
2654
+ }
2655
+ }
2656
+ function accountId(c) {
2657
+ const session = c.get("session");
2658
+ if (!session) {
2659
+ throw new TwinError("api_error", "internal_error", "Missing session context (auth middleware did not run).", { statusCode: 500 });
2660
+ }
2661
+ return session.account_id;
2662
+ }
2663
+ function ok(body, mutation = false, stateDelta) {
2664
+ return { status: 200, body, mutation, stateDelta };
2665
+ }
2666
+ function created(body, stateDelta) {
2667
+ return { status: 200, body, mutation: true, stateDelta };
2668
+ }
2669
+ async function handle(c, recorder, runId, fn) {
2670
+ const started = Date.now();
2671
+ let requestBody = null;
2672
+ try {
2673
+ if (c.req.method !== "GET" && c.req.method !== "HEAD") {
2674
+ try {
2675
+ requestBody = await c.req.raw.clone().text();
2676
+ } catch {
2677
+ requestBody = null;
2678
+ }
2679
+ }
2680
+ const result = await fn();
2681
+ return respond(c, recorder, runId, started, requestBody, result.status, result.body, result.mutation, "semantic", result.stateDelta ?? null);
2682
+ } catch (error) {
2683
+ if (error instanceof TwinError) {
2684
+ return respond(c, recorder, runId, started, requestBody, error.status, error.toEnvelope(), error.state_mutation ?? false, error.fidelity ?? "semantic", error.state_delta ?? null);
2685
+ }
2686
+ if (error instanceof z.ZodError) {
2687
+ const first = error.issues[0];
2688
+ const envelope2 = stripeError("invalid_request_error", "parameter_invalid", first?.message ?? "Invalid request parameters.", { param: first?.path?.join(".") });
2689
+ return respond(c, recorder, runId, started, requestBody, envelope2.status, envelope2.body, false, "semantic", null);
2690
+ }
2691
+ if (error instanceof SyntaxError) {
2692
+ const envelope2 = stripeError("invalid_request_error", "invalid_json", "Could not parse request body as JSON.");
2693
+ return respond(c, recorder, runId, started, requestBody, envelope2.status, envelope2.body, false, "semantic", null);
2694
+ }
2695
+ const envelope = stripeError("api_error", "internal_error", error instanceof Error ? error.message : "Internal Server Error", { statusCode: 500 });
2696
+ return respond(c, recorder, runId, started, requestBody, envelope.status, envelope.body, false, "semantic", null);
2697
+ }
2698
+ }
2699
+ function respond(c, recorder, runId, started, requestBody, status, responseBody, stateMutation, fidelity = "semantic", stateDelta = null) {
2700
+ const reqId = requestId();
2701
+ setHandlerResult(c, { status, body: responseBody });
2702
+ const override = c.get(FAILURE_INJECTION_OVERRIDE_KEY) ?? null;
2703
+ const finalStatus = override ? override.status : status;
2704
+ const finalBody = override ? override.body : responseBody;
2705
+ const stepId = c.req.header("x-pome-scenario-step-id") ?? null;
2706
+ recorder?.record({
2707
+ ts: (/* @__PURE__ */ new Date()).toISOString(),
2708
+ run_id: runId,
2709
+ twin: "stripe",
2710
+ request_id: reqId,
2711
+ correlation_id: c.req.header("x-pome-correlation-id") ?? reqId,
2712
+ task_step_id: stepId,
2713
+ scenario_step_id: stepId,
2714
+ step_id: null,
2715
+ tool_call_id: null,
2716
+ method: c.req.method,
2717
+ path: new URL(c.req.url).pathname,
2718
+ request_body: requestBody,
2719
+ // F-1125 — one shared implementation with the engine's own emit(), so
2720
+ // "which headers get recorded" has a single answer across every site.
2721
+ request_headers: recordedRequestHeaders(c),
2722
+ // Stripe's REST routes are not declared as twin actions: no criterion asks
2723
+ // whether a stripe TOOL was called, and stamping a name here that no check
2724
+ // can bind would be an unverifiable claim. MCP dispatch still stamps its
2725
+ // own name through the engine.
2726
+ tool: null,
2727
+ status: finalStatus,
2728
+ response_body: finalBody,
2729
+ latency_ms: Date.now() - started,
2730
+ fidelity,
2731
+ state_mutation: stateMutation,
2732
+ state_delta: stateDelta,
2733
+ error: finalStatus >= 400 ? errorMessage(finalBody) : null
2734
+ });
2735
+ return c.json(finalBody, finalStatus);
2736
+ }
2737
+ function errorMessage(body) {
2738
+ if (body && typeof body === "object" && "error" in body) {
2739
+ const err = body.error;
2740
+ if (err && typeof err.message === "string")
2741
+ return err.message;
2742
+ }
2743
+ return "request failed";
2744
+ }
2745
+ function parseListQuery(c) {
2746
+ const limit = c.req.query("limit");
2747
+ const numericLimit = limit !== void 0 ? Number(limit) : void 0;
2748
+ const created2 = createdRangeFromQuery(c);
2749
+ return {
2750
+ limit: Number.isFinite(numericLimit) ? numericLimit : void 0,
2751
+ starting_after: c.req.query("starting_after"),
2752
+ ending_before: c.req.query("ending_before"),
2753
+ ...created2
2754
+ };
2755
+ }
2756
+ async function readBodyForm(c) {
2757
+ const contentType = c.req.header("content-type") ?? "";
2758
+ if (contentType.includes("application/json")) {
2759
+ try {
2760
+ return await c.req.json();
2761
+ } catch {
2762
+ return {};
2763
+ }
2764
+ }
2765
+ if (contentType.includes("application/x-www-form-urlencoded") || contentType.includes("multipart/form-data")) {
2766
+ try {
2767
+ const form = await c.req.parseBody({ all: true });
2768
+ return formToObject(form);
2769
+ } catch {
2770
+ return {};
2771
+ }
2772
+ }
2773
+ try {
2774
+ return await c.req.json();
2775
+ } catch {
2776
+ try {
2777
+ const form = await c.req.parseBody({ all: true });
2778
+ return formToObject(form);
2779
+ } catch {
2780
+ return {};
2781
+ }
2782
+ }
2783
+ }
2784
+ function formToObject(form) {
2785
+ const out = {};
2786
+ for (const [rawKey, value] of Object.entries(form)) {
2787
+ const path = parseBracketPath(rawKey);
2788
+ setDeep(out, path, value);
2789
+ }
2790
+ return out;
2791
+ }
2792
+ var POLLUTION_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
2793
+ function parseBracketPath(key) {
2794
+ const parts = [];
2795
+ const regex = /([^\[\]]+)|\[([^\[\]]*)\]/g;
2796
+ let match;
2797
+ while ((match = regex.exec(key)) !== null) {
2798
+ const piece = match[1] ?? match[2] ?? "";
2799
+ if (/^\d+$/.test(piece))
2800
+ parts.push(Number(piece));
2801
+ else
2802
+ parts.push(piece);
2803
+ }
2804
+ return parts;
2805
+ }
2806
+ function setDeep(target, path, value) {
2807
+ for (const key of path) {
2808
+ if (typeof key === "string" && POLLUTION_KEYS.has(key)) {
2809
+ return;
2810
+ }
2811
+ }
2812
+ let cursor = target;
2813
+ for (let i = 0; i < path.length; i++) {
2814
+ const key = path[i];
2815
+ const isLast = i === path.length - 1;
2816
+ if (isLast) {
2817
+ cursor[key] = value;
2818
+ } else {
2819
+ const nextKey = path[i + 1];
2820
+ if (cursor[key] === void 0) {
2821
+ cursor[key] = typeof nextKey === "number" ? [] : {};
2822
+ }
2823
+ cursor = cursor[key];
2824
+ }
2825
+ }
2826
+ }
2827
+ function createdRangeFromQuery(c) {
2828
+ const out = {};
2829
+ const flat = c.req.query("created");
2830
+ if (flat !== void 0 && /^\d+$/.test(flat)) {
2831
+ out.created_gte = Number(flat);
2832
+ out.created_lte = Number(flat);
2833
+ }
2834
+ const gt = c.req.query("created[gt]");
2835
+ const gte = c.req.query("created[gte]");
2836
+ const lt = c.req.query("created[lt]");
2837
+ const lte = c.req.query("created[lte]");
2838
+ if (gt && /^\d+$/.test(gt))
2839
+ out.created_gt = Number(gt);
2840
+ if (gte && /^\d+$/.test(gte))
2841
+ out.created_gte = Number(gte);
2842
+ if (lt && /^\d+$/.test(lt))
2843
+ out.created_lt = Number(lt);
2844
+ if (lte && /^\d+$/.test(lte))
2845
+ out.created_lte = Number(lte);
2846
+ return out;
2847
+ }
2848
+ var formBool = z.union([z.boolean(), z.enum(["true", "false"]).transform((v) => v === "true")]).optional();
2849
+ var createPISchema = z.object({
2850
+ amount: z.coerce.number().int().positive(),
2851
+ currency: z.string().min(1),
2852
+ payment_method_types: z.array(z.string()).min(1),
2853
+ payment_method_options: z.object({
2854
+ crypto: z.object({
2855
+ mode: z.literal("deposit"),
2856
+ deposit_options: z.object({
2857
+ networks: z.array(z.string()).min(1).optional()
2858
+ }).optional()
2859
+ })
2860
+ }).optional(),
2861
+ payment_method: z.string().optional(),
2862
+ customer: z.string().optional(),
2863
+ confirm: formBool,
2864
+ metadata: z.record(z.string(), z.string()).optional(),
2865
+ capture_method: z.string().optional(),
2866
+ confirmation_method: z.string().optional()
2867
+ });
2868
+ var confirmPISchema = z.object({
2869
+ payment_method: z.string().optional()
2870
+ });
2871
+ var updatePISchema = z.object({
2872
+ amount: z.coerce.number().int().optional(),
2873
+ metadata: z.record(z.string(), z.string().nullable()).optional(),
2874
+ payment_method: z.string().optional(),
2875
+ customer: z.string().optional()
2876
+ });
2877
+ function registerPaymentIntentRoutes(router, domain, recorder, runId) {
2878
+ router.post("/v1/payment_intents", (c) => handle(c, recorder, runId, async () => {
2879
+ const body = await readBodyForm(c);
2880
+ const input = createPISchema.parse(body);
2881
+ const { body: piBody, delta } = domain.createPaymentIntent(accountId(c), input);
2882
+ return created(piBody, delta);
2883
+ }));
2884
+ router.get("/v1/payment_intents/:id", (c) => handle(c, recorder, runId, () => ok(domain.retrievePaymentIntent(accountId(c), c.req.param("id")))));
2885
+ router.get("/v1/payment_intents", (c) => handle(c, recorder, runId, () => {
2886
+ const list = parseListQuery(c);
2887
+ return ok(domain.listPaymentIntents(accountId(c), list));
2888
+ }));
2889
+ router.post("/v1/payment_intents/:id/confirm", (c) => handle(c, recorder, runId, async () => {
2890
+ const input = confirmPISchema.parse(await readBodyForm(c));
2891
+ const { body, delta } = domain.confirmPaymentIntent(accountId(c), c.req.param("id"), input);
2892
+ return ok(body, true, delta);
2893
+ }));
2894
+ router.post("/v1/payment_intents/:id", (c) => handle(c, recorder, runId, async () => {
2895
+ const input = updatePISchema.parse(await readBodyForm(c));
2896
+ const { body, delta } = domain.updatePaymentIntent(accountId(c), c.req.param("id"), input);
2897
+ return ok(body, true, delta);
2898
+ }));
2899
+ router.post("/v1/payment_intents/:id/cancel", (c) => handle(c, recorder, runId, () => {
2900
+ const { body, delta } = domain.cancelPaymentIntent(accountId(c), c.req.param("id"));
2901
+ return ok(body, true, delta);
2902
+ }));
2903
+ router.post("/v1/test_helpers/payment_intents/:id/simulate_crypto_deposit", (c) => handle(c, recorder, runId, () => {
2904
+ const { body, delta } = domain.simulateCryptoDeposit(accountId(c), c.req.param("id"));
2905
+ return ok(body, true, delta);
2906
+ }));
2907
+ }
2908
+
2909
+ // ../packages/twin-stripe/dist/src/routes/charges.js
2910
+ function registerChargesRoutes(router, domain, recorder, runId) {
2911
+ router.get("/v1/charges/:id", (c) => handle(c, recorder, runId, () => ok(domain.retrieveCharge(accountId(c), c.req.param("id")))));
2912
+ router.get("/v1/charges", (c) => handle(c, recorder, runId, () => {
2913
+ const list = parseListQuery(c);
2914
+ return ok(domain.listCharges(accountId(c), {
2915
+ ...list,
2916
+ payment_intent: c.req.query("payment_intent"),
2917
+ customer: c.req.query("customer")
2918
+ }));
2919
+ }));
2920
+ }
2921
+
2922
+ // ../packages/twin-stripe/dist/src/routes/balance.js
2923
+ function registerBalanceRoutes(router, domain, recorder, runId) {
2924
+ router.get("/v1/balance", (c) => handle(c, recorder, runId, () => ok(domain.retrieveBalance(accountId(c)))));
2925
+ router.get("/v1/balance_transactions", (c) => handle(c, recorder, runId, () => {
2926
+ const list = parseListQuery(c);
2927
+ return ok(domain.listBalanceTransactions(accountId(c), {
2928
+ ...list,
2929
+ type: c.req.query("type")
2930
+ }));
2931
+ }));
2932
+ }
2933
+
2934
+ // ../packages/twin-stripe/dist/src/routes/events.js
2935
+ function registerEventsRoutes(router, domain, recorder, runId) {
2936
+ router.get("/v1/events/:id", (c) => handle(c, recorder, runId, () => ok(domain.retrieveEvent(accountId(c), c.req.param("id")))));
2937
+ router.get("/v1/events", (c) => handle(c, recorder, runId, () => {
2938
+ const list = parseListQuery(c);
2939
+ return ok(domain.listEvents(accountId(c), {
2940
+ ...list,
2941
+ type: c.req.query("type")
2942
+ }));
2943
+ }));
2944
+ }
2945
+
2946
+ // ../packages/twin-stripe/dist/src/routes/refunds.js
2947
+ function registerRefundsRoutes(router, domain, recorder, runId) {
2948
+ router.post("/v1/refunds", (c) => handle(c, recorder, runId, async () => {
2949
+ const body = await readJson(c);
2950
+ const { body: response, delta } = domain.createRefund(accountId(c), {
2951
+ charge: typeof body.charge === "string" ? body.charge : "",
2952
+ amount: typeof body.amount === "number" ? body.amount : void 0,
2953
+ reason: typeof body.reason === "string" ? body.reason : null,
2954
+ idempotency_key: c.req.header("Idempotency-Key") ?? c.req.header("idempotency-key") ?? null
2955
+ });
2956
+ return created(response, delta);
2957
+ }));
2958
+ router.get("/v1/refunds/:id", (c) => handle(c, recorder, runId, () => ok(domain.retrieveRefund(accountId(c), c.req.param("id")))));
2959
+ router.get("/v1/refunds", (c) => handle(c, recorder, runId, () => {
2960
+ const list = parseListQuery(c);
2961
+ return ok(domain.listRefunds(accountId(c), {
2962
+ ...list,
2963
+ charge: c.req.query("charge"),
2964
+ payment_intent: c.req.query("payment_intent")
2965
+ }));
2966
+ }));
2967
+ }
2968
+ async function readJson(c) {
2969
+ const contentType = c.req.header("content-type") ?? "";
2970
+ if (contentType.includes("application/x-www-form-urlencoded")) {
2971
+ try {
2972
+ const parsed = await c.req.parseBody();
2973
+ return coerceFormBody(parsed);
2974
+ } catch {
2975
+ return {};
2976
+ }
2977
+ }
2978
+ try {
2979
+ const body = await c.req.json();
2980
+ return body && typeof body === "object" ? body : {};
2981
+ } catch {
2982
+ return {};
2983
+ }
2984
+ }
2985
+ function coerceFormBody(form) {
2986
+ const out = {};
2987
+ for (const [k, v] of Object.entries(form)) {
2988
+ if (typeof v === "string" && /^-?\d+$/.test(v) && k === "amount") {
2989
+ out[k] = Number(v);
2990
+ } else {
2991
+ out[k] = v;
2992
+ }
2993
+ }
2994
+ return out;
2995
+ }
2996
+ var customerFieldsSchema = z.object({
2997
+ name: z.string().nullish(),
2998
+ email: z.string().nullish(),
2999
+ description: z.string().nullish(),
3000
+ phone: z.string().nullish(),
3001
+ metadata: z.record(z.string(), z.string().nullable()).optional()
3002
+ });
3003
+ function registerCustomersRoutes(router, domain, recorder, runId) {
3004
+ router.post("/v1/customers", (c) => handle(c, recorder, runId, async () => {
3005
+ const input = customerFieldsSchema.parse(await readBodyForm(c));
3006
+ const { body, delta } = domain.createCustomer(accountId(c), input);
3007
+ return created(body, delta);
3008
+ }));
3009
+ router.get("/v1/customers/:id/payment_methods", (c) => handle(c, recorder, runId, () => {
3010
+ const list = parseListQuery(c);
3011
+ return ok(domain.listCustomerPaymentMethods(accountId(c), c.req.param("id"), {
3012
+ ...list,
3013
+ type: c.req.query("type")
3014
+ }));
3015
+ }));
3016
+ router.get("/v1/customers/:id", (c) => handle(c, recorder, runId, () => ok(domain.retrieveCustomer(accountId(c), c.req.param("id")))));
3017
+ router.post("/v1/customers/:id", (c) => handle(c, recorder, runId, async () => {
3018
+ const input = customerFieldsSchema.parse(await readBodyForm(c));
3019
+ const { body, delta } = domain.updateCustomer(accountId(c), c.req.param("id"), input);
3020
+ return ok(body, true, delta);
3021
+ }));
3022
+ router.delete("/v1/customers/:id", (c) => handle(c, recorder, runId, () => {
3023
+ const { body, delta } = domain.deleteCustomer(accountId(c), c.req.param("id"));
3024
+ return ok(body, true, delta);
3025
+ }));
3026
+ router.get("/v1/customers", (c) => handle(c, recorder, runId, () => {
3027
+ const list = parseListQuery(c);
3028
+ return ok(domain.listCustomers(accountId(c), { ...list, email: c.req.query("email") }));
3029
+ }));
3030
+ }
3031
+
3032
+ // ../packages/twin-stripe/dist/src/routes/payment-methods.js
3033
+ function registerPaymentMethodsRoutes(router, domain, recorder, runId) {
3034
+ router.post("/v1/payment_methods", (c) => handle(c, recorder, runId, async () => {
3035
+ const body = await readBodyForm(c);
3036
+ const { body: response, delta } = domain.createPaymentMethod(accountId(c), body);
3037
+ return created(response, delta);
3038
+ }));
3039
+ router.get("/v1/payment_methods/:id", (c) => handle(c, recorder, runId, () => ok(domain.retrievePaymentMethod(accountId(c), c.req.param("id")))));
3040
+ router.post("/v1/payment_methods/:id/attach", (c) => handle(c, recorder, runId, async () => {
3041
+ const body = await readBodyForm(c);
3042
+ const customer = typeof body.customer === "string" ? body.customer : "";
3043
+ if (!customer) {
3044
+ throw new TwinError("invalid_request_error", "parameter_missing", "Missing required param: customer.", { param: "customer", statusCode: 400 });
3045
+ }
3046
+ const { body: response, delta } = domain.attachPaymentMethod(accountId(c), c.req.param("id"), customer);
3047
+ return ok(response, true, delta);
3048
+ }));
3049
+ router.post("/v1/payment_methods/:id/detach", (c) => handle(c, recorder, runId, () => {
3050
+ const { body, delta } = domain.detachPaymentMethod(accountId(c), c.req.param("id"));
3051
+ return ok(body, true, delta);
3052
+ }));
3053
+ }
3054
+ var formBool2 = z.union([z.boolean(), z.enum(["true", "false"]).transform((v) => v === "true")]).optional();
3055
+ var metadataSchema = z.record(z.string(), z.string().nullable()).optional();
3056
+ var productFieldsSchema = z.object({
3057
+ name: z.string().min(1).optional(),
3058
+ description: z.string().nullish(),
3059
+ active: formBool2,
3060
+ metadata: metadataSchema
3061
+ });
3062
+ var createPriceSchema = z.object({
3063
+ currency: z.string().min(1).optional(),
3064
+ product: z.string().min(1).optional(),
3065
+ unit_amount: z.coerce.number().int().nonnegative().optional(),
3066
+ recurring: z.object({
3067
+ interval: z.string().min(1),
3068
+ interval_count: z.coerce.number().int().positive().optional()
3069
+ }).optional(),
3070
+ nickname: z.string().nullish(),
3071
+ lookup_key: z.string().nullish(),
3072
+ active: formBool2,
3073
+ metadata: metadataSchema
3074
+ });
3075
+ var createSubscriptionSchema = z.object({
3076
+ customer: z.string().min(1).optional(),
3077
+ items: z.array(z.object({
3078
+ price: z.string().min(1).optional(),
3079
+ quantity: z.coerce.number().int().positive().optional()
3080
+ })).optional(),
3081
+ cancel_at_period_end: formBool2,
3082
+ metadata: metadataSchema
3083
+ });
3084
+ var updateSubscriptionSchema = z.object({
3085
+ cancel_at_period_end: formBool2,
3086
+ metadata: metadataSchema
3087
+ });
3088
+ function registerBillingRoutes(router, domain, recorder, runId) {
3089
+ router.post("/v1/products", (c) => handle(c, recorder, runId, async () => {
3090
+ const input = productFieldsSchema.parse(await readBodyForm(c));
3091
+ const { body, delta } = domain.createProduct(accountId(c), input);
3092
+ return created(body, delta);
3093
+ }));
3094
+ router.get("/v1/products/:id", (c) => handle(c, recorder, runId, () => ok(domain.retrieveProduct(accountId(c), c.req.param("id")))));
3095
+ router.get("/v1/products", (c) => handle(c, recorder, runId, () => {
3096
+ const list = parseListQuery(c);
3097
+ return ok(domain.listProducts(accountId(c), { ...list, active: queryBool(c.req.query("active")) }));
3098
+ }));
3099
+ router.post("/v1/prices", (c) => handle(c, recorder, runId, async () => {
3100
+ const input = createPriceSchema.parse(await readBodyForm(c));
3101
+ const { body, delta } = domain.createPrice(accountId(c), input);
3102
+ return created(body, delta);
3103
+ }));
3104
+ router.get("/v1/prices/:id", (c) => handle(c, recorder, runId, () => ok(domain.retrievePrice(accountId(c), c.req.param("id")))));
3105
+ router.get("/v1/prices", (c) => handle(c, recorder, runId, () => {
3106
+ const list = parseListQuery(c);
3107
+ return ok(domain.listPrices(accountId(c), {
3108
+ ...list,
3109
+ product: c.req.query("product"),
3110
+ active: queryBool(c.req.query("active"))
3111
+ }));
3112
+ }));
3113
+ router.post("/v1/subscriptions", (c) => handle(c, recorder, runId, async () => {
3114
+ const input = createSubscriptionSchema.parse(await readBodyForm(c));
3115
+ const { body, delta } = domain.createSubscription(accountId(c), input);
3116
+ return created(body, delta);
3117
+ }));
3118
+ router.get("/v1/subscriptions/:id", (c) => handle(c, recorder, runId, () => ok(domain.retrieveSubscription(accountId(c), c.req.param("id")))));
3119
+ router.post("/v1/subscriptions/:id", (c) => handle(c, recorder, runId, async () => {
3120
+ const input = updateSubscriptionSchema.parse(await readBodyForm(c));
3121
+ const { body, delta } = domain.updateSubscription(accountId(c), c.req.param("id"), input);
3122
+ return ok(body, true, delta);
3123
+ }));
3124
+ router.delete("/v1/subscriptions/:id", (c) => handle(c, recorder, runId, () => {
3125
+ const { body, delta } = domain.cancelSubscription(accountId(c), c.req.param("id"));
3126
+ return ok(body, true, delta);
3127
+ }));
3128
+ router.get("/v1/subscriptions", (c) => handle(c, recorder, runId, () => {
3129
+ const list = parseListQuery(c);
3130
+ return ok(domain.listSubscriptions(accountId(c), {
3131
+ ...list,
3132
+ customer: c.req.query("customer"),
3133
+ status: c.req.query("status")
3134
+ }));
3135
+ }));
3136
+ router.get("/v1/invoices/:id", (c) => handle(c, recorder, runId, () => ok(domain.retrieveInvoice(accountId(c), c.req.param("id")))));
3137
+ router.get("/v1/invoices", (c) => handle(c, recorder, runId, () => ok(domain.listInvoices(accountId(c), parseListQuery(c)))));
3138
+ }
3139
+ function queryBool(value) {
3140
+ if (value === "true")
3141
+ return true;
3142
+ if (value === "false")
3143
+ return false;
3144
+ return void 0;
3145
+ }
3146
+
3147
+ // ../packages/twin-stripe/dist/src/routes/index.js
3148
+ function registerStripeRoutes(router, domain, recorder, runId) {
3149
+ registerPaymentIntentRoutes(router, domain, recorder, runId);
3150
+ registerChargesRoutes(router, domain, recorder, runId);
3151
+ registerRefundsRoutes(router, domain, recorder, runId);
3152
+ registerCustomersRoutes(router, domain, recorder, runId);
3153
+ registerPaymentMethodsRoutes(router, domain, recorder, runId);
3154
+ registerBillingRoutes(router, domain, recorder, runId);
3155
+ registerBalanceRoutes(router, domain, recorder, runId);
3156
+ registerEventsRoutes(router, domain, recorder, runId);
3157
+ router.all("/v1/*", (c) => {
3158
+ const envelope = unsupported();
3159
+ return respond(c, recorder, runId, Date.now(), null, envelope.status, envelope.body, false, "unsupported");
3160
+ });
3161
+ }
3162
+ var DEFAULT_SID = "default";
3163
+ var DEFAULT_API_KEY = "sk_test_pome_default";
3164
+ var PI_STATUSES = [
3165
+ "requires_payment_method",
3166
+ "requires_confirmation",
3167
+ "requires_action",
3168
+ "processing",
3169
+ "requires_capture",
3170
+ "canceled",
3171
+ "succeeded"
3172
+ ];
3173
+ var CHARGE_STATUSES = ["pending", "succeeded", "failed"];
3174
+ var REFUND_STATUSES = ["succeeded", "pending", "failed", "canceled"];
3175
+ var BALANCE_TX_STATUSES = ["pending", "available"];
3176
+ var paymentIntentSeedSchema = z.object({
3177
+ id: z.string().min(1),
3178
+ account_id: z.string().min(1),
3179
+ amount: z.number().int(),
3180
+ currency: z.string().min(1),
3181
+ status: z.enum(PI_STATUSES),
3182
+ payment_method_types: z.array(z.string()).default(["crypto"]),
3183
+ next_action: z.unknown().nullable().optional(),
3184
+ latest_charge_id: z.string().nullable().optional(),
3185
+ capture_method: z.string().default("automatic"),
3186
+ confirmation_method: z.string().default("automatic"),
3187
+ idempotency_key: z.string().nullable().optional(),
3188
+ metadata: z.record(z.string(), z.string()).default({}),
3189
+ crypto_deposit: z.unknown().nullable().optional(),
3190
+ client_secret: z.string().min(1),
3191
+ created: z.number().int(),
3192
+ updated: z.number().int(),
3193
+ canceled_at: z.number().int().nullable().optional(),
3194
+ captured_at: z.number().int().nullable().optional()
3195
+ });
3196
+ var chargeSeedSchema = z.object({
3197
+ id: z.string().min(1),
3198
+ account_id: z.string().min(1),
3199
+ payment_intent_id: z.string().min(1),
3200
+ amount: z.number().int(),
3201
+ amount_captured: z.number().int().default(0),
3202
+ amount_refunded: z.number().int().default(0),
3203
+ status: z.enum(CHARGE_STATUSES),
3204
+ balance_transaction_id: z.string().nullable().optional(),
3205
+ captured: z.boolean().default(true),
3206
+ currency: z.string().min(1),
3207
+ created: z.number().int()
3208
+ });
3209
+ var refundSeedSchema = z.object({
3210
+ id: z.string().min(1),
3211
+ account_id: z.string().min(1),
3212
+ charge_id: z.string().min(1),
3213
+ payment_intent_id: z.string().min(1),
3214
+ amount: z.number().int(),
3215
+ currency: z.string().min(1),
3216
+ status: z.enum(REFUND_STATUSES),
3217
+ reason: z.string().nullable().optional(),
3218
+ balance_transaction_id: z.string().nullable().optional(),
3219
+ idempotency_key: z.string().nullable().optional(),
3220
+ created: z.number().int()
3221
+ });
3222
+ var balanceTransactionSeedSchema = z.object({
3223
+ id: z.string().min(1),
3224
+ account_id: z.string().min(1),
3225
+ type: z.string().min(1),
3226
+ amount: z.number().int(),
3227
+ fee: z.number().int().default(0),
3228
+ net: z.number().int(),
3229
+ currency: z.string().min(1),
3230
+ source_id: z.string().nullable().optional(),
3231
+ source_type: z.string().nullable().optional(),
3232
+ available_on: z.number().int(),
3233
+ status: z.enum(BALANCE_TX_STATUSES).default("available"),
3234
+ created: z.number().int()
3235
+ });
3236
+ var seedSchema = z.object({
3237
+ api_keys: z.array(z.object({
3238
+ key: z.string().min(1),
3239
+ sid: z.string().min(1),
3240
+ account_id: z.string().min(1).optional()
3241
+ })).default([]),
3242
+ failure_injection: z.array(failureInjectionRuleSchema).default([]),
3243
+ payment_intents: z.array(paymentIntentSeedSchema).default([]),
3244
+ charges: z.array(chargeSeedSchema).default([]),
3245
+ refunds: z.array(refundSeedSchema).default([]),
3246
+ balance_transactions: z.array(balanceTransactionSeedSchema).default([])
3247
+ });
3248
+ function parseSeed(input) {
3249
+ return seedSchema.parse(input);
3250
+ }
3251
+ function loadSeedFromEnv(env = process.env) {
3252
+ const raw = env.POME_SEED_JSON;
3253
+ if (raw === void 0 || raw === "") {
3254
+ return defaultSeed();
3255
+ }
3256
+ let parsed;
3257
+ try {
3258
+ parsed = JSON.parse(raw);
3259
+ } catch (err) {
3260
+ throw new Error(`POME_SEED_JSON is not valid JSON: ${err.message}`);
3261
+ }
3262
+ const unwrapped = unwrapStripeSeed(parsed);
3263
+ return parseSeed(unwrapped);
3264
+ }
3265
+ function unwrapStripeSeed(value) {
3266
+ if (value && typeof value === "object" && !Array.isArray(value)) {
3267
+ const stripeKey = value.stripe;
3268
+ if (stripeKey && typeof stripeKey === "object" && !Array.isArray(stripeKey)) {
3269
+ const inner = stripeKey.seed;
3270
+ if (inner !== void 0) {
3271
+ return inner;
3272
+ }
3273
+ }
3274
+ }
3275
+ return value;
3276
+ }
3277
+ function defaultSeed() {
3278
+ return {
3279
+ api_keys: [
3280
+ { key: DEFAULT_API_KEY, sid: DEFAULT_SID, account_id: `acct_${DEFAULT_SID}` }
3281
+ ],
3282
+ failure_injection: [],
3283
+ payment_intents: [],
3284
+ charges: [],
3285
+ refunds: [],
3286
+ balance_transactions: []
3287
+ };
3288
+ }
3289
+ function applySeed(db, seed, failureInjection) {
3290
+ ensureStripeTables(db);
3291
+ for (const entry of seed.api_keys ?? []) {
3292
+ mintApiKey(db, {
3293
+ sid: entry.sid,
3294
+ account_id: entry.account_id,
3295
+ key: entry.key
3296
+ });
3297
+ }
3298
+ for (const row of seed.payment_intents ?? []) {
3299
+ insertSeedPaymentIntent(db, row);
3300
+ }
3301
+ for (const row of seed.charges ?? []) {
3302
+ insertSeedCharge(db, row);
3303
+ }
3304
+ for (const row of seed.balance_transactions ?? []) {
3305
+ insertSeedBalanceTransaction(db, row);
3306
+ }
3307
+ for (const row of seed.refunds ?? []) {
3308
+ insertSeedRefund(db, row);
3309
+ }
3310
+ if (failureInjection) {
3311
+ failureInjection.setRules(seed.failure_injection ?? []);
3312
+ }
3313
+ }
3314
+ function insertSeedPaymentIntent(db, row) {
3315
+ db.prepare(`INSERT INTO payment_intents (
3316
+ id, account_id, amount, currency, status,
3317
+ payment_method_types_json, next_action_json,
3318
+ latest_charge_id, capture_method, confirmation_method,
3319
+ idempotency_key, metadata_json, crypto_deposit_json,
3320
+ client_secret, created, updated, canceled_at, captured_at
3321
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(row.id, row.account_id, row.amount, row.currency, row.status, JSON.stringify(row.payment_method_types), row.next_action === void 0 || row.next_action === null ? null : JSON.stringify(row.next_action), row.latest_charge_id ?? null, row.capture_method, row.confirmation_method, row.idempotency_key ?? null, JSON.stringify(row.metadata), row.crypto_deposit === void 0 || row.crypto_deposit === null ? null : JSON.stringify(row.crypto_deposit), row.client_secret, row.created, row.updated, row.canceled_at ?? null, row.captured_at ?? null);
3322
+ }
3323
+ function insertSeedCharge(db, row) {
3324
+ db.prepare(`INSERT INTO charges (
3325
+ id, account_id, payment_intent_id, amount, amount_captured, amount_refunded,
3326
+ status, balance_transaction_id, captured, currency, created
3327
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(row.id, row.account_id, row.payment_intent_id, row.amount, row.amount_captured, row.amount_refunded, row.status, row.balance_transaction_id ?? null, row.captured ? 1 : 0, row.currency, row.created);
3328
+ }
3329
+ function insertSeedRefund(db, row) {
3330
+ db.prepare(`INSERT INTO refunds (
3331
+ id, account_id, charge_id, payment_intent_id, amount, currency,
3332
+ status, reason, balance_transaction_id, idempotency_key, created
3333
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(row.id, row.account_id, row.charge_id, row.payment_intent_id, row.amount, row.currency, row.status, row.reason ?? null, row.balance_transaction_id ?? null, row.idempotency_key ?? null, row.created);
3334
+ }
3335
+ function insertSeedBalanceTransaction(db, row) {
3336
+ db.prepare(`INSERT INTO balance_transactions (
3337
+ id, account_id, type, amount, fee, net, currency, source_id, source_type,
3338
+ available_on, status, created
3339
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(row.id, row.account_id, row.type, row.amount, row.fee, row.net, row.currency, row.source_id ?? null, row.source_type ?? null, row.available_on, row.status, row.created);
3340
+ }
3341
+
3342
+ // ../packages/twin-stripe/dist/src/x402.js
3343
+ function parsePriceToBaseUnits(price) {
3344
+ const trimmed = price.trim();
3345
+ const match = trimmed.match(/^\$?\s*(\d+(?:\.\d+)?)\s*([A-Za-z]+)?$/);
3346
+ if (!match) {
3347
+ throw new Error(`paymentMiddleware: cannot parse price "${price}"`);
3348
+ }
3349
+ const numStr = match[1];
3350
+ const asset = (match[2] ?? "USDC").toUpperCase();
3351
+ const decimals = 6;
3352
+ const [whole, frac = ""] = numStr.split(".");
3353
+ const fracPadded = (frac + "0".repeat(decimals)).slice(0, decimals);
3354
+ const combined = `${whole}${fracPadded}`.replace(/^0+(?=\d)/, "");
3355
+ return {
3356
+ amount: combined === "" ? "0" : combined,
3357
+ asset,
3358
+ decimals
3359
+ };
3360
+ }
3361
+ var TwinFacilitatorClient = class {
3362
+ opts;
3363
+ constructor(opts) {
3364
+ this.opts = opts;
3365
+ }
3366
+ get fetch_() {
3367
+ return this.opts.fetch ?? globalThis.fetch;
3368
+ }
3369
+ url(path) {
3370
+ let base = this.opts.twinBaseUrl;
3371
+ while (base.endsWith("/")) {
3372
+ base = base.slice(0, -1);
3373
+ }
3374
+ return `${base}/s/${encodeURIComponent(this.opts.sid)}${path}`;
3375
+ }
3376
+ headers(extra = {}) {
3377
+ return {
3378
+ Authorization: `Bearer ${this.opts.apiKey}`,
3379
+ "Content-Type": "application/json",
3380
+ ...extra
3381
+ };
3382
+ }
3383
+ /**
3384
+ * Create a crypto-mode PaymentIntent on the twin and pull the deposit
3385
+ * address out of `next_action.crypto_display_details.deposit_addresses.<network>.address`.
3386
+ *
3387
+ * Network parsing: `eip155:84532` → `base`. (We accept either form; v1
3388
+ * supports `base` only.)
3389
+ */
3390
+ async createCryptoPaymentIntent(args) {
3391
+ const networkSlug = networkToSlug(args.network);
3392
+ const body = {
3393
+ amount: args.amount,
3394
+ currency: args.currency,
3395
+ payment_method_types: ["crypto"],
3396
+ payment_method_options: {
3397
+ crypto: {
3398
+ mode: "deposit",
3399
+ deposit_options: { networks: [networkSlug] }
3400
+ }
3401
+ },
3402
+ metadata: args.metadata ?? {}
3403
+ };
3404
+ const res = await this.fetch_(this.url("/v1/payment_intents"), {
3405
+ method: "POST",
3406
+ headers: this.headers(),
3407
+ body: JSON.stringify(body)
3408
+ });
3409
+ if (!res.ok) {
3410
+ const text = await safeReadText(res);
3411
+ throw new Error(`TwinFacilitatorClient.createCryptoPaymentIntent: twin returned ${res.status}: ${text}`);
3412
+ }
3413
+ const pi = await res.json();
3414
+ const id = String(pi.id ?? "");
3415
+ const status = String(pi.status ?? "");
3416
+ const depositAddress = extractDepositAddress(pi, networkSlug);
3417
+ if (!id || !depositAddress) {
3418
+ throw new Error(`TwinFacilitatorClient.createCryptoPaymentIntent: malformed PI from twin: ${JSON.stringify(pi).slice(0, 256)}`);
3419
+ }
3420
+ return { id, depositAddress, status };
3421
+ }
3422
+ async retrievePaymentIntent(id) {
3423
+ const res = await this.fetch_(this.url(`/v1/payment_intents/${encodeURIComponent(id)}`), {
3424
+ method: "GET",
3425
+ headers: this.headers()
3426
+ });
3427
+ if (!res.ok) {
3428
+ const text = await safeReadText(res);
3429
+ throw new Error(`retrievePaymentIntent ${id}: ${res.status} ${text}`);
3430
+ }
3431
+ return await res.json();
3432
+ }
3433
+ /** Settle a crypto-mode PI by calling the test helper. */
3434
+ async simulateCryptoDeposit(piId) {
3435
+ const res = await this.fetch_(this.url(`/v1/test_helpers/payment_intents/${encodeURIComponent(piId)}/simulate_crypto_deposit`), {
3436
+ method: "POST",
3437
+ headers: this.headers(),
3438
+ body: JSON.stringify({})
3439
+ });
3440
+ if (!res.ok) {
3441
+ const text = await safeReadText(res);
3442
+ throw new Error(`simulateCryptoDeposit ${piId}: ${res.status} ${text}`);
3443
+ }
3444
+ return await res.json();
3445
+ }
3446
+ };
3447
+ function networkToSlug(network) {
3448
+ if (/^eip155:/i.test(network))
3449
+ return "base";
3450
+ return network.toLowerCase();
3451
+ }
3452
+ function extractDepositAddress(pi, networkSlug) {
3453
+ const next = pi.next_action ?? null;
3454
+ const display = next?.crypto_display_details ?? null;
3455
+ const addrs = display?.deposit_addresses ?? null;
3456
+ if (!addrs)
3457
+ return void 0;
3458
+ const entry = addrs[networkSlug] ?? addrs["base"] ?? null;
3459
+ if (!entry)
3460
+ return void 0;
3461
+ return typeof entry === "string" ? entry : entry.address;
3462
+ }
3463
+ async function safeReadText(res) {
3464
+ try {
3465
+ return await res.text();
3466
+ } catch {
3467
+ return "<unreadable>";
3468
+ }
3469
+ }
3470
+ function decodeXPayment(header) {
3471
+ const json = base64decodeToString(header);
3472
+ const obj = JSON.parse(json);
3473
+ if (!obj || typeof obj !== "object") {
3474
+ throw new Error("X-PAYMENT: not a JSON object");
3475
+ }
3476
+ const auth = obj?.payload?.authorization;
3477
+ if (!auth || typeof auth.to !== "string" || typeof auth.value !== "string") {
3478
+ throw new Error("X-PAYMENT: missing authorization.to or authorization.value");
3479
+ }
3480
+ return obj;
3481
+ }
3482
+ function base64decodeToString(b64) {
3483
+ if (typeof Buffer !== "undefined") {
3484
+ return Buffer.from(b64, "base64").toString("utf8");
3485
+ }
3486
+ return atob(b64);
3487
+ }
3488
+ function base64encodeFromString(s) {
3489
+ if (typeof Buffer !== "undefined") {
3490
+ return Buffer.from(s, "utf8").toString("base64");
3491
+ }
3492
+ return btoa(s);
3493
+ }
3494
+ var ChallengeCache = class {
3495
+ ttlMs;
3496
+ byPayTo = /* @__PURE__ */ new Map();
3497
+ byPaymentHeader = /* @__PURE__ */ new Map();
3498
+ constructor(ttlMs) {
3499
+ this.ttlMs = ttlMs;
3500
+ }
3501
+ rememberChallenge(c) {
3502
+ this.byPayTo.set(c.payTo.toLowerCase(), c);
3503
+ }
3504
+ lookupByPayTo(payTo) {
3505
+ const hit = this.byPayTo.get(payTo.toLowerCase());
3506
+ if (!hit)
3507
+ return void 0;
3508
+ if (Date.now() - hit.createdAt > this.ttlMs) {
3509
+ this.byPayTo.delete(payTo.toLowerCase());
3510
+ return void 0;
3511
+ }
3512
+ return hit;
3513
+ }
3514
+ rememberSettled(headerB64, result) {
3515
+ this.byPaymentHeader.set(headerB64, { piId: result.piId, status: result.status, result: result.result });
3516
+ }
3517
+ lookupSettled(headerB64) {
3518
+ return this.byPaymentHeader.get(headerB64);
3519
+ }
3520
+ /** Test-only: clear in-memory state. */
3521
+ clear() {
3522
+ this.byPayTo.clear();
3523
+ this.byPaymentHeader.clear();
3524
+ }
3525
+ };
3526
+ function paymentMiddleware(routes, twinOpts) {
3527
+ const facilitator = new TwinFacilitatorClient(resolveStaticTwinOptions(twinOpts));
3528
+ const cache = new ChallengeCache(twinOpts.challengeTtlMs ?? 5 * 6e4);
3529
+ for (const [key, cfg] of Object.entries(routes)) {
3530
+ if (!/^[A-Z]+\s+\//.test(key)) {
3531
+ throw new Error(`paymentMiddleware: route keys must look like "GET /paid"; got "${key}"`);
3532
+ }
3533
+ if (!cfg.accepts || cfg.accepts.length === 0) {
3534
+ throw new Error(`paymentMiddleware: route "${key}" must declare at least one accepts entry`);
3535
+ }
3536
+ for (const a of cfg.accepts) {
3537
+ if (a.scheme !== "exact") {
3538
+ throw new Error(`paymentMiddleware: only scheme "exact" is supported in v1, got "${a.scheme}"`);
3539
+ }
3540
+ }
3541
+ }
3542
+ const handler = async (c, next) => {
3543
+ const method = c.req.method.toUpperCase();
3544
+ const url = new URL(c.req.url);
3545
+ const routeKey = resolveRouteKey(method, url.pathname, routes);
3546
+ const config = routeKey ? routes[routeKey] : void 0;
3547
+ if (!config || !routeKey) {
3548
+ return next();
3549
+ }
3550
+ const requestFacilitator = new TwinFacilitatorClient(await resolveTwinOptions(c, twinOpts));
3551
+ const headerB64 = c.req.header("X-PAYMENT") ?? c.req.header("x-payment");
3552
+ if (!headerB64) {
3553
+ const body = await build402Body(c, config, requestFacilitator, cache, routeKey);
3554
+ return c.json(body, 402);
3555
+ }
3556
+ let payload;
3557
+ try {
3558
+ payload = decodeXPayment(headerB64);
3559
+ } catch (err) {
3560
+ return c.json({
3561
+ x402Version: 1,
3562
+ error: `X-PAYMENT: malformed (${err.message})`,
3563
+ accepts: await buildAcceptsList(c, config, requestFacilitator, cache, routeKey)
3564
+ }, 402);
3565
+ }
3566
+ const seen = cache.lookupSettled(headerB64);
3567
+ if (seen) {
3568
+ return next();
3569
+ }
3570
+ const auth = payload.payload.authorization;
3571
+ const challenge = cache.lookupByPayTo(auth.to);
3572
+ if (!challenge) {
3573
+ return c.json({
3574
+ x402Version: 1,
3575
+ error: `X-PAYMENT.authorization.to=${auth.to} does not match any active challenge`,
3576
+ accepts: await buildAcceptsList(c, config, requestFacilitator, cache, routeKey)
3577
+ }, 402);
3578
+ }
3579
+ if (auth.value !== challenge.amount) {
3580
+ return c.json({
3581
+ x402Version: 1,
3582
+ error: `X-PAYMENT.authorization.value=${auth.value} does not match required ${challenge.amount}`,
3583
+ accepts: await buildAcceptsList(c, config, requestFacilitator, cache, routeKey)
3584
+ }, 402);
3585
+ }
3586
+ if (challenge.network !== payload.network) {
3587
+ return c.json({
3588
+ x402Version: 1,
3589
+ error: `X-PAYMENT.network=${payload.network} does not match challenge.network=${challenge.network}`,
3590
+ accepts: await buildAcceptsList(c, config, requestFacilitator, cache, routeKey)
3591
+ }, 402);
3592
+ }
3593
+ try {
3594
+ let pi;
3595
+ try {
3596
+ pi = await requestFacilitator.simulateCryptoDeposit(challenge.paymentIntentId);
3597
+ } catch (err) {
3598
+ pi = await requestFacilitator.retrievePaymentIntent(challenge.paymentIntentId);
3599
+ if (pi.status !== "succeeded") {
3600
+ throw err;
3601
+ }
3602
+ }
3603
+ if (pi.status !== "succeeded") {
3604
+ return c.json({
3605
+ x402Version: 1,
3606
+ error: `settlement: PI ${challenge.paymentIntentId} did not advance to succeeded (status=${pi.status})`,
3607
+ accepts: await buildAcceptsList(c, config, requestFacilitator, cache, routeKey, twinOpts)
3608
+ }, 402);
3609
+ }
3610
+ cache.rememberSettled(headerB64, {
3611
+ piId: challenge.paymentIntentId,
3612
+ status: 200,
3613
+ result: pi
3614
+ });
3615
+ } catch (err) {
3616
+ return c.json({
3617
+ x402Version: 1,
3618
+ error: `settlement: ${err.message}`,
3619
+ accepts: await buildAcceptsList(c, config, requestFacilitator, cache, routeKey)
3620
+ }, 402);
3621
+ }
3622
+ const respHeader = base64encodeFromString(JSON.stringify({
3623
+ success: true,
3624
+ transaction: challenge.paymentIntentId,
3625
+ network: challenge.network,
3626
+ payer: auth.from
3627
+ }));
3628
+ c.header("X-PAYMENT-RESPONSE", respHeader);
3629
+ await next();
3630
+ };
3631
+ return Object.assign(handler, {
3632
+ facilitator,
3633
+ _resetCache: () => cache.clear()
3634
+ });
3635
+ }
3636
+ function resolveRouteKey(method, pathname, routes) {
3637
+ const direct = `${method} ${pathname}`;
3638
+ if (routes[direct])
3639
+ return direct;
3640
+ const sessionless = pathname.replace(/^\/s\/[^/]+/, "") || "/";
3641
+ const stripped = `${method} ${sessionless}`;
3642
+ return routes[stripped] ? stripped : void 0;
3643
+ }
3644
+ function resolveStaticTwinOptions(opts) {
3645
+ return {
3646
+ ...opts,
3647
+ apiKey: typeof opts.apiKey === "function" ? "sk_test_pome_default" : opts.apiKey,
3648
+ sid: typeof opts.sid === "function" ? "default" : opts.sid
3649
+ };
3650
+ }
3651
+ async function resolveTwinOptions(c, opts) {
3652
+ return {
3653
+ ...opts,
3654
+ apiKey: await resolveContextValue(c, opts.apiKey),
3655
+ sid: await resolveContextValue(c, opts.sid)
3656
+ };
3657
+ }
3658
+ async function resolveContextValue(c, value) {
3659
+ if (typeof value === "function") {
3660
+ return value(c);
3661
+ }
3662
+ return value;
3663
+ }
3664
+ async function build402Body(c, config, facilitator, cache, routeKey, twinOpts) {
3665
+ const accepts = await buildAcceptsList(c, config, facilitator, cache, routeKey);
3666
+ return {
3667
+ x402Version: 1,
3668
+ accepts,
3669
+ error: "payment required"
3670
+ };
3671
+ }
3672
+ async function buildAcceptsList(c, config, facilitator, cache, routeKey, twinOpts) {
3673
+ const out = [];
3674
+ for (let i = 0; i < config.accepts.length; i++) {
3675
+ const a = config.accepts[i];
3676
+ const parsed = parsePriceToBaseUnits(a.price);
3677
+ const explicitPayTo = await resolveExplicitPayTo(a.payTo, c);
3678
+ let payTo;
3679
+ let piId;
3680
+ if (explicitPayTo) {
3681
+ const created2 = await facilitator.createCryptoPaymentIntent({
3682
+ amount: Number(parsed.amount),
3683
+ // PI currency is always USD per Stripe x402 docs (the on-chain leg
3684
+ // is USDC but Stripe captures the PI in USD). parsed.asset is the
3685
+ // wire asset name (USDC) and stays in the x402 accepts entry below.
3686
+ currency: "usd",
3687
+ network: a.network,
3688
+ metadata: { x402_route: routeKey, x402_explicit_payTo: explicitPayTo }
3689
+ });
3690
+ payTo = explicitPayTo;
3691
+ piId = created2.id;
3692
+ } else {
3693
+ const cached = findReusable(cache, routeKey, i, parsed.amount);
3694
+ if (cached) {
3695
+ payTo = cached.payTo;
3696
+ piId = cached.paymentIntentId;
3697
+ } else {
3698
+ const created2 = await facilitator.createCryptoPaymentIntent({
3699
+ amount: Number(parsed.amount),
3700
+ // PI currency is always USD per Stripe x402 docs (the on-chain leg
3701
+ // is USDC but Stripe captures the PI in USD). parsed.asset is the
3702
+ // wire asset name (USDC) and stays in the x402 accepts entry below.
3703
+ currency: "usd",
3704
+ network: a.network,
3705
+ metadata: { x402_route: routeKey }
3706
+ });
3707
+ payTo = created2.depositAddress;
3708
+ piId = created2.id;
3709
+ }
3710
+ }
3711
+ const entry = {
3712
+ scheme: "exact",
3713
+ network: a.network,
3714
+ maxAmountRequired: parsed.amount,
3715
+ resource: a.resource ?? c.req.url,
3716
+ description: a.description ?? config.description ?? "",
3717
+ mimeType: a.mimeType ?? config.mimeType ?? "application/json",
3718
+ payTo,
3719
+ maxTimeoutSeconds: a.maxTimeoutSeconds ?? 60,
3720
+ asset: a.asset ?? parsed.asset,
3721
+ outputSchema: null,
3722
+ extra: a.extra
3723
+ };
3724
+ out.push(entry);
3725
+ cache.rememberChallenge({
3726
+ routeKey,
3727
+ acceptsIndex: i,
3728
+ payTo,
3729
+ amount: parsed.amount,
3730
+ asset: entry.asset,
3731
+ network: a.network,
3732
+ paymentIntentId: piId,
3733
+ createdAt: Date.now()
3734
+ });
3735
+ }
3736
+ return out;
3737
+ }
3738
+ function findReusable(cache, routeKey, acceptsIndex, amount) {
3739
+ for (const c of cache.byPayTo.values()) {
3740
+ if (c.routeKey === routeKey && c.acceptsIndex === acceptsIndex && c.amount === amount && Date.now() - c.createdAt < cache.ttlMs) {
3741
+ return c;
3742
+ }
3743
+ }
3744
+ return void 0;
3745
+ }
3746
+ async function resolveExplicitPayTo(payTo, c) {
3747
+ if (!payTo)
3748
+ return void 0;
3749
+ if (typeof payTo === "string")
3750
+ return payTo;
3751
+ return await payTo(c);
3752
+ }
3753
+
3754
+ // ../packages/twin-stripe/dist/src/session.js
3755
+ function recordGatedExchange(recorder, runId) {
3756
+ return async (c, next) => {
3757
+ const started = Date.now();
3758
+ await next();
3759
+ let responseBody = null;
3760
+ try {
3761
+ responseBody = await c.res.clone().json();
3762
+ } catch {
3763
+ responseBody = null;
3764
+ }
3765
+ const status = c.res.status;
3766
+ recorder.record({
3767
+ ts: (/* @__PURE__ */ new Date()).toISOString(),
3768
+ run_id: runId,
3769
+ twin: "stripe",
3770
+ request_id: `req_${crypto.randomUUID()}`,
3771
+ correlation_id: c.req.header("x-pome-correlation-id") ?? `req_${crypto.randomUUID()}`,
3772
+ task_step_id: c.req.header("x-pome-scenario-step-id") ?? null,
3773
+ scenario_step_id: c.req.header("x-pome-scenario-step-id") ?? null,
3774
+ step_id: null,
3775
+ tool_call_id: null,
3776
+ method: c.req.method,
3777
+ path: new URL(c.req.url).pathname,
3778
+ request_body: null,
3779
+ request_headers: recordedRequestHeaders(c),
3780
+ // No MCP counterpart — x402 is a wire protocol, not a twin action.
3781
+ tool: null,
3782
+ status,
3783
+ response_body: responseBody,
3784
+ latency_ms: Date.now() - started,
3785
+ fidelity: "semantic",
3786
+ state_mutation: false,
3787
+ state_delta: null,
3788
+ error: status >= 400 ? x402Error(responseBody) : null
3789
+ });
3790
+ };
3791
+ }
3792
+ function x402Error(body) {
3793
+ if (body && typeof body === "object" && "error" in body) {
3794
+ const message = body.error;
3795
+ if (typeof message === "string")
3796
+ return message;
3797
+ }
3798
+ return "payment required";
3799
+ }
3800
+ function registerX402Routes(session, opts) {
3801
+ session.use("/x402/*", recordGatedExchange(opts.recorder, opts.runId));
3802
+ session.use(paymentMiddleware({
3803
+ "GET /x402/protected-resource": {
3804
+ accepts: [
3805
+ {
3806
+ scheme: "exact",
3807
+ price: "$0.01",
3808
+ network: "eip155:84532",
3809
+ description: "Unlock the hosted Stripe x402 protected resource"
3810
+ }
3811
+ ],
3812
+ description: "Hosted Stripe x402 protected resource",
3813
+ mimeType: "application/json"
3814
+ }
3815
+ }, {
3816
+ twinBaseUrl: opts.twinBaseUrl,
3817
+ sid: (c) => {
3818
+ const sess = c.get("session");
3819
+ return sess?.sid ?? "default";
3820
+ },
3821
+ apiKey: (c) => {
3822
+ const header = c.req.header("authorization") ?? c.req.header("Authorization") ?? "";
3823
+ return header.replace(/^bearer\s+/i, "");
3824
+ }
3825
+ }));
3826
+ session.get("/x402/protected-resource", (c) => c.json({
3827
+ ok: true,
3828
+ resource: "stripe-x402-protected-resource",
3829
+ message: "Payment verified by the Stripe twin."
3830
+ }));
3831
+ }
3832
+ var piPMTypes = z.array(z.enum(["crypto", "card"])).length(1);
3833
+ var cryptoOptions = z.object({
3834
+ mode: z.literal("deposit"),
3835
+ deposit_options: z.object({
3836
+ networks: z.array(z.string()).min(1).optional()
3837
+ }).optional()
3838
+ });
3839
+ var limitShape = {
3840
+ limit: z.coerce.number().int().min(1).max(100).optional()
3841
+ };
3842
+ var createdRange = {
3843
+ created: z.union([
3844
+ z.coerce.number().int(),
3845
+ z.object({
3846
+ gt: z.coerce.number().int().optional(),
3847
+ gte: z.coerce.number().int().optional(),
3848
+ lt: z.coerce.number().int().optional(),
3849
+ lte: z.coerce.number().int().optional()
3850
+ })
3851
+ ]).optional()
3852
+ };
3853
+ function flattenCreated(input) {
3854
+ if (input.created === void 0)
3855
+ return {};
3856
+ if (typeof input.created === "number") {
3857
+ return { created_gte: input.created, created_lte: input.created };
3858
+ }
3859
+ return {
3860
+ created_gt: input.created.gt,
3861
+ created_gte: input.created.gte,
3862
+ created_lt: input.created.lt,
3863
+ created_lte: input.created.lte
3864
+ };
3865
+ }
3866
+ var toolDefinitions = [
3867
+ {
3868
+ name: "create_payment_intent",
3869
+ description: "Create a PaymentIntent: crypto-deposit (the x402 entry point) or card (optionally with payment_method / customer / confirm).",
3870
+ schema: z.object({
3871
+ amount: z.coerce.number().int().positive(),
3872
+ currency: z.string().min(1),
3873
+ payment_method_types: piPMTypes,
3874
+ payment_method_options: z.object({
3875
+ crypto: cryptoOptions
3876
+ }).optional(),
3877
+ payment_method: z.string().optional(),
3878
+ customer: z.string().optional(),
3879
+ confirm: z.boolean().optional(),
3880
+ metadata: z.record(z.string(), z.string()).optional(),
3881
+ capture_method: z.string().optional(),
3882
+ confirmation_method: z.string().optional()
3883
+ })
3884
+ },
3885
+ {
3886
+ name: "retrieve_payment_intent",
3887
+ description: "Retrieve a PaymentIntent by id.",
3888
+ schema: z.object({ id: z.string().min(1) })
3889
+ },
3890
+ {
3891
+ name: "list_payment_intents",
3892
+ description: "List PaymentIntents with optional filters.",
3893
+ schema: z.object({ ...limitShape, ...createdRange })
3894
+ },
3895
+ {
3896
+ name: "confirm_payment_intent",
3897
+ description: "Confirm a PaymentIntent. Card PIs attempt the charge synchronously (magic test PMs decline); crypto-deposit PIs are idempotent here.",
3898
+ schema: z.object({ id: z.string().min(1), payment_method: z.string().optional() })
3899
+ },
3900
+ {
3901
+ name: "update_payment_intent",
3902
+ description: "Update a non-terminal PaymentIntent (amount, metadata, payment_method, customer). The card retry step: attach a new PM after a decline, then confirm again.",
3903
+ schema: z.object({
3904
+ id: z.string().min(1),
3905
+ amount: z.coerce.number().int().optional(),
3906
+ metadata: z.record(z.string(), z.string().nullable()).optional(),
3907
+ payment_method: z.string().optional(),
3908
+ customer: z.string().optional()
3909
+ })
3910
+ },
3911
+ {
3912
+ name: "cancel_payment_intent",
3913
+ description: "Cancel a PaymentIntent. Refused once succeeded.",
3914
+ schema: z.object({ id: z.string().min(1) })
3915
+ },
3916
+ {
3917
+ name: "simulate_crypto_deposit",
3918
+ description: "Test helper: drive a crypto-deposit PI from requires_action through processing to succeeded.",
3919
+ schema: z.object({ id: z.string().min(1) })
3920
+ },
3921
+ {
3922
+ name: "retrieve_charge",
3923
+ description: "Retrieve a Charge by id.",
3924
+ schema: z.object({ id: z.string().min(1) })
3925
+ },
3926
+ {
3927
+ name: "list_charges",
3928
+ description: "List charges with optional payment_intent / customer / created filters.",
3929
+ schema: z.object({
3930
+ ...limitShape,
3931
+ ...createdRange,
3932
+ payment_intent: z.string().optional(),
3933
+ customer: z.string().optional()
3934
+ })
3935
+ },
3936
+ {
3937
+ name: "create_refund",
3938
+ description: "Refund a charge, fully or partially. Stripe refuses a refund on a charge that is already fully refunded, or one that would exceed the remaining refundable amount.",
3939
+ schema: z.object({
3940
+ charge: z.string().min(1),
3941
+ amount: z.coerce.number().int().positive().optional(),
3942
+ reason: z.string().optional()
3943
+ })
3944
+ },
3945
+ {
3946
+ name: "retrieve_refund",
3947
+ description: "Retrieve a Refund by id.",
3948
+ schema: z.object({ id: z.string().min(1) })
3949
+ },
3950
+ {
3951
+ name: "list_refunds",
3952
+ description: "List refunds, optionally filtered by charge or payment_intent.",
3953
+ schema: z.object({
3954
+ ...limitShape,
3955
+ ...createdRange,
3956
+ charge: z.string().optional(),
3957
+ payment_intent: z.string().optional()
3958
+ })
3959
+ },
3960
+ {
3961
+ name: "create_customer",
3962
+ description: "Create a customer. All fields optional, like real Stripe.",
3963
+ schema: z.object({
3964
+ name: z.string().optional(),
3965
+ email: z.string().optional(),
3966
+ description: z.string().optional(),
3967
+ phone: z.string().optional(),
3968
+ metadata: z.record(z.string(), z.string()).optional()
3969
+ })
3970
+ },
3971
+ {
3972
+ name: "retrieve_customer",
3973
+ description: "Retrieve a Customer by id. Deleted customers return the {deleted: true} stub.",
3974
+ schema: z.object({ id: z.string().min(1) })
3975
+ },
3976
+ {
3977
+ name: "update_customer",
3978
+ description: "Update a customer's fields. Metadata merges per-key; a null or empty value unsets the key.",
3979
+ schema: z.object({
3980
+ id: z.string().min(1),
3981
+ name: z.string().optional(),
3982
+ email: z.string().optional(),
3983
+ description: z.string().optional(),
3984
+ phone: z.string().optional(),
3985
+ // Nullable values mirror the REST surface: null (or "") unsets the key.
3986
+ metadata: z.record(z.string(), z.string().nullable()).optional()
3987
+ })
3988
+ },
3989
+ {
3990
+ name: "delete_customer",
3991
+ description: "Delete a customer (soft delete; its payment methods are detached).",
3992
+ schema: z.object({ id: z.string().min(1) })
3993
+ },
3994
+ {
3995
+ name: "list_customers",
3996
+ description: "List customers with optional email / created filters.",
3997
+ schema: z.object({
3998
+ ...limitShape,
3999
+ ...createdRange,
4000
+ email: z.string().optional()
4001
+ })
4002
+ },
4003
+ {
4004
+ name: "list_customer_payment_methods",
4005
+ description: "List the payment methods attached to a customer.",
4006
+ schema: z.object({
4007
+ customer: z.string().min(1),
4008
+ type: z.string().optional(),
4009
+ ...limitShape
4010
+ })
4011
+ },
4012
+ {
4013
+ name: "create_payment_method",
4014
+ description: "Create a card payment method from test card details (e.g. number 4242424242424242).",
4015
+ schema: z.object({
4016
+ type: z.literal("card"),
4017
+ card: z.object({
4018
+ number: z.string().min(1),
4019
+ exp_month: z.coerce.number().int(),
4020
+ exp_year: z.coerce.number().int(),
4021
+ cvc: z.string().optional()
4022
+ })
4023
+ })
4024
+ },
4025
+ {
4026
+ name: "retrieve_payment_method",
4027
+ description: "Retrieve a PaymentMethod by id.",
4028
+ schema: z.object({ id: z.string().min(1) })
4029
+ },
4030
+ {
4031
+ name: "attach_payment_method",
4032
+ description: "Attach a payment method to a customer. One customer per PM; a detached PM cannot be reattached.",
4033
+ schema: z.object({ id: z.string().min(1), customer: z.string().min(1) })
4034
+ },
4035
+ {
4036
+ name: "detach_payment_method",
4037
+ description: "Detach a payment method from its customer.",
4038
+ schema: z.object({ id: z.string().min(1) })
4039
+ },
4040
+ {
4041
+ name: "retrieve_balance",
4042
+ description: "Retrieve the current balance (available + pending per currency).",
4043
+ schema: z.object({}).optional()
4044
+ },
4045
+ {
4046
+ name: "list_balance_transactions",
4047
+ description: "List balance transactions (charges, refunds, fees).",
4048
+ schema: z.object({
4049
+ ...limitShape,
4050
+ ...createdRange,
4051
+ type: z.string().optional()
4052
+ })
4053
+ },
4054
+ {
4055
+ name: "retrieve_event",
4056
+ description: "Retrieve an event by id.",
4057
+ schema: z.object({ id: z.string().min(1) })
4058
+ },
4059
+ {
4060
+ name: "list_events",
4061
+ description: "List events. Filter by type and created.",
4062
+ schema: z.object({
4063
+ ...limitShape,
4064
+ ...createdRange,
4065
+ type: z.string().optional()
4066
+ })
4067
+ }
4068
+ ];
4069
+ function listTools() {
4070
+ return toolDefinitions.map((tool) => ({
4071
+ name: tool.name,
4072
+ description: tool.description,
4073
+ input_schema: schemaToJson(tool.schema)
4074
+ }));
4075
+ }
4076
+ function isMutatingTool(name) {
4077
+ return [
4078
+ "create_payment_intent",
4079
+ "confirm_payment_intent",
4080
+ "update_payment_intent",
4081
+ "cancel_payment_intent",
4082
+ "simulate_crypto_deposit",
4083
+ "create_refund",
4084
+ "create_customer",
4085
+ "update_customer",
4086
+ "delete_customer",
4087
+ "create_payment_method",
4088
+ "attach_payment_method",
4089
+ "detach_payment_method"
4090
+ ].includes(name);
4091
+ }
4092
+ function executeTool(domain, accountId2, name, input) {
4093
+ const definition = toolDefinitions.find((tool) => tool.name === name);
4094
+ if (!definition) {
4095
+ throw new TwinError("invalid_request_error", "tool_unknown", `No such MCP tool: '${name}'.`, { param: "tool", statusCode: 400 });
4096
+ }
4097
+ const parsed = definition.schema.parse(input ?? {});
4098
+ switch (name) {
4099
+ case "create_payment_intent":
4100
+ return domain.createPaymentIntent(accountId2, parsed).body;
4101
+ case "retrieve_payment_intent":
4102
+ return domain.retrievePaymentIntent(accountId2, parsed.id);
4103
+ case "list_payment_intents": {
4104
+ const flat = flattenCreated(parsed);
4105
+ return domain.listPaymentIntents(accountId2, { ...parsed, ...flat });
4106
+ }
4107
+ case "confirm_payment_intent":
4108
+ return domain.confirmPaymentIntent(accountId2, parsed.id, {
4109
+ payment_method: parsed.payment_method
4110
+ }).body;
4111
+ case "update_payment_intent": {
4112
+ const { id, ...fields } = parsed;
4113
+ return domain.updatePaymentIntent(accountId2, id, fields).body;
4114
+ }
4115
+ case "cancel_payment_intent":
4116
+ return domain.cancelPaymentIntent(accountId2, parsed.id).body;
4117
+ case "simulate_crypto_deposit":
4118
+ return domain.simulateCryptoDeposit(accountId2, parsed.id).body;
4119
+ case "retrieve_charge":
4120
+ return domain.retrieveCharge(accountId2, parsed.id);
4121
+ case "list_charges": {
4122
+ const flat = flattenCreated(parsed);
4123
+ return domain.listCharges(accountId2, { ...parsed, ...flat });
4124
+ }
4125
+ case "create_refund":
4126
+ return domain.createRefund(accountId2, parsed).body;
4127
+ case "retrieve_refund":
4128
+ return domain.retrieveRefund(accountId2, parsed.id);
4129
+ case "list_refunds": {
4130
+ const flat = flattenCreated(parsed);
4131
+ return domain.listRefunds(accountId2, { ...parsed, ...flat });
4132
+ }
4133
+ case "create_customer":
4134
+ return domain.createCustomer(accountId2, parsed).body;
4135
+ case "retrieve_customer":
4136
+ return domain.retrieveCustomer(accountId2, parsed.id);
4137
+ case "update_customer": {
4138
+ const { id, ...fields } = parsed;
4139
+ return domain.updateCustomer(accountId2, id, fields).body;
4140
+ }
4141
+ case "delete_customer":
4142
+ return domain.deleteCustomer(accountId2, parsed.id).body;
4143
+ case "list_customers": {
4144
+ const flat = flattenCreated(parsed);
4145
+ return domain.listCustomers(accountId2, { ...parsed, ...flat });
4146
+ }
4147
+ case "list_customer_payment_methods": {
4148
+ const { customer, ...rest } = parsed;
4149
+ return domain.listCustomerPaymentMethods(accountId2, customer, rest);
4150
+ }
4151
+ case "create_payment_method":
4152
+ return domain.createPaymentMethod(accountId2, parsed).body;
4153
+ case "retrieve_payment_method":
4154
+ return domain.retrievePaymentMethod(accountId2, parsed.id);
4155
+ case "attach_payment_method":
4156
+ return domain.attachPaymentMethod(accountId2, parsed.id, parsed.customer).body;
4157
+ case "detach_payment_method":
4158
+ return domain.detachPaymentMethod(accountId2, parsed.id).body;
4159
+ case "retrieve_balance":
4160
+ return domain.retrieveBalance(accountId2);
4161
+ case "list_balance_transactions": {
4162
+ const flat = flattenCreated(parsed);
4163
+ return domain.listBalanceTransactions(accountId2, { ...parsed, ...flat });
4164
+ }
4165
+ case "retrieve_event":
4166
+ return domain.retrieveEvent(accountId2, parsed.id);
4167
+ case "list_events": {
4168
+ const flat = flattenCreated(parsed);
4169
+ return domain.listEvents(accountId2, { ...parsed, ...flat });
4170
+ }
4171
+ }
4172
+ }
4173
+ function schemaToJson(schema) {
4174
+ const candidate = z.toJSONSchema;
4175
+ if (typeof candidate === "function") {
4176
+ try {
4177
+ return candidate(schema);
4178
+ } catch {
4179
+ return {};
4180
+ }
4181
+ }
4182
+ return {};
4183
+ }
4184
+
4185
+ // ../packages/twin-stripe/dist/src/twin.js
4186
+ var stripeSeedSchema = z.preprocess((value) => value === null || value === void 0 ? defaultSeed() : value, seedSchema);
4187
+ function tthwSeconds(startedAtMs, nowMs = Date.now) {
4188
+ const ms = Math.max(0, nowMs() - startedAtMs);
4189
+ return Number((ms / 1e3).toFixed(3));
4190
+ }
4191
+ function accountIdFrom(session) {
4192
+ return typeof session?.account_id === "string" ? session.account_id : "acct_default";
4193
+ }
4194
+ function zodIssues(err) {
4195
+ if (err instanceof ZodError)
4196
+ return err.issues;
4197
+ if (err instanceof Error && err.name === "ZodError" && Array.isArray(err.issues)) {
4198
+ return err.issues;
4199
+ }
4200
+ return void 0;
4201
+ }
4202
+ function stripeErrorEnvelope(err) {
4203
+ if (err instanceof UnknownToolError) {
4204
+ return stripeError("invalid_request_error", "tool_unknown", `No such MCP tool: '${err.tool}'.`, {
4205
+ param: "tool",
4206
+ statusCode: 400
4207
+ });
4208
+ }
4209
+ if (err instanceof TwinError) {
4210
+ return { status: err.status, body: err.toEnvelope() };
4211
+ }
4212
+ const issues = zodIssues(err);
4213
+ if (issues) {
4214
+ const first = issues[0];
4215
+ return stripeError("invalid_request_error", "parameter_invalid", first?.message ?? "Invalid request parameters.", {
4216
+ param: first?.path?.join(".")
4217
+ });
4218
+ }
4219
+ if (err instanceof SyntaxError) {
4220
+ return stripeError("invalid_request_error", "invalid_json", "Could not parse request body as JSON.");
4221
+ }
4222
+ return stripeError("api_error", "internal_error", err instanceof Error ? err.message : "Internal Server Error", { statusCode: 500 });
4223
+ }
4224
+ var toolListing = new Map(listTools().map((tool) => [tool.name, tool]));
4225
+ function createStripeTwinDefinition(opts) {
4226
+ const { db } = opts;
4227
+ const startedAtMs = opts.startedAtMs ?? Date.now();
4228
+ const failureInjection = createFailureInjectionStore();
4229
+ return defineTwin({
4230
+ id: "stripe",
4231
+ version: process.env.POME_TWIN_VERSION ?? "0.1.0",
4232
+ implementation: "stripe_clone",
4233
+ packageName: "@pome-sh/twin-stripe",
4234
+ fidelity: { default: "semantic" },
4235
+ // Pre-port: `payload === null ? defaultSeed() : parseSeed(payload)` —
4236
+ // an absent/unparseable seed body applies the default world.
4237
+ seed: z.preprocess((value) => value === null || value === void 0 ? defaultSeed() : value, stripeSeedSchema),
4238
+ domain: ({ db: injected, seed }) => {
4239
+ if (injected && injected !== db) {
4240
+ throw new Error("twin-stripe: the db passed to createApp/serve must be the db the definition was created with");
4241
+ }
4242
+ const domain = new StripeDomain(db);
4243
+ if (seed !== void 0)
4244
+ applySeed(db, seed, failureInjection);
4245
+ return domain;
4246
+ },
4247
+ // Session-wide middleware (the pre-port `session.use("*")` position):
4248
+ // mounted by the engine BEFORE its MCP routes, so failure injection and
4249
+ // idempotency cover /mcp, /mcp/call, /mcp/tools/:name exactly as the
4250
+ // pre-port chassis did (F-684 review pin: an Idempotency-Key'd MCP
4251
+ // create must replay, and injected rules on MCP paths must fire).
4252
+ middleware: (app, ctx) => {
4253
+ app.use("*", failureInjectionMiddleware(failureInjection, {
4254
+ recorder: ctx.recorder,
4255
+ runId: ctx.runId,
4256
+ twin: "stripe"
4257
+ }));
4258
+ app.use("*", idempotencyMiddleware(db, ctx.recorder, ctx.runId));
4259
+ },
4260
+ // Frozen pre-port body parsing on the engine-owned surfaces (F-684
4261
+ // review pin). Two pre-port readers existed: /admin/seed was strict
4262
+ // JSON with a null fallback (null → default seed via the schema
4263
+ // preprocess below), while the MCP dispatch surfaces used
4264
+ // routes/index.ts's form-or-JSON reader ({} fallback).
4265
+ bodyReader: async (c) => {
4266
+ if (new URL(c.req.url).pathname.endsWith("/admin/seed")) {
4267
+ try {
4268
+ return await c.req.json();
4269
+ } catch {
4270
+ return null;
4271
+ }
4272
+ }
4273
+ const contentType = c.req.header("content-type") ?? "";
4274
+ if (contentType.includes("application/x-www-form-urlencoded")) {
4275
+ try {
4276
+ return await c.req.parseBody();
4277
+ } catch {
4278
+ return {};
4279
+ }
4280
+ }
4281
+ try {
4282
+ return await c.req.json();
4283
+ } catch {
4284
+ return {};
4285
+ }
4286
+ },
4287
+ routes: (app, ctx) => {
4288
+ opts.extendRoutes?.(app, ctx);
4289
+ registerStripeRoutes(app, ctx.domain, ctx.recorder, ctx.runId);
4290
+ if (opts.twinBaseUrl) {
4291
+ registerX402Routes(app, {
4292
+ twinBaseUrl: opts.twinBaseUrl,
4293
+ recorder: ctx.recorder,
4294
+ runId: ctx.runId
4295
+ });
4296
+ }
4297
+ },
4298
+ // Account-scoped state export (F1): two sessions sharing a DB see
4299
+ // disjoint `/_pome/state` views.
4300
+ state: ({ domain, session }) => session ? domain.exportState(accountIdFrom(session)) : { payment_intents: [], charges: [], balance_transactions: [], events: [] },
4301
+ admin: {
4302
+ reset: () => {
4303
+ resetDatabase(db);
4304
+ applySeed(db, defaultSeed(), failureInjection);
4305
+ return { ok: true, message: "Stripe twin state reset to default seed." };
4306
+ },
4307
+ seed: ({ seed }) => {
4308
+ resetDatabase(db);
4309
+ applySeed(db, seed, failureInjection);
4310
+ return {
4311
+ ok: true,
4312
+ api_keys: (seed.api_keys ?? []).length,
4313
+ failure_injection: (seed.failure_injection ?? []).length
4314
+ };
4315
+ },
4316
+ // Frozen tape shape: stripe's pre-port recorder never saw admin
4317
+ // traffic — /admin/reset|seed emit no events (F-684 review pin).
4318
+ recorded: false,
4319
+ // Frozen stripe admin-gate 403 body.
4320
+ forbidden: () => forbidden("Forbidden")
4321
+ },
4322
+ tools: toolDefinitions.map((def) => ({
4323
+ name: def.name,
4324
+ description: def.description,
4325
+ schema: def.schema,
4326
+ mutation: isMutatingTool(def.name),
4327
+ inputSchema: toolListing.get(def.name)?.input_schema,
4328
+ handler: (domain, args, ctx) => executeTool(domain, accountIdFrom(ctx.session), def.name, args)
4329
+ })),
4330
+ // Frozen healthz extras: fidelity + tthw_seconds on top of the contract
4331
+ // core {ok, twin, implementation, tools, runtime}.
4332
+ healthz: () => ({ fidelity: "semantic", tthw_seconds: tthwSeconds(startedAtMs) }),
4333
+ // Frozen per-session health shape: implementation/fidelity/tthw/runtime
4334
+ // plus recorder counters (bounded store: real dropped count, D-ENG-10).
4335
+ pomeHealth: ({ recorder }) => ({
4336
+ implementation: "stripe_clone",
4337
+ fidelity: "semantic",
4338
+ tthw_seconds: tthwSeconds(startedAtMs),
4339
+ runtime: twinBuildInfo("@pome-sh/twin-stripe"),
4340
+ recorder: { events: recorder.count(), dropped: recorder.dropped() }
4341
+ }),
4342
+ // Frozen per-twin difference: stripe has NO per-session /healthz (501).
4343
+ sessionHealthz: false,
4344
+ // F3 SDK-compat root mount: stripe-node/stripe-python URLs (/v1/*) hit
4345
+ // the same session router; the bearer alone resolves the sid.
4346
+ mountSessionAtRoot: true,
4347
+ unsupported: () => unsupported(),
4348
+ errorEnvelope: stripeErrorEnvelope,
4349
+ auth: {
4350
+ // F-712 pins: liberal bearer parsing ON (raw token + case-insensitive
4351
+ // "bearer"); sid mismatch → 403; api_keys table lookup ahead of
4352
+ // provider-shaped verify + JWT; no path sid required (root mount);
4353
+ // expired-vs-invalid classified by the engine and rendered through
4354
+ // the frozen unauthorized envelope.
4355
+ providerToken: { provider: "stripe", prefixes: ["sk_test_pome_"] },
4356
+ providerSession: (sid) => ({ account_id: `acct_${sid}`, via: "api_key" }),
4357
+ allowRawBearer: true,
4358
+ requirePathSid: false,
4359
+ resolveCredential: (token) => {
4360
+ if (!looksLikeApiKey(token))
4361
+ return void 0;
4362
+ const row = resolveSidFromKey(db, token);
4363
+ return row ? { sid: row.sid, account_id: row.account_id, via: "api_key" } : void 0;
4364
+ },
4365
+ unauthorized: (kind, info) => {
4366
+ const message = kind === "expired" ? "Token expired" : info?.token && looksLikeApiKey(info.token) ? "Invalid API Key provided." : "Bad credentials";
4367
+ const envelope = unauthorized(message);
4368
+ return { status: envelope.status, body: envelope.body };
4369
+ },
4370
+ sidMismatch: () => {
4371
+ const envelope = forbidden("Session id mismatch.");
4372
+ return { status: envelope.status, body: envelope.body };
4373
+ },
4374
+ sessionExtras: (claims) => ({
4375
+ account_id: typeof claims.account_id === "string" ? claims.account_id : `acct_${claims.sid}`,
4376
+ via: "jwt"
4377
+ })
4378
+ }
4379
+ });
4380
+ }
4381
+ function createTwinStripeApp(opts = {}) {
4382
+ const db = opts.db ?? openTwinStripeDatabase(":memory:");
4383
+ const definition = createStripeTwinDefinition({
4384
+ db,
4385
+ twinBaseUrl: opts.twinBaseUrl,
4386
+ startedAtMs: opts.startedAtMs,
4387
+ extendRoutes: opts.extendRoutes
4388
+ });
4389
+ const seed = opts.noSeed ? void 0 : opts.seed ?? (opts.db ? void 0 : defaultSeed());
4390
+ return createApp(definition, {
4391
+ db,
4392
+ recorder: opts.recorder,
4393
+ runId: opts.runId ?? "local",
4394
+ seed
4395
+ });
4396
+ }
4397
+
4398
+ export { DEFAULT_API_KEY, DEFAULT_SID, StripeDomain, applySeed, createStripeTwinDefinition, createTwinStripeApp, defaultSeed, executeTool, isMutatingTool, listTools, loadSeedFromEnv, migrate, mintApiKey, openTwinStripeDatabase, parseSeed, paymentMiddleware, registerStripeRoutes, registerX402Routes, resetDatabase, resolveSidFromKey, revokeApiKey, seedSchema, toolDefinitions, tthwSeconds };