@radnine/claude-session-daemon 0.2.3 → 0.2.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radnine/claude-session-daemon",
3
- "version": "0.2.3",
3
+ "version": "0.2.6",
4
4
  "description": "Node.js daemon for managing Claude CLI sessions",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {
@@ -25,6 +25,7 @@ class ClaudeProcess extends EventEmitter {
25
25
  * @param {string} [options.claudeSessionId] - UUID for --session-id flag
26
26
  * @param {object} [options.logger] - Logger instance
27
27
  * @param {string} [options.claudeCommand] - Path to claude binary
28
+ * @param {boolean} [options.skipPermissions] - Pass --dangerously-skip-permissions (only safe in Docker)
28
29
  * @param {Function} [options._spawnFn] - For testing: replacement for child_process.spawn
29
30
  */
30
31
  constructor(sessionId, options = {}) {
@@ -35,6 +36,7 @@ class ClaudeProcess extends EventEmitter {
35
36
  this._workingDir = options.workingDir || process.cwd();
36
37
  this._logger = options.logger || _defaultLogger();
37
38
  this._claudeCommand = options.claudeCommand || 'claude';
39
+ this._skipPermissions = options.skipPermissions || false;
38
40
  this._spawnFn = options._spawnFn || defaultSpawn;
39
41
 
40
42
  this._state = 'idle';
@@ -64,9 +66,12 @@ class ClaudeProcess extends EventEmitter {
64
66
  '--output-format', 'stream-json',
65
67
  '--session-id', this._claudeSessionId,
66
68
  '--replay-user-messages',
67
- '--dangerously-skip-permissions',
68
69
  ];
69
70
 
71
+ if (this._skipPermissions) {
72
+ args.push('--dangerously-skip-permissions');
73
+ }
74
+
70
75
  const env = { ...process.env, CLAUDE_SESSION_ID: this._sessionId };
71
76
  delete env.CLAUDECODE; // Prevent nested session detection
72
77
 
package/src/config.js CHANGED
@@ -51,6 +51,9 @@ function loadConfig() {
51
51
 
52
52
  // Daemon identifier (generated at runtime if not set)
53
53
  daemonId: env.CLAUDE_DAEMON_ID || null,
54
+
55
+ // Skip Claude CLI permission prompts (only safe inside Docker containers)
56
+ skipPermissions: env.CLAUDE_SKIP_PERMISSIONS === 'true',
54
57
  };
55
58
 
56
59
  // Validate mode
@@ -149,9 +149,10 @@ class StandaloneServer extends BaseConnection {
149
149
 
150
150
  _handleConnection(ws, req) {
151
151
  const isLocalhost = this._isLocalhostConnection(req);
152
+ const authDisabled = process.env.CLAUDE_DISABLE_AUTH === 'true';
152
153
 
153
- // Validate auth token from query param (skip for localhost)
154
- if (!isLocalhost) {
154
+ // Validate auth token from query param (skip for localhost or when auth disabled in Docker)
155
+ if (!isLocalhost && !authDisabled) {
155
156
  let token = null;
156
157
  try {
157
158
  const url = new URL(req.url, `http://localhost:${this.port}`);
@@ -298,6 +299,15 @@ class StandaloneServer extends BaseConnection {
298
299
  return;
299
300
  }
300
301
 
302
+ // Store user command in session history for replay
303
+ this._sessionStore.append(sessionId, {
304
+ type: 'user_input',
305
+ sessionId,
306
+ commandId,
307
+ text,
308
+ timestamp: Date.now(),
309
+ });
310
+
301
311
  // Track client as watching this session if not already
302
312
  if (!this._sessions.has(sessionId)) {
303
313
  this._sessions.set(sessionId, new Set());
package/src/daemon.js CHANGED
@@ -147,6 +147,7 @@ class Daemon extends EventEmitter {
147
147
  const proc = this._createProcess(sessionId, {
148
148
  workingDir: options.workingDir || this._config.workingDir,
149
149
  claudeSessionId: options.claudeSessionId,
150
+ skipPermissions: this._config.skipPermissions,
150
151
  logger: this._logger.child(`Session:${sessionId}`),
151
152
  });
152
153