claude-code-controller 0.4.0 → 0.5.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.
@@ -8,7 +8,7 @@ interface InboxMessage {
8
8
  read: boolean;
9
9
  summary?: string;
10
10
  }
11
- type StructuredMessage = TaskAssignmentMessage | ShutdownRequestMessage | ShutdownApprovedMessage | IdleNotificationMessage | PlanApprovalRequestMessage | PlanApprovalResponseMessage | PermissionRequestMessage | PermissionResponseMessage | PlainTextMessage;
11
+ type StructuredMessage = TaskAssignmentMessage | TaskCompletedMessage | ShutdownRequestMessage | ShutdownApprovedMessage | IdleNotificationMessage | PlanApprovalRequestMessage | PlanApprovalResponseMessage | PermissionRequestMessage | PermissionResponseMessage | SandboxPermissionRequestMessage | SandboxPermissionResponseMessage | PlainTextMessage;
12
12
  interface TaskAssignmentMessage {
13
13
  type: "task_assignment";
14
14
  taskId: string;
@@ -37,6 +37,10 @@ interface IdleNotificationMessage {
37
37
  from: string;
38
38
  timestamp: string;
39
39
  idleReason: string;
40
+ summary?: string;
41
+ completedTaskId?: string;
42
+ completedStatus?: string;
43
+ failureReason?: string;
40
44
  }
41
45
  interface PlanApprovalRequestMessage {
42
46
  type: "plan_approval_request";
@@ -71,6 +75,29 @@ interface PermissionResponseMessage {
71
75
  approved: boolean;
72
76
  timestamp: string;
73
77
  }
78
+ interface TaskCompletedMessage {
79
+ type: "task_completed";
80
+ from: string;
81
+ taskId: string;
82
+ taskSubject: string;
83
+ timestamp: string;
84
+ }
85
+ interface SandboxPermissionRequestMessage {
86
+ type: "sandbox_permission_request";
87
+ requestId: string;
88
+ workerId: string;
89
+ workerName: string;
90
+ workerColor?: string;
91
+ hostPattern: string;
92
+ timestamp: string;
93
+ }
94
+ interface SandboxPermissionResponseMessage {
95
+ type: "sandbox_permission_response";
96
+ requestId: string;
97
+ host: string;
98
+ allow: boolean;
99
+ timestamp: string;
100
+ }
74
101
  interface PlainTextMessage {
75
102
  type: "plain_text";
76
103
  text: string;
@@ -88,10 +115,14 @@ interface TeamMember {
88
115
  name: string;
89
116
  agentType: string;
90
117
  model?: string;
118
+ prompt?: string;
119
+ color?: string;
120
+ planModeRequired?: boolean;
91
121
  joinedAt: number;
92
122
  tmuxPaneId?: string;
93
123
  cwd: string;
94
124
  subscriptions?: string[];
125
+ backendType?: string;
95
126
  }
96
127
  interface TaskFile {
97
128
  id: string;
@@ -105,7 +136,7 @@ interface TaskFile {
105
136
  metadata?: Record<string, unknown>;
106
137
  }
107
138
  type TaskStatus = "pending" | "in_progress" | "completed";
108
- type AgentType = "general-purpose" | "Bash" | "Explore" | "Plan" | string;
139
+ type AgentType = "general-purpose" | "Bash" | "Explore" | "Plan" | "claude-code-guide" | "statusline-setup" | string;
109
140
  type PermissionMode = "default" | "acceptEdits" | "bypassPermissions" | "plan" | "dontAsk" | "delegate";
110
141
  interface SpawnAgentOptions {
111
142
  name: string;
@@ -134,7 +165,7 @@ interface ReceiveOptions {
134
165
  }
135
166
  interface ControllerEvents {
136
167
  message: [agentName: string, message: InboxMessage];
137
- idle: [agentName: string];
168
+ idle: [agentName: string, details: IdleNotificationMessage];
138
169
  "shutdown:approved": [agentName: string, message: ShutdownApprovedMessage];
139
170
  "plan:approval_request": [agentName: string, message: PlanApprovalRequestMessage];
140
171
  "permission:request": [agentName: string, message: PermissionRequestMessage];
@@ -632,4 +663,4 @@ declare const claude: typeof claudeCall & {
632
663
  session: (opts?: SessionOptions) => Promise<Session>;
633
664
  };
634
665
 
635
- export { Agent as A, type TeamConfig as B, ClaudeCodeController as C, TeamManager as D, type TeamMember as E, claude as F, type InboxMessage as I, type Logger as L, type PermissionMode as P, type ReceiveOptions as R, type StructuredMessage as S, type TaskAssignmentMessage as T, type LogLevel as a, type AgentEvents as b, AgentHandle as c, type AgentType as d, type AskOptions as e, type ClaudeOptions as f, type ControllerEvents as g, type ControllerOptions as h, type IdleNotificationMessage as i, type PermissionPreset as j, type PermissionRequestInfo as k, type PermissionRequestMessage as l, type PermissionResponseMessage as m, type PlainTextMessage as n, type PlanApprovalRequestMessage as o, type PlanApprovalResponseMessage as p, type PlanRequestInfo as q, Session as r, type SessionAgentOptions as s, type SessionOptions as t, type ShutdownApprovedMessage as u, type ShutdownRequestMessage as v, type SpawnAgentOptions as w, type TaskFile as x, TaskManager as y, type TaskStatus as z };
666
+ export { Agent as A, type TaskFile as B, ClaudeCodeController as C, TaskManager as D, type TaskStatus as E, type TeamConfig as F, TeamManager as G, type TeamMember as H, type InboxMessage as I, claude as J, type Logger as L, type PermissionMode as P, type ReceiveOptions as R, type StructuredMessage as S, type TaskAssignmentMessage as T, type LogLevel as a, type AgentEvents as b, AgentHandle as c, type AgentType as d, type AskOptions as e, type ClaudeOptions as f, type ControllerEvents as g, type ControllerOptions as h, type IdleNotificationMessage as i, type PermissionPreset as j, type PermissionRequestInfo as k, type PermissionRequestMessage as l, type PermissionResponseMessage as m, type PlainTextMessage as n, type PlanApprovalRequestMessage as o, type PlanApprovalResponseMessage as p, type PlanRequestInfo as q, type SandboxPermissionRequestMessage as r, type SandboxPermissionResponseMessage as s, Session as t, type SessionAgentOptions as u, type SessionOptions as v, type ShutdownApprovedMessage as w, type ShutdownRequestMessage as x, type SpawnAgentOptions as y, type TaskCompletedMessage as z };
@@ -8,7 +8,7 @@ interface InboxMessage {
8
8
  read: boolean;
9
9
  summary?: string;
10
10
  }
11
- type StructuredMessage = TaskAssignmentMessage | ShutdownRequestMessage | ShutdownApprovedMessage | IdleNotificationMessage | PlanApprovalRequestMessage | PlanApprovalResponseMessage | PermissionRequestMessage | PermissionResponseMessage | PlainTextMessage;
11
+ type StructuredMessage = TaskAssignmentMessage | TaskCompletedMessage | ShutdownRequestMessage | ShutdownApprovedMessage | IdleNotificationMessage | PlanApprovalRequestMessage | PlanApprovalResponseMessage | PermissionRequestMessage | PermissionResponseMessage | SandboxPermissionRequestMessage | SandboxPermissionResponseMessage | PlainTextMessage;
12
12
  interface TaskAssignmentMessage {
13
13
  type: "task_assignment";
14
14
  taskId: string;
@@ -37,6 +37,10 @@ interface IdleNotificationMessage {
37
37
  from: string;
38
38
  timestamp: string;
39
39
  idleReason: string;
40
+ summary?: string;
41
+ completedTaskId?: string;
42
+ completedStatus?: string;
43
+ failureReason?: string;
40
44
  }
41
45
  interface PlanApprovalRequestMessage {
42
46
  type: "plan_approval_request";
@@ -71,6 +75,29 @@ interface PermissionResponseMessage {
71
75
  approved: boolean;
72
76
  timestamp: string;
73
77
  }
78
+ interface TaskCompletedMessage {
79
+ type: "task_completed";
80
+ from: string;
81
+ taskId: string;
82
+ taskSubject: string;
83
+ timestamp: string;
84
+ }
85
+ interface SandboxPermissionRequestMessage {
86
+ type: "sandbox_permission_request";
87
+ requestId: string;
88
+ workerId: string;
89
+ workerName: string;
90
+ workerColor?: string;
91
+ hostPattern: string;
92
+ timestamp: string;
93
+ }
94
+ interface SandboxPermissionResponseMessage {
95
+ type: "sandbox_permission_response";
96
+ requestId: string;
97
+ host: string;
98
+ allow: boolean;
99
+ timestamp: string;
100
+ }
74
101
  interface PlainTextMessage {
75
102
  type: "plain_text";
76
103
  text: string;
@@ -88,10 +115,14 @@ interface TeamMember {
88
115
  name: string;
89
116
  agentType: string;
90
117
  model?: string;
118
+ prompt?: string;
119
+ color?: string;
120
+ planModeRequired?: boolean;
91
121
  joinedAt: number;
92
122
  tmuxPaneId?: string;
93
123
  cwd: string;
94
124
  subscriptions?: string[];
125
+ backendType?: string;
95
126
  }
96
127
  interface TaskFile {
97
128
  id: string;
@@ -105,7 +136,7 @@ interface TaskFile {
105
136
  metadata?: Record<string, unknown>;
106
137
  }
107
138
  type TaskStatus = "pending" | "in_progress" | "completed";
108
- type AgentType = "general-purpose" | "Bash" | "Explore" | "Plan" | string;
139
+ type AgentType = "general-purpose" | "Bash" | "Explore" | "Plan" | "claude-code-guide" | "statusline-setup" | string;
109
140
  type PermissionMode = "default" | "acceptEdits" | "bypassPermissions" | "plan" | "dontAsk" | "delegate";
110
141
  interface SpawnAgentOptions {
111
142
  name: string;
@@ -134,7 +165,7 @@ interface ReceiveOptions {
134
165
  }
135
166
  interface ControllerEvents {
136
167
  message: [agentName: string, message: InboxMessage];
137
- idle: [agentName: string];
168
+ idle: [agentName: string, details: IdleNotificationMessage];
138
169
  "shutdown:approved": [agentName: string, message: ShutdownApprovedMessage];
139
170
  "plan:approval_request": [agentName: string, message: PlanApprovalRequestMessage];
140
171
  "permission:request": [agentName: string, message: PermissionRequestMessage];
@@ -632,4 +663,4 @@ declare const claude: typeof claudeCall & {
632
663
  session: (opts?: SessionOptions) => Promise<Session>;
633
664
  };
634
665
 
635
- export { Agent as A, type TeamConfig as B, ClaudeCodeController as C, TeamManager as D, type TeamMember as E, claude as F, type InboxMessage as I, type Logger as L, type PermissionMode as P, type ReceiveOptions as R, type StructuredMessage as S, type TaskAssignmentMessage as T, type LogLevel as a, type AgentEvents as b, AgentHandle as c, type AgentType as d, type AskOptions as e, type ClaudeOptions as f, type ControllerEvents as g, type ControllerOptions as h, type IdleNotificationMessage as i, type PermissionPreset as j, type PermissionRequestInfo as k, type PermissionRequestMessage as l, type PermissionResponseMessage as m, type PlainTextMessage as n, type PlanApprovalRequestMessage as o, type PlanApprovalResponseMessage as p, type PlanRequestInfo as q, Session as r, type SessionAgentOptions as s, type SessionOptions as t, type ShutdownApprovedMessage as u, type ShutdownRequestMessage as v, type SpawnAgentOptions as w, type TaskFile as x, TaskManager as y, type TaskStatus as z };
666
+ export { Agent as A, type TaskFile as B, ClaudeCodeController as C, TaskManager as D, type TaskStatus as E, type TeamConfig as F, TeamManager as G, type TeamMember as H, type InboxMessage as I, claude as J, type Logger as L, type PermissionMode as P, type ReceiveOptions as R, type StructuredMessage as S, type TaskAssignmentMessage as T, type LogLevel as a, type AgentEvents as b, AgentHandle as c, type AgentType as d, type AskOptions as e, type ClaudeOptions as f, type ControllerEvents as g, type ControllerOptions as h, type IdleNotificationMessage as i, type PermissionPreset as j, type PermissionRequestInfo as k, type PermissionRequestMessage as l, type PermissionResponseMessage as m, type PlainTextMessage as n, type PlanApprovalRequestMessage as o, type PlanApprovalResponseMessage as p, type PlanRequestInfo as q, type SandboxPermissionRequestMessage as r, type SandboxPermissionResponseMessage as s, Session as t, type SessionAgentOptions as u, type SessionOptions as v, type ShutdownApprovedMessage as w, type ShutdownRequestMessage as x, type SpawnAgentOptions as y, type TaskCompletedMessage as z };
package/dist/index.cjs CHANGED
@@ -420,6 +420,7 @@ else:
420
420
  stdio: ["pipe", "pipe", "pipe"],
421
421
  env: {
422
422
  ...process.env,
423
+ CLAUDECODE: "1",
423
424
  CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS: "1",
424
425
  ...opts.env
425
426
  }
@@ -753,7 +754,10 @@ var silentLogger = {
753
754
  var PROTOCOL_ONLY_TYPES = /* @__PURE__ */ new Set([
754
755
  "shutdown_approved",
755
756
  "plan_approval_response",
756
- "permission_response"
757
+ "permission_response",
758
+ "task_completed",
759
+ "sandbox_permission_request",
760
+ "sandbox_permission_response"
757
761
  ]);
758
762
  var AGENT_COLORS = [
759
763
  "#00FF00",
@@ -861,6 +865,10 @@ var ClaudeCodeController = class extends import_node_events.EventEmitter {
861
865
  name: opts.name,
862
866
  agentType: opts.type || "general-purpose",
863
867
  model: opts.model,
868
+ prompt: opts.prompt,
869
+ color,
870
+ planModeRequired: false,
871
+ backendType: "in-process",
864
872
  joinedAt: Date.now(),
865
873
  tmuxPaneId: "",
866
874
  cwd,
@@ -1103,7 +1111,7 @@ var ClaudeCodeController = class extends import_node_events.EventEmitter {
1103
1111
  const { raw, parsed } = event;
1104
1112
  switch (parsed.type) {
1105
1113
  case "idle_notification":
1106
- this.emit("idle", raw.from);
1114
+ this.emit("idle", raw.from, parsed);
1107
1115
  break;
1108
1116
  case "shutdown_approved":
1109
1117
  this.log.info(
@@ -1123,6 +1131,9 @@ var ClaudeCodeController = class extends import_node_events.EventEmitter {
1123
1131
  );
1124
1132
  this.emit("permission:request", raw.from, parsed);
1125
1133
  break;
1134
+ case "task_completed":
1135
+ this.emit("message", raw.from, raw);
1136
+ break;
1126
1137
  case "plain_text":
1127
1138
  this.emit("message", raw.from, raw);
1128
1139
  break;
@@ -1177,7 +1188,7 @@ function waitForReady(controller, agentName, timeoutMs = 15e3) {
1177
1188
  )
1178
1189
  );
1179
1190
  }, timeoutMs);
1180
- const onReady = (name) => {
1191
+ const onReady = (name, ..._rest) => {
1181
1192
  if (name === agentName && !settled) {
1182
1193
  settled = true;
1183
1194
  cleanup();
@@ -1392,7 +1403,7 @@ IMPORTANT: You MUST send your complete answer back using the SendMessage tool. D
1392
1403
  const onMessage = (name, msg) => {
1393
1404
  if (name === agentName) this.emit("message", msg.text);
1394
1405
  };
1395
- const onIdle = (name) => {
1406
+ const onIdle = (name, _details) => {
1396
1407
  if (name === agentName) this.emit("idle");
1397
1408
  };
1398
1409
  const onPermission = (name, parsed) => {