@conarium-ai/core 0.2.29 → 0.2.31

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 (46) hide show
  1. package/LIMITATIONS.md +5 -5
  2. package/LIMITATIONS.tr.md +5 -5
  3. package/README.md +17 -4
  4. package/bin/conarium-anchor-service.mjs +22 -3
  5. package/bin/conarium-doctor.mjs +28 -18
  6. package/bin/conarium-token-sync.mjs +54 -0
  7. package/deploy/anchor-service/README.md +3 -0
  8. package/deploy/anchor-service/conarium-token-sync.service +14 -0
  9. package/deploy/anchor-service/conarium-token-sync.timer +11 -0
  10. package/dist/anchor-service.d.ts +10 -0
  11. package/dist/anchor-service.d.ts.map +1 -1
  12. package/dist/anchor-service.js +33 -6
  13. package/dist/anchor-service.js.map +1 -1
  14. package/dist/audit.d.ts.map +1 -1
  15. package/dist/audit.js +40 -5
  16. package/dist/audit.js.map +1 -1
  17. package/dist/governance.d.ts.map +1 -1
  18. package/dist/governance.js +69 -14
  19. package/dist/governance.js.map +1 -1
  20. package/dist/masking-cost.d.ts +1 -1
  21. package/dist/masking-cost.js +4 -4
  22. package/dist/masking-cost.js.map +1 -1
  23. package/dist/server.js +1 -1
  24. package/dist/server.js.map +1 -1
  25. package/docs/BENCHMARK.md +49 -35
  26. package/docs/PRICING.md +41 -0
  27. package/docs/RECEIPT-SPEC.md +8 -6
  28. package/docs/benchmarks/latest.json +1662 -1662
  29. package/docs/benchmarks/masking-cost-threshold.json +2 -2
  30. package/docs/benchmarks/masking-cpu-summary.json +25 -0
  31. package/docs/benchmarks/masking-identity-after.json +66 -0
  32. package/docs/benchmarks/masking-identity-before.json +66 -0
  33. package/docs/benchmarks/masking-profile-100.json +22 -0
  34. package/docs/benchmarks/masking-profile-500.json +22 -0
  35. package/docs/benchmarks/masking-profile-5000.json +22 -0
  36. package/docs/benchmarks/overhead-20260818T1842Z-win32-before.json +539 -0
  37. package/docs/benchmarks/overhead-20260818T1852Z-win32.json +539 -0
  38. package/docs/benchmarks/overhead-20260818T2120Z-win32-09b2100.json +2310 -0
  39. package/docs/benchmarks/overhead-20260818T2145Z-win32-46acd75.json +2310 -0
  40. package/docs/claims/reviews/0.2.30.md +38 -0
  41. package/docs/claims/reviews/0.2.31.md +76 -0
  42. package/package.json +3 -1
  43. package/scripts/profile-masking-carryover.mjs +140 -0
  44. package/scripts/profile-masking-once.mjs +79 -0
  45. package/scripts/snapshot-masking-identity.mjs +62 -0
  46. package/scripts/summarize-cpuprofile.mjs +24 -0
package/docs/BENCHMARK.md CHANGED
@@ -7,7 +7,6 @@ Headline numbers are **p50 / p95 / p99**. Mean is not reported.
7
7
  Replay:
8
8
 
9
9
  ```
10
- # temporary Postgres (WSL Docker on this machine)
11
10
  docker run -d --name conarium-bench-pg \
12
11
  -e POSTGRES_USER=conarium -e POSTGRES_PASSWORD=demo-not-a-secret \
13
12
  -e POSTGRES_DB=conarium_bench -p 54329:5432 postgres:16-alpine
@@ -18,8 +17,15 @@ CONARIUM_BENCH_DSN=postgres://conarium:demo-not-a-secret@127.0.0.1:54329/conariu
18
17
  docker rm -f conarium-bench-pg
19
18
  ```
20
19
 
