@conarium-ai/core 0.2.52 → 0.2.54

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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.54 - two operator scripts leave the tarball
4
+
5
+ Nothing in the tool's behaviour changed. `scripts/conarium_sabah_brief.mjs` and
6
+ `scripts/start-mcp-c1.mjs` are one operator's own tools: they name a home
7
+ directory on one machine, and the second names a local environment file. They
8
+ were shipping through the `scripts` entry of `files` and are now excluded; the
9
+ pack check fails on any packed script that names a home directory. The
10
+ per-user identity example uses `alice` and `owner` as its actor and profile.
11
+
12
+ ## 0.2.53 - two more listings in the README
13
+
14
+ Nothing in the tool's behaviour changed. The README's listing line adds MCP
15
+ Market and LobeHub next to npm, Glama, the MCP Registry and Zenodo. The README
16
+ ships, so the line needs a version of its own.
17
+
3
18
  ## 0.2.52 - listing links, and four dependency advisories closed
4
19
 
5
20
  Nothing in the tool's behaviour changed. `README.md` carries one more line under
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
  <h1>Conarium</h1>
3
3
  <p><strong>The Third Eye for Your Company's Data.</strong></p>
4
4
  <p><sub>Part of <a href="https://verax-ai.com">VERAX</a>, by VERAX Teknoloji. Start with the VERAX body: <a href="https://github.com/verax-ai/verax">verax-ai/verax</a>. Sister projects: <a href="https://github.com/dogrucanemek-alt/tugra">Tugra</a> · <a href="https://github.com/dogrucanemek-alt/cedulon">Cedulon</a>.</sub></p>
5
- <p><sub>Listed on: <a href="https://www.npmjs.com/package/@conarium-ai/core">npm</a> · <a href="https://glama.ai/mcp/servers/dogrucanemek-alt/conarium">Glama</a> · <a href="https://registry.modelcontextprotocol.io/v0/servers?search=io.github.dogrucanemek-alt/conarium">MCP Registry</a> · <a href="https://doi.org/10.5281/zenodo.22238913">Zenodo</a></sub></p>
5
+ <p><sub>Listed on: <a href="https://www.npmjs.com/package/@conarium-ai/core">npm</a> · <a href="https://glama.ai/mcp/servers/dogrucanemek-alt/conarium">Glama</a> · <a href="https://registry.modelcontextprotocol.io/v0/servers?search=io.github.dogrucanemek-alt/conarium">MCP Registry</a> · <a href="https://mcpmarket.com/server/conarium">MCP Market</a> · <a href="https://lobehub.com/mcp/dogrucanemek-alt-conarium">LobeHub</a> · <a href="https://doi.org/10.5281/zenodo.22238913">Zenodo</a></sub></p>
6
6
  <p>A self-hosted, governed gateway that lets AI coding assistants (Cursor, Copilot, Claude) touch your real data under a policy you write—protected values masked before they leave. When a receipt sink is configured it writes a signed, independently verifiable receipt of every access it mediates; <code>conarium-init</code> sets that sink, so the default layout does.</p>
7
7
 
8
8
  <p>
@@ -159,7 +159,7 @@ disable the product's only real guarantee, so masking resolves **per person**:
159
159
  // The controller sees customer names; email and phone stay masked.
160
160
  "controller-full": { "maskColumns": ["*.email", "*.phone"], "maxRows": 1000 }
161
161
  },
162
- "actorProfiles": { "emekcan": "controller-full" }
162
+ "actorProfiles": { "alice": "controller-full" }
163
163
  }
164
164
  }
