@greatwait/contracts 0.1.0-alpha.2 → 0.1.0-alpha.4

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 (349) hide show
  1. package/README.md +11 -9
  2. package/dist/authority.d.ts +84 -21
  3. package/dist/authority.js +47 -2
  4. package/dist/billing.d.ts +1001 -0
  5. package/dist/billing.js +684 -0
  6. package/dist/callback-safety.d.ts +2 -2
  7. package/dist/callback-safety.js +2 -2
  8. package/dist/compatibility.d.ts +3 -3
  9. package/dist/compatibility.js +1 -1
  10. package/dist/data-export.d.ts +67 -0
  11. package/dist/data-export.js +182 -0
  12. package/dist/endpoints.d.ts +181 -240
  13. package/dist/endpoints.js +77 -81
  14. package/dist/events.d.ts +17 -17
  15. package/dist/events.js +1 -1
  16. package/dist/first-value-journey.d.ts +192 -42
  17. package/dist/first-value-journey.js +212 -6
  18. package/dist/forecast.d.ts +71 -71
  19. package/dist/forecast.js +1 -1
  20. package/dist/identifiers.d.ts +20 -20
  21. package/dist/identifiers.js +1 -1
  22. package/dist/identity.d.ts +45 -41
  23. package/dist/identity.js +5 -4
  24. package/dist/index.d.ts +13 -8
  25. package/dist/index.js +13 -8
  26. package/dist/mcp.d.ts +201 -0
  27. package/dist/mcp.js +214 -0
  28. package/dist/naming.d.ts +45 -0
  29. package/dist/naming.js +159 -0
  30. package/dist/oauth.d.ts +186 -172
  31. package/dist/oauth.js +84 -8
  32. package/dist/operation-definitions.d.ts +9 -0
  33. package/dist/operation-definitions.js +7 -0
  34. package/dist/operations.d.ts +4359 -2214
  35. package/dist/operations.js +2754 -881
  36. package/dist/organization-lifecycle.d.ts +34 -0
  37. package/dist/organization-lifecycle.js +122 -0
  38. package/dist/partition.d.ts +26 -0
  39. package/dist/policy.d.ts +4 -4
  40. package/dist/policy.js +9 -5
  41. package/dist/problems.d.ts +32 -26
  42. package/dist/problems.js +6 -2
  43. package/dist/protocol.d.ts +204 -75
  44. package/dist/protocol.js +108 -36
  45. package/dist/scheduling-records.d.ts +343 -285
  46. package/dist/scheduling-records.js +1 -1
  47. package/dist/scheduling.d.ts +670 -360
  48. package/dist/scheduling.js +382 -56
  49. package/dist/secrets.d.ts +119 -105
  50. package/dist/secrets.js +1 -1
  51. package/dist/signatures.d.ts +74 -74
  52. package/dist/signatures.js +1 -1
  53. package/dist/tenancy.d.ts +142 -68
  54. package/dist/tenancy.js +70 -17
  55. package/dist/test-sink.d.ts +127 -127
  56. package/dist/test-sink.js +1 -1
  57. package/dist/time.d.ts +4 -4
  58. package/dist/time.js +1 -1
  59. package/dist/timing.d.ts +65 -0
  60. package/dist/timing.js +82 -0
  61. package/dist/usage.d.ts +103 -47
  62. package/dist/usage.js +197 -31
  63. package/dist/workspace.d.ts +34 -34
  64. package/dist/workspace.js +1 -1
  65. package/dist/zod-values.d.ts +3 -0
  66. package/dist/zod-values.js +2 -0
  67. package/dist/zod.d.ts +2 -0
  68. package/dist/zod.js +2 -0
  69. package/generated/v1/examples/attempts.list.response.json +4 -0
  70. package/generated/v1/examples/attempts.read.response.json +4 -0
  71. package/generated/v1/examples/billing.autotopup.request.json +5 -0
  72. package/generated/v1/examples/billing.autotopup.response.json +120 -0
  73. package/generated/v1/examples/billing.autotopuppreview.request.json +19 -0
  74. package/generated/v1/examples/billing.autotopuppreview.response.json +45 -0
  75. package/generated/v1/examples/billing.budgets.request.json +13 -0
  76. package/generated/v1/examples/billing.budgets.response.json +22 -0
  77. package/generated/v1/examples/billing.ceiling.request.json +8 -0
  78. package/generated/v1/examples/billing.ceiling.response.json +120 -0
  79. package/generated/v1/examples/billing.change.request.json +5 -0
  80. package/generated/v1/examples/billing.change.response.json +12 -0
  81. package/generated/v1/examples/billing.funding.response.json +120 -0
  82. package/generated/v1/examples/billing.fundingquote.request.json +7 -0
  83. package/generated/v1/examples/billing.fundingquote.response.json +13 -0
  84. package/generated/v1/examples/billing.ledger.response.json +23 -0
  85. package/generated/v1/examples/billing.notices.response.json +41 -0
  86. package/generated/v1/examples/billing.notificationsettings.response.json +17 -0
  87. package/generated/v1/examples/billing.notificationsettingsupdate.request.json +9 -0
  88. package/generated/v1/examples/billing.notificationsettingsupdate.response.json +17 -0
  89. package/generated/v1/examples/billing.portal.response.json +3 -0
  90. package/generated/v1/examples/billing.projects.response.json +12 -0
  91. package/generated/v1/examples/billing.purchase.request.json +5 -0
  92. package/generated/v1/examples/billing.purchase.response.json +120 -0
  93. package/generated/v1/examples/billing.quote.request.json +4 -0
  94. package/generated/v1/examples/billing.quote.response.json +19 -0
  95. package/generated/v1/examples/billing.reconcile.response.json +73 -0
  96. package/generated/v1/examples/billing.refundrequest.request.json +10 -0
  97. package/generated/v1/examples/billing.refundrequest.response.json +11 -0
  98. package/generated/v1/examples/billing.refundresolution.request.json +4 -0
  99. package/generated/v1/examples/billing.refundresolution.response.json +120 -0
  100. package/generated/v1/examples/billing.summary.response.json +73 -0
  101. package/generated/v1/examples/context.read.response.json +6 -0
  102. package/generated/v1/examples/credentials.connection.response.json +16 -0
  103. package/generated/v1/examples/endpoints.acknowledgeSigningKeyRotation.response.json +18 -0
  104. package/generated/v1/examples/endpoints.create.response.json +1 -1
  105. package/generated/v1/examples/endpoints.disable.response.json +0 -1
  106. package/generated/v1/examples/{endpoints.verify.response.json → endpoints.enable.response.json} +4 -5
  107. package/generated/v1/examples/endpoints.list.response.json +1 -2
  108. package/generated/v1/examples/endpoints.read.response.json +2 -2
  109. package/generated/v1/examples/endpoints.revealSigningSecret.response.json +7 -0
  110. package/generated/v1/examples/endpoints.rotateSigningKey.response.json +1 -2
  111. package/generated/v1/examples/endpoints.update.response.json +1 -1
  112. package/generated/v1/examples/executions.list.response.json +20 -0
  113. package/generated/v1/examples/exports.cancel.response.json +11 -0
  114. package/generated/v1/examples/exports.create.request.json +1 -0
  115. package/generated/v1/examples/exports.create.response.json +8 -0
  116. package/generated/v1/examples/exports.part.response.json +5 -0
  117. package/generated/v1/examples/exports.read.response.json +8 -0
  118. package/generated/v1/examples/occurrences.read.response.json +4 -0
  119. package/generated/v1/examples/organizations.close.request.json +5 -0
  120. package/generated/v1/examples/organizations.close.response.json +10 -0
  121. package/generated/v1/examples/organizations.lifecycle.response.json +10 -0
  122. package/generated/v1/examples/organizations.restore.request.json +3 -0
  123. package/generated/v1/examples/organizations.restore.response.json +10 -0
  124. package/generated/v1/examples/projects.archive.request.json +3 -0
  125. package/generated/v1/examples/projects.archive.response.json +14 -0
  126. package/generated/v1/examples/projects.create.response.json +10 -1
  127. package/generated/v1/examples/projects.delete.response.json +9 -0
  128. package/generated/v1/examples/projects.list.response.json +12 -2
  129. package/generated/v1/examples/projects.rename.request.json +3 -0
  130. package/generated/v1/examples/projects.rename.response.json +14 -0
  131. package/generated/v1/examples/schedules.archive.response.json +3 -0
  132. package/generated/v1/examples/schedules.cancel.response.json +3 -0
  133. package/generated/v1/examples/schedules.create.request.json +4 -0
  134. package/generated/v1/examples/schedules.create.response.json +3 -0
  135. package/generated/v1/examples/schedules.list.response.json +3 -0
  136. package/generated/v1/examples/schedules.pause.response.json +3 -0
  137. package/generated/v1/examples/schedules.read.response.json +6 -0
  138. package/generated/v1/examples/schedules.replace.request.json +4 -0
  139. package/generated/v1/examples/schedules.replace.response.json +3 -0
  140. package/generated/v1/examples/schedules.resume.response.json +3 -0
  141. package/generated/v1/examples/timing.summary.response.json +35 -0
  142. package/generated/v1/examples/usage.read.response.json +1 -0
  143. package/generated/v1/first-value-journey.json +19 -10
  144. package/generated/v1/manifest.json +1019 -53
  145. package/generated/v1/openapi.json +30597 -5709
  146. package/generated/v1/policy-matrix.json +290 -45
  147. package/generated/v1/schemas/attempts.list.response.json +24 -1
  148. package/generated/v1/schemas/attempts.read.response.json +24 -1
  149. package/generated/v1/schemas/billing.autotopup.request-headers.json +13 -0
  150. package/generated/v1/schemas/billing.autotopup.request.json +22 -0
  151. package/generated/v1/schemas/billing.autotopup.response-headers.json +10 -0
  152. package/generated/v1/schemas/billing.autotopup.response.json +552 -0
  153. package/generated/v1/schemas/billing.autotopuppreview.request.json +77 -0
  154. package/generated/v1/schemas/billing.autotopuppreview.response.json +277 -0
  155. package/generated/v1/schemas/billing.budgets.request-headers.json +13 -0
  156. package/generated/v1/schemas/billing.budgets.request.json +66 -0
  157. package/generated/v1/schemas/billing.budgets.response-headers.json +10 -0
  158. package/generated/v1/schemas/billing.budgets.response.json +92 -0
  159. package/generated/v1/schemas/billing.ceiling.request-headers.json +13 -0
  160. package/generated/v1/schemas/billing.ceiling.request.json +40 -0
  161. package/generated/v1/schemas/billing.ceiling.response-headers.json +10 -0
  162. package/generated/v1/schemas/billing.ceiling.response.json +552 -0
  163. package/generated/v1/schemas/billing.change.request-headers.json +13 -0
  164. package/generated/v1/schemas/billing.change.request.json +22 -0
  165. package/generated/v1/schemas/billing.change.response.json +119 -0
  166. package/generated/v1/schemas/billing.funding.response.json +552 -0
  167. package/generated/v1/schemas/billing.fundingquote.request.json +28 -0
  168. package/generated/v1/schemas/billing.fundingquote.response.json +61 -0
  169. package/generated/v1/schemas/billing.ledger.query.json +16 -0
  170. package/generated/v1/schemas/billing.ledger.response.json +125 -0
  171. package/generated/v1/schemas/billing.notices.query.json +16 -0
  172. package/generated/v1/schemas/billing.notices.response.json +278 -0
  173. package/generated/v1/schemas/billing.notificationsettings.response.json +70 -0
  174. package/generated/v1/schemas/billing.notificationsettingsupdate.request-headers.json +13 -0
  175. package/generated/v1/schemas/billing.notificationsettingsupdate.request.json +36 -0
  176. package/generated/v1/schemas/billing.notificationsettingsupdate.response-headers.json +10 -0
  177. package/generated/v1/schemas/billing.notificationsettingsupdate.response.json +70 -0
  178. package/generated/v1/schemas/billing.portal.response.json +11 -0
  179. package/generated/v1/schemas/billing.projects.response.json +119 -0
  180. package/generated/v1/schemas/billing.purchase.request-headers.json +13 -0
  181. package/generated/v1/schemas/billing.purchase.request.json +22 -0
  182. package/generated/v1/schemas/billing.purchase.response-headers.json +10 -0
  183. package/generated/v1/schemas/billing.purchase.response.json +552 -0
  184. package/generated/v1/schemas/billing.quote.request.json +20 -0
  185. package/generated/v1/schemas/billing.quote.response.json +86 -0
  186. package/generated/v1/schemas/billing.reconcile.response.json +468 -0
  187. package/generated/v1/schemas/billing.refundrequest.request-headers.json +13 -0
  188. package/generated/v1/schemas/billing.refundrequest.request.json +42 -0
  189. package/generated/v1/schemas/billing.refundrequest.response-headers.json +10 -0
  190. package/generated/v1/schemas/billing.refundrequest.response.json +45 -0
  191. package/generated/v1/schemas/billing.refundresolution.request-headers.json +13 -0
  192. package/generated/v1/schemas/billing.refundresolution.request.json +61 -0
  193. package/generated/v1/schemas/billing.refundresolution.response-headers.json +10 -0
  194. package/generated/v1/schemas/billing.refundresolution.response.json +552 -0
  195. package/generated/v1/schemas/billing.summary.response.json +468 -0
  196. package/generated/v1/schemas/context.read.response.json +45 -0
  197. package/generated/v1/schemas/credentials.connection.response.json +66 -0
  198. package/generated/v1/schemas/credentials.create.request.json +2 -0
  199. package/generated/v1/schemas/credentials.create.response.json +2 -0
  200. package/generated/v1/schemas/credentials.list.response.json +2 -0
  201. package/generated/v1/schemas/credentials.revoke.response.json +2 -0
  202. package/generated/v1/schemas/credentials.rotate.response.json +4 -0
  203. package/generated/v1/schemas/{endpoints.verify.request-headers.json → endpoints.acknowledgeSigningKeyRotation.request-headers.json} +2 -1
  204. package/generated/v1/schemas/{endpoints.verify.response.json → endpoints.acknowledgeSigningKeyRotation.response.json} +8 -21
  205. package/generated/v1/schemas/endpoints.create.request.json +5 -0
  206. package/generated/v1/schemas/endpoints.create.response.json +8 -21
  207. package/generated/v1/schemas/endpoints.disable.response.json +8 -21
  208. package/generated/v1/schemas/endpoints.enable.response-headers.json +11 -0
  209. package/generated/v1/schemas/endpoints.enable.response.json +87 -0
  210. package/generated/v1/schemas/endpoints.list.response.json +8 -21
  211. package/generated/v1/schemas/endpoints.read.response.json +8 -21
  212. package/generated/v1/schemas/endpoints.revealSigningSecret.response.json +43 -0
  213. package/generated/v1/schemas/endpoints.rotateSigningKey.response.json +8 -21
  214. package/generated/v1/schemas/endpoints.update.request.json +5 -0
  215. package/generated/v1/schemas/endpoints.update.response.json +8 -21
  216. package/generated/v1/schemas/executions.list.query.json +46 -0
  217. package/generated/v1/schemas/executions.list.response.json +116 -0
  218. package/generated/v1/schemas/exports.cancel.response.json +48 -0
  219. package/generated/v1/schemas/exports.create.request.json +6 -0
  220. package/generated/v1/schemas/exports.create.response.json +38 -0
  221. package/generated/v1/schemas/exports.part.query.json +11 -0
  222. package/generated/v1/schemas/exports.part.response.json +22 -0
  223. package/generated/v1/schemas/exports.read.response.json +38 -0
  224. package/generated/v1/schemas/grants.list.response.json +2 -0
  225. package/generated/v1/schemas/grants.revoke.response.json +2 -0
  226. package/generated/v1/schemas/occurrences.list.query.json +5 -0
  227. package/generated/v1/schemas/occurrences.list.response.json +23 -0
  228. package/generated/v1/schemas/occurrences.read.response.json +23 -0
  229. package/generated/v1/schemas/occurrences.redeliver.response.json +24 -1
  230. package/generated/v1/schemas/organizations.close.request.json +20 -0
  231. package/generated/v1/schemas/organizations.close.response.json +68 -0
  232. package/generated/v1/schemas/organizations.lifecycle.response.json +68 -0
  233. package/generated/v1/schemas/organizations.restore.request.json +13 -0
  234. package/generated/v1/schemas/organizations.restore.response.json +68 -0
  235. package/generated/v1/schemas/projects.archive.request-headers.json +11 -0
  236. package/generated/v1/schemas/projects.archive.request.json +10 -0
  237. package/generated/v1/schemas/projects.archive.response-headers.json +11 -0
  238. package/generated/v1/schemas/projects.archive.response.json +79 -0
  239. package/generated/v1/schemas/projects.create.response.json +55 -1
  240. package/generated/v1/schemas/projects.delete.request-headers.json +11 -0
  241. package/generated/v1/schemas/projects.delete.response.json +37 -0
  242. package/generated/v1/schemas/projects.list.response.json +61 -2
  243. package/generated/v1/schemas/projects.rename.request-headers.json +11 -0
  244. package/generated/v1/schemas/projects.rename.request.json +12 -0
  245. package/generated/v1/schemas/projects.rename.response-headers.json +11 -0
  246. package/generated/v1/schemas/projects.rename.response.json +79 -0
  247. package/generated/v1/schemas/schedules.archive.response.json +90 -2
  248. package/generated/v1/schemas/schedules.cancel.response.json +90 -2
  249. package/generated/v1/schemas/schedules.create.request.json +24 -3
  250. package/generated/v1/schemas/schedules.create.response.json +90 -2
  251. package/generated/v1/schemas/schedules.list.query.json +13 -0
  252. package/generated/v1/schemas/schedules.list.response.json +67 -2
  253. package/generated/v1/schemas/schedules.pause.response.json +90 -2
  254. package/generated/v1/schemas/schedules.read.response.json +90 -2
  255. package/generated/v1/schemas/schedules.replace.request.json +24 -3
  256. package/generated/v1/schemas/schedules.replace.response.json +90 -2
  257. package/generated/v1/schemas/schedules.resume.response.json +90 -2
  258. package/generated/v1/schemas/timing.summary.response.json +191 -0
  259. package/generated/v1/schemas/usage.read.query.json +7 -0
  260. package/generated/v1/schemas/usage.read.response.json +36 -1
  261. package/generated/v1/snippets/attempts.list.json +1 -0
  262. package/generated/v1/snippets/attempts.read.json +1 -0
  263. package/generated/v1/snippets/billing.autotopup.json +6 -0
  264. package/generated/v1/snippets/billing.autotopuppreview.json +6 -0
  265. package/generated/v1/snippets/billing.budgets.json +6 -0
  266. package/generated/v1/snippets/billing.ceiling.json +6 -0
  267. package/generated/v1/snippets/billing.change.json +6 -0
  268. package/generated/v1/snippets/billing.funding.json +6 -0
  269. package/generated/v1/snippets/billing.fundingquote.json +6 -0
  270. package/generated/v1/snippets/billing.ledger.json +6 -0
  271. package/generated/v1/snippets/billing.notices.json +6 -0
  272. package/generated/v1/snippets/billing.notificationsettings.json +6 -0
  273. package/generated/v1/snippets/billing.notificationsettingsupdate.json +6 -0
  274. package/generated/v1/snippets/billing.portal.json +6 -0
  275. package/generated/v1/snippets/billing.projects.json +6 -0
  276. package/generated/v1/snippets/billing.purchase.json +6 -0
  277. package/generated/v1/snippets/billing.quote.json +6 -0
  278. package/generated/v1/snippets/billing.reconcile.json +6 -0
  279. package/generated/v1/snippets/billing.refundrequest.json +6 -0
  280. package/generated/v1/snippets/billing.refundresolution.json +6 -0
  281. package/generated/v1/snippets/billing.summary.json +6 -0
  282. package/generated/v1/snippets/context.read.json +6 -0
  283. package/generated/v1/snippets/credentials.connection.json +6 -0
  284. package/generated/v1/snippets/credentials.create.json +1 -0
  285. package/generated/v1/snippets/credentials.list.json +1 -0
  286. package/generated/v1/snippets/credentials.revoke.json +1 -0
  287. package/generated/v1/snippets/credentials.rotate.json +1 -0
  288. package/generated/v1/snippets/endpoints.acknowledgeSigningKeyRotation.json +6 -0
  289. package/generated/v1/snippets/endpoints.create.json +1 -0
  290. package/generated/v1/snippets/endpoints.disable.json +1 -0
  291. package/generated/v1/snippets/{endpoints.verify.json → endpoints.enable.json} +4 -3
  292. package/generated/v1/snippets/endpoints.list.json +1 -0
  293. package/generated/v1/snippets/endpoints.read.json +1 -0
  294. package/generated/v1/snippets/endpoints.revealSigningSecret.json +6 -0
  295. package/generated/v1/snippets/endpoints.rotateSigningKey.json +1 -0
  296. package/generated/v1/snippets/endpoints.update.json +1 -0
  297. package/generated/v1/snippets/executions.list.json +6 -0
  298. package/generated/v1/snippets/exports.cancel.json +6 -0
  299. package/generated/v1/snippets/exports.create.json +6 -0
  300. package/generated/v1/snippets/exports.part.json +6 -0
  301. package/generated/v1/snippets/exports.read.json +6 -0
  302. package/generated/v1/snippets/forecast.read.json +1 -0
  303. package/generated/v1/snippets/forecast.windows.json +1 -0
  304. package/generated/v1/snippets/grants.list.json +1 -0
  305. package/generated/v1/snippets/grants.revoke.json +1 -0
  306. package/generated/v1/snippets/journey/await-occurrence.json +6 -0
  307. package/generated/v1/snippets/journey/check-credential.json +6 -0
  308. package/generated/v1/snippets/journey/check-service.json +6 -0
  309. package/generated/v1/snippets/journey/clean-up.json +6 -0
  310. package/generated/v1/snippets/journey/create-destination.json +6 -0
  311. package/generated/v1/snippets/journey/create-one-shot.json +6 -0
  312. package/generated/v1/snippets/journey/read-attempt.json +6 -0
  313. package/generated/v1/snippets/journey/read-schedule.json +6 -0
  314. package/generated/v1/snippets/journey/replay-one-shot.json +6 -0
  315. package/generated/v1/snippets/meta.scaffold.json +1 -0
  316. package/generated/v1/snippets/meta.version.json +1 -0
  317. package/generated/v1/snippets/occurrences.list.json +1 -0
  318. package/generated/v1/snippets/occurrences.read.json +1 -0
  319. package/generated/v1/snippets/occurrences.redeliver.json +1 -0
  320. package/generated/v1/snippets/organizations.close.json +6 -0
  321. package/generated/v1/snippets/organizations.lifecycle.json +6 -0
  322. package/generated/v1/snippets/organizations.restore.json +6 -0
  323. package/generated/v1/snippets/projects.archive.json +6 -0
  324. package/generated/v1/snippets/projects.create.json +1 -0
  325. package/generated/v1/snippets/projects.delete.json +6 -0
  326. package/generated/v1/snippets/projects.list.json +1 -0
  327. package/generated/v1/snippets/projects.rename.json +6 -0
  328. package/generated/v1/snippets/schedules.archive.json +1 -0
  329. package/generated/v1/snippets/schedules.cancel.json +1 -0
  330. package/generated/v1/snippets/schedules.create.json +4 -3
  331. package/generated/v1/snippets/schedules.list.json +1 -0
  332. package/generated/v1/snippets/schedules.pause.json +1 -0
  333. package/generated/v1/snippets/schedules.read.json +1 -0
  334. package/generated/v1/snippets/schedules.replace.json +4 -3
  335. package/generated/v1/snippets/schedules.resume.json +1 -0
  336. package/generated/v1/snippets/sinkdeliveries.list.json +1 -0
  337. package/generated/v1/snippets/sinkdeliveries.read.json +1 -0
  338. package/generated/v1/snippets/testsinks.configure.json +1 -0
  339. package/generated/v1/snippets/testsinks.create.json +1 -0
  340. package/generated/v1/snippets/testsinks.delete.json +1 -0
  341. package/generated/v1/snippets/testsinks.list.json +1 -0
  342. package/generated/v1/snippets/testsinks.read.json +1 -0
  343. package/generated/v1/snippets/timing.summary.json +6 -0
  344. package/generated/v1/snippets/usage.read.json +1 -0
  345. package/package.json +2 -7
  346. package/dist/callback-ownership.d.ts +0 -58
  347. package/dist/callback-ownership.js +0 -71
  348. package/generated/v1/callback-endpoint-verification.json +0 -59
  349. /package/generated/v1/schemas/{endpoints.verify.response-headers.json → endpoints.acknowledgeSigningKeyRotation.response-headers.json} +0 -0
