svamp-cli 0.2.74 → 0.2.76

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.
@@ -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--SLXTrkN.mjs');
151
+ const { connectAndGetMachine } = await import('./commands-CZs5avkF.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--SLXTrkN.mjs');
168
+ const { resolveSessionId } = await import('./commands-CZs5avkF.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-Br90om8R.mjs';
1
+ import { s as startDaemon, b as stopDaemon, d as daemonStatus } from './run-D1eKN5kE.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-Br90om8R.mjs').then(function (n) { return n.u; });
47
+ const { restartDaemon } = await import('./run-D1eKN5kE.mjs').then(function (n) { return n.u; });
48
48
  await restartDaemon();
49
49
  process.exit(0);
50
50
  }
@@ -287,7 +287,7 @@ async function main() {
287
287
  console.error("svamp service: Service commands are not available in sandboxed sessions.");
288
288
  process.exit(1);
289
289
  }
290
- const { handleServiceCommand } = await import('./commands-yzpViN29.mjs');
290
+ const { handleServiceCommand } = await import('./commands-DLVy7n8Z.mjs');
291
291
  await handleServiceCommand();
292
292
  } else if (subcommand === "serve") {
293
293
  const { isSandboxed: isSandboxedServe } = await import('./sandboxDetect-DNTcbgWD.mjs');
@@ -295,7 +295,7 @@ async function main() {
295
295
  console.error("svamp serve: Serve commands are not available in sandboxed sessions.");
296
296
  process.exit(1);
297
297
  }
298
- const { handleServeCommand } = await import('./serveCommands-Cu_2l3vg.mjs');
298
+ const { handleServeCommand } = await import('./serveCommands-vzzDvFg_.mjs');
299
299
  await handleServeCommand();
300
300
  process.exit(0);
301
301
  } else if (subcommand === "process" || subcommand === "proc") {
@@ -304,7 +304,7 @@ async function main() {
304
304
  console.error("svamp process: Process commands are not available in sandboxed sessions.");
305
305
  process.exit(1);
306
306
  }
307
- const { processCommand } = await import('./commands-BTZCHV-Z.mjs');
307
+ const { processCommand } = await import('./commands-BZm6LT7D.mjs');
308
308
  let machineId;
309
309
  const processArgs = args.slice(1);
310
310
  const mIdx = processArgs.findIndex((a) => a === "--machine" || a === "-m");
@@ -322,7 +322,7 @@ async function main() {
322
322
  } else if (!subcommand || subcommand === "start") {
323
323
  await handleInteractiveCommand();
324
324
  } else if (subcommand === "--version" || subcommand === "-v") {
325
- const pkg = await import('./package-C__x7TGc.mjs').catch(() => ({ default: { version: "unknown" } }));
325
+ const pkg = await import('./package-CfUAL2KO.mjs').catch(() => ({ default: { version: "unknown" } }));
326
326
  console.log(`svamp version: ${pkg.default.version}`);
327
327
  } else {
328
328
  console.error(`Unknown command: ${subcommand}`);
@@ -331,7 +331,7 @@ async function main() {
331
331
  }
332
332
  }
333
333
  async function handleInteractiveCommand() {
334
- const { runInteractive } = await import('./run-DO_Axr2M.mjs');
334
+ const { runInteractive } = await import('./run-DxXRSNiT.mjs');
335
335
  const interactiveArgs = subcommand === "start" ? args.slice(1) : args;
336
336
  let directory = process.cwd();
337
337
  let resumeSessionId;
@@ -376,7 +376,7 @@ async function handleAgentCommand() {
376
376
  return;
377
377
  }
378
378
  if (agentArgs[0] === "list") {
379
- const { KNOWN_ACP_AGENTS, KNOWN_MCP_AGENTS: KNOWN_MCP_AGENTS2 } = await import('./run-Br90om8R.mjs').then(function (n) { return n.p; });
379
+ const { KNOWN_ACP_AGENTS, KNOWN_MCP_AGENTS: KNOWN_MCP_AGENTS2 } = await import('./run-D1eKN5kE.mjs').then(function (n) { return n.p; });
380
380
  console.log("Known agents:");
381
381
  for (const [name, config2] of Object.entries(KNOWN_ACP_AGENTS)) {
382
382
  console.log(` ${name.padEnd(12)} ${config2.command} ${config2.args.join(" ")} (ACP)`);
@@ -388,7 +388,7 @@ async function handleAgentCommand() {
388
388
  console.log('Use "svamp agent -- <command> [args]" for a custom ACP agent.');
389
389
  return;
390
390
  }
391
- const { resolveAcpAgentConfig, KNOWN_MCP_AGENTS } = await import('./run-Br90om8R.mjs').then(function (n) { return n.p; });
391
+ const { resolveAcpAgentConfig, KNOWN_MCP_AGENTS } = await import('./run-D1eKN5kE.mjs').then(function (n) { return n.p; });
392
392
  let cwd = process.cwd();
393
393
  const filteredArgs = [];
394
394
  for (let i = 0; i < agentArgs.length; i++) {
@@ -412,12 +412,12 @@ async function handleAgentCommand() {
412
412
  console.log(`Starting ${config.agentName} agent in ${cwd}...`);
413
413
  let backend;
414
414
  if (KNOWN_MCP_AGENTS[config.agentName]) {
415
- const { CodexMcpBackend } = await import('./run-Br90om8R.mjs').then(function (n) { return n.q; });
415
+ const { CodexMcpBackend } = await import('./run-D1eKN5kE.mjs').then(function (n) { return n.q; });
416
416
  backend = new CodexMcpBackend({ cwd, log: logFn });
417
417
  } else {
418
- const { AcpBackend } = await import('./run-Br90om8R.mjs').then(function (n) { return n.o; });
419
- const { GeminiTransport } = await import('./run-Br90om8R.mjs').then(function (n) { return n.G; });
420
- const { DefaultTransport } = await import('./run-Br90om8R.mjs').then(function (n) { return n.D; });
418
+ const { AcpBackend } = await import('./run-D1eKN5kE.mjs').then(function (n) { return n.o; });
419
+ const { GeminiTransport } = await import('./run-D1eKN5kE.mjs').then(function (n) { return n.G; });
420
+ const { DefaultTransport } = await import('./run-D1eKN5kE.mjs').then(function (n) { return n.D; });
421
421
  const transportHandler = config.agentName === "gemini" ? new GeminiTransport() : new DefaultTransport(config.agentName);
422
422
  backend = new AcpBackend({
423
423
  agentName: config.agentName,
@@ -544,7 +544,7 @@ async function handleSessionCommand() {
544
544
  process.exit(1);
545
545
  }
546
546
  }
547
- const { sessionList, sessionSpawn, sessionArchive, sessionResume, sessionDelete, sessionInfo, sessionMessages, sessionAttach, sessionMachines, sessionSend, sessionWait, sessionShare, sessionRalphStart, sessionRalphCancel, sessionRalphStatus, sessionInboxSend, sessionInboxList, sessionInboxRead, sessionInboxReply, sessionInboxClear } = await import('./commands--SLXTrkN.mjs');
547
+ const { sessionList, sessionSpawn, sessionArchive, sessionResume, sessionDelete, sessionInfo, sessionMessages, sessionAttach, sessionMachines, sessionSend, sessionWait, sessionShare, sessionRalphStart, sessionRalphCancel, sessionRalphStatus, sessionInboxSend, sessionInboxList, sessionInboxRead, sessionInboxReply, sessionInboxClear } = await import('./commands-CZs5avkF.mjs');
548
548
  const parseFlagStr = (flag, shortFlag) => {
549
549
  for (let i = 1; i < sessionArgs.length; i++) {
550
550
  if ((sessionArgs[i] === flag || shortFlag) && i + 1 < sessionArgs.length) {
@@ -610,7 +610,7 @@ async function handleSessionCommand() {
610
610
  allowDomain.push(sessionArgs[++i]);
611
611
  }
612
612
  }
613
- const { parseShareArg } = await import('./commands--SLXTrkN.mjs');
613
+ const { parseShareArg } = await import('./commands-CZs5avkF.mjs');
614
614
  const shareEntries = share.map((s) => parseShareArg(s));
615
615
  await sessionSpawn(agent, dir, targetMachineId, {
616
616
  message,
@@ -673,7 +673,8 @@ async function handleSessionCommand() {
673
673
  await sessionAttach(sessionArgs[1], targetMachineId);
674
674
  } else if (sessionSubcommand === "send") {
675
675
  if (!sessionArgs[1] || !sessionArgs[2]) {
676
- console.error('Usage: svamp session send <session-id> <message> [--subject "..."] [--urgency urgent|normal] [--wait] [--response] [--btw] [--require-approval] [--timeout N] [--json]');
676
+ console.error('Usage: svamp session send <session-id> <message> [--model <id>] [--subject "..."] [--urgency urgent|normal] [--wait] [--response] [--btw] [--require-approval] [--timeout N] [--json]');
677
+ console.error(" --model <id> Switch the session model (e.g. claude-opus-4-7, claude-sonnet-4-6) before delivering the message \u2014 forces a respawn.");
677
678
  process.exit(1);
678
679
  }
679
680
  await sessionSend(sessionArgs[1], sessionArgs[2], targetMachineId, {
@@ -684,7 +685,8 @@ async function handleSessionCommand() {
684
685
  timeout: parseFlagInt("--timeout"),
685
686
  json: hasFlag("--json"),
686
687
  subject: parseFlagStr("--subject"),
687
- urgency: parseFlagStr("--urgency")
688
+ urgency: parseFlagStr("--urgency"),
689
+ model: parseFlagStr("--model")
688
690
  });
689
691
  } else if (sessionSubcommand === "query") {
690
692
  const dir = sessionArgs[1];
@@ -694,7 +696,7 @@ async function handleSessionCommand() {
694
696
  console.error(" Spawns a stateless Claude session in <directory>, sends <prompt>, prints the answer, then deletes the session.");
695
697
  process.exit(1);
696
698
  }
697
- const { sessionQuery } = await import('./commands--SLXTrkN.mjs');
699
+ const { sessionQuery } = await import('./commands-CZs5avkF.mjs');
698
700
  await sessionQuery(dir, prompt, targetMachineId, {
699
701
  timeout: parseFlagInt("--timeout"),
700
702
  json: hasFlag("--json"),
@@ -727,7 +729,7 @@ async function handleSessionCommand() {
727
729
  console.error("Usage: svamp session approve <session-id> [request-id] [--json]");
728
730
  process.exit(1);
729
731
  }
730
- const { sessionApprove } = await import('./commands--SLXTrkN.mjs');
732
+ const { sessionApprove } = await import('./commands-CZs5avkF.mjs');
731
733
  const approveReqId = sessionArgs[2] && !sessionArgs[2].startsWith("--") ? sessionArgs[2] : void 0;
732
734
  await sessionApprove(sessionArgs[1], approveReqId, targetMachineId, {
733
735
  json: hasFlag("--json")
@@ -737,7 +739,7 @@ async function handleSessionCommand() {
737
739
  console.error("Usage: svamp session deny <session-id> [request-id] [--json]");
738
740
  process.exit(1);
739
741
  }
740
- const { sessionDeny } = await import('./commands--SLXTrkN.mjs');
742
+ const { sessionDeny } = await import('./commands-CZs5avkF.mjs');
741
743
  const denyReqId = sessionArgs[2] && !sessionArgs[2].startsWith("--") ? sessionArgs[2] : void 0;
742
744
  await sessionDeny(sessionArgs[1], denyReqId, targetMachineId, {
743
745
  json: hasFlag("--json")
@@ -773,7 +775,7 @@ async function handleSessionCommand() {
773
775
  console.error("Usage: svamp session set-title <title>");
774
776
  process.exit(1);
775
777
  }
776
- const { sessionSetTitle } = await import('./agentCommands-BXQNGfyi.mjs');
778
+ const { sessionSetTitle } = await import('./agentCommands-CKVP9dOf.mjs');
777
779
  await sessionSetTitle(title);
778
780
  } else if (sessionSubcommand === "set-link") {
779
781
  const url = sessionArgs[1];
@@ -782,7 +784,7 @@ async function handleSessionCommand() {
782
784
  process.exit(1);
783
785
  }
784
786
  const label = sessionArgs[2] && !sessionArgs[2].startsWith("--") ? sessionArgs[2] : void 0;
785
- const { sessionSetLink } = await import('./agentCommands-BXQNGfyi.mjs');
787
+ const { sessionSetLink } = await import('./agentCommands-CKVP9dOf.mjs');
786
788
  await sessionSetLink(url, label);
787
789
  } else if (sessionSubcommand === "notify") {
788
790
  const message = sessionArgs[1];
@@ -791,7 +793,7 @@ async function handleSessionCommand() {
791
793
  process.exit(1);
792
794
  }
793
795
  const level = parseFlagStr("--level") || "info";
794
- const { sessionNotify } = await import('./agentCommands-BXQNGfyi.mjs');
796
+ const { sessionNotify } = await import('./agentCommands-CKVP9dOf.mjs');
795
797
  await sessionNotify(message, level);
796
798
  } else if (sessionSubcommand === "broadcast") {
797
799
  const action = sessionArgs[1];
@@ -799,7 +801,7 @@ async function handleSessionCommand() {
799
801
  console.error("Usage: svamp session broadcast <action> [args...]\nActions: open-canvas <url> [label], close-canvas, toast <message>");
800
802
  process.exit(1);
801
803
  }
802
- const { sessionBroadcast } = await import('./agentCommands-BXQNGfyi.mjs');
804
+ const { sessionBroadcast } = await import('./agentCommands-CKVP9dOf.mjs');
803
805
  await sessionBroadcast(action, sessionArgs.slice(2).filter((a) => !a.startsWith("--")));
804
806
  } else if (sessionSubcommand === "inbox") {
805
807
  const inboxSubcmd = sessionArgs[1];
@@ -810,7 +812,7 @@ async function handleSessionCommand() {
810
812
  process.exit(1);
811
813
  }
812
814
  if (agentSessionId) {
813
- const { inboxSend } = await import('./agentCommands-BXQNGfyi.mjs');
815
+ const { inboxSend } = await import('./agentCommands-CKVP9dOf.mjs');
814
816
  await inboxSend(sessionArgs[2], {
815
817
  body: sessionArgs[3],
816
818
  subject: parseFlagStr("--subject"),
@@ -825,7 +827,7 @@ async function handleSessionCommand() {
825
827
  }
826
828
  } else if (inboxSubcmd === "list" || inboxSubcmd === "ls") {
827
829
  if (agentSessionId && !sessionArgs[2]) {
828
- const { inboxList } = await import('./agentCommands-BXQNGfyi.mjs');
830
+ const { inboxList } = await import('./agentCommands-CKVP9dOf.mjs');
829
831
  await inboxList({
830
832
  unread: hasFlag("--unread"),
831
833
  limit: parseFlagInt("--limit"),
@@ -847,7 +849,7 @@ async function handleSessionCommand() {
847
849
  process.exit(1);
848
850
  }
849
851
  if (agentSessionId && !sessionArgs[3]) {
850
- const { inboxList } = await import('./agentCommands-BXQNGfyi.mjs');
852
+ const { inboxList } = await import('./agentCommands-CKVP9dOf.mjs');
851
853
  await sessionInboxRead(agentSessionId, sessionArgs[2], targetMachineId);
852
854
  } else if (sessionArgs[3]) {
853
855
  await sessionInboxRead(sessionArgs[2], sessionArgs[3], targetMachineId);
@@ -857,7 +859,7 @@ async function handleSessionCommand() {
857
859
  }
858
860
  } else if (inboxSubcmd === "reply") {
859
861
  if (agentSessionId && sessionArgs[2] && sessionArgs[3] && !sessionArgs[4]) {
860
- const { inboxReply } = await import('./agentCommands-BXQNGfyi.mjs');
862
+ const { inboxReply } = await import('./agentCommands-CKVP9dOf.mjs');
861
863
  await inboxReply(sessionArgs[2], sessionArgs[3]);
862
864
  } else if (sessionArgs[2] && sessionArgs[3] && sessionArgs[4]) {
863
865
  await sessionInboxReply(sessionArgs[2], sessionArgs[3], sessionArgs[4], targetMachineId);
@@ -893,7 +895,7 @@ async function handleMachineCommand() {
893
895
  return;
894
896
  }
895
897
  if (machineSubcommand === "share") {
896
- const { machineShare } = await import('./commands--SLXTrkN.mjs');
898
+ const { machineShare } = await import('./commands-CZs5avkF.mjs');
897
899
  let machineId;
898
900
  const shareArgs = [];
899
901
  for (let i = 1; i < machineArgs.length; i++) {
@@ -923,7 +925,7 @@ async function handleMachineCommand() {
923
925
  }
924
926
  await machineShare(machineId, { add, remove, list, configPath, showConfig });
925
927
  } else if (machineSubcommand === "exec") {
926
- const { machineExec } = await import('./commands--SLXTrkN.mjs');
928
+ const { machineExec } = await import('./commands-CZs5avkF.mjs');
927
929
  let machineId;
928
930
  let cwd;
929
931
  const cmdParts = [];
@@ -943,7 +945,7 @@ async function handleMachineCommand() {
943
945
  }
944
946
  await machineExec(machineId, command, cwd);
945
947
  } else if (machineSubcommand === "info") {
946
- const { machineInfo } = await import('./commands--SLXTrkN.mjs');
948
+ const { machineInfo } = await import('./commands-CZs5avkF.mjs');
947
949
  let machineId;
948
950
  for (let i = 1; i < machineArgs.length; i++) {
949
951
  if ((machineArgs[i] === "--machine" || machineArgs[i] === "-m") && i + 1 < machineArgs.length) {
@@ -963,10 +965,10 @@ async function handleMachineCommand() {
963
965
  level = machineArgs[++i];
964
966
  }
965
967
  }
966
- const { machineNotify } = await import('./agentCommands-BXQNGfyi.mjs');
968
+ const { machineNotify } = await import('./agentCommands-CKVP9dOf.mjs');
967
969
  await machineNotify(message, level);
968
970
  } else if (machineSubcommand === "ls") {
969
- const { machineLs } = await import('./commands--SLXTrkN.mjs');
971
+ const { machineLs } = await import('./commands-CZs5avkF.mjs');
970
972
  let machineId;
971
973
  let showHidden = false;
972
974
  let path;
@@ -1020,24 +1022,24 @@ Examples:
1020
1022
  };
1021
1023
  const hasFlag = (name) => fleetArgs.includes(`--${name}`);
1022
1024
  if (sub === "status") {
1023
- const { fleetStatus } = await import('./fleet-DMajjqRV.mjs');
1025
+ const { fleetStatus } = await import('./fleet-Dxy1dK0s.mjs');
1024
1026
  await fleetStatus();
1025
1027
  } else if (sub === "exec") {
1026
1028
  const command = fleetArgs.slice(1).filter((a) => !a.startsWith("--")).join(" ");
1027
- const { fleetExec } = await import('./fleet-DMajjqRV.mjs');
1029
+ const { fleetExec } = await import('./fleet-Dxy1dK0s.mjs');
1028
1030
  await fleetExec(command, { cwd: flag("cwd") });
1029
1031
  } else if (sub === "upgrade-claude") {
1030
- const { fleetUpgradeClaude } = await import('./fleet-DMajjqRV.mjs');
1032
+ const { fleetUpgradeClaude } = await import('./fleet-Dxy1dK0s.mjs');
1031
1033
  await fleetUpgradeClaude({ version: flag("version", "-v") });
1032
1034
  } else if (sub === "upgrade-svamp") {
1033
- const { fleetUpgradeSvamp } = await import('./fleet-DMajjqRV.mjs');
1035
+ const { fleetUpgradeSvamp } = await import('./fleet-Dxy1dK0s.mjs');
1034
1036
  await fleetUpgradeSvamp({ version: flag("version", "-v") });
1035
1037
  } else if (sub === "daemon-restart") {
1036
- const { fleetDaemonRestart } = await import('./fleet-DMajjqRV.mjs');
1038
+ const { fleetDaemonRestart } = await import('./fleet-Dxy1dK0s.mjs');
1037
1039
  await fleetDaemonRestart({ graceful: !hasFlag("cleanup") });
1038
1040
  } else if (sub === "push-skill") {
1039
1041
  const name = fleetArgs[1];
1040
- const { fleetPushSkill } = await import('./fleet-DMajjqRV.mjs');
1042
+ const { fleetPushSkill } = await import('./fleet-Dxy1dK0s.mjs');
1041
1043
  await fleetPushSkill(name);
1042
1044
  } else {
1043
1045
  console.error(`Unknown fleet subcommand: ${sub}`);
@@ -1496,7 +1498,7 @@ async function applyClaudeAuthFlags(argv) {
1496
1498
  "--use-hypha-proxy, --use-claude-login, and --anthropic-base-url/--anthropic-api-key are mutually exclusive"
1497
1499
  );
1498
1500
  }
1499
- const mod = await import('./run-Br90om8R.mjs').then(function (n) { return n.t; });
1501
+ const mod = await import('./run-D1eKN5kE.mjs').then(function (n) { return n.t; });
1500
1502
  if (hasHypha) {
1501
1503
  mod.setClaudeAuthHyphaProxy();
1502
1504
  console.log("Claude auth configured: hypha-proxy (uses HYPHA_TOKEN live at each spawn).");
@@ -1534,7 +1536,7 @@ async function applyDaemonShareFlag(argv) {
1534
1536
  }
1535
1537
  }
1536
1538
  if (collected.length === 0) return;
1537
- const { updateEnvFile } = await import('./run-Br90om8R.mjs').then(function (n) { return n.t; });
1539
+ const { updateEnvFile } = await import('./run-D1eKN5kE.mjs').then(function (n) { return n.t; });
1538
1540
  const seen = /* @__PURE__ */ new Set();
1539
1541
  const deduped = collected.filter((e) => {
1540
1542
  const k = e.toLowerCase();
@@ -1547,7 +1549,7 @@ async function applyDaemonShareFlag(argv) {
1547
1549
  }
1548
1550
  async function handleDaemonAuthCommand(argv) {
1549
1551
  const sub = (argv[0] || "status").toLowerCase();
1550
- const mod = await import('./run-Br90om8R.mjs').then(function (n) { return n.t; });
1552
+ const mod = await import('./run-D1eKN5kE.mjs').then(function (n) { return n.t; });
1551
1553
  if (sub === "--help" || sub === "-h" || sub === "help") {
1552
1554
  console.log(`
1553
1555
  svamp daemon auth \u2014 Configure how Claude subprocesses authenticate
@@ -1,11 +1,11 @@
1
1
  import { writeFileSync, readFileSync } from 'fs';
2
2
  import { resolve } from 'path';
3
- import { connectAndGetMachine } from './commands--SLXTrkN.mjs';
3
+ import { connectAndGetMachine } from './commands-CZs5avkF.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-Br90om8R.mjs';
8
+ import './run-D1eKN5kE.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-Br90om8R.mjs';
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-D1eKN5kE.mjs';
6
6
  import 'os';
7
7
  import 'fs/promises';
8
8
  import 'fs';
@@ -1123,9 +1123,14 @@ async function sessionMessages(sessionId, machineId, opts) {
1123
1123
  const { server, machine, fullId } = await connectAndResolveSession(sessionId, machineId);
1124
1124
  try {
1125
1125
  const svc = getSessionProxy(machine, fullId);
1126
- const afterSeq = opts?.after ?? 0;
1127
- const apiLimit = opts?.limit ?? 1e3;
1128
- const { messages } = await svc.getMessages(afterSeq, apiLimit);
1126
+ let messages;
1127
+ if (opts?.after !== void 0) {
1128
+ const apiLimit = opts?.limit ?? 500;
1129
+ ({ messages } = await svc.getMessages(opts.after, apiLimit));
1130
+ } else {
1131
+ const tailCount = Math.min(opts?.last ?? opts?.limit ?? 50, 500);
1132
+ ({ messages } = await svc.getLatestMessages(void 0, tailCount));
1133
+ }
1129
1134
  const toShow = opts?.last ? messages.slice(-opts.last) : messages;
1130
1135
  if (toShow.length === 0) {
1131
1136
  if (opts?.json) {
@@ -1428,6 +1433,7 @@ function validateSendOptions(opts) {
1428
1433
  if (opts.urgency) incompatible.push("--urgency");
1429
1434
  if (opts.wait) incompatible.push("--wait");
1430
1435
  if (opts.response) incompatible.push("--response");
1436
+ if (opts.model) incompatible.push("--model");
1431
1437
  return incompatible;
1432
1438
  }
1433
1439
  async function sendCore(machine, fullId, message, opts) {
@@ -1454,6 +1460,55 @@ async function sendCore(machine, fullId, message, opts) {
1454
1460
  }
1455
1461
  const wantResponse = !!opts?.response;
1456
1462
  const shouldWait = !!opts?.wait || wantResponse;
1463
+ if (opts?.model) {
1464
+ const { randomUUID: ruuid } = await import('node:crypto');
1465
+ if (shouldWait && !opts?.requireApproval) {
1466
+ try {
1467
+ await machine.sessionRPC(fullId, "switchMode", { mode: "bypassPermissions" });
1468
+ } catch {
1469
+ }
1470
+ }
1471
+ try {
1472
+ await machine.sessionRPC(fullId, "abort", {});
1473
+ } catch {
1474
+ }
1475
+ await new Promise((r) => setTimeout(r, 2e3));
1476
+ const meta = { model: opts.model, sentFrom: "svamp-cli" };
1477
+ const contentStr = JSON.stringify({ role: "user", content: { type: "text", text: message }, meta });
1478
+ const sendRes = await machine.sessionRPC(fullId, "sendMessage", {
1479
+ content: contentStr,
1480
+ localId: ruuid(),
1481
+ meta
1482
+ });
1483
+ let mWait;
1484
+ if (shouldWait) {
1485
+ mWait = await waitForBusyThenIdle(machine, fullId, (opts?.timeout || 300) * 1e3);
1486
+ }
1487
+ if (mWait?.pendingPermissions?.length) {
1488
+ return {
1489
+ sessionId: fullId,
1490
+ mode: "send",
1491
+ sent: true,
1492
+ messageId: sendRes?.id,
1493
+ waited: true,
1494
+ status: "permission-pending",
1495
+ pendingPermissions: mWait.pendingPermissions
1496
+ };
1497
+ }
1498
+ let mResponse;
1499
+ if (wantResponse) {
1500
+ mResponse = await collectAssistantResponse(machine, fullId, 0);
1501
+ }
1502
+ return {
1503
+ sessionId: fullId,
1504
+ mode: "send",
1505
+ sent: true,
1506
+ messageId: sendRes?.id,
1507
+ waited: shouldWait,
1508
+ status: shouldWait ? "idle" : "sent",
1509
+ ...wantResponse && mResponse ? { response: mResponse.text, responseSeqs: mResponse.messageSeqs } : {}
1510
+ };
1511
+ }
1457
1512
  let bypassEnsured = false;
1458
1513
  if (shouldWait && !opts?.requireApproval) {
1459
1514
  try {
@@ -68,7 +68,7 @@ async function serviceExpose(args) {
68
68
  });
69
69
  return;
70
70
  }
71
- const { connectAndGetMachine } = await import('./commands--SLXTrkN.mjs');
71
+ const { connectAndGetMachine } = await import('./commands-CZs5avkF.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--SLXTrkN.mjs');
135
+ const { connectAndGetMachine } = await import('./commands-CZs5avkF.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--SLXTrkN.mjs');
164
+ const { connectAndGetMachine } = await import('./commands-CZs5avkF.mjs');
165
165
  const { server, machine } = await connectAndGetMachine();
166
166
  try {
167
167
  await machine.tunnelStop({ name });
@@ -1,7 +1,7 @@
1
1
  import { existsSync, readFileSync } from 'node:fs';
2
2
  import { join } from 'node:path';
3
3
  import os from 'node:os';
4
- import { c as connectToHypha } from './run-Br90om8R.mjs';
4
+ import { c as connectToHypha } from './run-D1eKN5kE.mjs';
5
5
  import { PINNED_CLAUDE_CODE_VERSION } from './pinnedClaudeCode-HydRNEt7.mjs';
6
6
  import 'os';
7
7
  import 'fs/promises';
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-Br90om8R.mjs';
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-D1eKN5kE.mjs';
2
2
  import 'os';
3
3
  import 'fs/promises';
4
4
  import 'fs';
@@ -1,5 +1,5 @@
1
1
  var name = "svamp-cli";
2
- var version = "0.2.74";
2
+ var version = "0.2.76";
3
3
  var description = "Svamp CLI — AI workspace daemon on Hypha Cloud";
4
4
  var author = "Amun AI AB";
5
5
  var license = "SEE LICENSE IN LICENSE";
@@ -5559,6 +5559,7 @@ function applyDaemonShareSeed(sharing, seedEmails, ownerEmail) {
5559
5559
 
5560
5560
  const AUTH0_NAMESPACES = ["https://api.imjoy.io/", "https://amun.ai/"];
5561
5561
  const COOKIE_NAME = "svamp_serve_token";
5562
+ const SVAMP_SERVE_TOKEN_PARAM = "__svamp_serve_token";
5562
5563
  const DEFAULT_CACHE_TTL_MS = 5 * 60 * 1e3;
5563
5564
  const DEFAULT_CACHE_MAX_SIZE = 1e3;
5564
5565
  class TokenCache {
@@ -5603,8 +5604,10 @@ function extractToken(req) {
5603
5604
  return auth.slice(7).trim();
5604
5605
  }
5605
5606
  const url = new URL(req.url || "/", "http://localhost");
5606
- const qToken = url.searchParams.get("token");
5607
- if (qToken) return qToken;
5607
+ const svampTokens = url.searchParams.getAll(SVAMP_SERVE_TOKEN_PARAM);
5608
+ if (svampTokens.length > 0) return svampTokens[svampTokens.length - 1];
5609
+ const tokens = url.searchParams.getAll("token");
5610
+ if (tokens.length > 0) return tokens[tokens.length - 1];
5608
5611
  return null;
5609
5612
  }
5610
5613
  function parseCookies(header) {
@@ -5746,6 +5749,7 @@ a:hover{text-decoration:underline}
5746
5749
  const hyphaServer = ${JSON.stringify(this.hyphaServerUrl)};
5747
5750
  const redirectUrl = ${JSON.stringify(redirectUrl)};
5748
5751
  const cookieName = ${JSON.stringify(COOKIE_NAME)};
5752
+ const tokenParam = ${JSON.stringify(SVAMP_SERVE_TOKEN_PARAM)};
5749
5753
 
5750
5754
  const btn = document.getElementById('login-btn');
5751
5755
  const statusEl = document.getElementById('status');
@@ -5815,13 +5819,26 @@ btn.addEventListener('click', async () => {
5815
5819
  // Also carry the token in the redirect URL as a fallback: browsers that
5816
5820
  // block third-party cookies entirely (Safari ITP, Chrome 3p-cookie
5817
5821
  // phaseout) won't send the cookie above when we're framed cross-site, but
5818
- // the proxy also accepts ?token= on the request. Harmless when the cookie
5819
- // does work \u2014 extractToken() prefers the cookie.
5820
- let dest = redirectUrl;
5822
+ // the proxy also accepts the param on the request. Harmless when the
5823
+ // cookie works \u2014 extractToken() prefers the cookie.
5824
+ //
5825
+ // Use the dedicated __svamp_serve_token name (not plain "token") so it
5826
+ // can never collide with any token the originally-requested URL had
5827
+ // for its own purposes \u2014 that collision caused the "stays on login
5828
+ // page" loop where the proxy's URL parser returned the *stale* token.
5829
+ // URL/URLSearchParams handles encoding, dedup of our own param across
5830
+ // retries, and preserving everything else (hash, other query, etc.).
5831
+ let dest;
5821
5832
  try {
5822
- const sep = dest.indexOf('?') === -1 ? '?' : '&';
5823
- dest = dest + sep + 'token=' + encodeURIComponent(token);
5824
- } catch (e) {}
5833
+ const u = new URL(redirectUrl, location.origin);
5834
+ u.searchParams.delete(tokenParam);
5835
+ u.searchParams.append(tokenParam, token);
5836
+ dest = u.pathname + u.search + u.hash;
5837
+ } catch (e) {
5838
+ // Fallback if URL parsing fails for some reason \u2014 just append.
5839
+ const sep = redirectUrl.indexOf('?') === -1 ? '?' : '&';
5840
+ dest = redirectUrl + sep + tokenParam + '=' + encodeURIComponent(token);
5841
+ }
5825
5842
 
5826
5843
  try { popup.close(); } catch (e) {}
5827
5844
  statusEl.innerHTML = '<span class="ok">Signed in. Redirecting\u2026</span>';
@@ -6758,6 +6775,43 @@ function checkTruncation(format, tail, fileSize, head) {
6758
6775
  const __filename$1 = fileURLToPath(import.meta.url);
6759
6776
  const __dirname$1 = dirname(__filename$1);
6760
6777
  const CLAUDE_SKILLS_DIR = join(os$1.homedir(), ".claude", "skills");
6778
+ function looksLikeClaudeError(line) {
6779
+ const l = line.toLowerCase();
6780
+ return l.includes("api error") || l.includes("request rejected") || l.includes("error:") || l.includes("overloaded") || l.includes("rate limit") || l.includes("unauthorized") || l.includes("forbidden") || /\b(4\d\d|5\d\d)\b/.test(l) && (l.includes("status") || l.includes("error") || l.includes("rejected"));
6781
+ }
6782
+ function dedupeLines(lines) {
6783
+ const seen = /* @__PURE__ */ new Set();
6784
+ const out = [];
6785
+ for (const raw of lines) {
6786
+ const line = raw.trim();
6787
+ if (!line || seen.has(line)) continue;
6788
+ seen.add(line);
6789
+ out.push(line);
6790
+ }
6791
+ return out;
6792
+ }
6793
+ function buildClaudeErrorHint(text, apiErrorStatus) {
6794
+ const lower = (text || "").toLowerCase();
6795
+ const isOverload = apiErrorStatus === 529 || lower.includes("529") || lower.includes("overload");
6796
+ const isResumeIssue = lower.includes("tool_use.name") || lower.includes("invalid_request") || lower.includes("messages.");
6797
+ const isBillingIssue = lower.includes("credit") || lower.includes("balance") || lower.includes("billing") || lower.includes("quota") || lower.includes("subscription") || lower.includes("payment") || lower.includes("1m-context") || lower.includes("1m context");
6798
+ const isLoginIssue = lower.includes("login") || lower.includes("logged in") || lower.includes("auth") || lower.includes("api key") || lower.includes("unauthorized");
6799
+ if (isOverload) {
6800
+ const onHyphaProxy = (process.env.SVAMP_CLAUDE_PROXY || "").toLowerCase() === "hypha";
6801
+ const proxyHint = onHyphaProxy ? "" : "\n\u2022 Switch the daemon to the Hypha proxy (rotates across accounts on 529): `svamp daemon auth use-hypha-proxy && svamp daemon restart`";
6802
+ return "\n\nAnthropic returned HTTP 529 Overloaded \u2014 server-side capacity, not your account. This session may be pinned to a hot backend shard.\n\u2022 Start a fresh session (different conversation id \u2192 different shard).\n\u2022 Wait a minute and resend.\n\u2022 Check https://status.claude.com." + proxyHint;
6803
+ }
6804
+ if (isBillingIssue) {
6805
+ return "\n\nThis looks like an account/plan limit (credits, quota, or context size not covered by your subscription). Switch the session to a standard 200K-context model (e.g. `claude-opus-4-7` / `claude-sonnet-4-6`), or check your Claude account credits/subscription at https://console.anthropic.com.";
6806
+ }
6807
+ if (isLoginIssue) {
6808
+ return "\n\nRun `claude login` in your terminal on the machine running the daemon to re-authenticate.";
6809
+ }
6810
+ if (isResumeIssue) {
6811
+ return "\n\nThe conversation history may be corrupted. Try starting a fresh session.";
6812
+ }
6813
+ return "\n\nCheck that the Claude Code CLI is properly installed and configured.";
6814
+ }
6761
6815
  function readSkillVersion(skillDir) {
6762
6816
  try {
6763
6817
  const md = readFileSync$1(join(skillDir, "SKILL.md"), "utf-8");
@@ -7885,7 +7939,7 @@ async function startDaemon(options) {
7885
7939
  const list = loadExposedTunnels().filter((t) => t.name !== name);
7886
7940
  saveExposedTunnels(list);
7887
7941
  }
7888
- const { ServeManager } = await import('./serveManager-ClzowUXI.mjs');
7942
+ const { ServeManager } = await import('./serveManager-Cpzlvbw7.mjs');
7889
7943
  const serveManager = new ServeManager(SVAMP_HOME, (msg) => logger.log(`[SERVE] ${msg}`), hyphaServerUrl);
7890
7944
  ensureAutoInstalledSkills(logger).catch(() => {
7891
7945
  });
@@ -8106,6 +8160,7 @@ async function startDaemon(options) {
8106
8160
  let startupFailureRetryPending = false;
8107
8161
  let startupRetryMessage;
8108
8162
  let startupNonJsonLines = [];
8163
+ let errorOutputLines = [];
8109
8164
  const STUCK_PROCESS_TIMEOUT_MS = 30 * 60 * 1e3;
8110
8165
  const STUCK_CHECK_INTERVAL_MS = 2 * 60 * 1e3;
8111
8166
  let lastOutputTime = Date.now();
@@ -8224,6 +8279,7 @@ async function startDaemon(options) {
8224
8279
  const spawnClaude = (initialMessage, meta) => {
8225
8280
  const effectiveMeta = { ...lastSpawnMeta, ...meta };
8226
8281
  startupNonJsonLines = [];
8282
+ errorOutputLines = [];
8227
8283
  startupRetryMessage = initialMessage;
8228
8284
  let rawPermissionMode = effectiveMeta.permissionMode || agentConfig.default_permission_mode || currentPermissionMode;
8229
8285
  if (options2.forceIsolation || sessionMetadata.sharing?.enabled) {
@@ -8469,18 +8525,8 @@ async function startDaemon(options) {
8469
8525
  lastErrorMessagePushed = true;
8470
8526
  } else {
8471
8527
  const lower = resultText.toLowerCase();
8472
- const isOverload = msg.api_error_status === 529 || lower.includes("529") || lower.includes("overload");
8473
8528
  const isLoginIssue = lower.includes("login") || lower.includes("logged in") || lower.includes("auth") || lower.includes("api key") || lower.includes("unauthorized");
8474
- const isResumeIssue = lower.includes("tool_use.name") || lower.includes("invalid_request") || lower.includes("messages.");
8475
- const isBillingIssue = lower.includes("credit") || lower.includes("balance") || lower.includes("billing") || lower.includes("quota") || lower.includes("subscription") || lower.includes("payment");
8476
- let hint = "";
8477
- if (isOverload) {
8478
- const onHyphaProxy = (process.env.SVAMP_CLAUDE_PROXY || "").toLowerCase() === "hypha";
8479
- const proxyHint = onHyphaProxy ? "" : "\n\u2022 Switch the daemon to the Hypha proxy (rotates across accounts on 529): `svamp daemon auth use-hypha-proxy && svamp daemon restart`";
8480
- hint = "\n\nAnthropic returned HTTP 529 Overloaded \u2014 server-side capacity, not your account. This session may be pinned to a hot backend shard.\n\u2022 Start a fresh session (different conversation id \u2192 different shard).\n\u2022 Wait a minute and resend.\n\u2022 Check https://status.claude.com." + proxyHint;
8481
- } else if (isBillingIssue) {
8482
- hint = "\n\nCheck your Claude account credits or subscription at https://console.anthropic.com.";
8483
- } else if (isLoginIssue) {
8529
+ if (isLoginIssue) {
8484
8530
  checkAndRefreshOAuthToken(true, logger).then((r) => {
8485
8531
  if (r.refreshed) {
8486
8532
  logger.log(`[Session ${sessionId}] OAuth token refreshed after auth error \u2014 retrying on next message`);
@@ -8489,12 +8535,8 @@ async function startDaemon(options) {
8489
8535
  }).catch((err) => {
8490
8536
  logger.log(`[Session ${sessionId}] Reactive OAuth refresh failed: ${err.message}`);
8491
8537
  });
8492
- hint = "\n\nRun `claude login` in your terminal on the machine running the daemon to re-authenticate.";
8493
- } else if (isResumeIssue) {
8494
- hint = "\n\nThe conversation history may be corrupted. Try starting a fresh session.";
8495
- } else {
8496
- hint = "\n\nCheck that the Claude Code CLI is properly installed and configured.";
8497
8538
  }
8539
+ const hint = buildClaudeErrorHint(resultText, msg.api_error_status);
8498
8540
  const displayMsg = resultText || "Claude Code exited with an error.";
8499
8541
  let contextInfo = "";
8500
8542
  if (startupNonJsonLines.length > 0) {
@@ -8867,6 +8909,9 @@ The automated loop has finished. Review the progress above and let me know if yo
8867
8909
  if (!spawnHasReceivedInit) {
8868
8910
  startupNonJsonLines.push(line.slice(0, 500));
8869
8911
  }
8912
+ if (looksLikeClaudeError(line)) {
8913
+ errorOutputLines.push(line.slice(0, 500));
8914
+ }
8870
8915
  }
8871
8916
  }
8872
8917
  });
@@ -8888,6 +8933,11 @@ The automated loop has finished. Review the progress above and let me know if yo
8888
8933
  const text = chunk.toString();
8889
8934
  logger.log(`[Session ${sessionId}] Claude stderr: ${text.trim()}`);
8890
8935
  stderrBuffer += text;
8936
+ for (const line of text.split("\n")) {
8937
+ if (looksLikeClaudeError(line)) {
8938
+ errorOutputLines.push(line.trim().slice(0, 500));
8939
+ }
8940
+ }
8891
8941
  });
8892
8942
  child.on("exit", (code, signal) => {
8893
8943
  logger.log(`[Session ${sessionId}] Claude exited: code=${code}, signal=${signal}`);
@@ -8903,10 +8953,18 @@ The automated loop has finished. Review the progress above and let me know if yo
8903
8953
  }
8904
8954
  pendingPermissions.clear();
8905
8955
  if (code !== 0 && code !== null && !lastErrorMessagePushed) {
8956
+ const capturedError = dedupeLines(errorOutputLines).join("\n").trim();
8957
+ let exitMsg = `Agent process exited unexpectedly (code ${code}${signal ? `, signal: ${signal}` : ""})`;
8958
+ if (capturedError) {
8959
+ exitMsg += `
8960
+
8961
+ ${capturedError}${buildClaudeErrorHint(capturedError)}`;
8962
+ }
8906
8963
  sessionService.pushMessage(
8907
- { type: "message", message: `Agent process exited unexpectedly (code ${code}${signal ? `, signal: ${signal}` : ""})` },
8964
+ { type: "message", message: exitMsg, level: "error" },
8908
8965
  "event"
8909
8966
  );
8967
+ lastErrorMessagePushed = true;
8910
8968
  }
8911
8969
  lastErrorMessagePushed = false;
8912
8970
  sessionMetadata = { ...sessionMetadata, lifecycleState: claudeResumeId ? "idle" : "stopped" };
@@ -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-Br90om8R.mjs';
5
+ import { c as connectToHypha, a as registerSessionService, k as generateHookSettings } from './run-D1eKN5kE.mjs';
6
6
  import { createServer } from 'node:http';
7
7
  import { spawn } from 'node:child_process';
8
8
  import { createInterface } from 'node:readline';
@@ -54,7 +54,7 @@ async function handleServeCommand() {
54
54
  }
55
55
  }
56
56
  async function serveAdd(args, machineId) {
57
- const { connectAndGetMachine } = await import('./commands--SLXTrkN.mjs');
57
+ const { connectAndGetMachine } = await import('./commands-CZs5avkF.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--SLXTrkN.mjs');
96
+ const { connectAndGetMachine } = await import('./commands-CZs5avkF.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--SLXTrkN.mjs');
185
+ const { connectAndGetMachine } = await import('./commands-CZs5avkF.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--SLXTrkN.mjs');
205
+ const { connectAndGetMachine } = await import('./commands-CZs5avkF.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--SLXTrkN.mjs');
238
+ const { connectAndGetMachine } = await import('./commands-CZs5avkF.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-Br90om8R.mjs';
7
+ import { S as ServeAuth, h as hasCookieToken } from './run-D1eKN5kE.mjs';
8
8
  import 'os';
9
9
  import 'fs/promises';
10
10
  import 'url';
@@ -530,7 +530,8 @@ class ServeManager {
530
530
  }
531
531
  if (basePath === "/__login__" || url.pathname === "/__login__") {
532
532
  const returnUrl = url.searchParams.get("return") || "/";
533
- const safeReturn = returnUrl.startsWith("/__login__") ? "/" : returnUrl;
533
+ const isSameOriginPath = returnUrl.startsWith("/") && !returnUrl.startsWith("//") && !returnUrl.startsWith("/__login__");
534
+ const safeReturn = isSameOriginPath ? returnUrl : "/";
534
535
  const html = this.auth ? this.auth.getLoginPageHtml(safeReturn) : "<h1>Auth not configured</h1>";
535
536
  res.writeHead(200, {
536
537
  "Content-Type": "text/html; charset=utf-8",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svamp-cli",
3
- "version": "0.2.74",
3
+ "version": "0.2.76",
4
4
  "description": "Svamp CLI — AI workspace daemon on Hypha Cloud",
5
5
  "author": "Amun AI AB",
6
6
  "license": "SEE LICENSE IN LICENSE",