@clagentic/console 1.5.0-beta.1 → 1.5.0-beta.2

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/README.md CHANGED
@@ -35,6 +35,16 @@ npx @clagentic/console
35
35
 
36
36
  **Requirements:** Node.js 20+. Authenticated Claude Code CLI, Codex CLI, or both.
37
37
 
38
+ ### Postinstall / systemd
39
+
40
+ On Linux, a global npm install runs a postinstall script that registers and enables a `clagentic-console.service` systemd unit. The script never restarts an already-running daemon — active sessions are not interrupted. Self-updates triggered from inside the app skip the restart entirely and let systemd's `Restart=always` handle the handoff after graceful shutdown.
41
+
42
+ To skip the postinstall script:
43
+
44
+ ```bash
45
+ npm install -g @clagentic/console --ignore-scripts
46
+ ```
47
+
38
48
  ## What it does
39
49
 
40
50
  - **Named agent sessions.** Type `@` in the session input to launch any agent defined in `.claude/agents/` or `~/.claude/agents/` into its own session — with its own conversation history, context window, and state. Pick agents by name, switch mid-conversation.
@@ -124,6 +134,39 @@ graph LR
124
134
 
125
135
  For architecture details, sequence diagrams, and key design decisions, see [docs/guides/architecture.md](docs/guides/architecture.md).
126
136
 
137
+ ## Security
138
+
139
+ These are implementation-level properties, not configuration options — they apply to every installation.
140
+
141
+ - **Token TTL.** Multi-user auth tokens expire after 30 days (`TOKEN_TTL_MS`). Tokens issued before TTL support was added are migrated on first use to a fresh 30-day window, avoiding forced logouts on upgrade.
142
+
143
+ - **Atomic writes, mode 0o600.** All config and state files (`users.json`, `auth-tokens.json`, and similar) are written via rename-after-write: data goes to a `.tmp.<pid>` path, then `rename()` atomically replaces the target. After rename, `chmod 0o600` is applied. Concurrent writes to the same file are serialized in call order.
144
+
145
+ - **Append-only audit log.** Privileged actions — user creation, lockouts, token revocation, multi-user enable/disable — are written as newline-delimited JSON to `~/.clagentic/audit.log` (mode 0o600, opened with `O_APPEND`).
146
+
147
+ - **Progressive lockout.** Failed login attempts trigger escalating per-username backoff: 1s, 5s, 30s, 5 min. Reaching the threshold results in permanent lockout until an admin explicitly unlocks the account. Per-IP rate limiting runs in parallel.
148
+
149
+ - **OS-level isolation (Linux, multi-user mode).** Each app user maps to a real system account. File ACLs are set via `setfacl`; processes spawn under the correct UID/GID.
150
+
151
+ ## Testing
152
+
153
+ The test suite covers 12 areas across 26 test files:
154
+
155
+ - **Boot / smoke** — daemon startup, config bootstrap, guard checks
156
+ - **Security gates** — auth token TTL, lockout thresholds, PIN rate limiting, audit log entries
157
+ - **WebSocket permission gates** — per-user RBAC enforcement on WS message types
158
+ - **Session lifecycle** — session open, resume, shutdown, and reaper behavior
159
+ - **External triggers** — v1 and v2 trigger processing, file archival, restart survival
160
+ - **Scheduler** — cron parsing, loop execution, run accounting
161
+ - **Store atomicity** — concurrent write serialization, atomic rename, 0o600 mode
162
+ - **XSS escaping** — output sanitization for user-controlled strings rendered in HTML
163
+ - **YOKE robustness** — vendor adapter error handling and fallback paths
164
+ - **SDK bridge** — slot counter, message processor, slash command enrichment, workflow and skill discovery, worker shutdown
165
+ - **Replay** — session replay correctness
166
+ - **ESM import check** — verifies the package is importable as an ES module
167
+
168
+ Run the suite: `npm test`
169
+
127
170
  ## FAQ
128
171
 
129
172
  **"Is this a Claude Code wrapper?"**
package/bin/cli.js CHANGED
@@ -31,7 +31,7 @@ if (_isDev || process.argv.includes("--debug")) {
31
31
  }
