svamp-cli 0.2.65 → 0.2.67

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-CgirOjun.mjs');
151
+ const { connectAndGetMachine } = await import('./commands-BO8gl_-u.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-CgirOjun.mjs');
168
+ const { resolveSessionId } = await import('./commands-BO8gl_-u.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-EPzdDXeY.mjs';
1
+ import { s as startDaemon, b as stopDaemon, d as daemonStatus } from './run-DZq12r28.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-EPzdDXeY.mjs').then(function (n) { return n.u; });
47
+ const { restartDaemon } = await import('./run-DZq12r28.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-CY0X_cdt.mjs');
283
+ const { handleServiceCommand } = await import('./commands-B6yUtg85.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-sRps4L_A.mjs');
291
+ const { handleServeCommand } = await import('./serveCommands-B-Ij7oce.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-CjKzQm8Q.mjs');
300
+ const { processCommand } = await import('./commands-D7A1aWC1.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-DHBXuNi1.mjs').catch(() => ({ default: { version: "unknown" } }));
318
+ const pkg = await import('./package-wAsRM-Wx.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-cSiQAr8c.mjs');
327
+ const { runInteractive } = await import('./run-B4a6wAxf.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-EPzdDXeY.mjs').then(function (n) { return n.p; });
372
+ const { KNOWN_ACP_AGENTS, KNOWN_MCP_AGENTS: KNOWN_MCP_AGENTS2 } = await import('./run-DZq12r28.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-EPzdDXeY.mjs').then(function (n) { return n.p; });
384
+ const { resolveAcpAgentConfig, KNOWN_MCP_AGENTS } = await import('./run-DZq12r28.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-EPzdDXeY.mjs').then(function (n) { return n.q; });
408
+ const { CodexMcpBackend } = await import('./run-DZq12r28.mjs').then(function (n) { return n.q; });
409
409
  backend = new CodexMcpBackend({ cwd, log: logFn });
