@conarium-ai/core 0.2.21 → 0.2.23

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 (60) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/LIMITATIONS.md +38 -0
  3. package/LIMITATIONS.tr.md +16 -0
  4. package/README.md +32 -2
  5. package/SECURITY.md +1 -1
  6. package/bin/conarium-docker-entry.mjs +62 -0
  7. package/bin/conarium-doctor.mjs +13 -0
  8. package/bin/conarium-reconcile.mjs +69 -5
  9. package/bin/conarium-verify.mjs +42 -7
  10. package/dist/audit.d.ts +7 -0
  11. package/dist/audit.d.ts.map +1 -1
  12. package/dist/audit.js +6 -2
  13. package/dist/audit.js.map +1 -1
  14. package/dist/config.d.ts +10 -0
  15. package/dist/config.d.ts.map +1 -1
  16. package/dist/config.js +2 -0
  17. package/dist/config.js.map +1 -1
  18. package/dist/console.d.ts.map +1 -1
  19. package/dist/console.js +3 -2
  20. package/dist/console.js.map +1 -1
  21. package/dist/executor.d.ts.map +1 -1
  22. package/dist/executor.js +2 -1
  23. package/dist/executor.js.map +1 -1
  24. package/dist/governance.d.ts.map +1 -1
  25. package/dist/governance.js +17 -15
  26. package/dist/governance.js.map +1 -1
  27. package/dist/receipt-view.d.ts +5 -0
  28. package/dist/receipt-view.d.ts.map +1 -1
  29. package/dist/receipt-view.js +21 -0
  30. package/dist/receipt-view.js.map +1 -1
  31. package/dist/receipt.d.ts +49 -3
  32. package/dist/receipt.d.ts.map +1 -1
  33. package/dist/receipt.js +46 -3
  34. package/dist/receipt.js.map +1 -1
  35. package/dist/safe-object.d.ts +14 -0
  36. package/dist/safe-object.d.ts.map +1 -0
  37. package/dist/safe-object.js +26 -0
  38. package/dist/safe-object.js.map +1 -0
  39. package/dist/server.d.ts.map +1 -1
  40. package/dist/server.js +12 -2
  41. package/dist/server.js.map +1 -1
  42. package/dist/tckn.d.ts +0 -11
  43. package/dist/tckn.d.ts.map +1 -1
  44. package/dist/tckn.js +5 -4
  45. package/dist/tckn.js.map +1 -1
  46. package/dist/types.d.ts +2 -0
  47. package/dist/types.d.ts.map +1 -1
  48. package/docs/API-STABILITY.md +7 -6
  49. package/docs/RECEIPT-SPEC.md +105 -17
  50. package/docs/dogfood/2026-08-06-reconcile.md +8 -0
  51. package/package.json +1 -1
  52. package/scripts/gen-test-vectors-04.mjs +115 -0
  53. package/scripts/gen-test-vectors.mjs +8 -0
  54. package/test-vectors/010-disclosure-commitment/receipts.jsonl +1 -0
  55. package/test-vectors/011-destination-declared/receipts.jsonl +1 -0
  56. package/test-vectors/012-mixed-chain/receipts.jsonl +2 -0
  57. package/test-vectors/013-disclosure-keys-omitted/receipts.jsonl +1 -0
  58. package/test-vectors/README.md +10 -5
  59. package/test-vectors/expected-hashes.json +24 -0
  60. package/test-vectors/manifest.json +37 -1
@@ -11,6 +11,10 @@
11
11
  * so a second implementation can reproduce byte-identical output.
12
12
  *
13
13
  * Usage: npm run build && node scripts/gen-test-vectors.mjs
14
+ *
15
+ * 001–009 are frozen. If they already exist, this script refuses to run —
16
+ * regenerating them would rewrite published 0.3 receipts. New 0.4 cases
17
+ * are produced by scripts/gen-test-vectors-04.mjs.
14
18
  */
15
19
  import { mkdirSync, writeFileSync, existsSync, readFileSync } from 'fs'