package/dist/identity.js CHANGED
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "./zod.js";
2
2
  /**
3
3
  * External identity, and what it projects into.
4
4
  *
@@ -52,13 +52,13 @@ export const externalMembershipIdSchema = z
52
52
  .string()
53
53
  .regex(/^orgmem_[A-Za-z0-9]{1,64}$/u, 'must be a Clerk membership identifier: "orgmem_" followed by alphanumerics');
54
54
  /**
55
- * Product roles, projected from Clerk's `org:admin` and `org:member`.
55
+ * Product roles, projected from Clerk's organization roles.
56
56
  *
57
57
  * Named without the `org:` prefix because these are ours: W1-03 builds the
58
58
  * role-to-scope matrix on them, and binding that matrix to a vendor's string
59
59
  * format would make changing identity providers a contract change.
60
60
  */
61
- export const MEMBERSHIP_ROLES = ["admin", "member"];
61
+ export const MEMBERSHIP_ROLES = ["admin", "billing", "member"];
62
62
  export const membershipRoleSchema = z.enum(MEMBERSHIP_ROLES);
63
63
  /**
64
64
  * Whether a membership currently grants anything.
@@ -79,7 +79,8 @@ export function grantsAccess(status) {
79
79
  * `reconcileMembership`.
80
80
  */
