codekin 0.3.6 → 0.4.0

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 (55) hide show
  1. package/README.md +13 -2
  2. package/bin/codekin.mjs +2 -1
  3. package/dist/assets/index-BAdQqYEY.js +182 -0
  4. package/dist/assets/index-CeZYNLWt.css +1 -0
  5. package/dist/index.html +2 -2
  6. package/package.json +8 -2
  7. package/server/dist/approval-manager.d.ts +44 -8
  8. package/server/dist/approval-manager.js +262 -23
  9. package/server/dist/approval-manager.js.map +1 -1
  10. package/server/dist/claude-process.d.ts +16 -1
  11. package/server/dist/claude-process.js +36 -12
  12. package/server/dist/claude-process.js.map +1 -1
  13. package/server/dist/commit-event-handler.d.ts +41 -0
  14. package/server/dist/commit-event-handler.js +99 -0
  15. package/server/dist/commit-event-handler.js.map +1 -0
  16. package/server/dist/commit-event-hooks.d.ts +35 -0
  17. package/server/dist/commit-event-hooks.js +177 -0
  18. package/server/dist/commit-event-hooks.js.map +1 -0
  19. package/server/dist/crypto-utils.js +10 -5
  20. package/server/dist/crypto-utils.js.map +1 -1
  21. package/server/dist/diff-parser.d.ts +23 -0
  22. package/server/dist/diff-parser.js +236 -0
  23. package/server/dist/diff-parser.js.map +1 -0
  24. package/server/dist/session-archive.js +6 -1
  25. package/server/dist/session-archive.js.map +1 -1
  26. package/server/dist/session-manager.d.ts +25 -8
  27. package/server/dist/session-manager.js +370 -30
  28. package/server/dist/session-manager.js.map +1 -1
  29. package/server/dist/session-routes.js +101 -4
  30. package/server/dist/session-routes.js.map +1 -1
  31. package/server/dist/stepflow-handler.js +19 -5
  32. package/server/dist/stepflow-handler.js.map +1 -1
  33. package/server/dist/tsconfig.tsbuildinfo +1 -1
  34. package/server/dist/types.d.ts +63 -8
  35. package/server/dist/upload-routes.d.ts +1 -1
  36. package/server/dist/upload-routes.js +40 -13
  37. package/server/dist/upload-routes.js.map +1 -1
  38. package/server/dist/webhook-handler.js +2 -2
  39. package/server/dist/webhook-handler.js.map +1 -1
  40. package/server/dist/webhook-workspace.js +5 -2
  41. package/server/dist/webhook-workspace.js.map +1 -1
  42. package/server/dist/workflow-loader.d.ts +6 -0
  43. package/server/dist/workflow-loader.js +11 -0
  44. package/server/dist/workflow-loader.js.map +1 -1
  45. package/server/dist/workflow-routes.d.ts +5 -1
  46. package/server/dist/workflow-routes.js +49 -8
  47. package/server/dist/workflow-routes.js.map +1 -1
  48. package/server/dist/ws-message-handler.js +19 -2
  49. package/server/dist/ws-message-handler.js.map +1 -1
  50. package/server/dist/ws-server.js +37 -9
  51. package/server/dist/ws-server.js.map +1 -1
  52. package/server/workflows/commit-review.md +22 -0
  53. package/server/workflows/docs-audit.weekly.md +97 -0
  54. package/dist/assets/index-Cp27uOZO.js +0 -174
  55. package/dist/assets/index-D3SqBuHB.css +0 -1
@@ -11,13 +11,27 @@ import { join } from 'path';
11
11
  import { DATA_DIR } from './config.js';
12
12
  const REPO_APPROVALS_FILE = join(DATA_DIR, 'repo-approvals.json');
13
13
  const PERSIST_DEBOUNCE_MS = 2000;