16
20
  import { join } from 'path'
@@ -19,6 +23,10 @@ import { generateKeyPair } from '../dist/keys.js'
19
23
  import { buildReceipt, RECEIPT_GENESIS_HASH } from '../dist/receipt.js'
20
24
 
21
25
  const ROOT = 'test-vectors'
26
+ if (existsSync(join(ROOT, '001-single-receipt', 'receipts.jsonl'))) {
27
+ console.error('001–009 are frozen. Refusing to regenerate. For 0.4 cases: node scripts/gen-test-vectors-04.mjs')
28
+ process.exit(2)
29
+ }
22
30
  const KEY_DIR = join(ROOT, 'keys')
23
31
  const KEY_ID = 'cnr-vectors'
24
32
  const PRIV = join(KEY_DIR, 'vector-key.SECRET-TEST-ONLY.pem')
@@ -0,0 +1 @@
1
+ {"v":"conarium-receipt/0.4","id":"01JVECTOR00000000000000010","ts":"2026-08-16T00:00:010.000Z","period":{"start":"2026-08-16T00:00:010.000Z","end":"2026-08-16T00:00:010.500Z"},"actor":{"type":"service","id":"vector-service","assurance":"shared-token"},"model":{"source":"undeclared","provider":null,"name":null,"version":null},"client":{"source":"undeclared","name":null,"version":null},"destination":{"value":null,"source":"undeclared"},"request":{"tool":"query","target":"demo-db","argsHash":"sha256:abababababababababababababababababababababababababababababababab"},"dataRefs":[{"source":"vectors","object":"public.demo","fieldsRequested":["id"]}],"policy":{"id":"conarium.policy/vectors","version":"1","decision":"allow","rulesApplied":["mask:name"]},"flags":[],"masking":{"maskedCount":0,"byClass":{},"rowsReturned":1,"rowCapApplied":false},"disclosure":{"hash":"sha256:813b89d0684be97d866ae2c6f0e9902a25833c4f8921b694ccec17bf63d64d00","bytes":134,"source":"measured"},"outcome":{"status":"complete","denied":false},"consentRef":null,"chain":{"seq":1,"prevHash":"sha256:0000000000000000000000000000000000000000000000000000000000000000","hash":"sha256:a3dd969eea7eda0ae728cc994527e3f19f512d10ae655f85c58e8d5a31e25a88"},"sig":{"alg":"Ed25519","keyId":"cnr-vectors","value":"yPnXtg/LMV9J/NzJ4AIdEAFfBms6alKxhZmyRti0IOCeslP679QlMo1WlSpQ9U9zVw3FN0IOhbE9OA/BAClRAA=="},"anchor":null}
@@ -0,0 +1 @@
1
+ {"v":"conarium-receipt/0.4","id":"01JVECTOR00000000000000011","ts":"2026-08-16T00:00:011.000Z","period":{"start":"2026-08-16T00:00:011.000Z","end":"2026-08-16T00:00:011.500Z"},"actor":{"type":"service","id":"vector-service","assurance":"shared-token"},"model":{"source":"undeclared","provider":null,"name":null,"version":null},"client":{"source":"undeclared","name":null,"version":null},"destination":{"value":"openai/gpt-x","source":"operator-declared"},"request":{"tool":"query","target":"demo-db","argsHash":"sha256:abababababababababababababababababababababababababababababababab"},"dataRefs":[{"source":"vectors","object":"public.demo","fieldsRequested":["id"]}],"policy":{"id":"conarium.policy/vectors","version":"1","decision":"allow","rulesApplied":["mask:name"]},"flags":[],"masking":{"maskedCount":0,"byClass":{},"rowsReturned":1,"rowCapApplied":false},"disclosure":{"hash":null,"bytes":null,"source":"undeclared"},"outcome":{"status":"complete","denied":false},"consentRef":null,"chain":{"seq":1,"prevHash":"sha256:0000000000000000000000000000000000000000000000000000000000000000","hash":"sha256:7cdbfd0e131c1f5615c305f7908c136b19e25b7fbd96c7d48f0928f1df4c076e"},"sig":{"alg":"Ed25519","keyId":"cnr-vectors","value":"FTpejMZCVHJVLLjxYr9CcAfv3+ozS7Mn+d59Xdc6To9cgGSKi13iGDk1JudvyJWgzR/2ElfzRuWNd5I3djPwCg=="},"anchor":null}
@@ -0,0 +1,2 @@
1
+ {"v":"conarium-receipt/0.3","id":"01JVECTOR00000000000000001","ts":"2026-01-01T00:00:00.000Z","period":{"start":"2026-01-01T00:00:00.000Z","end":"2026-01-01T00:00:01.000Z"},"actor":{"type":"service","id":"vector-service","assurance":"shared-token"},"model":{"source":"undeclared","provider":null,"name":null,"version":null},"client":{"source":"undeclared","name":null,"version":null},"request":{"tool":"query","argsHash":"sha256:abababababababababababababababababababababababababababababababab"},"dataRefs":[{"source":"vectors","object":"public.demo","fields":["id","name"]}],"policy":{"id":"conarium.policy/vectors","decision":"allow","rules":["mask:name"]},"flags":[],"masking":{"pii":1},"outcome":{"status":"complete","rows":2},"consentRef":null,"chain":{"seq":1,"prevHash":"sha256:0000000000000000000000000000000000000000000000000000000000000000","hash":"sha256:dbbbd3139923cdf7f854283b495386526de0629a71dc4d5407a3a810ee3e1847"},"sig":{"alg":"Ed25519","keyId":"cnr-vectors","value":"TVapCMZcuMJpg5IwxVmzU5MCH3c9qDZOTdyeW+HqCQ42tNzkEq1pnlVheI6KQoAZ+2BLYik69iEnFyXYydA9AQ=="},"anchor":null}
2
+ {"v":"conarium-receipt/0.4","id":"01JVECTOR00000000000000012","ts":"2026-08-16T00:00:012.000Z","period":{"start":"2026-08-16T00:00:012.000Z","end":"2026-08-16T00:00:012.500Z"},"actor":{"type":"service","id":"vector-service","assurance":"shared-token"},"model":{"source":"undeclared","provider":null,"name":null,"version":null},"client":{"source":"undeclared","name":null,"version":null},"destination":{"value":"openai/gpt-x","source":"operator-declared"},"request":{"tool":"query","target":"demo-db","argsHash":"sha256:abababababababababababababababababababababababababababababababab"},"dataRefs":[{"source":"vectors","object":"public.demo","fieldsRequested":["id"]}],"policy":{"id":"conarium.policy/vectors","version":"1","decision":"allow","rulesApplied":["mask:name"]},"flags":[],"masking":{"maskedCount":0,"byClass":{},"rowsReturned":1,"rowCapApplied":false},"disclosure":{"hash":"sha256:813b89d0684be97d866ae2c6f0e9902a25833c4f8921b694ccec17bf63d64d00","bytes":134,"source":"measured"},"outcome":{"status":"complete","denied":false},"consentRef":null,"chain":{"seq":2,"prevHash":"sha256:dbbbd3139923cdf7f854283b495386526de0629a71dc4d5407a3a810ee3e1847","hash":"sha256:d34aba9928377dc233a90d8cb10c566ad0d35d0a05ef9e396a066e1b689426ee"},"sig":{"alg":"Ed25519","keyId":"cnr-vectors","value":"fTIx4hUO0yCCGn+JgRw1ADWIYUZK3d9o3ZrbyCG/gX/NuFsOTR1/mBZQPWYq0ZVq/70794p+1P2SBbfMZxrBAA=="},"anchor":null}
@@ -0,0 +1 @@
1
+ {"v":"conarium-receipt/0.4","id":"01JVECTOR00000000000000013","ts":"2026-08-16T00:00:013.000Z","period":{"start":"2026-08-16T00:00:013.000Z","end":"2026-08-16T00:00:013.500Z"},"actor":{"type":"service","id":"vector-service","assurance":"shared-token"},"model":{"source":"undeclared","provider":null,"name":null,"version":null},"client":{"source":"undeclared","name":null,"version":null},"destination":{"value":null,"source":"undeclared"},"request":{"tool":"query","target":"demo-db","argsHash":"sha256:abababababababababababababababababababababababababababababababab"},"dataRefs":[{"source":"vectors","object":"public.demo","fieldsRequested":["id"]}],"policy":{"id":"conarium.policy/vectors","version":"1","decision":"allow","rulesApplied":["mask:name"]},"flags":[],"masking":{"maskedCount":0,"byClass":{},"rowsReturned":1,"rowCapApplied":false},"disclosure":{"source":"undeclared"},"outcome":{"status":"complete","denied":false},"consentRef":null,"chain":{"seq":1,"prevHash":"sha256:0000000000000000000000000000000000000000000000000000000000000000","hash":"sha256:4c26d350a17659a4e1501a1c45e21dddae9833ffbc8bd8d335a6aa090fe85d49"},"sig":{"alg":"Ed25519","keyId":"cnr-vectors","value":"ZcnAeriEleiUJ2ZHnqIS819TEubdfyXaXAHhkP9fJXM/VlDhC04kkhlsIxf8eKj5QvVZAeRnXohY1d55U1oFAQ=="},"anchor":null}
@@ -1,7 +1,7 @@
1
1
  # Conarium Receipt — conformance vectors
