@conarium-ai/core 0.2.7 → 0.2.8

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 (42) hide show
  1. package/CHANGELOG.md +12 -1
  2. package/README.md +34 -0
  3. package/bin/conarium-console.mjs +86 -4
  4. package/dist/console-handoff.d.ts +24 -0
  5. package/dist/console-handoff.d.ts.map +1 -0
  6. package/dist/console-handoff.js +49 -0
  7. package/dist/console-handoff.js.map +1 -0
  8. package/dist/console-notify.d.ts +6 -0
  9. package/dist/console-notify.d.ts.map +1 -0
  10. package/dist/console-notify.js +41 -0
  11. package/dist/console-notify.js.map +1 -0
  12. package/dist/console-ready.d.ts +5 -0
  13. package/dist/console-ready.d.ts.map +1 -0
  14. package/dist/console-ready.js +27 -0
  15. package/dist/console-ready.js.map +1 -0
  16. package/dist/console-receipts.d.ts +30 -0
  17. package/dist/console-receipts.d.ts.map +1 -0
  18. package/dist/console-receipts.js +137 -0
  19. package/dist/console-receipts.js.map +1 -0
  20. package/dist/console-shortcut.d.ts +49 -0
  21. package/dist/console-shortcut.d.ts.map +1 -0
  22. package/dist/console-shortcut.js +176 -0
  23. package/dist/console-shortcut.js.map +1 -0
  24. package/dist/console.d.ts +4 -0
  25. package/dist/console.d.ts.map +1 -1
  26. package/dist/console.js +121 -18
  27. package/dist/console.js.map +1 -1
  28. package/dist/http.d.ts.map +1 -1
  29. package/dist/http.js +9 -0
  30. package/dist/http.js.map +1 -1
  31. package/dist/receipt-view.d.ts +89 -0
  32. package/dist/receipt-view.d.ts.map +1 -0
  33. package/dist/receipt-view.js +317 -0
  34. package/dist/receipt-view.js.map +1 -0
  35. package/dist/receipt.d.ts +14 -0
  36. package/dist/receipt.d.ts.map +1 -1
  37. package/dist/receipt.js +39 -0
  38. package/dist/receipt.js.map +1 -1
  39. package/package.json +2 -2
  40. package/public/app.js +119 -7
  41. package/public/index.html +28 -0
  42. package/public/style.css +16 -0
package/CHANGELOG.md CHANGED
@@ -2,7 +2,18 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
- Nothing yet — 0.2.7 is the current cut.
5
+ - **Console Makbuzlar tab.** Lists `audit.receiptSink` newest-first, opens the
6
+ same receipt HTML as `/proof`, and writes **zincir sağlam** / **kırık (satır N)**.
7
+ Renderer is `src/receipt-view.ts` — demo must not keep a second copy.
8
+ - **`conarium-console --install-shortcut` / `--uninstall-shortcut`.**
9
+ Desktop / Applications / XDG launcher for the existing loopback console.
10
+ Double-click waits until the port listens, then opens the browser with a
11
+ one-time `/handoff` nonce (≤30s). The long-lived token is not put in the
12
+ URL. Auth and CSRF are unchanged for Bearer clients.
13
+ - **HTTP gateway returns 404 (plain text) for `/.well-known/*`.** Public
14
+ demo has no OAuth. A 302+HTML catch-all made MCP clients treat the
15
+ redirect body as authorization-server metadata. Caddy must still 404
16
+ these paths before its catch-all; this is defense in depth.
6
17
 
7
18
  ## 0.2.7 — 2026-08-14
8
19
 
package/README.md CHANGED
@@ -380,6 +380,40 @@ npm start
380
380
  `conarium-init` refuses to overwrite existing files unless you pass `--force`.
381
381
  It never prints the private key — only its path.
382
382
 