21
- Raw JSON: [`benchmarks/latest.json`](benchmarks/latest.json)
22
- (this run: [`benchmarks/overhead-20260814T1346Z-linux.json`](benchmarks/overhead-20260814T1346Z-linux.json)).
20
+ Raw JSON (this run, current code `46acd75`):
21
+ [`benchmarks/overhead-20260818T2145Z-win32-46acd75.json`](benchmarks/overhead-20260818T2145Z-win32-46acd75.json)
22
+ and [`benchmarks/latest.json`](benchmarks/latest.json).
23
+
24
+ Same environment, previous tag `09b2100`:
25
+ [`benchmarks/overhead-20260818T2120Z-win32-09b2100.json`](benchmarks/overhead-20260818T2120Z-win32-09b2100.json).
26
+
27
+ Historical other-environment archive (do not quote next to these cells):
28
+ [`benchmarks/overhead-20260814T1346Z-linux.json`](benchmarks/overhead-20260814T1346Z-linux.json).
23
29
 
24
30
  No competitor numbers. n=15 cells have a thin tail (p95 = p99).
25
31
 
@@ -30,12 +36,13 @@ No competitor numbers. n=15 cells have a thin tail (p95 = p99).
30
36
  | | |
31
37
  |---|---|
32
38
  | CPU | Intel Core Ultra 9 275HX × 24 |
33
- | RAM visible | 16 GB (WSL2) |
34
- | OS | WSL2 Ubuntu, linux 6.18.33.2 |
35
- | Node | v18.19.1 |
36
- | Postgres | 16.14 (postgres:16-alpine) |
39
+ | RAM | 32 GB |
40
+ | OS | win32 10.0.26200 |
41
+ | Node | v24.5.0 |
42
+ | Postgres | 16.15 (`postgres:16-alpine` on `127.0.0.1:54329`) |
37
43
  | Dataset | 5 000 rows, distinct email per row |
38
- | When | 2026-08-14T13:46Z |
44
+ | Before | `09b2100` at 2026-08-18T20:43:32Z |
45
+ | After | `46acd75` at 2026-08-18T20:44:13Z |
39
46
 
40
47
  `maxRows` falls back to **100** in code when the policy leaves it unset; the
41
48
  `conarium.config.json` shipped with the package sets **50**. A fresh install
@@ -51,6 +58,9 @@ Two series, same user SQL both sides:
51
58
 
52
59
  Deny must not hit Postgres. It did not.
53
60
 
61
+ The tables below are **after** (`46acd75`). The before/after pair for the
62
+ masked cliff is under Warning threshold.
63
+
54
64
  ---
55
65
 
56
66
  ## same-limit (same row count) — the number to quote
@@ -59,29 +69,32 @@ Deny must not hit Postgres. It did not.
59
69
 
60
70
  | maxRows | direct p50 | conarium p50 | overhead p50 / p95 / p99 | n |
61
71
  |---|---|---|---|---|
62
- | 100 | 0.427 ms | 3.798 ms | **2.850 / 3.731 / 4.191** | 50 |
63
- | 500 | 1.069 ms | 9.257 ms | **7.973 / 11.117 / 11.545** | 50 |
64
- | 5 000 | 5.660 ms | 73.885 ms | **69.242 / 85.116 / 85.116** | 15 |
72
+ | 100 | 1.157 ms | 3.789 ms | **2.392 / 3.183 / 3.594** | 50 |
73
+ | 500 | 1.863 ms | 9.944 ms | **7.832 / 14.539 / 15.034** | 50 |
74
+ | 5 000 | 7.328 ms | 94.699 ms | **88.884 / 119.527 / 119.527** | 15 |
65
75
 
66
76
  ### partial (email masked)
67
77
 
68
78
  | maxRows | direct p50 | conarium p50 | overhead p50 / p95 / p99 | n |
69
79
  |---|---|---|---|---|