2
2
 
3
3
  Frozen inputs and expected results for anyone implementing or checking a
4
- Conarium Receipt verifier. Nine cases, one public key, one manifest.
4
+ Conarium Receipt verifier. Thirteen cases, one public key, one manifest.
5
5
 
6
6
  A specification that cannot be implemented from the document alone is a blog
7
7
  post. These vectors are the difference.
@@ -41,6 +41,10 @@ exit code. Nothing else is required — no network, no server, no account.
41
41
  | 007-schema-invalid | `policy` removed — not a receipt at all | 20 |
42
42
  | 008-unsigned-no-pubkey | Unsigned receipt, no `--pubkey` given | 13 |
43
43
  | 009-unsigned-but-pubkey-given | Unsigned receipt, signature demanded | 13 |
44
+ | 010-disclosure-commitment | 0.4 receipt, `disclosure` measured over the payload that left | 0 |
45
+ | 011-destination-declared | 0.4 receipt, destination `operator-declared` | 0 |
46
+ | 012-mixed-chain | One 0.3 receipt then one 0.4 receipt; the chain verifies | 0 |
47
+ | 013-disclosure-keys-omitted | 0.4 receipt, `disclosure` is `undeclared` but `hash`/`bytes` are omitted, not `null` | 20 |
44
48
 
