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