70
- | 100 | 0.577 ms | 5.968 ms | **5.006 / 6.730 / 7.099** | 50 |
71
- | 500 | 0.950 ms | 88.363 ms | **86.615 / 112.802 / 341.147** | 50 |
72
- | 5 000 | 4.828 ms | 21787 ms | **21770 / 25581 / 25581** | 15 |
80
+ | 100 | 1.162 ms | 4.092 ms | **2.670 / 4.395 / 4.740** | 50 |
81
+ | 500 | 1.633 ms | 10.967 ms | **8.801 / 16.200 / 16.692** | 50 |
82
+ | 5 000 | 7.646 ms | 99.731 ms | **92.929 / 125.204 / 125.204** | 15 |
73
83
 
74
- Conservative default (100 rows, masked): **about 5 ms added**. The shipped
84
+ Conservative default (100 rows, masked): **about 3 ms added**. The shipped
75
85
  config caps at 50, so a fresh install stays below this figure.
76
- 500 distinct emails: **about 87 ms**. 5 000: **about 22 s**.
86
+ 500 distinct emails: **about 9 ms**. 5 000: **about 93 ms**.
87
+
88
+ On the same machine, `09b2100` same-limit partial overhead was
89
+ 5.6 ms / 83 ms / **14.1 s**. That 14 s cell is the cost that `46acd75` removed.
77
90
 
78
91
  ### deny
79
92
 
80
93
  | maxRows | conarium p50 | query ran |
81
94
  |---|---|---|
82
- | 100 | 0.432 ms | no |
83
- | 500 | 0.404 ms | no |
84
- | 5 000 | 0.396 ms | no |
95
+ | 100 | 0.786 ms | no |
96
+ | 500 | 0.646 ms | no |
97
+ | 5 000 | 0.630 ms | no |
85
98
 
86
99
  ---
87
100
 
@@ -91,36 +104,37 @@ Direct always returns 5 000 rows. Conarium returns `maxRows`.
91
104
 
92
105
  | scenario | maxRows | direct p50 | conarium p50 | overhead p50 | rows in / out |
93
106
  |---|---|---|---|---|---|
94
- | allow | 100 | 4.023 | 3.444 | **−1.592** | 5000 → 100 |
95
- | allow | 500 | 4.411 | 9.147 | 3.943 | 5000 → 500 |
96
- | allow | 5 000 | 4.511 | 78.854 | 73.775 | 5000 → 5000 |
97
- | partial | 100 | 5.862 | 6.926 | 1.824 | 5000 → 100 |
98
- | partial | 500 | 6.177 | 90.215 | 84.854 | 5000 → 500 |
99
- | partial | 5 000 | 5.856 | 19301 | 19289 | 5000 → 5000 |
100
-
101
- The −1.6 ms cell is the row cap doing less I/O. It is not a claim that
107
+ | allow | 100 | 4.920 | 3.479 | **−0.919** | 5000 → 100 |
108
+ | allow | 500 | 3.882 | 5.820 | 1.451 | 5000 → 500 |
109
+ | allow | 5 000 | 3.617 | 38.852 | 32.992 | 5000 → 5000 |
110
+ | partial | 100 | 5.413 | 3.492 | **−1.610** | 5000 → 100 |
111
+ | partial | 500 | 4.515 | 5.874 | 0.802 | 5000 → 500 |
112
+ | partial | 5 000 | 7.142 | 93.473 | 85.634 | 5000 → 5000 |
113
+
114
+ The negative cells are the row cap doing less I/O. They are not a claim that
102
115
  masking is free.
103
116
 
104
117
  ---
105
118
 
106
- ## In-process redact (WSL, unique email per row)
119
+ ## In-process redact (win32, unique email per row)
107
120
 
108
- Not a substitute for the table above. Shows the same cliff without a socket.
121
+ Not a substitute for the table above. Same environment; only 50 / 100 / 500
122
+ are timed in-process when a DSN is set (5 000 lives in the Postgres table).
109
123
 
110
124
  | distinct emails | p50 | p95 | p99 | n |
111
125
  |---|---|---|---|---|
