@lifeaitools/clauth 1.5.52 → 1.5.53
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 +28 -18
- package/cli/index.js +41 -0
- package/package.json +1 -1
package/cli/commands/serve.js
CHANGED
|
@@ -5265,24 +5265,34 @@ async function startChitchatSession(name) {
|
|
|
5265
5265
|
};
|
|
5266
5266
|
terminalSessions.set(session_id, session);
|
|
5267
5267
|
|
|
5268
|
-
// Spawn a
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
console.warn(`[ClaudeAItoCLI]
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5268
|
+
// Spawn a Windows Terminal tab running `npx clauth chitchat --session <id>`
|
|
5269
|
+
// Uses LOCALAPPDATA WindowsApps path (App Execution Alias — not visible to fs.existsSync but spawnable)
|
|
5270
|
+
try {
|
|
5271
|
+
const wtPath = path.join(process.env.LOCALAPPDATA || '', 'Microsoft', 'WindowsApps', 'wt.exe');
|
|
5272
|
+
const ps1Path = path.join(os.tmpdir(), `clauth-collab-${session_id.slice(0, 8)}.ps1`);
|
|
5273
|
+
fs.writeFileSync(ps1Path,
|
|
5274
|
+
`Set-Location '${CHITCHAT_CWD}'\r\n` +
|
|
5275
|
+
`npx clauth chitchat --session ${session_id}\r\n`
|
|
5276
|
+
);
|
|
5277
|
+
const child = spawnProc(wtPath, [
|
|
5278
|
+
'new-tab', '--title', `collab-${session_id.slice(0, 8)}`,
|
|
5279
|
+
'--', 'powershell.exe', '-NoExit', '-File', ps1Path
|
|
5280
|
+
], { detached: true, stdio: 'ignore', shell: false });
|
|
5281
|
+
child.on('error', err => {
|
|
5282
|
+
console.warn(`[ClaudeAItoCLI] wt spawn failed (${err.message}) — fallback to cmd /c start`);
|
|
5283
|
+
try {
|
|
5284
|
+
execSyncTop(
|
|
5285
|
+
`cmd /c start "" wt.exe new-tab --title "collab-${session_id.slice(0, 8)}" -- powershell.exe -NoExit -File "${ps1Path}"`,
|
|
5286
|
+
{ stdio: 'ignore', shell: true }
|
|
5287
|
+
);
|
|
5288
|
+
} catch (e2) {
|
|
5289
|
+
console.warn(`[ClaudeAItoCLI] fallback also failed: ${e2.message} — run manually: cd ${CHITCHAT_CWD} && npx clauth chitchat --session ${session_id}`);
|
|
5290
|
+
}
|
|
5291
|
+
});
|
|
5292
|
+
child.unref();
|
|
5293
|
+
console.log(`[ClaudeAItoCLI] spawned terminal tab for session ${session_id}`);
|
|
5294
|
+
} catch (err) {
|
|
5295
|
+
console.warn(`[ClaudeAItoCLI] could not spawn terminal: ${err.message}`);
|
|
5286
5296
|
}
|
|
5287
5297
|
|
|
5288
5298
|
// 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
|
// ──────────────────────────────────────────────
|