@kya-os/mcp 1.16.2 → 1.17.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 (469) hide show
  1. package/AUDITABILITY.md +129 -8
  2. package/CHANGELOG.md +579 -0
  3. package/CONFORMANCE.md +4 -4
  4. package/README.md +65 -26
  5. package/SPEC.md +85 -17
  6. package/dist/audit/adapters/legacy-audit-log.d.ts +0 -1
  7. package/dist/audit/adapters/mcp.d.ts +0 -1
  8. package/dist/audit/adapters/mcp.js +35 -20
  9. package/dist/audit/adapters/mcp.js.map +1 -1
  10. package/dist/audit/adapters/references.d.ts +9 -0
  11. package/dist/audit/adapters/references.js +22 -0
  12. package/dist/audit/adapters/references.js.map +1 -0
  13. package/dist/audit/assurance.d.ts +0 -1
  14. package/dist/audit/checkpoint-coordinator.d.ts +0 -1
  15. package/dist/audit/checkpoint.d.ts +17 -1
  16. package/dist/audit/checkpoint.js +76 -21
  17. package/dist/audit/checkpoint.js.map +1 -1
  18. package/dist/audit/cli.d.ts +0 -1
  19. package/dist/audit/crypto.d.ts +0 -1
  20. package/dist/audit/crypto.js +12 -3
  21. package/dist/audit/crypto.js.map +1 -1
  22. package/dist/audit/errors.d.ts +0 -1
  23. package/dist/audit/evidence.d.ts +0 -1
  24. package/dist/audit/index.d.ts +0 -1
  25. package/dist/audit/integrity.d.ts +0 -1
  26. package/dist/audit/merkle.d.ts +0 -1
  27. package/dist/audit/mirror-service.d.ts +0 -1
  28. package/dist/audit/projection.d.ts +1 -1
  29. package/dist/audit/projection.js +23 -2
  30. package/dist/audit/projection.js.map +1 -1
  31. package/dist/audit/providers/anchor.d.ts +0 -1
  32. package/dist/audit/providers/evidence.d.ts +0 -1
  33. package/dist/audit/providers/journal.d.ts +0 -1
  34. package/dist/audit/providers/memory-journal.d.ts +0 -1
  35. package/dist/audit/providers/observer.d.ts +0 -1
  36. package/dist/audit/providers/outbox.d.ts +35 -6
  37. package/dist/audit/providers/outbox.js +46 -8
  38. package/dist/audit/providers/outbox.js.map +1 -1
  39. package/dist/audit/providers/recorder-client.d.ts +0 -1
  40. package/dist/audit/providers/source-state.d.ts +24 -2
  41. package/dist/audit/providers/source-state.js +65 -44
  42. package/dist/audit/providers/source-state.js.map +1 -1
  43. package/dist/audit/read-contract.d.ts +0 -1
  44. package/dist/audit/read-service.d.ts +2 -3
  45. package/dist/audit/read-service.js +17 -12
  46. package/dist/audit/read-service.js.map +1 -1
  47. package/dist/audit/recorder-service.d.ts +33 -5
  48. package/dist/audit/recorder-service.js +116 -20
  49. package/dist/audit/recorder-service.js.map +1 -1
  50. package/dist/audit/reference-recorder.d.ts +0 -1
  51. package/dist/audit/replay-bundle.d.ts +0 -1
  52. package/dist/audit/replay-bundle.js +143 -36
  53. package/dist/audit/replay-bundle.js.map +1 -1
  54. package/dist/audit/schemas.d.ts +0 -1
  55. package/dist/audit/service.d.ts +6 -3
  56. package/dist/audit/service.js +55 -24
  57. package/dist/audit/service.js.map +1 -1
  58. package/dist/audit/testing/index.d.ts +0 -1
  59. package/dist/audit/testing/provider-contracts.d.ts +1 -2
  60. package/dist/audit/testing/provider-contracts.js +32 -2
  61. package/dist/audit/testing/provider-contracts.js.map +1 -1
  62. package/dist/audit/types.d.ts +0 -1
  63. package/dist/audit/verifier.d.ts +57 -5
  64. package/dist/audit/verifier.js +240 -49
  65. package/dist/audit/verifier.js.map +1 -1
  66. package/dist/auth/handshake.d.ts +12 -1
  67. package/dist/auth/handshake.js +44 -11
  68. package/dist/auth/handshake.js.map +1 -1
  69. package/dist/auth/index.d.ts +0 -1
  70. package/dist/auth/types.d.ts +0 -1
  71. package/dist/authz/accountability.d.ts +0 -1
  72. package/dist/authz/adapter.d.ts +0 -1
  73. package/dist/authz/examples/inmemory-oidc.d.ts +0 -1
  74. package/dist/authz/index.d.ts +0 -1
  75. package/dist/authz/oidc/authorize.d.ts +0 -1
  76. package/dist/authz/oidc/metadata.d.ts +0 -1
  77. package/dist/authz/oidc/oidc-adapter.d.ts +0 -1
  78. package/dist/authz/oidc/oidc-adapter.js +51 -3
  79. package/dist/authz/oidc/oidc-adapter.js.map +1 -1
  80. package/dist/authz/oidc/pending-flow-store.d.ts +6 -1
  81. package/dist/authz/oidc/pending-flow-store.js +22 -2
  82. package/dist/authz/oidc/pending-flow-store.js.map +1 -1
  83. package/dist/authz/oidc/pkce.d.ts +0 -1
  84. package/dist/authz/registry.d.ts +0 -1
  85. package/dist/authz/requirement.d.ts +0 -1
  86. package/dist/card/build.d.ts +0 -1
  87. package/dist/card/builder.d.ts +0 -1
  88. package/dist/card/cimd.d.ts +19 -5
  89. package/dist/card/cimd.js +52 -7
  90. package/dist/card/cimd.js.map +1 -1
  91. package/dist/card/delegation.d.ts +0 -1
  92. package/dist/card/delegation.js +25 -15
  93. package/dist/card/delegation.js.map +1 -1
  94. package/dist/card/emit.d.ts +0 -1
  95. package/dist/card/index.d.ts +0 -1
  96. package/dist/card/middleware.d.ts +0 -1
  97. package/dist/card/proof/build.d.ts +0 -1
  98. package/dist/card/proof/canonical.d.ts +0 -1
  99. package/dist/card/proof/canonical.js +6 -1
  100. package/dist/card/proof/canonical.js.map +1 -1
  101. package/dist/card/proof/http-sig.d.ts +0 -1
  102. package/dist/card/proof/index.d.ts +0 -1
  103. package/dist/card/proof/nonce-cache.d.ts +15 -14
  104. package/dist/card/proof/nonce-cache.js +22 -20
  105. package/dist/card/proof/nonce-cache.js.map +1 -1
  106. package/dist/card/proof/signer.d.ts +0 -1
  107. package/dist/card/proof/types.d.ts +10 -4
  108. package/dist/card/proof/types.js +2 -2
  109. package/dist/card/proof/verify.d.ts +0 -1
  110. package/dist/card/proof/verify.js +17 -3
  111. package/dist/card/proof/verify.js.map +1 -1
  112. package/dist/card/resolve.d.ts +0 -1
  113. package/dist/card/resolve.js +13 -8
  114. package/dist/card/resolve.js.map +1 -1
  115. package/dist/card/revocation.d.ts +0 -1
  116. package/dist/card/revocation.js +18 -6
  117. package/dist/card/revocation.js.map +1 -1
  118. package/dist/card/schema.d.ts +7 -6
  119. package/dist/card/schema.js +7 -3
  120. package/dist/card/schema.js.map +1 -1
  121. package/dist/card/verify.d.ts +0 -1
  122. package/dist/delegation/audience-validator.d.ts +0 -1
  123. package/dist/delegation/bitstring.d.ts +0 -1
  124. package/dist/delegation/cascading-revocation.d.ts +1 -2
  125. package/dist/delegation/cascading-revocation.js +34 -36
  126. package/dist/delegation/cascading-revocation.js.map +1 -1
  127. package/dist/delegation/chain-enforcement.d.ts +26 -5
  128. package/dist/delegation/chain-enforcement.js +110 -34
  129. package/dist/delegation/chain-enforcement.js.map +1 -1
  130. package/dist/delegation/delegation-graph.d.ts +30 -1
  131. package/dist/delegation/delegation-graph.js +33 -0
  132. package/dist/delegation/delegation-graph.js.map +1 -1
  133. package/dist/delegation/delegation-registration.d.ts +22 -0
  134. package/dist/delegation/delegation-registration.js +51 -0
  135. package/dist/delegation/delegation-registration.js.map +1 -0
  136. package/dist/delegation/delegation-status-entry.d.ts +22 -0
  137. package/dist/delegation/delegation-status-entry.js +42 -0
  138. package/dist/delegation/delegation-status-entry.js.map +1 -0
  139. package/dist/delegation/did-key-resolver.d.ts +0 -1
  140. package/dist/delegation/did-key-resolver.js +15 -4
  141. package/dist/delegation/did-key-resolver.js.map +1 -1
  142. package/dist/delegation/did-linkage.d.ts +0 -1
  143. package/dist/delegation/did-resolver-registry.d.ts +0 -1
  144. package/dist/delegation/did-web-resolver.d.ts +0 -1
  145. package/dist/delegation/did-web-resolver.js +40 -5
  146. package/dist/delegation/did-web-resolver.js.map +1 -1
  147. package/dist/delegation/holder-binding.d.ts +11 -11
  148. package/dist/delegation/holder-binding.js +8 -17
  149. package/dist/delegation/holder-binding.js.map +1 -1
  150. package/dist/delegation/index.d.ts +0 -1
  151. package/dist/delegation/outbound-headers.d.ts +0 -1
  152. package/dist/delegation/outbound-proof.d.ts +0 -1
  153. package/dist/delegation/scope-matcher.d.ts +25 -2
  154. package/dist/delegation/scope-matcher.js +75 -5
  155. package/dist/delegation/scope-matcher.js.map +1 -1
  156. package/dist/delegation/status-cache.d.ts +0 -1
  157. package/dist/delegation/statuslist-manager.d.ts +18 -2
  158. package/dist/delegation/statuslist-manager.js +40 -14
  159. package/dist/delegation/statuslist-manager.js.map +1 -1
  160. package/dist/delegation/storage/memory-graph-storage.d.ts +9 -3
  161. package/dist/delegation/storage/memory-graph-storage.js +28 -14
  162. package/dist/delegation/storage/memory-graph-storage.js.map +1 -1
  163. package/dist/delegation/storage/memory-statuslist-storage.d.ts +0 -1
  164. package/dist/delegation/utils.d.ts +5 -5
  165. package/dist/delegation/utils.js +4 -4
  166. package/dist/delegation/utils.js.map +1 -1
  167. package/dist/delegation/vc-issuer.d.ts +0 -1
  168. package/dist/delegation/vc-jwt-verify.d.ts +7 -2
  169. package/dist/delegation/vc-jwt-verify.js +55 -3
  170. package/dist/delegation/vc-jwt-verify.js.map +1 -1
  171. package/dist/delegation/vc-verification-checks.d.ts +0 -1
  172. package/dist/delegation/vc-verification-checks.js +9 -5
  173. package/dist/delegation/vc-verification-checks.js.map +1 -1
  174. package/dist/delegation/vc-verifier.d.ts +0 -1
  175. package/dist/delegation/vc-verifier.types.d.ts +0 -1
  176. package/dist/delegation/verification-method-key.d.ts +0 -1
  177. package/dist/delegation/verification-method-key.js +4 -3
  178. package/dist/delegation/verification-method-key.js.map +1 -1
  179. package/dist/errors.d.ts +0 -1
  180. package/dist/extension/declaration.d.ts +0 -1
  181. package/dist/extension/gate.d.ts +0 -1
  182. package/dist/extension/index.d.ts +0 -1
  183. package/dist/extension/settings.d.ts +0 -1
  184. package/dist/index.d.ts +2 -3
  185. package/dist/index.js +1 -1
  186. package/dist/index.js.map +1 -1
  187. package/dist/integrations/cheqd/dlr.d.ts +0 -1
  188. package/dist/integrations/cheqd/dlr.js +6 -1
  189. package/dist/integrations/cheqd/dlr.js.map +1 -1
  190. package/dist/integrations/cheqd/index.d.ts +0 -1
  191. package/dist/integrations/cheqd/linkage.d.ts +0 -1
  192. package/dist/integrations/cheqd/registrar.d.ts +0 -1
  193. package/dist/integrations/cheqd/resolver.d.ts +0 -1
  194. package/dist/integrations/cheqd/statuslist-resolver.d.ts +0 -1
  195. package/dist/logging/index.d.ts +0 -1
  196. package/dist/logging/logger.d.ts +0 -1
  197. package/dist/middleware/index.d.ts +0 -1
  198. package/dist/middleware/kya-os-transport.d.ts +5 -3
  199. package/dist/middleware/kya-os-transport.js +58 -24
  200. package/dist/middleware/kya-os-transport.js.map +1 -1
  201. package/dist/middleware/with-kya-os-server.d.ts +24 -4
  202. package/dist/middleware/with-kya-os-server.js +7 -0
  203. package/dist/middleware/with-kya-os-server.js.map +1 -1
  204. package/dist/middleware/with-kya-os.config-types.d.ts +22 -4
  205. package/dist/middleware/with-kya-os.d.ts +0 -1
  206. package/dist/middleware/with-kya-os.delegation-gate.d.ts +2 -1
  207. package/dist/middleware/with-kya-os.delegation-gate.js +37 -9
  208. package/dist/middleware/with-kya-os.delegation-gate.js.map +1 -1
  209. package/dist/middleware/with-kya-os.delegation-verify.d.ts +1 -1
  210. package/dist/middleware/with-kya-os.delegation-verify.js +45 -9
  211. package/dist/middleware/with-kya-os.delegation-verify.js.map +1 -1
  212. package/dist/middleware/with-kya-os.deps.d.ts +0 -1
  213. package/dist/middleware/with-kya-os.grants.d.ts +13 -6
  214. package/dist/middleware/with-kya-os.grants.js +56 -18
  215. package/dist/middleware/with-kya-os.grants.js.map +1 -1
  216. package/dist/middleware/with-kya-os.helpers.d.ts +0 -1
  217. package/dist/middleware/with-kya-os.js +14 -4
  218. package/dist/middleware/with-kya-os.js.map +1 -1
  219. package/dist/middleware/with-kya-os.policy-gate.d.ts +0 -1
  220. package/dist/middleware/with-kya-os.policy-gate.js +18 -9
  221. package/dist/middleware/with-kya-os.policy-gate.js.map +1 -1
  222. package/dist/middleware/with-kya-os.protocol.d.ts +0 -1
  223. package/dist/middleware/with-kya-os.session.d.ts +28 -1
  224. package/dist/middleware/with-kya-os.session.js +146 -7
  225. package/dist/middleware/with-kya-os.session.js.map +1 -1
  226. package/dist/middleware/with-kya-os.types.d.ts +28 -5
  227. package/dist/policy/approval.d.ts +13 -2
  228. package/dist/policy/approval.js +15 -4
  229. package/dist/policy/approval.js.map +1 -1
  230. package/dist/policy/classifier.d.ts +0 -1
  231. package/dist/policy/default-engine.d.ts +5 -2
  232. package/dist/policy/default-engine.js +10 -2
  233. package/dist/policy/default-engine.js.map +1 -1
  234. package/dist/policy/engine.d.ts +0 -1
  235. package/dist/policy/index.d.ts +0 -1
  236. package/dist/policy/projection.d.ts +0 -1
  237. package/dist/policy/types.d.ts +0 -1
  238. package/dist/proof/covered-request.d.ts +46 -0
  239. package/dist/proof/covered-request.js +107 -0
  240. package/dist/proof/covered-request.js.map +1 -0
  241. package/dist/proof/errors.d.ts +3 -1
  242. package/dist/proof/errors.js +5 -0
  243. package/dist/proof/errors.js.map +1 -1
  244. package/dist/proof/generator.d.ts +51 -1
  245. package/dist/proof/generator.js +71 -13
  246. package/dist/proof/generator.js.map +1 -1
  247. package/dist/proof/index.d.ts +1 -2
  248. package/dist/proof/index.js.map +1 -1
  249. package/dist/proof/verifier.d.ts +50 -12
  250. package/dist/proof/verifier.js +164 -84
  251. package/dist/proof/verifier.js.map +1 -1
  252. package/dist/providers/audit-log.d.ts +0 -1
  253. package/dist/providers/base.d.ts +19 -1
  254. package/dist/providers/base.js.map +1 -1
  255. package/dist/providers/grant-store.d.ts +8 -2
  256. package/dist/providers/grant-store.js +5 -5
  257. package/dist/providers/grant-store.js.map +1 -1
  258. package/dist/providers/index.d.ts +0 -1
  259. package/dist/providers/memory.d.ts +19 -1
  260. package/dist/providers/memory.js +53 -7
  261. package/dist/providers/memory.js.map +1 -1
  262. package/dist/providers/node-crypto.d.ts +4 -1
  263. package/dist/providers/node-crypto.js +32 -9
  264. package/dist/providers/node-crypto.js.map +1 -1
  265. package/dist/providers/nonce-admission.d.ts +31 -0
  266. package/dist/providers/nonce-admission.js +47 -0
  267. package/dist/providers/nonce-admission.js.map +1 -0
  268. package/dist/providers/nonce-retention.d.ts +8 -0
  269. package/dist/providers/nonce-retention.js +15 -0
  270. package/dist/providers/nonce-retention.js.map +1 -0
  271. package/dist/providers/runtime-fetch.d.ts +0 -1
  272. package/dist/providers/system-clock.d.ts +0 -1
  273. package/dist/providers/web-crypto.d.ts +0 -1
  274. package/dist/providers/web-crypto.js +7 -1
  275. package/dist/providers/web-crypto.js.map +1 -1
  276. package/dist/session/index.d.ts +0 -1
  277. package/dist/session/manager.d.ts +13 -1
  278. package/dist/session/manager.js +25 -9
  279. package/dist/session/manager.js.map +1 -1
  280. package/dist/session/session-store.d.ts +0 -1
  281. package/dist/types/protocol.d.ts +11 -3
  282. package/dist/types/protocol.js +21 -14
  283. package/dist/types/protocol.js.map +1 -1
  284. package/dist/utils/base58.d.ts +16 -3
  285. package/dist/utils/base58.js +34 -12
  286. package/dist/utils/base58.js.map +1 -1
  287. package/dist/utils/base64.d.ts +0 -1
  288. package/dist/utils/canonical-json.d.ts +7 -1
  289. package/dist/utils/canonical-json.js +130 -60
  290. package/dist/utils/canonical-json.js.map +1 -1
  291. package/dist/utils/crypto-service.d.ts +0 -1
  292. package/dist/utils/crypto-service.js +22 -2
  293. package/dist/utils/crypto-service.js.map +1 -1
  294. package/dist/utils/did-helpers.d.ts +0 -1
  295. package/dist/utils/ed25519-constants.d.ts +0 -1
  296. package/dist/utils/ed25519-public-key.d.ts +27 -0
  297. package/dist/utils/ed25519-public-key.js +86 -0
  298. package/dist/utils/ed25519-public-key.js.map +1 -0
  299. package/dist/utils/guards.d.ts +0 -1
  300. package/dist/utils/index.d.ts +0 -1
  301. package/dist/utils/ip-classifier.d.ts +0 -1
  302. package/dist/utils/safe-fetch-transports.d.ts +0 -1
  303. package/dist/utils/safe-fetch-types.d.ts +0 -1
  304. package/dist/utils/safe-fetch.d.ts +0 -1
  305. package/dist/utils/statuslist-bits.d.ts +0 -1
  306. package/dist/utils/statuslist-purpose.d.ts +0 -1
  307. package/dist/utils/ttl-cache.d.ts +0 -1
  308. package/dist/utils/url.d.ts +0 -1
  309. package/package.json +9 -6
  310. package/schemas/card-delegation-credential.json +4 -1
  311. package/dist/audit/adapters/legacy-audit-log.d.ts.map +0 -1
  312. package/dist/audit/adapters/mcp.d.ts.map +0 -1
  313. package/dist/audit/assurance.d.ts.map +0 -1
  314. package/dist/audit/checkpoint-coordinator.d.ts.map +0 -1
  315. package/dist/audit/checkpoint.d.ts.map +0 -1
  316. package/dist/audit/cli.d.ts.map +0 -1
  317. package/dist/audit/crypto.d.ts.map +0 -1
  318. package/dist/audit/errors.d.ts.map +0 -1
  319. package/dist/audit/evidence.d.ts.map +0 -1
  320. package/dist/audit/index.d.ts.map +0 -1
  321. package/dist/audit/integrity.d.ts.map +0 -1
  322. package/dist/audit/merkle.d.ts.map +0 -1
  323. package/dist/audit/mirror-service.d.ts.map +0 -1
  324. package/dist/audit/projection.d.ts.map +0 -1
  325. package/dist/audit/providers/anchor.d.ts.map +0 -1
  326. package/dist/audit/providers/evidence.d.ts.map +0 -1
  327. package/dist/audit/providers/journal.d.ts.map +0 -1
  328. package/dist/audit/providers/memory-journal.d.ts.map +0 -1
  329. package/dist/audit/providers/observer.d.ts.map +0 -1
  330. package/dist/audit/providers/outbox.d.ts.map +0 -1
  331. package/dist/audit/providers/recorder-client.d.ts.map +0 -1
  332. package/dist/audit/providers/source-state.d.ts.map +0 -1
  333. package/dist/audit/read-contract.d.ts.map +0 -1
  334. package/dist/audit/read-service.d.ts.map +0 -1
  335. package/dist/audit/recorder-service.d.ts.map +0 -1
  336. package/dist/audit/reference-recorder.d.ts.map +0 -1
  337. package/dist/audit/replay-bundle.d.ts.map +0 -1
  338. package/dist/audit/schemas.d.ts.map +0 -1
  339. package/dist/audit/service.d.ts.map +0 -1
  340. package/dist/audit/testing/index.d.ts.map +0 -1
  341. package/dist/audit/testing/provider-contracts.d.ts.map +0 -1
  342. package/dist/audit/types.d.ts.map +0 -1
  343. package/dist/audit/verifier.d.ts.map +0 -1
  344. package/dist/auth/handshake.d.ts.map +0 -1
  345. package/dist/auth/index.d.ts.map +0 -1
  346. package/dist/auth/types.d.ts.map +0 -1
  347. package/dist/authz/accountability.d.ts.map +0 -1
  348. package/dist/authz/adapter.d.ts.map +0 -1
  349. package/dist/authz/examples/inmemory-oidc.d.ts.map +0 -1
  350. package/dist/authz/index.d.ts.map +0 -1
  351. package/dist/authz/oidc/authorize.d.ts.map +0 -1
  352. package/dist/authz/oidc/metadata.d.ts.map +0 -1
  353. package/dist/authz/oidc/oidc-adapter.d.ts.map +0 -1
  354. package/dist/authz/oidc/pending-flow-store.d.ts.map +0 -1
  355. package/dist/authz/oidc/pkce.d.ts.map +0 -1
  356. package/dist/authz/registry.d.ts.map +0 -1
  357. package/dist/authz/requirement.d.ts.map +0 -1
  358. package/dist/card/build.d.ts.map +0 -1
  359. package/dist/card/builder.d.ts.map +0 -1
  360. package/dist/card/cimd.d.ts.map +0 -1
  361. package/dist/card/delegation.d.ts.map +0 -1
  362. package/dist/card/emit.d.ts.map +0 -1
  363. package/dist/card/index.d.ts.map +0 -1
  364. package/dist/card/middleware.d.ts.map +0 -1
  365. package/dist/card/proof/build.d.ts.map +0 -1
  366. package/dist/card/proof/canonical.d.ts.map +0 -1
  367. package/dist/card/proof/http-sig.d.ts.map +0 -1
  368. package/dist/card/proof/index.d.ts.map +0 -1
  369. package/dist/card/proof/nonce-cache.d.ts.map +0 -1
  370. package/dist/card/proof/signer.d.ts.map +0 -1
  371. package/dist/card/proof/types.d.ts.map +0 -1
  372. package/dist/card/proof/verify.d.ts.map +0 -1
  373. package/dist/card/resolve.d.ts.map +0 -1
  374. package/dist/card/revocation.d.ts.map +0 -1
  375. package/dist/card/schema.d.ts.map +0 -1
  376. package/dist/card/verify.d.ts.map +0 -1
  377. package/dist/delegation/audience-validator.d.ts.map +0 -1
  378. package/dist/delegation/bitstring.d.ts.map +0 -1
  379. package/dist/delegation/cascading-revocation.d.ts.map +0 -1
  380. package/dist/delegation/chain-enforcement.d.ts.map +0 -1
  381. package/dist/delegation/delegation-graph.d.ts.map +0 -1
  382. package/dist/delegation/did-key-resolver.d.ts.map +0 -1
  383. package/dist/delegation/did-linkage.d.ts.map +0 -1
  384. package/dist/delegation/did-resolver-registry.d.ts.map +0 -1
  385. package/dist/delegation/did-web-resolver.d.ts.map +0 -1
  386. package/dist/delegation/holder-binding.d.ts.map +0 -1
  387. package/dist/delegation/index.d.ts.map +0 -1
  388. package/dist/delegation/outbound-headers.d.ts.map +0 -1
  389. package/dist/delegation/outbound-proof.d.ts.map +0 -1
  390. package/dist/delegation/scope-matcher.d.ts.map +0 -1
  391. package/dist/delegation/status-cache.d.ts.map +0 -1
  392. package/dist/delegation/statuslist-manager.d.ts.map +0 -1
  393. package/dist/delegation/storage/memory-graph-storage.d.ts.map +0 -1
  394. package/dist/delegation/storage/memory-statuslist-storage.d.ts.map +0 -1
  395. package/dist/delegation/utils.d.ts.map +0 -1
  396. package/dist/delegation/vc-issuer.d.ts.map +0 -1
  397. package/dist/delegation/vc-jwt-verify.d.ts.map +0 -1
  398. package/dist/delegation/vc-verification-checks.d.ts.map +0 -1
  399. package/dist/delegation/vc-verifier.d.ts.map +0 -1
  400. package/dist/delegation/vc-verifier.types.d.ts.map +0 -1
  401. package/dist/delegation/verification-method-key.d.ts.map +0 -1
  402. package/dist/errors.d.ts.map +0 -1
  403. package/dist/extension/declaration.d.ts.map +0 -1
  404. package/dist/extension/gate.d.ts.map +0 -1
  405. package/dist/extension/index.d.ts.map +0 -1
  406. package/dist/extension/settings.d.ts.map +0 -1
  407. package/dist/index.d.ts.map +0 -1
  408. package/dist/integrations/cheqd/dlr.d.ts.map +0 -1
  409. package/dist/integrations/cheqd/index.d.ts.map +0 -1
  410. package/dist/integrations/cheqd/linkage.d.ts.map +0 -1
  411. package/dist/integrations/cheqd/registrar.d.ts.map +0 -1
  412. package/dist/integrations/cheqd/resolver.d.ts.map +0 -1
  413. package/dist/integrations/cheqd/statuslist-resolver.d.ts.map +0 -1
  414. package/dist/logging/index.d.ts.map +0 -1
  415. package/dist/logging/logger.d.ts.map +0 -1
  416. package/dist/middleware/index.d.ts.map +0 -1
  417. package/dist/middleware/kya-os-transport.d.ts.map +0 -1
  418. package/dist/middleware/with-kya-os-server.d.ts.map +0 -1
  419. package/dist/middleware/with-kya-os.config-types.d.ts.map +0 -1
  420. package/dist/middleware/with-kya-os.d.ts.map +0 -1
  421. package/dist/middleware/with-kya-os.delegation-gate.d.ts.map +0 -1
  422. package/dist/middleware/with-kya-os.delegation-verify.d.ts.map +0 -1
  423. package/dist/middleware/with-kya-os.deps.d.ts.map +0 -1
  424. package/dist/middleware/with-kya-os.grants.d.ts.map +0 -1
  425. package/dist/middleware/with-kya-os.helpers.d.ts.map +0 -1
  426. package/dist/middleware/with-kya-os.policy-gate.d.ts.map +0 -1
  427. package/dist/middleware/with-kya-os.protocol.d.ts.map +0 -1
  428. package/dist/middleware/with-kya-os.session.d.ts.map +0 -1
  429. package/dist/middleware/with-kya-os.types.d.ts.map +0 -1
  430. package/dist/policy/approval.d.ts.map +0 -1
  431. package/dist/policy/classifier.d.ts.map +0 -1
  432. package/dist/policy/default-engine.d.ts.map +0 -1
  433. package/dist/policy/engine.d.ts.map +0 -1
  434. package/dist/policy/index.d.ts.map +0 -1
  435. package/dist/policy/projection.d.ts.map +0 -1
  436. package/dist/policy/types.d.ts.map +0 -1
  437. package/dist/proof/errors.d.ts.map +0 -1
  438. package/dist/proof/generator.d.ts.map +0 -1
  439. package/dist/proof/index.d.ts.map +0 -1
  440. package/dist/proof/verifier.d.ts.map +0 -1
  441. package/dist/providers/audit-log.d.ts.map +0 -1
  442. package/dist/providers/base.d.ts.map +0 -1
  443. package/dist/providers/grant-store.d.ts.map +0 -1
  444. package/dist/providers/index.d.ts.map +0 -1
  445. package/dist/providers/memory.d.ts.map +0 -1
  446. package/dist/providers/node-crypto.d.ts.map +0 -1
  447. package/dist/providers/runtime-fetch.d.ts.map +0 -1
  448. package/dist/providers/system-clock.d.ts.map +0 -1
  449. package/dist/providers/web-crypto.d.ts.map +0 -1
  450. package/dist/session/index.d.ts.map +0 -1
  451. package/dist/session/manager.d.ts.map +0 -1
  452. package/dist/session/session-store.d.ts.map +0 -1
  453. package/dist/types/protocol.d.ts.map +0 -1
  454. package/dist/utils/base58.d.ts.map +0 -1
  455. package/dist/utils/base64.d.ts.map +0 -1
  456. package/dist/utils/canonical-json.d.ts.map +0 -1
  457. package/dist/utils/crypto-service.d.ts.map +0 -1
  458. package/dist/utils/did-helpers.d.ts.map +0 -1
  459. package/dist/utils/ed25519-constants.d.ts.map +0 -1
  460. package/dist/utils/guards.d.ts.map +0 -1
  461. package/dist/utils/index.d.ts.map +0 -1
  462. package/dist/utils/ip-classifier.d.ts.map +0 -1
  463. package/dist/utils/safe-fetch-transports.d.ts.map +0 -1
  464. package/dist/utils/safe-fetch-types.d.ts.map +0 -1
  465. package/dist/utils/safe-fetch.d.ts.map +0 -1
  466. package/dist/utils/statuslist-bits.d.ts.map +0 -1
  467. package/dist/utils/statuslist-purpose.d.ts.map +0 -1
  468. package/dist/utils/ttl-cache.d.ts.map +0 -1
  469. package/dist/utils/url.d.ts.map +0 -1
