@conarium-ai/core 0.2.8 → 0.2.10

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 (82) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/LIMITATIONS.md +49 -0
  3. package/LIMITATIONS.tr.md +49 -0
  4. package/README.md +42 -4
  5. package/SECURITY.md +14 -0
  6. package/assets/conarium-mark-512.png +0 -0
  7. package/assets/conarium-mark.icns +0 -0
  8. package/assets/conarium-mark.ico +0 -0
  9. package/assets/conarium-mark.svg +4 -0
  10. package/assets/hero/eye-base.webp +0 -0
  11. package/assets/hero/iris.webp +0 -0
  12. package/bin/conarium-anchor-upgrade.mjs +10 -43
  13. package/bin/conarium-console.mjs +3 -0
  14. package/bin/conarium-doctor.mjs +13 -17
  15. package/bin/conarium-stamp.mjs +4 -13
  16. package/bin/conarium-verify.mjs +13 -62
  17. package/deploy/anchor-service/README.md +3 -4
  18. package/dist/anchor-service.d.ts.map +1 -1
  19. package/dist/anchor-service.js +11 -26
  20. package/dist/anchor-service.js.map +1 -1
  21. package/dist/anchor.d.ts +6 -31
  22. package/dist/anchor.d.ts.map +1 -1
  23. package/dist/anchor.js +15 -65
  24. package/dist/anchor.js.map +1 -1
  25. package/dist/audit.d.ts +3 -1
  26. package/dist/audit.d.ts.map +1 -1
  27. package/dist/audit.js +7 -1
  28. package/dist/audit.js.map +1 -1
  29. package/dist/config.d.ts +68 -0
  30. package/dist/config.d.ts.map +1 -1
  31. package/dist/config.js +38 -1
  32. package/dist/config.js.map +1 -1
  33. package/dist/console-shortcut.d.ts +9 -1
  34. package/dist/console-shortcut.d.ts.map +1 -1
  35. package/dist/console-shortcut.js +47 -13
  36. package/dist/console-shortcut.js.map +1 -1
  37. package/dist/console.d.ts.map +1 -1
  38. package/dist/console.js +12 -2
  39. package/dist/console.js.map +1 -1
  40. package/dist/custom_patterns.d.ts +42 -0
  41. package/dist/custom_patterns.d.ts.map +1 -0
  42. package/dist/custom_patterns.js +164 -0
  43. package/dist/custom_patterns.js.map +1 -0
  44. package/dist/governance.d.ts +7 -1
  45. package/dist/governance.d.ts.map +1 -1
  46. package/dist/governance.js +38 -13
  47. package/dist/governance.js.map +1 -1
  48. package/dist/ots/calendar.d.ts +11 -0
  49. package/dist/ots/calendar.d.ts.map +1 -0
  50. package/dist/ots/calendar.js +93 -0
  51. package/dist/ots/calendar.js.map +1 -0
  52. package/dist/ots/client.d.ts +29 -0
  53. package/dist/ots/client.d.ts.map +1 -0
  54. package/dist/ots/client.js +102 -0
  55. package/dist/ots/client.js.map +1 -0
  56. package/dist/ots/codec.d.ts +26 -0
  57. package/dist/ots/codec.d.ts.map +1 -0
  58. package/dist/ots/codec.js +92 -0
  59. package/dist/ots/codec.js.map +1 -0
  60. package/dist/ots/format.d.ts +60 -0
  61. package/dist/ots/format.d.ts.map +1 -0
  62. package/dist/ots/format.js +232 -0
  63. package/dist/ots/format.js.map +1 -0
  64. package/dist/receipt-view.d.ts +1 -0
  65. package/dist/receipt-view.d.ts.map +1 -1
  66. package/dist/receipt-view.js +25 -4
  67. package/dist/receipt-view.js.map +1 -1
  68. package/dist/server.d.ts.map +1 -1
  69. package/dist/server.js +1 -0
  70. package/dist/server.js.map +1 -1
  71. package/dist/types.d.ts +20 -0
  72. package/dist/types.d.ts.map +1 -1
  73. package/docs/security/PENTEST-SCOPE.md +90 -0
  74. package/docs/security/THREAT-MODEL.md +116 -0
  75. package/docs/specs/2026-08-14-oracle-mssql-dialect-design.md +232 -0
  76. package/package.json +6 -12
  77. package/public/app.js +43 -66
  78. package/public/index.html +2 -1
  79. package/public/receipts-panel.js +87 -0
  80. package/public/style.css +2 -4
  81. package/scripts/render-conarium-mark.py +70 -0
  82. package/scripts/start-mcp-c1.mjs +23 -0