45
49
  Exit codes are the ones in [RECEIPT-SPEC.md](../docs/RECEIPT-SPEC.md); the
46
50
  drift guard in `test/spec_exitcode_drift.mjs` keeps the two in sync.
@@ -83,10 +87,11 @@ thing an interoperable receipt actually requires. Sign it with your own key.
83
87
 
84
88
  ## Regenerating — read before you do
85
89
 
86
- `scripts/gen-test-vectors.mjs` produced these files. Do not run it to make a
87
- failing test pass. If a change to this repository breaks a vector, the format
88
- changed, and that is the signal the vectors exist to raise. Change the code, or
89
- change the specification and the version string with it.
90
+ `scripts/gen-test-vectors.mjs` produced 001–009. It now refuses to run if those
91
+ files exist. `scripts/gen-test-vectors-04.mjs` appended 010–012, then 013. Do
92
+ not run either to make a failing test pass. If a change to this repository
93
+ breaks a vector, the format changed, and that is the signal the vectors exist
94
+ to raise.
90
95
 
91
96
  The frozen hash of case 001 is asserted separately in `test/vectors_run.mjs`
92
97
  for exactly this reason.
@@ -19,6 +19,30 @@
19
19
  "seq": 3,
20
20
  "prevHash": "sha256:56937472179de1567fee9f0b863c7c5d16d8d6b7a8e613e9bf50fb321f82433c",
