@lifeaitools/clauth 1.5.69 → 1.5.70
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/cli/commands/serve.js +21 -34
- package/package.json +1 -1
package/cli/commands/serve.js
CHANGED
|
@@ -5366,12 +5366,18 @@ function spawnClaudeTask(prompt, jobId, cwd) {
|
|
|
5366
5366
|
}
|
|
5367
5367
|
|
|
5368
5368
|
activeCliWorkers++;
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5369
|
+
// Use cmd /c with shell: false so Node quotes each argument properly for
|
|
5370
|
+
// CreateProcess. This prevents prompts containing spaces from being parsed
|
|
5371
|
+
// as separate CLI flags by Windows. Works for both .cmd and plain binaries.
|
|
5372
|
+
const proc = spawnProc(
|
|
5373
|
+
'cmd', ['/c', binary, '-p', prompt, '--dangerously-skip-permissions'],
|
|
5374
|
+
{
|
|
5375
|
+
cwd: cwd || CHITCHAT_FALLBACK_CWD,
|
|
5376
|
+
env: process.env,
|
|
5377
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
5378
|
+
shell: false,
|
|
5379
|
+
}
|
|
5380
|
+
);
|
|
5375
5381
|
|
|
5376
5382
|
const startedAt = Date.now();
|
|
5377
5383
|
proc.on('close', (code) => {
|
|
@@ -5561,34 +5567,15 @@ async function startChitchatSession(name) {
|
|
|
5561
5567
|
|
|
5562
5568
|
const binary = findClaudeBinary();
|
|
5563
5569
|
|
|
5564
|
-
// Spawn
|
|
5565
|
-
//
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
);
|
|
5573
|
-
const child = spawnProc(wtPath, [
|
|
5574
|
-
'new-tab', '--title', `collab-${session_id.slice(0, 8)}`,
|
|
5575
|
-
'--', 'powershell.exe', '-NoExit', '-File', ps1Path
|
|
5576
|
-
], { detached: true, stdio: 'ignore', shell: false });
|
|
5577
|
-
child.on('error', err => {
|
|
5578
|
-
console.warn(`[ClaudeAItoCLI] wt spawn failed (${err.message}) — fallback to cmd /c start`);
|
|
5579
|
-
try {
|
|
5580
|
-
execSyncTop(
|
|
5581
|
-
`cmd /c start "" wt.exe new-tab --title "collab-${session_id.slice(0, 8)}" -- powershell.exe -NoExit -File "${ps1Path}"`,
|
|
5582
|
-
{ stdio: 'ignore', shell: true }
|
|
5583
|
-
);
|
|
5584
|
-
} catch (e2) {
|
|
5585
|
-
console.warn(`[ClaudeAItoCLI] fallback also failed: ${e2.message} — run manually: cd ${CHITCHAT_CWD} && npx clauth chitchat --session ${session_id}`);
|
|
5586
|
-
}
|
|
5587
|
-
});
|
|
5588
|
-
child.unref();
|
|
5589
|
-
console.log(`[ClaudeAItoCLI] spawned terminal tab for session ${session_id}`);
|
|
5590
|
-
} catch (err) {
|
|
5591
|
-
console.warn(`[ClaudeAItoCLI] could not spawn terminal: ${err.message}`);
|
|
5570
|
+
// Spawn the Claude Code agent directly via spawnClaudeTask.
|
|
5571
|
+
// Embeds the session ID as plain text in the prompt so there are no
|
|
5572
|
+
// shell-quoting issues with --session being parsed as a Claude flag.
|
|
5573
|
+
const prompt = `You are joining a chitchat collab session. Session ID: ${session_id}. Run /rdc:collab --session ${session_id}`;
|
|
5574
|
+
const spawnResult = spawnClaudeTask(prompt, `chitchat-${session_id.slice(0, 8)}`, CHITCHAT_FALLBACK_CWD);
|
|
5575
|
+
if (spawnResult.error) {
|
|
5576
|
+
console.warn(`[ClaudeAItoCLI] spawnClaudeTask failed: ${spawnResult.error} — ${spawnResult.message}`);
|
|
5577
|
+
} else {
|
|
5578
|
+
console.log(`[ClaudeAItoCLI] spawned agent pid=${spawnResult.pid} for session ${session_id}`);
|
|
5592
5579
|
}
|
|
5593
5580
|
|
|
5594
5581
|
// Queue greeting so claude.ai gets an immediate response on first chitchat_recv
|