@emilia-protocol/gate 0.11.0 → 0.14.0

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 (425) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +310 -0
  3. package/action-control-manifest.js +3 -268
  4. package/action-escrow-custodian.js +3 -394
  5. package/action-escrow-evidence.js +3 -858
  6. package/action-escrow-package.js +3 -1668
  7. package/action-escrow-postgres.js +3 -337
  8. package/action-escrow-state.js +3 -396
  9. package/action-escrow-verifiers.js +3 -331
  10. package/action-escrow.js +3 -2447
  11. package/action-packs.js +3 -140
  12. package/adapters/_kit.js +3 -104
  13. package/adapters/aws.js +3 -108
  14. package/adapters/cloudflare.js +3 -54
  15. package/adapters/gcp.js +3 -70
  16. package/adapters/github.js +3 -109
  17. package/adapters/jira.js +3 -55
  18. package/adapters/k8s.js +3 -70
  19. package/adapters/linear.js +3 -55
  20. package/adapters/salesforce.js +3 -55
  21. package/adapters/stripe.js +3 -81
  22. package/adapters/supabase.js +3 -121
  23. package/adapters/terraform.js +3 -59
  24. package/adapters/vercel.js +3 -84
  25. package/aec-execution.js +3 -312
  26. package/breakglass.js +3 -582
  27. package/capability-receipt.js +4 -0
  28. package/cf1-conformance.js +3 -106
  29. package/challenge-store.js +3 -69
  30. package/control-plane.js +3 -340
  31. package/coverage.js +3 -721
  32. package/demo.mjs +1 -1
  33. package/deployment-attestation.js +3 -247
  34. package/dist/action-control-manifest.d.ts +82 -0
  35. package/dist/action-control-manifest.d.ts.map +1 -0
  36. package/dist/action-control-manifest.js +422 -0
  37. package/dist/action-control-manifest.js.map +1 -0
  38. package/dist/action-escrow-custodian.d.ts +74 -0
  39. package/dist/action-escrow-custodian.d.ts.map +1 -0
  40. package/dist/action-escrow-custodian.js +363 -0
  41. package/dist/action-escrow-custodian.js.map +1 -0
  42. package/dist/action-escrow-evidence.d.ts +130 -0
  43. package/dist/action-escrow-evidence.d.ts.map +1 -0
  44. package/dist/action-escrow-evidence.js +1012 -0
  45. package/dist/action-escrow-evidence.js.map +1 -0
  46. package/dist/action-escrow-package.d.ts +10 -0
  47. package/dist/action-escrow-package.d.ts.map +1 -0
  48. package/dist/action-escrow-package.js +1583 -0
  49. package/dist/action-escrow-package.js.map +1 -0
  50. package/dist/action-escrow-postgres.d.ts +62 -0
  51. package/dist/action-escrow-postgres.d.ts.map +1 -0
  52. package/dist/action-escrow-postgres.js +339 -0
  53. package/dist/action-escrow-postgres.js.map +1 -0
  54. package/dist/action-escrow-state.d.ts +141 -0
  55. package/dist/action-escrow-state.d.ts.map +1 -0
  56. package/dist/action-escrow-state.js +413 -0
  57. package/dist/action-escrow-state.js.map +1 -0
  58. package/dist/action-escrow-verifiers.d.ts +65 -0
  59. package/dist/action-escrow-verifiers.d.ts.map +1 -0
  60. package/dist/action-escrow-verifiers.js +421 -0
  61. package/dist/action-escrow-verifiers.js.map +1 -0
  62. package/dist/action-escrow.d.ts +112 -0
  63. package/dist/action-escrow.d.ts.map +1 -0
  64. package/dist/action-escrow.js +2661 -0
  65. package/dist/action-escrow.js.map +1 -0
  66. package/dist/action-packs.d.ts +54 -0
  67. package/dist/action-packs.d.ts.map +1 -0
  68. package/dist/action-packs.js +143 -0
  69. package/dist/action-packs.js.map +1 -0
  70. package/dist/adapters/_kit.d.ts +50 -0
  71. package/dist/adapters/_kit.d.ts.map +1 -0
  72. package/dist/adapters/_kit.js +98 -0
  73. package/dist/adapters/_kit.js.map +1 -0
  74. package/dist/adapters/aws.d.ts +158 -0
  75. package/dist/adapters/aws.d.ts.map +1 -0
  76. package/dist/adapters/aws.js +136 -0
  77. package/dist/adapters/aws.js.map +1 -0
  78. package/dist/adapters/cloudflare.d.ts +116 -0
  79. package/dist/adapters/cloudflare.d.ts.map +1 -0
  80. package/dist/adapters/cloudflare.js +75 -0
  81. package/dist/adapters/cloudflare.js.map +1 -0
  82. package/dist/adapters/gcp.d.ts +139 -0
  83. package/dist/adapters/gcp.d.ts.map +1 -0
  84. package/dist/adapters/gcp.js +69 -0
  85. package/dist/adapters/gcp.js.map +1 -0
  86. package/dist/adapters/github.d.ts +123 -0
  87. package/dist/adapters/github.d.ts.map +1 -0
  88. package/dist/adapters/github.js +105 -0
  89. package/dist/adapters/github.js.map +1 -0
  90. package/dist/adapters/jira.d.ts +109 -0
  91. package/dist/adapters/jira.d.ts.map +1 -0
  92. package/dist/adapters/jira.js +54 -0
  93. package/dist/adapters/jira.js.map +1 -0
  94. package/dist/adapters/k8s.d.ts +139 -0
  95. package/dist/adapters/k8s.d.ts.map +1 -0
  96. package/dist/adapters/k8s.js +69 -0
  97. package/dist/adapters/k8s.js.map +1 -0
  98. package/dist/adapters/linear.d.ts +109 -0
  99. package/dist/adapters/linear.d.ts.map +1 -0
  100. package/dist/adapters/linear.js +54 -0
  101. package/dist/adapters/linear.js.map +1 -0
  102. package/dist/adapters/salesforce.d.ts +109 -0
  103. package/dist/adapters/salesforce.d.ts.map +1 -0
  104. package/dist/adapters/salesforce.js +54 -0
  105. package/dist/adapters/salesforce.js.map +1 -0
  106. package/dist/adapters/stripe.d.ts +116 -0
  107. package/dist/adapters/stripe.d.ts.map +1 -0
  108. package/dist/adapters/stripe.js +77 -0
  109. package/dist/adapters/stripe.js.map +1 -0
  110. package/dist/adapters/supabase.d.ts +127 -0
  111. package/dist/adapters/supabase.d.ts.map +1 -0
  112. package/dist/adapters/supabase.js +112 -0
  113. package/dist/adapters/supabase.js.map +1 -0
  114. package/dist/adapters/terraform.d.ts +109 -0
  115. package/dist/adapters/terraform.d.ts.map +1 -0
  116. package/dist/adapters/terraform.js +58 -0
  117. package/dist/adapters/terraform.js.map +1 -0
  118. package/dist/adapters/vercel.d.ts +114 -0
  119. package/dist/adapters/vercel.d.ts.map +1 -0
  120. package/dist/adapters/vercel.js +81 -0
  121. package/dist/adapters/vercel.js.map +1 -0
  122. package/dist/aec-execution.d.ts +107 -0
  123. package/dist/aec-execution.d.ts.map +1 -0
  124. package/dist/aec-execution.js +334 -0
  125. package/dist/aec-execution.js.map +1 -0
  126. package/dist/breakglass.d.ts +205 -0
  127. package/dist/breakglass.d.ts.map +1 -0
  128. package/dist/breakglass.js +627 -0
  129. package/dist/breakglass.js.map +1 -0
  130. package/dist/capability-receipt.d.ts +601 -0
  131. package/dist/capability-receipt.d.ts.map +1 -0
  132. package/dist/capability-receipt.js +1177 -0
  133. package/dist/capability-receipt.js.map +1 -0
  134. package/dist/cf1-conformance.d.ts +83 -0
  135. package/dist/cf1-conformance.d.ts.map +1 -0
  136. package/dist/cf1-conformance.js +94 -0
  137. package/dist/cf1-conformance.js.map +1 -0
  138. package/dist/challenge-store.d.ts +20 -0
  139. package/dist/challenge-store.d.ts.map +1 -0
  140. package/dist/challenge-store.js +62 -0
  141. package/dist/challenge-store.js.map +1 -0
  142. package/dist/control-plane.d.ts +136 -0
  143. package/dist/control-plane.d.ts.map +1 -0
  144. package/dist/control-plane.js +349 -0
  145. package/dist/control-plane.js.map +1 -0
  146. package/dist/coverage.d.ts +156 -0
  147. package/dist/coverage.d.ts.map +1 -0
  148. package/dist/coverage.js +768 -0
  149. package/dist/coverage.js.map +1 -0
  150. package/dist/deployment-attestation.d.ts +93 -0
  151. package/dist/deployment-attestation.d.ts.map +1 -0
  152. package/dist/deployment-attestation.js +262 -0
  153. package/dist/deployment-attestation.js.map +1 -0
  154. package/dist/eg1-conformance.d.ts +286 -0
  155. package/dist/eg1-conformance.d.ts.map +1 -0
  156. package/dist/eg1-conformance.js +379 -0
  157. package/dist/eg1-conformance.js.map +1 -0
  158. package/dist/enterprise.d.ts +88 -0
  159. package/dist/enterprise.d.ts.map +1 -0
  160. package/dist/enterprise.js +194 -0
  161. package/dist/enterprise.js.map +1 -0
  162. package/dist/evidence-postgres.d.ts +123 -0
  163. package/dist/evidence-postgres.d.ts.map +1 -0
  164. package/dist/evidence-postgres.js +343 -0
  165. package/dist/evidence-postgres.js.map +1 -0
  166. package/dist/evidence.d.ts +113 -0
  167. package/dist/evidence.d.ts.map +1 -0
  168. package/dist/evidence.js +369 -0
  169. package/dist/evidence.js.map +1 -0
  170. package/dist/execution-binding.d.ts +49 -0
  171. package/dist/execution-binding.d.ts.map +1 -0
  172. package/dist/execution-binding.js +243 -0
  173. package/dist/execution-binding.js.map +1 -0
  174. package/dist/formal-runtime-map.d.ts +42 -0
  175. package/dist/formal-runtime-map.d.ts.map +1 -0
  176. package/dist/formal-runtime-map.js +23 -0
  177. package/dist/formal-runtime-map.js.map +1 -0
  178. package/dist/index.d.ts +1003 -0
  179. package/dist/index.d.ts.map +1 -0
  180. package/dist/index.js +1737 -0
  181. package/dist/index.js.map +1 -0
  182. package/dist/key-registry.d.ts +60 -0
  183. package/dist/key-registry.d.ts.map +1 -0
  184. package/dist/key-registry.js +144 -0
  185. package/dist/key-registry.js.map +1 -0
  186. package/dist/mcp.d.ts +53 -0
  187. package/dist/mcp.d.ts.map +1 -0
  188. package/dist/mcp.js +112 -0
  189. package/dist/mcp.js.map +1 -0
  190. package/dist/metering.d.ts +80 -0
  191. package/dist/metering.d.ts.map +1 -0
  192. package/dist/metering.js +227 -0
  193. package/dist/metering.js.map +1 -0
  194. package/dist/metrics.d.ts +68 -0
  195. package/dist/metrics.d.ts.map +1 -0
  196. package/dist/metrics.js +242 -0
  197. package/dist/metrics.js.map +1 -0
  198. package/dist/network-witness.d.ts +167 -0
  199. package/dist/network-witness.d.ts.map +1 -0
  200. package/dist/network-witness.js +520 -0
  201. package/dist/network-witness.js.map +1 -0
  202. package/dist/proposal-to-effect.d.ts +146 -0
  203. package/dist/proposal-to-effect.d.ts.map +1 -0
  204. package/dist/proposal-to-effect.js +427 -0
  205. package/dist/proposal-to-effect.js.map +1 -0
  206. package/dist/protocol-state.d.ts +141 -0
  207. package/dist/protocol-state.d.ts.map +1 -0
  208. package/dist/protocol-state.js +106 -0
  209. package/dist/protocol-state.js.map +1 -0
  210. package/dist/receipt-program.d.ts +59 -0
  211. package/dist/receipt-program.d.ts.map +1 -0
  212. package/dist/receipt-program.js +1053 -0
  213. package/dist/receipt-program.js.map +1 -0
  214. package/dist/reliance-kernel.d.ts +66 -0
  215. package/dist/reliance-kernel.d.ts.map +1 -0
  216. package/dist/reliance-kernel.js +103 -0
  217. package/dist/reliance-kernel.js.map +1 -0
  218. package/dist/reliance-packet.d.ts +67 -0
  219. package/dist/reliance-packet.d.ts.map +1 -0
  220. package/dist/reliance-packet.js +176 -0
  221. package/dist/reliance-packet.js.map +1 -0
  222. package/dist/remedy-program-postgres.d.ts +37 -0
  223. package/dist/remedy-program-postgres.d.ts.map +1 -0
  224. package/dist/remedy-program-postgres.js +291 -0
  225. package/dist/remedy-program-postgres.js.map +1 -0
  226. package/dist/remedy-program-receipt.d.ts +97 -0
  227. package/dist/remedy-program-receipt.d.ts.map +1 -0
  228. package/dist/remedy-program-receipt.js +817 -0
  229. package/dist/remedy-program-receipt.js.map +1 -0
  230. package/dist/remedy-program.d.ts +76 -0
  231. package/dist/remedy-program.d.ts.map +1 -0
  232. package/dist/remedy-program.js +1346 -0
  233. package/dist/remedy-program.js.map +1 -0
  234. package/dist/reports/art14.d.ts +101 -0
  235. package/dist/reports/art14.d.ts.map +1 -0
  236. package/dist/reports/art14.js +340 -0
  237. package/dist/reports/art14.js.map +1 -0
  238. package/dist/reports/assurance-package.d.ts +197 -0
  239. package/dist/reports/assurance-package.d.ts.map +1 -0
  240. package/dist/reports/assurance-package.js +313 -0
  241. package/dist/reports/assurance-package.js.map +1 -0
  242. package/dist/reports/auditor-workpaper.d.ts +194 -0
  243. package/dist/reports/auditor-workpaper.d.ts.map +1 -0
  244. package/dist/reports/auditor-workpaper.js +545 -0
  245. package/dist/reports/auditor-workpaper.js.map +1 -0
  246. package/dist/reports/external-verification.d.ts +76 -0
  247. package/dist/reports/external-verification.d.ts.map +1 -0
  248. package/dist/reports/external-verification.js +209 -0
  249. package/dist/reports/external-verification.js.map +1 -0
  250. package/dist/reports/reperform.d.ts +122 -0
  251. package/dist/reports/reperform.d.ts.map +1 -0
  252. package/dist/reports/reperform.js +432 -0
  253. package/dist/reports/reperform.js.map +1 -0
  254. package/dist/reports/underwriter.d.ts +127 -0
  255. package/dist/reports/underwriter.d.ts.map +1 -0
  256. package/dist/reports/underwriter.js +348 -0
  257. package/dist/reports/underwriter.js.map +1 -0
  258. package/dist/retention.d.ts +88 -0
  259. package/dist/retention.d.ts.map +1 -0
  260. package/dist/retention.js +90 -0
  261. package/dist/retention.js.map +1 -0
  262. package/dist/roster.d.ts +113 -0
  263. package/dist/roster.d.ts.map +1 -0
  264. package/dist/roster.js +261 -0
  265. package/dist/roster.js.map +1 -0
  266. package/dist/runtime-monitor.d.ts +132 -0
  267. package/dist/runtime-monitor.d.ts.map +1 -0
  268. package/dist/runtime-monitor.js +197 -0
  269. package/dist/runtime-monitor.js.map +1 -0
  270. package/dist/settlement.d.ts +68 -0
  271. package/dist/settlement.d.ts.map +1 -0
  272. package/dist/settlement.js +306 -0
  273. package/dist/settlement.js.map +1 -0
  274. package/dist/siem.d.ts +261 -0
  275. package/dist/siem.d.ts.map +1 -0
  276. package/dist/siem.js +247 -0
  277. package/dist/siem.js.map +1 -0
  278. package/dist/store-postgres.d.ts +107 -0
  279. package/dist/store-postgres.d.ts.map +1 -0
  280. package/dist/store-postgres.js +152 -0
  281. package/dist/store-postgres.js.map +1 -0
  282. package/dist/store.d.ts +95 -0
  283. package/dist/store.d.ts.map +1 -0
  284. package/dist/store.js +202 -0
  285. package/dist/store.js.map +1 -0
  286. package/dist/strict-json.d.ts +14 -0
  287. package/dist/strict-json.d.ts.map +1 -0
  288. package/dist/strict-json.js +132 -0
  289. package/dist/strict-json.js.map +1 -0
  290. package/dist/trust-program-adapters.d.ts +122 -0
  291. package/dist/trust-program-adapters.d.ts.map +1 -0
  292. package/dist/trust-program-adapters.js +802 -0
  293. package/dist/trust-program-adapters.js.map +1 -0
  294. package/dist/trust-program-postgres.d.ts +41 -0
  295. package/dist/trust-program-postgres.d.ts.map +1 -0
  296. package/dist/trust-program-postgres.js +346 -0
  297. package/dist/trust-program-postgres.js.map +1 -0
  298. package/dist/trust-program-revocation.d.ts +206 -0
  299. package/dist/trust-program-revocation.d.ts.map +1 -0
  300. package/dist/trust-program-revocation.js +600 -0
  301. package/dist/trust-program-revocation.js.map +1 -0
  302. package/dist/trust-program.d.ts +197 -0
  303. package/dist/trust-program.d.ts.map +1 -0
  304. package/dist/trust-program.js +1351 -0
  305. package/dist/trust-program.js.map +1 -0
  306. package/dist/witness-postgres.d.ts +43 -0
  307. package/dist/witness-postgres.d.ts.map +1 -0
  308. package/dist/witness-postgres.js +92 -0
  309. package/dist/witness-postgres.js.map +1 -0
  310. package/dist/zk-range-proof.d.ts +78 -0
  311. package/dist/zk-range-proof.d.ts.map +1 -0
  312. package/dist/zk-range-proof.js +228 -0
  313. package/dist/zk-range-proof.js.map +1 -0
  314. package/eg1-conformance.js +3 -404
  315. package/enterprise.js +3 -180
  316. package/ep-assure.mjs +1 -0
  317. package/evidence-postgres.js +3 -356
  318. package/evidence.js +4 -360
  319. package/execution-binding.js +3 -212
  320. package/formal-runtime-map.js +4 -0
  321. package/index.js +4 -1249
  322. package/key-registry.js +3 -134
  323. package/mcp.js +3 -109
  324. package/metering.js +3 -226
  325. package/metrics.js +3 -231
  326. package/network-witness.js +3 -499
  327. package/package.json +35 -4
  328. package/proposal-to-effect.js +4 -0
  329. package/receipt-program.js +4 -0
  330. package/reliance-kernel.js +3 -112
  331. package/reliance-packet.js +3 -175
  332. package/remedy-program-postgres.js +4 -0
  333. package/remedy-program-receipt.js +4 -0
  334. package/remedy-program.js +4 -0
  335. package/reports/art14.js +0 -0
  336. package/reports/assurance-package.js +2 -312
  337. package/reports/auditor-workpaper.js +3 -537
  338. package/reports/external-verification.js +3 -222
  339. package/reports/reperform.js +3 -424
  340. package/reports/underwriter.js +3 -339
  341. package/retention.js +3 -84
  342. package/roster.js +3 -264
  343. package/runtime-monitor.js +4 -0
  344. package/settlement.js +3 -299
  345. package/siem.js +3 -235
  346. package/src/action-control-manifest.ts +424 -0
  347. package/src/action-escrow-custodian.ts +427 -0
  348. package/src/action-escrow-evidence.ts +1178 -0
  349. package/src/action-escrow-package.ts +1821 -0
  350. package/src/action-escrow-postgres.ts +366 -0
  351. package/src/action-escrow-state.ts +498 -0
  352. package/src/action-escrow-verifiers.ts +484 -0
  353. package/src/action-escrow.ts +3039 -0
  354. package/src/action-packs.ts +170 -0
  355. package/src/adapters/_kit.ts +117 -0
  356. package/src/adapters/aws.ts +142 -0
  357. package/src/adapters/cloudflare.ts +78 -0
  358. package/src/adapters/gcp.ts +71 -0
  359. package/src/adapters/github.ts +110 -0
  360. package/src/adapters/jira.ts +56 -0
  361. package/src/adapters/k8s.ts +71 -0
  362. package/src/adapters/linear.ts +56 -0
  363. package/src/adapters/salesforce.ts +56 -0
  364. package/src/adapters/stripe.ts +82 -0
  365. package/src/adapters/supabase.ts +122 -0
  366. package/src/adapters/terraform.ts +60 -0
  367. package/src/adapters/vercel.ts +85 -0
  368. package/src/aec-execution.ts +354 -0
  369. package/src/breakglass.ts +647 -0
  370. package/src/capability-receipt.ts +1258 -0
  371. package/src/cf1-conformance.ts +120 -0
  372. package/src/challenge-store.ts +70 -0
  373. package/src/control-plane.ts +374 -0
  374. package/src/coverage.ts +832 -0
  375. package/src/deployment-attestation.ts +259 -0
  376. package/src/eg1-conformance.ts +471 -0
  377. package/src/enterprise.ts +195 -0
  378. package/src/evidence-postgres.ts +374 -0
  379. package/src/evidence.ts +367 -0
  380. package/src/execution-binding.ts +236 -0
  381. package/src/formal-runtime-map.ts +24 -0
  382. package/src/index.ts +2127 -0
  383. package/src/key-registry.ts +150 -0
  384. package/src/mcp.ts +120 -0
  385. package/src/metering.ts +237 -0
  386. package/src/metrics.ts +232 -0
  387. package/src/network-witness.ts +585 -0
  388. package/src/proposal-to-effect.ts +571 -0
  389. package/src/protocol-state.ts +143 -0
  390. package/src/protocol-state.typecheck.ts +94 -0
  391. package/src/receipt-program.ts +1105 -0
  392. package/src/reliance-kernel.ts +119 -0
  393. package/src/reliance-packet.ts +206 -0
  394. package/src/remedy-program-postgres.ts +367 -0
  395. package/src/remedy-program-receipt.ts +891 -0
  396. package/src/remedy-program.ts +1388 -0
  397. package/src/reports/art14.ts +361 -0
  398. package/src/reports/assurance-package.ts +330 -0
  399. package/src/reports/auditor-workpaper.ts +558 -0
  400. package/src/reports/external-verification.ts +232 -0
  401. package/src/reports/reperform.ts +441 -0
  402. package/src/reports/underwriter.ts +356 -0
  403. package/src/retention.ts +100 -0
  404. package/src/roster.ts +273 -0
  405. package/src/runtime-monitor.ts +217 -0
  406. package/src/settlement.ts +313 -0
  407. package/src/siem.ts +247 -0
  408. package/src/store-postgres.ts +167 -0
  409. package/src/store.ts +214 -0
  410. package/src/strict-json.ts +115 -0
  411. package/src/trust-program-adapters.ts +847 -0
  412. package/src/trust-program-postgres.ts +429 -0
  413. package/src/trust-program-revocation.ts +751 -0
  414. package/src/trust-program.ts +1460 -0
  415. package/src/witness-postgres.ts +106 -0
  416. package/src/zk-range-proof.ts +250 -0
  417. package/store-postgres.js +3 -161
  418. package/store.js +4 -198
  419. package/strict-json.js +3 -102
  420. package/trust-program-adapters.js +4 -0
  421. package/trust-program-postgres.js +4 -0
  422. package/trust-program-revocation.js +4 -0
  423. package/trust-program.js +4 -0
  424. package/witness-postgres.js +3 -96
  425. package/zk-range-proof.js +4 -0
