@paigy/harness 0.1.3 → 0.1.6
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/dist/cli.js +48 -5
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -30818,6 +30818,9 @@ async function checkReplies(opts = {}) {
|
|
|
30818
30818
|
};
|
|
30819
30819
|
}
|
|
30820
30820
|
var tokenOverride = null;
|
|
30821
|
+
function overrideToken(secret) {
|
|
30822
|
+
tokenOverride = secret;
|
|
30823
|
+
}
|
|
30821
30824
|
var authToken = (explicit) => explicit ?? tokenOverride ?? readToken();
|
|
30822
30825
|
async function hatch(name, voice = null) {
|
|
30823
30826
|
const res = ensureAuthed(await reach(`${BACKEND_URL}/api/hatch`, {
|
|
@@ -30857,7 +30860,7 @@ async function setTaskState(notificationId, state, opts = {}) {
|
|
|
30857
30860
|
// src/cli.ts
|
|
30858
30861
|
var import_qrcode = __toESM(require_lib(), 1);
|
|
30859
30862
|
import { hostname } from "os";
|
|
30860
|
-
import { existsSync as existsSync5, mkdirSync as mkdirSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
30863
|
+
import { existsSync as existsSync5, mkdirSync as mkdirSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
30861
30864
|
import { execSync } from "child_process";
|
|
30862
30865
|
import { homedir as homedir5 } from "os";
|
|
30863
30866
|
import { join as join4 } from "path";
|
|
@@ -32386,7 +32389,7 @@ function startHost(opts) {
|
|
|
32386
32389
|
|
|
32387
32390
|
// src/cli.ts
|
|
32388
32391
|
function parseArgs(argv) {
|
|
32389
|
-
const args = { harness: "claude", mode: "bypass", cwd: process.cwd(), doctor: false, host: false, pair: false, service: false, setup: false, grant: [], hatch: null, identity: null, graceSeconds: 90, prompt: "" };
|
|
32392
|
+
const args = { harness: "claude", mode: "bypass", cwd: process.cwd(), doctor: false, host: false, pair: false, service: false, setup: false, grant: [], hatch: null, voice: null, slot: null, identity: null, graceSeconds: 90, prompt: "" };
|
|
32390
32393
|
const words = [];
|
|
32391
32394
|
for (let i = 0; i < argv.length; i++) {
|
|
32392
32395
|
const arg = argv[i];
|
|
@@ -32425,6 +32428,10 @@ function parseArgs(argv) {
|
|
|
32425
32428
|
const v = next();
|
|
32426
32429
|
if (!v) return { error: 'hatch needs a name: paigy-harness hatch "Voice bug hunter"' };
|
|
32427
32430
|
args.hatch = v;
|
|
32431
|
+
} else if (arg === "--voice") {
|
|
32432
|
+
args.voice = next() ?? null;
|
|
32433
|
+
} else if (arg === "--slot") {
|
|
32434
|
+
args.slot = next() ?? null;
|
|
32428
32435
|
} else if (arg === "--identity") {
|
|
32429
32436
|
const v = next();
|
|
32430
32437
|
if (!v) return { error: "--identity needs a hatched agent's name" };
|
|
@@ -32444,7 +32451,7 @@ async function main() {
|
|
|
32444
32451
|
const parsed = parseArgs(process.argv.slice(2));
|
|
32445
32452
|
if ("error" in parsed) {
|
|
32446
32453
|
console.error(`paigy-harness: ${parsed.error}`);
|
|
32447
|
-
console.error("usage: paigy-harness setup | pair | host [--grant DIR]\u2026 | service | hatch NAME | [--harness claude|codex] [--mode bypass|ask] [--cwd DIR] [--identity NAME] [--grace SECONDS] [--doctor] PROMPT\u2026");
|
|
32454
|
+
console.error("usage: paigy-harness setup | pair | host [--grant DIR]\u2026 | service | hatch NAME [--voice KEY] [--slot SLOT] | [--harness claude|codex] [--mode bypass|ask] [--cwd DIR] [--identity NAME] [--grace SECONDS] [--doctor] PROMPT\u2026");
|
|
32448
32455
|
process.exit(2);
|
|
32449
32456
|
}
|
|
32450
32457
|
if (parsed.doctor) {
|
|
@@ -32502,6 +32509,41 @@ async function main() {
|
|
|
32502
32509
|
console.log("service install failed \u2014 run `paigy-harness host` to host in the foreground");
|
|
32503
32510
|
}
|
|
32504
32511
|
} else console.log("start hosting with: paigy-harness host (keep it running under your init system)");
|
|
32512
|
+
const TERMINAL_AGENTS = [
|
|
32513
|
+
{ cli: "claude", name: "Claude Code", slot: "mcp-agent", wire: "claude mcp add --scope user paigy -- npx -y @paigy/mcp@latest" },
|
|
32514
|
+
{ cli: "codex", name: "Codex", slot: "codex", wire: "codex mcp add paigy -- npx -y @paigy/mcp@latest" },
|
|
32515
|
+
{ cli: "antigravity", name: "Antigravity", slot: "antigravity" }
|
|
32516
|
+
];
|
|
32517
|
+
overrideToken(readToken("Desktop") || null);
|
|
32518
|
+
for (const t of TERMINAL_AGENTS) {
|
|
32519
|
+
try {
|
|
32520
|
+
if (!which(t.cli) || readToken(t.slot)) continue;
|
|
32521
|
+
const minted = await hatch(t.name, null);
|
|
32522
|
+
saveToken({ access_token: minted.token, name: minted.name, device: null }, t.slot);
|
|
32523
|
+
console.log(`\u2713 hatched "${minted.name}" for ${t.cli} sessions (name/voice it on the phone)`);
|
|
32524
|
+
if (t.wire) {
|
|
32525
|
+
try {
|
|
32526
|
+
execSync(t.wire, { stdio: "ignore", shell: "/bin/sh" });
|
|
32527
|
+
console.log(`\u2713 paigy MCP registered for ${t.cli} (restart open sessions)`);
|
|
32528
|
+
} catch {
|
|
32529
|
+
}
|
|
32530
|
+
}
|
|
32531
|
+
} catch {
|
|
32532
|
+
}
|
|
32533
|
+
}
|
|
32534
|
+
try {
|
|
32535
|
+
const settings = join4(homedir5(), ".claude", "settings.json");
|
|
32536
|
+
if (which("claude") && existsSync5(settings)) {
|
|
32537
|
+
const cfg = JSON.parse(readFileSync3(settings, "utf8"));
|
|
32538
|
+
if (!cfg["statusLine"]) {
|
|
32539
|
+
cfg["statusLine"] = { type: "command", command: "npx -y -p @paigy/mcp@latest paigy-statusline" };
|
|
32540
|
+
writeFileSync3(settings, JSON.stringify(cfg, null, 2));
|
|
32541
|
+
console.log("\u2713 statusline wired");
|
|
32542
|
+
}
|
|
32543
|
+
}
|
|
32544
|
+
} catch {
|
|
32545
|
+
}
|
|
32546
|
+
overrideToken(null);
|
|
32505
32547
|
console.log("\n\u2705 Done \u2014 look at your phone: Agents shows this machine with a green dot,");
|
|
32506
32548
|
console.log(" and \u201C+ New session\u201D launches agents on it.");
|
|
32507
32549
|
return;
|
|
@@ -32562,8 +32604,9 @@ async function main() {
|
|
|
32562
32604
|
process.exit(1);
|
|
32563
32605
|
}
|
|
32564
32606
|
if (parsed.hatch) {
|
|
32565
|
-
|
|
32566
|
-
|
|
32607
|
+
overrideToken(readToken("Desktop") || null);
|
|
32608
|
+
const minted = await hatch(parsed.hatch, parsed.voice ?? null);
|
|
32609
|
+
saveToken({ access_token: minted.token, name: minted.name, device: null }, parsed.slot ?? minted.name);
|
|
32567
32610
|
console.log(`\u2713 hatched "${minted.name}" \u2014 it's on your phone's Agents screen now.`);
|
|
32568
32611
|
console.log(` speak as it: PAIGY_AGENT="${minted.name}" <any paigy tool>`);
|
|
32569
32612
|
console.log(` run with it: paigy-harness --identity "${minted.name}" --harness codex "\u2026"`);
|