@conarium-ai/core 0.2.37 → 0.2.39

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 (87) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +6 -5
  3. package/bin/conarium-coverage.mjs +20 -19
  4. package/bin/conarium-init.mjs +10 -9
  5. package/bin/conarium-reconcile.mjs +6 -6
  6. package/bin/conarium-verify.mjs +37 -33
  7. package/dist/audit-hash.d.ts +1 -1
  8. package/dist/audit-hash.d.ts.map +1 -1
  9. package/dist/audit-hash.js +1 -1
  10. package/dist/audit-hash.js.map +1 -1
  11. package/dist/audit.d.ts +22 -21
  12. package/dist/audit.d.ts.map +1 -1
  13. package/dist/audit.js +104 -88
  14. package/dist/audit.js.map +1 -1
  15. package/dist/config.d.ts +69 -433
  16. package/dist/config.d.ts.map +1 -1
  17. package/dist/config.js +7 -4
  18. package/dist/config.js.map +1 -1
  19. package/dist/connectors/supabase_rest.d.ts +2 -2
  20. package/dist/connectors/supabase_rest.d.ts.map +1 -1
  21. package/dist/connectors/supabase_rest.js +7 -5
  22. package/dist/connectors/supabase_rest.js.map +1 -1
  23. package/dist/console-receipts.d.ts +2 -2
  24. package/dist/console-receipts.d.ts.map +1 -1
  25. package/dist/console-receipts.js +2 -2
  26. package/dist/console-receipts.js.map +1 -1
  27. package/dist/console.d.ts +6 -22
  28. package/dist/console.d.ts.map +1 -1
  29. package/dist/console.js +13 -12
  30. package/dist/console.js.map +1 -1
  31. package/dist/coverage.d.ts +32 -30
  32. package/dist/coverage.d.ts.map +1 -1
  33. package/dist/coverage.js +39 -36
  34. package/dist/coverage.js.map +1 -1
  35. package/dist/governance.d.ts +14 -13
  36. package/dist/governance.d.ts.map +1 -1
  37. package/dist/governance.js +52 -48
  38. package/dist/governance.js.map +1 -1
  39. package/dist/http.d.ts +6 -5
  40. package/dist/http.d.ts.map +1 -1
  41. package/dist/http.js +45 -41
  42. package/dist/http.js.map +1 -1
  43. package/dist/iban.d.ts.map +1 -1
  44. package/dist/iban.js +13 -12
  45. package/dist/iban.js.map +1 -1
  46. package/dist/llm-gate.d.ts +6 -6
  47. package/dist/llm-gate.js +6 -6
  48. package/dist/pseudonymize.d.ts +8 -8
  49. package/dist/pseudonymize.d.ts.map +1 -1
  50. package/dist/pseudonymize.js +7 -7
  51. package/dist/pseudonymize.js.map +1 -1
  52. package/dist/receipt-view.d.ts +1 -1
  53. package/dist/receipt-view.d.ts.map +1 -1
  54. package/dist/receipt-view.js +52 -51
  55. package/dist/receipt-view.js.map +1 -1
  56. package/dist/receipt.d.ts +32 -28
  57. package/dist/receipt.d.ts.map +1 -1
  58. package/dist/receipt.js +23 -20
  59. package/dist/receipt.js.map +1 -1
  60. package/dist/scripts/discover_schema.js +14 -12
  61. package/dist/scripts/discover_schema.js.map +1 -1
  62. package/dist/scripts/dogfood_prove.js +16 -16
  63. package/dist/scripts/dogfood_prove.js.map +1 -1
  64. package/dist/server.d.ts +5 -4
  65. package/dist/server.d.ts.map +1 -1
  66. package/dist/server.js +44 -34
  67. package/dist/server.js.map +1 -1
  68. package/dist/sql-gate/rules.d.ts +8 -7
  69. package/dist/sql-gate/rules.d.ts.map +1 -1
  70. package/dist/sql-gate/rules.js +11 -9
  71. package/dist/sql-gate/rules.js.map +1 -1
  72. package/dist/tokens.d.ts +3 -3
  73. package/dist/tokens.d.ts.map +1 -1
  74. package/dist/tokens.js +18 -18
  75. package/dist/tokens.js.map +1 -1
  76. package/docs/RECEIPT-SPEC.md +188 -1
  77. package/docs/claims/reviews/0.2.38.md +58 -0
  78. package/docs/claims/reviews/0.2.39.md +90 -0
  79. package/docs/security/THREAT-MODEL.md +6 -1
  80. package/package.json +6 -4
  81. package/public/app.js +6 -6
  82. package/public/index.html +7 -7
  83. package/public/receipts-panel.js +7 -7
  84. package/scripts/audit-chain-check.mjs +6 -6
  85. package/scripts/benchmark-overhead.mjs +4 -4
  86. package/scripts/conarium_sabah_brief.mjs +11 -11
  87. package/test-vectors/README.md +15 -0
