@conarium-ai/core 0.2.38 → 0.2.40
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.
- package/CHANGELOG.md +74 -0
- package/README.md +1 -1
- package/bin/conarium-coverage.mjs +20 -19
- package/bin/conarium-init.mjs +10 -9
- package/bin/conarium-reconcile.mjs +6 -6
- package/bin/conarium-verify.mjs +63 -42
- package/dist/audit-hash.d.ts +1 -1
- package/dist/audit-hash.d.ts.map +1 -1
- package/dist/audit-hash.js +1 -1
- package/dist/audit-hash.js.map +1 -1
- package/dist/audit.d.ts +22 -21
- package/dist/audit.d.ts.map +1 -1
- package/dist/audit.js +104 -88
- package/dist/audit.js.map +1 -1
- package/dist/config.d.ts +69 -433
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +7 -4
- package/dist/config.js.map +1 -1
- package/dist/connectors/supabase_rest.d.ts +2 -2
- package/dist/connectors/supabase_rest.d.ts.map +1 -1
- package/dist/connectors/supabase_rest.js +7 -5
- package/dist/connectors/supabase_rest.js.map +1 -1
- package/dist/console-receipts.d.ts +2 -2
- package/dist/console-receipts.d.ts.map +1 -1
- package/dist/console-receipts.js +2 -2
- package/dist/console-receipts.js.map +1 -1
- package/dist/console.d.ts +6 -22
- package/dist/console.d.ts.map +1 -1
- package/dist/console.js +13 -12
- package/dist/console.js.map +1 -1
- package/dist/coverage.d.ts +32 -30
- package/dist/coverage.d.ts.map +1 -1
- package/dist/coverage.js +39 -36
- package/dist/coverage.js.map +1 -1
- package/dist/governance.d.ts +14 -13
- package/dist/governance.d.ts.map +1 -1
- package/dist/governance.js +52 -48
- package/dist/governance.js.map +1 -1
- package/dist/http.d.ts +6 -5
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +45 -41
- package/dist/http.js.map +1 -1
- package/dist/iban.d.ts.map +1 -1
- package/dist/iban.js +13 -12
- package/dist/iban.js.map +1 -1
- package/dist/llm-gate.d.ts +6 -6
- package/dist/llm-gate.js +6 -6
- package/dist/pseudonymize.d.ts +8 -8
- package/dist/pseudonymize.d.ts.map +1 -1
- package/dist/pseudonymize.js +7 -7
- package/dist/pseudonymize.js.map +1 -1
- package/dist/receipt-view.d.ts +1 -1
- package/dist/receipt-view.d.ts.map +1 -1
- package/dist/receipt-view.js +52 -51
- package/dist/receipt-view.js.map +1 -1
- package/dist/receipt.d.ts +32 -28
- package/dist/receipt.d.ts.map +1 -1
- package/dist/receipt.js +23 -20
- package/dist/receipt.js.map +1 -1
- package/dist/scripts/discover_schema.js +14 -12
- package/dist/scripts/discover_schema.js.map +1 -1
- package/dist/scripts/dogfood_prove.js +16 -16
- package/dist/scripts/dogfood_prove.js.map +1 -1
- package/dist/server.d.ts +5 -4
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +44 -34
- package/dist/server.js.map +1 -1
- package/dist/sql-gate/rules.d.ts +8 -7
- package/dist/sql-gate/rules.d.ts.map +1 -1
- package/dist/sql-gate/rules.js +11 -9
- package/dist/sql-gate/rules.js.map +1 -1
- package/dist/tokens.d.ts +3 -3
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +18 -18
- package/dist/tokens.js.map +1 -1
- package/docs/RECEIPT-SPEC.md +200 -3
- package/docs/claims/reviews/0.2.39.md +90 -0
- package/docs/claims/reviews/0.2.40.md +70 -0
- package/package.json +6 -4
- package/public/app.js +6 -6
- package/public/index.html +7 -7
- package/public/receipts-panel.js +7 -7
- package/scripts/audit-chain-check.mjs +6 -6
- package/scripts/benchmark-overhead.mjs +4 -4
- package/scripts/conarium_sabah_brief.mjs +11 -11
- 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">
|
|
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>
|
|
101
|
-
<button class="btn secondary-btn" id="refresh-receipts">
|
|
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>
|
|
110
|
-
<th>
|
|
111
|
-
<th>
|
|
112
|
-
<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>
|
package/public/receipts-panel.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
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 = '
|
|
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 || '
|
|
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 = '
|
|
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 = '
|
|
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) || '
|
|
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
|
-
*
|
|
4
|
-
* Hash
|
|
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
|
|
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
|
|
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 = '
|
|
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
|
|
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
|
|
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:
|
|
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:
|
|
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}:
|
|
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 `
|
|
57
|
+
if (payload?.error) return `_Error: ${payload.error}_\n`
|
|
58
58
|
const rows = payload?.rows || []
|
|
59
|
-
if (!rows.length) return '
|
|
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
|
|
79
|
+
const md = `# Conarium morning — ${now}
|
|
80
80
|
|
|
81
|
-
>
|
|
81
|
+
> Source: zion-rest (Codes sync mirror). Not live Codes. PII-masked fields omitted.
|
|
82
82
|
|
|
83
|
-
## 1)
|
|
83
|
+
## 1) Dead stock
|
|
84
84
|
${fmtRows(r[2], 3)}
|
|
85
85
|
|
|
86
|
-
## 2)
|
|
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)
|
|
92
|
+
## 4) Shipment summary
|
|
93
93
|
${fmtRows(r[5], 3)}
|
|
94
94
|
|
|
95
|
-
##
|
|
96
|
-
- |
|
|
97
|
-
-
|
|
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 (
|
|
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
|
\`\`\`
|
package/test-vectors/README.md
CHANGED
|
@@ -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:
|