21
21
  "hash": "sha256:a06a30c3fb4bdbd46bb9400da0815fb3a7007b703cc9cb41208be08413e254c7"
22
+ },
23
+ {
24
+ "case": "010-disclosure-commitment",
25
+ "seq": 1,
26
+ "prevHash": "sha256:0000000000000000000000000000000000000000000000000000000000000000",
27
+ "hash": "sha256:a3dd969eea7eda0ae728cc994527e3f19f512d10ae655f85c58e8d5a31e25a88"
28
+ },
29
+ {
30
+ "case": "011-destination-declared",
31
+ "seq": 1,
32
+ "prevHash": "sha256:0000000000000000000000000000000000000000000000000000000000000000",
33
+ "hash": "sha256:7cdbfd0e131c1f5615c305f7908c136b19e25b7fbd96c7d48f0928f1df4c076e"
34
+ },
35
+ {
36
+ "case": "012-mixed-chain",
37
+ "seq": 2,
38
+ "prevHash": "sha256:dbbbd3139923cdf7f854283b495386526de0629a71dc4d5407a3a810ee3e1847",
39
+ "hash": "sha256:d34aba9928377dc233a90d8cb10c566ad0d35d0a05ef9e396a066e1b689426ee"
40
+ },
41
+ {
42
+ "case": "013-disclosure-keys-omitted",
43
+ "seq": 1,
44
+ "prevHash": "sha256:0000000000000000000000000000000000000000000000000000000000000000",
45
+ "hash": "sha256:4c26d350a17659a4e1501a1c45e21dddae9833ffbc8bd8d335a6aa090fe85d49"
22
46
  }
23
47
  ]
24
48
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "format": "conarium-receipt",
3
- "versionUnderTest": "conarium-receipt/0.3",
3
+ "versionUnderTest": "conarium-receipt/0.4",
4
4
  "keyId": "cnr-vectors",
5
5
  "publicKey": "keys/vector-key.pub.pem",
6
6
  "note": "Frozen conformance vectors. Run each case through your verifier and compare the exit code. KEYS/ in args resolves to the keys/ directory at the root of test-vectors.",
@@ -90,6 +90,42 @@
90
90
  "--pubkey",
91
91
  "KEYS/vector-key.pub.pem"
92
92
  ]
93
+ },
94
+ {
95
+ "name": "010-disclosure-commitment",
96
+ "description": "0.4 receipt with a measured disclosure hash over the masked, row-capped payload. Verify exits 0.",
97
+ "exitCode": 0,
98
+ "args": [
99
+ "--pubkey",
100
+ "KEYS/vector-key.pub.pem"
101
+ ]
102
+ },
103
+ {
104
+ "name": "011-destination-declared",
105
+ "description": "0.4 receipt with destination declared by the operator. source is operator-declared, not verified.",
106
+ "exitCode": 0,
107
+ "args": [
108
+ "--pubkey",
109
+ "KEYS/vector-key.pub.pem"
110
+ ]
111
+ },
112
+ {
113
+ "name": "012-mixed-chain",
114
+ "description": "A 0.3 receipt followed by a 0.4 receipt. The chain verifies; old receipts are not rewritten.",
115
+ "exitCode": 0,
116
+ "args": [
117
+ "--pubkey",
118
+ "KEYS/vector-key.pub.pem"
119
+ ]
120
+ },
121
+ {
122
+ "name": "013-disclosure-keys-omitted",
123
+ "description": "0.4 receipt whose disclosure is undeclared but omits hash and bytes entirely. Absence is not explicit null; verify exits 20.",
124
+ "exitCode": 20,
125
+ "args": [
126
+ "--pubkey",
127
+ "KEYS/vector-key.pub.pem"
128
+ ]
93
129
  }
94
130
  ]
95
131
  }