383
+ ### Desktop shortcut for the console
384
+
385
+ The policy editor is `npx conarium-console`. It still binds `127.0.0.1` and
386
+ still requires a token. These two commands only add a door on the desktop:
387
+
388
+ ```bash
389
+ npx conarium-console --install-shortcut
390
+ npx conarium-console --uninstall-shortcut
391
+ ```
392
+
393
+ | | |
394
+ |--|--|
395
+ | Windows | `.lnk` on the desktop (console window minimized) |
396
+ | macOS | `~/Applications/Conarium Console.app` |
397
+ | Linux | `~/.local/share/applications/conarium-console.desktop` |
398
+
399
+ Double-click starts the same console, waits until the port is listening, then
400
+ opens your browser. The token is not put in the URL; a one-time nonce (≤30s)
401
+ is exchanged for a session cookie. If a shortcut with that name already exists,
402
+ a `-2` suffix is used instead of overwriting.
403
+
404
+ Export `CONARIUM_CONSOLE_TOKEN` before `--install-shortcut` so the launcher
405
+ can read it from `~/.conarium/console.token` (created `0600`). The shortcut
406
+ file itself does not contain the token.
407
+
408
+ No `.ico` / `.icns` / 512px PNG ships in this package yet, so the shortcut
409
+ has no custom icon.
410
+
411
+ The console **Makbuzlar** tab lists signed receipts from `audit.receiptSink`
412
+ (newest first) and shows the same receipt HTML as `demo.conarium.dev/proof`.
413
+ It verifies the hash chain and writes **zincir sağlam** or **kırık (satır N)**.
414
+ If the sink is empty or unset, it says so — it does not invent a sample
415
+ receipt. Audit Logs remain the unsigned playground trail; they are not receipts.
416
+
383
417
  When the package is on npm, the same binaries will ship in the tarball
384
418
  (`conarium-init`, `conarium-doctor`, `conarium-verify`, `conarium-suggest-policy`).
385
419
  Until then, run them from this repository as above.
@@ -44,9 +44,13 @@ if (has('--help') || has('-h')) {
44
44
  the same file the gateway reads)
45
45
  --port <n> default 3000 (or CONARIUM_CONSOLE_PORT)
46
46
  --host <ip> default 127.0.0.1 (or CONARIUM_CONSOLE_HOST)
47
+ --install-shortcut put a desktop / Applications / .desktop launcher
48
+ --uninstall-shortcut remove the launcher this command created
49
+ --launch start, wait until the port listens, open the browser
50
+ (used by the shortcut; do not put a token in the URL)
47
51
  --help this text
48
52
 
49
- Required:
53
+ Required to start (not to install a shortcut):
50
54
  CONARIUM_CONSOLE_TOKEN bearer token for every request
51
55
  Optional:
52
56
  CONARIUM_CONSOLE_CSRF_TOKEN defaults to the console token