32
32
 
33
33
  var crypto = require("crypto");
34
- var { loadConfig, saveConfig, configPath, socketPath, oldSocketPath, logPath, ensureConfigDir, isDaemonAlive, isDaemonAliveAsync, checkOldDaemon, generateSlug, clearStaleConfig, loadClayrc, saveClayrc, readCrashInfo, REAL_HOME } = require("../lib/config");
34
+ var { loadConfig, saveConfig, configPath, socketPath, oldSocketPath, logPath, ensureConfigDir, isDaemonAlive, isDaemonAliveAsync, checkOldDaemon, generateSlug, clearStaleConfig, loadClayrc, saveClayrc, readCrashInfo, REAL_HOME, CONFIG_DIR, CLAGENTIC_HOME } = require("../lib/config");
35
35
  var { sendIPCCommand } = require("../lib/ipc");
36
36
  var { generateAuthToken } = require("../lib/server");
37
37
  var { enableMultiUser, disableMultiUser, hasAdmin, isMultiUser, getSetupCode } = require("../lib/users");
@@ -523,6 +523,7 @@ async function restartDaemonFromConfig() {
523
523
  // Debug mode: run in foreground with logs to stdout
524
524
  if (debugMode) {
525
525
  process.env.CLAGENTIC_CONFIG = configPath();
526
+ process.env.CLAGENTIC_HOME = CLAGENTIC_HOME;
526
527
  newConfig.pid = process.pid;
527
528
  saveConfig(newConfig);
528
529
  require(daemonScript);
@@ -538,6 +539,7 @@ async function restartDaemonFromConfig() {
538
539
  stdio: ["ignore", logFd, logFd],
539
540
  env: Object.assign({}, process.env, {
540
541
  CLAGENTIC_CONFIG: configPath(),
542
+ CLAGENTIC_HOME: CLAGENTIC_HOME,
541
543
  }),
542
544
  });
543
545
  child.unref();
@@ -1624,6 +1626,7 @@ async function forkDaemon(mode, keepAwake, extraProjects, addCwd, wantOsUsers) {
1624
1626
  // Debug mode: run in foreground with logs to stdout
1625
1627
  if (debugMode) {
1626
1628
  process.env.CLAGENTIC_CONFIG = configPath();
1629
+ process.env.CLAGENTIC_HOME = CLAGENTIC_HOME;
1627
1630
  config.pid = process.pid;
1628
1631
  saveConfig(config);
1629
1632
  require(daemonScript);
@@ -1639,6 +1642,7 @@ async function forkDaemon(mode, keepAwake, extraProjects, addCwd, wantOsUsers) {
1639
1642
  stdio: ["ignore", logFd, logFd],
1640
1643
  env: Object.assign({}, process.env, {
1641
1644
  CLAGENTIC_CONFIG: configPath(),
1645
+ CLAGENTIC_HOME: CLAGENTIC_HOME,
1642
1646
  }),
1643
1647
  });
1644
1648
  child.unref();
@@ -1827,6 +1831,7 @@ async function devMode(mode, keepAwake, existingPinHash, wantOsUsers) {
1827
1831
  stdio: ["ignore", "inherit", "inherit"],
1828
1832
  env: Object.assign({}, process.env, {
1829
1833
  CLAGENTIC_CONFIG: configPath(),
1834
+ CLAGENTIC_HOME: CLAGENTIC_HOME,
1830
1835
  }),
1831
1836
  });
1832
1837
 
@@ -1988,6 +1993,7 @@ async function restartDaemonWithTLS(config, callback) {
1988
1993
  stdio: ["ignore", logFd, logFd],
1989
1994
  env: Object.assign({}, process.env, {
1990
1995
  CLAGENTIC_CONFIG: configPath(),
1996
+ CLAGENTIC_HOME: CLAGENTIC_HOME,
1991
1997
  }),
1992
1998
  });
1993
1999
  child.unref();