package/public/app.js CHANGED
@@ -4,16 +4,38 @@ document.addEventListener('DOMContentLoaded', () => {
4
4
  const tabs = document.querySelectorAll('.nav-item');
5
5
  const contents = document.querySelectorAll('.tab-content');
6
6
 
7
+ function receiptUi() {
8
+ return {
9
+ chain: document.getElementById('receipt-chain'),
10
+ empty: document.getElementById('receipt-empty'),
11
+ table: document.getElementById('receipt-table'),
12
+ tbody: document.getElementById('receipt-body'),
13
+ detail: document.getElementById('receipt-detail'),
14
+ }
15
+ }
16
+
17
+ function activateTab(name) {
18
+ tabs.forEach(t => t.classList.toggle('active', t.dataset.tab === name))
19
+ contents.forEach(c => c.classList.toggle('active', c.id === 'tab-' + name))
20
+ const panel = document.getElementById('tab-' + name)
21
+ if (!panel) {
22
+ const empty = document.getElementById('receipt-empty')
23
+ if (empty && name === 'receipts') {
24
+ empty.hidden = false
25
+ empty.textContent = 'Makbuzlar alanı bulunamadı.'
26
+ }
27
+ }
28
+ }
29
+
7
30
  tabs.forEach(tab => {
8
31
  tab.addEventListener('click', (e) => {
9
32
  e.preventDefault();
10
- const targetId = `tab-${tab.dataset.tab}`;
11
-
12
- tabs.forEach(t => t.classList.remove('active'));
13
- contents.forEach(c => c.classList.remove('active'));
14
-
15
- tab.classList.add('active');
16
- document.getElementById(targetId).classList.add('active');
33
+ const name = tab.dataset.tab
34
+ activateTab(name)
35
+ if (name === 'receipts') {
36
+ ConariumReceiptsPanel.showLoading(receiptUi())
37
+ loadReceipts()
38
+ }
17
39
  });
18
40
  });
19
41
 
@@ -197,68 +219,25 @@ document.addEventListener('DOMContentLoaded', () => {
197
219
  document.getElementById('refresh-audit').addEventListener('click', loadAudit);
198
220
 
199
221
  async function loadReceipts() {
200
- const chainEl = document.getElementById('receipt-chain')
201
- const emptyEl = document.getElementById('receipt-empty')
202
- const table = document.getElementById('receipt-table')
203
- const tbody = document.getElementById('receipt-body')
204
- const detail = document.getElementById('receipt-detail')
222
+ const ui = receiptUi()
205
223
  try {
206
224
  const res = await apiFetch('/api/receipts')
207
225
  if (!res.ok) {
208
- emptyEl.hidden = false
209
- emptyEl.textContent = 'Makbuz listesi alınamadı (' + res.status + ').'
210
- chainEl.hidden = true
211
- table.hidden = true
226
+ ConariumReceiptsPanel.showError(ui, 'Makbuz listesi alınamadı (' + res.status + ').')
212
227
  return
213
228
  }
214
229
  const data = await res.json()
215
- tbody.textContent = ''
216
- const items = Array.isArray(data.items) ? data.items : []
217
- const chain = data.chain || {}
218
- if (items.length === 0) {
219
- chainEl.hidden = true
220
- table.hidden = true
221
- detail.hidden = true
222
- emptyEl.hidden = false
223
- emptyEl.textContent = data.empty || 'henüz makbuz yok'
224
- return
225
- }
226
- emptyEl.hidden = true
227
- table.hidden = false
228
- if (chain.ok === false) {
229
- chainEl.hidden = false
230
- chainEl.className = 'receipt-chain broken'
231
- chainEl.textContent = 'kırık (satır ' + chain.brokenAt + ')'
232
- } else {
233
- chainEl.hidden = false
234
- chainEl.className = 'receipt-chain ok'
235
- chainEl.textContent = 'zincir sağlam'
236
- }
237
- items.forEach(function (row) {
238
- const tr = document.createElement('tr')
239
- tr.className = 'receipt-table-row'
240
- tr.dataset.id = row.id
241
- function td(v) {
242
- const cell = document.createElement('td')
243
- cell.textContent = v == null ? '' : String(v)
244
- return cell
245
- }
246
- tr.appendChild(td(row.ts ? new Date(row.ts).toLocaleString() : ''))
247
- tr.appendChild(td(row.actor || 'unknown'))
248
- tr.appendChild(td(row.tool || ''))
249
- const dec = document.createElement('td')
250
- const badge = document.createElement('span')
251
- badge.className = 'status-badge-sm ' + (row.decision === 'deny' ? 'status-rejected' : row.decision === 'partial' ? 'status-partial' : 'status-success')
252
- badge.textContent = row.decision || ''
253
- dec.appendChild(badge)
254
- tr.appendChild(dec)
255
- tr.appendChild(td(row.maskedCount == null ? '' : String(row.maskedCount)))
256
- tr.appendChild(td(row.seq == null ? '' : String(row.seq)))
257
- tr.addEventListener('click', function () { openReceipt(row.id, tr) })
258
- tbody.appendChild(tr)
230
+ ConariumReceiptsPanel.render(ui, data, {
231
+ tr: function () { return document.createElement('tr') },
232
+ td: function () { return document.createElement('td') },
233
+ span: function () { return document.createElement('span') },
234
+ formatTime: function (ts) { return new Date(ts).toLocaleString() },
235
+ onRow: function (tr, row) {
236
+ tr.addEventListener('click', function () { openReceipt(row.id, tr) })
237
+ },
259
238
  })
260
239
  } catch (e) {
261
- console.error('Failed to load receipts', e)
240
+ ConariumReceiptsPanel.showError(ui, 'Makbuz listesi alınamadı.')
262
241
  }
263
242
  }
264
243
 
@@ -286,11 +265,9 @@ document.addEventListener('DOMContentLoaded', () => {
286
265
  }
287
266
 
288
267
  const refreshReceipts = document.getElementById('refresh-receipts')
289
- if (refreshReceipts) refreshReceipts.addEventListener('click', loadReceipts)
290
- document.querySelectorAll('.nav-item').forEach(function (tab) {
291
- tab.addEventListener('click', function () {
292
- if (tab.dataset.tab === 'receipts') loadReceipts()
293
- })
268
+ if (refreshReceipts) refreshReceipts.addEventListener('click', function () {
269
+ ConariumReceiptsPanel.showLoading(receiptUi())
270
+ loadReceipts()
294
271
  })
295
272
 
296
273
  // Load Connectors
package/public/index.html CHANGED
@@ -12,7 +12,7 @@
12
12
  <!-- Sidebar -->
13
13
  <aside class="sidebar glass-panel">
14
14
  <div class="logo">
15
- <div class="logo-icon"></div>
15
+ <img class="logo-mark" src="/assets/conarium-mark.svg" width="32" height="32" alt="">
16
16
  <h2>Conarium</h2>
17
17
  </div>
18
18
  <nav>
@@ -154,6 +154,7 @@
154
154
  <!-- Notification Toast -->
155
155
  <div id="toast" class="toast">Saved successfully</div>
156
156
 
157
+ <script src="receipts-panel.js"></script>
157
158
  <script src="app.js"></script>
158
159
  </body>
159
160
  </html>
@@ -0,0 +1,87 @@
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.
4
+ */
5
+ (function (root) {
6
+ function showLoading(ui) {
7
+ ui.chain.hidden = true
8
+ ui.table.hidden = true
9
+ ui.detail.hidden = true
10
+ ui.empty.hidden = false
11
+ ui.empty.textContent = 'Yükleniyor…'
12
+ }
13
+
14
+ function showError(ui, message) {
15
+ ui.chain.hidden = true
16
+ ui.table.hidden = true
17
+ ui.detail.hidden = true
18
+ ui.empty.hidden = false
19
+ ui.empty.textContent = message
20
+ }
21
+
22
+ function showEmpty(ui, message) {
23
+ ui.chain.hidden = true
24
+ ui.table.hidden = true
25
+ ui.detail.hidden = true
26
+ ui.empty.hidden = false
27
+ ui.empty.textContent = message || 'henüz makbuz yok'
28
+ }
29
+
30
+ function showList(ui, data, make) {
31
+ const items = Array.isArray(data.items) ? data.items : []
32
+ const chain = data.chain || {}
33
+ ui.empty.hidden = true
34
+ ui.table.hidden = false
35
+ ui.tbody.textContent = ''
36
+ if (chain.ok === false) {
37
+ ui.chain.hidden = false
38
+ ui.chain.className = 'receipt-chain broken'
39
+ ui.chain.textContent = 'kırık (satır ' + chain.brokenAt + ')'
40
+ } else {
41
+ ui.chain.hidden = false
42
+ ui.chain.className = 'receipt-chain ok'
43
+ ui.chain.textContent = 'zincir sağlam'
44
+ }
45
+ items.forEach(function (row) {
46
+ const tr = make.tr()
47
+ tr.className = 'receipt-table-row'
48
+ tr.dataset.id = row.id
49
+ function td(v) {
50
+ const cell = make.td()
51
+ cell.textContent = v == null ? '' : String(v)
52
+ return cell
53
+ }
54
+ tr.appendChild(td(row.ts ? make.formatTime(row.ts) : ''))
55
+ tr.appendChild(td(row.actor || 'unknown'))
56
+ tr.appendChild(td(row.tool || ''))
57
+ const dec = make.td()
58
+ const badge = make.span()
59
+ badge.className =
60
+ 'status-badge-sm ' +
61
+ (row.decision === 'deny' ? 'status-rejected' : row.decision === 'partial' ? 'status-partial' : 'status-success')
62
+ badge.textContent = row.decision || ''
63
+ dec.appendChild(badge)
64
+ tr.appendChild(dec)
65
+ tr.appendChild(td(row.maskedCount == null ? '' : String(row.maskedCount)))
66
+ tr.appendChild(td(row.seq == null ? '' : String(row.seq)))
67
+ if (make.onRow) make.onRow(tr, row)
68
+ ui.tbody.appendChild(tr)
69
+ })
70
+ }
71
+
72
+ function render(ui, data, make) {
73
+ if (!data || data.error) {
74
+ showError(ui, (data && data.error) || 'Makbuz listesi alınamadı.')
75
+ return 'error'
76
+ }
77
+ const items = Array.isArray(data.items) ? data.items : []
78
+ if (items.length === 0) {
79
+ showEmpty(ui, data.empty)
80
+ return 'empty'
81
+ }
82
+ showList(ui, data, make)
83
+ return 'list'
84
+ }
85
+
86
+ root.ConariumReceiptsPanel = { showLoading, showError, showEmpty, showList, render }
87
+ })(typeof window !== 'undefined' ? window : globalThis)
package/public/style.css CHANGED
@@ -57,12 +57,10 @@ body {
57
57
  gap: 1rem;
58
58
  }
59
59
 
60
- .logo-icon {
60
+ .logo-mark {
61
61
  width: 32px;
62
62
  height: 32px;
63
- background: linear-gradient(135deg, #3b82f6, #8b5cf6);
64
- border-radius: 8px;
65
- box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
63
+ display: block;
66
64
  }
67
65
 
68
66
  .sidebar nav {
@@ -0,0 +1,70 @@
1
+ """Rasterize assets/conarium-mark.svg geometry. No redesign — same circles, same #fff."""
2
+ from __future__ import annotations
3
+
4
+ import struct
5
+ from io import BytesIO
6
+ from pathlib import Path
7
+
8
+ from PIL import Image, ImageDraw
9
+
10
+ ROOT = Path(__file__).resolve().parents[1]
11
+ ASSETS = ROOT / "assets"
12
+ # viewBox 0 0 32 32 — exact numbers from the extracted mark
13
+ CX, CY, R_RING, STROKE, R_DOT = 16.0, 16.0, 9.0, 1.7, 3.4
14
+ FILL = (255, 255, 255, 255)
15
+
16
+
17
+ def render(size: int) -> Image.Image:
18
+ img = Image.new("RGBA", (size, size), (0, 0, 0, 0))
19
+ draw = ImageDraw.Draw(img)
20
+ s = size / 32.0
21
+ cx, cy = CX * s, CY * s
22
+ r = R_RING * s
23
+ sw = max(STROKE * s, 1.0)
24
+ # Pillow ellipse outline is centered on the path; match SVG stroke.
25
+ outer = (cx - r - sw / 2, cy - r - sw / 2, cx + r + sw / 2, cy + r + sw / 2)
26
+ inner = (cx - r + sw / 2, cy - r + sw / 2, cx + r - sw / 2, cy + r - sw / 2)
27
+ draw.ellipse(outer, fill=FILL)
28
+ draw.ellipse(inner, fill=(0, 0, 0, 0))
29
+ rd = R_DOT * s
30
+ draw.ellipse((cx - rd, cy - rd, cx + rd, cy + rd), fill=FILL)
31
+ return img
32
+
33
+
34
+ def png_bytes(img: Image.Image) -> bytes:
35
+ buf = BytesIO()
36
+ img.save(buf, format="PNG")
37
+ return buf.getvalue()
38
+
39
+
40
+ def write_icns(path: Path, pngs: dict[bytes, bytes]) -> None:
41
+ """Minimal ICNS with PNG media (icp5/icp6/ic07/ic08/ic09)."""
42
+ chunks = b""
43
+ for typ, data in pngs.items():
44
+ chunks += typ + struct.pack(">I", 8 + len(data)) + data
45
+ path.write_bytes(b"icns" + struct.pack(">I", 8 + len(chunks)) + chunks)
46
+
47
+
48
+ def main() -> None:
49
+ ASSETS.mkdir(exist_ok=True)
50
+ sizes = (16, 32, 48, 64, 128, 256, 512)
51
+ rasters = {n: render(n) for n in sizes}
52
+ rasters[512].save(ASSETS / "conarium-mark-512.png")
53
+ rasters[256].save(ASSETS / "conarium-mark.ico", format="ICO", sizes=[(n, n) for n in (16, 32, 48, 64, 128, 256)])
54
+ write_icns(
55
+ ASSETS / "conarium-mark.icns",
56
+ {
57
+ b"icp5": png_bytes(rasters[32]),
58
+ b"icp6": png_bytes(rasters[64]),
59
+ b"ic07": png_bytes(rasters[128]),
60
+ b"ic08": png_bytes(rasters[256]),
61
+ b"ic09": png_bytes(rasters[512]),
62
+ },
63
+ )
64
+ print("wrote", ASSETS / "conarium-mark-512.png")
65
+ print("wrote", ASSETS / "conarium-mark.ico")
66
+ print("wrote", ASSETS / "conarium-mark.icns")
67
+
68
+
69
+ if __name__ == "__main__":
70
+ main()
@@ -3,6 +3,7 @@
3
3
  * Loads Supabase URL/key from jarvis-web .env.local, never prints secrets.
4
4
  */
5
5
  import { readFileSync, existsSync } from 'fs'
6
+ import { homedir } from 'os'
6
7
  import { pathToFileURL } from 'url'
7
8
  import { dirname, join } from 'path'
8
9
  import { fileURLToPath } from 'url'
@@ -51,6 +52,28 @@ if (!url || !key) {
51
52
  process.env.CONARIUM_SUPABASE_URL = url
52
53
  process.env.CONARIUM_SUPABASE_KEY = key
53
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
+
54
77
  // Ensure dist/index.js sees --config (it reads process.argv)
55
78
  process.argv = [process.argv[0], dist, '--config', configPath]
56
79