@lifeaitools/clauth 1.5.52 → 1.5.54

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.
@@ -3655,6 +3655,37 @@ function createServer(initPassword, whitelist, port, tunnelHostnameInit = null,
3655
3655
  return;
3656
3656
  }
3657
3657
 
3658
+ // GET /chitchat/:id — session status (used by clauth chitchat CLI to verify session exists)
3659
+ const chitchatStatusMatch = reqPath.match(/^\/chitchat\/([^/]+)$/);
3660
+ if (method === "GET" && chitchatStatusMatch) {
3661
+ const sid = chitchatStatusMatch[1];
3662
+ const s = terminalSessions.get(sid);
3663
+ if (!s || !s.is_chitchat) {
3664
+ res.writeHead(404, { "Content-Type": "application/json", ...CORS });
3665
+ return res.end(JSON.stringify({ error: "not_found" }));
3666
+ }
3667
+ res.writeHead(200, { "Content-Type": "application/json", ...CORS });
3668
+ return res.end(JSON.stringify({ session_id: sid, status: s.status, name: s.name, turn: s.turn }));
3669
+ }
3670
+
3671
+ // POST /chitchat/start — start a chitchat collab session (local REST, same as MCP chitchat_start)
3672
+ if (method === "POST" && reqPath === "/chitchat/start") {
3673
+ let body = "";
3674
+ req.on("data", d => body += d);
3675
+ req.on("end", async () => {
3676
+ try {
3677
+ const { name } = JSON.parse(body || "{}");
3678
+ const result = await startChitchatSession(name || "collab");
3679
+ res.writeHead(200, { "Content-Type": "application/json", ...CORS });
3680
+ res.end(JSON.stringify(result));
3681
+ } catch (e) {
3682
+ res.writeHead(500, { "Content-Type": "application/json", ...CORS });
3683
+ res.end(JSON.stringify({ error: e.message }));
3684
+ }
3685
+ });
3686
+ return;
3687
+ }
3688
+
3658
3689
  // POST /terminal/start — start a named terminal session
3659
3690
  if (method === "POST" && reqPath === "/terminal/start") {
3660
3691
  let body = "";
@@ -5265,24 +5296,34 @@ async function startChitchatSession(name) {
5265
5296
  };
5266
5297
  terminalSessions.set(session_id, session);
5267
5298
 
5268
- // Spawn a visible Windows Terminal running /rdc:collab --session <id>
5269
- const binary = findClaudeBinary();
5270
- if (binary) {
5271
- try {
5272
- // Open Windows Terminal in regen-root. Claude Code skills are interactive REPL commands
5273
- // so we print the session ID and start claude — user types /rdc:collab --session <id>
5274
- const banner = `echo. && echo [rdc:collab] Session ready: ${session_id} && echo Type: /rdc:collab --session ${session_id} && echo.`;
5275
- const child = spawnProc('wt.exe', [
5276
- 'new-tab', '--title', `rdc:collab ${name}`,
5277
- '--', 'cmd', '/k', `cd /d ${CHITCHAT_CWD} && ${banner} && ${binary} & pause`
5278
- ], { detached: true, stdio: 'ignore', shell: false });
5279
- child.unref();
5280
- console.log(`[ClaudeAItoCLI] spawned terminal for session ${session_id} binary=${binary}`);
5281
- } catch (err) {
5282
- console.warn(`[ClaudeAItoCLI] could not spawn terminal: ${err.message}`);
5283
- }
5284
- } else {
5285
- console.warn(`[ClaudeAItoCLI] claude binary not found in PATH — terminal not spawned. Run manually: cd ${CHITCHAT_CWD} && claude, then type /rdc:collab --session ${session_id}`);
5299
+ // Spawn a Windows Terminal tab running `npx clauth chitchat --session <id>`
5300
+ // Uses LOCALAPPDATA WindowsApps path (App Execution Alias — not visible to fs.existsSync but spawnable)
5301
+ try {
5302
+ const wtPath = path.join(process.env.LOCALAPPDATA || '', 'Microsoft', 'WindowsApps', 'wt.exe');
5303
+ const ps1Path = path.join(os.tmpdir(), `clauth-collab-${session_id.slice(0, 8)}.ps1`);
5304
+ fs.writeFileSync(ps1Path,
5305
+ `Set-Location '${CHITCHAT_CWD}'\r\n` +
5306
+ `npx clauth chitchat --session ${session_id}\r\n`
5307
+ );
5308
+ const child = spawnProc(wtPath, [
5309
+ 'new-tab', '--title', `collab-${session_id.slice(0, 8)}`,
5310
+ '--', 'powershell.exe', '-NoExit', '-File', ps1Path
5311
+ ], { detached: true, stdio: 'ignore', shell: false });
5312
+ child.on('error', err => {
5313
+ console.warn(`[ClaudeAItoCLI] wt spawn failed (${err.message}) — fallback to cmd /c start`);
5314
+ try {
5315
+ execSyncTop(
5316
+ `cmd /c start "" wt.exe new-tab --title "collab-${session_id.slice(0, 8)}" -- powershell.exe -NoExit -File "${ps1Path}"`,
5317
+ { stdio: 'ignore', shell: true }
5318
+ );
5319
+ } catch (e2) {
5320
+ console.warn(`[ClaudeAItoCLI] fallback also failed: ${e2.message} — run manually: cd ${CHITCHAT_CWD} && npx clauth chitchat --session ${session_id}`);
5321
+ }
5322
+ });
5323
+ child.unref();
5324
+ console.log(`[ClaudeAItoCLI] spawned terminal tab for session ${session_id}`);
5325
+ } catch (err) {
5326
+ console.warn(`[ClaudeAItoCLI] could not spawn terminal: ${err.message}`);
5286
5327
  }
5287
5328
 
5288
5329
  // Queue greeting so claude.ai gets an immediate response on first chitchat_recv
package/cli/index.js CHANGED
@@ -631,6 +631,47 @@ tunnelCmd
631
631
  }
632
632
  });
