@scp-dev/cli 0.6.0 → 0.7.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-GG33NSBW.js → chunk-277BAY7J.js} +19 -3
- package/dist/{chunk-BSX24XMZ.js → chunk-3SOIVANO.js} +45 -4
- package/dist/{chunk-C5PYVRJE.js → chunk-LRQP25RI.js} +2 -2
- package/dist/{chunk-C7ZUACP7.js → chunk-LUDLDWH2.js} +1 -1
- package/dist/{codex-4GTXURTS.js → chunk-LWMTZH36.js} +6 -10
- package/dist/{chunk-CVW3INZO.js → chunk-RZUQ422C.js} +14 -6
- package/dist/{chunk-DEK3TE6T.js → chunk-SNW53KT3.js} +3 -3
- package/dist/{claude-NCPNZLIX.js → claude-WEHOLJ26.js} +5 -5
- package/dist/cli.js +1 -1
- package/dist/codex-54UWPDY5.js +26 -0
- package/dist/{hooks-SWVIDONV.js → hooks-ULKKUHPF.js} +6 -2
- package/dist/{install-YE7LCGPC.js → install-5A3ETGF6.js} +3 -3
- package/dist/{join-64BU6SEY.js → join-FFT7RQRW.js} +1 -1
- package/dist/{login-4IF26HH5.js → login-DCNCC3RS.js} +2 -2
- package/dist/{main-RA3MP25N.js → main-CDLW3MV5.js} +33 -24
- package/dist/{mcp-RERRUUIX.js → mcp-7GB35CTY.js} +7 -6
- package/dist/{mesh-XTMBRJLR.js → mesh-TDOVAHZ3.js} +1 -1
- package/dist/muse-S7FPY4CL.js +429 -0
- package/dist/{opencode-CPNR2G3W.js → opencode-WFMQYCI2.js} +4 -4
- package/dist/{peek-GEYQ7SHV.js → peek-X4QQFMQJ.js} +1 -1
- package/dist/{pi-XHZAUDP4.js → pi-5IPU6GA4.js} +1 -1
- package/dist/{relay-E4JFR33E.js → relay-7WBNUACH.js} +1 -1
- package/dist/{remote-3R4GRDGI.js → remote-YO5B2HQI.js} +2 -2
- package/dist/resume-3ZRDXSTX.js +308 -0
- package/dist/{setup-O45SE5L7.js → setup-U7CWN5QP.js} +4 -4
- package/dist/{spawn-CJSHYE7E.js → spawn-VZK5MD3R.js} +13 -5
- package/dist/{up-O2CMDGXP.js → up-S4KJBWI6.js} +8 -6
- package/package.json +6 -6
|
@@ -13,11 +13,11 @@ import {
|
|
|
13
13
|
psStart,
|
|
14
14
|
relayIdentity,
|
|
15
15
|
sessionKey
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-3SOIVANO.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,
|
|
@@ -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 {
|
|
@@ -393,7 +432,7 @@ function relayIdentity(input) {
|
|
|
393
432
|
labels: labelsFor(input.env),
|
|
394
433
|
...input.env.SCP_PARENT ? { parent: input.env.SCP_PARENT } : {},
|
|
395
434
|
...keys.length ? { lineage: keys } : {},
|
|
396
|
-
...
|
|
435
|
+
...grant ? { grant } : {},
|
|
397
436
|
...harnessSession ? { harness_session: harnessSession } : {}
|
|
398
437
|
};
|
|
399
438
|
}
|
|
@@ -595,7 +634,7 @@ async function open(verb, values, cwd, bodyFromStdin, walk) {
|
|
|
595
634
|
`${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
635
|
);
|
|
597
636
|
}
|
|
598
|
-
const { machineName, openCloud } = await import("./remote-
|
|
637
|
+
const { machineName, openCloud } = await import("./remote-YO5B2HQI.js");
|
|
599
638
|
const handle2 = named ? localHandle(named) : void 0;
|
|
600
639
|
const claim = handle2 ? {
|
|
601
640
|
handle: handle2,
|
|
@@ -853,7 +892,7 @@ function relayVerb(positionals, asJson, env = process.env) {
|
|
|
853
892
|
}
|
|
854
893
|
async function loginMain(positionals, values) {
|
|
855
894
|
if (positionals.length) throw new RelayUsage(`${CLI_NAME3} login takes only flags`);
|
|
856
|
-
return (await import("./login-
|
|
895
|
+
return (await import("./login-DCNCC3RS.js")).login(values);
|
|
857
896
|
}
|
|
858
897
|
function logoutMain(positionals, asJson, env = process.env) {
|
|
859
898
|
if (positionals.length) throw new RelayUsage(`${CLI_NAME3} logout takes no arguments`);
|
|
@@ -870,6 +909,7 @@ export {
|
|
|
870
909
|
detectHarness,
|
|
871
910
|
codexShell,
|
|
872
911
|
writeShimBinding,
|
|
912
|
+
writeMuseLaunch,
|
|
873
913
|
normalizeHarness,
|
|
874
914
|
hookHarness,
|
|
875
915
|
gitToplevel,
|
|
@@ -883,6 +923,7 @@ export {
|
|
|
883
923
|
psParent,
|
|
884
924
|
harnessPid,
|
|
885
925
|
hookHarnessPid,
|
|
926
|
+
launcherPid,
|
|
886
927
|
relayIdentity,
|
|
887
928
|
DEFAULT_RELAY,
|
|
888
929
|
configDir,
|
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
mergeHooks,
|
|
11
11
|
musePlugin,
|
|
12
12
|
opencodePlugin
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-277BAY7J.js";
|
|
14
14
|
import {
|
|
15
15
|
RelayUsage,
|
|
16
16
|
gitToplevel
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-3SOIVANO.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-RZUQ422C.js";
|
|
12
7
|
import {
|
|
13
8
|
RelayUsage,
|
|
14
9
|
readPsTable,
|
|
15
10
|
relayIdentity,
|
|
16
11
|
startDaemon
|
|
17
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-3SOIVANO.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
|
};
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
agySettingsFile,
|
|
4
4
|
mcpFile,
|
|
5
5
|
mountedEntry
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-SNW53KT3.js";
|
|
7
7
|
import {
|
|
8
8
|
steerPrompt
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-277BAY7J.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-3SOIVANO.js";
|
|
22
22
|
import {
|
|
23
23
|
SELF,
|
|
24
24
|
note
|
|
@@ -44,7 +44,7 @@ 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];
|
|
47
|
+
var SPAWNER_IDENTITY = ["SCP_NAME", "SCP_SESSION", "SCP_GRANT", "SCP_PARENT", "SCP_HARNESS", "SCP_SHIM_BINDING", "SCP_HARNESS_PID", SPAWN_RUNNER];
|
|
48
48
|
var SHIM_ENV = ["SCP_GRANT", "SCP_NAME", "SCP_LABELS", "SCP_DIR", "XDG_STATE_HOME", "SCP_SHIM_BINDING"];
|
|
49
49
|
function spawnEnvironment(parent, grant, labels) {
|
|
50
50
|
const env = {};
|
|
@@ -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;
|
|
@@ -924,6 +928,10 @@ export {
|
|
|
924
928
|
codexOverrideAt,
|
|
925
929
|
programAt,
|
|
926
930
|
MESSAGING,
|
|
931
|
+
messagingAllow,
|
|
932
|
+
MUSE_MODE,
|
|
933
|
+
MUSE_MODES_ALLOWED,
|
|
934
|
+
museModes,
|
|
927
935
|
contributorRefusal,
|
|
928
936
|
codexSkipsGitCheck,
|
|
929
937
|
closedStdin,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
hooksTarget
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LRQP25RI.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-277BAY7J.js";
|
|
16
16
|
import {
|
|
17
17
|
RelayUsage,
|
|
18
18
|
gitToplevel,
|
|
19
19
|
setJoinMode
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-3SOIVANO.js";
|
|
21
21
|
|
|
22
22
|
// src/setup.ts
|
|
23
23
|
import { spawnSync } from "child_process";
|
|
@@ -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-SNW53KT3.js";
|
|
7
|
+
import "./chunk-LRQP25RI.js";
|
|
8
|
+
import "./chunk-277BAY7J.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-3SOIVANO.js";
|
|
16
16
|
import {
|
|
17
17
|
SELF
|
|
18
18
|
} from "./chunk-MNTIEWKF.js";
|
|
@@ -233,7 +233,7 @@ async function renameBackground(target, to, env, err, bin, deps) {
|
|
|
233
233
|
`, { mode: 384 });
|
|
234
234
|
}
|
|
235
235
|
async function renameEndpoint(from, to) {
|
|
236
|
-
return (await import("./main-
|
|
236
|
+
return (await import("./main-CDLW3MV5.js")).relayMain(["name", "--endpoint", `me/${from}`, to]);
|
|
237
237
|
}
|
|
238
238
|
async function claudeCommand(argv, env = process.env, err = (line) => void process.stderr.write(`${line}
|
|
239
239
|
`), 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-CDLW3MV5.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-LWMTZH36.js";
|
|
10
|
+
import "./chunk-RZUQ422C.js";
|
|
11
|
+
import "./chunk-KN7WEIE4.js";
|
|
12
|
+
import "./chunk-SNW53KT3.js";
|
|
13
|
+
import "./chunk-LRQP25RI.js";
|
|
14
|
+
import "./chunk-277BAY7J.js";
|
|
15
|
+
import "./chunk-YYSLYVNZ.js";
|
|
16
|
+
import "./chunk-3SOIVANO.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-277BAY7J.js";
|
|
44
46
|
import {
|
|
45
47
|
SUBAGENT
|
|
46
48
|
} from "./chunk-YYSLYVNZ.js";
|
|
47
|
-
import "./chunk-
|
|
49
|
+
import "./chunk-3SOIVANO.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-LRQP25RI.js";
|
|
6
|
+
import "./chunk-277BAY7J.js";
|
|
7
7
|
import "./chunk-YYSLYVNZ.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-3SOIVANO.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-LUDLDWH2.js";
|
|
4
4
|
import {
|
|
5
5
|
RelayUsage,
|
|
6
6
|
activeRelay,
|
|
7
7
|
saveCredential
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-3SOIVANO.js";
|
|
9
9
|
import {
|
|
10
10
|
note
|
|
11
11
|
} from "./chunk-MNTIEWKF.js";
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
startDaemon,
|
|
17
17
|
terminalAttached,
|
|
18
18
|
time
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-3SOIVANO.js";
|
|
20
20
|
import {
|
|
21
21
|
FAILED,
|
|
22
22
|
exitFlushed,
|
|
@@ -35,7 +35,7 @@ import { parseArgs } from "util";
|
|
|
35
35
|
// package.json
|
|
36
36
|
var package_default = {
|
|
37
37
|
name: "@scp-dev/cli",
|
|
38
|
-
version: "0.
|
|
38
|
+
version: "0.7.0",
|
|
39
39
|
description: "The swarm command line tool.",
|
|
40
40
|
license: "Apache-2.0",
|
|
41
41
|
homepage: "https://scp.dev",
|
|
@@ -242,9 +242,16 @@ scopes (selectors are comma-separated, e.g. tree:parent,tree:children,group:team
|
|
|
242
242
|
message as a turn (steering a running one, waking an idle session)
|
|
243
243
|
${CLI_NAME} codex [--name N] [--headless] [--] [codex args...]
|
|
244
244
|
runs codex with relay messages waking an idle thread or steering a running turn
|
|
245
|
+
${CLI_NAME} muse [--name N] [--resume S] [--] [muse serve args...]
|
|
246
|
+
runs a headless Muse session that relay messages wake, printing its replies
|
|
245
247
|
${CLI_NAME} opencode [--name N] [--] [opencode args...]
|
|
246
248
|
runs OpenCode with your own config and arguments, wake on: the plugin wakes an
|
|
247
249
|
idle session, or opens one; refuses to start without the current plugin
|
|
250
|
+
${CLI_NAME} agy [--name N] [--] [agy args...]
|
|
251
|
+
runs agy headless: each new message resumes its conversation as a turn;
|
|
252
|
+
refuses interactive flags and starts only with the scp hooks installed
|
|
253
|
+
${CLI_NAME} grok [--name N] [--] [grok args...]
|
|
254
|
+
runs grok headless: each new message resumes its session as a turn
|
|
248
255
|
${CLI_NAME} peers [--all] [--roots] who you may message: title, status and the rule that admits each; offline ones and
|
|
249
256
|
sessions nobody spawned that spawned nobody only with --all (--roots: those sessions)
|
|
250
257
|
${CLI_NAME} why <from> <to> whether from may message to, and why
|
|
@@ -575,14 +582,16 @@ async function relayMain(argv, cwd = process.cwd()) {
|
|
|
575
582
|
out(cliVersion());
|
|
576
583
|
return 0;
|
|
577
584
|
}
|
|
578
|
-
if (verb === "hook") return (await import("./hooks-
|
|
579
|
-
if (verb === "setup") return (await import("./setup-
|
|
580
|
-
if (verb === "claude") return (await import("./claude-
|
|
581
|
-
if (verb === "pi") return (await import("./pi-
|
|
582
|
-
if (verb === "codex") return (await import("./codex-
|
|
583
|
-
if (verb === "
|
|
585
|
+
if (verb === "hook") return (await import("./hooks-ULKKUHPF.js")).relayHookCommand(rest, startDaemon);
|
|
586
|
+
if (verb === "setup") return (await import("./setup-U7CWN5QP.js")).relaySetupCommand(rest, cwd, out);
|
|
587
|
+
if (verb === "claude") return (await import("./claude-WEHOLJ26.js")).claudeCommand(rest);
|
|
588
|
+
if (verb === "pi") return (await import("./pi-5IPU6GA4.js")).piCommand(rest);
|
|
589
|
+
if (verb === "codex") return (await import("./codex-54UWPDY5.js")).codexCommand(rest);
|
|
590
|
+
if (verb === "muse") return (await import("./muse-S7FPY4CL.js")).museCommand(rest);
|
|
591
|
+
if (verb === "opencode") return (await import("./opencode-WFMQYCI2.js")).opencodeCommand(rest, process.env, void 0, cwd);
|
|
592
|
+
if (verb === "agy" || verb === "grok") return (await import("./resume-3ZRDXSTX.js")).resumeCommand(verb, rest, process.env, cwd);
|
|
584
593
|
if (verb === "spawn") {
|
|
585
|
-
const { splitSpawn, spawnCommand } = await import("./spawn-
|
|
594
|
+
const { splitSpawn, spawnCommand } = await import("./spawn-VZK5MD3R.js");
|
|
586
595
|
const { flags } = splitSpawn(rest);
|
|
587
596
|
if (flags.includes("--help") || flags.includes("-h")) {
|
|
588
597
|
out(flags.includes("--all") ? RELAY_HELP : SPAWN_HELP);
|
|
@@ -590,7 +599,7 @@ async function relayMain(argv, cwd = process.cwd()) {
|
|
|
590
599
|
}
|
|
591
600
|
return spawnCommand(rest, cwd);
|
|
592
601
|
}
|
|
593
|
-
if (verb === "mesh") return (await import("./mesh-
|
|
602
|
+
if (verb === "mesh") return (await import("./mesh-TDOVAHZ3.js")).meshCommand(rest);
|
|
594
603
|
const allowed = VERBS[verb];
|
|
595
604
|
if (!allowed) throw new RelayUsage(`unknown command "${verb}"`);
|
|
596
605
|
let parsed;
|
|
@@ -610,11 +619,11 @@ async function relayMain(argv, cwd = process.cwd()) {
|
|
|
610
619
|
return daemon(values.idle, values.policy);
|
|
611
620
|
}
|
|
612
621
|
if (verb === "mcp")
|
|
613
|
-
return (await import("./mcp-
|
|
622
|
+
return (await import("./mcp-7GB35CTY.js")).relayMcpCommand(values, positionals);
|
|
614
623
|
if (verb === "hooks") {
|
|
615
624
|
if (positionals[0] !== "install" || positionals.length > 1) throw new RelayUsage(`${CLI_NAME} hooks takes install --harness claude|codex|opencode|agy|muse`);
|
|
616
625
|
if (values.write && values.print) throw new RelayUsage("--print and --write: pick one");
|
|
617
|
-
return (await import("./install-
|
|
626
|
+
return (await import("./install-5A3ETGF6.js")).installHooks({
|
|
618
627
|
harness: values.harness,
|
|
619
628
|
scope: values.scope,
|
|
620
629
|
write: values.write === true,
|
|
@@ -625,27 +634,27 @@ async function relayMain(argv, cwd = process.cwd()) {
|
|
|
625
634
|
out
|
|
626
635
|
});
|
|
627
636
|
}
|
|
628
|
-
if (verb === "relay") return (await import("./relay-
|
|
629
|
-
if (verb === "up") return (await import("./up-
|
|
637
|
+
if (verb === "relay") return (await import("./relay-7WBNUACH.js")).relayVerb(positionals, values.json === true);
|
|
638
|
+
if (verb === "up") return (await import("./up-S4KJBWI6.js")).up(positionals, values, cwd, relinkBroker);
|
|
630
639
|
if (verb === "login") {
|
|
631
|
-
const code = await (await import("./relay-
|
|
640
|
+
const code = await (await import("./relay-7WBNUACH.js")).loginMain(positionals, values);
|
|
632
641
|
if (code === 0) await relinkRunning();
|
|
633
642
|
return code;
|
|
634
643
|
}
|
|
635
|
-
if (verb === "logout") return (await import("./relay-
|
|
644
|
+
if (verb === "logout") return (await import("./relay-7WBNUACH.js")).logoutMain(positionals, values.json === true);
|
|
636
645
|
if (verb === "cloud") {
|
|
637
|
-
const code = await (await import("./remote-
|
|
646
|
+
const code = await (await import("./remote-YO5B2HQI.js")).cloudMain(positionals, values, cloudStatus);
|
|
638
647
|
if (code === 0 && positionals[0] === "enable") await relinkRunning();
|
|
639
648
|
return code;
|
|
640
649
|
}
|
|
641
|
-
if (verb === "join") return (await import("./join-
|
|
650
|
+
if (verb === "join") return (await import("./join-FFT7RQRW.js")).joinCommand(values, positionals, cwd, out);
|
|
642
651
|
if (verb === "holds") holdsArgs(values, positionals);
|
|
643
652
|
const bodyFromStdin = (verb === "send" || verb === "ask" || verb === "reply") && (positionals[1] === void 0 || positionals[1] === "-");
|
|
644
653
|
const humanAdopt = verb === "adopt" && values.parent !== void 0 && values.as === void 0 && terminalAttached(process, false);
|
|
645
654
|
const opened = humanAdopt ? await openAdoptHuman(cwd, values) : await open(verb, values, cwd, bodyFromStdin);
|
|
646
655
|
const { client } = opened;
|
|
647
656
|
try {
|
|
648
|
-
if (verb === "machines") return await (await import("./remote-
|
|
657
|
+
if (verb === "machines") return await (await import("./remote-YO5B2HQI.js")).machinesVerb(client, positionals, values.json === true);
|
|
649
658
|
return await runVerb(opened, verb, values, positionals, cwd);
|
|
650
659
|
} finally {
|
|
651
660
|
client.close();
|
|
@@ -653,7 +662,7 @@ async function relayMain(argv, cwd = process.cwd()) {
|
|
|
653
662
|
}
|
|
654
663
|
async function openAdoptHuman(cwd, values) {
|
|
655
664
|
if (values.cloud || process.env.SCP_TRANSPORT === "cloud") {
|
|
656
|
-
const { openCloud } = await import("./remote-
|
|
665
|
+
const { openCloud } = await import("./remote-YO5B2HQI.js");
|
|
657
666
|
return { ...await openCloud({ tty: true, ...values.machine !== void 0 ? { machine: values.machine } : {} }), broker: null, bound: "human" };
|
|
658
667
|
}
|
|
659
668
|
if (values.machine !== void 0) throw new RelayUsage("--machine names the machine of the cloud transport: add --cloud");
|
|
@@ -838,9 +847,9 @@ async function runVerb({ client, me, broker, where, bound, harnessPid }, verb, v
|
|
|
838
847
|
return 0;
|
|
839
848
|
}
|
|
840
849
|
case "peek":
|
|
841
|
-
return (await import("./peek-
|
|
850
|
+
return (await import("./peek-X4QQFMQJ.js")).peekCommand(localClient(client, broker, verb), values, positionals);
|
|
842
851
|
case "set-peek":
|
|
843
|
-
return (await import("./peek-
|
|
852
|
+
return (await import("./peek-X4QQFMQJ.js")).setPeekCommand(localClient(client, broker, verb), values, positionals);
|
|
844
853
|
case "why": {
|
|
845
854
|
const [from, to] = positionals;
|
|
846
855
|
if (!from || !to || positionals.length > 2) throw new RelayUsage(`${CLI_NAME} why takes <from> <to>`);
|
|
@@ -1464,11 +1473,11 @@ async function daemon(idle, policyFile) {
|
|
|
1464
1473
|
});
|
|
1465
1474
|
let broker;
|
|
1466
1475
|
try {
|
|
1467
|
-
const { daemonBridge } = await import("./remote-
|
|
1476
|
+
const { daemonBridge } = await import("./remote-YO5B2HQI.js");
|
|
1468
1477
|
const bridge = await daemonBridge();
|
|
1469
1478
|
broker = await startBroker({
|
|
1470
1479
|
dir: relayDir(),
|
|
1471
|
-
...bridge ? { bridge } : await (await import("./mesh-
|
|
1480
|
+
...bridge ? { bridge } : await (await import("./mesh-TDOVAHZ3.js")).meshBrokerOptions(),
|
|
1472
1481
|
bridgeConfig: () => daemonBridge(),
|
|
1473
1482
|
...idleMs !== void 0 ? { idleMs } : {},
|
|
1474
1483
|
...policyFile ? { policyPath: resolve(policyFile) } : {}
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
spawnDetached
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RZUQ422C.js";
|
|
4
4
|
import "./chunk-KN7WEIE4.js";
|
|
5
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-SNW53KT3.js";
|
|
6
6
|
import {
|
|
7
7
|
mcpInstall
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-LRQP25RI.js";
|
|
9
|
+
import "./chunk-277BAY7J.js";
|
|
10
10
|
import "./chunk-YYSLYVNZ.js";
|
|
11
11
|
import {
|
|
12
12
|
CHANNELS_ENV,
|
|
13
13
|
RelayUsage,
|
|
14
14
|
harnessAt,
|
|
15
15
|
harnessPid,
|
|
16
|
+
launcherPid,
|
|
16
17
|
membership,
|
|
17
18
|
psParent,
|
|
18
19
|
relayIdentity,
|
|
19
20
|
startDaemon,
|
|
20
21
|
writeShimBinding
|
|
21
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-3SOIVANO.js";
|
|
22
23
|
import "./chunk-MNTIEWKF.js";
|
|
23
24
|
|
|
24
25
|
// src/mcp.ts
|
|
@@ -40,7 +41,7 @@ async function relayMcpCommand(values, positionals) {
|
|
|
40
41
|
fallbackHarness: "mcp",
|
|
41
42
|
cwd: process.cwd(),
|
|
42
43
|
env: process.env,
|
|
43
|
-
harnessPid: () => harnessPid(),
|
|
44
|
+
harnessPid: () => launcherPid(process.env) ?? harnessPid(),
|
|
44
45
|
inferHarness: (pid) => harnessAt(pid)
|
|
45
46
|
});
|
|
46
47
|
if (!validHandle(claim.handle)) throw new RelayUsage(`${JSON.stringify(claim.handle)} is not a valid agent handle (me, user and relay are reserved)`);
|