package/public/index.html CHANGED
@@ -20,7 +20,7 @@
20
20
  <a href="#" class="nav-item" data-tab="playground">Playground</a>
21
21
  <a href="#" class="nav-item" data-tab="governance">Governance</a>
22
22
  <a href="#" class="nav-item" data-tab="audit">Audit Logs</a>
23
- <a href="#" class="nav-item" data-tab="receipts">Makbuzlar</a>
23
+ <a href="#" class="nav-item" data-tab="receipts">Receipts</a>
24
24
  </nav>
25
25
  </aside>
26
26
 
@@ -97,8 +97,8 @@
97
97
  <div class="tab-content" id="tab-receipts">
98
98
  <div class="card glass-panel">
99
99
  <div class="card-header">
100
- <h3>Makbuzlar</h3>
101
- <button class="btn secondary-btn" id="refresh-receipts">Yenile</button>
100
+ <h3>Receipts</h3>
101
+ <button class="btn secondary-btn" id="refresh-receipts">Refresh</button>
102
102
  </div>
103
103
  <p id="receipt-chain" class="receipt-chain" hidden></p>
104
104
  <p id="receipt-empty" class="receipt-empty" hidden></p>
@@ -106,10 +106,10 @@
106
106
  <table class="audit-table" id="receipt-table" hidden>
107
107
  <thead>
108
108
  <tr>
109
- <th>Zaman</th>
110
- <th>Aktör</th>
111
- <th>Araç</th>
112
- <th>Karar</th>
109
+ <th>Time</th>
110
+ <th>Actor</th>
111
+ <th>Tool</th>
112
+ <th>Decision</th>
113
113
  <th>Maske</th>
114
114
  <th>seq</th>
115
115
  </tr>
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Makbuzlar tab view-state. Fetch'ten ÖNCE çağrılır — aksi halde ilk tık
3
- * boş (hepsi hidden) kalır ve ikinci tıkta dolu görünür.
2
+ * Receipts tab view-state. Called BEFORE the fetch — otherwise the first click
3
+ * stays empty (everything hidden) and only the second click looks filled.
4
4
  */
