@lifeaitools/clauth 1.5.53 → 1.5.55
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 +31 -0
- package/cli/index.js +29 -18
- package/package.json +1 -1
package/cli/commands/serve.js
CHANGED
|
@@ -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 = "";
|
package/cli/index.js
CHANGED
|
@@ -11,6 +11,7 @@ import { getMachineHash, deriveToken, deriveSeedHash } from "./fingerprint.js";
|
|
|
11
11
|
import * as api from "./api.js";
|
|
12
12
|
import os from "os";
|
|
13
13
|
import fs from "fs";
|
|
14
|
+
import path from "path";
|
|
14
15
|
|
|
15
16
|
const config = new Conf(getConfOptions());
|
|
16
17
|
const VERSION = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version;
|
|
@@ -636,7 +637,7 @@ tunnelCmd
|
|
|
636
637
|
// ──────────────────────────────────────────────
|
|
637
638
|
program
|
|
638
639
|
.command("chitchat")
|
|
639
|
-
.description("Join a chitchat collab session —
|
|
640
|
+
.description("Join a chitchat collab session — auto-starts /rdc:collab via claude -p")
|
|
640
641
|
.requiredOption("--session <id>", "Session ID from claude.ai")
|
|
641
642
|
.action(async (opts) => {
|
|
642
643
|
const id = opts.session;
|
|
@@ -651,25 +652,35 @@ program
|
|
|
651
652
|
console.error(`\n ✗ Daemon not reachable at http://127.0.0.1:52437 — is clauth running?\n`);
|
|
652
653
|
process.exit(1);
|
|
653
654
|
}
|
|
654
|
-
console.log(chalk.cyan(`
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
655
|
+
console.log(chalk.cyan(`\n [collab] session ${id} — starting /rdc:collab...\n`));
|
|
656
|
+
|
|
657
|
+
// Find claude binary (same candidates as daemon)
|
|
658
|
+
const { execSync: es, spawn } = await import("child_process");
|
|
659
|
+
let claudeBin = null;
|
|
660
|
+
for (const c of [
|
|
661
|
+
process.env.CLAUDE_BIN,
|
|
662
|
+
path.join(process.env.APPDATA || '', 'npm', 'claude.cmd'),
|
|
663
|
+
path.join(process.env.APPDATA || '', 'npm', 'claude'),
|
|
664
|
+
'claude',
|
|
665
|
+
].filter(Boolean)) {
|
|
666
|
+
try { es(`"${c}" --version`, { stdio: 'ignore', timeout: 3000 }); claudeBin = c; break; } catch {}
|
|
667
|
+
}
|
|
668
|
+
if (!claudeBin) {
|
|
669
|
+
console.error(' ✗ claude CLI not found — is @anthropic-ai/claude-code installed globally?');
|
|
670
|
+
process.exit(1);
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
// Auto-invoke /rdc:collab skill with streaming output to this terminal
|
|
674
|
+
const proc = spawn(claudeBin, [
|
|
675
|
+
'-p', `/rdc:collab --session ${id}`,
|
|
676
|
+
'--dangerously-skip-permissions',
|
|
677
|
+
], {
|
|
678
|
+
stdio: 'inherit',
|
|
679
|
+
cwd: 'C:/Dev/regen-root',
|
|
670
680
|
shell: true,
|
|
671
681
|
});
|
|
672
|
-
proc.on(
|
|
682
|
+
proc.on('error', e => { console.error(` ✗ spawn error: ${e.message}`); process.exit(1); });
|
|
683
|
+
proc.on('exit', code => process.exit(code ?? 0));
|
|
673
684
|
});
|
|
674
685
|
|
|
675
686
|
// ──────────────────────────────────────────────
|