@@ -2014,6 +2020,7 @@ async function restartDaemonWithTLS(config, callback) {
2014
2020
  stdio: ["ignore", logFd2, logFd2],
2015
2021
  env: Object.assign({}, process.env, {
2016
2022
  CLAGENTIC_CONFIG: configPath(),
2023
+ CLAGENTIC_HOME: CLAGENTIC_HOME,
2017
2024
  }),
2018
2025
  });
2019
2026
  child2.unref();
package/lib/audit.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // audit.js — Append-only audit log for privileged actions.
2
- // Writes JSON lines to ~/.clagentic/audit.log (mode 0o600).
2
+ // Writes JSON lines to ~/.clagentic/console/audit.log (CONFIG_DIR/audit.log, mode 0o600).
3
3
  // Never throws into callers: all errors are logged to stderr only.
4
4
 
5
5
  var fs = require("fs");
@@ -7,6 +7,24 @@ var path = require("path");
7
7
  var config = require("./config");
8
8
 
9
9
  var AUDIT_LOG_PATH = path.join(config.CONFIG_DIR, "audit.log");
10
+ var OLD_AUDIT_LOG_PATH = path.join(config.CONFIG_DIR, "..", "audit.log");
11
+
12
+ // One-time migration: copy old audit.log to new location if new is absent.
13
+ // Copy-not-rename so rollback still finds the old file.
14
+ // Only runs if CLAGENTIC_HOME is not explicitly set (default layout).
15
+ // Note: this runs at module load time, potentially before ensureConfigDir() creates
16
+ // console/ — so we ensure the parent dir exists ourselves before copying.
17
+ if (!process.env.CLAGENTIC_HOME && !fs.existsSync(AUDIT_LOG_PATH) && fs.existsSync(OLD_AUDIT_LOG_PATH)) {
18
+ try {
19
+ fs.mkdirSync(path.dirname(AUDIT_LOG_PATH), { recursive: true });
20
+ fs.copyFileSync(OLD_AUDIT_LOG_PATH, AUDIT_LOG_PATH);
21
+ try { fs.chmodSync(AUDIT_LOG_PATH, 0o600); } catch (_) {}
22
+ console.warn("[audit] Migrated audit.log to ~/.clagentic/console/audit.log");
23
+ } catch (e) {
24
+ console.error("[audit] Migration of audit.log failed (non-fatal):", e.message);
25
+ }
26
+ }
27
+
10
28
  var _logFd = null;
11
29
 
12
30
  function _getLogFd() {
@@ -54,4 +72,7 @@ function log(action, ctx) {
54
72
  });
55
73
  }
56
74
 
57
- module.exports = { log: log };
75
+ module.exports = {
76
+ log: log,
77
+ auditLogPath: function () { return AUDIT_LOG_PATH; },
78
+ };
package/lib/config.js CHANGED
@@ -44,15 +44,53 @@ var CLAGENTIC_HOME = process.env.CLAGENTIC_HOME
44
44
  var OLD_CLAY_HOME = path.join(REAL_HOME, ".clay");
45
45
  if (!fs.existsSync(CLAGENTIC_HOME) && fs.existsSync(OLD_CLAY_HOME)) {
46
46
  try {
47
- fs.cpSync(OLD_CLAY_HOME, CLAGENTIC_HOME, { recursive: true });
47
+ fs.cpSync(OLD_CLAY_HOME, CLAGENTIC_HOME, { recursive: true, preserveTimestamps: true });
48
48
  console.log("[config] Migrated " + OLD_CLAY_HOME + " → " + CLAGENTIC_HOME + " — ~/.clay/ can be deleted when verified");
49
49
  } catch (e) {
50
50
  console.error("[config] Migration failed:", e.message);
51
51
  }
52
52
  }
53
53
 