package/AUDITABILITY.md CHANGED
@@ -174,6 +174,16 @@ production adapter must provide:
174
174
  - no ordinary update or delete operation;
175
175
  - truthful durability and atomicity capabilities.
176
176
 
177
+ A head read is only a hint. When one is behind the highest head this recorder
178
+ has appended (a lagging read replica), the recorder compares-and-appends against
179
+ its own committed head instead, so a stale read costs a retry, as it always has.
180
+ If the journal's compare-and-append answer then reports a head below that
181
+ committed head, or a different digest at a sequence the journal already
182
+ reported (a failover to a lagging primary, or a restore), the recorder fails
183
+ closed with `AUDIT_JOURNAL_FAILURE` instead of signing a second entry at a
184
+ receipted sequence. Restoring a journal is an epoch transition, not a silent
185
+ rewind.
186
+
177
187
  Run the provider contract kit for every adapter:
178
188
 
179
189
  ```ts
@@ -215,12 +225,19 @@ a caller that retries `record()` with a stable event ID must also pin
215
225
  `occurredAt`, otherwise the recorder rejects the drifted content as an
216
226
  event-identity conflict. Buffered outbox redelivery is always byte-stable, and
217
227
  `flush()` receipts each delivered item against the item's own producer source.
228
+ An event without a caller-supplied ID gets a random `audit_<uuid>` ID, so two
229
+ trails sharing an outbox or a recorder never mint the same one.
218
230
 
219
231
  Evidence is persisted write-ahead of its committing entry. If the append then
220
- permanently fails, the recorder best-effort disposes the orphaned ciphertext
221
- after re-confirming that no committed entry claims the event identity; a
222
- disposal failure retains the orphan for operator retention tooling rather than
223
- risking a racing committed reference.
232
+ permanently fails, the recorder best-effort disposes the ciphertext that this
233
+ submission newly stored, after re-confirming that no committed entry claims the
234
+ event identity. An object that already existed, such as an encrypted actor
235
+ reference shared by every event of a session, is never disposed, because a
236
+ committed entry may reference it. Nor is one that another submission to the
237
+ same recorder held while this one did: both may have seen it as new, and the
238
+ other may have committed a reference to it. A disposal failure retains the
239
+ orphan for operator retention tooling rather than risking a racing committed
240
+ reference.
224
241
 
225
242
  The outbox contract persists an `attempts` count and yields only delivery-eligible
226
243
  items. Retry cadence, attempt caps, and dead-letter routing are provider policy,
@@ -229,12 +246,39 @@ adapter must remove dead-lettered items from `pending()` while retaining them fo
229
246
  operator inspection and recovery; the in-memory development adapter intentionally
230
247
  has no retry cap.
231
248
 
249
+ Event IDs are unique only within a producer source. An outbox that declares
250
+ `capabilities.keyedBySource` deduplicates, acknowledges, and fails items by
251
+ `(sourceId, eventId)` (`AuditOutboxItemKey`, see `auditOutboxItemKey`), and the
252
+ trail passes it that key. An adapter without the capability keeps receiving the
253
+ bare event ID its `markDelivered(eventId: string)` signature expects; the
254
+ interface accepts either. `MemoryAuditOutbox` declares the capability, except
255
+ in a subclass that overrides `markDelivered` or `markFailed`: such a subclass
256
+ may have been written for the bare event ID, so it keeps receiving one unless
257
+ it declares the capability itself. It still accepts a bare event ID from direct
258
+ callers, but only while exactly one pending item carries it: with several
259
+ sources pending, it throws rather than guess whose item to acknowledge. Once
260
+ the recorder has committed an item, `flush()` counts
261
+ it as delivered: a failure to acknowledge it reaches `onAcknowledgementFailure`,
262
+ never `markFailed` or `onDeliveryFailure`, and the item's later redelivery
263
+ resolves to the same receipt.
264
+
232
265
  Each producer event receives an atomically claimed source sequence. Consecutive
233
266
  events also carry `previousSourceEventDigest`. `recordSourceHighWater()` emits
234
267
  the producer's current high-water mark through the same recorder path. The
235
268
  source-state provider tracks highest emitted, highest contiguously receipted,
236
269
  and explicit pending gaps. AAP-3 requires durable source state.
237
270
 
271
+ The trail validates an event (schema, canonical JSON, evidence references)
272
+ before it claims a source sequence, so rejected input never consumes a sequence
273
+ or breaks predecessor linkage; a claim whose event then fails to build is
274
+ released through the optional `abandonClaim` where the provider supports it.
275
+ Re-claiming an event ID the provider still retains returns the original claim,
276
+ so an at-least-once redelivery of a stable event ID rebuilds the identical
277
+ event and resolves to its original receipt. `MemoryAuditSourceState` retains
278
+ receipted claims for a bounded redelivery window (`redeliveryWindow`, default
279
+ 1024 per source) and otherwise keeps only pending events, so one unreceipted
280
+ gap does not stop it from releasing memory.
281
+
238
282
  ## Event and privacy model
239
283
 
240
284
  The event catalog is the `AUDIT_EVENT_TYPES` constant. It covers session, tool,
@@ -244,8 +288,17 @@ Every detail payload is a strict discriminated union. Arbitrary integrity-core
244
288
  metadata and unknown fields fail closed.
245
289
 
246
290
  The MCP adapter excludes raw arguments, response bodies, error text, and tool
247
- names by default. `includeToolNames` is an explicit policy decision. Identity
248
- and resource references declare their privacy form:
291
+ names by default. `includeToolNames` is an explicit policy decision. References
292
+ a caller presents (delegation, grant, consent, scope, and policy references,
293
+ correlation and causation IDs, tool names) are untrusted: one that is empty,
294
+ over the schema bound, or not well-formed UTF-16 is recorded as the `sha256:`
295
+ digest of its UTF-8 encoding, so a hostile identifier cannot keep the event out
296
+ of the ledger, and a long reference handed to the adapter cannot collide with
297
+ another that shares its prefix. One caller still shortens a reference first:
298
+ `wrapWithDelegation` truncates the ID of a rejected delegation credential to
299
+ 256 UTF-16 code units, so two rejected credentials whose IDs share that prefix
300
+ are recorded with the same `delegationRef`.
301
+ Identity and resource references declare their privacy form:
249
302
 
250
303
  - `public_did` for intentionally public correlation;
251
304
  - `pairwise_did` for relationship-specific identity;
@@ -288,6 +341,16 @@ consistency proofs. Checkpoint lifecycle events are appended only after the
288
341
  snapshot is signed, so they can appear in a later checkpoint and cannot recurse
289
342
  into the checkpoint they describe.
290
343
 
344
+ Before signing, the builder confirms that the journal still contains the latest
345
+ checkpoint's exact tree as its prefix; a rewritten or restored history fails
346
+ with `AUDIT_CHECKPOINT_CONFLICT` instead of producing a signed checkpoint that
347
+ chains to a tree it does not extend. A builder serializes its calls per ledger
348
+ epoch, so concurrent calls chain in tree-size order rather than both naming the
349
+ same predecessor. If `onCheckpointCreated` throws after the checkpoint was
350
+ stored, the builder's next `createCheckpoint` call runs the hook again for that
351
+ checkpoint, before any newer one, even when the ledger has grown in between;
352
+ the hook must therefore be idempotent on the checkpoint digest.
353
+
291
354
  `AuditCheckpointCoordinator` publishes a committed checkpoint to independent
292
355
  observers and supporting anchors. Publication is retryable and may enforce a
293
356
  minimum observer count and required anchor kinds. Failure does not roll back the
@@ -326,6 +389,59 @@ nonce caches. It verifies:
326
389
  - supporting-anchor trust and an injected adapter verifier;
327
390
  - declared range completeness and explicit omission dispositions.
328
391
 
392
+ A subset export need not carry every leaf. A checkpoint whose complete prefix is
393
+ present has its root recomputed; otherwise its signature, digest, issuer trust,
394
+ and declared range are verified (`AuditArtifactVerifier.verifySignedCheckpoint`),
395
+ and every included entry it covers must carry a verified inclusion proof against
396
+ it (`AUDIT_MERKLE_PROOF_MISSING` otherwise). Two included checkpoints of one
397
+ epoch must either link directly through `previousCheckpointDigest`, or, when the
398
+ export omits checkpoints that could sit between them, be bound by a verified
399
+ consistency proof; the proof, not the chain link, is the split-view guarantee,
400
+ as for an observer catching up. A successor genesis commits where its
401
+ predecessor epoch ends, so a predecessor checkpoint over a larger tree than
402
+ that terminal checkpoint is reported as `AUDIT_CHECKPOINT_FORK_DETECTED`.
403
+ Predecessor entries past the terminal are not by themselves a fork: the
404
+ terminal checkpoint's own `checkpoint.created` event is appended after it is
405
+ signed.
406
+
407
+ The verifier enforces every verification-policy constraint it can evaluate and
408
+ never treats one it cannot evaluate as satisfied. No schema-valid policy is
409
+ rejected for the constraints it uses:
410
+
411
+ - `validFromCheckpoint` and `validUntilCheckpoint`, on a recorder or observer key
412
+ or on a trusted ledger epoch, are resolved by digest against supplied
413
+ checkpoints (`AuditVerificationContext`; a bundle supplies its own). An entry
414
+ at sequence `s` sits at tree position `s + 1`, a checkpoint or an observation
415
+ of one at its tree size; a key valid until checkpoint `C` covers positions up
416
+ to `C`'s tree size, and a key valid from `C` covers positions after it.
417
+ Outside the bound the signer is untrusted. A boundary that is absent, or that
418
+ belongs to another ledger epoch, makes the dimension `indeterminate`
419
+ (`AUDIT_KEY_BOUNDARY_UNRESOLVED`), never `valid`. An export has no ledger
420
+ position, so a checkpoint bound on the exporter key that authorizes a bundle
421
+ leaves cryptographic integrity `indeterminate` the same way.
422
+ - `requiredAuditProfile` marks every dimension the profile depends on
423
+ `invalid` (`AUDIT_REQUIRED_PROFILE_UNMET`) unless it is `valid`: AAP-1 needs
424
+ cryptographic integrity, AAP-2 adds chain integrity, AAP-3 checkpoint
425
+ integrity, and AAP-4 observation integrity plus at least one supporting
426
+ anchor receipt.
427
+ - `keyRevocationMode` selects when key status is evaluated. The integrity
428
+ dimensions always evaluate a key as observed, at the artifact's signing time
429
+ and ledger position, because revocation does not rewrite what was observed;
430
+ `as_observed` stops there. `current` and `both` also require every key that
431
+ signed an entry, checkpoint, observation, or the bundle manifest to be valid
432
+ at `verifiedAt` (within `validFrom`/`validUntil`, and without a
433
+ `validUntilCheckpoint`, which names a checkpoint the key was retired at), and
434
+ report the result in `currentAuthorization`: `invalid`
435
+ (`AUDIT_KEY_NOT_CURRENT`) when a key is no longer valid, `indeterminate`
436
+ (`AUDIT_NOT_EVALUATED`) when the verifier has no `verifiedAt` clock. As the
437
+ as-observed check is never waived, `current` and `both` evaluate the same
438
+ keys. Current key status alone never makes `currentAuthorization` `valid`;
439
+ that still takes the injected authorization verifier.
440
+
441
+ When a policy requires observation freshness, an observation dated more than
442
+ the verifier's clock-skew allowance (`maxClockSkewMs`, default 120 s) after
443
+ `verifiedAt` is `invalid` (`AUDIT_OBSERVATION_FUTURE_DATED`), not fresh.
444
+
329
445
  The report keeps these dimensions separate: cryptographic integrity, chain
330
446
  integrity, checkpoint integrity, anchor/observation integrity, committed-scope
331
447
  completeness, authorization as observed, and current authorization. Missing
@@ -354,8 +470,13 @@ by the relying party's policy.
354
470
  `AuditProjectionWorker` derives a minimal timeline projection with an atomic
355
471
  offset. It supports incremental synchronization, deterministic reset/rebuild,
356
472
  and head reconciliation with four honest states: `empty`, `pending`,
357
- `verified`, and `gap_detected`. The projection is disposable. The journal plus
358
- declared enrichment inputs remain the source of truth.
473
+ `verified`, and `gap_detected`. A projection behind the journal is `pending`
474
+ only when its offset digest matches the journal entry at that sequence, and
475
+ synchronization refuses (`AUDIT_PROJECTION_CONFLICT`) to apply an entry whose
476
+ predecessor is not the projection offset; a projection built from a forked
477
+ history is never reported verified and must be rebuilt. The projection is
478
+ disposable. The journal plus declared enrichment inputs remain the source of
479
+ truth.
359
480
 
360
481
  Checkpoint should ingest exact signed envelopes through the mirror or recorder
361
482
  path, store raw integrity objects separately from query projections, and expose