81
81
  const ROLE_RANK = {
82
- admin: 1,
82
+ admin: 2,
83
+ billing: 1,
83
84
  member: 0,
84
85
  };
85
86
  const STATUS_RANK = {
package/dist/index.d.ts CHANGED
@@ -1,8 +1,10 @@
1
+ export { DATA_EXPORT_STATES, dataExportIdSchema, newDataExportId, dataExportStateSchema, dataExportCreateRequestSchema, dataExportSchema, dataExportPartRequestSchema, dataExportPartSchema, dataExportCancelledSchema, type DataExport, type DataExportPart, } from "./data-export.js";
2
+ export { organizationLifecycleSchema, organizationClosureRequestSchema, organizationRestoreRequestSchema, type OrganizationLifecycle, } from "./organization-lifecycle.js";
1
3
  export { ANY_ID_PATTERN, ID_ALPHABET, ID_PREFIXES, apiCredentialEventIdSchema, apiCredentialIdSchema, attemptIdSchema, authorizationRequestIdSchema, callbackSigningKeyIdSchema, deliveryIdSchema, endpointIdSchema, environmentIdSchema, eventIdSchema, idPattern, idSchema, newId, oauthClientIdSchema, oauthGrantEventIdSchema, oauthGrantIdSchema, occurrenceIdSchema, organizationIdSchema, projectIdSchema, resourceOf, scheduleIdSchema, testSinkDeliveryIdSchema, testSinkIdSchema, type ApiCredentialEventId, type ApiCredentialId, type AttemptId, type AuthorizationRequestId, type CallbackSigningKeyId, type DeliveryId, type EndpointId, type EnvironmentId, type IdResource, type OAuthClientId, type OAuthGrantEventId, type OAuthGrantId, type OccurrenceId, type OrganizationId, type RandomBytes, type ProjectId, type ScheduleId, type TestSinkDeliveryId, type TestSinkId, } from "./identifiers.js";
2
4
  export { durationSecondsSchema, timeZoneSchema, timestampSchema, toTimestamp, type DurationSeconds, type TimeZone, type Timestamp, } from "./time.js";
3
- export { ENVIRONMENT_KINDS_IN_ORDER, PRINCIPAL_KINDS, SCOPES, SESSION_AUTHORITY_HEADERS, authoritySchema, decideAccess, decideEnvironmentIntent, effectiveScopes, problemCodeForRefusal, environmentKindSchema, principalKindSchema, principalSchema, scopeSchema, type AccessDecision, type AccessRefusal, type AccessRequest, type Authority, type EnvironmentIntentDecision, type EnvironmentKind, type Principal, type PrincipalKind, type Scope, } from "./authority.js";
5
+ export { ENVIRONMENT_KINDS_IN_ORDER, PRINCIPAL_KINDS, SCOPES, SESSION_AUTHORITY_HEADERS, authoritySchema, credentialContextSchema, decideAccess, decideEnvironmentIntent, effectiveScopes, problemCodeForRefusal, environmentKindSchema, principalKindSchema, principalSchema, scopeSchema, type AccessDecision, type AccessRefusal, type AccessRequest, type Authority, type CredentialContext, type EnvironmentIntentDecision, type EnvironmentKind, type Principal, type PrincipalKind, type Scope, } from "./authority.js";
4
6
  export { PROBLEM_CATEGORIES, PROBLEM_CODES, fieldErrorSchema, isRetryable, problem, problemCategorySchema, problemCodeSchema, problemSchema, type FieldError, type Problem, type ProblemCategory, type ProblemCode, type ProblemOptions, } from "./problems.js";
5
- export { CONCURRENCY_HEADERS, PAGE_SIZE, canonicalRequest, classifyIdempotency, conditionalRequestHeaderSchema, decodeCursor, encodeCursor, etagSchema, freshnessSchema, projectedFreshnessSchema, fromETag, idempotencyKeySchema, idempotencyReplayResponseHeaderSchema, idempotencyRequestHeaderSchema, idempotencyReceiptSchema, idempotencyScopeSchema, pageRequestSchema, pageSchema, parsePageRequest, replayedResponseHeaderSchema, requiredIdempotencyRequestHeaderSchema, requestFingerprint, toETag, versionResponseHeaderSchema, versionSchema, type Freshness, type ProjectedFreshness, type IdempotencyKey, type IdempotencyOutcome, type IdempotencyReceipt, type IdempotencyScope, type PagePosition, type PageRequest, type PageRequestParse, type Version, } from "./protocol.js";
7
+ export { CONCURRENCY_HEADERS, PAGE_SIZE, canonicalRequest, classifyIdempotency, conditionalRequestHeaderSchema, decodeCursor, encodeCursor, etagSchema, freshnessSchema, projectedFreshnessSchema, requiredConditionalRequestHeaderSchema, fromETag, idempotencyKeySchema, idempotencyReplayResponseHeaderSchema, idempotencyRequestHeaderSchema, idempotencyReceiptSchema, idempotencyScopeSchema, HISTORY_ORDERS, historyPageRequestSchema, pageRequestSchema, scheduleListRequestSchema, parseHistoryPageRequest, pageSchema, parsePageRequest, parseScheduleListRequest, replayedResponseHeaderSchema, requiredIdempotencyRequestHeaderSchema, requestFingerprint, toETag, versionResponseHeaderSchema, versionSchema, type Freshness, type CursorBinding, type ProjectedFreshness, type IdempotencyKey, type IdempotencyOutcome, type IdempotencyReceipt, type IdempotencyScope, type PagePosition, type PageRequest, SCHEDULE_ORDERS, type ScheduleListRequest, type ScheduleListRequestParse, type ScheduleOrder, type HistoryOrder, type HistoryPageRequest, type HistoryPageRequestParse, type PageRequestParse, type Version, } from "./protocol.js";
6
8
  export { CALLBACK_CONTENT_TYPE, CALLBACK_DELIVERY_PROTOCOL, CALLBACK_DELIVERY_PROTOCOL_VERSION, CALLBACK_ENVELOPE_VERSION, CALLBACK_ENVELOPE_VERSION_2026_07_01, CALLBACK_ENVELOPE_VERSION_2026_08_08, CALLBACK_ENVELOPE_VERSION_CHANGE, CALLBACK_ENVELOPE_VERSIONS, CALLBACK_HEADERS, SIGNATURE_SCHEME, SIGNATURE_TOLERANCE_SECONDS, callbackDeferredCompletionSchema, callbackDeliveryTestVectors, callbackEnvelopeSchema, callbackEnvelopeTrigger, callbackHeadersSchema, callbackRun, callbackTriggerSchema, classifyOutcome, classifyStatus, formatSignature, extractCanonicalEnvelopeIds, isTimestampFresh, signatureHeaderSchema, serializeCallbackEnvelope, signingInput, trySigningInput, type AttemptOutcome, type CallbackDeferredCompletion, type CallbackDeliveryTestVector, type CallbackEnvelope, type CallbackRun, type CallbackTrigger, type ResponseClass, } from "./signatures.js";
7
9
  export { CREDENTIAL_PREFIX_LENGTH, CREDENTIAL_PREFIX_PATTERN, CREDENTIAL_ROTATION_OVERLAP_SECONDS, CREDENTIAL_SECRET_LENGTH, CREDENTIAL_SECRET_PATTERN, NEVER_REDACTED, REDACTED_FIELDS_EXACT, REDACTED_FIELD_FRAGMENTS, credentialCreatedSchema, credentialMetadataSchema, credentialPageSchema, credentialRequestSchema, credentialRevokedSchema, credentialRotatedSchema, credentialRotationRequestSchema, redact, type CredentialCreated, type CredentialMetadata, type CredentialPage, type CredentialRequest, type CredentialRevokedResponse, type CredentialRotated, type CredentialRotationRequest, } from "./secrets.js";
8
10
  export { MAX_PARTITION_SHARDS, PROJECTION_DRAIN_LIMIT, SINGLE_SHARD, partitionInstanceName, partitionShardCount, partitionShardFor, partitionShardForIdempotencyKey, type CreateScheduleCommand, type CreateScheduleOutcome, type AttemptPagePosition, type DrainProjectionsOutcome, type DrainProjectionsQuery, type ForecastOutcome, type ForecastPartitionBucket, type ForecastQuery, type IdempotencyDisposition, type ListSchedulesOutcome, type ListSchedulesQuery, type ListAttemptsOutcome, type ListAttemptsQuery, type ListOccurrencesOutcome, type ListOccurrencesQuery, type OccurrencePagePosition, type PartitionOutcome, type PartitionRefusal, type PartitionRefused, type PartitionRpc, type ProjectionIntent, type ReadScheduleQuery, type ReadAttemptOutcome, type ReadAttemptQuery, type ReadOccurrenceOutcome, type ReadOccurrenceQuery, type RedeliverOccurrenceCommand, type RedeliverOccurrenceOutcome, type ReplaceScheduleCommand, type RetainedProjections, type ScheduleDefinition, type ScheduleWriteCommand, type ScheduleWriteOutcome, type SettleProjectionsCommand, type SettleProjectionsOutcome, } from "./partition.js";
@@ -10,17 +12,20 @@ export { EVENT_TYPES, eventEnvelopeSchema, eventTypeSchema, genericEventSchema,
10
12
  export { MEMBERSHIP_ROLES, MEMBERSHIP_STATUSES, externalMembershipIdSchema, externalOrganizationIdSchema, externalUserIdSchema, grantsAccess, leastRole, leastStatus, membershipChangeSchema, membershipRoleSchema, membershipSchema, membershipStatusSchema, organizationTombstoneSchema, sessionMembershipSchema, type ExternalMembershipId, type ExternalOrganizationId, type ExternalUserId, type Membership, type MembershipChange, type MembershipRole, type MembershipStatus, type OrganizationTombstone, type SessionMembership, } from "./identity.js";
11
13
  export { CHANGE_KINDS, CHANGE_OPERATIONS, CHANGE_SUBJECTS, CONTRACT_VERSION, assess, changeKindSchema, classifyChange, contractVersionSchema, type ChangeKind, type ChangeOperation, type ChangeSubject, type CompatibilityVerdict, type ContractChange, } from "./compatibility.js";
12
14
  export { WORKSPACE_LAYERS, scaffoldProblemSchema, scaffoldVersionSchema, toolDescriptorSchema, toolListSchema, workspaceIdentitySchema, workspaceLayerSchema, workspaceScaffoldSchema, type ScaffoldProblem, type ScaffoldVersion, type ToolDescriptor, type ToolList, type WorkspaceIdentity, type WorkspaceLayer, type WorkspaceScaffold, } from "./workspace.js";
13
- export { MOCK_BEHAVIORS, MOCK_HEADERS, OPERATIONS, UNIVERSAL_PROBLEMS, AUTHENTICATED_PROBLEMS, findOperation, fixtureListSchema, mockBehaviorSchema, mockScenarioRequestSchema, mockScenarioResponseSchema, operationsFor, problemsFor, requestSchemaFor, responseSchemaFor, successStatusFor, type FixtureList, type McpDisposition, type MockBehavior, type MockScenarioRequest, type MockScenarioResponse, type OperationDefinition, type OperationId, type OperationSurface, } from "./operations.js";
14
- export { PROJECT_LIST_LIMIT, PROJECT_STATUSES, environmentSchema, organizationSchema, projectCreateRequestSchema, projectListSchema, projectNameSchema, projectSchema, projectStatusSchema, projectSummarySchema, provisionedProjectSchema, type Environment, type Organization, type Project, type ProjectCreateRequest, type ProjectList, type ProjectStatus, type ProjectSummary, type ProvisionedProject, } from "./tenancy.js";
15
- export { ATTEMPT_DURATION_MAX_MS, ATTEMPT_FAILURE_SNIPPET_MAX_LENGTH, ATTEMPT_REMEDIATIONS, ATTEMPT_RESPONSE_HEADER_MAX_LENGTH, ATTEMPT_STATES, CRON_EXPRESSION_MAX_LENGTH, LATENCY_CLASSES, OCCURRENCE_STATES, PARTITION_KEY_MAX_LENGTH, RECURRENCE_REQUEST_FIELDS, SCHEDULE_STATUSES, SCHEDULING_BOUNDS, TERMINAL_OCCURRENCE_STATES, attemptFailureSnippetSchema, attemptResponseHeaderSchema, attemptSchema, attemptDiagnosticSchema, attemptPageSchema, attemptRemediationSchema, attemptStateForResponse, attemptStateSchema, attemptTriggerSchema, attemptViewSchema, cronExpressionSchema, DELIVERY_COMPLETION_MODES, DELIVERY_DURATION_TIERS, DELIVERY_OVERLAP_POLICIES, DEFAULT_DELIVERY_DURATION_SECONDS, DEFAULT_DELIVERY_OVERLAP_POLICY, FREE_DELIVERY_DURATION_SECONDS, isLongRunningDuration, deliveryCompletionModeSchema, deliveryDurationSecondsSchema, deliveryOverlapPolicySchema, type DeliveryCompletionMode, type DeliveryOverlapPolicy, deriveDeliverySettings, deriveLatencyClass, generationSchema, isTerminalOccurrenceState, latencyClassSchema, occurrenceSchema, occurrencePageSchema, occurrenceStateSchema, occurrenceViewSchema, partitionKeySchema, remediationForAttempt, recurrenceSchema, schedulePageSchema, scheduleRequestSchema, scheduleSchema, scheduleStatusSchema, scheduleViewSchema, type Attempt, type AttemptFailureSnippet, type AttemptResponseHeader, type AttemptDiagnostic, type AttemptPage, type AttemptRemediation, type AttemptState, type AttemptTrigger, type AttemptView, type CronExpression, type Generation, type DeliverySettings, type LatencyClass, type Occurrence, type OccurrencePage, type OccurrenceState, type OccurrenceView, type PartitionKey, type Recurrence, type Schedule, type SchedulePage, type ScheduleRequest, type ScheduleStatus, type ScheduleView, } from "./scheduling.js";
15
+ export { MOCK_BEHAVIORS, MOCK_HEADERS, OPERATIONS, UNIVERSAL_PROBLEMS, AUTHENTICATED_PROBLEMS, SCOPED_PROBLEMS, findOperation, fixtureListSchema, mockBehaviorSchema, mockScenarioRequestSchema, mockScenarioResponseSchema, operationsFor, problemsFor, requestSchemaFor, responseSchemaFor, successStatusFor, type FixtureList, type McpDisposition, type MockBehavior, type MockScenarioRequest, type MockScenarioResponse, type OperationDefinition, type OperationId, type OperationSurface, } from "./operations.js";
16
+ export { PROJECT_LIST_LIMIT, PROJECT_STATUSES, environmentSchema, organizationSchema, projectCreateRequestSchema, projectArchiveRequestSchema, projectDeletedSchema, projectDeletionCountsSchema, projectListSchema, projectNameKey, projectNameSchema, projectSchema, projectStatusSchema, projectSummarySchema, projectUpdateRequestSchema, provisionedProjectSchema, type Environment, type Organization, type Project, type ProjectCreateRequest, type ProjectArchiveRequest, type ProjectDeleted, type ProjectDeletionCounts, type ProjectList, type ProjectStatus, type ProjectSummary, type ProjectUpdateRequest, type ProvisionedProject, } from "./tenancy.js";
17
+ export { ATTEMPT_DURATION_MAX_MS, ATTEMPT_FAILURE_SNIPPET_MAX_LENGTH, ATTEMPT_REMEDIATIONS, ATTEMPT_RESPONSE_HEADER_MAX_LENGTH, ATTEMPT_STATES, CRON_EXPRESSION_MAX_LENGTH, LATENCY_CLASSES, OCCURRENCE_STATES, PARTITION_KEY_MAX_LENGTH, RECURRENCE_REQUEST_FIELDS, SCHEDULE_STATUSES, SCHEDULING_BOUNDS, TERMINAL_OCCURRENCE_STATES, attemptFailureSnippetSchema, attemptResponseHeaderSchema, attemptSchema, attemptDiagnosticSchema, attemptPageSchema, attemptRemediationSchema, attemptStateForResponse, attemptStateSchema, attemptTriggerSchema, attemptViewSchema, cronExpressionSchema, DELIVERY_COMPLETION_MODES, DELIVERY_DURATION_TIERS, MAX_DELIVERY_DURATION_SECONDS, RESPONSE_DELIVERY_MAX_DURATION_SECONDS, DELIVERY_OVERLAP_POLICIES, DEFAULT_DELIVERY_DURATION_SECONDS, DEFAULT_DELIVERY_OVERLAP_POLICY, FREE_DELIVERY_DURATION_SECONDS, DEFAULT_ONE_SHOT_MAX_STALENESS_SECONDS, LATENESS_POLICIES, isLongRunningDuration, deliveryCompletionModeSchema, deliveryDurationSecondsSchema, deliveryOverlapPolicySchema, type DeliveryCompletionMode, type DeliveryOverlapPolicy, deriveDeliverySettings, deriveLatencyClass, deriveLatenessSettings, defaultLatenessPolicyForRecurrence, generationSchema, isTerminalOccurrenceState, latencyClassSchema, latenessPolicySchema, occurrenceSchema, occurrencePageSchema, parseProjectOccurrenceListRequest, projectOccurrenceCursorBinding, projectOccurrenceListRequestSchema, projectOccurrencePageSchema, occurrenceStateSchema, occurrenceViewSchema, partitionKeySchema, remediationForAttempt, recurrenceSchema, scheduleNameSchema, scheduleLatenessRequestSchema, scheduleLatenessSchema, schedulePageSchema, scheduleRequestSchema, scheduleSchema, scheduleStatusSchema, scheduleViewSchema, type Attempt, type AttemptFailureSnippet, type AttemptResponseHeader, type AttemptDiagnostic, type AttemptPage, type AttemptRemediation, type AttemptState, type AttemptTrigger, type AttemptView, type CronExpression, type Generation, type DeliverySettings, type LatencyClass, type LatenessPolicy, type LatenessSettings, type Occurrence, type OccurrencePage, type ProjectOccurrenceListRequest, type ProjectOccurrenceListRequestParse, type ProjectOccurrencePage, type OccurrenceState, type OccurrenceView, type PartitionKey, type Recurrence, type Schedule, type ScheduleLatenessRequest, type SchedulePage, type ScheduleRequest, type ScheduleStatus, type ScheduleView, } from "./scheduling.js";
16
18
  export { portableAttemptRecordSchema, portableEncryptedPayloadRecordSchema, portableOccurrenceRecordSchema, portableReceiptRecordSchema, portableScheduleRecordSchema, portableSchedulingRecordSetSchema, type PortableAttemptRecord, type PortableEncryptedPayloadRecord, type PortableOccurrenceRecord, type PortableReceiptRecord, type PortableScheduleRecord, type PortableSchedulingRecordSet, } from "./scheduling-records.js";
17
19
  export { ROLE_SCOPE_CEILINGS, capScopesToRole, ceilingForRole, credentialScopes, grantableScopes, policyMatrix, roleAllows, roleCanPerform, type PolicyMatrixRow, } from "./policy.js";
18
20
  export { ACCESS_TOKEN_PATTERN, ACCESS_TOKEN_TTL_SECONDS, AUTHORIZATION_CODE_PATTERN, AUTHORIZATION_CODE_TTL_SECONDS, AUTHORIZATION_REQUEST_TTL_SECONDS, MAX_REDIRECT_URIS, OAUTH_ERRORS, OAUTH_ERROR_STATUS, OAUTH_GRANT_STATUSES, OAUTH_GRANT_TYPES, OAUTH_RESPONSE_TYPES, OAUTH_REVOCATION_REASONS, OAUTH_ROUTES, OAUTH_SECRET_PATTERN, OAUTH_TOKEN_NAMESPACE_LENGTH, OAUTH_TOKEN_SECRET_LENGTH, PKCE_CHALLENGE_PATTERN, PKCE_METHODS, PKCE_VERIFIER_PATTERN, REFRESH_TOKEN_PATTERN, REFRESH_TOKEN_TTL_SECONDS, TOKEN_ENDPOINT_AUTH_METHODS, authorizationParametersSchema, authorizationServerMetadataSchema, bearerChallenge, clientRegistrationRequestSchema, clientRegistrationSchema, consentDecisionSchema, consentOutcomeSchema, consentPromptSchema, formatScopeString, isLoopbackRedirect, oauthError, oauthErrorCodeSchema, oauthErrorSchema, oauthGrantListSchema, oauthGrantRevokedSchema, oauthGrantSchema, oauthGrantStatusSchema, oauthGrantTypeSchema, oauthRevocationReasonSchema, parseScopeString, pkceMethodSchema, protectedResourceMetadataSchema, redirectUriSchema, revocationRequestSchema, tokenRequestSchema, tokenResponseSchema, type AuthorizationParameters, type AuthorizationServerMetadata, type ClientRegistration, type ClientRegistrationRequest, type ConsentDecision, type ConsentOutcome, type ConsentPrompt, type OAuthErrorBody, type OAuthErrorCode, type OAuthGrant, type OAuthGrantList, type OAuthGrantRevoked, type OAuthGrantStatus, type OAuthGrantType, type OAuthRevocationReason, type ProtectedResourceMetadata, type RevocationRequest, type TokenRequest, type TokenResponse, } from "./oauth.js";
19
21
  export { CALLBACK_ENVELOPE_HEADROOM_BYTES, CALLBACK_RECEIVER_MAX_BODY_BYTES, } from "./callback-receiver.js";
20
- export { CALLBACK_OWNERSHIP_POLICIES, DEFAULT_CALLBACK_OWNERSHIP_POLICY, readCallbackOwnershipPolicy, sendableStatuses, type CallbackOwnershipPolicy, } from "./callback-ownership.js";
21
22
  export { CALLBACK_ENDPOINT_SECRET_PATTERN, CALLBACK_URL_REJECTION_REASONS, evaluateCallbackUrl, isPublicCallbackAddress, type CallbackUrlRejectionReason, } from "./callback-safety.js";
22
- export { CALLBACK_ENDPOINT_LIMIT_PER_ENVIRONMENT, CALLBACK_ENDPOINT_STATUSES, CALLBACK_SIGNING_KEY_ROTATION_OVERLAP_SECONDS, CALLBACK_VERIFICATION_FAILURES, CALLBACK_VERIFICATION_HEADERS, CALLBACK_VERIFICATION_PROTOCOL, CALLBACK_VERIFICATION_PROTOCOL_VERSION, CALLBACK_VERIFICATION_RATE_LIMITS, CALLBACK_VERIFICATION_RESPONSE_BYTES, CALLBACK_VERIFICATION_TIMEOUT_MILLISECONDS, CALLBACK_VERIFICATION_TYPE, callbackEndpointCreatedSchema, callbackEndpointPageSchema, callbackEndpointRequestSchema, callbackEndpointRotatedSchema, callbackEndpointSchema, callbackEndpointStatusSchema, callbackSigningKeyRotationRequestSchema, callbackSigningKeysSchema, callbackVerificationChallengeSchema, callbackVerificationFailureSchema, type CallbackEndpoint, type CallbackEndpointCreated, type CallbackEndpointPage, type CallbackEndpointRequest, type CallbackEndpointRotated, type CallbackEndpointStatus, type CallbackSigningKeyRotationRequest, type CallbackSigningKeys, type CallbackVerificationChallenge, type CallbackVerificationFailure, } from "./endpoints.js";
23
+ export { CALLBACK_ENDPOINT_LIMIT_PER_ENVIRONMENT, CALLBACK_ENDPOINT_STATUSES, CALLBACK_SIGNING_KEY_ROTATION_OVERLAP_SECONDS, CALLBACK_EGRESS_FAILURES, CALLBACK_ADMISSION_RATE_LIMITS, callbackEndpointCreatedSchema, callbackEndpointNameSchema, callbackEndpointPageSchema, callbackEndpointRequestSchema, callbackEndpointRotatedSchema, callbackEndpointSchema, callbackEndpointSigningSecretsSchema, callbackEndpointStatusSchema, callbackSigningKeyRotationRequestSchema, callbackSigningKeysSchema, callbackEgressFailureSchema, type CallbackEndpoint, type CallbackEndpointCreated, type CallbackEndpointPage, type CallbackEndpointRequest, type CallbackEndpointRotated, type CallbackEndpointSigningSecrets, type CallbackEndpointStatus, type CallbackSigningKeyRotationRequest, type CallbackSigningKeys, type CallbackEgressFailure, } from "./endpoints.js";
24
+ export { compactInterval, cronWords, generatedEndpointName, generatedScheduleName, periodWords, targetDomain, } from "./naming.js";
23
25
  export { FORECAST_BOUNDS, FORECAST_BREAKDOWNS, FORECAST_COMPATIBILITY, FORECAST_RULES, FORECAST_WINDOW_VERSION, decideForecastAnswer, forecastBreakdownSchema, forecastBucketSchema, forecastBucketStartMs, forecastLatencyCountsSchema, forecastRequestSchema, forecastSchema, forecastViolations, forecastWindowBucketSchema, forecastWindowViolations, forecastWindowsSchema, mergeForecastBuckets, parseForecastRequest, resolveForecastWindow, topPartitionKeys, type Forecast, type ForecastAnswerDecision, type ForecastAnswerRefusal, type ForecastBreakdown, type ForecastBucket, type ForecastMergedBucket, type ForecastShardAnswer, type ForecastLatencyCounts, type ForecastRequest, type ForecastRequestParse, type ForecastWindow, type ForecastWindowBucket, type ForecastWindowRefusal, type ForecastWindowResolution, type ForecastWindows, } from "./forecast.js";
24
- export { CURL_JOURNEY_TOOLS, FIRST_VALUE_JOURNEY, FIRST_VALUE_PREREQUISITES, FIRST_VALUE_STEPS, FIRST_VALUE_VARIABLES, JOURNEY_CONDITIONS, MINIMUM_CURL_VERSION, journeyCapturedVariables, journeyReferences, journeyStepSchema, journeyVariable, journeyVariableSchema, resolveJourneyReferences, type FirstValueJourney, type JourneyCapture, type JourneyCondition, type JourneyExpectation, type JourneyPoll, type JourneyPrerequisite, type JourneyRecovery, type JourneyStep, type JourneyVariable, } from "./first-value-journey.js";
26
+ export { CURL_JOURNEY_TOOLS, FIRST_VALUE_JOURNEY, FIRST_VALUE_PREREQUISITES, FIRST_VALUE_STEPS, FIRST_VALUE_VARIABLES, JOURNEY_ACTIVATION_DURATIONS, JOURNEY_ACTIVATION_OUTCOMES, JOURNEY_CONDITIONS, MINIMUM_CURL_VERSION, WEBSITE_JOURNEY_STEPS, WEBSITE_JOURNEY_STEP_KEYS, journeyActivationDuration, journeyCapturedVariables, journeyPathVariables, journeyPoll, journeyPrerequisite, journeyReferences, journeyStepSchema, journeyStepVariables, journeyVariable, journeyVariableName, journeyVariableSchema, parseWebsiteActivationEvent, pathParameterNames, resolveJourneyReferences, websiteActivationEventSchema, websiteJourneySteps, type FirstValueJourney, type JourneyActivationDuration, type JourneyActivationOutcome, type JourneyCapture, type JourneyCondition, type JourneyExpectation, type JourneyPoll, type JourneyPrerequisite, type JourneyRecovery, type JourneyStep, type JourneyVariable, type WebsiteActivationEvent, } from "./first-value-journey.js";
25
27
  export { BILLABLE_TERMINAL_STATES, USAGE_BOUNDS, USAGE_WINDOW_REASONS, billableTerminalStateSchema, parseUsageRequest, resolveUsageWindow, usageDaySchema, usageRequestSchema, usageSchema, utcMidnightMs, type BillableTerminalStateName, type ResolvedUsageWindow, type UsageDayView, type UsageRequest, type UsageRequestParse, type UsageView, type UsageWindowRefusal, } from "./usage.js";
28
+ export { BILLING_ACTIVATION_MODES, BILLING_AMOUNT_SCALE, BILLING_BLOCK_REASONS, BILLING_CURRENCY, BILLING_ENTRY_KINDS, BILLING_PAYMENT_KINDS, BILLING_PAYMENT_STATES, BILLING_NOTICE_KINDS, billingAutoTopUpApplyRequestSchema, billingAutoTopUpConfigurationSchema, billingAutoTopUpPreviewRequestSchema, billingAutoTopUpPreviewSchema, billingAutoTopUpRuleSchema, billingBudgetPolicySchema, billingBudgetUpdateRequestHeadersSchema, billingBudgetUpdateRequestSchema, billingBudgetUpdateResponseSchema, billingCeilingUpdateRequestSchema, billingFundingQuoteRequestSchema, billingFundingQuoteSchema, billingFundingViewSchema, billingNoticePageSchema, billingNoticeRecoveryPathSchema, billingNoticeSchema, billingNotificationSettingsSchema, billingNotificationSettingsUpdateRequestSchema, billingLedgerEntrySchema, billingLedgerPageSchema, billingLedgerRequestSchema, billingPaymentOperationSchema, billingPeriodSummarySchema, billingPurchaseRequestSchema, billingRefundRequestCreateSchema, billingRefundResolutionRequestSchema, billingRefundRequestViewSchema, billingSummarySchema, exactCentMoneySchema, manualFundingCreditSchema, microdollarAmountSchema, nonnegativeMicrodollarAmountSchema, type BillingAutoTopUpApplyRequest, type BillingAutoTopUpConfiguration, type BillingAutoTopUpPreview, type BillingAutoTopUpPreviewRequest, type BillingAutoTopUpRule, type BillingCeilingUpdateRequest, type BillingFundingQuote, type BillingFundingQuoteRequest, type BillingFundingView, type BillingNotice, type BillingNoticePage, type BillingNotificationSettings, type BillingNotificationSettingsUpdateRequest, type BillingLedgerEntryView, type BillingLedgerPage, type BillingLedgerRequest, type BillingBudgetUpdateRequest, type BillingBudgetUpdateResponse, type BillingPaymentOperation, type BillingPurchaseRequest, type BillingRefundRequestCreate, type BillingRefundResolutionRequest, type BillingRefundRequestView, type BillingSummaryView, } from "./billing.js";
29
+ export { DELIVERY_TIMING_TARGETS_MS, DELIVERY_TIMING_VERDICTS, deliveryTimingSummarySchema, timingThresholdSummarySchema, type DeliveryTimingSummaryView, type TimingThresholdView, } from "./timing.js";
26
30
  export { CALLBACK_RECEIVER_DISPOSITIONS, CALLBACK_RECEIVER_PROTOCOL, CALLBACK_RECEIVER_STATUS, TEST_SINK_BEHAVIORS, TEST_SINK_BEHAVIOR_FACTS, TEST_SINK_BOUNDS, TEST_SINK_CLIENT_ERROR_STATUSES, TEST_SINK_DISPOSITIONS, TEST_SINK_PROTOCOL_VERSION, TEST_SINK_SERVER_ERROR_STATUSES, callbackReceiverAcknowledgementSchema, callbackReceiverDispositionSchema, resolveTestSinkAction, testSinkBehaviorSchema, testSinkCreateRequestSchema, testSinkDeliveryBodySchema, testSinkDispositionSchema, testSinkDeliveryPageSchema, testSinkDeliverySchema, testSinkPageSchema, testSinkProgramSchema, testSinkSchema, type CallbackReceiverAcknowledgement, type CallbackReceiverDisposition, type TestSink, type TestSinkAction, type TestSinkBehavior, type TestSinkCreateRequest, type TestSinkDelivery, type TestSinkDeliveryBody, type TestSinkDeliveryPage, type TestSinkDisposition, type TestSinkPage, type TestSinkProgram, } from "./test-sink.js";
31
+ export { PROJECT_BILLING_ACTIONS, projectBillingQuoteRequestSchema, projectBillingQuoteSchema, projectBillingChangeRequestSchema, projectBillingStateSchema, billingPortalSchema, type ProjectBillingQuoteRequest, type ProjectBillingQuote, type ProjectBillingChangeRequest, type ProjectBillingState, } from "./billing.js";
package/dist/index.js CHANGED
@@ -1,8 +1,10 @@
1
+ export { DATA_EXPORT_STATES, dataExportIdSchema, newDataExportId, dataExportStateSchema, dataExportCreateRequestSchema, dataExportSchema, dataExportPartRequestSchema, dataExportPartSchema, dataExportCancelledSchema, } from "./data-export.js";
2
+ export { organizationLifecycleSchema, organizationClosureRequestSchema, organizationRestoreRequestSchema, } from "./organization-lifecycle.js";
1
3
  export { ANY_ID_PATTERN, ID_ALPHABET, ID_PREFIXES, apiCredentialEventIdSchema, apiCredentialIdSchema, attemptIdSchema, authorizationRequestIdSchema, callbackSigningKeyIdSchema, deliveryIdSchema, endpointIdSchema, environmentIdSchema, eventIdSchema, idPattern, idSchema, newId, oauthClientIdSchema, oauthGrantEventIdSchema, oauthGrantIdSchema, occurrenceIdSchema, organizationIdSchema, projectIdSchema, resourceOf, scheduleIdSchema, testSinkDeliveryIdSchema, testSinkIdSchema, } from "./identifiers.js";
2
4
  export { durationSecondsSchema, timeZoneSchema, timestampSchema, toTimestamp, } from "./time.js";
3
- export { ENVIRONMENT_KINDS_IN_ORDER, PRINCIPAL_KINDS, SCOPES, SESSION_AUTHORITY_HEADERS, authoritySchema, decideAccess, decideEnvironmentIntent, effectiveScopes, problemCodeForRefusal, environmentKindSchema, principalKindSchema, principalSchema, scopeSchema, } from "./authority.js";
5
+ export { ENVIRONMENT_KINDS_IN_ORDER, PRINCIPAL_KINDS, SCOPES, SESSION_AUTHORITY_HEADERS, authoritySchema, credentialContextSchema, decideAccess, decideEnvironmentIntent, effectiveScopes, problemCodeForRefusal, environmentKindSchema, principalKindSchema, principalSchema, scopeSchema, } from "./authority.js";
4
6
  export { PROBLEM_CATEGORIES, PROBLEM_CODES, fieldErrorSchema, isRetryable, problem, problemCategorySchema, problemCodeSchema, problemSchema, } from "./problems.js";
5
- export { CONCURRENCY_HEADERS, PAGE_SIZE, canonicalRequest, classifyIdempotency, conditionalRequestHeaderSchema, decodeCursor, encodeCursor, etagSchema, freshnessSchema, projectedFreshnessSchema, fromETag, idempotencyKeySchema, idempotencyReplayResponseHeaderSchema, idempotencyRequestHeaderSchema, idempotencyReceiptSchema, idempotencyScopeSchema, pageRequestSchema, pageSchema, parsePageRequest, replayedResponseHeaderSchema, requiredIdempotencyRequestHeaderSchema, requestFingerprint, toETag, versionResponseHeaderSchema, versionSchema, } from "./protocol.js";
7
+ export { CONCURRENCY_HEADERS, PAGE_SIZE, canonicalRequest, classifyIdempotency, conditionalRequestHeaderSchema, decodeCursor, encodeCursor, etagSchema, freshnessSchema, projectedFreshnessSchema, requiredConditionalRequestHeaderSchema, fromETag, idempotencyKeySchema, idempotencyReplayResponseHeaderSchema, idempotencyRequestHeaderSchema, idempotencyReceiptSchema, idempotencyScopeSchema, HISTORY_ORDERS, historyPageRequestSchema, pageRequestSchema, scheduleListRequestSchema, parseHistoryPageRequest, pageSchema, parsePageRequest, parseScheduleListRequest, replayedResponseHeaderSchema, requiredIdempotencyRequestHeaderSchema, requestFingerprint, toETag, versionResponseHeaderSchema, versionSchema, SCHEDULE_ORDERS, } from "./protocol.js";
6
8
  export { CALLBACK_CONTENT_TYPE, CALLBACK_DELIVERY_PROTOCOL, CALLBACK_DELIVERY_PROTOCOL_VERSION, CALLBACK_ENVELOPE_VERSION, CALLBACK_ENVELOPE_VERSION_2026_07_01, CALLBACK_ENVELOPE_VERSION_2026_08_08, CALLBACK_ENVELOPE_VERSION_CHANGE, CALLBACK_ENVELOPE_VERSIONS, CALLBACK_HEADERS, SIGNATURE_SCHEME, SIGNATURE_TOLERANCE_SECONDS, callbackDeferredCompletionSchema, callbackDeliveryTestVectors, callbackEnvelopeSchema, callbackEnvelopeTrigger, callbackHeadersSchema, callbackRun, callbackTriggerSchema, classifyOutcome, classifyStatus, formatSignature, extractCanonicalEnvelopeIds, isTimestampFresh, signatureHeaderSchema, serializeCallbackEnvelope, signingInput, trySigningInput, } from "./signatures.js";
7
9
  export { CREDENTIAL_PREFIX_LENGTH, CREDENTIAL_PREFIX_PATTERN, CREDENTIAL_ROTATION_OVERLAP_SECONDS, CREDENTIAL_SECRET_LENGTH, CREDENTIAL_SECRET_PATTERN, NEVER_REDACTED, REDACTED_FIELDS_EXACT, REDACTED_FIELD_FRAGMENTS, credentialCreatedSchema, credentialMetadataSchema, credentialPageSchema, credentialRequestSchema, credentialRevokedSchema, credentialRotatedSchema, credentialRotationRequestSchema, redact, } from "./secrets.js";
8
10
  export { MAX_PARTITION_SHARDS, PROJECTION_DRAIN_LIMIT, SINGLE_SHARD, partitionInstanceName, partitionShardCount, partitionShardFor, partitionShardForIdempotencyKey, } from "./partition.js";
@@ -10,17 +12,20 @@ export { EVENT_TYPES, eventEnvelopeSchema, eventTypeSchema, genericEventSchema,
10
12
  export { MEMBERSHIP_ROLES, MEMBERSHIP_STATUSES, externalMembershipIdSchema, externalOrganizationIdSchema, externalUserIdSchema, grantsAccess, leastRole, leastStatus, membershipChangeSchema, membershipRoleSchema, membershipSchema, membershipStatusSchema, organizationTombstoneSchema, sessionMembershipSchema, } from "./identity.js";
11
13
  export { CHANGE_KINDS, CHANGE_OPERATIONS, CHANGE_SUBJECTS, CONTRACT_VERSION, assess, changeKindSchema, classifyChange, contractVersionSchema, } from "./compatibility.js";
12
14
  export { WORKSPACE_LAYERS, scaffoldProblemSchema, scaffoldVersionSchema, toolDescriptorSchema, toolListSchema, workspaceIdentitySchema, workspaceLayerSchema, workspaceScaffoldSchema, } from "./workspace.js";
13
- export { MOCK_BEHAVIORS, MOCK_HEADERS, OPERATIONS, UNIVERSAL_PROBLEMS, AUTHENTICATED_PROBLEMS, findOperation, fixtureListSchema, mockBehaviorSchema, mockScenarioRequestSchema, mockScenarioResponseSchema, operationsFor, problemsFor, requestSchemaFor, responseSchemaFor, successStatusFor, } from "./operations.js";
14
- export { PROJECT_LIST_LIMIT, PROJECT_STATUSES, environmentSchema, organizationSchema, projectCreateRequestSchema, projectListSchema, projectNameSchema, projectSchema, projectStatusSchema, projectSummarySchema, provisionedProjectSchema, } from "./tenancy.js";
15
- export { ATTEMPT_DURATION_MAX_MS, ATTEMPT_FAILURE_SNIPPET_MAX_LENGTH, ATTEMPT_REMEDIATIONS, ATTEMPT_RESPONSE_HEADER_MAX_LENGTH, ATTEMPT_STATES, CRON_EXPRESSION_MAX_LENGTH, LATENCY_CLASSES, OCCURRENCE_STATES, PARTITION_KEY_MAX_LENGTH, RECURRENCE_REQUEST_FIELDS, SCHEDULE_STATUSES, SCHEDULING_BOUNDS, TERMINAL_OCCURRENCE_STATES, attemptFailureSnippetSchema, attemptResponseHeaderSchema, attemptSchema, attemptDiagnosticSchema, attemptPageSchema, attemptRemediationSchema, attemptStateForResponse, attemptStateSchema, attemptTriggerSchema, attemptViewSchema, cronExpressionSchema, DELIVERY_COMPLETION_MODES, DELIVERY_DURATION_TIERS, DELIVERY_OVERLAP_POLICIES, DEFAULT_DELIVERY_DURATION_SECONDS, DEFAULT_DELIVERY_OVERLAP_POLICY, FREE_DELIVERY_DURATION_SECONDS, isLongRunningDuration, deliveryCompletionModeSchema, deliveryDurationSecondsSchema, deliveryOverlapPolicySchema, deriveDeliverySettings, deriveLatencyClass, generationSchema, isTerminalOccurrenceState, latencyClassSchema, occurrenceSchema, occurrencePageSchema, occurrenceStateSchema, occurrenceViewSchema, partitionKeySchema, remediationForAttempt, recurrenceSchema, schedulePageSchema, scheduleRequestSchema, scheduleSchema, scheduleStatusSchema, scheduleViewSchema, } from "./scheduling.js";
15
+ export { MOCK_BEHAVIORS, MOCK_HEADERS, OPERATIONS, UNIVERSAL_PROBLEMS, AUTHENTICATED_PROBLEMS, SCOPED_PROBLEMS, findOperation, fixtureListSchema, mockBehaviorSchema, mockScenarioRequestSchema, mockScenarioResponseSchema, operationsFor, problemsFor, requestSchemaFor, responseSchemaFor, successStatusFor, } from "./operations.js";
16
+ export { PROJECT_LIST_LIMIT, PROJECT_STATUSES, environmentSchema, organizationSchema, projectCreateRequestSchema, projectArchiveRequestSchema, projectDeletedSchema, projectDeletionCountsSchema, projectListSchema, projectNameKey, projectNameSchema, projectSchema, projectStatusSchema, projectSummarySchema, projectUpdateRequestSchema, provisionedProjectSchema, } from "./tenancy.js";
17
+ export { ATTEMPT_DURATION_MAX_MS, ATTEMPT_FAILURE_SNIPPET_MAX_LENGTH, ATTEMPT_REMEDIATIONS, ATTEMPT_RESPONSE_HEADER_MAX_LENGTH, ATTEMPT_STATES, CRON_EXPRESSION_MAX_LENGTH, LATENCY_CLASSES, OCCURRENCE_STATES, PARTITION_KEY_MAX_LENGTH, RECURRENCE_REQUEST_FIELDS, SCHEDULE_STATUSES, SCHEDULING_BOUNDS, TERMINAL_OCCURRENCE_STATES, attemptFailureSnippetSchema, attemptResponseHeaderSchema, attemptSchema, attemptDiagnosticSchema, attemptPageSchema, attemptRemediationSchema, attemptStateForResponse, attemptStateSchema, attemptTriggerSchema, attemptViewSchema, cronExpressionSchema, DELIVERY_COMPLETION_MODES, DELIVERY_DURATION_TIERS, MAX_DELIVERY_DURATION_SECONDS, RESPONSE_DELIVERY_MAX_DURATION_SECONDS, DELIVERY_OVERLAP_POLICIES, DEFAULT_DELIVERY_DURATION_SECONDS, DEFAULT_DELIVERY_OVERLAP_POLICY, FREE_DELIVERY_DURATION_SECONDS, DEFAULT_ONE_SHOT_MAX_STALENESS_SECONDS, LATENESS_POLICIES, isLongRunningDuration, deliveryCompletionModeSchema, deliveryDurationSecondsSchema, deliveryOverlapPolicySchema, deriveDeliverySettings, deriveLatencyClass, deriveLatenessSettings, defaultLatenessPolicyForRecurrence, generationSchema, isTerminalOccurrenceState, latencyClassSchema, latenessPolicySchema, occurrenceSchema, occurrencePageSchema, parseProjectOccurrenceListRequest, projectOccurrenceCursorBinding, projectOccurrenceListRequestSchema, projectOccurrencePageSchema, occurrenceStateSchema, occurrenceViewSchema, partitionKeySchema, remediationForAttempt, recurrenceSchema, scheduleNameSchema, scheduleLatenessRequestSchema, scheduleLatenessSchema, schedulePageSchema, scheduleRequestSchema, scheduleSchema, scheduleStatusSchema, scheduleViewSchema, } from "./scheduling.js";
16
18
  export { portableAttemptRecordSchema, portableEncryptedPayloadRecordSchema, portableOccurrenceRecordSchema, portableReceiptRecordSchema, portableScheduleRecordSchema, portableSchedulingRecordSetSchema, } from "./scheduling-records.js";
17
19
  export { ROLE_SCOPE_CEILINGS, capScopesToRole, ceilingForRole, credentialScopes, grantableScopes, policyMatrix, roleAllows, roleCanPerform, } from "./policy.js";
18
20
  export { ACCESS_TOKEN_PATTERN, ACCESS_TOKEN_TTL_SECONDS, AUTHORIZATION_CODE_PATTERN, AUTHORIZATION_CODE_TTL_SECONDS, AUTHORIZATION_REQUEST_TTL_SECONDS, MAX_REDIRECT_URIS, OAUTH_ERRORS, OAUTH_ERROR_STATUS, OAUTH_GRANT_STATUSES, OAUTH_GRANT_TYPES, OAUTH_RESPONSE_TYPES, OAUTH_REVOCATION_REASONS, OAUTH_ROUTES, OAUTH_SECRET_PATTERN, OAUTH_TOKEN_NAMESPACE_LENGTH, OAUTH_TOKEN_SECRET_LENGTH, PKCE_CHALLENGE_PATTERN, PKCE_METHODS, PKCE_VERIFIER_PATTERN, REFRESH_TOKEN_PATTERN, REFRESH_TOKEN_TTL_SECONDS, TOKEN_ENDPOINT_AUTH_METHODS, authorizationParametersSchema, authorizationServerMetadataSchema, bearerChallenge, clientRegistrationRequestSchema, clientRegistrationSchema, consentDecisionSchema, consentOutcomeSchema, consentPromptSchema, formatScopeString, isLoopbackRedirect, oauthError, oauthErrorCodeSchema, oauthErrorSchema, oauthGrantListSchema, oauthGrantRevokedSchema, oauthGrantSchema, oauthGrantStatusSchema, oauthGrantTypeSchema, oauthRevocationReasonSchema, parseScopeString, pkceMethodSchema, protectedResourceMetadataSchema, redirectUriSchema, revocationRequestSchema, tokenRequestSchema, tokenResponseSchema, } from "./oauth.js";
19
21
  export { CALLBACK_ENVELOPE_HEADROOM_BYTES, CALLBACK_RECEIVER_MAX_BODY_BYTES, } from "./callback-receiver.js";
20
- export { CALLBACK_OWNERSHIP_POLICIES, DEFAULT_CALLBACK_OWNERSHIP_POLICY, readCallbackOwnershipPolicy, sendableStatuses, } from "./callback-ownership.js";
21
22
  export { CALLBACK_ENDPOINT_SECRET_PATTERN, CALLBACK_URL_REJECTION_REASONS, evaluateCallbackUrl, isPublicCallbackAddress, } from "./callback-safety.js";
22
- export { CALLBACK_ENDPOINT_LIMIT_PER_ENVIRONMENT, CALLBACK_ENDPOINT_STATUSES, CALLBACK_SIGNING_KEY_ROTATION_OVERLAP_SECONDS, CALLBACK_VERIFICATION_FAILURES, CALLBACK_VERIFICATION_HEADERS, CALLBACK_VERIFICATION_PROTOCOL, CALLBACK_VERIFICATION_PROTOCOL_VERSION, CALLBACK_VERIFICATION_RATE_LIMITS, CALLBACK_VERIFICATION_RESPONSE_BYTES, CALLBACK_VERIFICATION_TIMEOUT_MILLISECONDS, CALLBACK_VERIFICATION_TYPE, callbackEndpointCreatedSchema, callbackEndpointPageSchema, callbackEndpointRequestSchema, callbackEndpointRotatedSchema, callbackEndpointSchema, callbackEndpointStatusSchema, callbackSigningKeyRotationRequestSchema, callbackSigningKeysSchema, callbackVerificationChallengeSchema, callbackVerificationFailureSchema, } from "./endpoints.js";
23
+ export { CALLBACK_ENDPOINT_LIMIT_PER_ENVIRONMENT, CALLBACK_ENDPOINT_STATUSES, CALLBACK_SIGNING_KEY_ROTATION_OVERLAP_SECONDS, CALLBACK_EGRESS_FAILURES, CALLBACK_ADMISSION_RATE_LIMITS, callbackEndpointCreatedSchema, callbackEndpointNameSchema, callbackEndpointPageSchema, callbackEndpointRequestSchema, callbackEndpointRotatedSchema, callbackEndpointSchema, callbackEndpointSigningSecretsSchema, callbackEndpointStatusSchema, callbackSigningKeyRotationRequestSchema, callbackSigningKeysSchema, callbackEgressFailureSchema, } from "./endpoints.js";
24
+ export { compactInterval, cronWords, generatedEndpointName, generatedScheduleName, periodWords, targetDomain, } from "./naming.js";
23
25
  export { FORECAST_BOUNDS, FORECAST_BREAKDOWNS, FORECAST_COMPATIBILITY, FORECAST_RULES, FORECAST_WINDOW_VERSION, decideForecastAnswer, forecastBreakdownSchema, forecastBucketSchema, forecastBucketStartMs, forecastLatencyCountsSchema, forecastRequestSchema, forecastSchema, forecastViolations, forecastWindowBucketSchema, forecastWindowViolations, forecastWindowsSchema, mergeForecastBuckets, parseForecastRequest, resolveForecastWindow, topPartitionKeys, } from "./forecast.js";
24
- export { CURL_JOURNEY_TOOLS, FIRST_VALUE_JOURNEY, FIRST_VALUE_PREREQUISITES, FIRST_VALUE_STEPS, FIRST_VALUE_VARIABLES, JOURNEY_CONDITIONS, MINIMUM_CURL_VERSION, journeyCapturedVariables, journeyReferences, journeyStepSchema, journeyVariable, journeyVariableSchema, resolveJourneyReferences, } from "./first-value-journey.js";
26
+ export { CURL_JOURNEY_TOOLS, FIRST_VALUE_JOURNEY, FIRST_VALUE_PREREQUISITES, FIRST_VALUE_STEPS, FIRST_VALUE_VARIABLES, JOURNEY_ACTIVATION_DURATIONS, JOURNEY_ACTIVATION_OUTCOMES, JOURNEY_CONDITIONS, MINIMUM_CURL_VERSION, WEBSITE_JOURNEY_STEPS, WEBSITE_JOURNEY_STEP_KEYS, journeyActivationDuration, journeyCapturedVariables, journeyPathVariables, journeyPoll, journeyPrerequisite, journeyReferences, journeyStepSchema, journeyStepVariables, journeyVariable, journeyVariableName, journeyVariableSchema, parseWebsiteActivationEvent, pathParameterNames, resolveJourneyReferences, websiteActivationEventSchema, websiteJourneySteps, } from "./first-value-journey.js";
25
27
  export { BILLABLE_TERMINAL_STATES, USAGE_BOUNDS, USAGE_WINDOW_REASONS, billableTerminalStateSchema, parseUsageRequest, resolveUsageWindow, usageDaySchema, usageRequestSchema, usageSchema, utcMidnightMs, } from "./usage.js";
28
+ export { BILLING_ACTIVATION_MODES, BILLING_AMOUNT_SCALE, BILLING_BLOCK_REASONS, BILLING_CURRENCY, BILLING_ENTRY_KINDS, BILLING_PAYMENT_KINDS, BILLING_PAYMENT_STATES, BILLING_NOTICE_KINDS, billingAutoTopUpApplyRequestSchema, billingAutoTopUpConfigurationSchema, billingAutoTopUpPreviewRequestSchema, billingAutoTopUpPreviewSchema, billingAutoTopUpRuleSchema, billingBudgetPolicySchema, billingBudgetUpdateRequestHeadersSchema, billingBudgetUpdateRequestSchema, billingBudgetUpdateResponseSchema, billingCeilingUpdateRequestSchema, billingFundingQuoteRequestSchema, billingFundingQuoteSchema, billingFundingViewSchema, billingNoticePageSchema, billingNoticeRecoveryPathSchema, billingNoticeSchema, billingNotificationSettingsSchema, billingNotificationSettingsUpdateRequestSchema, billingLedgerEntrySchema, billingLedgerPageSchema, billingLedgerRequestSchema, billingPaymentOperationSchema, billingPeriodSummarySchema, billingPurchaseRequestSchema, billingRefundRequestCreateSchema, billingRefundResolutionRequestSchema, billingRefundRequestViewSchema, billingSummarySchema, exactCentMoneySchema, manualFundingCreditSchema, microdollarAmountSchema, nonnegativeMicrodollarAmountSchema, } from "./billing.js";
29
+ export { DELIVERY_TIMING_TARGETS_MS, DELIVERY_TIMING_VERDICTS, deliveryTimingSummarySchema, timingThresholdSummarySchema, } from "./timing.js";
26
30
  export { CALLBACK_RECEIVER_DISPOSITIONS, CALLBACK_RECEIVER_PROTOCOL, CALLBACK_RECEIVER_STATUS, TEST_SINK_BEHAVIORS, TEST_SINK_BEHAVIOR_FACTS, TEST_SINK_BOUNDS, TEST_SINK_CLIENT_ERROR_STATUSES, TEST_SINK_DISPOSITIONS, TEST_SINK_PROTOCOL_VERSION, TEST_SINK_SERVER_ERROR_STATUSES, callbackReceiverAcknowledgementSchema, callbackReceiverDispositionSchema, resolveTestSinkAction, testSinkBehaviorSchema, testSinkCreateRequestSchema, testSinkDeliveryBodySchema, testSinkDispositionSchema, testSinkDeliveryPageSchema, testSinkDeliverySchema, testSinkPageSchema, testSinkProgramSchema, testSinkSchema, } from "./test-sink.js";
31
+ export { PROJECT_BILLING_ACTIONS, projectBillingQuoteRequestSchema, projectBillingQuoteSchema, projectBillingChangeRequestSchema, projectBillingStateSchema, billingPortalSchema, } from "./billing.js";
package/dist/mcp.d.ts ADDED
@@ -0,0 +1,201 @@
1
+ import { z } from "./zod.js";
2
+ /**
3
+ * Where the remote MCP surface lives, and what it tells an agent about itself.
4
+ *
5
+ * Stated once for the same reason `OAUTH_ROUTES` is: two readers must agree.
6
+ * The router serves these paths and the protected-resource metadata document
7
+ * advertises them, and a path that drifts from its advertisement is not a 404 —
8
+ * it is a client that cannot authenticate and cannot say why.
9
+ *
10
+ * Outside `/v1`, following the convention `CLERK_WEBHOOK_PATH` and
11
+ * `OAUTH_ROUTES` set. The `/v1` surface is the operation registry, every entry
12
+ * of which is projected into OpenAPI, the SDK, an MCP tool and the contract
13
+ * mock; the MCP endpoint is the transport those tools are served over, and a
14
+ * transport that appeared in its own tool list would be a tool an agent could
15
+ * point at itself.
16
+ */
17
+ export declare const MCP_ROUTES: {
18
+ /**
19
+ * The single Streamable HTTP endpoint. POST only; `GET` and `DELETE` answer
20
+ * `405`, because this endpoint opens no standalone event stream and mints no
21
+ * session to terminate.
22
+ *
23
+ * Served at this path **and** at the same path with a trailing slash, without
24
+ * a redirect between them. A `301`/`302` on a POST is rewritten by the fetch
25
+ * standard into a GET with the body dropped, so a client configured with the
26
+ * other spelling would have its opening request silently become the GET this
27
+ * endpoint refuses — and read that as "no MCP server here".
28
+ */
29
+ readonly endpoint: "/mcp";
30
+ /**
31
+ * RFC 9728 metadata for the MCP endpoint specifically.
32
+ *
33
+ * Served *beside* the origin's own document rather than instead of it. RFC
34
+ * 9728 §3.1 places the metadata for a resource with a path component at
35
+ * `/.well-known/oauth-protected-resource` followed by that path, so a client
36
+ * that treats `https://host/mcp` as the resource it is authorizing for
37
+ * constructs exactly this URL — and one that follows the `resource_metadata`
38
+ * link out of the `401` is sent here too. Both arrive at a document naming
39
+ * the same authorization server.
40
+ */
41
+ readonly protectedResourceMetadata: "/.well-known/oauth-protected-resource/mcp";
42
+ };
43
+ /**
44
+ * What the server tells a model about itself, once, before any tool call.
45
+ *
46
+ * MCP calls this `instructions` and hands it to the model as context. It is
47
+ * kept short and factual: an agent that has read the tool descriptions knows
48
+ * what each one does, and what it cannot work out from them is the shape of the
49
+ * authority it is acting under — which is the one thing that decides whether an
50
+ * instruction like "create this in production" is even expressible.
51
+ */
52
+ export declare const MCP_INSTRUCTIONS: string;
53
+ /**
54
+ * What a signed-in member is told about a key they have just issued, so that a
55
+ * connection test can tell "the server refused you" from "the server does not
56
+ * know this key" from "this key sees fewer tools than you meant it to".
57
+ *
58
+ * **Why the endpoint returns the tool names rather than a count.** The
59
+ * connection test drives `tools/list` through the official MCP client with the
60
+ * transient secret, and then has to decide whether what came back is about the
61
+ * credential the member means. A count cannot answer that: two credentials with
62
+ * different scopes routinely authorize the same number of tools. The names can,
63
+ * and they are already public — they are the operation ids with underscores,
64
+ * published in the parity table and in every client's own listing.
65
+ *
66
+ * That comparison is what binds the secret in the browser to the credential the
67
+ * session named. The session's half is the tenant check on the way in: the
68
+ * route refuses a credential whose authority is not this session's project and
69
+ * environment, so a member cannot ask this question about another tenant's key.
70
+ */
71
+ export declare const MCP_CONNECTION_STATES: readonly ["usable", "revoked", "expired"];
72
+ export type McpConnectionState = (typeof MCP_CONNECTION_STATES)[number];
73
+ /**
74
+ * The steps a connection test performs, in order, and the only steps it has.
75
+ *
76
+ * Closed because the result is reported as an activation fact, and an open list
77
+ * of step names is a free-text field with a schema in front of it.
78
+ */
79
+ export declare const MCP_CONNECTION_CHECKS: readonly ["initialize", "tools", "authority"];
80
+ export type McpConnectionCheck = (typeof MCP_CONNECTION_CHECKS)[number];
81
+ /** What a step did. Binary, plus the case where an earlier step stopped it. */
82
+ export declare const MCP_CONNECTION_OUTCOMES: readonly ["passed", "failed", "skipped"];
83
+ export type McpConnectionOutcome = (typeof MCP_CONNECTION_OUTCOMES)[number];
84
+ /**
85
+ * The bounded answer a connection test starts from.
86
+ *
87
+ * Every field is either an address this deployment publishes or a fact about a
88
+ * credential the caller's own session may already read from the credential
89
+ * listing. Nothing here is new disclosure, and nothing here is the secret: the
90
+ * transient value never travels to this route, and the route has nothing it
91
+ * could echo.
92
+ */
93
+ export declare const mcpConnectionSchema: import("zod").ZodObject<{
94
+ discovery: import("zod").ZodString;
95
+ displayPrefix: import("zod").ZodString;
96
+ endpoint: import("zod").ZodString;
97
+ id: import("zod").ZodString;
98
+ scopes: import("zod").ZodArray<import("zod").ZodEnum<{
99
+ "credentials:administer": "credentials:administer";
100
+ "billing:write": "billing:write";
101
+ "credentials:read": "credentials:read";
102
+ "credentials:write": "credentials:write";
103
+ "endpoints:read": "endpoints:read";
104
+ "endpoints:write": "endpoints:write";
105
+ "forecast:read": "forecast:read";
106
+ "grants:read": "grants:read";
107
+ "grants:write": "grants:write";
108
+ "occurrences:read": "occurrences:read";
109
+ "occurrences:redeliver": "occurrences:redeliver";
110
+ "projects:administer": "projects:administer";
111
+ "projects:read": "projects:read";
112
+ "projects:write": "projects:write";
113
+ "schedules:read": "schedules:read";
114
+ "schedules:write": "schedules:write";
115
+ "usage:read": "usage:read";
116
+ }>>;
117
+ state: import("zod").ZodEnum<{
118
+ revoked: "revoked";
119
+ usable: "usable";
120
+ expired: "expired";
121
+ }>;
122
+ tools: import("zod").ZodArray<import("zod").ZodString>;
123
+ }, import("zod/v4/core").$strip>;
124
+ export type McpConnection = z.infer<typeof mcpConnectionSchema>;
125
+ /**
126
+ * Why a connection test stopped, from a closed list.
127
+ *
128
+ * **Closed because the alternative leaks.** The natural implementation of a
129
+ * diagnostic is to show what the server said, and what the server said is a
130
+ * string this product did not write — a proxy's error page, a transport
131
+ * library's message, a response body. Any of those can carry a URL, a header, or
132
+ * a fragment of the credential that produced them. A reason from this list
133
+ * carries none of that and is enough to act on, which is the whole bargain.
134
+ */
135
+ export declare const MCP_CONNECTION_FAILURES: readonly ["unauthorized", "unreachable", "protocol", "mismatch"];
136
+ export type McpConnectionFailure = (typeof MCP_CONNECTION_FAILURES)[number];
137
+ /**
138
+ * How long something took, coarsely.
139
+ *
140
+ * A duration recorded to the millisecond is a fingerprint: repeated across a
141
+ * small population it distinguishes one member's connection from another's. The
142
+ * question an activation fact answers is "was this fast enough to feel like it
143
+ * worked", and a bucket answers it.
144
+ */
145
+ export declare const MCP_ACTIVATION_DURATIONS: readonly ["under_1s", "under_5s", "under_30s", "over_30s"];
146
+ export type McpActivationDuration = (typeof MCP_ACTIVATION_DURATIONS)[number];
147
+ /** The bucket a measured duration falls in. */
148
+ export declare function activationDuration(elapsedMs: number): McpActivationDuration;
149
+ /**
150
+ * What is recorded when somebody connects a client, and the only thing that is.
151
+ *
152
+ * **Every field is drawn from a closed set, and that is the point rather than a
153
+ * convenience.** There is no free-text field, no identifier, no address and no
154
+ * measurement finer than a bucket, so an event of this shape cannot carry an
155
+ * account, an organization, a project, an OAuth URL, a token, a destination or a
156
+ * payload however carelessly it is constructed. The project specification asks
157
+ * for activation evidence containing "durations and coarse outcomes, never
158
+ * callback bodies, secrets, tenant identifiers, or customer payloads"; a schema
159
+ * that admits only those is how that becomes a property instead of a promise.
160
+ *
161
+ * `client` is validated against the catalog rather than typed as a string, so a
162
+ * client nobody has walked cannot appear in activation data as though it had.
163
+ *
164
+ * **Strict, not merely typed, and a test is why.** An ordinary object schema
165
+ * *strips* a field it does not know, which would have made an emitter that added
166
+ * `project` look like it was recording one while the field silently vanished.
167
+ * Stripping is safe and dishonest: the caller believes something is being
168
+ * recorded that is not, and nothing ever tells them. "Closed" has to mean the
169
+ * schema refuses what it does not recognise, so the mistake surfaces where it
170
+ * was made.
171
+ */
172
+ export declare const mcpActivationEventSchema: import("zod").ZodObject<{
173
+ authKind: import("zod").ZodEnum<{
174
+ oauth: "oauth";
175
+ "api-key": "api-key";
176
+ }>;
177
+ checks: import("zod").ZodRecord<import("zod").ZodEnum<{
178
+ authority: "authority";
179
+ initialize: "initialize";
180
+ tools: "tools";
181
+ }>, import("zod").ZodEnum<{
182
+ failed: "failed";
183
+ passed: "passed";
184
+ skipped: "skipped";
185
+ }>>;
186
+ client: import("zod").ZodString;
187
+ duration: import("zod").ZodEnum<{
188
+ under_1s: "under_1s";
189
+ under_5s: "under_5s";
190
+ under_30s: "under_30s";
191
+ over_30s: "over_30s";
192
+ }>;
193
+ failure: import("zod").ZodOptional<import("zod").ZodEnum<{
194
+ unauthorized: "unauthorized";
195
+ unreachable: "unreachable";
196
+ protocol: "protocol";
197
+ mismatch: "mismatch";
198
+ }>>;
199
+ type: import("zod").ZodLiteral<"mcp.connection_test">;
200
+ }, import("zod/v4/core").$strict>;
201
+ export type McpActivationEvent = z.infer<typeof mcpActivationEventSchema>;
package/dist/mcp.js ADDED
@@ -0,0 +1,214 @@
1
+ import { z } from "./zod.js";
2
+ import { scopeSchema } from "./authority.js";
3
+ import { apiCredentialIdSchema } from "./identifiers.js";
4
+ import { CREDENTIAL_PREFIX_PATTERN } from "./secrets.js";
5
+ /**
6
+ * Where the remote MCP surface lives, and what it tells an agent about itself.
7
+ *
8
+ * Stated once for the same reason `OAUTH_ROUTES` is: two readers must agree.
9
+ * The router serves these paths and the protected-resource metadata document
10
+ * advertises them, and a path that drifts from its advertisement is not a 404 —
11
+ * it is a client that cannot authenticate and cannot say why.
12
+ *
13
+ * Outside `/v1`, following the convention `CLERK_WEBHOOK_PATH` and
14
+ * `OAUTH_ROUTES` set. The `/v1` surface is the operation registry, every entry
15
+ * of which is projected into OpenAPI, the SDK, an MCP tool and the contract
16
+ * mock; the MCP endpoint is the transport those tools are served over, and a
17
+ * transport that appeared in its own tool list would be a tool an agent could
18
+ * point at itself.
19
+ */
20
+ export const MCP_ROUTES = {
21
+ /**
22
+ * The single Streamable HTTP endpoint. POST only; `GET` and `DELETE` answer
23
+ * `405`, because this endpoint opens no standalone event stream and mints no
24
+ * session to terminate.
25
+ *
26
+ * Served at this path **and** at the same path with a trailing slash, without
27
+ * a redirect between them. A `301`/`302` on a POST is rewritten by the fetch
28
+ * standard into a GET with the body dropped, so a client configured with the
29
+ * other spelling would have its opening request silently become the GET this
30
+ * endpoint refuses — and read that as "no MCP server here".
31
+ */
32
+ endpoint: "/mcp",
33
+ /**
34
+ * RFC 9728 metadata for the MCP endpoint specifically.
35
+ *
36
+ * Served *beside* the origin's own document rather than instead of it. RFC
37
+ * 9728 §3.1 places the metadata for a resource with a path component at
38
+ * `/.well-known/oauth-protected-resource` followed by that path, so a client
39
+ * that treats `https://host/mcp` as the resource it is authorizing for
40
+ * constructs exactly this URL — and one that follows the `resource_metadata`
41
+ * link out of the `401` is sent here too. Both arrive at a document naming
42
+ * the same authorization server.
43
+ */
44
+ protectedResourceMetadata: "/.well-known/oauth-protected-resource/mcp",
45
+ };
46
+ /**
47
+ * What the server tells a model about itself, once, before any tool call.
48
+ *
49
+ * MCP calls this `instructions` and hands it to the model as context. It is
50
+ * kept short and factual: an agent that has read the tool descriptions knows
51
+ * what each one does, and what it cannot work out from them is the shape of the
52
+ * authority it is acting under — which is the one thing that decides whether an
53
+ * instruction like "create this in production" is even expressible.
54
+ */
55
+ export const MCP_INSTRUCTIONS = [
56
+ "Greatwait schedules work and delivers it to an endpoint at the time asked for.",
57
+ "Every tool acts inside one organization, project and environment, fixed by the credential this connection was authorized with; no argument can name another, and there is no tool that moves between them.",
58
+ "Reads are safe to repeat. Writes are annotated, and the ones marked destructive settle or discard an occurrence that would otherwise have fired.",
59
+ "A refusal comes back as a problem document with a stable `code`: act on the code, not on the wording.",
60
+ ].join(" ");
61
+ /**
62
+ * What a signed-in member is told about a key they have just issued, so that a
63
+ * connection test can tell "the server refused you" from "the server does not
64
+ * know this key" from "this key sees fewer tools than you meant it to".
65
+ *
66
+ * **Why the endpoint returns the tool names rather than a count.** The
67
+ * connection test drives `tools/list` through the official MCP client with the
68
+ * transient secret, and then has to decide whether what came back is about the
69
+ * credential the member means. A count cannot answer that: two credentials with
70
+ * different scopes routinely authorize the same number of tools. The names can,
71
+ * and they are already public — they are the operation ids with underscores,
72
+ * published in the parity table and in every client's own listing.
73
+ *
74
+ * That comparison is what binds the secret in the browser to the credential the
75
+ * session named. The session's half is the tenant check on the way in: the
76
+ * route refuses a credential whose authority is not this session's project and
77
+ * environment, so a member cannot ask this question about another tenant's key.
78
+ */
79
+ export const MCP_CONNECTION_STATES = ["usable", "revoked", "expired"];
80
+ /**
81
+ * The steps a connection test performs, in order, and the only steps it has.
82
+ *
83
+ * Closed because the result is reported as an activation fact, and an open list
84
+ * of step names is a free-text field with a schema in front of it.
85
+ */
86
+ export const MCP_CONNECTION_CHECKS = [
87
+ /** The client completed the MCP handshake against the endpoint. */
88
+ "initialize",
89
+ /** The client listed tools, and the listing was well formed. */
90
+ "tools",
91
+ /** The listing was the one this credential's scopes authorize. */
92
+ "authority",
93
+ ];
94
+ /** What a step did. Binary, plus the case where an earlier step stopped it. */
95
+ export const MCP_CONNECTION_OUTCOMES = ["passed", "failed", "skipped"];
96
+ /**
97
+ * The bounded answer a connection test starts from.
98
+ *
99
+ * Every field is either an address this deployment publishes or a fact about a
100
+ * credential the caller's own session may already read from the credential
101
+ * listing. Nothing here is new disclosure, and nothing here is the secret: the
102
+ * transient value never travels to this route, and the route has nothing it
103
+ * could echo.
104
+ */
105
+ export const mcpConnectionSchema = z.object({
106
+ /** The RFC 9728 document for the endpoint, absolute. */
107
+ discovery: z.string().url(),
108
+ /** The non-secret leading segment, so a client can check it holds this key. */
109
+ displayPrefix: z.string().regex(CREDENTIAL_PREFIX_PATTERN),
110
+ /** The Streamable HTTP endpoint, absolute, ready to paste. */
111
+ endpoint: z.string().url(),
112
+ /**
113
+ * Which credential this describes.
114
+ *
115
+ * A document addressed by an identifier echoes it — the rule
116
+ * `published-examples.worker.test.ts` enforces on every read, and the reason
117
+ * is a caller holding two of these needing to tell them apart. The display
118
+ * prefix is a recognition aid rather than an identity, and it is not the value
119
+ * a later call is addressed by.
120
+ */
121
+ id: apiCredentialIdSchema,
122
+ /** The scopes fixed into this credential when it was issued. */
123
+ scopes: z.array(scopeSchema),
124
+ state: z.enum(MCP_CONNECTION_STATES),
125
+ /**
126
+ * The MCP tool names these scopes authorize, sorted.
127
+ *
128
+ * Computed by the same authorization policy `/mcp` runs when it decides what
129
+ * to put in `tools/list`, rather than by a second rule that would drift from
130
+ * it. A connection test compares this against what the official client
131
+ * actually listed; equal means the secret in the browser is the credential the
132
+ * session named, and unequal means it is not — which no count could tell them.
133
+ */
134
+ tools: z.array(z.string()),
135
+ });
136
+ /**
137
+ * Why a connection test stopped, from a closed list.
138
+ *
139
+ * **Closed because the alternative leaks.** The natural implementation of a
140
+ * diagnostic is to show what the server said, and what the server said is a
141
+ * string this product did not write — a proxy's error page, a transport
142
+ * library's message, a response body. Any of those can carry a URL, a header, or
143
+ * a fragment of the credential that produced them. A reason from this list
144
+ * carries none of that and is enough to act on, which is the whole bargain.
145
+ */
146
+ export const MCP_CONNECTION_FAILURES = [
147
+ /** The endpoint answered, and refused the credential. */
148
+ "unauthorized",
149
+ /** Nothing answered, or what answered was not this endpoint. */
150
+ "unreachable",
151
+ /** It answered, but not in a way an MCP client could complete. */
152
+ "protocol",
153
+ /** It listed tools, and they are not the ones this credential authorizes. */
154
+ "mismatch",
155
+ ];
156
+ /**
157
+ * How long something took, coarsely.
158
+ *
159
+ * A duration recorded to the millisecond is a fingerprint: repeated across a
160
+ * small population it distinguishes one member's connection from another's. The
161
+ * question an activation fact answers is "was this fast enough to feel like it
162
+ * worked", and a bucket answers it.
163
+ */
164
+ export const MCP_ACTIVATION_DURATIONS = [
165
+ "under_1s",
166
+ "under_5s",
167
+ "under_30s",
168
+ "over_30s",
169
+ ];
170
+ /** The bucket a measured duration falls in. */
171
+ export function activationDuration(elapsedMs) {
172
+ if (elapsedMs < 1_000)
173
+ return "under_1s";
174
+ if (elapsedMs < 5_000)
175
+ return "under_5s";
176
+ if (elapsedMs < 30_000)
177
+ return "under_30s";
178
+ return "over_30s";
179
+ }
180
+ /**
181
+ * What is recorded when somebody connects a client, and the only thing that is.
182
+ *
183
+ * **Every field is drawn from a closed set, and that is the point rather than a
184
+ * convenience.** There is no free-text field, no identifier, no address and no
185
+ * measurement finer than a bucket, so an event of this shape cannot carry an
186
+ * account, an organization, a project, an OAuth URL, a token, a destination or a
187
+ * payload however carelessly it is constructed. The project specification asks
188
+ * for activation evidence containing "durations and coarse outcomes, never
189
+ * callback bodies, secrets, tenant identifiers, or customer payloads"; a schema
190
+ * that admits only those is how that becomes a property instead of a promise.
191
+ *
192
+ * `client` is validated against the catalog rather than typed as a string, so a
193
+ * client nobody has walked cannot appear in activation data as though it had.
194
+ *
195
+ * **Strict, not merely typed, and a test is why.** An ordinary object schema
196
+ * *strips* a field it does not know, which would have made an emitter that added
197
+ * `project` look like it was recording one while the field silently vanished.
198
+ * Stripping is safe and dishonest: the caller believes something is being
199
+ * recorded that is not, and nothing ever tells them. "Closed" has to mean the
200
+ * schema refuses what it does not recognise, so the mistake surfaces where it
201
+ * was made.
202
+ */
203
+ export const mcpActivationEventSchema = z.strictObject({
204
+ /** Which of the two named authentication modes was used. */
205
+ authKind: z.enum(["oauth", "api-key"]),
206
+ /** Every step, and what it did. */
207
+ checks: z.record(z.enum(MCP_CONNECTION_CHECKS), z.enum(MCP_CONNECTION_OUTCOMES)),
208
+ /** The catalog id of the client, checked against the catalog by the emitter. */
209
+ client: z.string().regex(/^[a-z][a-z0-9-]{0,31}$/u),
210
+ duration: z.enum(MCP_ACTIVATION_DURATIONS),
211
+ /** Present only when something stopped, and drawn from a closed list. */
212
+ failure: z.enum(MCP_CONNECTION_FAILURES).optional(),
213
+ type: z.literal("mcp.connection_test"),
214
+ });