54
- var CONFIG_DIR = CLAGENTIC_HOME;
54
+ // One-time migration: copy all Console data from ~/.clagentic/ root into
55
+ // ~/.clagentic/console/ if not yet done.
56
+ //
57
+ // Sentinel: console/.migrated marker file. Using sessions/ directory existence
58
+ // as the sentinel is wrong — partial earlier migrations (lr-5dca, lr-eb5a)
59
+ // created console/sessions/ before this full sweep ran, causing the sentinel
60
+ // to fire too early and leaving any sessions written after that point orphaned.
61
+ // A marker file written only at sweep completion is the correct pattern
62
+ // (same as how ~/.clay/ → ~/.clagentic/ worked: gated on destination absence).
63
+ //
64
+ // Skip-if-dest-exists for each entry so files already in console/ from
65
+ // earlier partial migrations are preserved.
66
+ var _consoleMigrated = path.join(CLAGENTIC_HOME, "console", ".migrated");
67
+ if (!fs.existsSync(_consoleMigrated) && fs.existsSync(CLAGENTIC_HOME)) {
68
+ try {
69
+ fs.mkdirSync(path.join(CLAGENTIC_HOME, "console"), { recursive: true });
70
+ // cpSync cannot copy a dir into one of its own subdirs — iterate entries
71
+ // individually and skip the console/ subdir itself to avoid recursion.
72
+ var _rootEntries = fs.readdirSync(CLAGENTIC_HOME);
73
+ for (var _ri = 0; _ri < _rootEntries.length; _ri++) {
74
+ if (_rootEntries[_ri] === "console") continue;
75
+ var _src = path.join(CLAGENTIC_HOME, _rootEntries[_ri]);
76
+ var _dst = path.join(CLAGENTIC_HOME, "console", _rootEntries[_ri]);
77
+ if (!fs.existsSync(_dst)) {
78
+ try { fs.cpSync(_src, _dst, { recursive: true, preserveTimestamps: true }); } catch (_ce) {}
79
+ }
80
+ }
81
+ // Write sentinel only after the sweep completes so a crash mid-sweep
82
+ // causes a retry on next start rather than silently leaving data behind.
83
+ fs.writeFileSync(_consoleMigrated, "");
84
+ console.log("[config] Migrated ~/.clagentic/ → ~/.clagentic/console/ — root files can be cleaned up when verified");
85
+ } catch (e) {
86
+ console.error("[config] Migration to console/ subdir failed:", e.message);
87
+ }
88
+ }
89
+
90
+ var CONSOLE_DIR = path.join(CLAGENTIC_HOME, "console");
91
+ var CONFIG_DIR = CONSOLE_DIR;
55
92
  var EXTERNAL_TRIGGERS_DIR = path.join(CONFIG_DIR, "external-triggers");
93
+ var OLD_EXTERNAL_TRIGGERS_DIR = path.join(CLAGENTIC_HOME, "external-triggers");
56
94
  var OLD_CLAYRC = path.join(REAL_HOME, ".clayrc");
57
95
  var CLAGENTIC_RC_PATH = path.join(REAL_HOME, ".clagentic-rc");
58
96
  // One-time migration: copy .clayrc → .clagentic-rc if new file absent
@@ -60,6 +98,7 @@ if (!fs.existsSync(CLAGENTIC_RC_PATH) && fs.existsSync(OLD_CLAYRC)) {
60
98
  try { fs.copyFileSync(OLD_CLAYRC, CLAGENTIC_RC_PATH); } catch (e) {}
61
99
  }
62
100
  var CRASH_INFO_PATH = path.join(CONFIG_DIR, "crash.json");
101
+ var OLD_CRASH_INFO_PATH = path.join(CLAGENTIC_HOME, "crash.json");
63
102
 
64
103
  // Dev mode uses separate daemon files so dev and prod can run simultaneously
65
104
  var _devMode = !!(process.env.CLAGENTIC_DEV || process.env.CLAY_DEV);
@@ -68,25 +107,35 @@ function configPath() {
68
107
  return path.join(CONFIG_DIR, _devMode ? "daemon-dev.json" : "daemon.json");
69
108
  }
70
109
 
110
+ // Path used before lr-12d0 moved CONFIG_DIR to console/ (was CLAGENTIC_HOME root).
111
+ function oldConfigPath() {
112
+ return path.join(CLAGENTIC_HOME, _devMode ? "daemon-dev.json" : "daemon.json");
113
+ }
114
+
71
115
  function socketPath() {
72
116
  if (process.platform === "win32") {
73
117
  var pipeName = _devMode ? "clagentic-daemon-dev" : "clagentic-daemon";
74
118
  return "\\\\.\\pipe\\" + pipeName;
75
119
  }
76
- return path.join(CONFIG_DIR, "console", _devMode ? "daemon-dev.sock" : "daemon.sock");
120
+ return path.join(CONFIG_DIR, _devMode ? "daemon-dev.sock" : "daemon.sock");
77
121
  }
