@radnine/claude-session-daemon 0.9.7 → 0.9.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.
package/README.md CHANGED
@@ -235,6 +235,7 @@ In Docker mode, `CLAUDE_WORKING_DIR` should point to your mounted workspace (e.g
235
235
  | `CLAUDE_COMMAND` | `claude` | Claude CLI binary to spawn. Also used for `claude auth status` |
236
236
  | `CLAUDE_EFFORT` | — | Machine default reasoning effort (`low`, `medium`, `high`, `xhigh`, `max`) that the daemon reports to FlightDeck. Overrides the `effort` key in `~/.claude/settings.json` |
237
237
  | `CLAUDE_PERMISSION_MODE` | `auto` | Claude CLI permission mode: `auto`, `acceptEdits`, `manual`, `dontAsk`, `plan`, `bypassPermissions` |
238
+ | `CODEX_SANDBOX_MODE` | `workspace-write` | Sandbox every Codex chat runs in: `read-only`, `workspace-write` or `danger-full-access`. Set `danger-full-access` to let Codex chats launch a browser (Playwright, Rails system tests); it also drops the `sandbox_workspace_write.*` overrides. Any other value stops the daemon at startup. One setting for the whole machine, so Codex builders and verifiers both get it (#723) |
238
239
  | `CLAUDE_PERMISSION_TIMEOUT` | `600` | Seconds a permission prompt waits for an operator before auto-denying (1–86400) |
239
240
  | `CLAUDE_SKIP_PERMISSIONS` | `false` | **Deprecated** — alias for `CLAUDE_PERMISSION_MODE=bypassPermissions` |
240
241
  | `CLAUDE_DISABLE_AUTH` | `false` | Disable WebSocket auth (Docker only) |
@@ -250,6 +251,10 @@ Sessions inherit the daemon's environment, so Claude CLI variables such as `CLAU
250
251
  | `STORYBOOK_CLAUDE_DAEMON_PORT` | `3001` | Daemon port (or inject via `window.__CLAUDE_DAEMON_PORT__`) |
251
252
  | `STORYBOOK_CLAUDE_DAEMON_TOKEN` | — | Shared secret (or inject via `window.__CLAUDE_DAEMON_TOKEN__`) |
252
253
 
254
+ ## Releasing
255
+
256
+ How a new daemon version reaches npm and the pilots: [docs/releasing.md](../docs/releasing.md).
257
+
253
258
  ## License
254
259
 
255
260
  Proprietary. See [LICENSE](./LICENSE) for terms.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radnine/claude-session-daemon",
3
- "version": "0.9.7",
3
+ "version": "0.9.8",
4
4
  "description": "Node.js daemon for managing Claude CLI sessions",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {
@@ -59,6 +59,7 @@ class CodexProcess extends EventEmitter {
59
59
  * @param {boolean} [options.resume]
60
60
  * @param {object} [options.logger]
61
61
  * @param {string} [options.codexCommand] - path to the codex binary
62
+ * @param {string} [options.codexSandboxMode] - #723: read-only, workspace-write (default) or danger-full-access
62
63
  * @param {string} [options.systemPrompt] - persona prompt, sent as developer instructions
63
64
  * @param {string} [options.model] - Codex model id
64
65
  * @param {string} [options.effort] - reasoning effort for each turn
@@ -78,6 +79,7 @@ class CodexProcess extends EventEmitter {
78
79
  this._workingDir = options.workingDir || process.cwd();
79
80
  this._logger = options.logger || _defaultLogger();
80
81
  this._codexCommand = options.codexCommand || 'codex';
82
+ this._sandboxMode = options.codexSandboxMode || 'workspace-write';
81
83
  this._spawnFn = options._spawnFn || defaultSpawn;
82
84
  this._sessionEnv = options.sessionEnv || {};
83
85
  this._systemPrompt = options.systemPrompt || null;
@@ -131,6 +133,7 @@ class CodexProcess extends EventEmitter {
131
133
  radMcp: this._radMcp,
132
134
  mcpServers,
133
135
  writableRoots: gitWritableRoots(this._workingDir),
136
+ sandboxMode: this._sandboxMode,
134
137
  logger: this._logger,
135
138
  });
136
139
  this._skillRoots = claudeSkillRoots(env, this._workingDir);
@@ -321,12 +324,13 @@ class CodexProcess extends EventEmitter {
321
324
  }
322
325
  }
323
326
 
324
- // workspace-write with network (set in buildCodexArgs): git commit works in
325
- // a worktree, and git push / package installs reach the network.
327
+ // CODEX_SANDBOX_MODE (#723), workspace-write by default. workspace-write
328
+ // gets network and the git dirs (set in buildCodexLaunch): git commit works
329
+ // in a worktree, and git push / package installs reach the network.
326
330
  const params = {
327
331
  cwd: this._workingDir,
328
332
  approvalPolicy: 'never',
329
- sandbox: 'workspace-write',
333
+ sandbox: this._sandboxMode,
330
334
  };
331
335
  if (this._model) params.model = this._model;
332
336
  const instructions = developerInstructions(this._systemPrompt, this._memoryIndex, this._jobText);
@@ -990,7 +994,8 @@ function gitWritableRoots(workingDir, exec = childProcess.execFileSync) {
990
994
  * Arguments and env for `codex app-server`. Per-process `-c` overrides, so no
991
995
  * config file is written:
992
996
  * - sandbox_workspace_write.network_access: workspace-write blocks the network
993
- * by default, which breaks git push and installs.
997
+ * by default, which breaks git push and installs. Left off, with
998
+ * writable_roots, in danger-full-access (#723), which has no sandbox.
994
999
  * - project_doc_fallback_filenames: Codex reads CLAUDE.md in a directory with
995
1000
  * no AGENTS.md, so a chat gets the repo's Claude rules (#491).
996
1001
  * - mcp_servers.rad: the command a Claude chat uses, plus env_vars so that
@@ -1014,11 +1019,14 @@ function gitWritableRoots(workingDir, exec = childProcess.execFileSync) {
1014
1019
  *
1015
1020
  * @returns {{args: string[], env: object}} env is a new object
1016
1021
  */
1017
- function buildCodexLaunch({ env = {}, radMcp, mcpServers = [], writableRoots, logger = _defaultLogger() } = {}) {
1022
+ function buildCodexLaunch({ env = {}, radMcp, mcpServers = [], writableRoots, sandboxMode = 'workspace-write', logger = _defaultLogger() } = {}) {
1018
1023
  const childEnv = { ...env };
1019
- const args = ['app-server', '-c', 'sandbox_workspace_write.network_access=true'];
1020
- if (Array.isArray(writableRoots) && writableRoots.length) {
1021
- args.push('-c', `sandbox_workspace_write.writable_roots=${JSON.stringify(writableRoots)}`);
1024
+ const args = ['app-server'];
1025
+ if (sandboxMode !== 'danger-full-access') {
1026
+ args.push('-c', 'sandbox_workspace_write.network_access=true');
1027
+ if (Array.isArray(writableRoots) && writableRoots.length) {
1028
+ args.push('-c', `sandbox_workspace_write.writable_roots=${JSON.stringify(writableRoots)}`);
1029
+ }
1022
1030
  }
1023
1031
  // Even an empty Codex home gets the built-in `codex_apps` MCP server (the
1024
1032
  // ChatGPT account's connectors, 100+ tools) and the curated plugin catalog
package/src/config.js CHANGED
@@ -66,6 +66,28 @@ function resolvePermissionMode(env) {
66
66
  return { mode, warnings };
67
67
  }
68
68
 
69
+ // Sandbox modes accepted by Codex's `thread/start` and `thread/resume` (#723).
70
+ const CODEX_SANDBOX_MODES = ['read-only', 'workspace-write', 'danger-full-access'];
71
+
72
+ /**
73
+ * Resolve the sandbox every Codex chat runs in from CODEX_SANDBOX_MODE.
74
+ * Unset or blank keeps workspace-write, the mode every Codex chat ran in
75
+ * before the setting existed. Any other value stops the daemon at startup.
76
+ *
77
+ * @param {object} env
78
+ * @returns {string}
79
+ */
80
+ function resolveCodexSandboxMode(env) {
81
+ const raw = (env.CODEX_SANDBOX_MODE || '').trim();
82
+ if (!raw) return 'workspace-write';
83
+ if (!CODEX_SANDBOX_MODES.includes(raw)) {
84
+ throw new Error(
85
+ `Invalid CODEX_SANDBOX_MODE: "${raw}". Must be one of: ${CODEX_SANDBOX_MODES.join(', ')}`
86
+ );
87
+ }
88
+ return raw;
89
+ }
90
+
69
91
  const DEFAULT_PERMISSION_TIMEOUT = 600;
70
92
 
71
93
  /**
@@ -110,6 +132,7 @@ function loadConfig() {
110
132
  const { mode: permissionMode, warnings: modeWarnings } = resolvePermissionMode(env);
111
133
  const { timeout: permissionTimeout, warnings: timeoutWarnings } = resolvePermissionTimeout(env);
112
134
  const permissionWarnings = [...modeWarnings, ...timeoutWarnings];
135
+ const codexSandboxMode = resolveCodexSandboxMode(env);
113
136
 
114
137
  const config = {
115
138
  // Operating mode: 'standalone' runs own WS server, 'actioncable' connects to Rails
@@ -165,6 +188,10 @@ function loadConfig() {
165
188
  // Path to the Codex CLI binary, for chats on a Codex model (#480)
166
189
  codexCommand: env.CODEX_COMMAND || 'codex',
167
190
 
191
+ // Sandbox every Codex chat runs in (#723): read-only, workspace-write or
192
+ // danger-full-access. The Codex counterpart of permissionMode.
193
+ codexSandboxMode,
194
+
168
195
  // Stale session timeout in seconds — kill alive processes with no activity beyond this threshold.
169
196
  // Safety net for when WebSocket-based deactivation messages are lost.
170
197
  // Default: off (0). It never ran on a real process before #488 restored
@@ -212,4 +239,4 @@ function loadConfig() {
212
239
  return Object.freeze(config);
213
240
  }
214
241
 
215
- module.exports = { loadConfig, PERMISSION_MODES };
242
+ module.exports = { loadConfig, PERMISSION_MODES, CODEX_SANDBOX_MODES };
package/src/daemon.js CHANGED
@@ -305,6 +305,7 @@ class Daemon extends EventEmitter {
305
305
  claudeCommand: this._config.claudeCommand || 'claude',
306
306
  codexCommand: this._config.codexCommand || 'codex',
307
307
  permissionMode: this._config.permissionMode || 'auto',
308
+ codexSandboxMode: this._config.codexSandboxMode || 'workspace-write',
308
309
  sessionEnv: options.sessionEnv || {},
309
310
  systemPrompt,
310
311
  model,
package/src/index.js CHANGED
@@ -20,6 +20,7 @@ function main() {
20
20
  maxSessions: config.maxSessions,
21
21
  workingDir: config.workingDir,
22
22
  permissionMode: config.permissionMode,
23
+ codexSandboxMode: config.codexSandboxMode,
23
24
  });
24
25
 
25
26
  for (const warning of config.permissionWarnings) {