410
410
  } else {
411
- const { AcpBackend } = await import('./run-EPzdDXeY.mjs').then(function (n) { return n.o; });
412
- const { GeminiTransport } = await import('./run-EPzdDXeY.mjs').then(function (n) { return n.G; });
413
- const { DefaultTransport } = await import('./run-EPzdDXeY.mjs').then(function (n) { return n.D; });
411
+ const { AcpBackend } = await import('./run-DZq12r28.mjs').then(function (n) { return n.o; });
412
+ const { GeminiTransport } = await import('./run-DZq12r28.mjs').then(function (n) { return n.G; });
413
+ const { DefaultTransport } = await import('./run-DZq12r28.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, sessionStop, sessionInfo, sessionMessages, sessionAttach, sessionMachines, sessionSend, sessionWait, sessionShare, sessionRalphStart, sessionRalphCancel, sessionRalphStatus, sessionInboxSend, sessionInboxList, sessionInboxRead, sessionInboxReply, sessionInboxClear } = await import('./commands-CgirOjun.mjs');
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-BO8gl_-u.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) {
@@ -597,7 +597,7 @@ async function handleSessionCommand() {
597
597
  allowDomain.push(sessionArgs[++i]);
598
598
  }
599
599
  }
600
- const { parseShareArg } = await import('./commands-CgirOjun.mjs');
600
+ const { parseShareArg } = await import('./commands-BO8gl_-u.mjs');
601
601
  const shareEntries = share.map((s) => parseShareArg(s));
602
602
  await sessionSpawn(agent, dir, targetMachineId, {
603
603
  message,
@@ -614,12 +614,24 @@ async function handleSessionCommand() {
614
614
  tags: tags.length > 0 ? tags : void 0,
615
615
  parentSessionId
616
616
  });
617
- } else if (sessionSubcommand === "stop") {
617
+ } else if (sessionSubcommand === "archive") {
618
618
  if (!sessionArgs[1]) {
619
- console.error("Usage: svamp session stop <session-id>");
619
+ console.error("Usage: svamp session archive <session-id>");
620
620
  process.exit(1);
621
621
  }
622
- await sessionStop(sessionArgs[1], targetMachineId);
622
+ await sessionArchive(sessionArgs[1], targetMachineId);
623
+ } else if (sessionSubcommand === "resume") {
624
+ if (!sessionArgs[1]) {
625
+ console.error("Usage: svamp session resume <session-id>");
626
+ process.exit(1);
627
+ }
628
+ await sessionResume(sessionArgs[1], targetMachineId);
629
+ } else if (sessionSubcommand === "delete" || sessionSubcommand === "rm") {
630
+ if (!sessionArgs[1]) {
631
+ console.error("Usage: svamp session delete <session-id>");
632
+ process.exit(1);
633
+ }
634
+ await sessionDelete(sessionArgs[1], targetMachineId);
623
635
  } else if (sessionSubcommand === "info") {
624
636
  if (!sessionArgs[1]) {
625
637
  console.error("Usage: svamp session info <session-id>");
@@ -683,7 +695,7 @@ async function handleSessionCommand() {
683
695
  console.error("Usage: svamp session approve <session-id> [request-id] [--json]");
684
696
  process.exit(1);
685
697
  }
686
- const { sessionApprove } = await import('./commands-CgirOjun.mjs');
698
+ const { sessionApprove } = await import('./commands-BO8gl_-u.mjs');
687
699
  const approveReqId = sessionArgs[2] && !sessionArgs[2].startsWith("--") ? sessionArgs[2] : void 0;
688
700
  await sessionApprove(sessionArgs[1], approveReqId, targetMachineId, {
689
701
  json: hasFlag("--json")
@@ -693,7 +705,7 @@ async function handleSessionCommand() {
693
705
  console.error("Usage: svamp session deny <session-id> [request-id] [--json]");
694
706
  process.exit(1);
695
707
  }
696
- const { sessionDeny } = await import('./commands-CgirOjun.mjs');
708
+ const { sessionDeny } = await import('./commands-BO8gl_-u.mjs');
697
709
  const denyReqId = sessionArgs[2] && !sessionArgs[2].startsWith("--") ? sessionArgs[2] : void 0;
698
710
  await sessionDeny(sessionArgs[1], denyReqId, targetMachineId, {
699
711
  json: hasFlag("--json")
@@ -729,7 +741,7 @@ async function handleSessionCommand() {
729
741
  console.error("Usage: svamp session set-title <title>");
730
742
  process.exit(1);
731
743
  }
732
- const { sessionSetTitle } = await import('./agentCommands-CcvaE6am.mjs');
744
+ const { sessionSetTitle } = await import('./agentCommands-CVmNxFdC.mjs');
733
745
  await sessionSetTitle(title);
734
746
  } else if (sessionSubcommand === "set-link") {
735
747
  const url = sessionArgs[1];
@@ -738,7 +750,7 @@ async function handleSessionCommand() {
738
750
  process.exit(1);
739
751
  }
740
752
  const label = sessionArgs[2] && !sessionArgs[2].startsWith("--") ? sessionArgs[2] : void 0;
741
- const { sessionSetLink } = await import('./agentCommands-CcvaE6am.mjs');
753
+ const { sessionSetLink } = await import('./agentCommands-CVmNxFdC.mjs');
742
754
  await sessionSetLink(url, label);
743
755
  } else if (sessionSubcommand === "notify") {
744
756
  const message = sessionArgs[1];
@@ -747,7 +759,7 @@ async function handleSessionCommand() {
747
759
  process.exit(1);
748
760
  }
749
761
  const level = parseFlagStr("--level") || "info";
750
- const { sessionNotify } = await import('./agentCommands-CcvaE6am.mjs');
762
+ const { sessionNotify } = await import('./agentCommands-CVmNxFdC.mjs');
751
763
  await sessionNotify(message, level);
752
764
  } else if (sessionSubcommand === "broadcast") {
753
765
  const action = sessionArgs[1];
@@ -755,7 +767,7 @@ async function handleSessionCommand() {
755
767
  console.error("Usage: svamp session broadcast <action> [args...]\nActions: open-canvas <url> [label], close-canvas, toast <message>");
756
768
  process.exit(1);
757
769
  }
758
- const { sessionBroadcast } = await import('./agentCommands-CcvaE6am.mjs');
770
+ const { sessionBroadcast } = await import('./agentCommands-CVmNxFdC.mjs');
759
771
  await sessionBroadcast(action, sessionArgs.slice(2).filter((a) => !a.startsWith("--")));
760
772
  } else if (sessionSubcommand === "inbox") {
761
773
  const inboxSubcmd = sessionArgs[1];
@@ -766,7 +778,7 @@ async function handleSessionCommand() {
766
778
  process.exit(1);
767
779
  }
768
780
  if (agentSessionId) {
769
- const { inboxSend } = await import('./agentCommands-CcvaE6am.mjs');
781
+ const { inboxSend } = await import('./agentCommands-CVmNxFdC.mjs');
770
782
  await inboxSend(sessionArgs[2], {
771
783
  body: sessionArgs[3],
772
784
  subject: parseFlagStr("--subject"),
@@ -781,7 +793,7 @@ async function handleSessionCommand() {
781
793
  }
782
794
  } else if (inboxSubcmd === "list" || inboxSubcmd === "ls") {
783
795
  if (agentSessionId && !sessionArgs[2]) {
784
- const { inboxList } = await import('./agentCommands-CcvaE6am.mjs');
796
+ const { inboxList } = await import('./agentCommands-CVmNxFdC.mjs');
785
797
  await inboxList({
786
798
  unread: hasFlag("--unread"),
787
799
  limit: parseFlagInt("--limit"),
@@ -803,7 +815,7 @@ async function handleSessionCommand() {
803
815
  process.exit(1);
804
816
  }
805
817
  if (agentSessionId && !sessionArgs[3]) {
806
- const { inboxList } = await import('./agentCommands-CcvaE6am.mjs');
818
+ const { inboxList } = await import('./agentCommands-CVmNxFdC.mjs');
807
819
  await sessionInboxRead(agentSessionId, sessionArgs[2], targetMachineId);
808
820
  } else if (sessionArgs[3]) {
809
821
  await sessionInboxRead(sessionArgs[2], sessionArgs[3], targetMachineId);
@@ -813,7 +825,7 @@ async function handleSessionCommand() {
813
825
  }
814
826
  } else if (inboxSubcmd === "reply") {
815
827
  if (agentSessionId && sessionArgs[2] && sessionArgs[3] && !sessionArgs[4]) {
816
- const { inboxReply } = await import('./agentCommands-CcvaE6am.mjs');
828
+ const { inboxReply } = await import('./agentCommands-CVmNxFdC.mjs');
817
829
  await inboxReply(sessionArgs[2], sessionArgs[3]);
818
830
  } else if (sessionArgs[2] && sessionArgs[3] && sessionArgs[4]) {
819
831
  await sessionInboxReply(sessionArgs[2], sessionArgs[3], sessionArgs[4], targetMachineId);
@@ -849,7 +861,7 @@ async function handleMachineCommand() {
849
861
  return;
850
862
  }
851
863
  if (machineSubcommand === "share") {
852
- const { machineShare } = await import('./commands-CgirOjun.mjs');
864
+ const { machineShare } = await import('./commands-BO8gl_-u.mjs');
853
865
  let machineId;
854
866
  const shareArgs = [];
855
867
  for (let i = 1; i < machineArgs.length; i++) {
@@ -879,7 +891,7 @@ async function handleMachineCommand() {
879
891
  }
880
892
  await machineShare(machineId, { add, remove, list, configPath, showConfig });
881
893
  } else if (machineSubcommand === "exec") {
882
- const { machineExec } = await import('./commands-CgirOjun.mjs');
894
+ const { machineExec } = await import('./commands-BO8gl_-u.mjs');
883
895
  let machineId;
884
896
  let cwd;
885
897
  const cmdParts = [];
@@ -899,7 +911,7 @@ async function handleMachineCommand() {
899
911
  }
900
912
  await machineExec(machineId, command, cwd);
901
913
  } else if (machineSubcommand === "info") {
902
- const { machineInfo } = await import('./commands-CgirOjun.mjs');
914
+ const { machineInfo } = await import('./commands-BO8gl_-u.mjs');
903
915
  let machineId;
904
916
  for (let i = 1; i < machineArgs.length; i++) {
905
917
  if ((machineArgs[i] === "--machine" || machineArgs[i] === "-m") && i + 1 < machineArgs.length) {
@@ -919,10 +931,10 @@ async function handleMachineCommand() {
919
931
  level = machineArgs[++i];
920
932
  }
921
933
  }
922
- const { machineNotify } = await import('./agentCommands-CcvaE6am.mjs');
934
+ const { machineNotify } = await import('./agentCommands-CVmNxFdC.mjs');
923
935
  await machineNotify(message, level);
924
936
  } else if (machineSubcommand === "ls") {
925
- const { machineLs } = await import('./commands-CgirOjun.mjs');
937
+ const { machineLs } = await import('./commands-BO8gl_-u.mjs');
926
938
  let machineId;
927
939
  let showHidden = false;
928
940
  let path;
@@ -1317,7 +1329,9 @@ Commands:
1317
1329
  svamp session messages <id> Show message history (--last N, --json, --raw)
1318
1330
  svamp session info <id> Show session status & pending permissions
1319
1331
  svamp session list List sessions
1320
- svamp session stop <id> Stop a session
1332
+ svamp session archive <id> Archive a session (preserves history, resumable later)
1333
+ svamp session resume <id> Resume an archived session
1334
+ svamp session delete <id> Permanently delete a session (cannot be undone)
1321
1335
  svamp session attach <id> Attach interactive terminal (stdin/stdout)
1322
1336
  svamp session approve/deny <id> Approve or deny pending permission requests
1323
1337
  svamp session --help Show ALL session commands and detailed options
@@ -1389,7 +1403,7 @@ async function applyClaudeAuthFlags(argv) {
1389
1403
  "--use-hypha-proxy, --use-claude-login, and --anthropic-base-url/--anthropic-api-key are mutually exclusive"
1390
1404
  );
1391
1405
  }
1392
- const mod = await import('./run-EPzdDXeY.mjs').then(function (n) { return n.t; });
1406
+ const mod = await import('./run-DZq12r28.mjs').then(function (n) { return n.t; });
1393
1407
  if (hasHypha) {
1394
1408
  mod.setClaudeAuthHyphaProxy();
1395
1409
  console.log("Claude auth configured: hypha-proxy (uses HYPHA_TOKEN live at each spawn).");
@@ -1427,7 +1441,7 @@ async function applyDaemonShareFlag(argv) {
1427
1441
  }
1428
1442
  }
1429
1443
  if (collected.length === 0) return;
1430
- const { updateEnvFile } = await import('./run-EPzdDXeY.mjs').then(function (n) { return n.t; });
1444
+ const { updateEnvFile } = await import('./run-DZq12r28.mjs').then(function (n) { return n.t; });
1431
1445
  const seen = /* @__PURE__ */ new Set();
1432
1446
  const deduped = collected.filter((e) => {
1433
1447
  const k = e.toLowerCase();
@@ -1440,7 +1454,7 @@ async function applyDaemonShareFlag(argv) {
1440
1454
  }
1441
1455
  async function handleDaemonAuthCommand(argv) {
1442
1456
  const sub = (argv[0] || "status").toLowerCase();
1443
- const mod = await import('./run-EPzdDXeY.mjs').then(function (n) { return n.t; });
1457
+ const mod = await import('./run-DZq12r28.mjs').then(function (n) { return n.t; });
1444
1458
  if (sub === "--help" || sub === "-h" || sub === "help") {
1445
1459
  console.log(`
1446
1460
  svamp daemon auth \u2014 Configure how Claude subprocesses authenticate
@@ -1513,7 +1527,8 @@ QUICK START \u2014 Spawn a session, give it a task, get results:
1513
1527
  # The command prints the session ID (e.g., "abc12345-..."). Use it to:
1514
1528
  svamp session messages abc1 --last 10 # read output (prefix match on ID)
1515
1529
  svamp session send abc1 "now run lint" --wait # send follow-up, wait for done
1516
- svamp session stop abc1 # stop when finished
1530
+ svamp session archive abc1 # archive when finished (resumable)
1531
+ svamp session resume abc1 # bring an archived session back
1517
1532
 
1518
1533
  # Spawn on a remote/cloud machine:
1519
1534
  svamp session spawn claude -d /workspace -m cloud-box --message "deploy" --wait
@@ -1530,7 +1545,9 @@ COMMANDS:
1530
1545
 
1531
1546
  Lifecycle:
1532
1547
  spawn <agent> [-d <path>] [options] Spawn a new agent session
1533
- stop <id> Stop a running session
1548
+ archive <id> Archive a session (resumable; preserves --resume token)
1549
+ resume <id> Resume an archived session (spawns agent with --resume)
1550
+ delete <id> Permanently delete a session (cannot be undone)
1534
1551
  list [--active] [--json] List sessions (alias: ls)
1535
1552
  machines List discoverable machines
1536
1553
  info <id> [--json] Show status & pending permissions
@@ -68,7 +68,7 @@ async function serviceExpose(args) {
68
68
  });
69
69
  return;
70
70
  }
71
- const { connectAndGetMachine } = await import('./commands-CgirOjun.mjs');
71
+ const { connectAndGetMachine } = await import('./commands-BO8gl_-u.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-CgirOjun.mjs');
135
+ const { connectAndGetMachine } = await import('./commands-BO8gl_-u.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-CgirOjun.mjs');
164
+ const { connectAndGetMachine } = await import('./commands-BO8gl_-u.mjs');
165
165
  const { server, machine } = await connectAndGetMachine();
166
166
  try {
167
167
  await machine.tunnelStop({ name });
@@ -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-EPzdDXeY.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-DZq12r28.mjs';
6
6
  import 'os';
7
7
  import 'fs/promises';
8
8
  import 'fs';
@@ -83,7 +83,7 @@ const SESSION_RPC_PARAMS = {
83
83
  permissionResponse: ["params"],
84
84
  switchMode: ["mode"],
85
85
  restartClaude: [],
86
- killSession: [],
86
+ archiveSession: [],
87
87
  keepAlive: ["thinking", "mode"],
88
88
  sessionEnd: [],
89
89
  getActivityState: [],
@@ -1033,14 +1033,42 @@ async function sessionSpawn(agent, directory, machineId, opts) {
1033
1033
  await server.disconnect();
1034
1034
  }
1035
1035
  }
1036
- async function sessionStop(sessionId, machineId) {
1036
+ async function sessionArchive(sessionId, machineId) {
1037
1037
  const { server, machine, fullId } = await connectAndResolveSession(sessionId, machineId);
1038
1038
  try {
1039
- const success = await machine.stopSession(fullId);
1039
+ const success = await machine.archiveSession(fullId);
1040
1040
  if (success) {
1041
- console.log(`Session ${fullId.slice(0, 8)} stopped.`);
1041
+ console.log(`Session ${fullId.slice(0, 8)} archived. Run \`svamp session resume ${fullId.slice(0, 8)}\` to bring it back.`);
1042
1042
  } else {
1043
- console.error("Failed to stop session (not found on daemon).");
1043
+ console.error("Failed to archive session (not found on daemon).");
1044
+ process.exit(1);
1045
+ }
1046
+ } finally {
1047
+ await server.disconnect();
1048
+ }
1049
+ }
1050
+ async function sessionResume(sessionId, machineId) {
1051
+ const { server, machine, fullId } = await connectAndResolveSession(sessionId, machineId);
1052
+ try {
1053
+ const result = await machine.resumeSession(fullId);
1054
+ if (result?.success) {
1055
+ console.log(`Session ${fullId.slice(0, 8)} resumed.`);
1056
+ } else {
1057
+ console.error(`Failed to resume session: ${result?.message || "unknown error"}`);
1058
+ process.exit(1);
1059
+ }
1060
+ } finally {
1061
+ await server.disconnect();
1062
+ }
1063
+ }
1064
+ async function sessionDelete(sessionId, machineId) {
1065
+ const { server, machine, fullId } = await connectAndResolveSession(sessionId, machineId);
1066
+ try {
1067
+ const success = await machine.deleteSession(fullId);
1068
+ if (success) {
1069
+ console.log(`Session ${fullId.slice(0, 8)} deleted.`);
1070
+ } else {
1071
+ console.error("Failed to delete session.");
1044
1072
  process.exit(1);
1045
1073
  }
1046
1074
  } finally {
@@ -1284,12 +1312,12 @@ async function sessionAttach(sessionId, machineId) {
1284
1312
  process.stdout.write("> ");
1285
1313
  return;
1286
1314
  }
1287
- if (trimmed === "/kill") {
1315
+ if (trimmed === "/archive") {
1288
1316
  try {
1289
- await svc.killSession();
1290
- console.log("Session killed.");
1317
+ await svc.archiveSession();
1318
+ console.log("Session archived. Run `svamp session resume <id>` to bring it back.");
1291
1319
  } catch (err) {
1292
- console.error(`Kill failed: ${err.message}`);
1320
+ console.error(`Archive failed: ${err.message}`);
1293
1321
  }
1294
1322
  rl.close();
1295
1323
  await server.disconnect();
@@ -1896,4 +1924,4 @@ async function sessionInboxClear(sessionIdPartial, machineId, opts) {
1896
1924
  }
1897
1925
  }
1898
1926
 
1899
- export { connectAndGetMachine, connectAndResolveSession, createWorktree, generateWorktreeName, machineExec, machineInfo, machineLs, machineShare, parseShareArg, renderMessage, resolveSessionId, sessionApprove, sessionAttach, sessionDeny, sessionInboxClear, sessionInboxList, sessionInboxRead, sessionInboxReply, sessionInboxSend, sessionInfo, sessionList, sessionMachines, sessionMessages, sessionRalphCancel, sessionRalphStart, sessionRalphStatus, sessionSend, sessionShare, sessionSpawn, sessionStop, sessionWait };
1927
+ export { connectAndGetMachine, connectAndResolveSession, createWorktree, generateWorktreeName, machineExec, machineInfo, machineLs, machineShare, parseShareArg, renderMessage, resolveSessionId, sessionApprove, sessionArchive, sessionAttach, sessionDelete, sessionDeny, sessionInboxClear, sessionInboxList, sessionInboxRead, sessionInboxReply, sessionInboxSend, sessionInfo, sessionList, sessionMachines, sessionMessages, sessionRalphCancel, sessionRalphStart, sessionRalphStatus, sessionResume, sessionSend, sessionShare, sessionSpawn, sessionWait };
@@ -1,11 +1,11 @@
1
1
  import { writeFileSync, readFileSync } from 'fs';
2
2
  import { resolve } from 'path';
3
- import { connectAndGetMachine } from './commands-CgirOjun.mjs';
3
+ import { connectAndGetMachine } from './commands-BO8gl_-u.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-EPzdDXeY.mjs';
8
+ import './run-DZq12r28.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-EPzdDXeY.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-DZq12r28.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.65";
2
+ var version = "0.2.67";
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";
@@ -24,6 +24,7 @@ var scripts = {
24
24
  dev: "tsx src/cli.ts",
25
25
  "dev:daemon": "tsx src/cli.ts daemon start-sync",
26
26
  "test:e2e": "node --no-warnings test/e2e-session-tests.mjs",
27
+ "test:archive-resume": "node --no-warnings test/test-session-archive-resume.mjs",
27
28
  "test:frpc": "npx tsx test/test-frpc-e2e.mjs"
28
29
  };
29
30
  var dependencies = {
@@ -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-EPzdDXeY.mjs';
5
+ import { c as connectToHypha, a as registerSessionService, k as generateHookSettings } from './run-DZq12r28.mjs';
6
6
  import { createServer } from 'node:http';
7
7
  import { spawn } from 'node:child_process';
8
8
  import { createInterface } from 'node:readline';
@@ -684,8 +684,8 @@ async function runInteractive(options) {
684
684
  log("[hypha] Restart requested");
685
685
  return { success: false, message: "Restart not supported in interactive mode" };
686
686
  },
687
- onKillSession: async () => {
688
- log("[hypha] Kill requested");
687
+ onArchiveSession: async () => {
688
+ log("[hypha] Archive requested");
689
689
  await cleanup();
690
690
  process.exit(0);
691
691
  },
@@ -754,12 +754,36 @@ async function registerMachineService(server, machineId, metadata, daemonState,
754
754
  }
755
755
  return result;
756
756
  },
757
- // Stop a session
758
- stopSession: async (sessionId, context) => {
757
+ // Archive a session (non-destructive — preserves claudeResumeId for resume)
758
+ archiveSession: async (sessionId, context) => {
759
759
  authorizeRequest(context, currentMetadata.sharing, "admin");
760
- const result = handlers.stopSession(sessionId);
760
+ const result = handlers.archiveSession(sessionId);
761
761
  notifyListeners({
762
- type: "session-stopped",
762
+ type: "session-archived",
763
+ sessionId,
764
+ machineId
765
+ });
766
+ return result;
767
+ },
768
+ // Resume an archived session (spawns the agent with --resume <claudeResumeId>)
769
+ resumeSession: async (sessionId, context) => {
770
+ authorizeRequest(context, currentMetadata.sharing, "admin");
771
+ const result = await handlers.resumeSession(sessionId);
772
+ if (result.success) {
773
+ notifyListeners({
774
+ type: "session-resumed",
775
+ sessionId,
776
+ machineId
777
+ });
778
+ }
779
+ return result;
780
+ },
781
+ // Permanently delete a session (wipes session.json + messages.jsonl + .svamp/{id}/)
782
+ deleteSession: async (sessionId, context) => {
783
+ authorizeRequest(context, currentMetadata.sharing, "admin");
784
+ const result = handlers.deleteSession(sessionId);
785
+ notifyListeners({
786
+ type: "session-deleted",
763
787
  sessionId,
764
788
  machineId
765
789
  });
@@ -1960,9 +1984,9 @@ function createSessionStore(server, sessionId, initialMetadata, initialAgentStat
1960
1984
  authorizeRequest(context, metadata.sharing, "admin");
1961
1985
  return await callbacks.onRestartClaude();
1962
1986
  },
1963
- killSession: async (context) => {
1987
+ archiveSession: async (context) => {
1964
1988
  authorizeRequest(context, metadata.sharing, "admin");
1965
- callbacks.onKillSession();
1989
+ callbacks.onArchiveSession();
1966
1990
  return { success: true };
1967
1991
  },
1968
1992
  // ── Activity ──
@@ -7454,6 +7478,43 @@ function deletePersistedSession(sessionId) {
7454
7478
  saveSessionIndex(index);
7455
7479
  }
7456
7480
  }
7481
+ function markSessionAsArchived(sessionId) {
7482
+ const index = loadSessionIndex();
7483
+ const entry = index[sessionId];
7484
+ if (!entry) return false;
7485
+ const filePath = getSessionFilePath(entry.directory, sessionId);
7486
+ if (!existsSync$1(filePath)) return false;
7487
+ try {
7488
+ const data = JSON.parse(readFileSync$1(filePath, "utf-8"));
7489
+ if (data.stopped === true) return true;
7490
+ data.stopped = true;
7491
+ const tmpPath = filePath + ".tmp";
7492
+ writeFileSync(tmpPath, JSON.stringify(data, null, 2), "utf-8");
7493
+ renameSync(tmpPath, filePath);
7494
+ return true;
7495
+ } catch {
7496
+ return false;
7497
+ }
7498
+ }
7499
+ function clearSessionArchivedFlag(sessionId) {
7500
+ const index = loadSessionIndex();
7501
+ const entry = index[sessionId];
7502
+ if (!entry) return null;
7503
+ const filePath = getSessionFilePath(entry.directory, sessionId);
7504
+ if (!existsSync$1(filePath)) return null;
7505
+ try {
7506
+ const data = JSON.parse(readFileSync$1(filePath, "utf-8"));
7507
+ if (data.stopped) {
7508
+ delete data.stopped;
7509
+ const tmpPath = filePath + ".tmp";
7510
+ writeFileSync(tmpPath, JSON.stringify(data, null, 2), "utf-8");
7511
+ renameSync(tmpPath, filePath);
7512
+ }
7513
+ return data;
7514
+ } catch {
7515
+ return null;
7516
+ }
7517
+ }
7457
7518
  function loadPersistedSessions() {
7458
7519
  const sessions = [];
7459
7520
  const index = loadSessionIndex();
@@ -7755,7 +7816,7 @@ async function startDaemon(options) {
7755
7816
  const list = loadExposedTunnels().filter((t) => t.name !== name);
7756
7817
  saveExposedTunnels(list);
7757
7818
  }
7758
- const { ServeManager } = await import('./serveManager-pDviHaH8.mjs');
7819
+ const { ServeManager } = await import('./serveManager-D4f3wiSO.mjs');
7759
7820
  const serveManager = new ServeManager(SVAMP_HOME, (msg) => logger.log(`[SERVE] ${msg}`), hyphaServerUrl);
7760
7821
  ensureAutoInstalledSkills(logger).catch(() => {
7761
7822
  });
@@ -7940,6 +8001,7 @@ async function startDaemon(options) {
7940
8001
  startedFromDaemon: true,
7941
8002
  startedBy: "daemon",
7942
8003
  lifecycleState: resumeSessionId ? "idle" : "starting",
8004
+ ...resumeSessionId && { claudeSessionId: resumeSessionId },
7943
8005
  sharing: options2.sharing,
7944
8006
  securityContext: options2.securityContext,
7945
8007
  tags: options2.tags,
@@ -8655,7 +8717,16 @@ The automated loop has finished. Review the progress above and let me know if yo
8655
8717
  artifactSync.scheduleDebouncedSync(sessionId, getSessionDir(directory, sessionId), sessionMetadata, machineId);
8656
8718
  }
8657
8719
  if (isResumeFailure) {
8658
- logger.log(`[Session ${sessionId}] Resume failed \u2014 Claude started fresh session (tried: ${persisted?.claudeResumeId ?? "unknown"}, got: ${msg.session_id})`);
8720
+ const triedId = persisted?.claudeResumeId ?? "unknown";
8721
+ logger.log(`[Session ${sessionId}] Resume failed \u2014 Claude started fresh session (tried: ${triedId}, got: ${msg.session_id})`);
8722
+ sessionService.pushMessage(
8723
+ {
8724
+ type: "message",
8725
+ message: `Resume incomplete \u2014 Claude could not restore the previous conversation. A new Claude session was started (expected ${triedId.slice(0, 8)}\u2026, got ${msg.session_id.slice(0, 8)}\u2026). Earlier messages remain in the history above for reference, but Claude does not have them in its context.`,
8726
+ level: "warning"
8727
+ },
8728
+ "event"
8729
+ );
8659
8730
  } else if (isConversationClear) {
8660
8731
  logger.log(`[Session ${sessionId}] Conversation cleared (/clear) \u2014 new Claude session: ${msg.session_id}`);
8661
8732
  sessionService.clearMessages();
@@ -9111,9 +9182,9 @@ The automated loop has finished. Review the progress above and let me know if yo
9111
9182
  lastSpawnMeta = { ...lastSpawnMeta, appendSystemPrompt: prompt };
9112
9183
  return await restartClaudeHandler();
9113
9184
  },
9114
- onKillSession: () => {
9115
- logger.log(`[Session ${sessionId}] Kill session requested`);
9116
- stopSession(sessionId);
9185
+ onArchiveSession: () => {
9186
+ logger.log(`[Session ${sessionId}] Archive session requested`);
9187
+ archiveSession(sessionId);
9117
9188
  },
9118
9189
  onInboxMessage: (message) => {
9119
9190
  if (trackedSession?.stopped) return;
@@ -9582,9 +9653,9 @@ The automated loop has finished. Review the progress above and let me know if yo
9582
9653
  onApplySystemPrompt: async () => {
9583
9654
  return { success: false, message: "System prompt updates with restart are not yet supported for this agent type." };
9584
9655
  },
9585
- onKillSession: () => {
9586
- logger.log(`[${agentName} Session ${sessionId}] Kill session requested`);
9587
- stopSession(sessionId);
9656
+ onArchiveSession: () => {
9657
+ logger.log(`[${agentName} Session ${sessionId}] Archive session requested`);
9658
+ archiveSession(sessionId);
9588
9659
  },
9589
9660
  onInboxMessage: (message) => {
9590
9661
  if (acpStopped) return;
@@ -10040,7 +10111,7 @@ The automated loop has finished. Review the progress above and let me know if yo
10040
10111
  "event"
10041
10112
  );
10042
10113
  sessionService.sendSessionEnd();
10043
- stopSession(sessionId);
10114
+ deleteSession(sessionId);
10044
10115
  });
10045
10116
  return {
10046
10117
  type: "success",
@@ -10055,8 +10126,7 @@ The automated loop has finished. Review the progress above and let me know if yo
10055
10126
  };
10056
10127
  }
10057
10128
  };
10058
- const stopSession = (sessionId) => {
10059
- logger.log(`Stopping session: ${sessionId}`);
10129
+ const teardownTrackedSession = (sessionId) => {
10060
10130
  for (const [pid, session] of pidToTrackedSession) {
10061
10131
  if (session.svampSessionId === sessionId) {
10062
10132
  session.stopped = true;
@@ -10075,16 +10145,64 @@ The automated loop has finished. Review the progress above and let me know if yo
10075
10145
  session.cleanupSvampConfig?.();
10076
10146
  artifactSync.cancelSync(sessionId);
10077
10147
  pidToTrackedSession.delete(pid);
10078
- deletePersistedSession(sessionId);
10079
- logger.log(`Session ${sessionId} stopped`);
10080
10148
  return true;
10081
10149
  }
10082
10150
  }
10083
10151
  artifactSync.cancelSync(sessionId);
10084
- deletePersistedSession(sessionId);
10085
- logger.log(`Session ${sessionId} not found in memory, cleaned up persisted state`);
10086
10152
  return false;
10087
10153
  };
10154
+ const archiveSession = (sessionId) => {
10155
+ logger.log(`Archiving session: ${sessionId}`);
10156
+ const wasInMemory = teardownTrackedSession(sessionId);
10157
+ const markedArchived = markSessionAsArchived(sessionId);
10158
+ if (wasInMemory || markedArchived) {
10159
+ logger.log(`Session ${sessionId} archived (inMemory=${wasInMemory}, persisted=${markedArchived})`);
10160
+ return true;
10161
+ }
10162
+ logger.log(`Session ${sessionId} not found in memory or on disk; nothing to archive`);
10163
+ return false;
10164
+ };
10165
+ const resumeSession = async (sessionId) => {
10166
+ logger.log(`Resuming session: ${sessionId}`);
10167
+ for (const session of pidToTrackedSession.values()) {
10168
+ if (session.svampSessionId === sessionId && !session.stopped) {
10169
+ logger.log(`Session ${sessionId} already running \u2014 resume is a no-op`);
10170
+ return { success: true, sessionId, message: "Session is already running" };
10171
+ }
10172
+ }
10173
+ const persisted = clearSessionArchivedFlag(sessionId);
10174
+ if (!persisted) {
10175
+ return { success: false, message: `Session ${sessionId} has no persisted record to resume` };
10176
+ }
10177
+ try {
10178
+ const result = await spawnSession({
10179
+ directory: persisted.directory,
10180
+ sessionId: persisted.sessionId,
10181
+ resumeSessionId: persisted.claudeResumeId,
10182
+ sharing: persisted.metadata?.sharing,
10183
+ securityContext: persisted.metadata?.securityContext,
10184
+ forceIsolation: !!persisted.metadata?.isolationMethod,
10185
+ parentSessionId: persisted.metadata?.parentSessionId,
10186
+ permissionMode: persisted.permissionMode
10187
+ });
10188
+ if (result.type === "success") {
10189
+ logger.log(`Resumed session ${sessionId} (claudeResumeId=${persisted.claudeResumeId || "none"})`);
10190
+ return { success: true, sessionId: result.sessionId };
10191
+ }
10192
+ markSessionAsArchived(sessionId);
10193
+ return { success: false, message: result.errorMessage || `spawnSession returned ${result.type}` };
10194
+ } catch (err) {
10195
+ markSessionAsArchived(sessionId);
10196
+ return { success: false, message: err.message };
10197
+ }
10198
+ };
10199
+ const deleteSession = (sessionId) => {
10200
+ logger.log(`Deleting session: ${sessionId}`);
10201
+ teardownTrackedSession(sessionId);
10202
+ deletePersistedSession(sessionId);
10203
+ logger.log(`Session ${sessionId} deleted`);
10204
+ return true;
10205
+ };
10088
10206
  const restartSession = async (sessionId) => {
10089
10207
  for (const session of pidToTrackedSession.values()) {
10090
10208
  if (session.svampSessionId === sessionId && !session.stopped) {
@@ -10162,7 +10280,9 @@ The automated loop has finished. Review the progress above and let me know if yo
10162
10280
  initialDaemonState,
10163
10281
  {
10164
10282
  spawnSession,
10165
- stopSession,
10283
+ archiveSession,
10284
+ resumeSession,
10285
+ deleteSession,
10166
10286
  restartSession,
10167
10287
  requestShutdown: () => {
10168
10288
  logger.log("Shutdown requested via hypha-app (ignored \u2014 daemon never self-terminates)");
@@ -54,7 +54,7 @@ async function handleServeCommand() {
54
54
  }
55
55
  }
56
56
  async function serveAdd(args, machineId) {
57
- const { connectAndGetMachine } = await import('./commands-CgirOjun.mjs');
57
+ const { connectAndGetMachine } = await import('./commands-BO8gl_-u.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-CgirOjun.mjs');
96
+ const { connectAndGetMachine } = await import('./commands-BO8gl_-u.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-CgirOjun.mjs');
185
+ const { connectAndGetMachine } = await import('./commands-BO8gl_-u.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-CgirOjun.mjs');
205
+ const { connectAndGetMachine } = await import('./commands-BO8gl_-u.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-CgirOjun.mjs');
238
+ const { connectAndGetMachine } = await import('./commands-BO8gl_-u.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-EPzdDXeY.mjs';
7
+ import { S as ServeAuth, h as hasCookieToken } from './run-DZq12r28.mjs';
8
8
  import 'os';
9
9
  import 'fs/promises';
10
10
  import 'url';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svamp-cli",
3
- "version": "0.2.65",
3
+ "version": "0.2.67",
4
4
  "description": "Svamp CLI — AI workspace daemon on Hypha Cloud",
5
5
  "author": "Amun AI AB",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -25,6 +25,7 @@
25
25
  "dev": "tsx src/cli.ts",
26
26
  "dev:daemon": "tsx src/cli.ts daemon start-sync",
27
27
  "test:e2e": "node --no-warnings test/e2e-session-tests.mjs",
28
+ "test:archive-resume": "node --no-warnings test/test-session-archive-resume.mjs",
28
29
  "test:frpc": "npx tsx test/test-frpc-e2e.mjs"
29
30
  },
30
31
  "dependencies": {