@@ -0,0 +1,1003 @@
1
+ import { receiptChallenge } from '@emilia-protocol/require-receipt';
2
+ import { MemoryConsumptionStore } from './store.js';
3
+ import { canonicalEvidenceJson, createAtomicEvidenceLog, createEvidenceLog, createMemoryAtomicEvidenceBackend } from './evidence.js';
4
+ import { DEFAULT_GATE_MANIFEST, HIGH_RISK_ACTION_PACKS, createDefaultActionRiskManifest } from './action-packs.js';
5
+ import { createEg1Harness, runEg1 } from './eg1-conformance.js';
6
+ import { runCf1 } from './cf1-conformance.js';
7
+ import { createKeyRegistry, asKeyRegistry } from './key-registry.js';
8
+ import { classifyRetention, buildRetentionExport } from './retention.js';
9
+ import { createDefaultActionControlManifest, findActionControl, resolveActionControl, validateActionControlManifest } from './action-control-manifest.js';
10
+ import { createRuntimeMonitor } from './runtime-monitor.js';
11
+ import { capabilityBaseReceiptDigest, capabilityActionDigest, verifyCapabilityScope, mintCapabilityReceipt, verifyCapabilityReceipt, splitCapabilitySecret, reconstructCapabilitySecret, createMemoryCapabilityStore, createPostgresCapabilityStore, executeWithCapability, executeWithThreshold, reconcileCapabilityOperation } from './capability-receipt.js';
12
+ import { deriveZkRangeBases, loadBulletproofBackend, mintZkRangeReceipt, verifyZkRangeReceipt } from './zk-range-proof.js';
13
+ import { mintBreakGlassAuthorization, verifyBreakGlass, consumeBreakGlass, buildBreakGlassEvidence, runBreakGlass, BREAKGLASS_VERSION, BREAKGLASS_EVIDENCE_KIND } from './breakglass.js';
14
+ type Obj = Record<string, any>;
15
+ /** Shared shape for the `opts`/selector-bag argument accepted by route(), guard(),
16
+ * requestGateInput(), run(), and runCapability(). Each field may be a literal value
17
+ * or a `(req) => value` resolver function; see requestGateInput for resolution. */
18
+ interface GateCallOpts {
19
+ selector?: any;
20
+ action?: any;
21
+ receipt?: any;
22
+ observedAction?: any;
23
+ admissibilityProfile?: any;
24
+ reliancePacket?: any;
25
+ admissibility?: any;
26
+ capability?: any;
27
+ recordExecution?: boolean;
28
+ }
29
+ export { MemoryConsumptionStore, canonicalEvidenceJson, createEvidenceLog, createAtomicEvidenceLog, createMemoryAtomicEvidenceBackend, };
30
+ export { createDurableConsumptionStore, createMemoryBackend, isSecureConsumptionStore, DURABLE_CONSUMPTION_VERSION, } from './store.js';
31
+ export { createDurableChallengeStore, challengeStorageKey, challengeBodyDigest, DURABLE_CHALLENGE_STORE_VERSION } from './challenge-store.js';
32
+ export { createKeyRegistry, asKeyRegistry } from './key-registry.js';
33
+ export { classifyRetention, buildRetentionExport, RETENTION_EXPORT_VERSION } from './retention.js';
34
+ export { DEFAULT_GATE_MANIFEST, HIGH_RISK_ACTION_PACKS, createDefaultActionRiskManifest };
35
+ export { ACTION_CONTROL_MANIFEST_VERSION, ACTION_CONTROL_SCHEMA_URL, ACTION_CONTROL_CONFORMANCE_LEVEL, ACTION_CONTROL_DEFAULTS, ACTION_CONTROL_EVIDENCE_PROFILES, ACTION_CONTROL_CONFORMANCE_CHECKS, toActionControl, createDefaultActionControlManifest, findActionControl, resolveActionControl, validateActionControlManifest, } from './action-control-manifest.js';
36
+ export { EXECUTION_BINDING_VERSION, canonicalize, hashCanonical, materialFieldsFor, verifyExecutionBinding } from './execution-binding.js';
37
+ export { RELIANCE_PACKET_VERSION, ADMISSIBILITY_VERDICTS, buildReliancePacket } from './reliance-packet.js';
38
+ export { EXTERNAL_VERIFICATION_STATEMENT_VERSION, EXTERNAL_VERIFICATION_DOMAIN, externalVerificationDigest, signExternalVerificationStatement, verifyExternalVerificationStatement, } from './reports/external-verification.js';
39
+ export { EG1_VERSION, EG1_CHECKS, EG1_DEFAULT_ACTION, EG1_DEFAULT_SELECTOR, createEg1Harness, makeGateInvoke, runEg1, mintDeviceSignoff, mintQuorumEvidence, } from './eg1-conformance.js';
40
+ export { CF1_VERSION, CF1_CHECKS, runCf1 } from './cf1-conformance.js';
41
+ export { mintBreakGlassAuthorization, verifyBreakGlass, consumeBreakGlass, buildBreakGlassEvidence, runBreakGlass, BREAKGLASS_VERSION, BREAKGLASS_EVIDENCE_KIND, };
42
+ export { createRuntimeMonitor, RUNTIME_MONITOR_VERSION, RUNTIME_MONITOR_MODES, RUNTIME_INVARIANTS } from './runtime-monitor.js';
43
+ export { FORMAL_RUNTIME_BRIDGE_VERSION, FORMAL_RUNTIME_SPEC, FORMAL_RUNTIME_CONFIG, FORMAL_RUNTIME_INVARIANT_MAP, } from './formal-runtime-map.js';
44
+ export { CAPABILITY_RECEIPT_VERSION, CAPABILITY_STATE_VERSION, CAPABILITY_SHARE_VERSION, CAPABILITY_SCOPE_PROFILE, CAPABILITY_CAID_SCOPE_PROFILE, CAPABILITY_STATE_DDL, CAPABILITY_SQL, capabilityBaseReceiptDigest, capabilityActionDigest, verifyCapabilityScope, mintCapabilityReceipt, verifyCapabilityReceipt, splitCapabilitySecret, reconstructCapabilitySecret, createMemoryCapabilityStore, createPostgresCapabilityStore, executeWithCapability, executeWithThreshold, reconcileCapabilityOperation, delegateCapabilityReceipt, } from './capability-receipt.js';
45
+ export { ZK_RANGE_RECEIPT_VERSION, ZK_RANGE_SCHEME, ZK_RANGE_BACKEND_PACKAGE, deriveZkRangeBases, loadBulletproofBackend, mintZkRangeReceipt, verifyZkRangeReceipt, } from './zk-range-proof.js';
46
+ export { RECEIPT_PROGRAM_VERSION, RECEIPT_PROGRAM_CERTIFICATE_VERSION, RECEIPT_PROGRAM_SIGNATURE_ALGORITHM, createReceiptProgramKernel, verifyReceiptProgramCertificate, } from './receipt-program.js';
47
+ export { TRUST_PROGRAM_VERSION, TRUST_STAGE_RECEIPT_VERSION, validateTrustProgram, trustProgramDigest, verifyTrustStageReceipt, createMemoryTrustProgramStore, createTrustProgramKernel, } from './trust-program.js';
48
+ export { TRUST_PROGRAM_REVOCATION_TARGET_VERSION, deriveTrustProgramRevocationTargetObject, deriveTrustProgramRevocationTarget, verifyTrustProgramRevocation, applyTrustProgramRevocation, } from './trust-program-revocation.js';
49
+ export { REMEDY_PROGRAM_VERSION, createRemedyMemoryStore, createRemedyProgramKernel, } from './remedy-program.js';
50
+ export { ACTION_REMEDY_RECEIPT_VERSION, REMEDY_PROGRAM_RECEIPT_VERSION, ACTION_REMEDY_RECEIPT_DOMAIN, expectedRemedyProgramReceiptBindings, remedyProgramReceiptSigningBytes, issueRemedyProgramReceipt, signRemedyProgramReceipt, createRemedyProgramReceipt, verifyRemedyProgramReceipt, } from './remedy-program-receipt.js';
51
+ export { REMEDY_PROGRAM_PG_STORE_VERSION, REMEDY_PROGRAM_MAX_STATE_BYTES, REMEDY_PROGRAM_MAX_FORWARD_SKEW_MINUTES, REMEDY_PROGRAM_POSTGRES_SQL, createRemedyProgramPostgresStore, } from './remedy-program-postgres.js';
52
+ export { PROPOSAL_TO_EFFECT_VERSION, proposalToEffectConsumptionNonce, createProposalToEffect, } from './proposal-to-effect.js';
53
+ export declare const ASSURANCE_TIERS: string[];
54
+ /**
55
+ * Structurally compare a PRE-COMPUTED admissibility block with a profile hash.
56
+ * This helper does NOT authenticate the block or establish evaluator provenance.
57
+ * An execution gate must first verify a signature over the packet or recompute
58
+ * the verdict from trusted evidence. createGate enforces that boundary through
59
+ * its verifyAdmissibilityPacket callback whenever a profile is pinned.
60
+ *
61
+ * @param {{id?:string, profile_hash:string}} pinned the profile the relying party requires
62
+ * @param {object|null} presented a reliance packet, or its `.admissibility` block,
63
+ * as produced by buildReliancePacket / the relying party's evaluator
64
+ * @returns {{ok:boolean, reason:string|null, pinned_hash:string|null, presented_hash:string|null, verdict:string|null}}
65
+ * ok:true ONLY when the presented profile_hash equals the pinned hash AND the
66
+ * verdict is exactly 'admissible'. Every other case fails closed with a distinct reason.
67
+ */
68
+ export declare function verifyAdmissibilityAgainstPinnedProfile(pinned: any, presented: any): {
69
+ ok: boolean;
70
+ reason: string;
71
+ pinned_hash: any;
72
+ presented_hash: any;
73
+ verdict: any;
74
+ } | {
75
+ ok: boolean;
76
+ reason: null;
77
+ pinned_hash: any;
78
+ presented_hash: any;
79
+ verdict: any;
80
+ };
81
+ /**
82
+ * The assurance tier a receipt has CRYPTOGRAPHICALLY EARNED.
83
+ *
84
+ * SECURITY: the credited tier is NEVER inferred from self-asserted payload
85
+ * fields. A bare `quorum:{signers,threshold}` block or an `outcome:
86
+ * 'allow_with_signoff'` string with no verifiable signature earns only
87
+ * `software` — it will be refused `assurance_too_low` by any guard that needs
88
+ * more. Fail-closed by construction.
89
+ *
90
+ * Two independent cryptographic proof shapes are accepted; a receipt earns the
91
+ * HIGHEST tier any of them proves:
92
+ *
93
+ * (a) Pinned assurance proof (`payload.assurance_proof`, EP-ASSURANCE-PROOF-v1):
94
+ * per-signer signatures verified against PINNED approver keys (opts.approverKeys)
95
+ * or a caller-supplied verifier (opts.verifyAssurance). This is the primary,
96
+ * strongest model — the verifier never trusts a key that travels inside the
97
+ * receipt. Delegated to require-receipt's receiptAssuranceTierFromProof.
98
+ *
99
+ * (b) Embedded evidence (DoD audit fix): a full EP-QUORUM-v1
100
+ * document (payload.quorum) whose per-signer WebAuthn assertions verify via
101
+ * verifyQuorum (distinct humans + distinct keys + threshold + action-binding
102
+ * + window) earns `quorum`; a WebAuthn device signoff (payload.signoff =
103
+ * {context, webauthn}) that verifies against the approver's own key via
104
+ * verifyWebAuthnSignoff earns `class_a`. Quorum additionally requires an
105
+ * out-of-band organizational policy and identity-bound approver directory.
106
+ *
107
+ * TRUST-LAUNDERING GUARD: an approver key carried INSIDE the receipt proves
108
+ * only that whoever minted the receipt also holds that key — it is NOT proof
109
+ * the relying party trusts that human. Crediting an elevated tier off such a
110
+ * key would collapse VERIFIED into ACCEPTED (any party can mint a fresh
111
+ * keypair, self-sign a signoff, and embed both). So path (b) elevates the
112
+ * tier ONLY when either: (i) the caller explicitly opts in with
113
+ * `allowEmbeddedApproverKeys:true` for a single Class-A integrity demo
114
+ * (DEFAULT OFF); or (ii) the embedded approver key that would earn the
115
+ * credit is present in the relying party's PINNED approver key set
116
+ * (opts.approverKeys). With no pin and no opt-in, path (b) may still VERIFY
117
+ * the signoff/quorum, but it does NOT elevate above `software`. Fail-closed.
118
+ *
119
+ * @param {object} doc the EP-RECEIPT-v1 document
120
+ * @param {object} [opts]
121
+ * @param {object} [opts.approverKeys] pinned approver keys for path (a) and the
122
+ * path-(b) fallback: a receipt-embedded approver key elevates the tier only if
123
+ * it is one of these pinned keys (unless allowEmbeddedApproverKeys is set)
124
+ * @param {boolean} [opts.allowEmbeddedApproverKeys=false] explicit opt-in where
125
+ * one unpinned embedded key may earn Class-A integrity. It never earns quorum.
126
+ * @param {object} [opts.quorumPolicy] relying-party-pinned organizational rule
127
+ * @param {function|null} [opts.verifyAssurance] custom assurance verifier for path (a)
128
+ * @param {string|null} [opts.rpId] bind embedded device assertions to this WebAuthn RP id (path b)
129
+ * @param {string[]} [opts.allowedOrigins] exact WebAuthn origins accepted for embedded-evidence verification (path b)
130
+ * @param {object} [opts.quorum_policy] legacy snake_case alias for opts.quorumPolicy
131
+ * @param {boolean} [opts.detail] return a {tier, quorum, signoff} object instead of the string
132
+ * @returns {'software'|'class_a'|'quorum'|object} the highest tier proven
133
+ */
134
+ interface AssuranceQuorumDetail {
135
+ valid: boolean;
136
+ checks: Obj;
137
+ policy_pinned: boolean;
138
+ embedded_keys_trusted: boolean;
139
+ approvers: string[];
140
+ roles: {
141
+ subject: string | null;
142
+ role: string | null;
143
+ }[];
144
+ refusal: string | null;
145
+ }
146
+ interface AssuranceSignoffDetail {
147
+ valid: boolean;
148
+ checks: Obj;
149
+ embedded_key_trusted: boolean;
150
+ approver: string | null;
151
+ }
152
+ interface AssuranceTierDetail {
153
+ tier: string;
154
+ quorum: AssuranceQuorumDetail | null;
155
+ signoff: AssuranceSignoffDetail | null;
156
+ }
157
+ interface ReceiptAssuranceOpts {
158
+ approverKeys?: Obj;
159
+ allowEmbeddedApproverKeys?: boolean;
160
+ quorumPolicy?: Obj | null;
161
+ quorum_policy?: Obj | null;
162
+ verifyAssurance?: ((...args: any[]) => any) | null;
163
+ rpId?: string | null;
164
+ allowedOrigins?: readonly string[];
165
+ detail?: boolean;
166
+ }
167
+ export declare function receiptAssuranceTier(doc: any, opts?: ReceiptAssuranceOpts): string | AssuranceTierDetail;
168
+ /**
169
+ * Normalize the relying party's business-authorization pin for one action.
170
+ *
171
+ * Canonical manifest shape:
172
+ * business_authorization: {
173
+ * policy: { id, hash }, tenant_id,
174
+ * allowed_approvers: [{ subject, role }]
175
+ * }
176
+ *
177
+ * Flat policy_id/policy_hash and approver aliases are accepted so an existing
178
+ * manifest can add the control without changing its surrounding schema. Once
179
+ * any part is configured, every part is required; a partial pin is invalid.
180
+ */
181
+ export declare function businessAuthorizationRequirement(requirement: any): {
182
+ configured: boolean;
183
+ ok: boolean;
184
+ reason: string | null;
185
+ policy_id: string | null;
186
+ policy_hash: string | null;
187
+ tenant_id: string | null;
188
+ allowed_approvers: {
189
+ subject: string | null;
190
+ role: string | null;
191
+ }[];
192
+ };
193
+ /**
194
+ * Verify signed business-policy and tenant fields plus the cryptographically
195
+ * credited human approvers against one action's relying-party pins.
196
+ * @returns {{required:boolean, ok:boolean, reason:string|null, expected:object, evaluated:{policy_id:string|null, policy_hash:string|null, tenant_id:string|null, approvers:{subject:string, roles:string[]}[]}}}
197
+ */
198
+ export declare function verifyBusinessAuthorization({ requirement, receipt, assurance, tierResult }?: {
199
+ requirement?: any;
200
+ receipt?: any;
201
+ assurance?: any;
202
+ tierResult?: any;
203
+ }): {
204
+ ok: boolean;
205
+ reason: string | null;
206
+ required: boolean;
207
+ expected: {
208
+ configured: boolean;
209
+ ok: boolean;
210
+ reason: string | null;
211
+ policy_id: string | null;
212
+ policy_hash: string | null;
213
+ tenant_id: string | null;
214
+ allowed_approvers: {
215
+ subject: string | null;
216
+ role: string | null;
217
+ }[];
218
+ };
219
+ evaluated: {
220
+ policy_id: unknown;
221
+ policy_hash: unknown;
222
+ tenant_id: unknown;
223
+ approvers: {
224
+ subject: unknown;
225
+ roles: string[];
226
+ }[];
227
+ };
228
+ };
229
+ /**
230
+ * Create a gate.
231
+ * @param {object} opts
232
+ * @param {object} [opts.manifest] EP-ACTION-RISK-MANIFEST-v0.1 (which actions are guarded, their tier)
233
+ * @param {string[]} [opts.trustedKeys] base64url SPKI-DER issuer keys you trust
234
+ * @param {number} [opts.maxAgeSec=900] reject receipts older than this
235
+ * @param {object} [opts.store] durable, ownership-fenced, permanent consumption store
236
+ * @param {object} [opts.capabilityStore] Marvel capability budget store. A
237
+ * capability run reserves here before the effect and commits after it.
238
+ * @param {string[]} [opts.capabilityTrustedIssuerKeys] pinned capability
239
+ * envelope issuer keys. Required when capabilityStore is configured.
240
+ * @param {function|null} [opts.capabilityCaidResolver] relying-party-pinned resolver
241
+ * for `urn:emilia:scope:caid-set-v1`. Missing resolver fails CAID scope closed.
242
+ * @param {boolean} [opts.allowEphemeralStore=false] explicit test/demo opt-in for in-memory state
243
+ * @param {object} [opts.log] evidence log (default in-memory, hash-chained)
244
+ * @param {boolean} [opts.allowInlineKey=false] accept the receipt's own key (integrity, NOT trust)
245
+ * @param {object} [opts.keyRegistry] a key registry (createKeyRegistry) for rotation + revocation;
246
+ * if given it supersedes trustedKeys — a receipt is verified only against keys valid (and not
247
+ * revoked) at its issuance time.
248
+ * @param {object} [opts.approverKeys] PINNED approver keys ({ keyId: { public_key, key_class } }).
249
+ * Used both for the pinned assurance-proof path and to authorize receipt-embedded
250
+ * approver keys under the self-contained embedded-evidence path.
251
+ * @param {boolean} [opts.allowEmbeddedApproverKeys=false] allow one embedded key
252
+ * to earn Class-A integrity in demos. Embedded keys never establish quorum.
253
+ * @param {object} [opts.quorumPolicy] global relying-party-pinned quorum rule
254
+ * @param {object} [opts.quorumPolicies] action_type -> pinned quorum rule
255
+ * @param {string|null} [opts.rpId] WebAuthn relying-party identifier. Required for
256
+ * built-in Class-A or quorum assurance verification.
257
+ * @param {string[]} [opts.allowedOrigins] exact WebAuthn origins accepted by the
258
+ * relying party. Required for built-in Class-A or quorum verification.
259
+ * @param {function|null} [opts.verifyAdmissibilityPacket] trusted relying-party hook.
260
+ * Required whenever an admissibility profile is pinned. It must authenticate
261
+ * the presented packet or recompute the verdict and return the trusted block.
262
+ * @param {boolean} [opts.strictEvidence=true] make the evidence log strict (fail on record errors)
263
+ * @param {() => number} [opts.now] clock source (defaults to Date.now)
264
+ * @param {object|null} [opts.approver_keys] legacy snake_case alias for opts.approverKeys
265
+ * @param {function|null} [opts.verifyAssurance] caller-supplied assurance verifier (assurance-proof path a)
266
+ * @param {object} [opts.requiredAdmissibilityProfile] gate-level pinned admissibility profile {id, profile_hash}
267
+ * @param {object} [opts.runtimeMonitor] runtime invariant monitor (defaults to createRuntimeMonitor)
268
+ */
269
+ interface CreateGateOptions {
270
+ manifest?: Obj | null;
271
+ trustedKeys?: readonly string[];
272
+ maxAgeSec?: number;
273
+ store?: any;
274
+ log?: any;
275
+ capabilityStore?: any;
276
+ capabilityTrustedIssuerKeys?: string[];
277
+ capabilityCaidResolver?: ((...args: any[]) => any) | null;
278
+ allowInlineKey?: boolean;
279
+ allowEphemeralStore?: boolean;
280
+ strictEvidence?: boolean;
281
+ now?: number | (() => number);
282
+ keyRegistry?: any;
283
+ approverKeys?: Obj;
284
+ approver_keys?: Obj | null;
285
+ verifyAssurance?: ((...args: any[]) => any) | null;
286
+ rpId?: string | null;
287
+ allowedOrigins?: readonly string[];
288
+ quorumPolicy?: Obj | null;
289
+ quorumPolicies?: Obj;
290
+ requiredAdmissibilityProfile?: Obj | null;
291
+ verifyAdmissibilityPacket?: ((...args: any[]) => any) | null;
292
+ allowEmbeddedApproverKeys?: boolean;
293
+ runtimeMonitor?: ReturnType<typeof createRuntimeMonitor> | null;
294
+ }
295
+ export declare function createGate({ manifest, trustedKeys, maxAgeSec, store, log, capabilityStore, capabilityTrustedIssuerKeys, capabilityCaidResolver, allowInlineKey, allowEphemeralStore, strictEvidence, now, keyRegistry, approverKeys, approver_keys, verifyAssurance, rpId, allowedOrigins, quorumPolicy, quorumPolicies, requiredAdmissibilityProfile, verifyAdmissibilityPacket, allowEmbeddedApproverKeys, runtimeMonitor }?: CreateGateOptions): {
296
+ check: ({ selector, receipt, observedAction, consumptionMode, admissibilityProfile, reliancePacket: presentedPacket, admissibility, capability }?: {
297
+ selector?: any;
298
+ receipt?: any;
299
+ observedAction?: any;
300
+ consumptionMode?: string;
301
+ admissibilityProfile?: any;
302
+ reliancePacket?: any;
303
+ admissibility?: any;
304
+ capability?: any;
305
+ }) => Promise<{
306
+ allow: any;
307
+ status: any;
308
+ reason: any;
309
+ action: any;
310
+ requirement: any;
311
+ evidence: any;
312
+ challenge?: ReturnType<typeof receiptChallenge>;
313
+ header?: string;
314
+ _runtime_cycle_id?: any;
315
+ }>;
316
+ run: ({ selector, receipt, observedAction, admissibilityProfile, reliancePacket: presentedPacket, admissibility, capability }: {
317
+ selector?: any;
318
+ receipt?: any;
319
+ observedAction?: any;
320
+ admissibilityProfile?: any;
321
+ reliancePacket?: any;
322
+ admissibility?: any;
323
+ capability?: any;
324
+ } | undefined, fn: any, opts?: GateCallOpts) => Promise<Awaited<ReturnType<({ selector, receipt, observedAction, admissibilityProfile, reliancePacket: presentedPacket, admissibility, capability }: {
325
+ selector?: any;
326
+ receipt?: any;
327
+ observedAction?: any;
328
+ admissibilityProfile?: any;
329
+ reliancePacket?: any;
330
+ admissibility?: any;
331
+ capability?: any;
332
+ } | undefined, fn: any, opts?: GateCallOpts) => Promise<ReturnType<({ authorization, capability, reason, status, event }?: {
333
+ authorization?: any;
334
+ capability?: any;
335
+ reason?: any;
336
+ status?: number;
337
+ event?: any;
338
+ }) => {
339
+ ok: false;
340
+ status: any;
341
+ body: any;
342
+ authorization: any;
343
+ refusal: any;
344
+ capability: any;
345
+ evidence: any;
346
+ result?: undefined;
347
+ execution?: undefined;
348
+ packet?: undefined;
349
+ }> | {
350
+ ok: true;
351
+ result: any;
352
+ authorization: any;
353
+ execution: any;
354
+ packet: any;
355
+ capability: any;
356
+ status?: undefined;
357
+ body?: undefined;
358
+ refusal?: undefined;
359
+ evidence?: undefined;
360
+ } | {
361
+ ok: false;
362
+ status: any;
363
+ body: any;
364
+ authorization: any;
365
+ refusal: any;
366
+ capability: any;
367
+ result?: undefined;
368
+ execution?: undefined;
369
+ packet?: undefined;
370
+ evidence?: undefined;
371
+ }>>> | {
372
+ ok: false;
373
+ status: any;
374
+ body: any;
375
+ authorization: any;
376
+ result?: undefined;
377
+ execution?: undefined;
378
+ packet?: undefined;
379
+ } | {
380
+ ok: true;
381
+ result: any;
382
+ authorization: any;
383
+ execution: any;
384
+ packet: any;
385
+ status?: undefined;
386
+ body?: undefined;
387
+ }>;
388
+ recordExecution: ({ authorization, outcome, detail, observedAction, executionBinding }?: {
389
+ authorization?: any;
390
+ outcome?: string;
391
+ detail?: any;
392
+ observedAction?: any;
393
+ executionBinding?: any;
394
+ }) => Promise<any>;
395
+ route: (handler: any, opts?: GateCallOpts) => (req: any, res: any) => Promise<any>;
396
+ wrapRoute: (handler: any, opts?: GateCallOpts) => (req: any, res: any) => Promise<any>;
397
+ middleware: (opts?: GateCallOpts) => (req: any, res: any) => Promise<any>;
398
+ guard: (fn: any, opts?: GateCallOpts) => (...args: any[]) => Promise<any>;
399
+ reliancePacket: ({ authorization, execution, binding, admissibility }?: {
400
+ authorization?: any;
401
+ execution?: any;
402
+ binding?: any;
403
+ admissibility?: any;
404
+ }) => Promise<{
405
+ '@version': string;
406
+ product: string;
407
+ verifier: string;
408
+ verdict: string;
409
+ summary: {
410
+ action: any;
411
+ receipt_id: any;
412
+ subject: any;
413
+ policy_id: any;
414
+ policy_hash: any;
415
+ tenant_id: any;
416
+ approvers: any;
417
+ required_tier: any;
418
+ observed_tier: any;
419
+ decision_hash: any;
420
+ execution_hash: any;
421
+ evidence_head: any;
422
+ admissibility_verdict: string | null;
423
+ admissibility_profile: {
424
+ id: any;
425
+ version: any;
426
+ } | null;
427
+ admissibility_profile_hash: string | null;
428
+ };
429
+ admissibility: {
430
+ admissibility_profile: {
431
+ id: any;
432
+ version: any;
433
+ } | null;
434
+ profile_hash: string | null;
435
+ verdict: string | null;
436
+ verdict_recognized: boolean;
437
+ admissible: boolean;
438
+ replay_digest: string | null;
439
+ challenge_id: any;
440
+ challenge_digest: string | null;
441
+ } | null;
442
+ checks: {
443
+ detail?: string | {
444
+ [x: string]: any;
445
+ } | undefined;
446
+ id: any;
447
+ ok: any;
448
+ }[];
449
+ manifest_version: any;
450
+ limitations: string[];
451
+ }>;
452
+ evidence: any;
453
+ store: any;
454
+ capabilityStore: any;
455
+ keyRegistry: any;
456
+ retention: (opts?: {}) => {
457
+ summary: {
458
+ total: number;
459
+ hot: number;
460
+ cold: number;
461
+ expired: number;
462
+ legal_hold: number;
463
+ unknown: number;
464
+ hot_days: number;
465
+ cold_days: number;
466
+ };
467
+ hot: {
468
+ hash: string | null;
469
+ at: string | null;
470
+ kind: string | null;
471
+ }[];
472
+ cold: {
473
+ hash: string | null;
474
+ at: string | null;
475
+ kind: string | null;
476
+ }[];
477
+ expired: {
478
+ hash: string | null;
479
+ at: string | null;
480
+ kind: string | null;
481
+ }[];
482
+ legal_hold: {
483
+ hash: string | null;
484
+ at: string | null;
485
+ kind: string | null;
486
+ }[];
487
+ unknown: {
488
+ hash: string | null;
489
+ at: string | null;
490
+ kind: string | null;
491
+ }[];
492
+ };
493
+ retentionExport: (opts?: {}) => {
494
+ '@version': string;
495
+ generated_at: string;
496
+ hot_days: number;
497
+ cold_days: number;
498
+ evidence_head: string | null;
499
+ counts: {
500
+ total: number;
501
+ hot: number;
502
+ cold: number;
503
+ expired: number;
504
+ legal_hold: number;
505
+ unknown: number;
506
+ };
507
+ entries: {
508
+ hash: string | null;
509
+ at: string;
510
+ kind: string | null;
511
+ }[];
512
+ };
513
+ };
514
+ export declare function createTrustedActionFirewall(opts?: CreateGateOptions): {
515
+ check: ({ selector, receipt, observedAction, consumptionMode, admissibilityProfile, reliancePacket: presentedPacket, admissibility, capability }?: {
516
+ selector?: any;
517
+ receipt?: any;
518
+ observedAction?: any;
519
+ consumptionMode?: string;
520
+ admissibilityProfile?: any;
521
+ reliancePacket?: any;
522
+ admissibility?: any;
523
+ capability?: any;
524
+ }) => Promise<{
525
+ allow: any;
526
+ status: any;
527
+ reason: any;
528
+ action: any;
529
+ requirement: any;
530
+ evidence: any;
531
+ challenge?: ReturnType<typeof receiptChallenge>;
532
+ header?: string;
533
+ _runtime_cycle_id?: any;
534
+ }>;
535
+ run: ({ selector, receipt, observedAction, admissibilityProfile, reliancePacket: presentedPacket, admissibility, capability }: {
536
+ selector?: any;
537
+ receipt?: any;
538
+ observedAction?: any;
539
+ admissibilityProfile?: any;
540
+ reliancePacket?: any;
541
+ admissibility?: any;
542
+ capability?: any;
543
+ } | undefined, fn: any, opts?: GateCallOpts) => Promise<Awaited<ReturnType<({ selector, receipt, observedAction, admissibilityProfile, reliancePacket: presentedPacket, admissibility, capability }: {
544
+ selector?: any;
545
+ receipt?: any;
546
+ observedAction?: any;
547
+ admissibilityProfile?: any;
548
+ reliancePacket?: any;
549
+ admissibility?: any;
550
+ capability?: any;
551
+ } | undefined, fn: any, opts?: GateCallOpts) => Promise<ReturnType<({ authorization, capability, reason, status, event }?: {
552
+ authorization?: any;
553
+ capability?: any;
554
+ reason?: any;
555
+ status?: number;
556
+ event?: any;
557
+ }) => {
558
+ ok: false;
559
+ status: any;
560
+ body: any;
561
+ authorization: any;
562
+ refusal: any;
563
+ capability: any;
564
+ evidence: any;
565
+ result?: undefined;
566
+ execution?: undefined;
567
+ packet?: undefined;
568
+ }> | {
569
+ ok: true;
570
+ result: any;
571
+ authorization: any;
572
+ execution: any;
573
+ packet: any;
574
+ capability: any;
575
+ status?: undefined;
576
+ body?: undefined;
577
+ refusal?: undefined;
578
+ evidence?: undefined;
579
+ } | {
580
+ ok: false;
581
+ status: any;
582
+ body: any;
583
+ authorization: any;
584
+ refusal: any;
585
+ capability: any;
586
+ result?: undefined;
587
+ execution?: undefined;
588
+ packet?: undefined;
589
+ evidence?: undefined;
590
+ }>>> | {
591
+ ok: false;
592
+ status: any;
593
+ body: any;
594
+ authorization: any;
595
+ result?: undefined;
596
+ execution?: undefined;
597
+ packet?: undefined;
598
+ } | {
599
+ ok: true;
600
+ result: any;
601
+ authorization: any;
602
+ execution: any;
603
+ packet: any;
604
+ status?: undefined;
605
+ body?: undefined;
606
+ }>;
607
+ recordExecution: ({ authorization, outcome, detail, observedAction, executionBinding }?: {
608
+ authorization?: any;
609
+ outcome?: string;
610
+ detail?: any;
611
+ observedAction?: any;
612
+ executionBinding?: any;
613
+ }) => Promise<any>;
614
+ route: (handler: any, opts?: GateCallOpts) => (req: any, res: any) => Promise<any>;
615
+ wrapRoute: (handler: any, opts?: GateCallOpts) => (req: any, res: any) => Promise<any>;
616
+ middleware: (opts?: GateCallOpts) => (req: any, res: any) => Promise<any>;
617
+ guard: (fn: any, opts?: GateCallOpts) => (...args: any[]) => Promise<any>;
618
+ reliancePacket: ({ authorization, execution, binding, admissibility }?: {
619
+ authorization?: any;
620
+ execution?: any;
621
+ binding?: any;
622
+ admissibility?: any;
623
+ }) => Promise<{
624
+ '@version': string;
625
+ product: string;
626
+ verifier: string;
627
+ verdict: string;
628
+ summary: {
629
+ action: any;
630
+ receipt_id: any;
631
+ subject: any;
632
+ policy_id: any;
633
+ policy_hash: any;
634
+ tenant_id: any;
635
+ approvers: any;
636
+ required_tier: any;
637
+ observed_tier: any;
638
+ decision_hash: any;
639
+ execution_hash: any;
640
+ evidence_head: any;
641
+ admissibility_verdict: string | null;
642
+ admissibility_profile: {
643
+ id: any;
644
+ version: any;
645
+ } | null;
646
+ admissibility_profile_hash: string | null;
647
+ };
648
+ admissibility: {
649
+ admissibility_profile: {
650
+ id: any;
651
+ version: any;
652
+ } | null;
653
+ profile_hash: string | null;
654
+ verdict: string | null;
655
+ verdict_recognized: boolean;
656
+ admissible: boolean;
657
+ replay_digest: string | null;
658
+ challenge_id: any;
659
+ challenge_digest: string | null;
660
+ } | null;
661
+ checks: {
662
+ detail?: string | {
663
+ [x: string]: any;
664
+ } | undefined;
665
+ id: any;
666
+ ok: any;
667
+ }[];
668
+ manifest_version: any;
669
+ limitations: string[];
670
+ }>;
671
+ evidence: any;
672
+ store: any;
673
+ capabilityStore: any;
674
+ keyRegistry: any;
675
+ retention: (opts?: {}) => {
676
+ summary: {
677
+ total: number;
678
+ hot: number;
679
+ cold: number;
680
+ expired: number;
681
+ legal_hold: number;
682
+ unknown: number;
683
+ hot_days: number;
684
+ cold_days: number;
685
+ };
686
+ hot: {
687
+ hash: string | null;
688
+ at: string | null;
689
+ kind: string | null;
690
+ }[];
691
+ cold: {
692
+ hash: string | null;
693
+ at: string | null;
694
+ kind: string | null;
695
+ }[];
696
+ expired: {
697
+ hash: string | null;
698
+ at: string | null;
699
+ kind: string | null;
700
+ }[];
701
+ legal_hold: {
702
+ hash: string | null;
703
+ at: string | null;
704
+ kind: string | null;
705
+ }[];
706
+ unknown: {
707
+ hash: string | null;
708
+ at: string | null;
709
+ kind: string | null;
710
+ }[];
711
+ };
712
+ retentionExport: (opts?: {}) => {
713
+ '@version': string;
714
+ generated_at: string;
715
+ hot_days: number;
716
+ cold_days: number;
717
+ evidence_head: string | null;
718
+ counts: {
719
+ total: number;
720
+ hot: number;
721
+ cold: number;
722
+ expired: number;
723
+ legal_hold: number;
724
+ unknown: number;
725
+ };
726
+ entries: {
727
+ hash: string | null;
728
+ at: string;
729
+ kind: string | null;
730
+ }[];
731
+ };
732
+ };
733
+ /**
734
+ * EG-1 conformance for an existing gate. The gate MUST have been built trusting
735
+ * `harness.publicKey` (otherwise every valid receipt is rejected and the gate
736
+ * cannot earn EG-1). Returns the EG-1 JSON report.
737
+ * @param {object} [o]
738
+ * @param {object} [o.gate] an EMILIA Gate (createGate/createTrustedActionFirewall)
739
+ * @param {object} [o.harness] the harness whose key the gate trusts (createEg1Harness)
740
+ * @param {object} [o.action] the high-risk action to exercise
741
+ * @param {object} [o.selector] the manifest selector for that action
742
+ */
743
+ export declare function gateConformance({ gate, harness, action, selector }?: {
744
+ gate?: any;
745
+ harness?: any;
746
+ action?: any;
747
+ selector?: any;
748
+ }): Promise<{
749
+ standard: string;
750
+ passed: boolean;
751
+ badge: string;
752
+ summary: {
753
+ passed: number;
754
+ total: number;
755
+ };
756
+ checks: any[];
757
+ generated_at: string;
758
+ }>;
759
+ /**
760
+ * Self-certify the reference gate: build a default Consequence Firewall that
761
+ * trusts a fresh EG-1 harness key, then run all eight checks. This is the
762
+ * canonical "EMILIA Gate earns EG-1" proof — runnable as a CLI (`eg1.mjs`),
763
+ * shown on /gate, and the template an adopter copies for their integration.
764
+ * @param {{now?: any}} [o]
765
+ */
766
+ export declare function gateConformanceSelfTest({ now }?: {
767
+ now?: any;
768
+ }): Promise<{
769
+ standard: string;
770
+ passed: boolean;
771
+ badge: string;
772
+ summary: {
773
+ passed: number;
774
+ total: number;
775
+ };
776
+ checks: any[];
777
+ generated_at: string;
778
+ }>;
779
+ /**
780
+ * CF-1 (Consequence Firewall) conformance for an existing gate. Runs the eight
781
+ * EG-1 runtime checks plus the three CF-1 category checks: the action is
782
+ * declared consequential by the manifest, a gate pinned to the WRONG issuer key
783
+ * refuses a valid receipt, and the allowed run emits offline-verifiable reliance
784
+ * evidence. The `gate` MUST trust `harness.publicKey`; `wrongGate` MUST trust a
785
+ * DIFFERENT key (otherwise wrong_authority_refused cannot be demonstrated).
786
+ * @param {object} [o]
787
+ * @param {object} [o.gate] an EMILIA Gate trusting harness.publicKey
788
+ * @param {object} [o.wrongGate] a sibling gate trusting a different (wrong) key
789
+ * @param {object} [o.harness] from createEg1Harness()
790
+ * @param {object} [o.manifest] the action-risk manifest (to resolve the requirement)
791
+ * @param {object} [o.selector] the manifest selector for the action
792
+ * @param {object} [o.action] the high-risk action to exercise
793
+ */
794
+ export declare function cf1Conformance({ gate, wrongGate, harness, manifest, selector, action }?: {
795
+ gate?: any;
796
+ wrongGate?: any;
797
+ harness?: any;
798
+ manifest?: any;
799
+ selector?: any;
800
+ action?: any;
801
+ }): Promise<{
802
+ standard: string;
803
+ passed: boolean;
804
+ badge: string;
805
+ summary: {
806
+ passed: number;
807
+ total: number;
808
+ };
809
+ eg1: {
810
+ passed: boolean;
811
+ summary: {
812
+ passed: number;
813
+ total: number;
814
+ };
815
+ };
816
+ checks: {
817
+ pass: boolean;
818
+ observed: {
819
+ [x: string]: any;
820
+ };
821
+ id: string;
822
+ title: string;
823
+ }[];
824
+ generated_at: string;
825
+ }>;
826
+ /**
827
+ * Self-certify the reference gate against CF-1: a default Trusted Action
828
+ * Firewall trusting a fresh harness key, a sibling firewall trusting a DIFFERENT
829
+ * key (for wrong_authority_refused), and the default action-risk manifest (for
830
+ * consequential_action_declared). The canonical "reference gate earns CF-1"
831
+ * proof — runnable as a CLI (`cf1.mjs`).
832
+ * @param {{now?: any}} [o]
833
+ */
834
+ export declare function cf1ConformanceSelfTest({ now }?: {
835
+ now?: any;
836
+ }): Promise<{
837
+ standard: string;
838
+ passed: boolean;
839
+ badge: string;
840
+ summary: {
841
+ passed: number;
842
+ total: number;
843
+ };
844
+ eg1: {
845
+ passed: boolean;
846
+ summary: {
847
+ passed: number;
848
+ total: number;
849
+ };
850
+ };
851
+ checks: {
852
+ pass: boolean;
853
+ observed: {
854
+ [x: string]: any;
855
+ };
856
+ id: string;
857
+ title: string;
858
+ }[];
859
+ generated_at: string;
860
+ }>;
861
+ declare const _default: {
862
+ createGate: typeof createGate;
863
+ createTrustedActionFirewall: typeof createTrustedActionFirewall;
864
+ runBreakGlass: typeof runBreakGlass;
865
+ receiptAssuranceTier: typeof receiptAssuranceTier;
866
+ businessAuthorizationRequirement: typeof businessAuthorizationRequirement;
867
+ verifyBusinessAuthorization: typeof verifyBusinessAuthorization;
868
+ verifyAdmissibilityAgainstPinnedProfile: typeof verifyAdmissibilityAgainstPinnedProfile;
869
+ ADMISSIBILITY_VERDICTS: readonly string[];
870
+ MemoryConsumptionStore: typeof MemoryConsumptionStore;
871
+ createEvidenceLog: typeof createEvidenceLog;
872
+ createAtomicEvidenceLog: typeof createAtomicEvidenceLog;
873
+ createMemoryAtomicEvidenceBackend: typeof createMemoryAtomicEvidenceBackend;
874
+ ASSURANCE_TIERS: string[];
875
+ DEFAULT_GATE_MANIFEST: Readonly<{
876
+ '@version': string;
877
+ actions: {
878
+ id: string;
879
+ label: string;
880
+ action_type: string;
881
+ risk?: string;
882
+ receipt_required: boolean;
883
+ assurance_class?: string;
884
+ match: {
885
+ protocol: string;
886
+ tool: string;
887
+ };
888
+ why?: string;
889
+ execution_binding?: {
890
+ required_fields: string[];
891
+ caid_selector?: {
892
+ field: string;
893
+ };
894
+ };
895
+ business_authorization?: Record<string, any>;
896
+ }[];
897
+ }>;
898
+ HIGH_RISK_ACTION_PACKS: readonly {
899
+ id: string;
900
+ label: string;
901
+ action_type: string;
902
+ risk?: string;
903
+ receipt_required: boolean;
904
+ assurance_class?: string;
905
+ match: {
906
+ protocol: string;
907
+ tool: string;
908
+ };
909
+ why?: string;
910
+ execution_binding?: {
911
+ required_fields: string[];
912
+ caid_selector?: {
913
+ field: string;
914
+ };
915
+ };
916
+ business_authorization?: Record<string, any>;
917
+ }[];
918
+ gateConformance: typeof gateConformance;
919
+ gateConformanceSelfTest: typeof gateConformanceSelfTest;
920
+ cf1Conformance: typeof cf1Conformance;
921
+ cf1ConformanceSelfTest: typeof cf1ConformanceSelfTest;
922
+ CF1_VERSION: string;
923
+ CF1_CHECKS: readonly {
924
+ id: string;
925
+ title: string;
926
+ }[];
927
+ runCf1: typeof runCf1;
928
+ createEg1Harness: typeof createEg1Harness;
929
+ runEg1: typeof runEg1;
930
+ createKeyRegistry: typeof createKeyRegistry;
931
+ asKeyRegistry: typeof asKeyRegistry;
932
+ classifyRetention: typeof classifyRetention;
933
+ buildRetentionExport: typeof buildRetentionExport;
934
+ createDefaultActionControlManifest: typeof createDefaultActionControlManifest;
935
+ findActionControl: typeof findActionControl;
936
+ resolveActionControl: typeof resolveActionControl;
937
+ validateActionControlManifest: typeof validateActionControlManifest;
938
+ createRuntimeMonitor: typeof createRuntimeMonitor;
939
+ RUNTIME_MONITOR_VERSION: string;
940
+ RUNTIME_MONITOR_MODES: Readonly<{
941
+ NORMAL: "normal";
942
+ DEGRADED: "degraded";
943
+ LOCKDOWN: "lockdown";
944
+ }>;
945
+ RUNTIME_INVARIANTS: Readonly<{
946
+ CONSUME_ONCE: "ConsumeOnceSafety";
947
+ WRITE_BYPASS: "WriteBypassSafety";
948
+ SIGNOFF_BINDING: "SignoffBindingMatch";
949
+ }>;
950
+ FORMAL_RUNTIME_BRIDGE_VERSION: string;
951
+ FORMAL_RUNTIME_SPEC: string;
952
+ FORMAL_RUNTIME_CONFIG: string;
953
+ FORMAL_RUNTIME_INVARIANT_MAP: readonly (Readonly<{
954
+ runtime: "ConsumeOnceSafety";
955
+ formal: "ConsumeOnceSafety";
956
+ transition: "consumptionCommitted";
957
+ }> | Readonly<{
958
+ runtime: "WriteBypassSafety";
959
+ formal: "WriteBypassSafety";
960
+ transition: "beginExecution";
961
+ }> | Readonly<{
962
+ runtime: "SignoffBindingMatch";
963
+ formal: "SignoffBindingMatch";
964
+ transition: "recordDecision";
965
+ }>)[];
966
+ CAPABILITY_RECEIPT_VERSION: string;
967
+ CAPABILITY_STATE_VERSION: string;
968
+ CAPABILITY_SHARE_VERSION: string;
969
+ CAPABILITY_SCOPE_PROFILE: string;
970
+ CAPABILITY_CAID_SCOPE_PROFILE: string;
971
+ CAPABILITY_STATE_DDL: string;
972
+ CAPABILITY_SQL: Readonly<{
973
+ register: "INSERT INTO ep_capability_state (capability_id, budget_amount, currency, expires_at, capability_fingerprint) VALUES ($1, $2, $3, $4, $5) ON CONFLICT (capability_id) DO UPDATE SET capability_fingerprint = COALESCE(ep_capability_state.capability_fingerprint, EXCLUDED.capability_fingerprint) WHERE ep_capability_state.budget_amount = EXCLUDED.budget_amount AND ep_capability_state.currency = EXCLUDED.currency AND ep_capability_state.expires_at = EXCLUDED.expires_at";
974
+ readState: "SELECT capability_id, capability_fingerprint, budget_amount, currency, consumed_amount, reserved_amount, expires_at FROM ep_capability_state WHERE capability_id = $1 FOR UPDATE";
975
+ readOperation: "SELECT operation_id, capability_id, action_digest, amount, currency, status, reservation_token, outcome, reconciliation_outcome, reconciliation_evidence_digest, reconciled_at FROM ep_capability_operations WHERE operation_id = $1 FOR UPDATE";
976
+ insertOperation: "INSERT INTO ep_capability_operations (operation_id, capability_id, action_digest, amount, currency, status, reservation_token, reserved_at) VALUES ($1, $2, $3, $4, $5, 'reserved', $6, $7)";
977
+ reserveState: "UPDATE ep_capability_state SET reserved_amount = reserved_amount + $2 WHERE capability_id = $1 AND budget_amount - consumed_amount - reserved_amount >= $2";
978
+ commitOperation: "UPDATE ep_capability_operations SET status = 'committed', outcome = $3, committed_at = $4 WHERE operation_id = $1 AND capability_id = $2 AND status = 'reserved' AND reservation_token = $5";
979
+ reconcileOperation: "UPDATE ep_capability_operations SET reconciliation_outcome = $3, reconciliation_evidence_digest = $4, reconciled_at = $5 WHERE operation_id = $1 AND capability_id = $2 AND status = 'committed' AND outcome = 'indeterminate' AND reconciliation_outcome IS NULL";
980
+ commitState: "UPDATE ep_capability_state SET reserved_amount = reserved_amount - $2, consumed_amount = consumed_amount + $2 WHERE capability_id = $1 AND reserved_amount >= $2";
981
+ }>;
982
+ capabilityBaseReceiptDigest: typeof capabilityBaseReceiptDigest;
983
+ capabilityActionDigest: typeof capabilityActionDigest;
984
+ verifyCapabilityScope: typeof verifyCapabilityScope;
985
+ mintCapabilityReceipt: typeof mintCapabilityReceipt;
986
+ verifyCapabilityReceipt: typeof verifyCapabilityReceipt;
987
+ splitCapabilitySecret: typeof splitCapabilitySecret;
988
+ reconstructCapabilitySecret: typeof reconstructCapabilitySecret;
989
+ createMemoryCapabilityStore: typeof createMemoryCapabilityStore;
990
+ createPostgresCapabilityStore: typeof createPostgresCapabilityStore;
991
+ executeWithCapability: typeof executeWithCapability;
992
+ executeWithThreshold: typeof executeWithThreshold;
993
+ reconcileCapabilityOperation: typeof reconcileCapabilityOperation;
994
+ ZK_RANGE_RECEIPT_VERSION: string;
995
+ ZK_RANGE_SCHEME: string;
996
+ ZK_RANGE_BACKEND_PACKAGE: string;
997
+ deriveZkRangeBases: typeof deriveZkRangeBases;
998
+ loadBulletproofBackend: typeof loadBulletproofBackend;
999
+ mintZkRangeReceipt: typeof mintZkRangeReceipt;
1000
+ verifyZkRangeReceipt: typeof verifyZkRangeReceipt;
1001
+ };
1002
+ export default _default;
1003
+ //# sourceMappingURL=index.d.ts.map