14
+ /**
15
+ * Minimum number of repos that must have independently approved the same
16
+ * tool/command/pattern before it is auto-approved globally (cross-repo).
17
+ */
18
+ const CROSS_REPO_THRESHOLD = 2;
14
19
  export class ApprovalManager {
15
20
  /** Repo-level auto-approval store, keyed by workingDir (repo path). */
16
21
  repoApprovals = new Map();
17
22
  _approvalPersistTimer = null;
18
23
  constructor() {
24
+ this.validatePrefixSets();
19
25
  this.restoreRepoApprovalsFromDisk();
20
26
  }
27
+ /** Warn at startup if any single-token prefix appears in both allow and deny lists. */
28
+ validatePrefixSets() {
29
+ for (const prefix of ApprovalManager.PATTERNABLE_PREFIXES) {
30
+ if (ApprovalManager.NEVER_PATTERN_PREFIXES.has(prefix)) {
31
+ console.warn(`[approval-manager] WARNING: "${prefix}" is in both PATTERNABLE_PREFIXES and NEVER_PATTERN_PREFIXES — deny takes precedence for single-token; two-token allow overrides first-token deny`);
32
+ }
33
+ }
34
+ }
21
35
  /** Get or create the approval entry for a repo (workingDir). */
22
36
  getRepoApprovalEntry(workingDir) {
23
37
  let entry = this.repoApprovals.get(workingDir);
@@ -39,35 +53,76 @@ export class ApprovalManager {
39
53
  this.persistRepoApprovalsDebounced();
40
54
  }
41
55
  /**
42
- * Command prefixes where prefix-based auto-approval is safe.
43
- * Only commands whose behavior is determined by later arguments (not by target)
44
- * should be listed here. Dangerous commands like rm, sudo, curl, etc. require
45
- * exact match to prevent escalation (e.g. approving `rm -rf /tmp/x` should NOT
46
- * also approve `rm -rf /`).
56
+ * Prefixes where pattern-based grouping is safe. Used by derivePattern()
57
+ * and compactExactCommands() to create "prefix *" patterns.
58
+ *
59
+ * IMPORTANT: Inclusion here does NOT auto-approve anything the user
60
+ * still explicitly approves the pattern. It only means "we can group
61
+ * `git push origin feat/x` and `git push origin feat/y` into one
62
+ * `git push *` pattern" instead of storing each as an exact match.
47
63
  */
48
- static SAFE_PREFIX_COMMANDS = new Set([
64
+ static PATTERNABLE_PREFIXES = new Set([
65
+ // Git operations — safe to group by subcommand
49
66
  'git add', 'git commit', 'git diff', 'git log', 'git show', 'git stash',
50
67
  'git status', 'git branch', 'git checkout', 'git switch', 'git rebase',
51
68
  'git fetch', 'git pull', 'git merge', 'git tag', 'git rev-parse',
69
+ 'git remote', 'git cherry-pick',
70
+ 'git worktree', 'git archive',
71
+ // GitHub CLI
72
+ 'gh pr', 'gh repo', 'gh run', 'gh search',
73
+ 'gh issue', 'gh release',
74
+ // Package managers — Node (two-token subcommands only; bare executors are in NEVER list)
52
75
  'npm run', 'npm test', 'npm install', 'npm ci', 'npm exec',
53
- 'npx', 'node', 'bun', 'deno',
76
+ 'yarn run', 'yarn test', 'yarn install', 'yarn add',
77
+ 'pnpm test', 'pnpm run', 'pnpm install',
78
+ 'pnpm --filter', 'pnpm typecheck',
79
+ 'bun run', 'bun test', 'bun install',
80
+ // Build / compile (two-token subcommands only)
54
81
  'cargo build', 'cargo test', 'cargo run', 'cargo check', 'cargo clippy',
55
82
  'make', 'cmake',
56
- 'python', 'python3', 'pip install',
83
+ 'pip install',
57
84
  'go build', 'go test', 'go run', 'go vet',
58
85
  'tsc', 'eslint', 'prettier',
86
+ // File inspection (read-only)
59
87
  'cat', 'head', 'tail', 'wc', 'sort', 'uniq', 'diff', 'less',
60
88
  'ls', 'pwd', 'echo', 'date', 'which', 'whoami', 'env', 'printenv',
61
89
  'find', 'grep', 'rg', 'ag', 'fd',
62
90
  'mkdir', 'touch',
91
+ 'file', 'du', 'stat', 'tree',
92
+ 'basename', 'dirname', 'realpath',
93
+ ]);
94
+ /**
95
+ * Prefixes that should NEVER be auto-patterned, even if the user
96
+ * clicks "Always Allow". These are stored as exact match only.
97
+ */
98
+ static NEVER_PATTERN_PREFIXES = new Set([
99
+ 'ssh', 'docker', 'docker-compose',
100
+ 'rm', 'sudo', 'curl', 'wget',
101
+ 'git reset', 'git clean',
102
+ 'git push', // cross-remote escalation risk — require exact match
103
+ 'gh api', // can perform DELETE/PUT — too broad to pattern
104
+ // Code executors — "node *" / "python *" would match arbitrary code execution
105
+ 'node', 'npx', 'python', 'python3', 'deno', 'bun', 'pm2',
63
106
  ]);
64
107
  /**
65
108
  * Check if a tool/command is auto-approved for a repo.
66
109
  * For Bash commands, uses prefix matching only for safe commands;
67
110
  * dangerous commands require exact match to prevent escalation.
111
+ *
112
+ * Falls back to cross-repo inference: if the same tool/command/pattern
113
+ * has been approved in CROSS_REPO_THRESHOLD or more other repos,
114
+ * it is auto-approved everywhere.
68
115
  */
69
116
  checkAutoApproval(workingDir, toolName, toolInput) {
70
- const approvals = this.getRepoApprovalEntry(workingDir);
117
+ if (this.checkRepoApproval(workingDir, toolName, toolInput))
118
+ return true;
119
+ return this.checkCrossRepoApproval(workingDir, toolName, toolInput);
120
+ }
121
+ /** Check approvals for a single repo (no cross-repo fallback). */
122
+ checkRepoApproval(workingDir, toolName, toolInput) {
123
+ const approvals = this.repoApprovals.get(workingDir);
124
+ if (!approvals)
125
+ return false;
71
126
  if (approvals.tools.has(toolName))
72
127
  return true;
73
128
  if (toolName === 'Bash') {
@@ -82,7 +137,7 @@ export class ApprovalManager {
82
137
  }
83
138
  // Prefix match only for safe commands
84
139
  const cmdPrefix = this.commandPrefix(cmd);
85
- if (cmdPrefix && ApprovalManager.SAFE_PREFIX_COMMANDS.has(cmdPrefix)) {
140
+ if (cmdPrefix && ApprovalManager.PATTERNABLE_PREFIXES.has(cmdPrefix)) {
86
141
  for (const approved of approvals.commands) {
87
142
  if (this.commandPrefix(approved) === cmdPrefix)
88
143
  return true;
@@ -91,6 +146,60 @@ export class ApprovalManager {
91
146
  }
92
147
  return false;
93
148
  }
149
+ /**
150
+ * Cross-repo inference: if enough other repos have approved the same
151
+ * tool/command/pattern, auto-approve it for this repo too.
152
+ */
153
+ checkCrossRepoApproval(workingDir, toolName, toolInput) {
154
+ let count = 0;
155
+ for (const [dir, entry] of this.repoApprovals) {
156
+ if (dir === workingDir)
157
+ continue;
158
+ // Check tool approval
159
+ if (toolName !== 'Bash') {
160
+ if (entry.tools.has(toolName))
161
+ count++;
162
+ }
163
+ else {
164
+ const cmd = (typeof toolInput.command === 'string' ? toolInput.command : '').trim();
165
+ let matched = false;
166
+ // Exact command match
167
+ if (entry.commands.has(cmd))
168
+ matched = true;
169
+ // Pattern match
170
+ if (!matched) {
171
+ for (const pattern of entry.patterns) {
172
+ if (this.matchesPattern(pattern, cmd)) {
173
+ matched = true;
174
+ break;
175
+ }
176
+ }
177
+ }
178
+ // Prefix match for safe commands
179
+ if (!matched) {
180
+ const cmdPrefix = this.commandPrefix(cmd);
181
+ if (cmdPrefix && ApprovalManager.PATTERNABLE_PREFIXES.has(cmdPrefix)) {
182
+ for (const approved of entry.commands) {
183
+ if (this.commandPrefix(approved) === cmdPrefix) {
184
+ matched = true;
185
+ break;
186
+ }
187
+ }
188
+ }
189
+ }
190
+ if (matched)
191
+ count++;
192
+ }
193
+ if (count >= CROSS_REPO_THRESHOLD) {
194
+ const label = toolName === 'Bash'
195
+ ? `command: ${(typeof toolInput.command === 'string' ? toolInput.command : '').slice(0, 80)}`
196
+ : `tool: ${toolName}`;
197
+ console.log(`[auto-approve] cross-repo inference (${count} repos) for ${workingDir}: ${label}`);
198
+ return true;
199
+ }
200
+ }
201
+ return false;
202
+ }
94
203
  /** Extract the command prefix (first two tokens) for prefix-based matching. */
95
204
  commandPrefix(cmd) {
96
205
  const tokens = cmd.split(/\s+/).filter(Boolean);
@@ -101,7 +210,7 @@ export class ApprovalManager {
101
210
  return `${tokens[0]} ${tokens[1]}`;
102
211
  }
103
212
  /**
104
- * Derive a glob pattern from a tool invocation for "Approve Pattern".
213
+ * Derive a glob pattern from a tool invocation for "Always Allow".
105
214
  * Returns a string like "cat *" or "git diff *", or null if no safe pattern applies.
106
215
  * Patterns use the format "<prefix> *" meaning "this prefix followed by anything".
107
216
  */
@@ -112,18 +221,25 @@ export class ApprovalManager {
112
221
  const tokens = cmd.split(/\s+/).filter(Boolean);
113
222
  if (tokens.length === 0)
114
223
  return null;
115
- // Check single-token safe commands (cat, grep, ls, etc.)
224
+ // Never pattern commands with shell meta-characters — the pattern
225
+ // would be far broader than the specific command the user approved
226
+ if (/[|;&`$(){}]/.test(cmd) || cmd.includes('\n'))
227
+ return null;
116
228
  const first = tokens[0];
117
- if (ApprovalManager.SAFE_PREFIX_COMMANDS.has(first)) {
229
+ const twoToken = tokens.length >= 2 ? `${tokens[0]} ${tokens[1]}` : '';
230
+ // Two-token deny-list always wins (e.g. "git push", "git reset")
231
+ if (twoToken && ApprovalManager.NEVER_PATTERN_PREFIXES.has(twoToken))
232
+ return null;
233
+ // Two-token allow-list takes priority over first-token deny
234
+ // (e.g. "bun run" is safe even though bare "bun" is denied)
235
+ if (twoToken && ApprovalManager.PATTERNABLE_PREFIXES.has(twoToken))
236
+ return `${twoToken} *`;
237
+ // First-token deny-list blocks remaining single-token patterns
238
+ if (ApprovalManager.NEVER_PATTERN_PREFIXES.has(first))
239
+ return null;
240
+ // First-token allow-list
241
+ if (ApprovalManager.PATTERNABLE_PREFIXES.has(first))
118
242
  return `${first} *`;
119
- }
120
- // Check two-token safe commands (git diff, npm run, etc.)
121
- if (tokens.length >= 2) {
122
- const twoToken = `${tokens[0]} ${tokens[1]}`;
123
- if (ApprovalManager.SAFE_PREFIX_COMMANDS.has(twoToken)) {
124
- return `${twoToken} *`;
125
- }
126
- }
127
243
  return null;
128
244
  }
129
245
  /**
@@ -137,12 +253,24 @@ export class ApprovalManager {
137
253
  }
138
254
  return cmd === pattern;
139
255
  }
140
- /** Save an "Always Allow" approval for a tool/command. */
256
+ /**
257
+ * Save an "Always Allow" approval for a tool/command.
258
+ * For Bash commands, stores a pattern when derivable (e.g. "git push *"),
259
+ * falling back to exact match only for commands without a safe pattern.
260
+ */
141
261
  saveAlwaysAllow(workingDir, toolName, toolInput) {
142
262
  if (toolName === 'Bash') {
143
263
  const cmd = (typeof toolInput.command === 'string' ? toolInput.command : '').trim();
264
+ // Try to derive a pattern first (e.g. "git diff *", "npm run *")
265
+ const pattern = this.derivePattern(toolName, toolInput);
266
+ if (pattern) {
267
+ this.addRepoApproval(workingDir, { pattern });
268
+ console.log(`[auto-approve] saved pattern for repo ${workingDir}: ${pattern}`);
269
+ return;
270
+ }
271
+ // For commands with no safe pattern, store exact match
144
272
  this.addRepoApproval(workingDir, { command: cmd });
145
- console.log(`[auto-approve] saved command for repo ${workingDir}: ${cmd.slice(0, 80)}`);
273
+ console.log(`[auto-approve] saved exact command for repo ${workingDir}: ${cmd.slice(0, 80)}`);
146
274
  }
147
275
  else {
148
276
  this.addRepoApproval(workingDir, { tool: toolName });
@@ -172,6 +300,46 @@ export class ApprovalManager {
172
300
  patterns: Array.from(entry.patterns).sort(),
173
301
  };
174
302
  }
303
+ /**
304
+ * Return approvals that are effective globally via cross-repo inference
305
+ * (approved in CROSS_REPO_THRESHOLD+ repos). Each entry includes the
306
+ * repos that contributed to it.
307
+ */
308
+ getGlobalApprovals() {
309
+ const toolCounts = new Map();
310
+ const commandCounts = new Map();
311
+ const patternCounts = new Map();
312
+ for (const [dir, entry] of this.repoApprovals) {
313
+ for (const tool of entry.tools) {
314
+ const dirs = toolCounts.get(tool) || [];
315
+ dirs.push(dir);
316
+ toolCounts.set(tool, dirs);
317
+ }
318
+ for (const cmd of entry.commands) {
319
+ const dirs = commandCounts.get(cmd) || [];
320
+ dirs.push(dir);
321
+ commandCounts.set(cmd, dirs);
322
+ }
323
+ for (const pattern of entry.patterns) {
324
+ const dirs = patternCounts.get(pattern) || [];
325
+ dirs.push(dir);
326
+ patternCounts.set(pattern, dirs);
327
+ }
328
+ }
329
+ const filterAboveThreshold = (counts) => {
330
+ const result = {};
331
+ for (const [key, dirs] of counts) {
332
+ if (dirs.length >= CROSS_REPO_THRESHOLD)
333
+ result[key] = dirs.sort();
334
+ }
335
+ return result;
336
+ };
337
+ return {
338
+ tools: filterAboveThreshold(toolCounts),
339
+ commands: filterAboveThreshold(commandCounts),
340
+ patterns: filterAboveThreshold(patternCounts),
341
+ };
342
+ }
175
343
  /** Remove an auto-approval rule for a repo (workingDir) and persist to disk.
176
344
  * Returns 'invalid' if no tool/command provided, or boolean indicating if something was deleted.
177
345
  * Pass skipPersist=true for bulk operations (caller must call persistRepoApprovals after). */
@@ -244,6 +412,77 @@ export class ApprovalManager {
244
412
  catch (err) {
245
413
  console.error('Failed to restore repo approvals from disk:', err);
246
414
  }
415
+ this.compactExactCommands();
416
+ }
417
+ /** Compact exact commands that could be represented by existing patterns. */
418
+ compactExactCommands() {
419
+ let totalRemoved = 0;
420
+ for (const [, entry] of this.repoApprovals) {
421
+ if (entry.commands.size === 0)
422
+ continue;
423
+ const toRemove = new Set();
424
+ // Phase 1: Remove exact commands already covered by existing patterns
425
+ if (entry.patterns.size > 0) {
426
+ for (const cmd of entry.commands) {
427
+ for (const pattern of entry.patterns) {
428
+ if (this.matchesPattern(pattern, cmd)) {
429
+ toRemove.add(cmd);
430
+ break;
431
+ }
432
+ }
433
+ }
434
+ }
435
+ // Phase 2: If 3+ exact commands share a patternable prefix,
436
+ // create a pattern and mark the exact commands for removal.
437
+ const prefixGroups = new Map();
438
+ for (const cmd of entry.commands) {
439
+ if (toRemove.has(cmd))
440
+ continue;
441
+ const tokens = cmd.split(/\s+/).filter(Boolean);
442
+ if (tokens.length === 0)
443
+ continue;
444
+ const firstToken = tokens[0];
445
+ let prefix = tokens.length >= 2 ? `${tokens[0]} ${tokens[1]}` : firstToken;
446
+ // Two-token deny always wins
447
+ if (ApprovalManager.NEVER_PATTERN_PREFIXES.has(prefix))
448
+ continue;
449
+ // Two-token allow takes priority over first-token deny (e.g. "bun run" safe, bare "bun" denied)
450
+ if (!ApprovalManager.PATTERNABLE_PREFIXES.has(prefix)) {
451
+ // First-token deny blocks remaining single-token patterns
452
+ if (ApprovalManager.NEVER_PATTERN_PREFIXES.has(firstToken))
453
+ continue;
454
+ if (ApprovalManager.PATTERNABLE_PREFIXES.has(firstToken)) {
455
+ prefix = firstToken;
456
+ }
457
+ else {
458
+ continue;
459
+ }
460
+ }
461
+ // Skip commands with shell meta-characters
462
+ if (/[|;&`$(){}]/.test(cmd) || cmd.includes('\n'))
463
+ continue;
464
+ const group = prefixGroups.get(prefix) || [];
465
+ group.push(cmd);
466
+ prefixGroups.set(prefix, group);
467
+ }
468
+ for (const [prefix, cmds] of prefixGroups) {
469
+ if (cmds.length >= 3) {
470
+ const pattern = `${prefix} *`;
471
+ if (!entry.patterns.has(pattern)) {
472
+ entry.patterns.add(pattern);
473
+ }
474
+ for (const cmd of cmds)
475
+ toRemove.add(cmd);
476
+ }
477
+ }
478
+ for (const cmd of toRemove)
479
+ entry.commands.delete(cmd);
480
+ totalRemoved += toRemove.size;
481
+ }
482
+ if (totalRemoved > 0) {
483
+ console.log(`[auto-approve] compacted ${totalRemoved} exact commands into patterns`);
484
+ this.persistRepoApprovals();
485
+ }
247
486
  }
248
487
  }
249
488
  //# sourceMappingURL=approval-manager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"approval-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wBACjC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;oBAC7B,CAAC;oBACD,KAAK,MAAM,GAAG,IAAI,IAAI;wBAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;gBAC3C,CAAC;YACH,CAAC;YAED,KAAK,MAAM,GAAG,IAAI,QAAQ;gBAAE,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;YACtD,YAAY,IAAI,QAAQ,CAAC,IAAI,CAAA;QAC/B,CAAC;QACD,IAAI,YAAY,GAAG,CAAC,EAAE,CAAC;YACrB,OAAO,CAAC,GAAG,CAAC,4BAA4B,YAAY,+BAA+B,CAAC,CAAA;YACpF,IAAI,CAAC,oBAAoB,EAAE,CAAA;QAC7B,CAAC;IACH,CAAC"}
@@ -29,6 +29,7 @@ export interface ClaudeProcessEvents {
29
29
  control_request: [requestId: string, toolName: string, toolInput: Record<string, unknown>];
30
30
  planning_mode: [active: boolean];
31
31
  todo_update: [tasks: TaskItem[]];
32
+ image: [base64: string, mediaType: string];
32
33
  result: [text: string, isError: boolean];
33
34
  error: [message: string];
34
35
  exit: [code: number | null, signal: string | null];
@@ -46,7 +47,6 @@ export declare class ClaudeProcess extends EventEmitter<ClaudeProcessEvents> {
46
47
  private alive;
47
48
  private currentToolName;
48
49
  private currentToolInput;
49
- private textBuffer;
50
50
  private inThinkingBlock;
51
51
  private thinkingText;
52
52
  private thinkingSummaryEmitted;
@@ -55,6 +55,14 @@ export declare class ClaudeProcess extends EventEmitter<ClaudeProcessEvents> {
55
55
  private taskSeq;
56
56
  /** Additional env vars passed to the child process (session ID, port, token). */
57
57
  private extraEnv;
58
+ /**
59
+ * @param workingDir Absolute path to the git repo where the Claude CLI runs.
60
+ * @param sessionId Claude session UUID for `--session-id`. Defaults to a random UUID
61
+ * (new conversation). Pass an existing ID to resume a session.
62
+ * @param extraEnv Additional environment variables merged into the child process env
63
+ * (e.g. `CC_WS_PORT`, `CC_AUTH_TOKEN` for port-forwarding and auth).
64
+ * @param model Claude model ID override (e.g. 'claude-opus-4-6'). Omit to use the CLI default.
65
+ */
58
66
  constructor(workingDir: string, sessionId?: string, extraEnv?: Record<string, string>, model?: string | undefined);
59
67
  /** Spawn the Claude CLI process with stream-json I/O and acceptEdits mode. */
60
68
  start(): void;
@@ -74,6 +82,13 @@ export declare class ClaudeProcess extends EventEmitter<ClaudeProcessEvents> {
74
82
  private handleAssistantMessage;
75
83
  /** Extract tool_result blocks from 'user' events and emit as tool_output. */
76
84
  private handleUserEvent;
85
+ /**
86
+ * Tools that are safe to auto-approve without user interaction.
87
+ * These are file operations and planning tools that acceptEdits mode already allows,
88
+ * plus harmless internal tools. Everything else is forwarded to the session manager
89
+ * for UI-based approval (or auto-approval registry check).
90
+ */
91
+ private static readonly AUTO_APPROVE_TOOLS;
77
92
  /**
78
93
  * Handle a control_request from the CLI.
79
94
  * With acceptEdits mode + PermissionRequest hook, most permissions go through hooks.
@@ -31,7 +31,6 @@ export class ClaudeProcess extends EventEmitter {
31
31
  // Tool tracking: accumulates partial_json input during streaming
32
32
  currentToolName = null;
33
33
  currentToolInput = '';
34
- textBuffer = '';
35
34
  // Extended thinking: extract a short summary from the thinking block
36
35
  inThinkingBlock = false;
37
36
  thinkingText = '';
@@ -44,6 +43,14 @@ export class ClaudeProcess extends EventEmitter {
44
43
  taskSeq = 0;
45
44
  /** Additional env vars passed to the child process (session ID, port, token). */
46
45
  extraEnv;
46
+ /**
47
+ * @param workingDir Absolute path to the git repo where the Claude CLI runs.
48
+ * @param sessionId Claude session UUID for `--session-id`. Defaults to a random UUID
49
+ * (new conversation). Pass an existing ID to resume a session.
50
+ * @param extraEnv Additional environment variables merged into the child process env
51
+ * (e.g. `CC_WS_PORT`, `CC_AUTH_TOKEN` for port-forwarding and auth).
52
+ * @param model Claude model ID override (e.g. 'claude-opus-4-6'). Omit to use the CLI default.
53
+ */
47
54
  constructor(workingDir, sessionId, extraEnv, model) {
48
55
  super();
49
56
  this.workingDir = workingDir;
@@ -135,7 +142,7 @@ export class ClaudeProcess extends EventEmitter {
135
142
  console.log(`[event] type=${event.type} subtype=${subtype || '-'}`);
136
143
  }
137
144
  // Log all event types we DON'T handle to catch unknown protocol messages
138
- if (!['system', 'stream_event', 'assistant', 'user', 'result', 'control_request', 'rate_limit_event'].includes(event.type)) {
145
+ if (!['system', 'stream_event', 'assistant', 'user', 'result', 'control_request'].includes(event.type)) {
139
146
  console.log(`[event-unhandled] type=${event.type} data=${JSON.stringify(event).slice(0, 300)}`);
140
147
  }
141
148
  switch (event.type) {
@@ -317,6 +324,16 @@ export class ClaudeProcess extends EventEmitter {
317
324
  }
318
325
  }
319
326
  }
327
+ /**
328
+ * Tools that are safe to auto-approve without user interaction.
329
+ * These are file operations and planning tools that acceptEdits mode already allows,
330
+ * plus harmless internal tools. Everything else is forwarded to the session manager
331
+ * for UI-based approval (or auto-approval registry check).
332
+ */
333
+ static AUTO_APPROVE_TOOLS = new Set([
334
+ 'Read', 'Write', 'Edit', 'Glob', 'Grep', 'NotebookEdit',
335
+ 'EnterPlanMode', 'TodoWrite', 'TodoRead', 'Task', 'TaskCreate', 'TaskUpdate',
336
+ ]);
320
337
  /**
321
338
  * Handle a control_request from the CLI.
322
339
  * With acceptEdits mode + PermissionRequest hook, most permissions go through hooks.
@@ -332,15 +349,19 @@ export class ClaudeProcess extends EventEmitter {
332
349
  // Each question has its own options and multiSelect flag; the frontend
333
350
  // walks the user through them one-by-one and returns all answers at once.
334
351
  const questions = toolInput?.questions;
335
- if (!Array.isArray(questions) || questions.length === 0)
352
+ if (!Array.isArray(questions) || questions.length === 0) {
353
+ console.warn(`[control_request] AskUserQuestion with no/empty questions array, forwarding as generic control_request`);
354
+ this.emit('control_request', request_id, toolName, toolInput);
336
355
  return;
356
+ }
357
+ console.log(`[control_request] AskUserQuestion received with ${questions.length} question(s), requestId=${request_id}`);
337
358
  const structuredQuestions = questions.map(q => ({
338
359
  question: q.question,
339
360
  header: q.header,
340
361
  multiSelect: q.multiSelect ?? false,
341
362
  options: (q.options || []).map((opt) => ({
342
363
  label: opt.label,
343
- value: opt.label,
364
+ value: opt.value ?? opt.label,
344
365
  description: opt.description,
345
366
  })),
346
367
  }));
@@ -354,16 +375,19 @@ export class ClaudeProcess extends EventEmitter {
354
375
  console.log(`[control_request] forwarding ExitPlanMode to session manager for user approval`);
355
376
  this.emit('control_request', request_id, toolName, toolInput);
356
377
  }
357
- else if (toolName === 'Bash') {
358
- // Bash runs arbitrary commands — forward to session manager for registry check / UI prompt
359
- console.log(`[control_request] forwarding Bash to session manager: ${redactSecrets(String(toolInput.command || '').slice(0, 80))}`);
360
- this.emit('control_request', request_id, toolName, toolInput);
378
+ else if (ClaudeProcess.AUTO_APPROVE_TOOLS.has(toolName)) {
379
+ // Known-safe tools: auto-approve without prompting
380
+ console.log(`[control_request] auto-approving safe tool: ${toolName}`);
381
+ this.sendControlResponse(request_id, 'allow');
361
382
  }
362
383
  else {
363
- // All other tools (Write, Edit, Read, Glob, Grep, Task, TodoWrite,
364
- // EnterPlanMode, etc.) are safe auto-approve
365
- console.log(`[control_request] auto-approving: ${toolName}`);
366
- this.sendControlResponse(request_id, 'allow');
384
+ // All other tools (Bash, WebSearch, WebFetch, Agent, etc.)
385
+ // Forward to session manager for registry check / UI prompt
386
+ const logDetail = toolName === 'Bash'
387
+ ? `: ${redactSecrets(String(toolInput.command || '').slice(0, 80))}`
388
+ : '';
389
+ console.log(`[control_request] forwarding ${toolName} to session manager for approval${logDetail}`);
390
+ this.emit('control_request', request_id, toolName, toolInput);
367
391
  }
368
392
  }
369
393
  /** Send a control_response back to the CLI to allow or deny a pending request. */