@scp-dev/cli 0.6.0 → 0.8.0
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/{chunk-BSX24XMZ.js → chunk-6S3V5ZGU.js} +59 -6
- package/dist/{chunk-DEK3TE6T.js → chunk-77NUOWQ4.js} +3 -3
- package/dist/{chunk-KN7WEIE4.js → chunk-FPNFRDXG.js} +1 -0
- package/dist/{chunk-C7ZUACP7.js → chunk-GTU3EWEY.js} +1 -1
- package/dist/{chunk-C5PYVRJE.js → chunk-MHBWDAXO.js} +2 -2
- package/dist/{codex-4GTXURTS.js → chunk-S5KEVIGO.js} +6 -10
- package/dist/{chunk-GG33NSBW.js → chunk-UUFTEXDU.js} +19 -3
- package/dist/{chunk-CVW3INZO.js → chunk-ZEWZBRVM.js} +33 -8
- package/dist/{claude-NCPNZLIX.js → claude-7BA4PGK3.js} +16 -6
- package/dist/cli.js +1 -1
- package/dist/codex-KQNXVGTE.js +26 -0
- package/dist/{hooks-SWVIDONV.js → hooks-DRIUG546.js} +6 -2
- package/dist/{install-YE7LCGPC.js → install-MZC4PAIC.js} +3 -3
- package/dist/{join-64BU6SEY.js → join-JW7C2IDC.js} +1 -1
- package/dist/{login-4IF26HH5.js → login-22BLC7KI.js} +2 -2
- package/dist/{main-RA3MP25N.js → main-6BPNG53C.js} +99 -26
- package/dist/{mcp-RERRUUIX.js → mcp-4VAPXGF6.js} +8 -7
- package/dist/{mesh-XTMBRJLR.js → mesh-P3EQXYLH.js} +1 -1
- package/dist/muse-QWCI627T.js +429 -0
- package/dist/{opencode-CPNR2G3W.js → opencode-7XYA7E3Q.js} +4 -4
- package/dist/{peek-GEYQ7SHV.js → peek-G6RLQGKO.js} +1 -1
- package/dist/{pi-XHZAUDP4.js → pi-QUW4MSVZ.js} +1 -1
- package/dist/{relay-E4JFR33E.js → relay-7VBBQCFB.js} +1 -1
- package/dist/{remote-3R4GRDGI.js → remote-VRVONVET.js} +2 -2
- package/dist/remote-spawn-7Z2FLG33.js +309 -0
- package/dist/resume-B5BOZO2G.js +308 -0
- package/dist/{setup-O45SE5L7.js → setup-NK2HRFZN.js} +4 -4
- package/dist/{spawn-CJSHYE7E.js → spawn-3IYGUBG6.js} +14 -6
- package/dist/{up-O2CMDGXP.js → up-QL3FLYUK.js} +8 -6
- package/package.json +6 -6
|
@@ -67,6 +67,38 @@ function writeShimBinding(claim, env) {
|
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
+
function museLaunchFile(key, env) {
|
|
71
|
+
const pid = BINDING_PROCESS.exec(key)?.[1];
|
|
72
|
+
return pid ? join(relayDir(env), "launch", `muse-${pid}.json`) : void 0;
|
|
73
|
+
}
|
|
74
|
+
function writeMuseLaunch(key, launch, env) {
|
|
75
|
+
const pid = BINDING_PROCESS.exec(key)?.[1];
|
|
76
|
+
if (!pid) throw new Error(`muse serve has no process key (${key})`);
|
|
77
|
+
const path = join(privateDir(join(relayDir(env), "launch")), `muse-${pid}.json`);
|
|
78
|
+
const text = JSON.stringify({ process: key, ...launch });
|
|
79
|
+
writeFileSync(path, text, { mode: 384 });
|
|
80
|
+
chmodSync(path, 384);
|
|
81
|
+
return () => {
|
|
82
|
+
try {
|
|
83
|
+
if (readFileSync(path, "utf8") === text) rmSync(path);
|
|
84
|
+
} catch {
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function readMuseLaunch(key, env) {
|
|
89
|
+
const path = museLaunchFile(key, env);
|
|
90
|
+
if (!path) return void 0;
|
|
91
|
+
try {
|
|
92
|
+
const launch = JSON.parse(readFileSync(path, "utf8"));
|
|
93
|
+
if (launch.process !== key) return void 0;
|
|
94
|
+
return {
|
|
95
|
+
...typeof launch.name === "string" && validHandle(launch.name) ? { name: launch.name } : {},
|
|
96
|
+
...typeof launch.grant === "string" && launch.grant ? { grant: launch.grant } : {}
|
|
97
|
+
};
|
|
98
|
+
} catch {
|
|
99
|
+
return void 0;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
70
102
|
function readShimBinding(env, pid, table) {
|
|
71
103
|
const read = (name, expectedPid) => {
|
|
72
104
|
try {
|
|
@@ -374,14 +406,21 @@ function hookHarnessPid(env, harness, ppid = process.ppid, parentOf = psParent)
|
|
|
374
406
|
if (Number.isInteger(pid) && pid > 1) return pid;
|
|
375
407
|
return harnessPid(ppid, parentOf);
|
|
376
408
|
}
|
|
409
|
+
function launcherPid(env, harness = harnessPid, parentOf = psParent) {
|
|
410
|
+
const pid = Number(env.SCP_HARNESS_PID);
|
|
411
|
+
if (!Number.isInteger(pid) || pid <= 1) return void 0;
|
|
412
|
+
return parentOf(harness())?.ppid === pid ? pid : void 0;
|
|
413
|
+
}
|
|
377
414
|
var HARNESS_SESSION = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/;
|
|
378
415
|
function relayIdentity(input) {
|
|
379
416
|
const resolved = resolveHarness(input.harness, input.env, input.fallbackHarness);
|
|
380
417
|
const pid = input.harnessPid(resolved);
|
|
381
418
|
const harness = GENERIC_HARNESSES.has(resolved) && input.inferHarness?.(pid) || resolved;
|
|
382
419
|
const cwd = isAbsolute(input.cwd) ? input.cwd : resolve(input.cwd);
|
|
383
|
-
const handle = input.as ?? input.env.SCP_NAME ?? deriveHandle(harness, cwd);
|
|
384
420
|
const harnessProcess = processKey(pid, input.startOf);
|
|
421
|
+
const launched = harness === "muse" && !input.env.SCP_NAME && !input.env.SCP_GRANT ? readMuseLaunch(harnessProcess, input.env) : void 0;
|
|
422
|
+
const handle = input.as ?? input.env.SCP_NAME ?? launched?.name ?? deriveHandle(harness, cwd);
|
|
423
|
+
const grant = input.env.SCP_GRANT || launched?.grant;
|
|
385
424
|
const keys = input.lineageOf ? input.lineageOf(pid) : lineage(pid);
|
|
386
425
|
const harnessSession = harness === "claude-code" ? [input.harnessSession, input.env.CLAUDE_CODE_SESSION_ID].find((id) => id !== void 0 && HARNESS_SESSION.test(id)) : void 0;
|
|
387
426
|
return {
|
|
@@ -392,8 +431,9 @@ function relayIdentity(input) {
|
|
|
392
431
|
process: harnessProcess,
|
|
393
432
|
labels: labelsFor(input.env),
|
|
394
433
|
...input.env.SCP_PARENT ? { parent: input.env.SCP_PARENT } : {},
|
|
434
|
+
...input.env.SCP_UNDER ? { under: input.env.SCP_UNDER } : {},
|
|
395
435
|
...keys.length ? { lineage: keys } : {},
|
|
396
|
-
...
|
|
436
|
+
...grant ? { grant } : {},
|
|
397
437
|
...harnessSession ? { harness_session: harnessSession } : {}
|
|
398
438
|
};
|
|
399
439
|
}
|
|
@@ -471,7 +511,14 @@ var OPTIONS = {
|
|
|
471
511
|
endpoint: { type: "string" },
|
|
472
512
|
"take-over": { type: "boolean" },
|
|
473
513
|
live: { type: "boolean" },
|
|
474
|
-
parent: { type: "string" }
|
|
514
|
+
parent: { type: "string" },
|
|
515
|
+
via: { type: "string" },
|
|
516
|
+
wake: { type: "string" },
|
|
517
|
+
eta: { type: "string" },
|
|
518
|
+
ref: { type: "string" },
|
|
519
|
+
gone: { type: "boolean" },
|
|
520
|
+
"secret-env": { type: "string" },
|
|
521
|
+
clear: { type: "boolean" }
|
|
475
522
|
};
|
|
476
523
|
var SPAWN_OPTIONS = [
|
|
477
524
|
"as",
|
|
@@ -492,7 +539,8 @@ var SPAWN_OPTIONS = [
|
|
|
492
539
|
"handback-bytes",
|
|
493
540
|
"no-push",
|
|
494
541
|
"bg",
|
|
495
|
-
"fg"
|
|
542
|
+
"fg",
|
|
543
|
+
"via"
|
|
496
544
|
];
|
|
497
545
|
var OBSERVE = /* @__PURE__ */ new Set([
|
|
498
546
|
"list",
|
|
@@ -595,7 +643,7 @@ async function open(verb, values, cwd, bodyFromStdin, walk) {
|
|
|
595
643
|
`${CLI_NAME2} ${verb} needs an identity: --as HANDLE (or $SCP_NAME) for an agent, or --human for your own inbox me/ (no terminal is attached, so me/ is not assumed)`
|
|
596
644
|
);
|
|
597
645
|
}
|
|
598
|
-
const { machineName, openCloud } = await import("./remote-
|
|
646
|
+
const { machineName, openCloud } = await import("./remote-VRVONVET.js");
|
|
599
647
|
const handle2 = named ? localHandle(named) : void 0;
|
|
600
648
|
const claim = handle2 ? {
|
|
601
649
|
handle: handle2,
|
|
@@ -638,6 +686,7 @@ async function open(verb, values, cwd, bodyFromStdin, walk) {
|
|
|
638
686
|
harness: claimHarness(values, process.env, here),
|
|
639
687
|
cwd,
|
|
640
688
|
...process.env.SCP_PARENT ? { parent: process.env.SCP_PARENT } : {},
|
|
689
|
+
...process.env.SCP_UNDER ? { under: process.env.SCP_UNDER } : {},
|
|
641
690
|
labels: labelsFor(process.env),
|
|
642
691
|
...lineageClaim,
|
|
643
692
|
...grant ? { grant } : {}
|
|
@@ -853,7 +902,7 @@ function relayVerb(positionals, asJson, env = process.env) {
|
|
|
853
902
|
}
|
|
854
903
|
async function loginMain(positionals, values) {
|
|
855
904
|
if (positionals.length) throw new RelayUsage(`${CLI_NAME3} login takes only flags`);
|
|
856
|
-
return (await import("./login-
|
|
905
|
+
return (await import("./login-22BLC7KI.js")).login(values);
|
|
857
906
|
}
|
|
858
907
|
function logoutMain(positionals, asJson, env = process.env) {
|
|
859
908
|
if (positionals.length) throw new RelayUsage(`${CLI_NAME3} logout takes no arguments`);
|
|
@@ -870,10 +919,13 @@ export {
|
|
|
870
919
|
detectHarness,
|
|
871
920
|
codexShell,
|
|
872
921
|
writeShimBinding,
|
|
922
|
+
writeMuseLaunch,
|
|
873
923
|
normalizeHarness,
|
|
874
924
|
hookHarness,
|
|
875
925
|
gitToplevel,
|
|
876
926
|
deriveHandle,
|
|
927
|
+
parseLabels,
|
|
928
|
+
labelsFor,
|
|
877
929
|
processKey,
|
|
878
930
|
sessionKey,
|
|
879
931
|
psStart,
|
|
@@ -883,6 +935,7 @@ export {
|
|
|
883
935
|
psParent,
|
|
884
936
|
harnessPid,
|
|
885
937
|
hookHarnessPid,
|
|
938
|
+
launcherPid,
|
|
886
939
|
relayIdentity,
|
|
887
940
|
DEFAULT_RELAY,
|
|
888
941
|
configDir,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
hooksTarget
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-MHBWDAXO.js";
|
|
4
4
|
import {
|
|
5
5
|
AGY_HOOK_SET,
|
|
6
6
|
BLOCK_STOP,
|
|
@@ -12,12 +12,12 @@ import {
|
|
|
12
12
|
mergeHooks,
|
|
13
13
|
musePlugin,
|
|
14
14
|
opencodePlugin
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-UUFTEXDU.js";
|
|
16
16
|
import {
|
|
17
17
|
RelayUsage,
|
|
18
18
|
gitToplevel,
|
|
19
19
|
setJoinMode
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-6S3V5ZGU.js";
|
|
21
21
|
|
|
22
22
|
// src/setup.ts
|
|
23
23
|
import { spawnSync } from "child_process";
|
|
@@ -16,6 +16,7 @@ var SPAWN_HELP = `${CLI_NAME} spawn [flags] [--] <harness cmd...>: run a worker
|
|
|
16
16
|
--peek local peekable from its start
|
|
17
17
|
--scope P --rules S --in S --out S --allow S --group G --under EP --ttl S --labels K=V,...
|
|
18
18
|
its scope and grant, as for ${CLI_NAME} spawn-env (default scope: parent)
|
|
19
|
+
--via R start it on another machine through runner R (runners.json, see help --all)
|
|
19
20
|
The command starts after -- or at the first word that is not one of these flags.
|
|
20
21
|
|
|
21
22
|
It returns at once, printing the worker's name and its runner's pid: do not background it (no &, no
|
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
mergeHooks,
|
|
11
11
|
musePlugin,
|
|
12
12
|
opencodePlugin
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-UUFTEXDU.js";
|
|
14
14
|
import {
|
|
15
15
|
RelayUsage,
|
|
16
16
|
gitToplevel
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-6S3V5ZGU.js";
|
|
18
18
|
|
|
19
19
|
// src/install.ts
|
|
20
20
|
import { chmodSync, copyFileSync, existsSync, lstatSync, mkdirSync, readFileSync, realpathSync, renameSync, statSync, unlinkSync, writeFileSync } from "fs";
|
|
@@ -3,18 +3,13 @@ import {
|
|
|
3
3
|
codexMount,
|
|
4
4
|
codexOverrides,
|
|
5
5
|
toml
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-KN7WEIE4.js";
|
|
8
|
-
import "./chunk-DEK3TE6T.js";
|
|
9
|
-
import "./chunk-C5PYVRJE.js";
|
|
10
|
-
import "./chunk-GG33NSBW.js";
|
|
11
|
-
import "./chunk-YYSLYVNZ.js";
|
|
6
|
+
} from "./chunk-ZEWZBRVM.js";
|
|
12
7
|
import {
|
|
13
8
|
RelayUsage,
|
|
14
9
|
readPsTable,
|
|
15
10
|
relayIdentity,
|
|
16
11
|
startDaemon
|
|
17
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-6S3V5ZGU.js";
|
|
18
13
|
import {
|
|
19
14
|
SELF
|
|
20
15
|
} from "./chunk-MNTIEWKF.js";
|
|
@@ -611,12 +606,13 @@ ${stderr.toString().trim()}` : ""}`
|
|
|
611
606
|
rmSync(dir, { recursive: true, force: true });
|
|
612
607
|
}
|
|
613
608
|
}
|
|
609
|
+
|
|
614
610
|
export {
|
|
615
611
|
CODEX_HELP,
|
|
612
|
+
codexLaunch,
|
|
616
613
|
CodexSocket,
|
|
617
614
|
CodexWaker,
|
|
618
|
-
|
|
619
|
-
codexLaunch,
|
|
615
|
+
serverOptions,
|
|
620
616
|
connectCodexChannel,
|
|
621
|
-
|
|
617
|
+
codexCommand
|
|
622
618
|
};
|
|
@@ -13,11 +13,11 @@ import {
|
|
|
13
13
|
psStart,
|
|
14
14
|
relayIdentity,
|
|
15
15
|
sessionKey
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-6S3V5ZGU.js";
|
|
17
17
|
|
|
18
18
|
// src/hooks.ts
|
|
19
19
|
import { Readable } from "stream";
|
|
20
|
-
import { closeSync, fstatSync, openSync, readFileSync, readSync, writeSync } from "fs";
|
|
20
|
+
import { closeSync, fstatSync, openSync, readFileSync, readSync, writeFileSync, writeSync } from "fs";
|
|
21
21
|
import { homedir } from "os";
|
|
22
22
|
import { basename, join } from "path";
|
|
23
23
|
import {
|
|
@@ -304,7 +304,9 @@ function titleText(text) {
|
|
|
304
304
|
return line || void 0;
|
|
305
305
|
}
|
|
306
306
|
function promptTitle(prompt) {
|
|
307
|
-
|
|
307
|
+
const first = prompt?.split("\n").find((line) => line.trim());
|
|
308
|
+
if (first?.startsWith(PREAMBLE) || first?.startsWith(PREAMBLE_BRIEF)) return void 0;
|
|
309
|
+
return titleText(first);
|
|
308
310
|
}
|
|
309
311
|
function transcriptTitle(path, session) {
|
|
310
312
|
if (!path || !session || !path.startsWith("/") || !path.endsWith(`/${session}.jsonl`)) return void 0;
|
|
@@ -409,6 +411,17 @@ function tldrEvery(env) {
|
|
|
409
411
|
return raw && /^\d{1,6}$/.test(raw) ? Number(raw) : TLDR_EVERY_DEFAULT;
|
|
410
412
|
}
|
|
411
413
|
var NUDGE = `${CLI_NAME} (optional): a title and a one-line now (relay_set_title / relay_set_now) help peers find you; skip it when you only run workers.`;
|
|
414
|
+
var AGY_CONVERSATION = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/;
|
|
415
|
+
function recordAgyConversation(payload, env) {
|
|
416
|
+
const file = env.SCP_AGY_CONVERSATION_FILE;
|
|
417
|
+
if (!file || field(payload, "parentConversationId", "parent_conversation_id") !== void 0) return;
|
|
418
|
+
const id = asString(field(payload, "conversationId", "conversation_id")) ?? env.ANTIGRAVITY_CONVERSATION_ID;
|
|
419
|
+
if (!id || !AGY_CONVERSATION.test(id)) return;
|
|
420
|
+
try {
|
|
421
|
+
writeFileSync(file, id, { flag: "wx", mode: 384 });
|
|
422
|
+
} catch {
|
|
423
|
+
}
|
|
424
|
+
}
|
|
412
425
|
async function runHook(args, options) {
|
|
413
426
|
const began = Date.now();
|
|
414
427
|
const blockStop = args.includes(BLOCK_STOP);
|
|
@@ -427,6 +440,7 @@ async function runHook(args, options) {
|
|
|
427
440
|
} catch {
|
|
428
441
|
payload = {};
|
|
429
442
|
}
|
|
443
|
+
if (harnessArg === "agy") recordAgyConversation(payload, options.env);
|
|
430
444
|
if (Number.isFinite(wakeS) && wakeS > 0) return wakeHook(harnessArg, payload, wakeS, options);
|
|
431
445
|
const event = mapHookPayload(payload, eventArg);
|
|
432
446
|
if (!event || options.env.SCP_TRANSPORT === "cloud") return;
|
|
@@ -1038,6 +1052,8 @@ export {
|
|
|
1038
1052
|
TLDR_EVERY_DEFAULT,
|
|
1039
1053
|
TLDR,
|
|
1040
1054
|
tldrEvery,
|
|
1055
|
+
AGY_CONVERSATION,
|
|
1056
|
+
recordAgyConversation,
|
|
1041
1057
|
runHook,
|
|
1042
1058
|
subagentIntro,
|
|
1043
1059
|
relayHookCommand,
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
agySettingsFile,
|
|
4
4
|
mcpFile,
|
|
5
5
|
mountedEntry
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-77NUOWQ4.js";
|
|
7
7
|
import {
|
|
8
8
|
steerPrompt
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-UUFTEXDU.js";
|
|
10
10
|
import {
|
|
11
11
|
OPTIONS,
|
|
12
12
|
RelayUsage,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
selectorList,
|
|
19
19
|
spawnerKey,
|
|
20
20
|
walkNow
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-6S3V5ZGU.js";
|
|
22
22
|
import {
|
|
23
23
|
SELF,
|
|
24
24
|
note
|
|
@@ -44,8 +44,8 @@ import {
|
|
|
44
44
|
} from "@scp-dev/core";
|
|
45
45
|
var SERVER = "scp";
|
|
46
46
|
var SPAWN_RUNNER = "SCP_SPAWN_RUNNER";
|
|
47
|
-
var SPAWNER_IDENTITY = ["SCP_NAME", "SCP_SESSION", "SCP_GRANT", "SCP_PARENT", "SCP_HARNESS", "SCP_SHIM_BINDING", SPAWN_RUNNER];
|
|
48
|
-
var SHIM_ENV = ["SCP_GRANT", "SCP_NAME", "SCP_LABELS", "SCP_DIR", "XDG_STATE_HOME", "SCP_SHIM_BINDING"];
|
|
47
|
+
var SPAWNER_IDENTITY = ["SCP_NAME", "SCP_SESSION", "SCP_GRANT", "SCP_PARENT", "SCP_UNDER", "SCP_HARNESS", "SCP_SHIM_BINDING", "SCP_HARNESS_PID", SPAWN_RUNNER];
|
|
48
|
+
var SHIM_ENV = ["SCP_GRANT", "SCP_NAME", "SCP_UNDER", "SCP_LABELS", "SCP_DIR", "XDG_STATE_HOME", "SCP_SHIM_BINDING"];
|
|
49
49
|
function spawnEnvironment(parent, grant, labels) {
|
|
50
50
|
const env = {};
|
|
51
51
|
for (const [key, value] of Object.entries(parent)) if (value !== void 0 && !SPAWNER_IDENTITY.includes(key)) env[key] = value;
|
|
@@ -164,6 +164,10 @@ var PRESETS = {
|
|
|
164
164
|
allow: MESSAGING.flatMap((tool) => ["--allow", tool])
|
|
165
165
|
}
|
|
166
166
|
};
|
|
167
|
+
function messagingAllow(harness, args) {
|
|
168
|
+
const preset = PRESETS[harness];
|
|
169
|
+
return preset && !hasFlag(args, preset.own) ? preset.allow : [];
|
|
170
|
+
}
|
|
167
171
|
var MUSE_VALUED = /* @__PURE__ */ new Set([
|
|
168
172
|
"--agents",
|
|
169
173
|
"--provider",
|
|
@@ -477,7 +481,7 @@ function workerName(command, random = nameSuffix) {
|
|
|
477
481
|
const harness = (program === void 0 ? "" : basename(program)).toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^[^a-z0-9]+|[^a-z0-9]+$/g, "").slice(0, 57);
|
|
478
482
|
return `${harness || "worker"}-${random()}`;
|
|
479
483
|
}
|
|
480
|
-
function agyNote(command, env) {
|
|
484
|
+
function agyNote(command, env, verb = "spawn") {
|
|
481
485
|
const at = programAt(command);
|
|
482
486
|
const args = command.slice(at + 1);
|
|
483
487
|
if (command[at] === void 0 || basename(command[at]) !== "agy" || !hasFlag(args, ["-p", "--print", "--prompt"]) || hasFlag(args, ["--dangerously-skip-permissions"]))
|
|
@@ -488,7 +492,7 @@ function agyNote(command, env) {
|
|
|
488
492
|
} catch {
|
|
489
493
|
}
|
|
490
494
|
if (Array.isArray(allow) && agyRules().every((rule) => allow.includes(rule))) return null;
|
|
491
|
-
return `${CLI_NAME}
|
|
495
|
+
return `${CLI_NAME} ${verb}: headless agy denies the relay tools without the permission rules ${CLI_NAME} setup writes to ${agySettingsFile(env)}; run ${CLI_NAME} setup`;
|
|
492
496
|
}
|
|
493
497
|
var FORWARDED = ["SIGINT", "SIGQUIT", "SIGTERM", "SIGHUP"];
|
|
494
498
|
var TAIL_BYTES = 16 * 1024;
|
|
@@ -724,6 +728,7 @@ async function spawnCommand(args, cwd) {
|
|
|
724
728
|
const bytes = values["handback-bytes"] === void 0 ? void 0 : handbackBytes(values["handback-bytes"]);
|
|
725
729
|
const runner = process.env[SPAWN_RUNNER];
|
|
726
730
|
delete process.env[SPAWN_RUNNER];
|
|
731
|
+
if (typeof values.via === "string") return (await import("./remote-spawn-7Z2FLG33.js")).viaSpawn(values, command, cwd);
|
|
727
732
|
if (runner === void 0 && (values.bg === true || values.fg !== true && (process.stdout.isTTY !== true || process.stdin.isTTY !== true && agentShell(process.env))))
|
|
728
733
|
return detachSpawn(args, cwd);
|
|
729
734
|
const channel = runner === void 0 ? void 0 : handshakeChannel();
|
|
@@ -735,6 +740,21 @@ async function spawnCommand(args, cwd) {
|
|
|
735
740
|
} catch {
|
|
736
741
|
}
|
|
737
742
|
});
|
|
743
|
+
if (typeof values.under === "string") {
|
|
744
|
+
const remote = await import("./remote-spawn-7Z2FLG33.js");
|
|
745
|
+
let plan;
|
|
746
|
+
try {
|
|
747
|
+
plan = await remote.linkedPlan(values, command);
|
|
748
|
+
} catch (error) {
|
|
749
|
+
handshake?.({ error: error instanceof Error ? error.message : String(error), ...error instanceof RelayUsage ? { usage: true } : {} });
|
|
750
|
+
throw error;
|
|
751
|
+
}
|
|
752
|
+
if (plan) {
|
|
753
|
+
const name2 = plan.name;
|
|
754
|
+
const started2 = handshake && ((failed) => handshake(failed ? { error: failed.message, code: failed.code } : { name: name2, pid: process.pid }));
|
|
755
|
+
return remote.linkedSpawn(plan, command, cwd, { group: runner !== void 0, ...started2 ? { started: started2 } : {}, ...bytes !== void 0 ? { bytes } : {} });
|
|
756
|
+
}
|
|
757
|
+
}
|
|
738
758
|
const bound = spawnerKey();
|
|
739
759
|
const prompt = values.peek === void 0 ? void 0 : spawnPrompt(command)?.slice(0, PEEK.rawChars);
|
|
740
760
|
const walk = runner === void 0 ? walkNow() : JSON.parse(runner);
|
|
@@ -797,7 +817,8 @@ function parseSpawn(args) {
|
|
|
797
817
|
throw new RelayUsage(error instanceof Error ? error.message : String(error));
|
|
798
818
|
}
|
|
799
819
|
if (values.help) return { values, command: split.command };
|
|
800
|
-
for (const key of Object.keys(values))
|
|
820
|
+
for (const key of Object.keys(values))
|
|
821
|
+
if (!SPAWN_OPTIONS.includes(key) && !(key === "json" && values.via !== void 0)) throw new RelayUsage(`${CLI_NAME} spawn does not take --${key}`);
|
|
801
822
|
if (values.bg && values.fg) throw new RelayUsage("--bg and --fg: pick one");
|
|
802
823
|
const command = split.command;
|
|
803
824
|
if (!command.length)
|
|
@@ -924,6 +945,10 @@ export {
|
|
|
924
945
|
codexOverrideAt,
|
|
925
946
|
programAt,
|
|
926
947
|
MESSAGING,
|
|
948
|
+
messagingAllow,
|
|
949
|
+
MUSE_MODE,
|
|
950
|
+
MUSE_MODES_ALLOWED,
|
|
951
|
+
museModes,
|
|
927
952
|
contributorRefusal,
|
|
928
953
|
codexSkipsGitCheck,
|
|
929
954
|
closedStdin,
|
|
@@ -3,16 +3,16 @@ import {
|
|
|
3
3
|
mcpFile,
|
|
4
4
|
mountedEntry,
|
|
5
5
|
whichOnPath
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-77NUOWQ4.js";
|
|
7
|
+
import "./chunk-MHBWDAXO.js";
|
|
8
|
+
import "./chunk-UUFTEXDU.js";
|
|
9
9
|
import "./chunk-YYSLYVNZ.js";
|
|
10
10
|
import {
|
|
11
11
|
CHANNELS_ENV,
|
|
12
12
|
RelayUsage,
|
|
13
13
|
deriveHandle,
|
|
14
14
|
joinMode
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-6S3V5ZGU.js";
|
|
16
16
|
import {
|
|
17
17
|
SELF
|
|
18
18
|
} from "./chunk-MNTIEWKF.js";
|
|
@@ -59,7 +59,17 @@ function claudeLaunchArgs(args, added) {
|
|
|
59
59
|
const channels = optionsOf(args).some((arg) => arg === "server:scp" || arg === `${CHANNEL_FLAGS[0]}=server:scp`) ? [] : CHANNEL_FLAGS;
|
|
60
60
|
return beforeDashes(args, [...channels, ...added]);
|
|
61
61
|
}
|
|
62
|
-
var LAUNCHER_IDENTITY = [
|
|
62
|
+
var LAUNCHER_IDENTITY = [
|
|
63
|
+
"SCP_NAME",
|
|
64
|
+
"SCP_GRANT",
|
|
65
|
+
"SCP_SESSION",
|
|
66
|
+
"SCP_PARENT",
|
|
67
|
+
"SCP_UNDER",
|
|
68
|
+
"SCP_HARNESS",
|
|
69
|
+
"SCP_SHIM_BINDING",
|
|
70
|
+
"SCP_SPAWN_RUNNER",
|
|
71
|
+
CHANNELS_ENV
|
|
72
|
+
];
|
|
63
73
|
var SHIM_VARS = ["SCP_LABELS", "SCP_DIR", "XDG_STATE_HOME"];
|
|
64
74
|
var bgDir = (env) => join(relayDir(env), "claude-bg");
|
|
65
75
|
function bgMount(env, name) {
|
|
@@ -233,7 +243,7 @@ async function renameBackground(target, to, env, err, bin, deps) {
|
|
|
233
243
|
`, { mode: 384 });
|
|
234
244
|
}
|
|
235
245
|
async function renameEndpoint(from, to) {
|
|
236
|
-
return (await import("./main-
|
|
246
|
+
return (await import("./main-6BPNG53C.js")).relayMain(["name", "--endpoint", `me/${from}`, to]);
|
|
237
247
|
}
|
|
238
248
|
async function claudeCommand(argv, env = process.env, err = (line) => void process.stderr.write(`${line}
|
|
239
249
|
`), cwd = process.cwd(), deps = {}) {
|
package/dist/cli.js
CHANGED
|
@@ -17,6 +17,6 @@ function quietSqliteWarning() {
|
|
|
17
17
|
// src/cli.ts
|
|
18
18
|
if (!await subagentFastPath(process.argv.slice(2))) {
|
|
19
19
|
quietSqliteWarning();
|
|
20
|
-
const { run } = await import("./main-
|
|
20
|
+
const { run } = await import("./main-6BPNG53C.js");
|
|
21
21
|
await run(process.argv.slice(2));
|
|
22
22
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CODEX_HELP,
|
|
3
|
+
CodexSocket,
|
|
4
|
+
CodexWaker,
|
|
5
|
+
codexCommand,
|
|
6
|
+
codexLaunch,
|
|
7
|
+
connectCodexChannel,
|
|
8
|
+
serverOptions
|
|
9
|
+
} from "./chunk-S5KEVIGO.js";
|
|
10
|
+
import "./chunk-ZEWZBRVM.js";
|
|
11
|
+
import "./chunk-FPNFRDXG.js";
|
|
12
|
+
import "./chunk-77NUOWQ4.js";
|
|
13
|
+
import "./chunk-MHBWDAXO.js";
|
|
14
|
+
import "./chunk-UUFTEXDU.js";
|
|
15
|
+
import "./chunk-YYSLYVNZ.js";
|
|
16
|
+
import "./chunk-6S3V5ZGU.js";
|
|
17
|
+
import "./chunk-MNTIEWKF.js";
|
|
18
|
+
export {
|
|
19
|
+
CODEX_HELP,
|
|
20
|
+
CodexSocket,
|
|
21
|
+
CodexWaker,
|
|
22
|
+
codexCommand,
|
|
23
|
+
codexLaunch,
|
|
24
|
+
connectCodexChannel,
|
|
25
|
+
serverOptions
|
|
26
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AGY_CONVERSATION,
|
|
2
3
|
AGY_HOOK_SET,
|
|
3
4
|
AGY_UNVERIFIED,
|
|
4
5
|
BLOCK_STOP,
|
|
@@ -30,6 +31,7 @@ import {
|
|
|
30
31
|
promptTitle,
|
|
31
32
|
pushText,
|
|
32
33
|
pushWait,
|
|
34
|
+
recordAgyConversation,
|
|
33
35
|
relayHookCommand,
|
|
34
36
|
runHook,
|
|
35
37
|
steerPrompt,
|
|
@@ -40,13 +42,14 @@ import {
|
|
|
40
42
|
tldrEvery,
|
|
41
43
|
transcriptTitle,
|
|
42
44
|
unreadPointer
|
|
43
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-UUFTEXDU.js";
|
|
44
46
|
import {
|
|
45
47
|
SUBAGENT
|
|
46
48
|
} from "./chunk-YYSLYVNZ.js";
|
|
47
|
-
import "./chunk-
|
|
49
|
+
import "./chunk-6S3V5ZGU.js";
|
|
48
50
|
import "./chunk-MNTIEWKF.js";
|
|
49
51
|
export {
|
|
52
|
+
AGY_CONVERSATION,
|
|
50
53
|
AGY_HOOK_SET,
|
|
51
54
|
AGY_UNVERIFIED,
|
|
52
55
|
BLOCK_STOP,
|
|
@@ -79,6 +82,7 @@ export {
|
|
|
79
82
|
promptTitle,
|
|
80
83
|
pushText,
|
|
81
84
|
pushWait,
|
|
85
|
+
recordAgyConversation,
|
|
82
86
|
relayHookCommand,
|
|
83
87
|
runHook,
|
|
84
88
|
steerPrompt,
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
hooksTarget,
|
|
3
3
|
installHooks,
|
|
4
4
|
mcpInstall
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-MHBWDAXO.js";
|
|
6
|
+
import "./chunk-UUFTEXDU.js";
|
|
7
7
|
import "./chunk-YYSLYVNZ.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-6S3V5ZGU.js";
|
|
9
9
|
import "./chunk-MNTIEWKF.js";
|
|
10
10
|
export {
|
|
11
11
|
hooksTarget,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
machineName
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GTU3EWEY.js";
|
|
4
4
|
import {
|
|
5
5
|
RelayUsage,
|
|
6
6
|
activeRelay,
|
|
7
7
|
saveCredential
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-6S3V5ZGU.js";
|
|
9
9
|
import {
|
|
10
10
|
note
|
|
11
11
|
} from "./chunk-MNTIEWKF.js";
|