165
165
  ```
@@ -0,0 +1,20 @@
1
+ # Claims review — 0.2.53
2
+
3
+ - base: v0.2.52
4
+ - head: bc99413
5
+ - surface: sha256:190f5c7b6659643368a7aae0191f8d5177df51004b15455d456faebb268d6729
6
+ - verdict: pass
7
+ - reviewer: Claude. Across the 24 claim surfaces the diff from v0.2.52 is one
8
+ changed line in `README.md`: the listing line gains "MCP Market" and
9
+ "LobeHub", each a link to the listing it names. It states where the package
10
+ is listed and asserts nothing about what the tool does, so there is no
11
+ mechanism for it to claim past. Both new pages were opened before this
12
+ record and show the Conarium listing.
13
+
14
+ The rest of the release is version fields (`package.json`, `server.json`,
15
+ `package-lock.json`), the version assertion in `src/demo-mode.test.ts`, and the
16
+ changelog entry. None of those files is a claim surface.
17
+
18
+ ## Findings
19
+
20
+ none
@@ -0,0 +1,20 @@
1
+ # Claims review — 0.2.54
2
+
3
+ - base: v0.2.53
4
+ - head: 4be9ceb
5
+ - surface: sha256:7c1f0d634937feae884815169827cb91a24aa73596fc98c8e045ca887d49ddf6
6
+ - verdict: pass
7
+ - reviewer: Claude. Across the claim surfaces the diff from v0.2.53 is one
8
+ changed line in `README.md`: the example `actorProfiles` key changes from a
9
+ personal id to `alice`. It is a placeholder name inside a configuration
10
+ example and asserts nothing about what the tool does.
11
+
12
+ The rest of the release is the `files` list in `package.json` (two operator
13
+ scripts excluded), the per-user identity example's names, the pack check, the
14
+ version fields (`package.json`, `server.json`, `package-lock.json`), the
15
+ version assertion in `src/demo-mode.test.ts`, and the changelog entry. None of
16
+ those files is a claim surface.
17
+
18
+ ## Findings
19
+
20
+ none
@@ -4,12 +4,12 @@ Today a shared token writes `assurance: shared-token` and names nobody.
4
4
  The code for `policy.profiles` / `policy.actorProfiles` is already in
5
5
  `src/governance.ts`. This directory is the operator kit to turn it on
6
6
  **locally**, prove it, and roll it back. Copying to `/opt/conarium-mcp`
7
- is a separate patron decision.
7
+ is a separate owner decision.
8
8
 
9
9
  ## 1. Mint tokens (hash only on disk)
10
10
 
11
11
  ```bash
12
- node examples/per-user-identity/mint-token.mjs --id emekcan --file ./conarium.tokens.json
12
+ node examples/per-user-identity/mint-token.mjs --id alice --file ./conarium.tokens.json
13
13
  node examples/per-user-identity/mint-token.mjs --id copilot --file ./conarium.tokens.json
14
14
  ```
15
15
 
@@ -28,7 +28,7 @@ Merge `policy.overlay.json` under `policy` of the live c2
28
28
  config. Do **not** replace `allowTables` / connectors.
29
29
 
30
30
  - Base (AI / unlisted actor): names stay masked.
31
- - `emekcan` → profile `patron`: name columns visible; email / TCKN / IBAN
31
+ - `alice` → profile `owner`: name columns visible; email / TCKN / IBAN
32
32
  scanners still run (a profile cannot switch those off).
33
33
 
34
34
  Backup first:
@@ -44,9 +44,9 @@ npm run build
44
44
  node examples/per-user-identity/prove-identity.mjs
45
45
  ```
46
46
 
47
- Same row, two tokens: patron sees the name, the other sees `[MASKED_PII]`.
48
- Both receipts carry `assurance: per-user-token`. The patron receipt's
49
- `policy.id` is `conarium.policy/patron`; the other stays `conarium.policy`.
47
+ Same row, two tokens: owner sees the name, the other sees `[MASKED_PII]`.
48
+ Both receipts carry `assurance: per-user-token`. The owner receipt's
49
+ `policy.id` is `conarium.policy/owner`; the other stays `conarium.policy`.
50
50
  `conarium-verify` must exit 0.
51
51
 
52
52
  ## 4. Rollback (one command)
@@ -5,7 +5,7 @@
5
5
  * The file stores SHA-256 only. The raw token is printed once, to stdout,
