svamp-cli 0.2.70 → 0.2.71
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-BaQIO1T2.mjs → agentCommands-COEbsMuw.mjs} +2 -2
- package/dist/cli.mjs +34 -34
- package/dist/{commands-BMOelGYC.mjs → commands-B0zqVia0.mjs} +7 -3
- package/dist/{commands-CdGLuwtQ.mjs → commands-Cc8AE2jl.mjs} +3 -3
- package/dist/{commands-CB03m9-Z.mjs → commands-Kztc20Nx.mjs} +2 -2
- package/dist/index.mjs +1 -1
- package/dist/{package-Cw40xKCx.mjs → package-CDSBvCp_.mjs} +1 -1
- package/dist/{run-Di-48dsY.mjs → run-B_bKTQ8M.mjs} +1 -1
- package/dist/{run-BqAe7GgA.mjs → run-h-QVSVFd.mjs} +47 -28
- package/dist/{serveCommands-DpKi_PuD.mjs → serveCommands-CM17DByZ.mjs} +5 -5
- package/dist/{serveManager-Dy4afaLH.mjs → serveManager-Bzjw2bO6.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-B0zqVia0.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-B0zqVia0.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-h-QVSVFd.mjs';
|
|
2
2
|
import 'os';
|
|
3
3
|
import 'fs/promises';
|
|
4
4
|
import 'fs';
|
|
@@ -44,7 +44,7 @@ async function main() {
|
|
|
44
44
|
console.error(`svamp daemon restart: ${err.message || err}`);
|
|
45
45
|
process.exit(1);
|
|
46
46
|
}
|
|
47
|
-
const { restartDaemon } = await import('./run-
|
|
47
|
+
const { restartDaemon } = await import('./run-h-QVSVFd.mjs').then(function (n) { return n.u; });
|
|
48
48
|
await restartDaemon();
|
|
49
49
|
process.exit(0);
|
|
50
50
|
}
|
|
@@ -280,7 +280,7 @@ async function main() {
|
|
|
280
280
|
console.error("svamp service: Service commands are not available in sandboxed sessions.");
|
|
281
281
|
process.exit(1);
|
|
282
282
|
}
|
|
283
|
-
const { handleServiceCommand } = await import('./commands-
|
|
283
|
+
const { handleServiceCommand } = await import('./commands-Cc8AE2jl.mjs');
|
|
284
284
|
await handleServiceCommand();
|
|
285
285
|
} else if (subcommand === "serve") {
|
|
286
286
|
const { isSandboxed: isSandboxedServe } = await import('./sandboxDetect-DNTcbgWD.mjs');
|
|
@@ -288,7 +288,7 @@ async function main() {
|
|
|
288
288
|
console.error("svamp serve: Serve commands are not available in sandboxed sessions.");
|
|
289
289
|
process.exit(1);
|
|
290
290
|
}
|
|
291
|
-
const { handleServeCommand } = await import('./serveCommands-
|
|
291
|
+
const { handleServeCommand } = await import('./serveCommands-CM17DByZ.mjs');
|
|
292
292
|
await handleServeCommand();
|
|
293
293
|
process.exit(0);
|
|
294
294
|
} else if (subcommand === "process" || subcommand === "proc") {
|
|
@@ -297,7 +297,7 @@ async function main() {
|
|
|
297
297
|
console.error("svamp process: Process commands are not available in sandboxed sessions.");
|
|
298
298
|
process.exit(1);
|
|
299
299
|
}
|
|
300
|
-
const { processCommand } = await import('./commands-
|
|
300
|
+
const { processCommand } = await import('./commands-Kztc20Nx.mjs');
|
|
301
301
|
let machineId;
|
|
302
302
|
const processArgs = args.slice(1);
|
|
303
303
|
const mIdx = processArgs.findIndex((a) => a === "--machine" || a === "-m");
|
|
@@ -315,7 +315,7 @@ async function main() {
|
|
|
315
315
|
} else if (!subcommand || subcommand === "start") {
|
|
316
316
|
await handleInteractiveCommand();
|
|
317
317
|
} else if (subcommand === "--version" || subcommand === "-v") {
|
|
318
|
-
const pkg = await import('./package-
|
|
318
|
+
const pkg = await import('./package-CDSBvCp_.mjs').catch(() => ({ default: { version: "unknown" } }));
|
|
319
319
|
console.log(`svamp version: ${pkg.default.version}`);
|
|
320
320
|
} else {
|
|
321
321
|
console.error(`Unknown command: ${subcommand}`);
|
|
@@ -324,7 +324,7 @@ async function main() {
|
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
326
|
async function handleInteractiveCommand() {
|
|
327
|
-
const { runInteractive } = await import('./run-
|
|
327
|
+
const { runInteractive } = await import('./run-B_bKTQ8M.mjs');
|
|
328
328
|
const interactiveArgs = subcommand === "start" ? args.slice(1) : args;
|
|
329
329
|
let directory = process.cwd();
|
|
330
330
|
let resumeSessionId;
|
|
@@ -369,7 +369,7 @@ async function handleAgentCommand() {
|
|
|
369
369
|
return;
|
|
370
370
|
}
|
|
371
371
|
if (agentArgs[0] === "list") {
|
|
372
|
-
const { KNOWN_ACP_AGENTS, KNOWN_MCP_AGENTS: KNOWN_MCP_AGENTS2 } = await import('./run-
|
|
372
|
+
const { KNOWN_ACP_AGENTS, KNOWN_MCP_AGENTS: KNOWN_MCP_AGENTS2 } = await import('./run-h-QVSVFd.mjs').then(function (n) { return n.p; });
|
|
373
373
|
console.log("Known agents:");
|
|
374
374
|
for (const [name, config2] of Object.entries(KNOWN_ACP_AGENTS)) {
|
|
375
375
|
console.log(` ${name.padEnd(12)} ${config2.command} ${config2.args.join(" ")} (ACP)`);
|
|
@@ -381,7 +381,7 @@ async function handleAgentCommand() {
|
|
|
381
381
|
console.log('Use "svamp agent -- <command> [args]" for a custom ACP agent.');
|
|
382
382
|
return;
|
|
383
383
|
}
|
|
384
|
-
const { resolveAcpAgentConfig, KNOWN_MCP_AGENTS } = await import('./run-
|
|
384
|
+
const { resolveAcpAgentConfig, KNOWN_MCP_AGENTS } = await import('./run-h-QVSVFd.mjs').then(function (n) { return n.p; });
|
|
385
385
|
let cwd = process.cwd();
|
|
386
386
|
const filteredArgs = [];
|
|
387
387
|
for (let i = 0; i < agentArgs.length; i++) {
|
|
@@ -405,12 +405,12 @@ async function handleAgentCommand() {
|
|
|
405
405
|
console.log(`Starting ${config.agentName} agent in ${cwd}...`);
|
|
406
406
|
let backend;
|
|
407
407
|
if (KNOWN_MCP_AGENTS[config.agentName]) {
|
|
408
|
-
const { CodexMcpBackend } = await import('./run-
|
|
408
|
+
const { CodexMcpBackend } = await import('./run-h-QVSVFd.mjs').then(function (n) { return n.q; });
|
|
409
409
|
backend = new CodexMcpBackend({ cwd, log: logFn });
|
|
410
410
|
} else {
|
|
411
|
-
const { AcpBackend } = await import('./run-
|
|
412
|
-
const { GeminiTransport } = await import('./run-
|
|
413
|
-
const { DefaultTransport } = await import('./run-
|
|
411
|
+
const { AcpBackend } = await import('./run-h-QVSVFd.mjs').then(function (n) { return n.o; });
|
|
412
|
+
const { GeminiTransport } = await import('./run-h-QVSVFd.mjs').then(function (n) { return n.G; });
|
|
413
|
+
const { DefaultTransport } = await import('./run-h-QVSVFd.mjs').then(function (n) { return n.D; });
|
|
414
414
|
const transportHandler = config.agentName === "gemini" ? new GeminiTransport() : new DefaultTransport(config.agentName);
|
|
415
415
|
backend = new AcpBackend({
|
|
416
416
|
agentName: config.agentName,
|
|
@@ -537,7 +537,7 @@ async function handleSessionCommand() {
|
|
|
537
537
|
process.exit(1);
|
|
538
538
|
}
|
|
539
539
|
}
|
|
540
|
-
const { sessionList, sessionSpawn, sessionArchive, sessionResume, sessionDelete, sessionInfo, sessionMessages, sessionAttach, sessionMachines, sessionSend, sessionWait, sessionShare, sessionRalphStart, sessionRalphCancel, sessionRalphStatus, sessionInboxSend, sessionInboxList, sessionInboxRead, sessionInboxReply, sessionInboxClear } = await import('./commands-
|
|
540
|
+
const { sessionList, sessionSpawn, sessionArchive, sessionResume, sessionDelete, sessionInfo, sessionMessages, sessionAttach, sessionMachines, sessionSend, sessionWait, sessionShare, sessionRalphStart, sessionRalphCancel, sessionRalphStatus, sessionInboxSend, sessionInboxList, sessionInboxRead, sessionInboxReply, sessionInboxClear } = await import('./commands-B0zqVia0.mjs');
|
|
541
541
|
const parseFlagStr = (flag, shortFlag) => {
|
|
542
542
|
for (let i = 1; i < sessionArgs.length; i++) {
|
|
543
543
|
if ((sessionArgs[i] === flag || shortFlag) && i + 1 < sessionArgs.length) {
|
|
@@ -603,7 +603,7 @@ async function handleSessionCommand() {
|
|
|
603
603
|
allowDomain.push(sessionArgs[++i]);
|
|
604
604
|
}
|
|
605
605
|
}
|
|
606
|
-
const { parseShareArg } = await import('./commands-
|
|
606
|
+
const { parseShareArg } = await import('./commands-B0zqVia0.mjs');
|
|
607
607
|
const shareEntries = share.map((s) => parseShareArg(s));
|
|
608
608
|
await sessionSpawn(agent, dir, targetMachineId, {
|
|
609
609
|
message,
|
|
@@ -687,7 +687,7 @@ async function handleSessionCommand() {
|
|
|
687
687
|
console.error(" Spawns a stateless Claude session in <directory>, sends <prompt>, prints the answer, then deletes the session.");
|
|
688
688
|
process.exit(1);
|
|
689
689
|
}
|
|
690
|
-
const { sessionQuery } = await import('./commands-
|
|
690
|
+
const { sessionQuery } = await import('./commands-B0zqVia0.mjs');
|
|
691
691
|
await sessionQuery(dir, prompt, targetMachineId, {
|
|
692
692
|
timeout: parseFlagInt("--timeout"),
|
|
693
693
|
json: hasFlag("--json"),
|
|
@@ -720,7 +720,7 @@ async function handleSessionCommand() {
|
|
|
720
720
|
console.error("Usage: svamp session approve <session-id> [request-id] [--json]");
|
|
721
721
|
process.exit(1);
|
|
722
722
|
}
|
|
723
|
-
const { sessionApprove } = await import('./commands-
|
|
723
|
+
const { sessionApprove } = await import('./commands-B0zqVia0.mjs');
|
|
724
724
|
const approveReqId = sessionArgs[2] && !sessionArgs[2].startsWith("--") ? sessionArgs[2] : void 0;
|
|
725
725
|
await sessionApprove(sessionArgs[1], approveReqId, targetMachineId, {
|
|
726
726
|
json: hasFlag("--json")
|
|
@@ -730,7 +730,7 @@ async function handleSessionCommand() {
|
|
|
730
730
|
console.error("Usage: svamp session deny <session-id> [request-id] [--json]");
|
|
731
731
|
process.exit(1);
|
|
732
732
|
}
|
|
733
|
-
const { sessionDeny } = await import('./commands-
|
|
733
|
+
const { sessionDeny } = await import('./commands-B0zqVia0.mjs');
|
|
734
734
|
const denyReqId = sessionArgs[2] && !sessionArgs[2].startsWith("--") ? sessionArgs[2] : void 0;
|
|
735
735
|
await sessionDeny(sessionArgs[1], denyReqId, targetMachineId, {
|
|
736
736
|
json: hasFlag("--json")
|
|
@@ -766,7 +766,7 @@ async function handleSessionCommand() {
|
|
|
766
766
|
console.error("Usage: svamp session set-title <title>");
|
|
767
767
|
process.exit(1);
|
|
768
768
|
}
|
|
769
|
-
const { sessionSetTitle } = await import('./agentCommands-
|
|
769
|
+
const { sessionSetTitle } = await import('./agentCommands-COEbsMuw.mjs');
|
|
770
770
|
await sessionSetTitle(title);
|
|
771
771
|
} else if (sessionSubcommand === "set-link") {
|
|
772
772
|
const url = sessionArgs[1];
|
|
@@ -775,7 +775,7 @@ async function handleSessionCommand() {
|
|
|
775
775
|
process.exit(1);
|
|
776
776
|
}
|
|
777
777
|
const label = sessionArgs[2] && !sessionArgs[2].startsWith("--") ? sessionArgs[2] : void 0;
|
|
778
|
-
const { sessionSetLink } = await import('./agentCommands-
|
|
778
|
+
const { sessionSetLink } = await import('./agentCommands-COEbsMuw.mjs');
|
|
779
779
|
await sessionSetLink(url, label);
|
|
780
780
|
} else if (sessionSubcommand === "notify") {
|
|
781
781
|
const message = sessionArgs[1];
|
|
@@ -784,7 +784,7 @@ async function handleSessionCommand() {
|
|
|
784
784
|
process.exit(1);
|
|
785
785
|
}
|
|
786
786
|
const level = parseFlagStr("--level") || "info";
|
|
787
|
-
const { sessionNotify } = await import('./agentCommands-
|
|
787
|
+
const { sessionNotify } = await import('./agentCommands-COEbsMuw.mjs');
|
|
788
788
|
await sessionNotify(message, level);
|
|
789
789
|
} else if (sessionSubcommand === "broadcast") {
|
|
790
790
|
const action = sessionArgs[1];
|
|
@@ -792,7 +792,7 @@ async function handleSessionCommand() {
|
|
|
792
792
|
console.error("Usage: svamp session broadcast <action> [args...]\nActions: open-canvas <url> [label], close-canvas, toast <message>");
|
|
793
793
|
process.exit(1);
|
|
794
794
|
}
|
|
795
|
-
const { sessionBroadcast } = await import('./agentCommands-
|
|
795
|
+
const { sessionBroadcast } = await import('./agentCommands-COEbsMuw.mjs');
|
|
796
796
|
await sessionBroadcast(action, sessionArgs.slice(2).filter((a) => !a.startsWith("--")));
|
|
797
797
|
} else if (sessionSubcommand === "inbox") {
|
|
798
798
|
const inboxSubcmd = sessionArgs[1];
|
|
@@ -803,7 +803,7 @@ async function handleSessionCommand() {
|
|
|
803
803
|
process.exit(1);
|
|
804
804
|
}
|
|
805
805
|
if (agentSessionId) {
|
|
806
|
-
const { inboxSend } = await import('./agentCommands-
|
|
806
|
+
const { inboxSend } = await import('./agentCommands-COEbsMuw.mjs');
|
|
807
807
|
await inboxSend(sessionArgs[2], {
|
|
808
808
|
body: sessionArgs[3],
|
|
809
809
|
subject: parseFlagStr("--subject"),
|
|
@@ -818,7 +818,7 @@ async function handleSessionCommand() {
|
|
|
818
818
|
}
|
|
819
819
|
} else if (inboxSubcmd === "list" || inboxSubcmd === "ls") {
|
|
820
820
|
if (agentSessionId && !sessionArgs[2]) {
|
|
821
|
-
const { inboxList } = await import('./agentCommands-
|
|
821
|
+
const { inboxList } = await import('./agentCommands-COEbsMuw.mjs');
|
|
822
822
|
await inboxList({
|
|
823
823
|
unread: hasFlag("--unread"),
|
|
824
824
|
limit: parseFlagInt("--limit"),
|
|
@@ -840,7 +840,7 @@ async function handleSessionCommand() {
|
|
|
840
840
|
process.exit(1);
|
|
841
841
|
}
|
|
842
842
|
if (agentSessionId && !sessionArgs[3]) {
|
|
843
|
-
const { inboxList } = await import('./agentCommands-
|
|
843
|
+
const { inboxList } = await import('./agentCommands-COEbsMuw.mjs');
|
|
844
844
|
await sessionInboxRead(agentSessionId, sessionArgs[2], targetMachineId);
|
|
845
845
|
} else if (sessionArgs[3]) {
|
|
846
846
|
await sessionInboxRead(sessionArgs[2], sessionArgs[3], targetMachineId);
|
|
@@ -850,7 +850,7 @@ async function handleSessionCommand() {
|
|
|
850
850
|
}
|
|
851
851
|
} else if (inboxSubcmd === "reply") {
|
|
852
852
|
if (agentSessionId && sessionArgs[2] && sessionArgs[3] && !sessionArgs[4]) {
|
|
853
|
-
const { inboxReply } = await import('./agentCommands-
|
|
853
|
+
const { inboxReply } = await import('./agentCommands-COEbsMuw.mjs');
|
|
854
854
|
await inboxReply(sessionArgs[2], sessionArgs[3]);
|
|
855
855
|
} else if (sessionArgs[2] && sessionArgs[3] && sessionArgs[4]) {
|
|
856
856
|
await sessionInboxReply(sessionArgs[2], sessionArgs[3], sessionArgs[4], targetMachineId);
|
|
@@ -886,7 +886,7 @@ async function handleMachineCommand() {
|
|
|
886
886
|
return;
|
|
887
887
|
}
|
|
888
888
|
if (machineSubcommand === "share") {
|
|
889
|
-
const { machineShare } = await import('./commands-
|
|
889
|
+
const { machineShare } = await import('./commands-B0zqVia0.mjs');
|
|
890
890
|
let machineId;
|
|
891
891
|
const shareArgs = [];
|
|
892
892
|
for (let i = 1; i < machineArgs.length; i++) {
|
|
@@ -916,7 +916,7 @@ async function handleMachineCommand() {
|
|
|
916
916
|
}
|
|
917
917
|
await machineShare(machineId, { add, remove, list, configPath, showConfig });
|
|
918
918
|
} else if (machineSubcommand === "exec") {
|
|
919
|
-
const { machineExec } = await import('./commands-
|
|
919
|
+
const { machineExec } = await import('./commands-B0zqVia0.mjs');
|
|
920
920
|
let machineId;
|
|
921
921
|
let cwd;
|
|
922
922
|
const cmdParts = [];
|
|
@@ -936,7 +936,7 @@ async function handleMachineCommand() {
|
|
|
936
936
|
}
|
|
937
937
|
await machineExec(machineId, command, cwd);
|
|
938
938
|
} else if (machineSubcommand === "info") {
|
|
939
|
-
const { machineInfo } = await import('./commands-
|
|
939
|
+
const { machineInfo } = await import('./commands-B0zqVia0.mjs');
|
|
940
940
|
let machineId;
|
|
941
941
|
for (let i = 1; i < machineArgs.length; i++) {
|
|
942
942
|
if ((machineArgs[i] === "--machine" || machineArgs[i] === "-m") && i + 1 < machineArgs.length) {
|
|
@@ -956,10 +956,10 @@ async function handleMachineCommand() {
|
|
|
956
956
|
level = machineArgs[++i];
|
|
957
957
|
}
|
|
958
958
|
}
|
|
959
|
-
const { machineNotify } = await import('./agentCommands-
|
|
959
|
+
const { machineNotify } = await import('./agentCommands-COEbsMuw.mjs');
|
|
960
960
|
await machineNotify(message, level);
|
|
961
961
|
} else if (machineSubcommand === "ls") {
|
|
962
|
-
const { machineLs } = await import('./commands-
|
|
962
|
+
const { machineLs } = await import('./commands-B0zqVia0.mjs');
|
|
963
963
|
let machineId;
|
|
964
964
|
let showHidden = false;
|
|
965
965
|
let path;
|
|
@@ -1429,7 +1429,7 @@ async function applyClaudeAuthFlags(argv) {
|
|
|
1429
1429
|
"--use-hypha-proxy, --use-claude-login, and --anthropic-base-url/--anthropic-api-key are mutually exclusive"
|
|
1430
1430
|
);
|
|
1431
1431
|
}
|
|
1432
|
-
const mod = await import('./run-
|
|
1432
|
+
const mod = await import('./run-h-QVSVFd.mjs').then(function (n) { return n.t; });
|
|
1433
1433
|
if (hasHypha) {
|
|
1434
1434
|
mod.setClaudeAuthHyphaProxy();
|
|
1435
1435
|
console.log("Claude auth configured: hypha-proxy (uses HYPHA_TOKEN live at each spawn).");
|
|
@@ -1467,7 +1467,7 @@ async function applyDaemonShareFlag(argv) {
|
|
|
1467
1467
|
}
|
|
1468
1468
|
}
|
|
1469
1469
|
if (collected.length === 0) return;
|
|
1470
|
-
const { updateEnvFile } = await import('./run-
|
|
1470
|
+
const { updateEnvFile } = await import('./run-h-QVSVFd.mjs').then(function (n) { return n.t; });
|
|
1471
1471
|
const seen = /* @__PURE__ */ new Set();
|
|
1472
1472
|
const deduped = collected.filter((e) => {
|
|
1473
1473
|
const k = e.toLowerCase();
|
|
@@ -1480,7 +1480,7 @@ async function applyDaemonShareFlag(argv) {
|
|
|
1480
1480
|
}
|
|
1481
1481
|
async function handleDaemonAuthCommand(argv) {
|
|
1482
1482
|
const sub = (argv[0] || "status").toLowerCase();
|
|
1483
|
-
const mod = await import('./run-
|
|
1483
|
+
const mod = await import('./run-h-QVSVFd.mjs').then(function (n) { return n.t; });
|
|
1484
1484
|
if (sub === "--help" || sub === "-h" || sub === "help") {
|
|
1485
1485
|
console.log(`
|
|
1486
1486
|
svamp daemon auth \u2014 Configure how Claude subprocesses authenticate
|
|
@@ -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-h-QVSVFd.mjs';
|
|
6
6
|
import 'os';
|
|
7
7
|
import 'fs/promises';
|
|
8
8
|
import 'fs';
|
|
@@ -1464,12 +1464,14 @@ async function sendCore(machine, fullId, message, opts) {
|
|
|
1464
1464
|
}
|
|
1465
1465
|
const preSeq = wantResponse ? await snapshotLatestSeq(machine, fullId) : 0;
|
|
1466
1466
|
const { randomUUID } = await import('node:crypto');
|
|
1467
|
+
const callerSessionId = process.env.SVAMP_SESSION_ID;
|
|
1467
1468
|
const inboxMessage = {
|
|
1468
1469
|
messageId: randomUUID(),
|
|
1469
1470
|
body: message,
|
|
1470
1471
|
timestamp: Date.now(),
|
|
1471
1472
|
read: false,
|
|
1472
|
-
from: `cli:${os.userInfo().username}`,
|
|
1473
|
+
from: callerSessionId ? `agent:${callerSessionId}` : `cli:${os.userInfo().username}`,
|
|
1474
|
+
...callerSessionId ? { fromSession: callerSessionId } : {},
|
|
1473
1475
|
to: fullId,
|
|
1474
1476
|
subject: opts?.subject,
|
|
1475
1477
|
urgency: opts?.urgency || "urgent"
|
|
@@ -2100,12 +2102,14 @@ async function sessionInboxSend(sessionIdPartial, body, machineId, opts) {
|
|
|
2100
2102
|
const { server, machine, fullId } = await connectAndResolveSession(sessionIdPartial, machineId);
|
|
2101
2103
|
try {
|
|
2102
2104
|
const { randomUUID } = await import('node:crypto');
|
|
2105
|
+
const callerSessionId = process.env.SVAMP_SESSION_ID;
|
|
2103
2106
|
const message = {
|
|
2104
2107
|
messageId: randomUUID(),
|
|
2105
2108
|
body,
|
|
2106
2109
|
timestamp: Date.now(),
|
|
2107
2110
|
read: false,
|
|
2108
|
-
from: `cli:${os.userInfo().username}`,
|
|
2111
|
+
from: callerSessionId ? `agent:${callerSessionId}` : `cli:${os.userInfo().username}`,
|
|
2112
|
+
...callerSessionId ? { fromSession: callerSessionId } : {},
|
|
2109
2113
|
to: fullId,
|
|
2110
2114
|
subject: opts?.subject,
|
|
2111
2115
|
urgency: opts?.urgency || "normal",
|
|
@@ -68,7 +68,7 @@ async function serviceExpose(args) {
|
|
|
68
68
|
});
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
|
-
const { connectAndGetMachine } = await import('./commands-
|
|
71
|
+
const { connectAndGetMachine } = await import('./commands-B0zqVia0.mjs');
|
|
72
72
|
const { server, machine } = await connectAndGetMachine();
|
|
73
73
|
try {
|
|
74
74
|
const status = await machine.tunnelStart({
|
|
@@ -132,7 +132,7 @@ async function serviceServe(args) {
|
|
|
132
132
|
}
|
|
133
133
|
async function serviceList(_args) {
|
|
134
134
|
try {
|
|
135
|
-
const { connectAndGetMachine } = await import('./commands-
|
|
135
|
+
const { connectAndGetMachine } = await import('./commands-B0zqVia0.mjs');
|
|
136
136
|
const { server, machine } = await connectAndGetMachine();
|
|
137
137
|
try {
|
|
138
138
|
const tunnels = await machine.tunnelList({});
|
|
@@ -161,7 +161,7 @@ async function serviceDelete(args) {
|
|
|
161
161
|
process.exit(1);
|
|
162
162
|
}
|
|
163
163
|
try {
|
|
164
|
-
const { connectAndGetMachine } = await import('./commands-
|
|
164
|
+
const { connectAndGetMachine } = await import('./commands-B0zqVia0.mjs');
|
|
165
165
|
const { server, machine } = await connectAndGetMachine();
|
|
166
166
|
try {
|
|
167
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-B0zqVia0.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-h-QVSVFd.mjs';
|
|
9
9
|
import 'os';
|
|
10
10
|
import 'fs/promises';
|
|
11
11
|
import 'url';
|
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-h-QVSVFd.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-h-QVSVFd.mjs';
|
|
6
6
|
import { createServer } from 'node:http';
|
|
7
7
|
import { spawn } from 'node:child_process';
|
|
8
8
|
import { createInterface } from 'node:readline';
|
|
@@ -1597,7 +1597,7 @@ async function registerMachineService(server, machineId, metadata, daemonState,
|
|
|
1597
1597
|
}
|
|
1598
1598
|
|
|
1599
1599
|
function isStructuredMessage(msg) {
|
|
1600
|
-
return !!(msg.from
|
|
1600
|
+
return !!(msg.from || msg.fromSession || msg.subject || msg.replyTo || msg.threadId);
|
|
1601
1601
|
}
|
|
1602
1602
|
function escapeXml(s) {
|
|
1603
1603
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
@@ -5703,10 +5703,16 @@ class ServeAuth {
|
|
|
5703
5703
|
return access.some((e) => e.toLowerCase() === email.toLowerCase());
|
|
5704
5704
|
}
|
|
5705
5705
|
/**
|
|
5706
|
-
* Generate the login page HTML.
|
|
5707
|
-
*
|
|
5708
|
-
*
|
|
5709
|
-
*
|
|
5706
|
+
* Generate the login page HTML.
|
|
5707
|
+
*
|
|
5708
|
+
* Uses the Hypha-Login HTTP endpoints directly (no SDK / no WebSocket):
|
|
5709
|
+
* 1. GET /public/services/hypha-login/start → { login_url, key }
|
|
5710
|
+
* 2. open popup to login_url so the user signs in
|
|
5711
|
+
* 3. GET /public/services/hypha-login/check?key=… → token (long-polled)
|
|
5712
|
+
*
|
|
5713
|
+
* This matches the proven pattern in svamp-app/.../share/[id].tsx and
|
|
5714
|
+
* removes a class of hangs we previously saw when the JS SDK never
|
|
5715
|
+
* invoked its `login_callback` (button-stuck-after-click symptom).
|
|
5710
5716
|
*/
|
|
5711
5717
|
getLoginPageHtml(redirectUrl) {
|
|
5712
5718
|
return `<!DOCTYPE html>
|
|
@@ -5729,7 +5735,6 @@ button:disabled{background:#94d3a2;cursor:wait}
|
|
|
5729
5735
|
a{color:#0969da;text-decoration:none}
|
|
5730
5736
|
a:hover{text-decoration:underline}
|
|
5731
5737
|
</style>
|
|
5732
|
-
<script src="https://cdn.jsdelivr.net/npm/hypha-rpc@0.21.28/dist/hypha-rpc-websocket.min.js"><\/script>
|
|
5733
5738
|
</head><body>
|
|
5734
5739
|
<div class="card">
|
|
5735
5740
|
<h1>Sign in required</h1>
|
|
@@ -5751,17 +5756,10 @@ function setError(msg) {
|
|
|
5751
5756
|
}
|
|
5752
5757
|
|
|
5753
5758
|
btn.addEventListener('click', async () => {
|
|
5754
|
-
if (typeof hyphaWebsocketClient === 'undefined' || !hyphaWebsocketClient.login) {
|
|
5755
|
-
setError('Hypha SDK failed to load. Check your network connection and retry.');
|
|
5756
|
-
return;
|
|
5757
|
-
}
|
|
5758
|
-
|
|
5759
5759
|
// Open the popup SYNCHRONOUSLY inside the click handler so the browser's
|
|
5760
|
-
// popup blocker treats it as user-initiated. The
|
|
5761
|
-
//
|
|
5762
|
-
//
|
|
5763
|
-
// blocked \u2014 especially inside sandboxed iframes (canvas, artifact view).
|
|
5764
|
-
// We point it at about:blank first and rewrite the URL once we have it.
|
|
5760
|
+
// popup blocker treats it as user-initiated. The HTTP request below is
|
|
5761
|
+
// awaited, by which time the user-gesture flag has cleared and any
|
|
5762
|
+
// window.open() call would be silently blocked.
|
|
5765
5763
|
const popup = window.open('about:blank', '_blank');
|
|
5766
5764
|
if (!popup) {
|
|
5767
5765
|
setError('Popup was blocked by the browser. Please allow popups for this site and retry.');
|
|
@@ -5770,21 +5768,42 @@ btn.addEventListener('click', async () => {
|
|
|
5770
5768
|
try { popup.document.write('<html><body style="font-family:system-ui;padding:24px;color:#656d76">Opening Hypha sign-in\u2026</body></html>'); } catch (e) {}
|
|
5771
5769
|
|
|
5772
5770
|
btn.disabled = true;
|
|
5773
|
-
statusEl.textContent = '
|
|
5771
|
+
statusEl.textContent = 'Contacting Hypha\u2026';
|
|
5774
5772
|
|
|
5775
5773
|
try {
|
|
5776
|
-
|
|
5777
|
-
|
|
5778
|
-
|
|
5779
|
-
|
|
5780
|
-
|
|
5781
|
-
|
|
5782
|
-
|
|
5783
|
-
|
|
5774
|
+
// 1. Ask the Hypha-Login service for a login URL + polling key.
|
|
5775
|
+
const startResp = await fetch(hyphaServer + '/public/services/hypha-login/start');
|
|
5776
|
+
if (!startResp.ok) throw new Error('Login start failed: HTTP ' + startResp.status);
|
|
5777
|
+
const ctx = await startResp.json();
|
|
5778
|
+
if (!ctx || !ctx.login_url || !ctx.key) throw new Error('Login start returned no URL/key');
|
|
5779
|
+
|
|
5780
|
+
// 2. Redirect the popup to the actual login UI.
|
|
5781
|
+
statusEl.textContent = 'Waiting for you to sign in\u2026';
|
|
5782
|
+
try { popup.location.href = ctx.login_url; }
|
|
5783
|
+
catch (e) { window.open(ctx.login_url, '_blank'); }
|
|
5784
|
+
|
|
5785
|
+
// 3. Long-poll the check endpoint until the user finishes signing in.
|
|
5786
|
+
// Each request waits up to 3 s server-side; we retry for ~3 minutes total.
|
|
5787
|
+
const checkBase = ctx.check_url || (hyphaServer + '/public/services/hypha-login/check');
|
|
5788
|
+
let token = null;
|
|
5789
|
+
for (let i = 0; i < 60; i++) {
|
|
5790
|
+
if (popup.closed) {
|
|
5791
|
+
// User dismissed the popup before completing \u2014 keep polling briefly
|
|
5792
|
+
// (the report endpoint may still fire even if window is gone).
|
|
5793
|
+
}
|
|
5794
|
+
try {
|
|
5795
|
+
const r = await fetch(checkBase + '?key=' + encodeURIComponent(ctx.key) + '&timeout=3');
|
|
5796
|
+
if (r.ok) {
|
|
5797
|
+
const body = await r.json();
|
|
5798
|
+
const t = typeof body === 'string' ? body : (body && (body.token || body));
|
|
5799
|
+
if (typeof t === 'string' && t.length > 20) { token = t; break; }
|
|
5800
|
+
}
|
|
5801
|
+
} catch (e) { /* transient \u2014 retry */ }
|
|
5802
|
+
}
|
|
5784
5803
|
|
|
5785
|
-
if (!token) throw new Error('
|
|
5804
|
+
if (!token) throw new Error('Timed out waiting for sign-in. Please try again.');
|
|
5786
5805
|
|
|
5787
|
-
// Set the cookie so subsequent requests to this origin are authenticated.
|
|
5806
|
+
// 4. Set the cookie so subsequent requests to this origin are authenticated.
|
|
5788
5807
|
const secure = location.protocol === 'https:' ? '; Secure' : '';
|
|
5789
5808
|
document.cookie = cookieName + '=' + token + '; path=/; SameSite=Lax' + secure;
|
|
5790
5809
|
|
|
@@ -7848,7 +7867,7 @@ async function startDaemon(options) {
|
|
|
7848
7867
|
const list = loadExposedTunnels().filter((t) => t.name !== name);
|
|
7849
7868
|
saveExposedTunnels(list);
|
|
7850
7869
|
}
|
|
7851
|
-
const { ServeManager } = await import('./serveManager-
|
|
7870
|
+
const { ServeManager } = await import('./serveManager-Bzjw2bO6.mjs');
|
|
7852
7871
|
const serveManager = new ServeManager(SVAMP_HOME, (msg) => logger.log(`[SERVE] ${msg}`), hyphaServerUrl);
|
|
7853
7872
|
ensureAutoInstalledSkills(logger).catch(() => {
|
|
7854
7873
|
});
|
|
@@ -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-B0zqVia0.mjs');
|
|
58
58
|
const pos = positionalArgs(args);
|
|
59
59
|
const name = pos[0];
|
|
60
60
|
if (!name) {
|
|
@@ -93,7 +93,7 @@ async function serveAdd(args, machineId) {
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
async function serveApply(args, machineId) {
|
|
96
|
-
const { connectAndGetMachine } = await import('./commands-
|
|
96
|
+
const { connectAndGetMachine } = await import('./commands-B0zqVia0.mjs');
|
|
97
97
|
const fs = await import('fs');
|
|
98
98
|
const yaml = await import('yaml');
|
|
99
99
|
const file = positionalArgs(args)[0];
|
|
@@ -182,7 +182,7 @@ async function serveApply(args, machineId) {
|
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
async function serveRemove(args, machineId) {
|
|
185
|
-
const { connectAndGetMachine } = await import('./commands-
|
|
185
|
+
const { connectAndGetMachine } = await import('./commands-B0zqVia0.mjs');
|
|
186
186
|
const pos = positionalArgs(args);
|
|
187
187
|
const name = pos[0];
|
|
188
188
|
if (!name) {
|
|
@@ -202,7 +202,7 @@ async function serveRemove(args, machineId) {
|
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
async function serveList(args, machineId) {
|
|
205
|
-
const { connectAndGetMachine } = await import('./commands-
|
|
205
|
+
const { connectAndGetMachine } = await import('./commands-B0zqVia0.mjs');
|
|
206
206
|
const all = hasFlag(args, "--all", "-a");
|
|
207
207
|
const json = hasFlag(args, "--json");
|
|
208
208
|
const sessionId = getFlag(args, "--session");
|
|
@@ -235,7 +235,7 @@ async function serveList(args, machineId) {
|
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
237
|
async function serveInfo(machineId) {
|
|
238
|
-
const { connectAndGetMachine } = await import('./commands-
|
|
238
|
+
const { connectAndGetMachine } = await import('./commands-B0zqVia0.mjs');
|
|
239
239
|
const { machine, server } = await connectAndGetMachine(machineId);
|
|
240
240
|
try {
|
|
241
241
|
const info = await machine.serveInfo();
|
|
@@ -4,7 +4,7 @@ import * as fs from 'fs';
|
|
|
4
4
|
import * as http from 'http';
|
|
5
5
|
import * as net from 'net';
|
|
6
6
|
import * as path from 'path';
|
|
7
|
-
import { S as ServeAuth, h as hasCookieToken } from './run-
|
|
7
|
+
import { S as ServeAuth, h as hasCookieToken } from './run-h-QVSVFd.mjs';
|
|
8
8
|
import 'os';
|
|
9
9
|
import 'fs/promises';
|
|
10
10
|
import 'url';
|