78
122
 
79
- // Path used by pre-1.5 daemons (before lr-88fe moved the socket into console/).
80
- // Only meaningful on Unix — Windows named pipes were unchanged by lr-88fe.
123
+ // Path used by pre-lr-12d0 daemons (before CONFIG_DIR moved to console/).
124
+ // Only meaningful on Unix — Windows named pipes were unchanged.
81
125
  function oldSocketPath() {
82
126
  if (process.platform === "win32") return null;
83
- return path.join(CONFIG_DIR, _devMode ? "daemon-dev.sock" : "daemon.sock");
127
+ return path.join(CLAGENTIC_HOME, _devMode ? "daemon-dev.sock" : "daemon.sock");
84
128
  }
85
129
 
86
130
  function logPath() {
87
131
  return path.join(CONFIG_DIR, _devMode ? "daemon-dev.log" : "daemon.log");
88
132
  }
89
133
 
134
+ // Path used by pre-lr-12d0 daemons (before CONFIG_DIR moved to console/).
135
+ function oldLogPath() {
136
+ return path.join(CLAGENTIC_HOME, _devMode ? "daemon-dev.log" : "daemon.log");
137
+ }
138
+
90
139
  function chmodSafe(filePath, mode) {
91
140
  if (process.platform === "win32") return;
92
141
  try { fs.chmodSync(filePath, mode); } catch (e) {}
@@ -95,8 +144,54 @@ function chmodSafe(filePath, mode) {
95
144
  function ensureConfigDir() {
96
145
  fs.mkdirSync(CONFIG_DIR, { recursive: true });
97
146
  chmodSafe(CONFIG_DIR, 0o700);
98
- fs.mkdirSync(path.join(CONFIG_DIR, "console"), { recursive: true });
99
- chmodSafe(path.join(CONFIG_DIR, "console"), 0o700);
147
+ // One-time migrations: copy Console-owned runtime files to console/ subdir.
148
+ // Rules: copy-not-rename (rollback safety), never overwrite newer dest,
149
+ // non-fatal on permission errors, skip when CLAGENTIC_HOME is custom.
150
+ if (!process.env.CLAGENTIC_HOME) {
151
+ // daemon.log / daemon-dev.log
152
+ var oldLog = oldLogPath();
153
+ var newLog = logPath();
154
+ if (fs.existsSync(oldLog) && !fs.existsSync(newLog)) {
155
+ try {
156
+ fs.copyFileSync(oldLog, newLog);
157
+ console.warn("[config] Migrated " + oldLog + " → " + newLog);
158
+ } catch (e) {
159
+ console.error("[config] Migration of daemon log failed (non-fatal):", e.message);
160
+ }
161
+ }
162
+ // crash.json
163
+ if (fs.existsSync(OLD_CRASH_INFO_PATH) && !fs.existsSync(CRASH_INFO_PATH)) {
164
+ try {
165
+ fs.copyFileSync(OLD_CRASH_INFO_PATH, CRASH_INFO_PATH);
166
+ try { fs.chmodSync(CRASH_INFO_PATH, 0o600); } catch (_) {}
167
+ console.warn("[config] Migrated crash.json → " + CRASH_INFO_PATH);
168
+ } catch (e) {
169
+ console.error("[config] Migration of crash.json failed (non-fatal):", e.message);
170
+ }
171
+ }
172
+ // external-triggers/
173
+ if (fs.existsSync(OLD_EXTERNAL_TRIGGERS_DIR) && !fs.existsSync(EXTERNAL_TRIGGERS_DIR)) {
174
+ try {
175
+ fs.cpSync(OLD_EXTERNAL_TRIGGERS_DIR, EXTERNAL_TRIGGERS_DIR, { recursive: true });
176
+ console.warn("[config] Migrated external-triggers/ → " + EXTERNAL_TRIGGERS_DIR);
177
+ } catch (e) {
178
+ console.error("[config] Migration of external-triggers/ failed (non-fatal):", e.message);
179
+ }
180
+ }
181
+ // daemon.json / daemon-dev.json (lr-eb5a: moved into console/)
182
+ var oldCfg = oldConfigPath();
183
+ var newCfg = configPath();
184
+ if (fs.existsSync(oldCfg) && !fs.existsSync(newCfg)) {
185
+ try {
186
+ fs.copyFileSync(oldCfg, newCfg);
187
+ try { fs.chmodSync(newCfg, 0o600); } catch (_) {}
188
+ console.warn("[config] Migrated " + oldCfg + " → " + newCfg);
189
+ } catch (e) {
190
+ console.error("[config] Migration of daemon.json failed (non-fatal):", e.message);
191
+ }
192
+ }
193
+ }
194
+
100
195
  // Guard stale old socket cleanup: only unlink when the old-path daemon is
101
196
  // dead. If a live pre-1.5 daemon is still on that path we must not yank its
102
197
  // socket out from under it — warn instead so the operator can shut it down
@@ -377,11 +472,14 @@ function removeFromClayrc(projectPath) {
377
472
 
378
473
  module.exports = {
379
474
  CONFIG_DIR: CONFIG_DIR,
475
+ CLAGENTIC_HOME: CLAGENTIC_HOME,
380
476
  EXTERNAL_TRIGGERS_DIR: EXTERNAL_TRIGGERS_DIR,
381
477
  configPath: configPath,
478
+ oldConfigPath: oldConfigPath,
382
479
  socketPath: socketPath,
383
480
  oldSocketPath: oldSocketPath,
384
481
  logPath: logPath,
482
+ oldLogPath: oldLogPath,
385
483
  ensureConfigDir: ensureConfigDir,
386
484
  loadConfig: loadConfig,
387
485
  saveConfig: saveConfig,
package/lib/daemon.js CHANGED
@@ -47,25 +47,22 @@ try {
47
47
  config = JSON.parse(fs.readFileSync(configFile, "utf8"));
48
48
  } catch (e) {
49
49
  if (e.code === "ENOENT") {
50
- // Guard: detect CLAGENTIC_HOME mis-pointed at the socket subdirectory.
51
- //
52
- // Symptom: CLAGENTIC_HOME=~/.clagentic/console → CONFIG_DIR ends in
53
- // ".clagentic/console" and configFile = CONFIG_DIR/daemon.json (absent),
54
- // but the real config lives one level up at ../daemon.json. If we
55
- // bootstrap here we silently write projects:[] and the user loses all
56
- // their projects with no obvious error. Refuse loudly instead. (lr-dec3)
57
- var _configBasename = path.basename(path.dirname(configFile));
58
- var _configGrandparent = path.basename(path.dirname(path.dirname(configFile)));
59
- var _siblingConfig = path.join(path.dirname(path.dirname(configFile)), path.basename(configFile));
60
- if (_configBasename === "console" && _configGrandparent === ".clagentic" && fs.existsSync(_siblingConfig)) {
61
- console.error("[daemon] ERROR: config file not found at " + configFile + " but a config exists at " + _siblingConfig + ".");
62
- console.error("[daemon] CLAGENTIC_HOME appears to be set to the socket subdirectory (~/.clagentic/console).");
63
- console.error("[daemon] Do NOT set CLAGENTIC_HOME to ~/.clagentic/console — that directory holds the");
64
- console.error("[daemon] Unix socket, not the config. Relocating CLAGENTIC_HOME there moves daemon.json");
65
- console.error("[daemon] out of reach and causes your project list to be wiped on next bootstrap.");
66
- console.error("[daemon] Fix: unset CLAGENTIC_HOME (or set it back to ~/.clagentic) and restart.");
67
- process.exit(78); // EX_CONFIG — fatal config error, don't auto-restart
68
- }
50
+ // Guard: if CLAGENTIC_HOME was erroneously set to the socket subdirectory
51
+ // (e.g. ~/.clagentic/console instead of ~/.clagentic), a real daemon.json
52
+ // will exist one level above CLAGENTIC_HOME. Detect this and refuse to
53
+ // bootstrap an empty config — that would silently discard all projects.
54
+ var { CLAGENTIC_HOME: _cgHome } = require("./config");
55
+ var _siblingConfig = path.join(path.dirname(_cgHome), "daemon.json");
56
+ try {
57
+ var _sibling = JSON.parse(fs.readFileSync(_siblingConfig, "utf8"));
58
+ if (_sibling && Array.isArray(_sibling.projects) && _sibling.projects.length > 0) {
59
+ console.error("[daemon] ERROR: CLAGENTIC_HOME appears to point at the console/ socket subdirectory (" + _cgHome + ").");
60
+ console.error("[daemon] A populated daemon.json with " + _sibling.projects.length + " project(s) exists at " + _siblingConfig + ".");
61
+ console.error("[daemon] Set CLAGENTIC_HOME to the parent directory (" + path.dirname(_cgHome) + ") to use the correct config.");
62
+ process.exit(78); // EX_CONFIG — do not auto-restart
63
+ }
64
+ } catch (_e) { /* sibling check is best-effort; fall through to normal bootstrap */ }
65
+
69
66
  // No config file yet (fresh install, systemd-only start). Bootstrap minimal defaults.
70
67
  console.warn("[daemon] No config file found at " + configFile + " — bootstrapping defaults. Run clagentic-console to configure projects.");
71
68
  var _isDev = !!(process.env.CLAGENTIC_DEV || process.env.CLAY_DEV);
@@ -1630,7 +1627,7 @@ function spawnAndRestart() {
1630
1627
  relay.server.close(function () {
1631
1628
  try {
1632
1629
  var { spawn: spawnRestart } = require("child_process");
1633
- var { logPath: restartLogPath, configPath: restartConfigPath } = require("./config");
1630
+ var { logPath: restartLogPath, configPath: restartConfigPath, CLAGENTIC_HOME: restartClagenticHome } = require("./config");
1634
1631
  var daemonScript = path.join(__dirname, "daemon.js");
1635
1632
  var logFd = fs.openSync(restartLogPath(), "a");
1636
1633
  var child = spawnRestart(process.execPath, [daemonScript], {
@@ -1639,6 +1636,7 @@ function spawnAndRestart() {
1639
1636
  stdio: ["ignore", logFd, logFd],
1640
1637
  env: Object.assign({}, process.env, {
1641
1638
  CLAGENTIC_CONFIG: restartConfigPath(),
1639
+ CLAGENTIC_HOME: restartClagenticHome,
1642
1640
  }),
1643
1641
  });
1644
1642
  child.unref();
@@ -745,7 +745,7 @@ function attachAdmin(ctx) {
745
745
  res.end('{"error":"Admin access required"}');
746
746
  return true;
747
747
  }
748
- var auditPath = require("path").join(require("./config").CONFIG_DIR, "audit.log");
748
+ var auditPath = require("./audit").auditLogPath();
749
749
  var fs = require("fs");
750
750
  try {
751
751
  var raw = fs.readFileSync(auditPath, "utf8");
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.5.0-beta.1",
6
+ "version": "1.5.0-beta.2",
7
7
  "description": "Self-hosted console for Claude Code and Codex. Multi-user, browser-based, persistent AI sessions.",
8
8
  "bin": {
9
9
  "clagentic-console": "./bin/cli.js"
@@ -54,7 +54,8 @@
54
54
  "Chad (original Clay author)"
55
55
  ],
56
56
  "dependencies": {
57
- "@anthropic-ai/claude-agent-sdk": "^0.2.112",
57
+ "@anthropic-ai/claude-agent-sdk": "^0.3.173",
58
+ "@anthropic-ai/sdk": "^0.104.1",
58
59
  "@lydell/node-pty": "^1.2.0-beta.3",
59
60
  "@openai/codex": "^0.124.0",
60
61
  "nodemailer": "^6.10.1",