6
6
  * and is never written. 0600 on POSIX.
7
7
  *
8
- * node mint-token.mjs --id emekcan [--file ./conarium.tokens.json]
8
+ * node mint-token.mjs --id alice [--file ./conarium.tokens.json]
9
9
  *
10
10
  * Exit: 0 wrote · 1 refused · 2 could not run
11
11
  */
@@ -1,15 +1,15 @@
1
1
  {
2
- "_comment": "Overlay for a live conarium.config.c2.json. Merge under policy. Do not replace allowTables/denyTables/connectors. Base policy (AI) keeps names masked; the patron profile unmasks name columns only. Email/TCKN/IBAN scanners still run.",
2
+ "_comment": "Overlay for a live conarium.config.c2.json. Merge under policy. Do not replace allowTables/denyTables/connectors. Base policy (AI) keeps names masked; the owner profile unmasks name columns only. Email/TCKN/IBAN scanners still run.",
3
3
  "policy": {
4
4
  "maskColumns": ["*.customer_name", "*.email", "*.phone", "*.tckn", "*.iban"],
5
5
  "profiles": {
6
- "patron": {
6
+ "owner": {
7
7
  "maskColumns": ["*.email", "*.phone", "*.tckn", "*.iban"],
8
8
  "maskLabelledNames": false
9
9
  }
10
10
  },
11
11
  "actorProfiles": {
12
- "emekcan": "patron"
12
+ "alice": "owner"
13
13
  }
14
14
  }
15
15
  }
@@ -34,11 +34,11 @@ const receiptSink = join(dir, 'receipts.jsonl')
34
34
  const auditSink = join(dir, 'audit.jsonl')
35
35
  mkdirSync(dir, { recursive: true })
36
36
 
37
- const patronRaw = randomBytes(32).toString('base64url')
37
+ const ownerRaw = randomBytes(32).toString('base64url')
38
38
  const aiRaw = randomBytes(32).toString('base64url')
39
39
  writeFileSync(tokensFile, JSON.stringify({
40
40
  tokens: [
41
- { sha256: createHash('sha256').update(patronRaw).digest('hex'), id: 'emekcan' },
41
+ { sha256: createHash('sha256').update(ownerRaw).digest('hex'), id: 'alice' },
42
42
  { sha256: createHash('sha256').update(aiRaw).digest('hex'), id: 'copilot' },
43
43
  ],
44
44
  }) + '\n')
@@ -52,38 +52,38 @@ const policy = {
52
52
  allowTables: ['public.customers'],
53
53
  maskColumns: ['*.customer_name', '*.email', '*.phone', '*.tckn', '*.iban'],
54
54
  profiles: {
55
- patron: {
55
+ owner: {
56
56
  maskColumns: ['*.email', '*.phone', '*.tckn', '*.iban'],
57
57
  maskLabelledNames: false,
58
58
  },
59
59
  },
60
- actorProfiles: { emekcan: 'patron' },
60
+ actorProfiles: { alice: 'owner' },
61
61
  }
62
62
 
63
63
  const store = loadTokenStore(tokensFile)
64
- const patron = resolveActor(patronRaw, store, 'conarium_c2')
64
+ const owner = resolveActor(ownerRaw, store, 'conarium_c2')
65
65
  const ai = resolveActor(aiRaw, store, 'conarium_c2')
66
- if (patron.assurance !== 'per-user-token' || patron.id !== 'emekcan') fail(`patron resolve: ${JSON.stringify(patron)}`)
66
+ if (owner.assurance !== 'per-user-token' || owner.id !== 'alice') fail(`owner resolve: ${JSON.stringify(owner)}`)
67
67
  if (ai.assurance !== 'per-user-token' || ai.id !== 'copilot') fail(`ai resolve: ${JSON.stringify(ai)}`)
68
68
 
69
69
  const row = { _table: 'public.customers', customer_name: 'Ayşe Yılmaz', email: 'a@b.com', city: 'İzmir' }
70
70
  const base = new Governance(policy)
71
- const asPatron = base.forActor(patron)
71
+ const asOwner = base.forActor(owner)
72
72
  const asAi = base.forActor(ai)
73
73
 
74
- const patronOut = asPatron.redact({ rows: [row], rowCount: 1, fields: Object.keys(row) })
74
+ const ownerOut = asOwner.redact({ rows: [row], rowCount: 1, fields: Object.keys(row) })
75
75
  const aiOut = asAi.redact({ rows: [row], rowCount: 1, fields: Object.keys(row) })
76
- const pName = patronOut.rows[0].customer_name
76
+ const pName = ownerOut.rows[0].customer_name
77
77
  const aName = aiOut.rows[0].customer_name
78
78
 
79
- console.log(`patron name ${pName}`)
79
+ console.log(`owner name ${pName}`)
80
80
  console.log(`ai name ${aName}`)
81
- console.log(`patron email ${patronOut.rows[0].email}`)
81
+ console.log(`owner email ${ownerOut.rows[0].email}`)
82
82
  console.log(`ai email ${aiOut.rows[0].email}`)
83
83
 
84
- if (pName !== 'Ayşe Yılmaz') fail(`patron should see the name, got ${pName}`)
84
+ if (pName !== 'Ayşe Yılmaz') fail(`owner should see the name, got ${pName}`)
85
85
  if (aName !== '[MASKED_PII]') fail(`ai should see [MASKED_PII], got ${aName}`)
86
- if (patronOut.rows[0].email !== '[MASKED_PII]' || aiOut.rows[0].email !== '[MASKED_PII]') {
86
+ if (ownerOut.rows[0].email !== '[MASKED_PII]' || aiOut.rows[0].email !== '[MASKED_PII]') {
87
87
  fail('email must stay masked for both (content scanner / remaining maskColumns)')
88
88
  }
89
89
 
@@ -92,9 +92,9 @@ audit.log({
92
92
  tool: 'query',
93
93
  target: 'public.customers',
94
94
  denied: false,
95
- actor: patron.id,
96
- actorAssurance: patron.assurance,
97
- policyProfile: asPatron.appliedProfile() || undefined,
95
+ actor: owner.id,
96
+ actorAssurance: owner.assurance,
97
+ policyProfile: asOwner.appliedProfile() || undefined,
98
98
  rowsReturned: 1,
99
99
  source: 'postgres',
100
100
  })
@@ -112,15 +112,15 @@ audit.log({
112
112
  const receipts = readFileSync(receiptSink, 'utf8').trim().split('\n').map((l) => JSON.parse(l))
113
113
  if (receipts.length !== 2) fail(`expected 2 receipts, got ${receipts.length}`)
114
114
 
115
- const [rPatron, rAi] = receipts
116
- console.log(`patron policy.id ${rPatron.policy.id}`)
117
- console.log(`patron assurance ${rPatron.actor.assurance} actor.id=${rPatron.actor.id}`)
115
+ const [rOwner, rAi] = receipts
116
+ console.log(`owner policy.id ${rOwner.policy.id}`)
117
+ console.log(`owner assurance ${rOwner.actor.assurance} actor.id=${rOwner.actor.id}`)
118
118
  console.log(`ai policy.id ${rAi.policy.id}`)
119
119
  console.log(`ai assurance ${rAi.actor.assurance} actor.id=${rAi.actor.id}`)
120
120
 
121
- if (rPatron.policy.id !== 'conarium.policy/patron') fail(`patron policy.id ${rPatron.policy.id}`)
121
+ if (rOwner.policy.id !== 'conarium.policy/owner') fail(`owner policy.id ${rOwner.policy.id}`)
122
122
  if (rAi.policy.id !== 'conarium.policy') fail(`ai (no profile) policy.id ${rAi.policy.id}`)
123
- if (rPatron.actor.assurance !== 'per-user-token' || rAi.actor.assurance !== 'per-user-token') {
123
+ if (rOwner.actor.assurance !== 'per-user-token' || rAi.actor.assurance !== 'per-user-token') {
124
124
  fail('both receipts must carry per-user-token')
125
125
  }
126
126
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conarium-ai/core",
3
- "version": "0.2.52",
3
+ "version": "0.2.54",
4
4
  "mcpName": "io.github.dogrucanemek-alt/conarium",
5
5
  "//files-artefakt": "Generated files under examples/ (private key, receipt/audit JSONL) are EXCLUDED. .gitignore does not bind npm: because the allow-list contained 'examples', `npm publish` on a machine that had run the demo was shipping _keys/audit-ed25519.pem (PRIVATE KEY) and the receipts. test/pack_artefakt.mjs locks this. The exclusions are LIMITED to examples/: receipts.jsonl and .pub.pem under test-vectors/ MUST ship, or a third party cannot run the conformance vectors.",
6
6
  "//files": "Allow-list of what enters the package. Without it npm sent everything: 296 files / 1.5 MB — CI workflows, gitleaks config, a 137 KB marketing image, the site's api/chat.js. A bank security team opens the tarball and sees those. scripts/ is here ON PURPOSE: conarium-reconcile references scripts/pg-snapshot.sql at runtime; without it the user files a support mail.",
@@ -8,6 +8,8 @@
8
8
  "dist",
9
9
  "bin",
10
10
  "scripts",
11
+ "!scripts/conarium_sabah_brief.mjs",
12
+ "!scripts/start-mcp-c1.mjs",
11
13
  "docs",
12
14
  "!docs/reviews",
13
15
  "!docs/teaching",
@@ -1,107 +0,0 @@
1
- /**
2
- * Conarium sabah brief — zion-rest queries → markdown file.
3
- * Usage: node scripts/conarium_sabah_brief.mjs
4
- * Writes: AI_GOVERNANCE/cursor_memory/sabah_conarium.md (no secrets)
5
- */
6
- import { spawn } from 'child_process'
7
- import { writeFileSync, mkdirSync, existsSync } from 'fs'
8
- import { join } from 'path'
9
-
10
- const launcher = join(
11
- 'C:/Users/emek.dogru/Desktop/projeler/Documents/conarium-public/scripts/start-mcp-c1.mjs'
12
- )
13
- const outDir = 'C:/Users/emek.dogru/AI_GOVERNANCE/cursor_memory'
14
- const outFile = join(outDir, 'sabah_conarium.md')
15
- const nodeExe = 'C:/Program Files/nodejs/node.exe'
16
-
17
- function rpc(id, method, params) {
18
- return JSON.stringify({ jsonrpc: '2.0', id, method, params }) + '\n'
19
- }
20
-
21
- function runMcp(messages) {
22
- return new Promise((resolve, reject) => {
23
- const p = spawn(nodeExe, [launcher], { stdio: ['pipe', 'pipe', 'pipe'] })
24
- let out = '', err = ''
25
- p.stdout.on('data', d => (out += d))
26
- p.stderr.on('data', d => (err += d))
27
- p.on('error', reject)
28
- setTimeout(() => {
29
- for (const m of messages) p.stdin.write(m)
30
- p.stdin.end()
31
- }, 200)
32
- setTimeout(() => {
33
- try { p.kill() } catch {}
34
- resolve({ out, err })
35
- }, 12000)
36
- })
37
- }
38
-
39
- function parseToolResults(out) {
40
- const map = {}
41
- for (const line of out.split(/\r?\n/)) {
42
- if (!line.trim()) continue
43
- let o
44
- try { o = JSON.parse(line) } catch { continue }
45
- if (o.id == null || !o.result?.content?.[0]?.text) continue
46
- const t = o.result.content[0].text
47
- if (t.startsWith('Error:')) {
48
- map[o.id] = { error: t }
49
- continue
50
- }
51
- try { map[o.id] = JSON.parse(t) } catch { map[o.id] = { raw: t.slice(0, 500) } }
52
- }
53
- return map
54
- }
55
-
56
- function fmtRows(payload, max = 8) {
57
- if (payload?.error) return `_Error: ${payload.error}_\n`
58
- const rows = payload?.rows || []
59
- if (!rows.length) return '_empty_\n'
60
- const keys = Object.keys(rows[0]).filter(k => !/phone|email|gsm|tckn/i.test(k)).slice(0, 6)
61
- const lines = ['| ' + keys.join(' | ') + ' |', '| ' + keys.map(() => '---').join(' | ') + ' |']
62
- for (const r of rows.slice(0, max)) {
63
- lines.push('| ' + keys.map(k => String(r[k] ?? '')).join(' | ') + ' |')
64
- }
65
- return lines.join('\n') + '\n'
66
- }
67
-
68
- const { out, err } = await runMcp([
69
- rpc(1, 'initialize', { protocolVersion: '2024-11-05', capabilities: {}, clientInfo: { name: 'sabah', version: '1' } }),
70
- JSON.stringify({ jsonrpc: '2.0', method: 'notifications/initialized' }) + '\n',
71
- rpc(2, 'tools/call', { name: 'query', arguments: { connector: 'zion-rest', sql: 'SELECT * FROM zion.v_dead_stock_summary LIMIT 1' } }),
72
- rpc(3, 'tools/call', { name: 'query', arguments: { connector: 'zion-rest', sql: 'SELECT * FROM zion.v_branch_summary LIMIT 10' } }),
73
- rpc(4, 'tools/call', { name: 'query', arguments: { connector: 'zion-rest', sql: 'SELECT * FROM zion.v_stock_runout LIMIT 10' } }),
74
- rpc(5, 'tools/call', { name: 'query', arguments: { connector: 'zion-rest', sql: 'SELECT * FROM zion.v_ship_summary LIMIT 1' } }),
75
- ])
76
-
77
- const r = parseToolResults(out)
78
- const now = new Date().toISOString()
79
- const md = `# Conarium morning — ${now}
80
-
81
- > Source: zion-rest (Codes sync mirror). Not live Codes. PII-masked fields omitted.
82
-
83
- ## 1) Dead stock
84
- ${fmtRows(r[2], 3)}
85
-
86
- ## 2) Branch summary
87
- ${fmtRows(r[3], 10)}
88
-
89
- ## 3) Stock runout
90
- ${fmtRows(r[4], 10)}
91
-
92
- ## 4) Shipment summary
93
- ${fmtRows(r[5], 3)}
94
-
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
-
99
- ## stderr (short)
100
- \`\`\`
101
- ${err.split('\\n').filter(l => /allow=|Connected|running|Fatal/.test(l)).slice(0, 8).join('\\n')}
102
- \`\`\`
103
- `
104
-
105
- if (!existsSync(outDir)) mkdirSync(outDir, { recursive: true })
106
- writeFileSync(outFile, md, 'utf8')
107
- console.error('[sabah] wrote', outFile)
@@ -1,93 +0,0 @@
1
- /**
2
- * C1 launcher — same-process (no nested spawn; Cursor MCP-safe).
3
- * Loads Supabase URL/key from jarvis-web .env.local, never prints secrets.
4
- */
5
- import { readFileSync, existsSync } from 'fs'
6
- import { homedir } from 'os'
7
- import { pathToFileURL } from 'url'
8
- import { dirname, join } from 'path'
9
- import { fileURLToPath } from 'url'
10
-
11
- const __dirname = dirname(fileURLToPath(import.meta.url))
12
- const root = join(__dirname, '..')
13
- const dist = join(root, 'dist', 'index.js')
14
- const configPath = join(root, 'conarium.config.c1.json')
15
- const envPath = process.env.CONARIUM_ENV_FILE ||
16
- 'C:/Users/emek.dogru/Desktop/1/X/jarvis-web/.env.local'
17
-
18
- function loadEnvFile(path) {
19
- if (!existsSync(path)) throw new Error(`env file missing: ${path}`)
20
- const out = {}
21
- for (const line of readFileSync(path, 'utf8').replace(/^\uFEFF/, '').split(/\r?\n/)) {
22
- const t = line.trim()
23
- if (!t || t.startsWith('#') || !t.includes('=')) continue
24
- const i = t.indexOf('=')
25
- const k = t.slice(0, i).trim()
26
- let v = t.slice(i + 1).trim()
27
- if ((v.startsWith('"') && v.endsWith('"')) || (v.startsWith("'") && v.endsWith("'"))) {
28
- v = v.slice(1, -1)
29
- }
30
- out[k] = v
31
- }
32
- return out
33
- }
34
-
35
- if (!existsSync(dist)) {
36
- console.error('[conarium-c1] dist/index.js missing — run npm run build')
37
- process.exit(1)
38
- }
39
- if (!existsSync(configPath)) {
40
- console.error('[conarium-c1] conarium.config.c1.json missing')
41
- process.exit(1)
42
- }
43
-
44
- const fileEnv = loadEnvFile(envPath)
45
- const url = fileEnv.NEXT_PUBLIC_SUPABASE_URL || fileEnv.SUPABASE_URL
46
- const key = fileEnv.SUPABASE_SERVICE_ROLE_KEY
47
- if (!url || !key) {
48
- console.error('[conarium-c1] NEXT_PUBLIC_SUPABASE_URL / SUPABASE_SERVICE_ROLE_KEY missing')
49
- process.exit(1)
50
- }
51
-
52
- process.env.CONARIUM_SUPABASE_URL = url
53
- process.env.CONARIUM_SUPABASE_KEY = key
54
-
55
- // receiptSink in c1 config requires Ed25519 at boot. Cursor mcp.json does not
56
- // set CONARIUM_AUDIT_SIGNING_KEY — that is why receipts-c1.jsonl never appeared
57
- // after the sink was added. Do not create an empty sink; the first governed
58
- // access writes the first line.
59
- if (!process.env.CONARIUM_AUDIT_SIGNING_KEY?.trim()) {
60
- let receiptSink = ''
61
- try {
62
- receiptSink = JSON.parse(readFileSync(configPath, 'utf8'))?.audit?.receiptSink || ''
63
- } catch { /* probe below still runs */ }
64
- if (receiptSink) {
65
- const fallback = join(homedir(), '.conarium', 'audit-ed25519.pem')
66
- if (!existsSync(fallback)) {
67
- console.error('[conarium-c1] receiptSink is set but CONARIUM_AUDIT_SIGNING_KEY is missing')
68
- console.error(`[conarium-c1] expected signing key at ${fallback}`)
69
- process.exit(1)
70
- }
71
- process.env.CONARIUM_AUDIT_SIGNING_KEY = fallback
72
- console.error(`[conarium-c1] signing key=${fallback}`)
73
- console.error('[conarium-c1] receipt file is created on the first governed access, not at start')
74
- }
75
- }
76
-
77
- // Ensure dist/index.js sees --config (it reads process.argv)
78
- process.argv = [process.argv[0], dist, '--config', configPath]
79
-
80
- // Prove which policy file this process loaded (Cursor stale-process debug).
81
- try {
82
- const cfg = JSON.parse(readFileSync(configPath, 'utf8'))
83
- const zion = (cfg.connectors || []).find(c => c.name === 'zion-rest')
84
- const n = (zion?.config?.allowTables || '').split(',').filter(Boolean).length
85
- const p = (cfg.policy?.allowTables || []).filter(t => String(t).startsWith('zion.')).length
86
- console.error(`[conarium-c1] config=${configPath}`)
87
- console.error(`[conarium-c1] zion connector allow=${n} policy zion allow=${p}`)
88
- } catch (e) {
89
- console.error('[conarium-c1] config probe failed:', e.message)
90
- }
91
-
92
- console.error('[conarium-c1] starting MCP same-process (zion-rest + docs)')
93
- await import(pathToFileURL(dist).href)