5
5
  (function (root) {
6
6
  function showLoading(ui) {
@@ -8,7 +8,7 @@
8
8
  ui.table.hidden = true
9
9
  ui.detail.hidden = true
10
10
  ui.empty.hidden = false
11
- ui.empty.textContent = 'Yükleniyor…'
11
+ ui.empty.textContent = 'Loading…'
12
12
  }
13
13
 
14
14
  function showError(ui, message) {
@@ -24,7 +24,7 @@
24
24
  ui.table.hidden = true
25
25
  ui.detail.hidden = true
26
26
  ui.empty.hidden = false
27
- ui.empty.textContent = message || 'henüz makbuz yok'
27
+ ui.empty.textContent = message || 'no receipts yet'
28
28
  }
29
29
 
30
30
  function showList(ui, data, make) {
@@ -36,11 +36,11 @@
36
36
  if (chain.ok === false) {
37
37
  ui.chain.hidden = false
38
38
  ui.chain.className = 'receipt-chain broken'
39
- ui.chain.textContent = 'kırık (satır ' + chain.brokenAt + ')'
39
+ ui.chain.textContent = 'broken (row ' + chain.brokenAt + ')'
40
40
  } else {
41
41
  ui.chain.hidden = false
42
42
  ui.chain.className = 'receipt-chain ok'
43
- ui.chain.textContent = 'zincir sağlam'
43
+ ui.chain.textContent = 'chain intact'
44
44
  }
45
45
  items.forEach(function (row) {
46
46
  const tr = make.tr()
@@ -71,7 +71,7 @@
71
71
 
72
72
  function render(ui, data, make) {
73
73
  if (!data || data.error) {
74
- showError(ui, (data && data.error) || 'Makbuz listesi alınamadı.')
74
+ showError(ui, (data && data.error) || 'Could not load the receipt list.')
75
75
  return 'error'
76
76
  }
77
77
  const items = Array.isArray(data.items) ? data.items : []
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Salt-oku audit zincir doğrulayıcı.
4
- * Hash kuralı = src/audit-hash.ts / validateChain (hash+signature hariç JSON → sha256).
3
+ * Read-only audit chain verifier.
4
+ * Hash rule = src/audit-hash.ts / validateChain (JSON excluding hash+signature → sha256).
5
5
  *
6
6
  * Usage: node scripts/audit-chain-check.mjs <sink.jsonl>
7
- * exit 0 temiz · exit 1 kırık/self-hash · exit 2 kullanım
7
+ * exit 0 clean · exit 1 broken/self-hash · exit 2 usage
8
8
  */
9
9
  import { createHash } from 'crypto'
10
10
  import { existsSync, readFileSync, statSync } from 'fs'
@@ -32,13 +32,13 @@ function check(sinkPath) {
32
32
  }
33
33
  if (!result.exists) {
34
34
  result.ok = true
35
- result.note = 'sink yok — genesis kabul'
35
+ result.note = 'no sink — treat as genesis'
36
36
  return result
37
37
  }
38
38
  result.bytes = statSync(abs).size
39
39
  const raw = readFileSync(abs, 'utf-8').trim()
40
40
  if (!raw) {
41
- result.note = 'boş sink'
41
+ result.note = 'empty sink'
42
42
  return result
43
43
  }
44
44
  const lines = raw.split('\n').filter(Boolean)
@@ -96,7 +96,7 @@ function human(r) {
96
96
  `sink: ${r.sink}`,
97
97
  `exists: ${r.exists} · bytes: ${r.bytes} · lines: ${r.lines}`,
98
98
  `prevHash breaks: ${r.prevHashBreaks.length}`,
99
- `self-hash mismatches (tamper şüphesi): ${r.selfHashMismatches.length}`,
99
+ `self-hash mismatches (tamper suspected): ${r.selfHashMismatches.length}`,
100
100
  `ok: ${r.ok}`,
101
101
  ]
102
102
  if (r.prevHashBreaks[0]) {
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * CONARIUM_BENCH_DSN=postgres://… node scripts/benchmark-overhead.mjs
6
6
  *
7
- * Without a DSN this does not invent a comparison. It writes koşulamadı
7
+ * Without a DSN this does not invent a comparison. It writes not run
8
8
  * for (a) vs (b) and still records in-process gate timings (CPU of
9
9
  * guardQuery + redact — not a substitute for the Postgres delta).
10
10
  *
@@ -43,7 +43,7 @@ Measures Conarium's added cost, not absolute speed.
43
43
  Scenarios: allow (unmasked) · partial (email masked) · deny (query must not run).
44
44
  Caps: 100 (code default) · 500 · 5 000. Dataset is 5 000 rows.
45
45
 
46
- Needs CONARIUM_BENCH_DSN for (a) vs (b). Without it: koşulamadı.`)
46
+ Needs CONARIUM_BENCH_DSN for (a) vs (b). Without it: not run.`)
47
47
  process.exit(0)
48
48
  }
49
49
 
@@ -472,7 +472,7 @@ if (postgresResult.comparison) {
472
472
  }
473
473
  }
474
474
  } else {
475
- console.log('Postgres comparison: koşulamadı')
475
+ console.log('Postgres comparison: not run')
476
476
  }
477
477
  console.log('')
478
478
  console.log('in-process (not vs Postgres)')
@@ -482,7 +482,7 @@ for (const kind of Object.keys(inProcess.guard)) {
482
482
  for (const n of Object.keys(inProcess.redact)) {
483
483
  const cell = inProcess.redact[n]
484
484
  if (cell.status === 'kosulanmadi') {
485
- console.log(` redact ${n}: koşulamadı — ${cell.reason}`)
485
+ console.log(` redact ${n}: not run — ${cell.reason}`)
486
486
  } else {
487
487
  console.log(' ' + line(`redact ${String(n).padStart(6)}`, cell))
488
488
  }
@@ -54,9 +54,9 @@ function parseToolResults(out) {
54
54
  }
55
55
 
56
56
  function fmtRows(payload, max = 8) {
57
- if (payload?.error) return `_Hata: ${payload.error}_\n`
57
+ if (payload?.error) return `_Error: ${payload.error}_\n`
58
58
  const rows = payload?.rows || []
59
- if (!rows.length) return '_boş_\n'
59
+ if (!rows.length) return '_empty_\n'
60
60
  const keys = Object.keys(rows[0]).filter(k => !/phone|email|gsm|tckn/i.test(k)).slice(0, 6)
61
61
  const lines = ['| ' + keys.join(' | ') + ' |', '| ' + keys.map(() => '---').join(' | ') + ' |']
62
62
  for (const r of rows.slice(0, max)) {
@@ -76,27 +76,27 @@ const { out, err } = await runMcp([
76
76
 
77
77
  const r = parseToolResults(out)
78
78
  const now = new Date().toISOString()
79
- const md = `# Conarium sabah — ${now}
79
+ const md = `# Conarium morning — ${now}
80
80
 
81
- > Kaynak: zion-rest (Codes sync aynası). Canlı Codes değil. PII maskeli alanlar atlandı.
81
+ > Source: zion-rest (Codes sync mirror). Not live Codes. PII-masked fields omitted.
82
82
 
83
- ## 1) Ölü stok
83
+ ## 1) Dead stock
84
84
  ${fmtRows(r[2], 3)}
85
85
 
86
- ## 2) Şube özet
86
+ ## 2) Branch summary
87
87
  ${fmtRows(r[3], 10)}
88
88
 
89
89
  ## 3) Stock runout
90
90
  ${fmtRows(r[4], 10)}
91
91
 
92
- ## 4) Sevk özet
92
+ ## 4) Shipment summary
93
93
  ${fmtRows(r[5], 3)}
94
94
 
95
- ## Not
96
- - |marj| uçuksa önce maliyet/veri_hatası hipotezi.
97
- - 3 hamleyi Agent skill \`conarium-sabah\` ile yorumla.
95
+ ## Note
96
+ - If |margin| looks wild, test the cost / data-error hypothesis first.
97
+ - Interpret the three moves with the \`conarium-sabah\` agent skill.
98
98
 
99
- ## stderr (kısa)
99
+ ## stderr (short)
100
100
  \`\`\`
101
101
  ${err.split('\\n').filter(l => /allow=|Connected|running|Fatal/.test(l)).slice(0, 8).join('\\n')}
102
102
  \`\`\`
@@ -6,6 +6,21 @@ Conarium Receipt verifier. Thirteen cases, one public key, one manifest.
6
6
  A specification that cannot be implemented from the document alone is a blog
7
7
  post. These vectors are the difference.
8
8
 
9
+ ## Before you write a verifier
10
+
11
+ Read [Wire format for a second implementation](../docs/RECEIPT-SPEC.md#wire-format-for-a-second-implementation)
12
+ first. It carries the things these vectors do not tell you on their own: what
13
+ the Ed25519 signature actually covers, that `seq` advances by exactly one,
14
+ which absent fields are schema errors rather than tampering, and the order the
15
+ checks run in.
16
+
17
+ That section exists because someone built a verifier from this directory and
18
+ reached 13/13 only after opening our source. It is not repeated here — a fact
19
+ written down twice by hand is a fact that will disagree with itself. The parts
20
+ of it marked *measured* — the signed payload, the sequence rule, the
21
+ required-field table and the check order — are asserted against the shipped
22
+ verifier by `test/spec_wire_contract.mjs`. The rest is prose, and says so.
23
+
9
24
  ## Run them
10
25
 
11
26
  Against this repository's verifier: