@lifeaitools/clauth 1.5.68 → 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.
@@ -5366,12 +5366,18 @@ function spawnClaudeTask(prompt, jobId, cwd) {
5366
5366
  }
5367
5367
 
5368
5368
  activeCliWorkers++;
5369
- const proc = spawnProc(binary, ['-p', prompt, '--dangerously-skip-permissions'], {
5370
- cwd: cwd || CHITCHAT_FALLBACK_CWD,
5371
- env: process.env,
5372
- stdio: ['ignore', 'pipe', 'pipe'],
5373
- shell: true,
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) => {
@@ -5405,7 +5411,7 @@ function startTerminalSession(name, knowledge_tier, context_md, cwd) {
5405
5411
  const preamble = context_md
5406
5412
  ? `${context_md}\n\n---\n`
5407
5413
  : '';
5408
- const initialContext = `${preamble}Session: ${name} | Tier: ${knowledge_tier}\nReady. Await instructions.`;
5414
+ const initialContext = `${preamble}Session: ${name}, Tier: ${knowledge_tier}\nReady. Await instructions.`;
5409
5415
  const session = {
5410
5416
  session_id,
5411
5417
  name,
@@ -5559,34 +5565,17 @@ async function startChitchatSession(name) {
5559
5565
  };
5560
5566
  terminalSessions.set(session_id, session);
5561
5567
 
5562
- // Spawn a Windows Terminal tab running `npx clauth chitchat --session <id>`
5563
- // Uses LOCALAPPDATA WindowsApps path (App Execution Alias — not visible to fs.existsSync but spawnable)
5564
- try {
5565
- const wtPath = path.join(process.env.LOCALAPPDATA || '', 'Microsoft', 'WindowsApps', 'wt.exe');
5566
- const ps1Path = path.join(os.tmpdir(), `clauth-collab-${session_id.slice(0, 8)}.ps1`);
5567
- fs.writeFileSync(ps1Path,
5568
- `Set-Location '${CHITCHAT_CWD}'\r\n` +
5569
- `npx clauth chitchat --session ${session_id}\r\n`
5570
- );
5571
- const child = spawnProc(wtPath, [
5572
- 'new-tab', '--title', `collab-${session_id.slice(0, 8)}`,
5573
- '--', 'powershell.exe', '-NoExit', '-File', ps1Path
5574
- ], { detached: true, stdio: 'ignore', shell: false });
5575
- child.on('error', err => {
5576
- console.warn(`[ClaudeAItoCLI] wt spawn failed (${err.message}) — fallback to cmd /c start`);
5577
- try {
5578
- execSyncTop(
5579
- `cmd /c start "" wt.exe new-tab --title "collab-${session_id.slice(0, 8)}" -- powershell.exe -NoExit -File "${ps1Path}"`,
5580
- { stdio: 'ignore', shell: true }
5581
- );
5582
- } catch (e2) {
5583
- console.warn(`[ClaudeAItoCLI] fallback also failed: ${e2.message} — run manually: cd ${CHITCHAT_CWD} && npx clauth chitchat --session ${session_id}`);
5584
- }
5585
- });
5586
- child.unref();
5587
- console.log(`[ClaudeAItoCLI] spawned terminal tab for session ${session_id}`);
5588
- } catch (err) {
5589
- console.warn(`[ClaudeAItoCLI] could not spawn terminal: ${err.message}`);
5568
+ const binary = findClaudeBinary();
5569
+
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}`);
5590
5579
  }
5591
5580
 
5592
5581
  // Queue greeting so claude.ai gets an immediate response on first chitchat_recv
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifeaitools/clauth",
3
- "version": "1.5.68",
3
+ "version": "1.5.70",
4
4
  "description": "Hardware-bound credential vault for the LIFEAI infrastructure stack",
5
5
  "type": "module",
6
6
  "bin": {