ccgateway 0.1.7 → 0.1.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/dist/async-watcher.d.ts +48 -0
- package/dist/async-watcher.d.ts.map +1 -0
- package/dist/async-watcher.js +183 -0
- package/dist/async-watcher.js.map +1 -0
- package/dist/daemon.d.ts.map +1 -1
- package/dist/daemon.js +35 -2
- package/dist/daemon.js.map +1 -1
- package/dist/messaging.d.ts.map +1 -1
- package/dist/messaging.js +11 -2
- package/dist/messaging.js.map +1 -1
- package/dist/plugins/slack-gateway.d.ts.map +1 -1
- package/dist/plugins/slack-gateway.js +27 -1
- package/dist/plugins/slack-gateway.js.map +1 -1
- package/dist/router.d.ts +11 -1
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +189 -8
- package/dist/router.js.map +1 -1
- package/dist/spawner.d.ts +44 -5
- package/dist/spawner.d.ts.map +1 -1
- package/dist/spawner.js +278 -19
- package/dist/spawner.js.map +1 -1
- package/package.json +1 -1
package/dist/spawner.js
CHANGED
|
@@ -1,18 +1,120 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { spawn, execSync } from "node:child_process";
|
|
2
|
+
import { writeFileSync, mkdirSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { randomBytes } from "node:crypto";
|
|
2
5
|
// ── CCSpawner ──────────────────────────────────────────────────────────────
|
|
3
6
|
const DEFAULT_TIMEOUT_MS = 300_000; // 5 minutes
|
|
7
|
+
const IMAGE_TIMEOUT_MS = 600_000; // 10 minutes — vision calls on Opus are slower
|
|
4
8
|
export class CCSpawner {
|
|
9
|
+
static TRIAGE_TIMEOUT_MS = 15_000;
|
|
10
|
+
static TRIAGE_PROMPT = `Given this user request, will it require intensive coding work (multiple file edits, building features, refactoring, debugging across files) or is it a quick task (answering questions, small edits, short explanations)?
|
|
11
|
+
|
|
12
|
+
Respond with ONLY the single word "async" or "sync". Nothing else.
|
|
13
|
+
|
|
14
|
+
User request:`;
|
|
5
15
|
/**
|
|
6
|
-
*
|
|
16
|
+
* Run a quick `claude --print` with Sonnet to classify a message as
|
|
17
|
+
* "sync" (quick task) or "async" (intensive, long-running).
|
|
7
18
|
*
|
|
8
|
-
*
|
|
9
|
-
|
|
10
|
-
|
|
19
|
+
* Defaults to "sync" on timeout, unexpected output, or errors.
|
|
20
|
+
*/
|
|
21
|
+
async triage(message, _model) {
|
|
22
|
+
const triageModel = "sonnet";
|
|
23
|
+
const args = [
|
|
24
|
+
"--print",
|
|
25
|
+
"--dangerously-skip-permissions",
|
|
26
|
+
"-p",
|
|
27
|
+
`${CCSpawner.TRIAGE_PROMPT} ${message}`,
|
|
28
|
+
"--model",
|
|
29
|
+
triageModel,
|
|
30
|
+
"--bare",
|
|
31
|
+
];
|
|
32
|
+
return new Promise((resolve) => {
|
|
33
|
+
const child = spawn("claude", args, {
|
|
34
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
35
|
+
});
|
|
36
|
+
let stdout = "";
|
|
37
|
+
let timedOut = false;
|
|
38
|
+
child.stdout.on("data", (chunk) => {
|
|
39
|
+
stdout += chunk.toString();
|
|
40
|
+
});
|
|
41
|
+
const timer = setTimeout(() => {
|
|
42
|
+
timedOut = true;
|
|
43
|
+
child.kill("SIGTERM");
|
|
44
|
+
}, CCSpawner.TRIAGE_TIMEOUT_MS);
|
|
45
|
+
child.on("close", () => {
|
|
46
|
+
clearTimeout(timer);
|
|
47
|
+
if (timedOut) {
|
|
48
|
+
resolve("sync");
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const trimmed = stdout.trim().toLowerCase();
|
|
52
|
+
resolve(trimmed === "async" ? "async" : "sync");
|
|
53
|
+
});
|
|
54
|
+
child.on("error", () => {
|
|
55
|
+
clearTimeout(timer);
|
|
56
|
+
resolve("sync");
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Spawn a `claude --print` invocation.
|
|
11
62
|
*
|
|
12
|
-
*
|
|
63
|
+
* When `images` are provided, uses `--input-format stream-json` to pass
|
|
64
|
+
* image content blocks directly via stdin (avoids the Read-tool
|
|
65
|
+
* round-trip). Otherwise falls back to the simpler `-p "<message>"` form
|
|
66
|
+
* with stdin closed.
|
|
13
67
|
*/
|
|
14
68
|
async spawn(options) {
|
|
15
|
-
const
|
|
69
|
+
const hasImages = options.images && options.images.length > 0;
|
|
70
|
+
return hasImages ? this.spawnStreamJson(options) : this.spawnText(options);
|
|
71
|
+
}
|
|
72
|
+
// ── Multiplexer detection ────────────────────────────────────────────
|
|
73
|
+
detectMultiplexer() {
|
|
74
|
+
try {
|
|
75
|
+
execSync("which tmux", { stdio: "pipe" });
|
|
76
|
+
return "tmux";
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
// tmux not found, try screen
|
|
80
|
+
}
|
|
81
|
+
try {
|
|
82
|
+
execSync("which screen", { stdio: "pipe" });
|
|
83
|
+
return "screen";
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
// screen not found either
|
|
87
|
+
}
|
|
88
|
+
throw new Error("Neither tmux nor screen is installed. Install one to use async tasks.");
|
|
89
|
+
}
|
|
90
|
+
// ── Async spawn (background task via tmux/screen) ───────────────────
|
|
91
|
+
async spawnAsync(options) {
|
|
92
|
+
const { workspace, message, systemPrompt, model, ccgHome, agentId } = options;
|
|
93
|
+
const mux = this.detectMultiplexer();
|
|
94
|
+
const shortId = randomBytes(2).toString("hex");
|
|
95
|
+
const sessionName = `ccg-${agentId}-${shortId}`;
|
|
96
|
+
const taskDir = join(ccgHome, "async-tasks", sessionName);
|
|
97
|
+
mkdirSync(taskDir, { recursive: true });
|
|
98
|
+
// Write system prompt + result instruction
|
|
99
|
+
const instructions = `${systemPrompt}\n\nWhen you are completely finished with the task, write a concise summary of what you did to: ${join(taskDir, "RESULT.md")}`;
|
|
100
|
+
writeFileSync(join(taskDir, "INSTRUCTIONS.md"), instructions, "utf-8");
|
|
101
|
+
const outputLog = join(taskDir, "output.log");
|
|
102
|
+
const instructionsFile = join(taskDir, "INSTRUCTIONS.md");
|
|
103
|
+
// Escape single quotes in message for shell
|
|
104
|
+
const escapedMessage = message.replace(/'/g, "'\\''");
|
|
105
|
+
if (mux === "tmux") {
|
|
106
|
+
const cmd = `tmux new-session -d -s ${sessionName} -c '${workspace}' "claude --dangerously-skip-permissions --append-system-prompt-file '${instructionsFile}' --model ${model} -p '${escapedMessage}' 2>&1 | tee '${outputLog}'"`;
|
|
107
|
+
execSync(cmd, { stdio: "pipe" });
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
const cmd = `screen -dmS ${sessionName} bash -c "cd '${workspace}' && claude --dangerously-skip-permissions --append-system-prompt-file '${instructionsFile}' --model ${model} -p '${escapedMessage}' 2>&1 | tee '${outputLog}'"`;
|
|
111
|
+
execSync(cmd, { stdio: "pipe" });
|
|
112
|
+
}
|
|
113
|
+
return { sessionName, taskDir };
|
|
114
|
+
}
|
|
115
|
+
// ── Text-only path ────────────────────────────────────────────────────
|
|
116
|
+
spawnText(options) {
|
|
117
|
+
const { workspace, message, systemPrompt, model, timeoutMs = DEFAULT_TIMEOUT_MS, } = options;
|
|
16
118
|
const args = [
|
|
17
119
|
"--print",
|
|
18
120
|
"--dangerously-skip-permissions",
|
|
@@ -23,24 +125,124 @@ export class CCSpawner {
|
|
|
23
125
|
"--model",
|
|
24
126
|
model,
|
|
25
127
|
];
|
|
26
|
-
// allowedTools intentionally omitted — agents have full access
|
|
27
|
-
// since we run with --dangerously-skip-permissions
|
|
28
128
|
return new Promise((resolve) => {
|
|
29
|
-
|
|
129
|
+
const child = spawn("claude", args, {
|
|
130
|
+
cwd: workspace,
|
|
131
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
132
|
+
});
|
|
133
|
+
let stdout = "";
|
|
134
|
+
let stderr = "";
|
|
135
|
+
let timedOut = false;
|
|
136
|
+
child.stdout.on("data", (chunk) => {
|
|
137
|
+
stdout += chunk.toString();
|
|
138
|
+
});
|
|
139
|
+
child.stderr.on("data", (chunk) => {
|
|
140
|
+
stderr += chunk.toString();
|
|
141
|
+
});
|
|
142
|
+
const timer = setTimeout(() => {
|
|
143
|
+
timedOut = true;
|
|
144
|
+
child.kill("SIGTERM");
|
|
145
|
+
setTimeout(() => {
|
|
146
|
+
if (!child.killed)
|
|
147
|
+
child.kill("SIGKILL");
|
|
148
|
+
}, 5000);
|
|
149
|
+
}, timeoutMs);
|
|
150
|
+
child.on("close", (code) => {
|
|
151
|
+
clearTimeout(timer);
|
|
152
|
+
const exitCode = timedOut ? 124 : (code ?? 1);
|
|
153
|
+
const inputChars = message.length + systemPrompt.length;
|
|
154
|
+
const outputChars = stdout.length;
|
|
155
|
+
resolve({
|
|
156
|
+
response: stdout,
|
|
157
|
+
stderr,
|
|
158
|
+
exitCode,
|
|
159
|
+
tokensEstimate: {
|
|
160
|
+
in: Math.ceil(inputChars / 4),
|
|
161
|
+
out: Math.ceil(outputChars / 4),
|
|
162
|
+
},
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
child.on("error", (err) => {
|
|
166
|
+
clearTimeout(timer);
|
|
167
|
+
resolve({
|
|
168
|
+
response: "",
|
|
169
|
+
stderr: err.message,
|
|
170
|
+
exitCode: 1,
|
|
171
|
+
tokensEstimate: {
|
|
172
|
+
in: Math.ceil((message.length + systemPrompt.length) / 4),
|
|
173
|
+
out: 0,
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
// ── Image-aware path (stream-json) ────────────────────────────────────
|
|
180
|
+
spawnStreamJson(options) {
|
|
181
|
+
const { workspace, message, systemPrompt, model, images = [], timeoutMs = IMAGE_TIMEOUT_MS, } = options;
|
|
182
|
+
const args = [
|
|
183
|
+
"--print",
|
|
184
|
+
"--dangerously-skip-permissions",
|
|
185
|
+
"--input-format",
|
|
186
|
+
"stream-json",
|
|
187
|
+
"--output-format",
|
|
188
|
+
"stream-json",
|
|
189
|
+
"--verbose",
|
|
190
|
+
"--append-system-prompt",
|
|
191
|
+
systemPrompt,
|
|
192
|
+
"--model",
|
|
193
|
+
model,
|
|
194
|
+
];
|
|
195
|
+
// Build structured content: images first, then text
|
|
196
|
+
const content = [];
|
|
197
|
+
for (const img of images) {
|
|
198
|
+
content.push({
|
|
199
|
+
type: "image",
|
|
200
|
+
source: {
|
|
201
|
+
type: "base64",
|
|
202
|
+
media_type: img.mediaType,
|
|
203
|
+
data: img.base64,
|
|
204
|
+
},
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
content.push({ type: "text", text: message });
|
|
208
|
+
const stdinPayload = JSON.stringify({
|
|
209
|
+
type: "user",
|
|
210
|
+
message: { role: "user", content },
|
|
211
|
+
}) + "\n";
|
|
212
|
+
return new Promise((resolve) => {
|
|
213
|
+
const child = spawn("claude", args, {
|
|
30
214
|
cwd: workspace,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
215
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
216
|
+
});
|
|
217
|
+
let stdout = "";
|
|
218
|
+
let stderr = "";
|
|
219
|
+
let timedOut = false;
|
|
220
|
+
child.stdout.on("data", (chunk) => {
|
|
221
|
+
stdout += chunk.toString();
|
|
222
|
+
});
|
|
223
|
+
child.stderr.on("data", (chunk) => {
|
|
224
|
+
stderr += chunk.toString();
|
|
225
|
+
});
|
|
226
|
+
// Write the user message and close stdin to signal completion
|
|
227
|
+
child.stdin.write(stdinPayload);
|
|
228
|
+
child.stdin.end();
|
|
229
|
+
const timer = setTimeout(() => {
|
|
230
|
+
timedOut = true;
|
|
231
|
+
child.kill("SIGTERM");
|
|
232
|
+
setTimeout(() => {
|
|
233
|
+
if (!child.killed)
|
|
234
|
+
child.kill("SIGKILL");
|
|
235
|
+
}, 5000);
|
|
236
|
+
}, timeoutMs);
|
|
237
|
+
child.on("close", (code) => {
|
|
238
|
+
clearTimeout(timer);
|
|
239
|
+
const exitCode = timedOut ? 124 : (code ?? 1);
|
|
240
|
+
const response = parseStreamOutput(stdout);
|
|
40
241
|
const inputChars = message.length + systemPrompt.length;
|
|
41
242
|
const outputChars = response.length;
|
|
42
243
|
resolve({
|
|
43
244
|
response,
|
|
245
|
+
stderr,
|
|
44
246
|
exitCode,
|
|
45
247
|
tokensEstimate: {
|
|
46
248
|
in: Math.ceil(inputChars / 4),
|
|
@@ -48,7 +250,64 @@ export class CCSpawner {
|
|
|
48
250
|
},
|
|
49
251
|
});
|
|
50
252
|
});
|
|
253
|
+
child.on("error", (err) => {
|
|
254
|
+
clearTimeout(timer);
|
|
255
|
+
resolve({
|
|
256
|
+
response: "",
|
|
257
|
+
stderr: err.message,
|
|
258
|
+
exitCode: 1,
|
|
259
|
+
tokensEstimate: {
|
|
260
|
+
in: Math.ceil((message.length + systemPrompt.length) / 4),
|
|
261
|
+
out: 0,
|
|
262
|
+
},
|
|
263
|
+
});
|
|
264
|
+
});
|
|
51
265
|
});
|
|
52
266
|
}
|
|
53
267
|
}
|
|
268
|
+
// ── Stream-json output parser ─────────────────────────────────────────────
|
|
269
|
+
/**
|
|
270
|
+
* Extract the assistant's text response from stream-json JSONL output.
|
|
271
|
+
*
|
|
272
|
+
* Looks for a `{"type":"result","result":"..."}` event first (final output),
|
|
273
|
+
* then falls back to collecting text from assistant message content blocks.
|
|
274
|
+
*/
|
|
275
|
+
export function parseStreamOutput(stdout) {
|
|
276
|
+
const lines = stdout.split("\n").filter(Boolean);
|
|
277
|
+
// 1. Look for a result event (the definitive final output)
|
|
278
|
+
for (const line of lines) {
|
|
279
|
+
try {
|
|
280
|
+
const event = JSON.parse(line);
|
|
281
|
+
if (event.type === "result" && typeof event.result === "string") {
|
|
282
|
+
return event.result;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
catch {
|
|
286
|
+
// skip non-JSON lines
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
// 2. Fallback: collect text from assistant message content blocks
|
|
290
|
+
const textParts = [];
|
|
291
|
+
for (const line of lines) {
|
|
292
|
+
try {
|
|
293
|
+
const event = JSON.parse(line);
|
|
294
|
+
if (event.type === "assistant" &&
|
|
295
|
+
Array.isArray(event.message?.content)) {
|
|
296
|
+
for (const block of event.message.content) {
|
|
297
|
+
if (block.type === "text" && typeof block.text === "string") {
|
|
298
|
+
textParts.push(block.text);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
catch {
|
|
304
|
+
// skip non-JSON lines
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
if (textParts.length > 0) {
|
|
308
|
+
return textParts.join("");
|
|
309
|
+
}
|
|
310
|
+
// 3. Last resort: return raw stdout
|
|
311
|
+
return stdout;
|
|
312
|
+
}
|
|
54
313
|
//# sourceMappingURL=spawner.js.map
|
package/dist/spawner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spawner.js","sourceRoot":"","sources":["../src/spawner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"spawner.js","sourceRoot":"","sources":["../src/spawner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AA0C1C,8EAA8E;AAE9E,MAAM,kBAAkB,GAAG,OAAO,CAAC,CAAC,YAAY;AAChD,MAAM,gBAAgB,GAAG,OAAO,CAAC,CAAC,+CAA+C;AAEjF,MAAM,OAAO,SAAS;IACZ,MAAM,CAAU,iBAAiB,GAA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