@scp-dev/cli 0.1.3 → 0.2.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-BUC5G5PY.js → chunk-3RRPUYTE.js} +2 -2
- package/dist/{chunk-URSBFDR6.js → chunk-3V3DRXB2.js} +2 -2
- package/dist/{chunk-QQZF5TQD.js → chunk-5DYFYLAQ.js} +3 -3
- package/dist/{chunk-3PGDKPRN.js → chunk-E53YHYEP.js} +2 -1
- package/dist/{chunk-ABP5AKFH.js → chunk-GH7AXFUL.js} +4 -4
- package/dist/{chunk-ABR5UABL.js → chunk-RXKBND3T.js} +1 -1
- package/dist/{chunk-5UWLTO2Y.js → chunk-U2RSSTNW.js} +2 -2
- package/dist/{chunk-IH2RJRIW.js → chunk-WV5FINTW.js} +4 -4
- package/dist/{claude-5WTICOYS.js → claude-YJLGFQ2P.js} +5 -5
- package/dist/cli.js +1 -1
- package/dist/{hooks-4YVIPZKE.js → hooks-EI7M3YKY.js} +2 -2
- package/dist/{install-4KQQWGGB.js → install-MYHVFKT4.js} +4 -4
- package/dist/{login-5Y3HPSVC.js → login-V2WT7QX5.js} +4 -4
- package/dist/{main-PZQAJGHQ.js → main-HPBTO3JK.js} +21 -18
- package/dist/{mcp-GI5OMTUT.js → mcp-DGAQNFKO.js} +6 -6
- package/dist/{peek-X4SEGEUB.js → peek-WLG3ZROU.js} +2 -2
- package/dist/pi-HMESQA64.js +72 -0
- package/dist/{relay-W2NFUE2U.js → relay-5Z7IEXKD.js} +3 -3
- package/dist/{remote-GC4XN44U.js → remote-FYN5ZXE4.js} +4 -4
- package/dist/{setup-UF4AA6RO.js → setup-LXG346FJ.js} +5 -5
- package/dist/{spawn-KT5235WX.js → spawn-DLPMAS5M.js} +6 -6
- package/dist/{up-VA54QWA6.js → up-GPM4LWY3.js} +6 -6
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RelayUsage
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-3V3DRXB2.js";
|
|
4
4
|
import {
|
|
5
5
|
note
|
|
6
6
|
} from "./chunk-M2DCR2J4.js";
|
|
@@ -119,7 +119,7 @@ function relayVerb(positionals, asJson, env = process.env) {
|
|
|
119
119
|
}
|
|
120
120
|
async function loginMain(positionals, values) {
|
|
121
121
|
if (positionals.length) throw new RelayUsage(`${CLI_NAME} login takes only flags`);
|
|
122
|
-
return (await import("./login-
|
|
122
|
+
return (await import("./login-V2WT7QX5.js")).login(values);
|
|
123
123
|
}
|
|
124
124
|
function logoutMain(positionals, asJson, env = process.env) {
|
|
125
125
|
if (positionals.length) throw new RelayUsage(`${CLI_NAME} logout takes no arguments`);
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
labelsFor,
|
|
5
5
|
lineage,
|
|
6
6
|
readPsTable
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-E53YHYEP.js";
|
|
8
8
|
import {
|
|
9
9
|
SELF,
|
|
10
10
|
parseSeconds
|
|
@@ -186,7 +186,7 @@ async function open(verb, values, cwd, bodyFromStdin, walk) {
|
|
|
186
186
|
`${CLI_NAME} ${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)`
|
|
187
187
|
);
|
|
188
188
|
}
|
|
189
|
-
const { machineName, openCloud } = await import("./remote-
|
|
189
|
+
const { machineName, openCloud } = await import("./remote-FYN5ZXE4.js");
|
|
190
190
|
const handle2 = named ? localHandle(named) : void 0;
|
|
191
191
|
const claim = handle2 ? {
|
|
192
192
|
handle: handle2,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RelayUsage
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-3V3DRXB2.js";
|
|
4
4
|
import {
|
|
5
5
|
AGY_HOOK_SET,
|
|
6
6
|
AGY_UNVERIFIED,
|
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
mergeHooks,
|
|
14
14
|
musePlugin,
|
|
15
15
|
opencodePlugin
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-RXKBND3T.js";
|
|
17
17
|
import {
|
|
18
18
|
gitToplevel
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-E53YHYEP.js";
|
|
20
20
|
|
|
21
21
|
// src/install.ts
|
|
22
22
|
import { chmodSync, copyFileSync, existsSync, lstatSync, mkdirSync, readFileSync, realpathSync, renameSync, statSync, unlinkSync, writeFileSync } from "fs";
|
|
@@ -132,7 +132,8 @@ var HARNESSES = /* @__PURE__ */ new Set([
|
|
|
132
132
|
"agy",
|
|
133
133
|
"antigravity",
|
|
134
134
|
"gemini",
|
|
135
|
-
"gemini-cli"
|
|
135
|
+
"gemini-cli",
|
|
136
|
+
"pi-coding-agent"
|
|
136
137
|
]);
|
|
137
138
|
var INSTALLED = /(^|\/)(node_modules|site-packages|dist-packages|\.npm|\.bun|\.cache|\.local|\.cargo|\.volta|\.nvm|\.pyenv|\.rbenv|Cellar|Applications)(\/|$)|^\/(opt|usr|Library|nix)\//;
|
|
138
139
|
function command(args) {
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
agySettingsFile,
|
|
4
4
|
mcpFile,
|
|
5
5
|
mountedEntry
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-WV5FINTW.js";
|
|
7
7
|
import {
|
|
8
8
|
OPTIONS,
|
|
9
9
|
RelayUsage,
|
|
@@ -13,14 +13,14 @@ import {
|
|
|
13
13
|
open,
|
|
14
14
|
selectorList,
|
|
15
15
|
walkNow
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-3V3DRXB2.js";
|
|
17
17
|
import {
|
|
18
18
|
steerPrompt
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-RXKBND3T.js";
|
|
20
20
|
import {
|
|
21
21
|
detectHarness,
|
|
22
22
|
spawnerKey
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-E53YHYEP.js";
|
|
24
24
|
import {
|
|
25
25
|
SELF,
|
|
26
26
|
note
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
hooksTarget
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5DYFYLAQ.js";
|
|
4
4
|
import {
|
|
5
5
|
RelayUsage
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-3V3DRXB2.js";
|
|
7
7
|
import {
|
|
8
8
|
AGY_HOOK_SET,
|
|
9
9
|
BLOCK_STOP,
|
|
@@ -15,10 +15,10 @@ import {
|
|
|
15
15
|
mergeHooks,
|
|
16
16
|
musePlugin,
|
|
17
17
|
opencodePlugin
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-RXKBND3T.js";
|
|
19
19
|
import {
|
|
20
20
|
gitToplevel
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-E53YHYEP.js";
|
|
22
22
|
|
|
23
23
|
// src/setup.ts
|
|
24
24
|
import { spawnSync } from "child_process";
|
|
@@ -3,15 +3,15 @@ import {
|
|
|
3
3
|
mcpFile,
|
|
4
4
|
mountedEntry,
|
|
5
5
|
whichOnPath
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-WV5FINTW.js";
|
|
7
|
+
import "./chunk-5DYFYLAQ.js";
|
|
8
8
|
import {
|
|
9
9
|
CHANNELS_ENV,
|
|
10
10
|
RelayUsage
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-3V3DRXB2.js";
|
|
12
|
+
import "./chunk-RXKBND3T.js";
|
|
13
13
|
import "./chunk-YYSLYVNZ.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-E53YHYEP.js";
|
|
15
15
|
import "./chunk-M2DCR2J4.js";
|
|
16
16
|
|
|
17
17
|
// src/claude.ts
|
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-HPBTO3JK.js");
|
|
21
21
|
await run(process.argv.slice(2));
|
|
22
22
|
}
|
|
@@ -30,11 +30,11 @@ import {
|
|
|
30
30
|
subagentIntro,
|
|
31
31
|
summarize,
|
|
32
32
|
unreadPointer
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-RXKBND3T.js";
|
|
34
34
|
import {
|
|
35
35
|
SUBAGENT
|
|
36
36
|
} from "./chunk-YYSLYVNZ.js";
|
|
37
|
-
import "./chunk-
|
|
37
|
+
import "./chunk-E53YHYEP.js";
|
|
38
38
|
import "./chunk-M2DCR2J4.js";
|
|
39
39
|
export {
|
|
40
40
|
AGY_HOOK_SET,
|
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
hooksTarget,
|
|
3
3
|
installHooks,
|
|
4
4
|
mcpInstall
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-5DYFYLAQ.js";
|
|
6
|
+
import "./chunk-3V3DRXB2.js";
|
|
7
|
+
import "./chunk-RXKBND3T.js";
|
|
8
8
|
import "./chunk-YYSLYVNZ.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-E53YHYEP.js";
|
|
10
10
|
import "./chunk-M2DCR2J4.js";
|
|
11
11
|
export {
|
|
12
12
|
hooksTarget,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
machineName
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-U2RSSTNW.js";
|
|
4
4
|
import {
|
|
5
5
|
activeRelay,
|
|
6
6
|
saveCredential
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-3RRPUYTE.js";
|
|
8
8
|
import {
|
|
9
9
|
RelayUsage
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-3V3DRXB2.js";
|
|
11
|
+
import "./chunk-E53YHYEP.js";
|
|
12
12
|
import {
|
|
13
13
|
note
|
|
14
14
|
} from "./chunk-M2DCR2J4.js";
|
|
@@ -14,10 +14,10 @@ import {
|
|
|
14
14
|
stamp,
|
|
15
15
|
startDaemon,
|
|
16
16
|
time
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-3V3DRXB2.js";
|
|
18
18
|
import {
|
|
19
19
|
shortHostname
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-E53YHYEP.js";
|
|
21
21
|
import {
|
|
22
22
|
FAILED,
|
|
23
23
|
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.2.0",
|
|
39
39
|
description: "The swarm command line tool.",
|
|
40
40
|
license: "Apache-2.0",
|
|
41
41
|
homepage: "https://scp.dev",
|
|
@@ -225,6 +225,8 @@ scopes (selectors are comma-separated, e.g. tree:parent,tree:children,group:team
|
|
|
225
225
|
messages with the relay MCP tools (relay_send, relay_inbox, relay_reply). A
|
|
226
226
|
${CLI_NAME} command from codex's workspace-write sandbox also needs
|
|
227
227
|
-c sandbox_workspace_write.network_access=true (the relay socket counts as network)
|
|
228
|
+
${CLI_NAME} pi [--name N] [--] [pi args...] runs pi with the @scp-dev/pi extension: the relay tools, and each new
|
|
229
|
+
message as a turn (steering a running one, waking an idle session)
|
|
228
230
|
${CLI_NAME} peers [--all] [--roots] who you may message: title, status and the rule that admits each; offline ones and
|
|
229
231
|
sessions nobody spawned that spawned nobody only with --all (--roots: those sessions)
|
|
230
232
|
${CLI_NAME} why <from> <to> whether from may message to, and why
|
|
@@ -496,11 +498,12 @@ async function relayMain(argv, cwd = process.cwd()) {
|
|
|
496
498
|
out(package_default.version);
|
|
497
499
|
return 0;
|
|
498
500
|
}
|
|
499
|
-
if (verb === "hook") return (await import("./hooks-
|
|
500
|
-
if (verb === "setup") return (await import("./setup-
|
|
501
|
-
if (verb === "claude") return (await import("./claude-
|
|
501
|
+
if (verb === "hook") return (await import("./hooks-EI7M3YKY.js")).relayHookCommand(rest, startDaemon);
|
|
502
|
+
if (verb === "setup") return (await import("./setup-LXG346FJ.js")).relaySetupCommand(rest, cwd, out);
|
|
503
|
+
if (verb === "claude") return (await import("./claude-YJLGFQ2P.js")).claudeCommand(rest);
|
|
504
|
+
if (verb === "pi") return (await import("./pi-HMESQA64.js")).piCommand(rest);
|
|
502
505
|
if (verb === "spawn") {
|
|
503
|
-
const { splitSpawn, spawnCommand } = await import("./spawn-
|
|
506
|
+
const { splitSpawn, spawnCommand } = await import("./spawn-DLPMAS5M.js");
|
|
504
507
|
const { flags } = splitSpawn(rest);
|
|
505
508
|
if (flags.includes("--help") || flags.includes("-h")) {
|
|
506
509
|
out(flags.includes("--all") ? RELAY_HELP : SPAWN_HELP);
|
|
@@ -527,11 +530,11 @@ async function relayMain(argv, cwd = process.cwd()) {
|
|
|
527
530
|
return daemon(values.idle, values.policy);
|
|
528
531
|
}
|
|
529
532
|
if (verb === "mcp")
|
|
530
|
-
return (await import("./mcp-
|
|
533
|
+
return (await import("./mcp-DGAQNFKO.js")).relayMcpCommand(values, positionals);
|
|
531
534
|
if (verb === "hooks") {
|
|
532
535
|
if (positionals[0] !== "install" || positionals.length > 1) throw new RelayUsage(`${CLI_NAME} hooks takes install --harness claude|codex|opencode|agy|muse`);
|
|
533
536
|
if (values.write && values.print) throw new RelayUsage("--print and --write: pick one");
|
|
534
|
-
return (await import("./install-
|
|
537
|
+
return (await import("./install-MYHVFKT4.js")).installHooks({
|
|
535
538
|
harness: values.harness,
|
|
536
539
|
scope: values.scope,
|
|
537
540
|
write: values.write === true,
|
|
@@ -542,16 +545,16 @@ async function relayMain(argv, cwd = process.cwd()) {
|
|
|
542
545
|
out
|
|
543
546
|
});
|
|
544
547
|
}
|
|
545
|
-
if (verb === "relay") return (await import("./relay-
|
|
546
|
-
if (verb === "up") return (await import("./up-
|
|
548
|
+
if (verb === "relay") return (await import("./relay-5Z7IEXKD.js")).relayVerb(positionals, values.json === true);
|
|
549
|
+
if (verb === "up") return (await import("./up-GPM4LWY3.js")).up(positionals, values, cwd, relinkBroker);
|
|
547
550
|
if (verb === "login") {
|
|
548
|
-
const code = await (await import("./relay-
|
|
551
|
+
const code = await (await import("./relay-5Z7IEXKD.js")).loginMain(positionals, values);
|
|
549
552
|
if (code === 0) await relinkRunning();
|
|
550
553
|
return code;
|
|
551
554
|
}
|
|
552
|
-
if (verb === "logout") return (await import("./relay-
|
|
555
|
+
if (verb === "logout") return (await import("./relay-5Z7IEXKD.js")).logoutMain(positionals, values.json === true);
|
|
553
556
|
if (verb === "cloud") {
|
|
554
|
-
const code = await (await import("./remote-
|
|
557
|
+
const code = await (await import("./remote-FYN5ZXE4.js")).cloudMain(positionals, values, cloudStatus);
|
|
555
558
|
if (code === 0 && positionals[0] === "enable") await relinkRunning();
|
|
556
559
|
return code;
|
|
557
560
|
}
|
|
@@ -560,7 +563,7 @@ async function relayMain(argv, cwd = process.cwd()) {
|
|
|
560
563
|
const opened = await open(verb, values, cwd, bodyFromStdin);
|
|
561
564
|
const { client } = opened;
|
|
562
565
|
try {
|
|
563
|
-
if (verb === "machines") return await (await import("./remote-
|
|
566
|
+
if (verb === "machines") return await (await import("./remote-FYN5ZXE4.js")).machinesVerb(client, positionals, values.json === true);
|
|
564
567
|
return await runVerb(opened, verb, values, positionals, cwd);
|
|
565
568
|
} finally {
|
|
566
569
|
client.close();
|
|
@@ -737,9 +740,9 @@ async function runVerb({ client, me, broker, where, bound, harnessPid }, verb, v
|
|
|
737
740
|
return 0;
|
|
738
741
|
}
|
|
739
742
|
case "peek":
|
|
740
|
-
return (await import("./peek-
|
|
743
|
+
return (await import("./peek-WLG3ZROU.js")).peekCommand(localClient(client, broker, verb), values, positionals);
|
|
741
744
|
case "set-peek":
|
|
742
|
-
return (await import("./peek-
|
|
745
|
+
return (await import("./peek-WLG3ZROU.js")).setPeekCommand(localClient(client, broker, verb), values, positionals);
|
|
743
746
|
case "why": {
|
|
744
747
|
const [from, to] = positionals;
|
|
745
748
|
if (!from || !to || positionals.length > 2) throw new RelayUsage(`${CLI_NAME} why takes <from> <to>`);
|
|
@@ -1292,7 +1295,7 @@ async function daemon(idle, policyFile) {
|
|
|
1292
1295
|
});
|
|
1293
1296
|
let broker;
|
|
1294
1297
|
try {
|
|
1295
|
-
const { daemonBridge } = await import("./remote-
|
|
1298
|
+
const { daemonBridge } = await import("./remote-FYN5ZXE4.js");
|
|
1296
1299
|
const bridge = await daemonBridge();
|
|
1297
1300
|
broker = await startBroker({
|
|
1298
1301
|
dir: relayDir(),
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
spawnDetached
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GH7AXFUL.js";
|
|
4
4
|
import "./chunk-KN7WEIE4.js";
|
|
5
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-WV5FINTW.js";
|
|
6
6
|
import {
|
|
7
7
|
mcpInstall
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-5DYFYLAQ.js";
|
|
9
9
|
import {
|
|
10
10
|
CHANNELS_ENV,
|
|
11
11
|
RelayUsage,
|
|
12
12
|
startDaemon
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-3V3DRXB2.js";
|
|
14
|
+
import "./chunk-RXKBND3T.js";
|
|
15
15
|
import "./chunk-YYSLYVNZ.js";
|
|
16
16
|
import {
|
|
17
17
|
harnessPid,
|
|
18
18
|
psParent,
|
|
19
19
|
relayIdentity
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-E53YHYEP.js";
|
|
21
21
|
import "./chunk-M2DCR2J4.js";
|
|
22
22
|
|
|
23
23
|
// src/mcp.ts
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RelayUsage
|
|
3
|
+
} from "./chunk-3V3DRXB2.js";
|
|
4
|
+
import "./chunk-E53YHYEP.js";
|
|
5
|
+
import "./chunk-M2DCR2J4.js";
|
|
6
|
+
|
|
7
|
+
// src/pi.ts
|
|
8
|
+
import { spawn } from "child_process";
|
|
9
|
+
import { fileURLToPath } from "url";
|
|
10
|
+
import { CLI_NAME, validHandle } from "@scp-dev/core";
|
|
11
|
+
var PI_HELP = `${CLI_NAME} pi [--name NAME | --as NAME] [--] [pi args...]
|
|
12
|
+
runs pi with the @scp-dev/pi extension: the relay tools, and each new message as a turn, waking the session when idle.
|
|
13
|
+
$SCP_PI_BIN picks the pi binary (default pi on PATH), $SCP_PI_EXTENSION the extension file.`;
|
|
14
|
+
function piLaunch(args, env, extension) {
|
|
15
|
+
let name;
|
|
16
|
+
const rest = [];
|
|
17
|
+
for (let i = 0; i < args.length; i++) {
|
|
18
|
+
const arg = args[i];
|
|
19
|
+
if (arg === "--") {
|
|
20
|
+
rest.push(...args.slice(i + 1));
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
if (arg === "--name" || arg === "--as") {
|
|
24
|
+
name = args[++i];
|
|
25
|
+
if (name === void 0) throw new RelayUsage(`${CLI_NAME} pi ${arg} takes a name`);
|
|
26
|
+
} else if (arg.startsWith("--name=") || arg.startsWith("--as=")) name = arg.slice(arg.indexOf("=") + 1);
|
|
27
|
+
else rest.push(arg);
|
|
28
|
+
}
|
|
29
|
+
name = name?.replace(/^me\//, "");
|
|
30
|
+
if (name !== void 0 && !validHandle(name)) throw new RelayUsage(`${JSON.stringify(name)} is not a valid agent handle`);
|
|
31
|
+
return {
|
|
32
|
+
argv: [env.SCP_PI_BIN || "pi", "--extension", extension, ...rest],
|
|
33
|
+
env: { ...env, SCP_HARNESS: "pi", ...name !== void 0 ? { SCP_NAME: name } : {} }
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function extensionPath(env) {
|
|
37
|
+
if (env.SCP_PI_EXTENSION) return env.SCP_PI_EXTENSION;
|
|
38
|
+
try {
|
|
39
|
+
return fileURLToPath(import.meta.resolve("@scp-dev/pi"));
|
|
40
|
+
} catch {
|
|
41
|
+
throw new RelayUsage(`${CLI_NAME} pi needs the @scp-dev/pi extension: install it next to ${CLI_NAME}, or set $SCP_PI_EXTENSION to its file`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
async function piCommand(args) {
|
|
45
|
+
const own = args.includes("--") ? args.slice(0, args.indexOf("--")) : args;
|
|
46
|
+
if (own.includes("--help") || own.includes("-h")) {
|
|
47
|
+
process.stdout.write(`${PI_HELP}
|
|
48
|
+
`);
|
|
49
|
+
return 0;
|
|
50
|
+
}
|
|
51
|
+
const launch = piLaunch(args, process.env, extensionPath(process.env));
|
|
52
|
+
return await new Promise((resolve, reject) => {
|
|
53
|
+
const child = spawn(launch.argv[0], launch.argv.slice(1), { env: launch.env, stdio: "inherit" });
|
|
54
|
+
const forward = (signal) => child.kill(signal);
|
|
55
|
+
const signals = ["SIGTERM", "SIGHUP"];
|
|
56
|
+
const ignore = () => {
|
|
57
|
+
};
|
|
58
|
+
for (const signal of signals) process.on(signal, forward);
|
|
59
|
+
process.on("SIGINT", ignore);
|
|
60
|
+
child.once("error", (error) => reject(new RelayUsage(`could not start ${launch.argv[0]}: ${error.message}`)));
|
|
61
|
+
child.once("exit", (code, signal) => {
|
|
62
|
+
for (const each of signals) process.off(each, forward);
|
|
63
|
+
process.off("SIGINT", ignore);
|
|
64
|
+
resolve(code ?? (signal ? 1 : 0));
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
export {
|
|
69
|
+
PI_HELP,
|
|
70
|
+
piCommand,
|
|
71
|
+
piLaunch
|
|
72
|
+
};
|
|
@@ -11,9 +11,9 @@ import {
|
|
|
11
11
|
removeCredential,
|
|
12
12
|
saveCredential,
|
|
13
13
|
writePrivateJson
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-3RRPUYTE.js";
|
|
15
|
+
import "./chunk-3V3DRXB2.js";
|
|
16
|
+
import "./chunk-E53YHYEP.js";
|
|
17
17
|
import "./chunk-M2DCR2J4.js";
|
|
18
18
|
export {
|
|
19
19
|
DEFAULT_RELAY,
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
machinesVerb,
|
|
10
10
|
openCloud,
|
|
11
11
|
readCloudFile
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-U2RSSTNW.js";
|
|
13
|
+
import "./chunk-3RRPUYTE.js";
|
|
14
|
+
import "./chunk-3V3DRXB2.js";
|
|
15
|
+
import "./chunk-E53YHYEP.js";
|
|
16
16
|
import "./chunk-M2DCR2J4.js";
|
|
17
17
|
export {
|
|
18
18
|
CloudRelayClient,
|
|
@@ -15,12 +15,12 @@ import {
|
|
|
15
15
|
verifyMount,
|
|
16
16
|
verifyMusePlugin,
|
|
17
17
|
whichOnPath
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
18
|
+
} from "./chunk-WV5FINTW.js";
|
|
19
|
+
import "./chunk-5DYFYLAQ.js";
|
|
20
|
+
import "./chunk-3V3DRXB2.js";
|
|
21
|
+
import "./chunk-RXKBND3T.js";
|
|
22
22
|
import "./chunk-YYSLYVNZ.js";
|
|
23
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-E53YHYEP.js";
|
|
24
24
|
import "./chunk-M2DCR2J4.js";
|
|
25
25
|
export {
|
|
26
26
|
SETUP_HARNESSES,
|
|
@@ -29,16 +29,16 @@ import {
|
|
|
29
29
|
steerArgv,
|
|
30
30
|
transcriptReplies,
|
|
31
31
|
workerName
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-GH7AXFUL.js";
|
|
33
33
|
import {
|
|
34
34
|
SPAWN_HELP
|
|
35
35
|
} from "./chunk-KN7WEIE4.js";
|
|
36
|
-
import "./chunk-
|
|
37
|
-
import "./chunk-
|
|
38
|
-
import "./chunk-
|
|
39
|
-
import "./chunk-
|
|
36
|
+
import "./chunk-WV5FINTW.js";
|
|
37
|
+
import "./chunk-5DYFYLAQ.js";
|
|
38
|
+
import "./chunk-3V3DRXB2.js";
|
|
39
|
+
import "./chunk-RXKBND3T.js";
|
|
40
40
|
import "./chunk-YYSLYVNZ.js";
|
|
41
|
-
import "./chunk-
|
|
41
|
+
import "./chunk-E53YHYEP.js";
|
|
42
42
|
import "./chunk-M2DCR2J4.js";
|
|
43
43
|
export {
|
|
44
44
|
MESSAGING,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
activeRelay,
|
|
3
3
|
relayCredential
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-3RRPUYTE.js";
|
|
5
5
|
import {
|
|
6
6
|
RelayUsage
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-3V3DRXB2.js";
|
|
8
|
+
import "./chunk-E53YHYEP.js";
|
|
9
9
|
import "./chunk-M2DCR2J4.js";
|
|
10
10
|
|
|
11
11
|
// src/up.ts
|
|
@@ -17,16 +17,16 @@ async function up(positionals, values, cwd, brokerStatus) {
|
|
|
17
17
|
const { url } = activeRelay(process.env);
|
|
18
18
|
const headless = values.token !== void 0 || Boolean(process.env.SCP_TOKEN?.trim());
|
|
19
19
|
if (headless || !relayCredential(process.env, url).token) {
|
|
20
|
-
const code = await (await import("./login-
|
|
20
|
+
const code = await (await import("./login-V2WT7QX5.js")).login({
|
|
21
21
|
...values.token !== void 0 ? { token: values.token } : {},
|
|
22
22
|
...values.label !== void 0 ? { label: values.label } : {},
|
|
23
23
|
...values["no-browser"] ? { "no-browser": true } : {}
|
|
24
24
|
});
|
|
25
25
|
if (code !== 0) return code;
|
|
26
26
|
} else out(`already logged in to ${url}`);
|
|
27
|
-
const enabled = await (await import("./remote-
|
|
27
|
+
const enabled = await (await import("./remote-FYN5ZXE4.js")).cloudMain(["enable"], values.machine !== void 0 ? { machine: values.machine } : {}, brokerStatus);
|
|
28
28
|
if (enabled !== 0) return enabled;
|
|
29
|
-
const setup = (await import("./setup-
|
|
29
|
+
const setup = (await import("./setup-LXG346FJ.js")).relaySetupCommand(["--write"], cwd, out);
|
|
30
30
|
if (setup !== 0) return setup;
|
|
31
31
|
const broker = await brokerStatus();
|
|
32
32
|
if (!broker.enabled) out(`the broker is still local-only; run \`${CLI_NAME} daemon restart\` to link it to ${url}`);
|