112
- | 50 | 1.137 ms | 2.018 | 3.066 | 50 |
113
- | 100 | 2.678 ms | 5.821 | 8.998 | 50 |
114
- | 500 | 76.381 ms | 113.928 | 123.534 | 50 |
126
+ | 50 | 0.790 ms | 1.192 | 1.460 | 50 |
127
+ | 100 | 1.195 ms | 1.811 | 2.181 | 50 |
128
+ | 500 | 4.066 ms | 10.756 | 12.308 | 50 |
115
129
 
116
130
  ---
117
131
 
118
132
  ## Warning threshold
119
133
 
120
- `docs/benchmarks/masking-cost-threshold.json` → **warn above 100**.
134
+ `docs/benchmarks/masking-cost-threshold.json` → **warn above 500**.
121
135
 
122
- 100 is the last measured point still in the low-millisecond band
123
- (same-limit partial overhead p50 = 5.0 ms). 500 is already 87 ms.
136
+ 500 is the last measured cap still in the low-millisecond band
137
+ (same-limit partial overhead p50 = 8.8 ms). 5 000 is 93 ms.
124
138
  The doctor and `parseConariumConfig` warn. They do not reject the query.
125
139
 
126
140
  ---
@@ -0,0 +1,41 @@
1
+ # Pricing (same words as the site)
2
+
3
+ The live cards are on [conarium.dev](https://conarium.dev/#pricing). This file
4
+ exists so the public repository does not drift from the site the way `docs.html`
5
+ did. A card line that cannot be delivered does not go on the card.
6
+
7
+ | Tier | Price | Button |
8
+ |---|---|---|
9
+ | Community | Free | Get started free → GitHub |
10
+ | **Pro** | **$20/month** or **$200/year — save $40** | Get started → `#cta` while checkout is closed; `/buy?plan=pro&period=monthly\|yearly` once it opens |
11
+ | Business | $100/month | **Join the waitlist** → `#cta` — **does not take payment** |
12
+ | Enterprise | Custom | Contact us → `#cta` |
13
+
14
+ ## Pro (priced, checkout closed)
15
+
16
+ - **Checkout is closed.** `/buy` and both card buttons redirect to `#cta`, and
17
+ `/api/checkout/live` reports `{"live":false}`. The price below is published,
18
+ not payable. When the payment path goes live this section says `sold` and the
19
+ Button column above drops its first clause.
20
+ - Hosted countersignature: someone other than you signs the chain head. Shipped in the package since 0.2.16; the VERAX-operated endpoint is not open to customers yet.
21
+ - Fair use — 60 submissions per minute.
22
+ - No monthly quota.
23
+ - **One period, not a subscription.** It does not renew by itself — when the period ends, access ends and you can buy it again. 14-day no-questions refund; after that, no partial refunds.
24
+ - VAT added where applicable.
25
+
26
+ ## Business (waitlist)
27
+
28
+ Three items remain marked **In the contract, not shipped yet**:
29
+
30
+ - reconciliation on a schedule, against your database's own counters
31
+ - an alert when coverage breaks
32
+ - a signed period report, generated on your side
33
+
34
+ Do not remove those marks. The waitlist form (`#cta`) is Business / Enterprise /
35
+ Design Partner. It is not Pro checkout.
36
+
37
+ ## `#cta`
38
+
39
+ The footer form writes an email to the waitlist. Pro checkout does not use it —
40
+ but while checkout is closed, the Pro buttons and `/buy` land there, which is
41
+ the one case in which a Pro reader reaches this form.
@@ -26,6 +26,7 @@ Design source: `docs/superpowers/specs/2026-07-29-conarium-receipt-design.md`.
26
26
  değiştirilmediğini, **ortadan** silinmediğini, yeniden sıralanmadığını ve geriye
27
27
  dönük tarihlenmediğini kanıtlar. **Oluşturma anında doğru olduğunu kanıtlamaz.**
28
28
  Sondan kesmeyi tek başına göremez.
29
+ *(/TR)*
29
30
 
30
31
  ## Media type
31
32
 
@@ -411,12 +412,13 @@ revision history is itself timestamped.
411
412
 
412
413
  ## Known gaps (documented, not hidden)
413
414
 
414
- 1. **`actor` is a service identity unless per-user tokens are configured.** With a token file (`CONARIUM_TOKENS_FILE`, default `conarium.tokens.json`), the audit line and the receipt name the individual and set `assurance: "per-user-token"`. Without it the actor is the connecting service, with `assurance: "shared-token"`. This is an operator-managed token map — **not** OAuth or SSO; there is no identity-provider integration, so the assurance is only as good as the operator's token hygiene. For shared-token deployments, marketing must not claim "who accessed".
415
- 2. **Bypass detection — addressed as of reconcile v0.1, with stated limits.** Disabling Conarium and reading the DB directly still produces no receipt — no gateway can prevent that from inside. What changed: absence is now *checkable from both sides*. One-sided: `conarium-coverage` emits a signed declaration (chain contiguity + which declared objects have recorded access). Two-sided: `conarium-reconcile` compares the database's own per-role query counters against the in-window receipts and reports any DB-recorded pattern no receipt covers (see §Reconciliation). Remaining limits, stated: reconciliation trusts the DB's own counters (an attacker who can falsify `pg_stat_statements` is out of scope), requires a dedicated DB role per gateway instance, and matches per pattern/table — never per call count. **The language rule stands: "access NOT RECORDED", never "no access occurred."**
416
- 3. **Creation-time truth is not proven.** Without hardware attestation, an operator can still write false-but-well-formed receipts *before* anchoring.
417
- 4. **In-file `sig` stripping + HMAC/`anchor` reduction.** Content `hash` is computed with `{hash, sig, anchor}` (and audit `signature`/`sig`) excluded, so an operator who controls the file can drop or thin those fields without invalidating the content hash itself. Contiguity and the trust store catch some boot-time cases, but full protection against in-file strip/reduce games is **not solvable in-file** (*in-file çözülemez*) — it needs an external transparency-log anchor and/or out-of-band key ceremony. **Opt-in strict boot (G3):** `CONARIUM_AUDIT_REQUIRE_SIG=1` rejects a chain with any unsigned line when a signing key is configured; the default stays the 08-05 compatibility open. **Mitigation available today, measured:** keep `CONARIUM_AUDIT_HMAC_KEY` enabled alongside Ed25519. HMAC is keyed, so an actor who strips `sig` and recomputes the unkeyed hashes still fails the HMAC check (`entry signature mismatch`). Verified by test: Ed25519 alone → strip-all passes the boot check; Ed25519 + HMAC → caught. `conarium-verify --pubkey` also catches it (exit 13, `missing sig`) because it is told to expect signatures. **Anchor is available** (`CONARIUM_ANCHOR_SINK=opentimestamps`) but starts as `pending` — Bitcoin finality is delayed (hours); see §Anchoring.
418
- 5. **`argsHash` hurts debugging.** Support cases need the customer's own logs to correlate.
419
- 6. **Tail truncation is invisible to `conarium-verify` unless pinned.** Deleting the last N receipts leaves a consistent leftover chain (exit 0). `--expect-count` / `--expect-last-hash` exist for operators who have an external length or last-hash; they are opt-in so a verifier that saw the same file yesterday still exits 0 today. Anchoring the head, or `conarium-reconcile` against the database's own counters, are the other pins.
415
+ 1. **`actor` is a service identity unless per-user tokens are configured.** With a token file (`CONARIUM_TOKENS_FILE`, default `conarium.tokens.json`), the audit line and the receipt name the individual, set `assurance: "per-user-token"` and `type: "user"`. Without it the actor is the connecting service, with `assurance: "shared-token"` and `type: "service"`. `type` is derived from `assurance` rather than carried separately — `resolveActor` is the single place either is decided, so a second field would be the same fact asserted twice. This is an operator-managed token map — **not** OAuth or SSO; there is no identity-provider integration, so the assurance is only as good as the operator's token hygiene. For shared-token deployments, marketing must not claim "who accessed". *Until 0.2.29, `type` was hard-coded to `"service"` regardless: a person connecting with their own token produced a signed receipt naming them and calling them a service. The verifier already rejected `"user"` with `"shared-token"`, but the producing side never emitted `"user"`, so that rule had never fired.*
416
+ 2. **`dataRefs[].fieldsRequested` and `policy.rulesApplied` are emitted empty.** Until 0.2.29 the first was filled from the masked-field list and the second from the set of SQL functions the query touched — in both cases a field whose name described something other than its contents. A reader takes `fieldsRequested` for the columns a query asked for, and `rulesApplied` for policy rule identifiers; neither was true, and both were signed. They are now empty, because in a signed document a field filled with the wrong thing is worse than a field left empty: empty says *unknown*, wrongly-filled says *known* and misleads. The correct contents are recoverable — selected columns from the SQL AST, rule identifiers from a policy engine that emits them — and neither is implemented; when it is, these fields carry it. **The conformance vectors under `test-vectors/` show both fields populated. Those vectors are hand-written to exercise the format and are not produced by this implementation; a populated value is valid, and an empty one is what this version emits.** Losing per-field masking detail from `dataRefs` is a regression and is stated here rather than absorbed silently — `masking.byClass` still carries the per-class counts.
417
+ 3. **Bypass detection — addressed as of reconcile v0.1, with stated limits.** Disabling Conarium and reading the DB directly still produces no receipt — no gateway can prevent that from inside. What changed: absence is now *checkable from both sides*. One-sided: `conarium-coverage` emits a signed declaration (chain contiguity + which declared objects have recorded access). Two-sided: `conarium-reconcile` compares the database's own per-role query counters against the in-window receipts and reports any DB-recorded pattern no receipt covers (see §Reconciliation). Remaining limits, stated: reconciliation trusts the DB's own counters (an attacker who can falsify `pg_stat_statements` is out of scope), requires a dedicated DB role per gateway instance, and matches per pattern/table — never per call count. **The language rule stands: "access NOT RECORDED", never "no access occurred."**
418
+ 4. **Creation-time truth is not proven.** Without hardware attestation, an operator can still write false-but-well-formed receipts *before* anchoring.
419
+ 5. **In-file `sig` stripping + HMAC/`anchor` reduction.** Content `hash` is computed with `{hash, sig, anchor}` (and audit `signature`/`sig`) excluded, so an operator who controls the file can drop or thin those fields without invalidating the content hash itself. Contiguity and the trust store catch some boot-time cases, but full protection against in-file strip/reduce games is **not solvable in-file** (*in-file çözülemez*) — it needs an external transparency-log anchor and/or out-of-band key ceremony. **Opt-in strict boot (G3):** `CONARIUM_AUDIT_REQUIRE_SIG=1` rejects a chain with any unsigned line when a signing key is configured; the default stays the 08-05 compatibility open. **Mitigation available today, measured:** keep `CONARIUM_AUDIT_HMAC_KEY` enabled alongside Ed25519. HMAC is keyed, so an actor who strips `sig` and recomputes the unkeyed hashes still fails the HMAC check (`entry signature mismatch`). Verified by test: Ed25519 alone → strip-all passes the boot check; Ed25519 + HMAC → caught. `conarium-verify --pubkey` also catches it (exit 13, `missing sig`) because it is told to expect signatures. **Anchor is available** (`CONARIUM_ANCHOR_SINK=opentimestamps`) but starts as `pending` — Bitcoin finality is delayed (hours); see §Anchoring.
420
+ 6. **`argsHash` hurts debugging.** Support cases need the customer's own logs to correlate.
421
+ 7. **Tail truncation is invisible to `conarium-verify` unless pinned.** Deleting the last N receipts leaves a consistent leftover chain (exit 0). `--expect-count` / `--expect-last-hash` exist for operators who have an external length or last-hash; they are opt-in so a verifier that saw the same file yesterday still exits 0 today. Anchoring the head, or `conarium-reconcile` against the database's own counters, are the other pins.
420
422
 
421
423
  ## Anchoring (OpenTimestamps)
422
424