633
633
 
634
+ // ──────────────────────────────────────────────
635
+ // clauth chitchat --session <id>
636
+ // ──────────────────────────────────────────────
637
+ program
638
+ .command("chitchat")
639
+ .description("Join a chitchat collab session — opens claude interactively")
640
+ .requiredOption("--session <id>", "Session ID from claude.ai")
641
+ .action(async (opts) => {
642
+ const id = opts.session;
643
+ // Verify session exists in the daemon
644
+ try {
645
+ const r = await fetch(`http://127.0.0.1:52437/chitchat/${id}`, { signal: AbortSignal.timeout(3000) });
646
+ if (!r.ok) {
647
+ console.error(`\n ✗ Session ${id} not found (daemon returned ${r.status})\n`);
648
+ process.exit(1);
649
+ }
650
+ } catch (e) {
651
+ console.error(`\n ✗ Daemon not reachable at http://127.0.0.1:52437 — is clauth running?\n`);
652
+ process.exit(1);
653
+ }
654
+ console.log(chalk.cyan(`
655
+ ┌─────────────────────────────────────────────────┐
656
+ │ rdc:collab session ready │
657
+ │ │
658
+ │ Session: ${id} │
659
+ │ │
660
+ │ Type this in Claude Code: │
661
+ │ /rdc:collab --session ${id.slice(0,8)}... │
662
+ └─────────────────────────────────────────────────┘
663
+ `));
664
+ console.log(chalk.yellow(` /rdc:collab --session ${id}\n`));
665
+ // Launch claude interactively in this terminal
666
+ const { spawn } = await import("child_process");
667
+ const proc = spawn("claude", [], {
668
+ stdio: "inherit",
669
+ cwd: "C:/Dev/regen-root",
670
+ shell: true,
671
+ });
672
+ proc.on("exit", (code) => process.exit(code ?? 0));
673
+ });
674
+
634
675
  // ──────────────────────────────────────────────
635
676
  // clauth --help override banner
636
677
  // ──────────────────────────────────────────────
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifeaitools/clauth",
3
- "version": "1.5.52",
3
+ "version": "1.5.54",
4
4
  "description": "Hardware-bound credential vault for the LIFEAI infrastructure stack",
5
5
  "type": "module",
6
6
  "bin": {