@conarium-ai/core 0.2.11 → 0.2.13

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 (136) hide show
  1. package/CHANGELOG.md +149 -1
  2. package/LICENSE +21 -21
  3. package/LIMITATIONS.md +36 -2
  4. package/LIMITATIONS.tr.md +25 -2
  5. package/SECURITY.md +1 -0
  6. package/bin/conarium-coverage.mjs +89 -6
  7. package/bin/conarium-doctor.mjs +62 -0
  8. package/bin/conarium-verify.mjs +110 -51
  9. package/dist/anchor.d.ts +11 -0
  10. package/dist/anchor.d.ts.map +1 -1
  11. package/dist/anchor.js +27 -0
  12. package/dist/anchor.js.map +1 -1
  13. package/dist/audit.d.ts +4 -0
  14. package/dist/audit.d.ts.map +1 -1
  15. package/dist/audit.js +136 -33
  16. package/dist/audit.js.map +1 -1
  17. package/dist/config.d.ts +28 -8
  18. package/dist/config.d.ts.map +1 -1
  19. package/dist/config.js +51 -1
  20. package/dist/config.js.map +1 -1
  21. package/dist/connectors/custom-sql.d.ts +22 -0
  22. package/dist/connectors/custom-sql.d.ts.map +1 -0
  23. package/dist/connectors/custom-sql.js +67 -0
  24. package/dist/connectors/custom-sql.js.map +1 -0
  25. package/dist/connectors/index.d.ts +1 -0
  26. package/dist/connectors/index.d.ts.map +1 -1
  27. package/dist/connectors/index.js +5 -1
  28. package/dist/connectors/index.js.map +1 -1
  29. package/dist/connectors/openapi.d.ts +14 -1
  30. package/dist/connectors/openapi.d.ts.map +1 -1
  31. package/dist/connectors/openapi.js +78 -6
  32. package/dist/connectors/openapi.js.map +1 -1
  33. package/dist/connectors/postgres.js +8 -8
  34. package/dist/connectors/supabase_rest.d.ts.map +1 -1
  35. package/dist/connectors/supabase_rest.js +0 -1
  36. package/dist/connectors/supabase_rest.js.map +1 -1
  37. package/dist/console-receipts.d.ts +12 -1
  38. package/dist/console-receipts.d.ts.map +1 -1
  39. package/dist/console-receipts.js +14 -2
  40. package/dist/console-receipts.js.map +1 -1
  41. package/dist/console.d.ts.map +1 -1
  42. package/dist/console.js +15 -4
  43. package/dist/console.js.map +1 -1
  44. package/dist/coverage.d.ts +17 -1
  45. package/dist/coverage.d.ts.map +1 -1
  46. package/dist/coverage.js +30 -3
  47. package/dist/coverage.js.map +1 -1
  48. package/dist/digit_pii.d.ts.map +1 -1
  49. package/dist/digit_pii.js +24 -5
  50. package/dist/digit_pii.js.map +1 -1
  51. package/dist/executor.d.ts.map +1 -1
  52. package/dist/executor.js +0 -1
  53. package/dist/executor.js.map +1 -1
  54. package/dist/governance.d.ts +2 -0
  55. package/dist/governance.d.ts.map +1 -1
  56. package/dist/governance.js +23 -8
  57. package/dist/governance.js.map +1 -1
  58. package/dist/http.d.ts +11 -1
  59. package/dist/http.d.ts.map +1 -1
  60. package/dist/http.js +87 -7
  61. package/dist/http.js.map +1 -1
  62. package/dist/iban.d.ts.map +1 -1
  63. package/dist/iban.js +6 -3
  64. package/dist/iban.js.map +1 -1
  65. package/dist/index.js +1 -0
  66. package/dist/index.js.map +1 -1
  67. package/dist/keys.d.ts +5 -0
  68. package/dist/keys.d.ts.map +1 -1
  69. package/dist/keys.js +22 -7
  70. package/dist/keys.js.map +1 -1
  71. package/dist/mask-text.d.ts +11 -0
  72. package/dist/mask-text.d.ts.map +1 -0
  73. package/dist/mask-text.js +42 -0
  74. package/dist/mask-text.js.map +1 -0
  75. package/dist/receipt-view.d.ts +13 -0
  76. package/dist/receipt-view.d.ts.map +1 -1
  77. package/dist/receipt-view.js +28 -5
  78. package/dist/receipt-view.js.map +1 -1
  79. package/dist/search_policy.d.ts.map +1 -1
  80. package/dist/search_policy.js +8 -4
  81. package/dist/search_policy.js.map +1 -1
  82. package/dist/server.d.ts.map +1 -1
  83. package/dist/server.js +111 -20
  84. package/dist/server.js.map +1 -1
  85. package/dist/sql-executor.d.ts +14 -0
  86. package/dist/sql-executor.d.ts.map +1 -0
  87. package/dist/sql-executor.js +75 -0
  88. package/dist/sql-executor.js.map +1 -0
  89. package/dist/sql-gate/mssql.d.ts.map +1 -1
  90. package/dist/sql-gate/mssql.js +36 -2
  91. package/dist/sql-gate/mssql.js.map +1 -1
  92. package/dist/sql-gate/oracle.d.ts.map +1 -1
  93. package/dist/sql-gate/oracle.js +24 -3
  94. package/dist/sql-gate/oracle.js.map +1 -1
  95. package/dist/sql-gate/rules.d.ts +19 -1
  96. package/dist/sql-gate/rules.d.ts.map +1 -1
  97. package/dist/sql-gate/rules.js +116 -7
  98. package/dist/sql-gate/rules.js.map +1 -1
  99. package/dist/table-unavailable.d.ts +12 -0
  100. package/dist/table-unavailable.d.ts.map +1 -0
  101. package/dist/table-unavailable.js +32 -0
  102. package/dist/table-unavailable.js.map +1 -0
  103. package/dist/types.d.ts +10 -3
  104. package/dist/types.d.ts.map +1 -1
  105. package/docs/API-STABILITY.md +4 -4
  106. package/docs/ARCHITECTURE.md +42 -42
  107. package/docs/BENCHMARK.md +20 -0
  108. package/docs/RECEIPT-SPEC.md +17 -11
  109. package/docs/benchmarks/concurrency-20260814.json +38 -0
  110. package/docs/plans/2026-07-02-redteam-harness.md +416 -416
  111. package/docs/security/NPM-PROVENANCE.md +64 -0
  112. package/docs/security/THREAT-MODEL.md +18 -0
  113. package/docs/specs/2026-07-02-redteam-harness-design.md +90 -90
  114. package/docs/superpowers/TODO-gate1-f4.md +23 -23
  115. package/docs/superpowers/plans/2026-07-29-conarium-receipt-plan.md +200 -200
  116. package/docs/superpowers/specs/2026-07-29-conarium-receipt-design.md +202 -202
  117. package/examples/claude-desktop-config.json +9 -9
  118. package/examples/cursor-mcp-settings.json +10 -10
  119. package/examples/custom-sql/README.md +50 -0
  120. package/examples/custom-sql/conarium.config.json +22 -0
  121. package/examples/custom-sql/memory-executor.mjs +16 -0
  122. package/package.json +8 -4
  123. package/public/app.js +378 -378
  124. package/public/index.html +160 -160
  125. package/public/style.css +504 -504
  126. package/scripts/benchmark-concurrency.mjs +133 -0
  127. package/scripts/conarium_sabah_brief.mjs +107 -107
  128. package/scripts/start-mcp-c1.mjs +93 -93
  129. package/test-vectors/sql-gate/LAST-RUN.json +1 -1
  130. package/test-vectors/sql-gate/vectors.json +28 -0
  131. package/dist/openapi_connector.d.ts +0 -6
  132. package/dist/openapi_connector.d.ts.map +0 -1
  133. package/dist/openapi_connector.js +0 -145
  134. package/dist/openapi_connector.js.map +0 -1
  135. package/docs/audit/2026-08-14-security-scan.md +0 -48
  136. package/docs/audit/2026-08-14-surface-sync.md +0 -34