@@ -65,6 +69,8 @@ const die = (code, msg, fix) => {
65
69
 
66
70
  const pkgRoot = dirname(dirname(fileURLToPath(import.meta.url)))
67
71
  const consoleJs = join(pkgRoot, 'dist', 'console.js')
72
+ const shortcutJs = join(pkgRoot, 'dist', 'console-shortcut.js')
73
+ const thisBin = fileURLToPath(import.meta.url)
68
74
  if (!existsSync(consoleJs)) {
69
75
  die(
70
76
  2,
@@ -73,6 +79,39 @@ if (!existsSync(consoleJs)) {
73
79
  )
74
80
  }
75
81
 
82
+ if (has('--install-shortcut') || has('--uninstall-shortcut')) {
83
+ const { installShortcut, uninstallShortcut } = await import(pathToFileURL(shortcutJs).href)
84
+ try {
85
+ if (has('--uninstall-shortcut')) {
86
+ const { removed } = uninstallShortcut()
87
+ console.error(removed ? `conarium-console: removed ${removed}` : 'conarium-console: no shortcut recorded')
88
+ process.exit(0)
89
+ }
90
+ const workdir = process.cwd()
91
+ const token = process.env.CONARIUM_CONSOLE_TOKEN?.trim() || ''
92
+ const out = installShortcut({
93
+ scriptPath: thisBin,
94
+ workdir,
95
+ token: token || undefined,
96
+ })
97
+ console.error(`conarium-console: shortcut at ${out.dest}${out.collided ? ' (name was taken, used -2)' : ''}`)
98
+ if (!token) {
99
+ console.error('conarium-console: CONARIUM_CONSOLE_TOKEN was not set; the shortcut will need it in the environment, or re-run install with the token exported')
100
+ }
101
+ process.exit(0)
102
+ } catch (e) {
103
+ die(2, `shortcut: ${e.message}`)
104
+ }
105
+ }
106
+
107
+ if (has('--launch')) {
108
+ const { loadLaunchToken, loadShortcutState } = await import(pathToFileURL(shortcutJs).href)
109
+ const persisted = loadLaunchToken()
110
+ if (persisted && !process.env.CONARIUM_CONSOLE_TOKEN?.trim()) {
111
+ process.env.CONARIUM_CONSOLE_TOKEN = persisted
112
+ }
113
+ }
114
+
76
115
  if (!process.env.CONARIUM_CONSOLE_TOKEN?.trim()) {
77
116
  die(
78
117
  2,
@@ -121,7 +160,15 @@ if (!loopback && process.env.CONARIUM_CONSOLE_PUBLIC !== '1') {
121
160
  // inside the package, which for an installed user is the wrong file twice over:
122
161
  // it is not the one the gateway reads, and npm overwrites it on every install.
123
162
  // Default to the same path the gateway uses — conarium.config.json in cwd.
124
- const configFile = resolve(process.cwd(), valueOf('--config', 'conarium.config.json'))
163
+ let workdir = process.cwd()
164
+ if (has('--launch') && !has('--config')) {
165
+ const { loadShortcutState } = await import(pathToFileURL(shortcutJs).href)
166
+ const st = loadShortcutState()
167
+ if (st?.workdir && existsSync(join(st.workdir, 'conarium.config.json'))) {
168
+ workdir = st.workdir
169
+ }
170
+ }
171
+ const configFile = resolve(workdir, valueOf('--config', 'conarium.config.json'))
125
172
  if (!existsSync(configFile)) {
126
173
  die(
127
174
  2,
@@ -132,14 +179,49 @@ if (!existsSync(configFile)) {
132
179
 
133
180
  try {
134
181
  const { createConsoleApp } = await import(pathToFileURL(consoleJs).href)
135
- const app = createConsoleApp({ configFile })
136
- app.listen(port, host, () => {
182
+ const launch = has('--launch')
183
+ let handoff
184
+ let lastPresence = 0
185
+ if (launch) {
186
+ const { createHandoffStore } = await import(pathToFileURL(join(pkgRoot, 'dist', 'console-handoff.js')).href)
187
+ handoff = createHandoffStore()
188
+ }
189
+ const app = createConsoleApp({
190
+ configFile,
191
+ handoff,
192
+ onPresence: launch ? () => { lastPresence = Date.now() } : undefined,
193
+ })
194
+ const server = app.listen(port, host, async () => {
137
195
  console.error(`[conarium-console] http://${host}:${port} — editing ${configFile}`)
138
196
  console.error(
139
197
  loopback
140
198
  ? '[conarium-console] loopback only — tunnel in over SSH if you are not on this machine'
141
199
  : '[conarium-console] WARNING: bound to a non-loopback address on purpose (CONARIUM_CONSOLE_PUBLIC=1)',
142
200
  )
201
+ if (!launch) return
202
+ const { waitForListen } = await import(pathToFileURL(join(pkgRoot, 'dist', 'console-ready.js')).href)
203
+ const { openBrowser, notifyLaunchError } = await import(pathToFileURL(join(pkgRoot, 'dist', 'console-notify.js')).href)
204
+ try {
205
+ await waitForListen(host, port, { timeoutMs: 15_000 })
206
+ const nonce = handoff.issue()
207
+ openBrowser(`http://${host}:${port}/handoff?n=${encodeURIComponent(nonce)}`)
208
+ const started = Date.now()
209
+ const watch = setInterval(() => {
210
+ if (lastPresence && Date.now() - lastPresence > 8_000) {
211
+ clearInterval(watch)
212
+ server.close(() => process.exit(0))
213
+ }
214
+ if (!lastPresence && Date.now() - started > 30_000) {
215
+ clearInterval(watch)
216
+ notifyLaunchError('The console started but the browser never opened a session.')
217
+ server.close(() => process.exit(2))
218
+ }
219
+ }, 1000)
220
+ watch.unref()
221
+ } catch (err) {
222
+ notifyLaunchError(err.message)
223
+ server.close(() => process.exit(2))
224
+ }
143
225
  })
144
226
  } catch (e) {
145
227
  // Anything that goes wrong before we are listening is a start failure, not a
@@ -0,0 +1,24 @@
1
+ export declare const HANDOFF_TTL_MS = 30000;
2
+ export interface HandoffEntry {
3
+ exp: number;
4
+ used: boolean;
5
+ }
6
+ export declare function createHandoffStore(opts?: {
7
+ ttlMs?: number;
8
+ now?: () => number;
9
+ }): {
10
+ issue: () => string;
11
+ consume: (n: string) => boolean;
12
+ size: () => number;
13
+ };
14
+ export interface ConsoleSession {
15
+ csrf: string;
16
+ }
17
+ export declare function createSessionStore(): {
18
+ create: () => {
19
+ id: string;
20
+ csrf: string;
21
+ };
22
+ get: (id: string) => ConsoleSession | null;
23
+ };
24
+ //# sourceMappingURL=console-handoff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console-handoff.d.ts","sourceRoot":"","sources":["../src/console-handoff.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,QAAS,CAAA;AAEpC,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,OAAO,CAAA;CACd;AAED,wBAAgB,kBAAkB,CAAC,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAA;CAAO;iBAKhE,MAAM;iBAMJ,MAAM,KAAG,OAAO;;EAerC;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAA;CACb;AAED,wBAAgB,kBAAkB;kBAGb;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE;cAO9B,MAAM,KAAG,cAAc,GAAG,IAAI;EAMhD"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * One-time handoff nonce for the desktop launcher.
3
+ * The long-lived console token never goes in a URL.
4
+ */
5
+ import { randomBytes } from 'node:crypto';
6
+ export const HANDOFF_TTL_MS = 30_000;
7
+ export function createHandoffStore(opts = {}) {
8
+ const ttl = opts.ttlMs ?? HANDOFF_TTL_MS;
9
+ const now = opts.now ?? Date.now;
10
+ const map = new Map();
11
+ function issue() {
12
+ const n = randomBytes(24).toString('base64url');
13
+ map.set(n, { exp: now() + ttl, used: false });
14
+ return n;
15
+ }
16
+ function consume(n) {
17
+ if (!n)
18
+ return false;
19
+ const e = map.get(n);
20
+ if (!e)
21
+ return false;
22
+ if (e.used)
23
+ return false;
24
+ if (now() > e.exp) {
25
+ map.delete(n);
26
+ return false;
27
+ }
28
+ e.used = true;
29
+ map.delete(n);
30
+ return true;
31
+ }
32
+ return { issue, consume, size: () => map.size };
33
+ }
34
+ export function createSessionStore() {
35
+ const map = new Map();
36
+ function create() {
37
+ const id = randomBytes(24).toString('base64url');
38
+ const csrf = randomBytes(24).toString('base64url');
39
+ map.set(id, { csrf });
40
+ return { id, csrf };
41
+ }
42
+ function get(id) {
43
+ if (!id)
44
+ return null;
45
+ return map.get(id) ?? null;
46
+ }
47
+ return { create, get };
48
+ }
49
+ //# sourceMappingURL=console-handoff.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console-handoff.js","sourceRoot":"","sources":["../src/console-handoff.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAEzC,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAA;AAOpC,MAAM,UAAU,kBAAkB,CAAC,OAA+C,EAAE;IAClF,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,IAAI,cAAc,CAAA;IACxC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAA;IAChC,MAAM,GAAG,GAAG,IAAI,GAAG,EAAwB,CAAA;IAE3C,SAAS,KAAK;QACZ,MAAM,CAAC,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAA;QAC/C,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EA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CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,IAAI,CAAA;IAC5B,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,CAAA;AACxB,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare function notifyLaunchError(message: string, opts?: {
2
+ platform?: NodeJS.Platform;
3
+ home?: string;
4
+ }): void;
5
+ export declare function openBrowser(url: string, platform?: NodeJS.Platform): void;
6
+ //# sourceMappingURL=console-notify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console-notify.d.ts","sourceRoot":"","sources":["../src/console-notify.ts"],"names":[],"mappings":"AAQA,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,IAAI,CAoBjH;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAM,CAAC,QAA2B,GAAG,IAAI,CAU3F"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Show a launch failure to a human. No silent exit.
3
+ */
4
+ import { spawnSync } from 'node:child_process';
5
+ import { writeBorn0600 } from './console-shortcut.js';
6
+ import { homedir } from 'node:os';
7
+ import { join } from 'node:path';
8
+ export function notifyLaunchError(message, opts = {}) {
9
+ const platform = opts.platform ?? process.platform;
10
+ const home = opts.home ?? process.env.CONARIUM_CONSOLE_HOME ?? homedir();
11
+ const log = join(home, '.conarium', 'console-launch.log');
12
+ try {
13
+ writeBorn0600(log, `${new Date().toISOString()} ${message}\n`);
14
+ }
15
+ catch { /* still try a dialog */ }
16
+ if (platform === 'win32') {
17
+ const ps = `Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.MessageBox]::Show('${message.replace(/'/g, "''")}', 'Conarium Console')`;
18
+ spawnSync('powershell.exe', ['-NoProfile', '-Command', ps], { stdio: 'ignore' });
19
+ return;
20
+ }
21
+ if (platform === 'darwin') {
22
+ spawnSync('osascript', ['-e', `display dialog ${JSON.stringify(message)} with title "Conarium Console" buttons {"OK"}`], { stdio: 'ignore' });
23
+ return;
24
+ }
25
+ const zenity = spawnSync('zenity', ['--error', `--text=${message}`, '--title=Conarium Console'], { stdio: 'ignore' });
26
+ if (zenity.status === 0)
27
+ return;
28
+ spawnSync('notify-send', ['Conarium Console', message], { stdio: 'ignore' });
29
+ }
30
+ export function openBrowser(url, platform = process.platform) {
31
+ if (platform === 'win32') {
32
+ spawnSync('cmd', ['/c', 'start', '', url], { stdio: 'ignore' });
33
+ return;
34
+ }
35
+ if (platform === 'darwin') {
36
+ spawnSync('open', [url], { stdio: 'ignore' });
37
+ return;
38
+ }
39
+ spawnSync('xdg-open', [url], { stdio: 'ignore' });
40
+ }
41
+ //# sourceMappingURL=console-notify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console-notify.js","sourceRoot":"","sources":["../src/console-notify.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,MAAM,UAAU,iBAAiB,CAAC,OAAe,EAAE,OAAsD,EAAE;IACzG,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAA;IAClD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,OAAO,EAAE,CAAA;IACxE,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,oBAAoB,CAAC,CAAA;IACzD,IAAI,CAAC;QACH,aAAa,CAAC,GAAG,EAAE,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW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,QAAQ,EAAE,CAAC;QAC1B,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAA;QAC7C,OAAM;IACR,CAAC;IACD,SAAS,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAA;AACnD,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare function waitForListen(host: string, port: number, opts?: {
2
+ timeoutMs?: number;
3
+ intervalMs?: number;
4
+ }): Promise<void>;
5
+ //# sourceMappingURL=console-ready.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console-ready.d.ts","sourceRoot":"","sources":["../src/console-ready.ts"],"names":[],"mappings":"AAKA,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAO,GACrD,OAAO,CAAC,IAAI,CAAC,CAqBf"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Wait until a TCP port accepts a connection. No fixed sleep.
3
+ */
4
+ import { createConnection } from 'node:net';
5
+ export async function waitForListen(host, port, opts = {}) {
6
+ const timeoutMs = opts.timeoutMs ?? 15_000;
7
+ const intervalMs = opts.intervalMs ?? 100;
8
+ const start = Date.now();
9
+ while (Date.now() - start < timeoutMs) {
10
+ const ok = await new Promise((resolve) => {
11
+ const sock = createConnection({ host, port });
12
+ const done = (v) => {
13
+ sock.removeAllListeners();
14
+ sock.destroy();
15
+ resolve(v);
16
+ };
17
+ sock.once('connect', () => done(true));
18
+ sock.once('error', () => done(false));
19
+ sock.setTimeout(intervalMs, () => done(false));
20
+ });
21
+ if (ok)
22
+ return;
23
+ await new Promise((r) => setTimeout(r, intervalMs));
24
+ }
25
+ throw new Error(`console did not listen on ${host}:${port} within ${timeoutMs}ms`);
26
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,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAA;IACrD,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,6BAA6B,IAAI,IAAI,IAAI,WAAW,SAAS,IAAI,CAAC,CAAA;AACpF,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { type Receipt, type ReceiptChainCheck } from './receipt.js';
2
+ export declare const EMPTY_RECEIPTS_MESSAGE = "hen\u00FCz makbuz yok. Gateway `audit.receiptSink` ile \u00E7al\u0131\u015F\u0131yorsa her eri\u015Fim bir sat\u0131r yazar.";
3
+ export declare const NO_SINK_MESSAGE = "hen\u00FCz makbuz yok. `conarium.config.json` i\u00E7inde `audit.receiptSink` yok; denetim kayd\u0131 makbuz de\u011Fildir.";
4
+ export interface ReceiptListItem {
5
+ id: string;
6
+ ts: string;
7
+ actor: string;
8
+ tool: string;
9
+ decision: string;
10
+ maskedCount: number;
11
+ seq: number;
12
+ }
13
+ export interface LoadedReceipts {
14
+ sink: string | null;
15
+ receipts: Receipt[];
16
+ chain: ReceiptChainCheck;
17
+ emptyMessage: string | null;
18
+ }
19
+ export declare function resolveReceiptSink(configFile: string): string | null;
20
+ export declare function readReceiptJsonl(file: string): {
21
+ receipts: Receipt[];
22
+ parseBreak?: number;
23
+ };
24
+ export declare function loadReceiptsForConsole(configFile: string): LoadedReceipts;
25
+ export declare function toListItems(receipts: Receipt[]): ReceiptListItem[];
26
+ export declare function findReceipt(receipts: Receipt[], id: string): Receipt | null;
27
+ /** Public PEM only. Never returns a private key block. */
28
+ export declare function publicPemForPanel(): string | null;
29
+ export declare function verifyCommandFor(sink: string | null): string;
30
+ //# sourceMappingURL=console-receipts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console-receipts.d.ts","sourceRoot":"","sources":["../src/console-receipts.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,iBAAiB,EAEvB,MAAM,cAAc,CAAA;AAGrB,eAAO,MAAM,sBAAsB,iIAC0D,CAAA;AAE7F,eAAO,MAAM,eAAe,gIAC+E,CAAA;AAE3G,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,KAAK,EAAE,iBAAiB,CAAA;IACxB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B;AAED,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAYpE;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAgB3F;AAED,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,cAAc,CAkCzE;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,eAAe,EAAE,CAYlE;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAE3E;AAED,0DAA0D;AAC1D,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,IAAI,CAyBjD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAG5D"}
@@ -0,0 +1,137 @@
1
+ /**
2
+ * Load the operator's receipt sink for the console. No invented receipts.
3
+ */
4
+ import { createPublicKey } from 'node:crypto';
5
+ import { existsSync, readFileSync } from 'node:fs';
6
+ import { basename, dirname, isAbsolute, resolve } from 'node:path';
7
+ import { verifyReceiptChain, } from './receipt.js';
8
+ import { parseTrustPubkeyPaths } from './keys.js';
9
+ export const EMPTY_RECEIPTS_MESSAGE = 'henüz makbuz yok. Gateway `audit.receiptSink` ile çalışıyorsa her erişim bir satır yazar.';
10
+ export const NO_SINK_MESSAGE = 'henüz makbuz yok. `conarium.config.json` içinde `audit.receiptSink` yok; denetim kaydı makbuz değildir.';
11
+ export function resolveReceiptSink(configFile) {
12
+ try {
13
+ if (!existsSync(configFile))
14
+ return null;
15
+ const raw = JSON.parse(readFileSync(configFile, 'utf8'));
16
+ const sink = raw?.audit?.receiptSink;
17
+ if (typeof sink !== 'string' || !sink.trim())
18
+ return null;
19
+ return isAbsolute(sink) ? sink : resolve(dirname(configFile), sink);
20
+ }
21
+ catch {
22
+ return null;
23
+ }
24
+ }
25
+ export function readReceiptJsonl(file) {
26
+ if (!existsSync(file))
27
+ return { receipts: [] };
28
+ const lines = readFileSync(file, 'utf8').split(/\r?\n/);
29
+ const receipts = [];
30
+ let seen = 0;
31
+ for (const raw of lines) {
32
+ const line = raw.trim();
33
+ if (!line)
34
+ continue;
35
+ seen += 1;
36
+ try {
37
+ receipts.push(JSON.parse(line));
38
+ }
39
+ catch {
40
+ return { receipts, parseBreak: seen };
41
+ }
42
+ }
43
+ return { receipts };
44
+ }
45
+ export function loadReceiptsForConsole(configFile) {
46
+ const sink = resolveReceiptSink(configFile);
47
+ if (!sink) {
48
+ return {
49
+ sink: null,
50
+ receipts: [],
51
+ chain: { ok: true, entries: 0 },
52
+ emptyMessage: NO_SINK_MESSAGE,
53
+ };
54
+ }
55
+ if (!existsSync(sink)) {
56
+ return {
57
+ sink,
58
+ receipts: [],
59
+ chain: { ok: true, entries: 0 },
60
+ emptyMessage: EMPTY_RECEIPTS_MESSAGE,
61
+ };
62
+ }
63
+ const { receipts, parseBreak } = readReceiptJsonl(sink);
64
+ if (parseBreak != null) {
65
+ return {
66
+ sink,
67
+ receipts,
68
+ chain: { ok: false, brokenAt: parseBreak, reason: 'unreadable', entries: receipts.length },
69
+ emptyMessage: receipts.length === 0 ? EMPTY_RECEIPTS_MESSAGE : null,
70
+ };
71
+ }
72
+ const chain = verifyReceiptChain(receipts);
73
+ return {
74
+ sink,
75
+ receipts,
76
+ chain,
77
+ emptyMessage: receipts.length === 0 ? EMPTY_RECEIPTS_MESSAGE : null,
78
+ };
79
+ }
80
+ export function toListItems(receipts) {
81
+ return receipts
82
+ .map((r) => ({
83
+ id: String(r.id || ''),
84
+ ts: String(r.ts || ''),
85
+ actor: r.actor?.id || 'unknown',
86
+ tool: r.request?.tool || '',
87
+ decision: r.policy?.decision || '',
88
+ maskedCount: Number(r.masking?.maskedCount || 0),
89
+ seq: Number(r.chain?.seq || 0),
90
+ }))
91
+ .reverse();
92
+ }
93
+ export function findReceipt(receipts, id) {
94
+ return receipts.find((r) => r.id === id) ?? null;
95
+ }
96
+ /** Public PEM only. Never returns a private key block. */
97
+ export function publicPemForPanel() {
98
+ for (const p of parseTrustPubkeyPaths()) {
99
+ if (!existsSync(p))
100
+ continue;
101
+ const pem = readFileSync(p, 'utf8');
102
+ if (/BEGIN PRIVATE KEY|BEGIN.*PRIVATE/.test(pem))
103
+ continue;
104
+ if (/BEGIN PUBLIC KEY/.test(pem))
105
+ return pem;
106
+ }
107
+ const priv = process.env.CONARIUM_AUDIT_SIGNING_KEY?.trim();
108
+ if (!priv)
109
+ return null;
110
+ const candidates = [priv.replace(/\.pem$/i, '.pub.pem'), `${priv}.pub.pem`];
111
+ for (const c of candidates) {
112
+ if (c === priv || !existsSync(c))
113
+ continue;
114
+ const pem = readFileSync(c, 'utf8');
115
+ if (/BEGIN PRIVATE KEY|BEGIN.*PRIVATE/.test(pem))
116
+ continue;
117
+ if (/BEGIN PUBLIC KEY/.test(pem))
118
+ return pem;
119
+ }
120
+ if (!existsSync(priv))
121
+ return null;
122
+ try {
123
+ const raw = readFileSync(priv, 'utf8');
124
+ const pub = createPublicKey(raw).export({ type: 'spki', format: 'pem' }).toString();
125
+ if (/BEGIN PRIVATE KEY|BEGIN.*PRIVATE/.test(pub))
126
+ return null;
127
+ return pub;
128
+ }
129
+ catch {
130
+ return null;
131
+ }
132
+ }
133
+ export function verifyCommandFor(sink) {
134
+ const file = sink ? basename(sink) : 'conarium-receipts.jsonl';
135
+ return `npx conarium-verify ${file} --pubkey <key.pub.pem>`;
136
+ }
137
+ //# sourceMappingURL=console-receipts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console-receipts.js","sourceRoot":"","sources":["../src/console-receipts.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAClE,OAAO,EAGL,kBAAkB,GACnB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAA;AAEjD,MAAM,CAAC,MAAM,sBAAsB,GACjC,2FAA2F,CAAA;AAE7F,MAAM,CAAC,MAAM,eAAe,GAC1B,yGAAyG,CAAA;AAmB3G,MAAM,UAAU,kBAAkB,CAAC,UAAkB;IACnD,IAAI,CAAC;QACH,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC;YAAE,OAAO,IAAI,CAAA;QACxC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAEtD,CAAA;QACD,MAAM,IAAI,GAAG,GAAG,EAAE,KAAK,EAAE,WAAW,CAAA;QACpC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YAAE,OAAO,IAAI,CAAA;QACzD,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IA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QACnC,IAAI,kCAAkC,CAAC,IAAI,CAAC,GAAG,CAAC;YAAE,SAAQ;QAC1D,IAAI,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC;YAAE,OAAO,GAAG,CAAA;IAC9C,CAAC;IACD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAA;IAClC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;QACtC,MAAM,GAAG,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAA;QACnF,IAAI,kCAAkC,CAAC,IAAI,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAA;QAC7D,OAAO,GAAG,CAAA;IACZ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAmB;IAClD,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,yBAAyB,CAAA;IAC9D,OAAO,uBAAuB,IAAI,yBAAyB,CAAA;AAC7D,CAAC"}
@@ -0,0 +1,49 @@
1
+ export declare const SHORTCUT_NAME = "Conarium Console";
2
+ export declare const STATE_REL: string;
3
+ export declare const TOKEN_REL: string;
4
+ export interface ShortcutPlan {
5
+ dest: string;
6
+ kind: 'lnk' | 'app' | 'desktop';
7
+ }
8
+ export interface ShortcutState {
9
+ path: string;
10
+ workdir: string;
11
+ kind: ShortcutPlan['kind'];
12
+ }
13
+ export declare function nextAvailablePath(preferred: string, exists?: (p: string) => boolean): string;
14
+ export declare function planShortcut(platform: NodeJS.Platform, home: string): ShortcutPlan;
15
+ export declare function writeBorn0600(file: string, contents: string): void;
16
+ export declare function windowsShortcutScript(opts: {
17
+ dest: string;
18
+ nodePath: string;
19
+ scriptPath: string;
20
+ workdir: string;
21
+ }): string;
22
+ export declare function macLauncherScript(nodePath: string, scriptPath: string): string;
23
+ export declare function macInfoPlist(): string;
24
+ export declare function linuxDesktopFile(opts: {
25
+ nodePath: string;
26
+ scriptPath: string;
27
+ workdir: string;
28
+ }): string;
29
+ export declare function installShortcut(opts: {
30
+ platform?: NodeJS.Platform;
31
+ home?: string;
32
+ nodePath?: string;
33
+ scriptPath: string;
34
+ workdir: string;
35
+ token?: string;
36
+ runWindows?: (script: string) => void;
37
+ }): {
38
+ dest: string;
39
+ kind: ShortcutPlan['kind'];
40
+ collided: boolean;
41
+ };
42
+ export declare function uninstallShortcut(opts?: {
43
+ home?: string;
44
+ }): {
45
+ removed: string | null;
46
+ };
47
+ export declare function loadLaunchToken(home?: string): string | null;
48
+ export declare function loadShortcutState(home?: string): ShortcutState | null;
49
+ //# sourceMappingURL=console-shortcut.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console-shortcut.d.ts","sourceRoot":"","sources":["../src/console-shortcut.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,aAAa,qBAAqB,CAAA;AAC/C,eAAO,MAAM,SAAS,QAA6C,CAAA;AACnE,eAAO,MAAM,SAAS,QAAqC,CAAA;AAE3D,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,KAAK,GAAG,KAAK,GAAG,SAAS,CAAA;CAChC;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,CAAA;CAC3B;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,GAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAoB,GAAG,MAAM,CAUxG;AAED,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,MAAM,CAAC,QA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