svamp-cli 0.2.58 → 0.2.59
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/{agentCommands-3F23ymKC.mjs → agentCommands-DU0bGhdt.mjs} +2 -2
- package/dist/cli.mjs +33 -33
- package/dist/{commands-DfifaEbW.mjs → commands-DNpgg4Td.mjs} +45 -10
- package/dist/{commands-DR7o1R2b.mjs → commands-DXZwCUve.mjs} +2 -2
- package/dist/{commands-CEq6IsUJ.mjs → commands-iYxal2yb.mjs} +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{package-GG73qTsa.mjs → package-CYdzHadw.mjs} +1 -1
- package/dist/{run-D-yYK3EG.mjs → run-COWbdmBJ.mjs} +1 -1
- package/dist/{run-a3tcb38_.mjs → run-FTguq4Qt.mjs} +118 -5
- package/dist/{serveCommands-C77qUVpI.mjs → serveCommands-C25VGmW2.mjs} +5 -5
- package/dist/{serveManager-D0rSoflf.mjs → serveManager-wSTZ4YwV.mjs} +1 -1
- package/package.json +1 -1
|
@@ -148,7 +148,7 @@ async function sessionBroadcast(action, args) {
|
|
|
148
148
|
console.log(`Broadcast sent: ${action}`);
|
|
149
149
|
}
|
|
150
150
|
async function connectToMachineService() {
|
|
151
|
-
const { connectAndGetMachine } = await import('./commands-
|
|
151
|
+
const { connectAndGetMachine } = await import('./commands-iYxal2yb.mjs');
|
|
152
152
|
return connectAndGetMachine();
|
|
153
153
|
}
|
|
154
154
|
async function inboxSend(targetSessionId, opts) {
|
|
@@ -165,7 +165,7 @@ async function inboxSend(targetSessionId, opts) {
|
|
|
165
165
|
}
|
|
166
166
|
const { server, machine } = await connectToMachineService();
|
|
167
167
|
try {
|
|
168
|
-
const { resolveSessionId } = await import('./commands-
|
|
168
|
+
const { resolveSessionId } = await import('./commands-iYxal2yb.mjs');
|
|
169
169
|
const sessions = await machine.listSessions();
|
|
170
170
|
const match = resolveSessionId(sessions, targetSessionId);
|
|
171
171
|
const fullTargetId = match.sessionId;
|
package/dist/cli.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as startDaemon, b as stopDaemon, d as daemonStatus } from './run-
|
|
1
|
+
import { s as startDaemon, b as stopDaemon, d as daemonStatus } from './run-FTguq4Qt.mjs';
|
|
2
2
|
import 'os';
|
|
3
3
|
import 'fs/promises';
|
|
4
4
|
import 'fs';
|
|
@@ -43,7 +43,7 @@ async function main() {
|
|
|
43
43
|
console.error(`svamp daemon restart: ${err.message || err}`);
|
|
44
44
|
process.exit(1);
|
|
45
45
|
}
|
|
46
|
-
const { restartDaemon } = await import('./run-
|
|
46
|
+
const { restartDaemon } = await import('./run-FTguq4Qt.mjs').then(function (n) { return n.u; });
|
|
47
47
|
await restartDaemon();
|
|
48
48
|
process.exit(0);
|
|
49
49
|
}
|
|
@@ -279,7 +279,7 @@ async function main() {
|
|
|
279
279
|
console.error("svamp service: Service commands are not available in sandboxed sessions.");
|
|
280
280
|
process.exit(1);
|
|
281
281
|
}
|
|
282
|
-
const { handleServiceCommand } = await import('./commands-
|
|
282
|
+
const { handleServiceCommand } = await import('./commands-DNpgg4Td.mjs');
|
|
283
283
|
await handleServiceCommand();
|
|
284
284
|
} else if (subcommand === "serve") {
|
|
285
285
|
const { isSandboxed: isSandboxedServe } = await import('./sandboxDetect-DNTcbgWD.mjs');
|
|
@@ -287,7 +287,7 @@ async function main() {
|
|
|
287
287
|
console.error("svamp serve: Serve commands are not available in sandboxed sessions.");
|
|
288
288
|
process.exit(1);
|
|
289
289
|
}
|
|
290
|
-
const { handleServeCommand } = await import('./serveCommands-
|
|
290
|
+
const { handleServeCommand } = await import('./serveCommands-C25VGmW2.mjs');
|
|
291
291
|
await handleServeCommand();
|
|
292
292
|
process.exit(0);
|
|
293
293
|
} else if (subcommand === "process" || subcommand === "proc") {
|
|
@@ -296,7 +296,7 @@ async function main() {
|
|
|
296
296
|
console.error("svamp process: Process commands are not available in sandboxed sessions.");
|
|
297
297
|
process.exit(1);
|
|
298
298
|
}
|
|
299
|
-
const { processCommand } = await import('./commands-
|
|
299
|
+
const { processCommand } = await import('./commands-DXZwCUve.mjs');
|
|
300
300
|
let machineId;
|
|
301
301
|
const processArgs = args.slice(1);
|
|
302
302
|
const mIdx = processArgs.findIndex((a) => a === "--machine" || a === "-m");
|
|
@@ -314,7 +314,7 @@ async function main() {
|
|
|
314
314
|
} else if (!subcommand || subcommand === "start") {
|
|
315
315
|
await handleInteractiveCommand();
|
|
316
316
|
} else if (subcommand === "--version" || subcommand === "-v") {
|
|
317
|
-
const pkg = await import('./package-
|
|
317
|
+
const pkg = await import('./package-CYdzHadw.mjs').catch(() => ({ default: { version: "unknown" } }));
|
|
318
318
|
console.log(`svamp version: ${pkg.default.version}`);
|
|
319
319
|
} else {
|
|
320
320
|
console.error(`Unknown command: ${subcommand}`);
|
|
@@ -323,7 +323,7 @@ async function main() {
|
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
325
|
async function handleInteractiveCommand() {
|
|
326
|
-
const { runInteractive } = await import('./run-
|
|
326
|
+
const { runInteractive } = await import('./run-COWbdmBJ.mjs');
|
|
327
327
|
const interactiveArgs = subcommand === "start" ? args.slice(1) : args;
|
|
328
328
|
let directory = process.cwd();
|
|
329
329
|
let resumeSessionId;
|
|
@@ -368,7 +368,7 @@ async function handleAgentCommand() {
|
|
|
368
368
|
return;
|
|
369
369
|
}
|
|
370
370
|
if (agentArgs[0] === "list") {
|
|
371
|
-
const { KNOWN_ACP_AGENTS, KNOWN_MCP_AGENTS: KNOWN_MCP_AGENTS2 } = await import('./run-
|
|
371
|
+
const { KNOWN_ACP_AGENTS, KNOWN_MCP_AGENTS: KNOWN_MCP_AGENTS2 } = await import('./run-FTguq4Qt.mjs').then(function (n) { return n.p; });
|
|
372
372
|
console.log("Known agents:");
|
|
373
373
|
for (const [name, config2] of Object.entries(KNOWN_ACP_AGENTS)) {
|
|
374
374
|
console.log(` ${name.padEnd(12)} ${config2.command} ${config2.args.join(" ")} (ACP)`);
|
|
@@ -380,7 +380,7 @@ async function handleAgentCommand() {
|
|
|
380
380
|
console.log('Use "svamp agent -- <command> [args]" for a custom ACP agent.');
|
|
381
381
|
return;
|
|
382
382
|
}
|
|
383
|
-
const { resolveAcpAgentConfig, KNOWN_MCP_AGENTS } = await import('./run-
|
|
383
|
+
const { resolveAcpAgentConfig, KNOWN_MCP_AGENTS } = await import('./run-FTguq4Qt.mjs').then(function (n) { return n.p; });
|
|
384
384
|
let cwd = process.cwd();
|
|
385
385
|
const filteredArgs = [];
|
|
386
386
|
for (let i = 0; i < agentArgs.length; i++) {
|
|
@@ -404,12 +404,12 @@ async function handleAgentCommand() {
|
|
|
404
404
|
console.log(`Starting ${config.agentName} agent in ${cwd}...`);
|
|
405
405
|
let backend;
|
|
406
406
|
if (KNOWN_MCP_AGENTS[config.agentName]) {
|
|
407
|
-
const { CodexMcpBackend } = await import('./run-
|
|
407
|
+
const { CodexMcpBackend } = await import('./run-FTguq4Qt.mjs').then(function (n) { return n.q; });
|
|
408
408
|
backend = new CodexMcpBackend({ cwd, log: logFn });
|
|
409
409
|
} else {
|
|
410
|
-
const { AcpBackend } = await import('./run-
|
|
411
|
-
const { GeminiTransport } = await import('./run-
|
|
412
|
-
const { DefaultTransport } = await import('./run-
|
|
410
|
+
const { AcpBackend } = await import('./run-FTguq4Qt.mjs').then(function (n) { return n.o; });
|
|
411
|
+
const { GeminiTransport } = await import('./run-FTguq4Qt.mjs').then(function (n) { return n.G; });
|
|
412
|
+
const { DefaultTransport } = await import('./run-FTguq4Qt.mjs').then(function (n) { return n.D; });
|
|
413
413
|
const transportHandler = config.agentName === "gemini" ? new GeminiTransport() : new DefaultTransport(config.agentName);
|
|
414
414
|
backend = new AcpBackend({
|
|
415
415
|
agentName: config.agentName,
|
|
@@ -536,7 +536,7 @@ async function handleSessionCommand() {
|
|
|
536
536
|
process.exit(1);
|
|
537
537
|
}
|
|
538
538
|
}
|
|
539
|
-
const { sessionList, sessionSpawn, sessionStop, sessionInfo, sessionMessages, sessionAttach, sessionMachines, sessionSend, sessionWait, sessionShare, sessionRalphStart, sessionRalphCancel, sessionRalphStatus, sessionInboxSend, sessionInboxList, sessionInboxRead, sessionInboxReply, sessionInboxClear } = await import('./commands-
|
|
539
|
+
const { sessionList, sessionSpawn, sessionStop, sessionInfo, sessionMessages, sessionAttach, sessionMachines, sessionSend, sessionWait, sessionShare, sessionRalphStart, sessionRalphCancel, sessionRalphStatus, sessionInboxSend, sessionInboxList, sessionInboxRead, sessionInboxReply, sessionInboxClear } = await import('./commands-iYxal2yb.mjs');
|
|
540
540
|
const parseFlagStr = (flag, shortFlag) => {
|
|
541
541
|
for (let i = 1; i < sessionArgs.length; i++) {
|
|
542
542
|
if ((sessionArgs[i] === flag || shortFlag) && i + 1 < sessionArgs.length) {
|
|
@@ -596,7 +596,7 @@ async function handleSessionCommand() {
|
|
|
596
596
|
allowDomain.push(sessionArgs[++i]);
|
|
597
597
|
}
|
|
598
598
|
}
|
|
599
|
-
const { parseShareArg } = await import('./commands-
|
|
599
|
+
const { parseShareArg } = await import('./commands-iYxal2yb.mjs');
|
|
600
600
|
const shareEntries = share.map((s) => parseShareArg(s));
|
|
601
601
|
await sessionSpawn(agent, dir, targetMachineId, {
|
|
602
602
|
message,
|
|
@@ -682,7 +682,7 @@ async function handleSessionCommand() {
|
|
|
682
682
|
console.error("Usage: svamp session approve <session-id> [request-id] [--json]");
|
|
683
683
|
process.exit(1);
|
|
684
684
|
}
|
|
685
|
-
const { sessionApprove } = await import('./commands-
|
|
685
|
+
const { sessionApprove } = await import('./commands-iYxal2yb.mjs');
|
|
686
686
|
const approveReqId = sessionArgs[2] && !sessionArgs[2].startsWith("--") ? sessionArgs[2] : void 0;
|
|
687
687
|
await sessionApprove(sessionArgs[1], approveReqId, targetMachineId, {
|
|
688
688
|
json: hasFlag("--json")
|
|
@@ -692,7 +692,7 @@ async function handleSessionCommand() {
|
|
|
692
692
|
console.error("Usage: svamp session deny <session-id> [request-id] [--json]");
|
|
693
693
|
process.exit(1);
|
|
694
694
|
}
|
|
695
|
-
const { sessionDeny } = await import('./commands-
|
|
695
|
+
const { sessionDeny } = await import('./commands-iYxal2yb.mjs');
|
|
696
696
|
const denyReqId = sessionArgs[2] && !sessionArgs[2].startsWith("--") ? sessionArgs[2] : void 0;
|
|
697
697
|
await sessionDeny(sessionArgs[1], denyReqId, targetMachineId, {
|
|
698
698
|
json: hasFlag("--json")
|
|
@@ -728,7 +728,7 @@ async function handleSessionCommand() {
|
|
|
728
728
|
console.error("Usage: svamp session set-title <title>");
|
|
729
729
|
process.exit(1);
|
|
730
730
|
}
|
|
731
|
-
const { sessionSetTitle } = await import('./agentCommands-
|
|
731
|
+
const { sessionSetTitle } = await import('./agentCommands-DU0bGhdt.mjs');
|
|
732
732
|
await sessionSetTitle(title);
|
|
733
733
|
} else if (sessionSubcommand === "set-link") {
|
|
734
734
|
const url = sessionArgs[1];
|
|
@@ -737,7 +737,7 @@ async function handleSessionCommand() {
|
|
|
737
737
|
process.exit(1);
|
|
738
738
|
}
|
|
739
739
|
const label = sessionArgs[2] && !sessionArgs[2].startsWith("--") ? sessionArgs[2] : void 0;
|
|
740
|
-
const { sessionSetLink } = await import('./agentCommands-
|
|
740
|
+
const { sessionSetLink } = await import('./agentCommands-DU0bGhdt.mjs');
|
|
741
741
|
await sessionSetLink(url, label);
|
|
742
742
|
} else if (sessionSubcommand === "notify") {
|
|
743
743
|
const message = sessionArgs[1];
|
|
@@ -746,7 +746,7 @@ async function handleSessionCommand() {
|
|
|
746
746
|
process.exit(1);
|
|
747
747
|
}
|
|
748
748
|
const level = parseFlagStr("--level") || "info";
|
|
749
|
-
const { sessionNotify } = await import('./agentCommands-
|
|
749
|
+
const { sessionNotify } = await import('./agentCommands-DU0bGhdt.mjs');
|
|
750
750
|
await sessionNotify(message, level);
|
|
751
751
|
} else if (sessionSubcommand === "broadcast") {
|
|
752
752
|
const action = sessionArgs[1];
|
|
@@ -754,7 +754,7 @@ async function handleSessionCommand() {
|
|
|
754
754
|
console.error("Usage: svamp session broadcast <action> [args...]\nActions: open-canvas <url> [label], close-canvas, toast <message>");
|
|
755
755
|
process.exit(1);
|
|
756
756
|
}
|
|
757
|
-
const { sessionBroadcast } = await import('./agentCommands-
|
|
757
|
+
const { sessionBroadcast } = await import('./agentCommands-DU0bGhdt.mjs');
|
|
758
758
|
await sessionBroadcast(action, sessionArgs.slice(2).filter((a) => !a.startsWith("--")));
|
|
759
759
|
} else if (sessionSubcommand === "inbox") {
|
|
760
760
|
const inboxSubcmd = sessionArgs[1];
|
|
@@ -765,7 +765,7 @@ async function handleSessionCommand() {
|
|
|
765
765
|
process.exit(1);
|
|
766
766
|
}
|
|
767
767
|
if (agentSessionId) {
|
|
768
|
-
const { inboxSend } = await import('./agentCommands-
|
|
768
|
+
const { inboxSend } = await import('./agentCommands-DU0bGhdt.mjs');
|
|
769
769
|
await inboxSend(sessionArgs[2], {
|
|
770
770
|
body: sessionArgs[3],
|
|
771
771
|
subject: parseFlagStr("--subject"),
|
|
@@ -780,7 +780,7 @@ async function handleSessionCommand() {
|
|
|
780
780
|
}
|
|
781
781
|
} else if (inboxSubcmd === "list" || inboxSubcmd === "ls") {
|
|
782
782
|
if (agentSessionId && !sessionArgs[2]) {
|
|
783
|
-
const { inboxList } = await import('./agentCommands-
|
|
783
|
+
const { inboxList } = await import('./agentCommands-DU0bGhdt.mjs');
|
|
784
784
|
await inboxList({
|
|
785
785
|
unread: hasFlag("--unread"),
|
|
786
786
|
limit: parseFlagInt("--limit"),
|
|
@@ -802,7 +802,7 @@ async function handleSessionCommand() {
|
|
|
802
802
|
process.exit(1);
|
|
803
803
|
}
|
|
804
804
|
if (agentSessionId && !sessionArgs[3]) {
|
|
805
|
-
const { inboxList } = await import('./agentCommands-
|
|
805
|
+
const { inboxList } = await import('./agentCommands-DU0bGhdt.mjs');
|
|
806
806
|
await sessionInboxRead(agentSessionId, sessionArgs[2], targetMachineId);
|
|
807
807
|
} else if (sessionArgs[3]) {
|
|
808
808
|
await sessionInboxRead(sessionArgs[2], sessionArgs[3], targetMachineId);
|
|
@@ -812,7 +812,7 @@ async function handleSessionCommand() {
|
|
|
812
812
|
}
|
|
813
813
|
} else if (inboxSubcmd === "reply") {
|
|
814
814
|
if (agentSessionId && sessionArgs[2] && sessionArgs[3] && !sessionArgs[4]) {
|
|
815
|
-
const { inboxReply } = await import('./agentCommands-
|
|
815
|
+
const { inboxReply } = await import('./agentCommands-DU0bGhdt.mjs');
|
|
816
816
|
await inboxReply(sessionArgs[2], sessionArgs[3]);
|
|
817
817
|
} else if (sessionArgs[2] && sessionArgs[3] && sessionArgs[4]) {
|
|
818
818
|
await sessionInboxReply(sessionArgs[2], sessionArgs[3], sessionArgs[4], targetMachineId);
|
|
@@ -848,7 +848,7 @@ async function handleMachineCommand() {
|
|
|
848
848
|
return;
|
|
849
849
|
}
|
|
850
850
|
if (machineSubcommand === "share") {
|
|
851
|
-
const { machineShare } = await import('./commands-
|
|
851
|
+
const { machineShare } = await import('./commands-iYxal2yb.mjs');
|
|
852
852
|
let machineId;
|
|
853
853
|
const shareArgs = [];
|
|
854
854
|
for (let i = 1; i < machineArgs.length; i++) {
|
|
@@ -878,7 +878,7 @@ async function handleMachineCommand() {
|
|
|
878
878
|
}
|
|
879
879
|
await machineShare(machineId, { add, remove, list, configPath, showConfig });
|
|
880
880
|
} else if (machineSubcommand === "exec") {
|
|
881
|
-
const { machineExec } = await import('./commands-
|
|
881
|
+
const { machineExec } = await import('./commands-iYxal2yb.mjs');
|
|
882
882
|
let machineId;
|
|
883
883
|
let cwd;
|
|
884
884
|
const cmdParts = [];
|
|
@@ -898,7 +898,7 @@ async function handleMachineCommand() {
|
|
|
898
898
|
}
|
|
899
899
|
await machineExec(machineId, command, cwd);
|
|
900
900
|
} else if (machineSubcommand === "info") {
|
|
901
|
-
const { machineInfo } = await import('./commands-
|
|
901
|
+
const { machineInfo } = await import('./commands-iYxal2yb.mjs');
|
|
902
902
|
let machineId;
|
|
903
903
|
for (let i = 1; i < machineArgs.length; i++) {
|
|
904
904
|
if ((machineArgs[i] === "--machine" || machineArgs[i] === "-m") && i + 1 < machineArgs.length) {
|
|
@@ -918,10 +918,10 @@ async function handleMachineCommand() {
|
|
|
918
918
|
level = machineArgs[++i];
|
|
919
919
|
}
|
|
920
920
|
}
|
|
921
|
-
const { machineNotify } = await import('./agentCommands-
|
|
921
|
+
const { machineNotify } = await import('./agentCommands-DU0bGhdt.mjs');
|
|
922
922
|
await machineNotify(message, level);
|
|
923
923
|
} else if (machineSubcommand === "ls") {
|
|
924
|
-
const { machineLs } = await import('./commands-
|
|
924
|
+
const { machineLs } = await import('./commands-iYxal2yb.mjs');
|
|
925
925
|
let machineId;
|
|
926
926
|
let showHidden = false;
|
|
927
927
|
let path;
|
|
@@ -1388,7 +1388,7 @@ async function applyClaudeAuthFlags(argv) {
|
|
|
1388
1388
|
"--use-hypha-proxy, --use-claude-login, and --anthropic-base-url/--anthropic-api-key are mutually exclusive"
|
|
1389
1389
|
);
|
|
1390
1390
|
}
|
|
1391
|
-
const mod = await import('./run-
|
|
1391
|
+
const mod = await import('./run-FTguq4Qt.mjs').then(function (n) { return n.t; });
|
|
1392
1392
|
if (hasHypha) {
|
|
1393
1393
|
mod.setClaudeAuthHyphaProxy();
|
|
1394
1394
|
console.log("Claude auth configured: hypha-proxy (uses HYPHA_TOKEN live at each spawn).");
|
|
@@ -1426,7 +1426,7 @@ async function applyDaemonShareFlag(argv) {
|
|
|
1426
1426
|
}
|
|
1427
1427
|
}
|
|
1428
1428
|
if (collected.length === 0) return;
|
|
1429
|
-
const { updateEnvFile } = await import('./run-
|
|
1429
|
+
const { updateEnvFile } = await import('./run-FTguq4Qt.mjs').then(function (n) { return n.t; });
|
|
1430
1430
|
const seen = /* @__PURE__ */ new Set();
|
|
1431
1431
|
const deduped = collected.filter((e) => {
|
|
1432
1432
|
const k = e.toLowerCase();
|
|
@@ -1439,7 +1439,7 @@ async function applyDaemonShareFlag(argv) {
|
|
|
1439
1439
|
}
|
|
1440
1440
|
async function handleDaemonAuthCommand(argv) {
|
|
1441
1441
|
const sub = (argv[0] || "status").toLowerCase();
|
|
1442
|
-
const mod = await import('./run-
|
|
1442
|
+
const mod = await import('./run-FTguq4Qt.mjs').then(function (n) { return n.t; });
|
|
1443
1443
|
if (sub === "--help" || sub === "-h" || sub === "help") {
|
|
1444
1444
|
console.log(`
|
|
1445
1445
|
svamp daemon auth \u2014 Configure how Claude subprocesses authenticate
|
|
@@ -51,18 +51,53 @@ async function serviceExpose(args) {
|
|
|
51
51
|
const healthCheck = getFlag(args, "--health-check");
|
|
52
52
|
const healthPath = getFlag(args, "--health-path");
|
|
53
53
|
const healthInterval = getFlag(args, "--health-interval");
|
|
54
|
+
const foreground = hasFlag(args, "--foreground");
|
|
54
55
|
if (!name || ports.length === 0) {
|
|
55
56
|
console.error("Usage: svamp service expose <name> --port <port> [--port <port2>] [options]");
|
|
57
|
+
console.error(" --foreground run frpc in this shell (legacy, dies with shell)");
|
|
56
58
|
process.exit(1);
|
|
57
59
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
if (foreground) {
|
|
61
|
+
const { runFrpcTunnel } = await import('./frpc-j60b46eU.mjs');
|
|
62
|
+
await runFrpcTunnel(name, ports, void 0, {
|
|
63
|
+
group,
|
|
64
|
+
groupKey,
|
|
65
|
+
healthCheckType: healthCheck,
|
|
66
|
+
healthCheckPath: healthPath,
|
|
67
|
+
healthCheckInterval: healthInterval ? parseInt(healthInterval, 10) : void 0
|
|
68
|
+
});
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const { connectAndGetMachine } = await import('./commands-iYxal2yb.mjs');
|
|
72
|
+
const { server, machine } = await connectAndGetMachine();
|
|
73
|
+
try {
|
|
74
|
+
const status = await machine.tunnelStart({
|
|
75
|
+
name,
|
|
76
|
+
ports,
|
|
77
|
+
group: group || void 0,
|
|
78
|
+
groupKey: groupKey || void 0,
|
|
79
|
+
healthCheckType: healthCheck,
|
|
80
|
+
healthCheckPath: healthPath || void 0,
|
|
81
|
+
healthCheckInterval: healthInterval ? parseInt(healthInterval, 10) : void 0
|
|
82
|
+
});
|
|
83
|
+
console.log(`Tunnel '${name}' registered with daemon \u2014 supervised + restart-persistent.`);
|
|
84
|
+
if (status && status.urls) {
|
|
85
|
+
for (const [port, url] of Object.entries(status.urls)) {
|
|
86
|
+
console.log(` port ${port}: ${url}`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
console.log(`To stop: svamp service delete ${name} (or: svamp tunnel stop ${name})`);
|
|
90
|
+
} catch (err) {
|
|
91
|
+
if (/already running/i.test(err?.message || "")) {
|
|
92
|
+
console.error(`Tunnel '${name}' is already running. Use \`svamp service delete ${name}\` first.`);
|
|
93
|
+
} else {
|
|
94
|
+
console.error(`Failed to register tunnel: ${err?.message || err}`);
|
|
95
|
+
console.error(`Falling back to foreground mode? Add --foreground to run in this shell.`);
|
|
96
|
+
}
|
|
97
|
+
process.exit(1);
|
|
98
|
+
} finally {
|
|
99
|
+
await server.disconnect();
|
|
100
|
+
}
|
|
66
101
|
}
|
|
67
102
|
async function serviceServe(args) {
|
|
68
103
|
const positional = positionalArgs(args);
|
|
@@ -97,7 +132,7 @@ async function serviceServe(args) {
|
|
|
97
132
|
}
|
|
98
133
|
async function serviceList(_args) {
|
|
99
134
|
try {
|
|
100
|
-
const { connectAndGetMachine } = await import('./commands-
|
|
135
|
+
const { connectAndGetMachine } = await import('./commands-iYxal2yb.mjs');
|
|
101
136
|
const { server, machine } = await connectAndGetMachine();
|
|
102
137
|
try {
|
|
103
138
|
const tunnels = await machine.tunnelList({});
|
|
@@ -126,7 +161,7 @@ async function serviceDelete(args) {
|
|
|
126
161
|
process.exit(1);
|
|
127
162
|
}
|
|
128
163
|
try {
|
|
129
|
-
const { connectAndGetMachine } = await import('./commands-
|
|
164
|
+
const { connectAndGetMachine } = await import('./commands-iYxal2yb.mjs');
|
|
130
165
|
const { server, machine } = await connectAndGetMachine();
|
|
131
166
|
try {
|
|
132
167
|
await machine.tunnelStop({ name });
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { writeFileSync, readFileSync } from 'fs';
|
|
2
2
|
import { resolve } from 'path';
|
|
3
|
-
import { connectAndGetMachine } from './commands-
|
|
3
|
+
import { connectAndGetMachine } from './commands-iYxal2yb.mjs';
|
|
4
4
|
import 'node:fs';
|
|
5
5
|
import 'node:child_process';
|
|
6
6
|
import 'node:path';
|
|
7
7
|
import 'node:os';
|
|
8
|
-
import './run-
|
|
8
|
+
import './run-FTguq4Qt.mjs';
|
|
9
9
|
import 'os';
|
|
10
10
|
import 'fs/promises';
|
|
11
11
|
import 'url';
|
|
@@ -2,7 +2,7 @@ import { existsSync, readFileSync } from 'node:fs';
|
|
|
2
2
|
import { execSync } from 'node:child_process';
|
|
3
3
|
import { resolve, join } from 'node:path';
|
|
4
4
|
import os from 'node:os';
|
|
5
|
-
import { n as normalizeAllowedUser, l as loadSecurityContextConfig, e as resolveSecurityContext, f as buildSecurityContextFromFlags, m as mergeSecurityContexts, c as connectToHypha, i as buildSessionShareUrl, j as buildMachineShareUrl } from './run-
|
|
5
|
+
import { n as normalizeAllowedUser, l as loadSecurityContextConfig, e as resolveSecurityContext, f as buildSecurityContextFromFlags, m as mergeSecurityContexts, c as connectToHypha, i as buildSessionShareUrl, j as buildMachineShareUrl } from './run-FTguq4Qt.mjs';
|
|
6
6
|
import 'os';
|
|
7
7
|
import 'fs/promises';
|
|
8
8
|
import 'fs';
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { c as connectToHypha, d as daemonStatus, g as getHyphaServerUrl, r as registerMachineService, a as registerSessionService, s as startDaemon, b as stopDaemon } from './run-
|
|
1
|
+
export { c as connectToHypha, d as daemonStatus, g as getHyphaServerUrl, r as registerMachineService, a as registerSessionService, s as startDaemon, b as stopDaemon } from './run-FTguq4Qt.mjs';
|
|
2
2
|
import 'os';
|
|
3
3
|
import 'fs/promises';
|
|
4
4
|
import 'fs';
|
|
@@ -2,7 +2,7 @@ import{createRequire as _pkgrollCR}from"node:module";const require=_pkgrollCR(im
|
|
|
2
2
|
import os from 'node:os';
|
|
3
3
|
import { resolve, join } from 'node:path';
|
|
4
4
|
import { existsSync, readFileSync, watch } from 'node:fs';
|
|
5
|
-
import { c as connectToHypha, a as registerSessionService, k as generateHookSettings } from './run-
|
|
5
|
+
import { c as connectToHypha, a as registerSessionService, k as generateHookSettings } from './run-FTguq4Qt.mjs';
|
|
6
6
|
import { createServer } from 'node:http';
|
|
7
7
|
import { spawn } from 'node:child_process';
|
|
8
8
|
import { createInterface } from 'node:readline';
|
|
@@ -1117,7 +1117,11 @@ async function registerMachineService(server, machineId, metadata, daemonState,
|
|
|
1117
1117
|
tunnels.delete(params.name);
|
|
1118
1118
|
return { name: params.name, stopped: true };
|
|
1119
1119
|
},
|
|
1120
|
-
/**
|
|
1120
|
+
/**
|
|
1121
|
+
* Start a daemon-supervised reverse tunnel. The frpc subprocess lives
|
|
1122
|
+
* in the daemon's process, persists across CLI shell exits, and is
|
|
1123
|
+
* auto-restored when the daemon restarts (see daemon/run.ts).
|
|
1124
|
+
*/
|
|
1121
1125
|
tunnelStart: async (params, context) => {
|
|
1122
1126
|
authorizeRequest(context, currentMetadata.sharing, "admin");
|
|
1123
1127
|
const tunnels = handlers.tunnels;
|
|
@@ -1127,15 +1131,32 @@ async function registerMachineService(server, machineId, metadata, daemonState,
|
|
|
1127
1131
|
const tunnel = new FrpcTunnel({
|
|
1128
1132
|
name: params.name,
|
|
1129
1133
|
ports: params.ports,
|
|
1134
|
+
group: params.group,
|
|
1135
|
+
groupKey: params.groupKey,
|
|
1136
|
+
healthCheckType: params.healthCheckType,
|
|
1137
|
+
healthCheckPath: params.healthCheckPath,
|
|
1138
|
+
healthCheckInterval: params.healthCheckInterval,
|
|
1130
1139
|
onError: (err) => console.error(`[FRPC] ${params.name}: ${err.message}`),
|
|
1131
1140
|
onConnect: () => console.log(`[FRPC] ${params.name}: connected`),
|
|
1132
1141
|
onDisconnect: () => console.log(`[FRPC] ${params.name}: disconnected, will auto-reconnect`)
|
|
1133
1142
|
});
|
|
1134
1143
|
await tunnel.connect();
|
|
1135
1144
|
tunnels.set(params.name, tunnel);
|
|
1136
|
-
|
|
1145
|
+
handlers.persistExposedTunnel?.({
|
|
1146
|
+
name: params.name,
|
|
1147
|
+
ports: params.ports,
|
|
1148
|
+
group: params.group,
|
|
1149
|
+
groupKey: params.groupKey,
|
|
1150
|
+
healthCheckType: params.healthCheckType,
|
|
1151
|
+
healthCheckPath: params.healthCheckPath,
|
|
1152
|
+
healthCheckInterval: params.healthCheckInterval,
|
|
1153
|
+
addedAt: Date.now()
|
|
1154
|
+
});
|
|
1155
|
+
const urls = {};
|
|
1156
|
+
for (const [port, url] of tunnel.getUrls()) urls[port] = url;
|
|
1157
|
+
return { ...tunnel.status, urls };
|
|
1137
1158
|
},
|
|
1138
|
-
/** Stop a tunnel. */
|
|
1159
|
+
/** Stop a tunnel and forget its persisted spec. */
|
|
1139
1160
|
tunnelStop: async (params, context) => {
|
|
1140
1161
|
authorizeRequest(context, currentMetadata.sharing, "admin");
|
|
1141
1162
|
const tunnels = handlers.tunnels;
|
|
@@ -1144,6 +1165,7 @@ async function registerMachineService(server, machineId, metadata, daemonState,
|
|
|
1144
1165
|
if (!client) throw new Error(`Tunnel '${params.name}' not found`);
|
|
1145
1166
|
client.destroy();
|
|
1146
1167
|
tunnels.delete(params.name);
|
|
1168
|
+
handlers.forgetExposedTunnel?.(params.name);
|
|
1147
1169
|
return { name: params.name, stopped: true };
|
|
1148
1170
|
},
|
|
1149
1171
|
/** List active tunnels with health status. */
|
|
@@ -7375,7 +7397,35 @@ async function startDaemon(options) {
|
|
|
7375
7397
|
const supervisor = new ProcessSupervisor(join(SVAMP_HOME, "processes"));
|
|
7376
7398
|
await supervisor.init();
|
|
7377
7399
|
const tunnels = /* @__PURE__ */ new Map();
|
|
7378
|
-
const
|
|
7400
|
+
const EXPOSED_TUNNELS_FILE = join(SVAMP_HOME, "exposed-tunnels.json");
|
|
7401
|
+
function loadExposedTunnels() {
|
|
7402
|
+
try {
|
|
7403
|
+
if (!existsSync$1(EXPOSED_TUNNELS_FILE)) return [];
|
|
7404
|
+
const raw = readFileSync$1(EXPOSED_TUNNELS_FILE, "utf-8");
|
|
7405
|
+
const parsed = JSON.parse(raw);
|
|
7406
|
+
return Array.isArray(parsed.tunnels) ? parsed.tunnels : [];
|
|
7407
|
+
} catch {
|
|
7408
|
+
return [];
|
|
7409
|
+
}
|
|
7410
|
+
}
|
|
7411
|
+
function saveExposedTunnels(specs) {
|
|
7412
|
+
try {
|
|
7413
|
+
mkdirSync(SVAMP_HOME, { recursive: true });
|
|
7414
|
+
writeFileSync(EXPOSED_TUNNELS_FILE, JSON.stringify({ tunnels: specs }, null, 2));
|
|
7415
|
+
} catch (err) {
|
|
7416
|
+
logger.log(`[exposed-tunnels] Persist failed: ${err.message}`);
|
|
7417
|
+
}
|
|
7418
|
+
}
|
|
7419
|
+
function persistExposedTunnel(spec) {
|
|
7420
|
+
const list = loadExposedTunnels().filter((t) => t.name !== spec.name);
|
|
7421
|
+
list.push(spec);
|
|
7422
|
+
saveExposedTunnels(list);
|
|
7423
|
+
}
|
|
7424
|
+
function forgetExposedTunnel(name) {
|
|
7425
|
+
const list = loadExposedTunnels().filter((t) => t.name !== name);
|
|
7426
|
+
saveExposedTunnels(list);
|
|
7427
|
+
}
|
|
7428
|
+
const { ServeManager } = await import('./serveManager-wSTZ4YwV.mjs');
|
|
7379
7429
|
const serveManager = new ServeManager(SVAMP_HOME, (msg) => logger.log(`[SERVE] ${msg}`), hyphaServerUrl);
|
|
7380
7430
|
ensureAutoInstalledSkills(logger).catch(() => {
|
|
7381
7431
|
});
|
|
@@ -8717,6 +8767,10 @@ The automated loop has finished. Review the progress above and let me know if yo
|
|
|
8717
8767
|
}
|
|
8718
8768
|
},
|
|
8719
8769
|
onMetadataUpdate: (newMeta) => {
|
|
8770
|
+
const oldTitle = sessionMetadata.summary?.text;
|
|
8771
|
+
const newTitle = newMeta.summary?.text;
|
|
8772
|
+
const oldLink = sessionMetadata.sessionLink;
|
|
8773
|
+
const newLink = newMeta.sessionLink;
|
|
8720
8774
|
const prevRalphLoop = sessionMetadata.ralphLoop;
|
|
8721
8775
|
sessionMetadata = {
|
|
8722
8776
|
...newMeta,
|
|
@@ -8732,6 +8786,18 @@ The automated loop has finished. Review the progress above and let me know if yo
|
|
|
8732
8786
|
// which would wipe the active loop state and cause the bar to disappear mid-run.
|
|
8733
8787
|
...prevRalphLoop ? { ralphLoop: prevRalphLoop } : {}
|
|
8734
8788
|
};
|
|
8789
|
+
const cfgPatch = {};
|
|
8790
|
+
if (newTitle !== oldTitle) cfgPatch.title = newTitle ?? null;
|
|
8791
|
+
if (newLink?.url !== oldLink?.url || newLink?.label !== oldLink?.label) {
|
|
8792
|
+
cfgPatch.session_link = newLink?.url ? { url: newLink.url, label: newLink.label || "View" } : null;
|
|
8793
|
+
}
|
|
8794
|
+
if (Object.keys(cfgPatch).length > 0) {
|
|
8795
|
+
try {
|
|
8796
|
+
writeSvampConfigPatch(cfgPatch);
|
|
8797
|
+
} catch (err) {
|
|
8798
|
+
logger.log(`[Session ${sessionId}] Failed to persist metadata patch: ${err.message}`);
|
|
8799
|
+
}
|
|
8800
|
+
}
|
|
8735
8801
|
if (prevRalphLoop && !newMeta.ralphLoop) {
|
|
8736
8802
|
sessionService.updateMetadata(sessionMetadata);
|
|
8737
8803
|
}
|
|
@@ -9185,6 +9251,10 @@ The automated loop has finished. Review the progress above and let me know if yo
|
|
|
9185
9251
|
}
|
|
9186
9252
|
},
|
|
9187
9253
|
onMetadataUpdate: (newMeta) => {
|
|
9254
|
+
const oldTitleAcp = sessionMetadata.summary?.text;
|
|
9255
|
+
const newTitleAcp = newMeta.summary?.text;
|
|
9256
|
+
const oldLinkAcp = sessionMetadata.sessionLink;
|
|
9257
|
+
const newLinkAcp = newMeta.sessionLink;
|
|
9188
9258
|
const prevRalphLoop = sessionMetadata.ralphLoop;
|
|
9189
9259
|
sessionMetadata = {
|
|
9190
9260
|
...newMeta,
|
|
@@ -9198,6 +9268,18 @@ The automated loop has finished. Review the progress above and let me know if yo
|
|
|
9198
9268
|
// which would wipe the active loop state and cause the bar to disappear mid-run.
|
|
9199
9269
|
...prevRalphLoop ? { ralphLoop: prevRalphLoop } : {}
|
|
9200
9270
|
};
|
|
9271
|
+
const cfgPatchAcp = {};
|
|
9272
|
+
if (newTitleAcp !== oldTitleAcp) cfgPatchAcp.title = newTitleAcp ?? null;
|
|
9273
|
+
if (newLinkAcp?.url !== oldLinkAcp?.url || newLinkAcp?.label !== oldLinkAcp?.label) {
|
|
9274
|
+
cfgPatchAcp.session_link = newLinkAcp?.url ? { url: newLinkAcp.url, label: newLinkAcp.label || "View" } : null;
|
|
9275
|
+
}
|
|
9276
|
+
if (Object.keys(cfgPatchAcp).length > 0) {
|
|
9277
|
+
try {
|
|
9278
|
+
writeSvampConfigPatchAcp(cfgPatchAcp);
|
|
9279
|
+
} catch (err) {
|
|
9280
|
+
logger.log(`[Session ${sessionId}] Failed to persist metadata patch: ${err.message}`);
|
|
9281
|
+
}
|
|
9282
|
+
}
|
|
9201
9283
|
if (prevRalphLoop && !newMeta.ralphLoop) {
|
|
9202
9284
|
sessionService.updateMetadata(sessionMetadata);
|
|
9203
9285
|
}
|
|
@@ -9719,10 +9801,41 @@ The automated loop has finished. Review the progress above and let me know if yo
|
|
|
9719
9801
|
supervisor,
|
|
9720
9802
|
tunnels,
|
|
9721
9803
|
serveManager,
|
|
9722
|
-
sharingNotificationSync
|
|
9804
|
+
sharingNotificationSync,
|
|
9805
|
+
persistExposedTunnel,
|
|
9806
|
+
forgetExposedTunnel
|
|
9723
9807
|
}
|
|
9724
9808
|
);
|
|
9725
9809
|
logger.log(`Machine service registered: svamp-machine-${machineId}`);
|
|
9810
|
+
(async () => {
|
|
9811
|
+
const specs = loadExposedTunnels();
|
|
9812
|
+
if (specs.length === 0) return;
|
|
9813
|
+
logger.log(`[exposed-tunnels] Restoring ${specs.length} tunnel(s) from ${EXPOSED_TUNNELS_FILE}`);
|
|
9814
|
+
const { FrpcTunnel } = await import('./frpc-j60b46eU.mjs');
|
|
9815
|
+
for (const spec of specs) {
|
|
9816
|
+
if (tunnels.has(spec.name)) continue;
|
|
9817
|
+
try {
|
|
9818
|
+
const tunnel = new FrpcTunnel({
|
|
9819
|
+
name: spec.name,
|
|
9820
|
+
ports: spec.ports,
|
|
9821
|
+
group: spec.group,
|
|
9822
|
+
groupKey: spec.groupKey,
|
|
9823
|
+
healthCheckType: spec.healthCheckType,
|
|
9824
|
+
healthCheckPath: spec.healthCheckPath,
|
|
9825
|
+
healthCheckInterval: spec.healthCheckInterval,
|
|
9826
|
+
onError: (err) => logger.log(`[FRPC ${spec.name}] ${err.message}`),
|
|
9827
|
+
onConnect: () => logger.log(`[FRPC ${spec.name}] connected (restored)`),
|
|
9828
|
+
onDisconnect: () => logger.log(`[FRPC ${spec.name}] disconnected, will auto-reconnect`)
|
|
9829
|
+
});
|
|
9830
|
+
await tunnel.connect();
|
|
9831
|
+
tunnels.set(spec.name, tunnel);
|
|
9832
|
+
logger.log(`[exposed-tunnels] Restored: ${spec.name} \u2192 ports ${spec.ports.join(",")}`);
|
|
9833
|
+
} catch (err) {
|
|
9834
|
+
logger.log(`[exposed-tunnels] Failed to restore ${spec.name}: ${err.message}`);
|
|
9835
|
+
}
|
|
9836
|
+
}
|
|
9837
|
+
})().catch(() => {
|
|
9838
|
+
});
|
|
9726
9839
|
if (seededSharing?.enabled) {
|
|
9727
9840
|
const shareUrl = buildMachineShareUrl({
|
|
9728
9841
|
machineId,
|
|
@@ -54,7 +54,7 @@ async function handleServeCommand() {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
async function serveAdd(args, machineId) {
|
|
57
|
-
const { connectAndGetMachine } = await import('./commands-
|
|
57
|
+
const { connectAndGetMachine } = await import('./commands-iYxal2yb.mjs');
|
|
58
58
|
const pos = positionalArgs(args);
|
|
59
59
|
const name = pos[0];
|
|
60
60
|
if (!name) {
|
|
@@ -86,7 +86,7 @@ async function serveAdd(args, machineId) {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
async function serveApply(args, machineId) {
|
|
89
|
-
const { connectAndGetMachine } = await import('./commands-
|
|
89
|
+
const { connectAndGetMachine } = await import('./commands-iYxal2yb.mjs');
|
|
90
90
|
const fs = await import('fs');
|
|
91
91
|
const yaml = await import('yaml');
|
|
92
92
|
const file = positionalArgs(args)[0];
|
|
@@ -171,7 +171,7 @@ async function serveApply(args, machineId) {
|
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
async function serveRemove(args, machineId) {
|
|
174
|
-
const { connectAndGetMachine } = await import('./commands-
|
|
174
|
+
const { connectAndGetMachine } = await import('./commands-iYxal2yb.mjs');
|
|
175
175
|
const pos = positionalArgs(args);
|
|
176
176
|
const name = pos[0];
|
|
177
177
|
if (!name) {
|
|
@@ -191,7 +191,7 @@ async function serveRemove(args, machineId) {
|
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
async function serveList(args, machineId) {
|
|
194
|
-
const { connectAndGetMachine } = await import('./commands-
|
|
194
|
+
const { connectAndGetMachine } = await import('./commands-iYxal2yb.mjs');
|
|
195
195
|
const all = hasFlag(args, "--all", "-a");
|
|
196
196
|
const json = hasFlag(args, "--json");
|
|
197
197
|
const sessionId = getFlag(args, "--session");
|
|
@@ -224,7 +224,7 @@ async function serveList(args, machineId) {
|
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
async function serveInfo(machineId) {
|
|
227
|
-
const { connectAndGetMachine } = await import('./commands-
|
|
227
|
+
const { connectAndGetMachine } = await import('./commands-iYxal2yb.mjs');
|
|
228
228
|
const { machine, server } = await connectAndGetMachine(machineId);
|
|
229
229
|
try {
|
|
230
230
|
const info = await machine.serveInfo();
|
|
@@ -3,7 +3,7 @@ import * as fs from 'fs';
|
|
|
3
3
|
import * as http from 'http';
|
|
4
4
|
import * as net from 'net';
|
|
5
5
|
import * as path from 'path';
|
|
6
|
-
import { S as ServeAuth, h as hasCookieToken } from './run-
|
|
6
|
+
import { S as ServeAuth, h as hasCookieToken } from './run-FTguq4Qt.mjs';
|
|
7
7
|
import 'os';
|
|
8
8
|
import 'fs/promises';
|
|
9
9
|
import 'url';
|