@@ -0,0 +1,133 @@
1
+ /**
2
+ * In-process concurrency + audit-chain race. Does not touch Hetzner.
3
+ * Hardware is recorded with the numbers. Not a formal load test.
4
+ */
5
+ import { cpus, totalmem, platform, release } from 'os'
6
+ import { mkdtempSync, readFileSync, writeFileSync, mkdirSync } from 'fs'
7
+ import { tmpdir } from 'os'
8
+ import { join, dirname } from 'path'
9
+ import { fileURLToPath } from 'url'
10
+ import { CallToolRequestSchema } from '@modelcontextprotocol/sdk/types.js'
11
+ import { buildServer } from '../dist/server.js'
12
+ import { Audit } from '../dist/audit.js'
13
+ import { Governance } from '../dist/governance.js'
14
+
15
+ const N = Number(process.env.CONARIUM_BENCH_N || 50)
16
+ const PREV = process.env.CONARIUM_AUDIT_UNSIGNED
17
+ process.env.CONARIUM_AUDIT_UNSIGNED = '1'
18
+
19
+ const conn = {
20
+ name: 'mem',
21
+ description: 'concurrency fixture',
22
+ capabilities: { canQuery: true, canListSchema: false, canDescribeTable: false, canSearch: false },
23
+ connect: async () => {},
24
+ disconnect: async () => {},
25
+ listTables: async () => [],
26
+ describeTable: async (t) => ({ name: t, schema: 'public', columns: [] }),
27
+ query: async (sql) => {
28
+ await new Promise((r) => setImmediate(r))
29
+ return { rows: [{ id: 1, email: 'a@b.com' }], rowCount: 1, fields: ['id', 'email'] }
30
+ },
31
+ search: async () => ({ rows: [], rowCount: 0, fields: [] }),
32
+ }
33
+
34
+ const dir = mkdtempSync(join(tmpdir(), 'conarium-conc-'))
35
+ const sink = join(dir, 'audit.jsonl')
36
+ const deps = {
37
+ config: { serverName: 'bench', consumer: 'conc', connectors: [] },
38
+ governance: new Governance({
39
+ allowConnectors: ['mem'],
40
+ allowTables: ['public.customers'],
41
+ maskColumns: ['*.email'],
42
+ maxRows: 50,
43
+ dialect: 'postgres',
44
+ }),
45
+ audit: new Audit({ consumer: 'conc', sink }),
46
+ connectors: [conn],
47
+ }
48
+ const server = buildServer(deps)
49
+ const handlers = server._requestHandlers
50
+ const call = handlers.get(CallToolRequestSchema.shape.method.value)
51
+
52
+ function pct(sorted, p) {
53
+ if (!sorted.length) return null
54
+ const i = Math.min(sorted.length - 1, Math.ceil((p / 100) * sorted.length) - 1)
55
+ return sorted[i]
56
+ }
57
+
58
+ const t0 = process.hrtime.bigint()
59
+ const heap0 = process.memoryUsage()
60
+ const started = Date.now()
61
+ const results = await Promise.all(
62
+ Array.from({ length: N }, async () => {
63
+ const a = process.hrtime.bigint()
64
+ const out = await call({
65
+ method: 'tools/call',
66
+ params: { name: 'query', arguments: { sql: 'SELECT id, email FROM public.customers' } },
67
+ })
68
+ const ms = Number(process.hrtime.bigint() - a) / 1e6
69
+ return { ms, isError: Boolean(out.isError) }
70
+ }),
71
+ )
72
+ const wallMs = Date.now() - started
73
+ const heap1 = process.memoryUsage()
74
+
75
+ const times = results.map((r) => r.ms).sort((a, b) => a - b)
76
+ const errors = results.filter((r) => r.isError).length
77
+ const lines = readFileSync(sink, 'utf8').trim().split('\n').filter(Boolean).map((l) => JSON.parse(l))
78
+ const prevBreaks = []
79
+ for (let i = 1; i < lines.length; i++) {
80
+ if (lines[i].prevHash !== lines[i - 1].hash) prevBreaks.push(i + 1)
81
+ }
82
+
83
+ const auditA = new Audit({ consumer: 'race-a', sink: join(dir, 'race.jsonl') })
84
+ const auditB = new Audit({ consumer: 'race-b', sink: join(dir, 'race.jsonl') })
85
+ // Two instances, interleaved only at await boundaries — log() itself is sync.
86
+ await Promise.all([
87
+ (async () => { await new Promise((r) => setImmediate(r)); auditA.log({ tool: 'q', denied: false }) })(),
88
+ (async () => { await new Promise((r) => setImmediate(r)); auditB.log({ tool: 'q', denied: false }) })(),
89
+ ])
90
+ const raceLines = readFileSync(join(dir, 'race.jsonl'), 'utf8').trim().split('\n').filter(Boolean).map((l) => JSON.parse(l))
91
+ const raceBreaks = []
92
+ for (let i = 1; i < raceLines.length; i++) {
93
+ if (raceLines[i].prevHash !== raceLines[i - 1].hash) raceBreaks.push(i + 1)
94
+ }
95
+
96
+ const huge = await call({
97
+ method: 'tools/call',
98
+ params: { name: 'query', arguments: { sql: 'SELECT ' + 'x,'.repeat(200) + 'id FROM public.customers' } },
99
+ })
100
+
101
+ const report = {
102
+ when: new Date().toISOString(),
103
+ hardware: {
104
+ cpu: cpus()[0]?.model,
105
+ cores: cpus().length,
106
+ ramBytes: totalmem(),
107
+ os: `${platform()} ${release()}`,
108
+ node: process.version,
109
+ },
110
+ n: N,
111
+ wallMs,
112
+ latencyMs: { p50: pct(times, 50), p95: pct(times, 95), p99: pct(times, 99), min: times[0], max: times[times.length - 1] },
113
+ errorRate: errors / N,
114
+ chain: { entries: lines.length, prevHashBreaks: prevBreaks },
115
+ twoInstanceRace: { entries: raceLines.length, prevHashBreaks: raceBreaks },
116
+ heap: {
117
+ heapUsed0: heap0.heapUsed,
118
+ heapUsed1: heap1.heapUsed,
119
+ delta: heap1.heapUsed - heap0.heapUsed,
120
+ },
121
+ hugeSql: { isError: Boolean(huge.isError), preview: String(huge.content?.[0]?.text || '').slice(0, 120) },
122
+ elapsedNs: Number(process.hrtime.bigint() - t0),
123
+ }
124
+
125
+ const outDir = join(dirname(fileURLToPath(import.meta.url)), '..', 'docs', 'benchmarks')
126
+ mkdirSync(outDir, { recursive: true })
127
+ const outPath = join(outDir, 'concurrency-20260814.json')
128
+ writeFileSync(outPath, JSON.stringify(report, null, 2) + '\n')
129
+ console.log(JSON.stringify(report, null, 2))
130
+ console.log(`wrote ${outPath}`)
131
+
132
+ if (PREV === undefined) delete process.env.CONARIUM_AUDIT_UNSIGNED
133
+ else process.env.CONARIUM_AUDIT_UNSIGNED = PREV
@@ -1,107 +1,107 @@
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 `_Hata: ${payload.error}_\n`
58
- const rows = payload?.rows || []
59
- if (!rows.length) return '_boş_\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 sabah — ${now}
80
-
81
- > Kaynak: zion-rest (Codes sync aynası). Canlı Codes değil. PII maskeli alanlar atlandı.
82
-
83
- ## 1) Ölü stok
84
- ${fmtRows(r[2], 3)}
85
-
86
- ## 2) Şube özet
87
- ${fmtRows(r[3], 10)}
88
-
89
- ## 3) Stock runout
90
- ${fmtRows(r[4], 10)}
91
-
92
- ## 4) Sevk özet
93
- ${fmtRows(r[5], 3)}
94
-
95
- ## Not
96
- - |marj| uçuksa önce maliyet/veri_hatası hipotezi.
97
- - 3 hamleyi Agent skill \`conarium-sabah\` ile yorumla.
98
-
99
- ## stderr (kısa)
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
+ /**
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 `_Hata: ${payload.error}_\n`
58
+ const rows = payload?.rows || []
59
+ if (!rows.length) return '_boş_\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 sabah — ${now}
80
+
81
+ > Kaynak: zion-rest (Codes sync aynası). Canlı Codes değil. PII maskeli alanlar atlandı.
82
+
83
+ ## 1) Ölü stok
84
+ ${fmtRows(r[2], 3)}
85
+
86
+ ## 2) Şube özet
87
+ ${fmtRows(r[3], 10)}
88
+
89
+ ## 3) Stock runout
90
+ ${fmtRows(r[4], 10)}
91
+
92
+ ## 4) Sevk özet
93
+ ${fmtRows(r[5], 3)}
94
+
95
+ ## Not
96
+ - |marj| uçuksa önce maliyet/veri_hatası hipotezi.
97
+ - 3 hamleyi Agent skill \`conarium-sabah\` ile yorumla.
98
+
99
+ ## stderr (kısa)
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 +1,93 @@
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)
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)
@@ -7,5 +7,5 @@
7
7
  "crashed": 0,
8
8
  "bypasses": 0,
9
9
  "result": "bulunamadi",
10
- "when": "2026-08-14T17:35:25.099Z"
10
+ "when": "2026-08-14T23:30:36.601Z"
11
11
  }
@@ -317,6 +317,34 @@
317
317
  "oracle": " "
318
318
  }
319
319
  },
320
+ {
321
+ "id": "deny-string-agg",
322
+ "class": "dump-fn",
323
+ "expect": "deny",
324
+ "sql": {
325
+ "postgres": "SELECT STRING_AGG(email, ',') FROM public.customers",
326
+ "mssql": "SELECT STRING_AGG(email, ',') FROM dbo.customers",
327
+ "oracle": "SELECT LISTAGG(email, ',') WITHIN GROUP (ORDER BY email) FROM app.customers"
328
+ }
329
+ },
330
+ {
331
+ "id": "deny-user-fn",
332
+ "class": "dump-fn",
333
+ "expect": "deny",
334
+ "sql": {
335
+ "postgres": "SELECT app.pkg.fn(id) FROM public.customers",
336
+ "mssql": "SELECT dbo.fn_x(id) FROM dbo.customers",
337
+ "oracle": "SELECT app.pkg.fn(id) FROM app.customers"
338
+ }
339
+ },
340
+ {
341
+ "id": "deny-updlock",
342
+ "class": "locking-hint",
343
+ "expect": "deny",
344
+ "sql": {
345
+ "mssql": "SELECT id FROM dbo.customers WITH (UPDLOCK)"
346
+ }
347
+ },
320
348
  {
321
349
  "id": "fail-two-statements",
322
350
  "class": "fail-closed",
@@ -1,6 +0,0 @@
1
- import { Tool } from '@modelcontextprotocol/sdk/types.js';
2
- /**
3
- * Parses an OpenAPI spec and returns a list of MCP Tool definitions.
4
- */
5
- export declare function generateMcpToolsFromSpec(source: string): Promise<Tool[]>;
6
- //# sourceMappingURL=openapi_connector.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"openapi_connector.d.ts","sourceRoot":"","sources":["../src/openapi_connector.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAsH1D;;GAEG;AACH,wBAAsB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAkC9E"}