svamp-cli 0.2.246 → 0.2.247

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.
Files changed (25) hide show
  1. package/dist/{agentCommands-wOdV4Do1.mjs → agentCommands-DOzMhE_G.mjs} +5 -5
  2. package/dist/{auth-Bg0Z_bP-.mjs → auth-B_ZnoKX0.mjs} +1 -1
  3. package/dist/cli.mjs +82 -68
  4. package/dist/{commands-CkduYG4a.mjs → commands-BENx03Oz.mjs} +2 -2
  5. package/dist/{commands-Z8Ki8iA9.mjs → commands-Bm5q9G35.mjs} +1 -1
  6. package/dist/{commands-D9khoYtI.mjs → commands-C2u9U3y6.mjs} +2 -2
  7. package/dist/{commands-CniwP5Tm.mjs → commands-CxOPcoWa.mjs} +1 -1
  8. package/dist/{commands-CudvGpEz.mjs → commands-F6j9TF4Q.mjs} +6 -6
  9. package/dist/{commands-Bi_LZXPe.mjs → commands-_rMwFmFH.mjs} +1 -1
  10. package/dist/{commands-BhLGBhBS.mjs → commands-vCeWXvYJ.mjs} +1 -1
  11. package/dist/{fleet-DCMPBC7b.mjs → fleet-pMXCRilx.mjs} +12 -4
  12. package/dist/{frpc-nvGz8fWs.mjs → frpc-Di-y4cWK.mjs} +1 -1
  13. package/dist/{headlessCli-d6XjdG6n.mjs → headlessCli-D6k9Pnum.mjs} +2 -2
  14. package/dist/index.mjs +1 -1
  15. package/dist/{package-CUTX-CB-.mjs → package-BJYmQjS2.mjs} +2 -2
  16. package/dist/{rpc-s_Hibfpl.mjs → rpc-BncvIQMO.mjs} +1 -1
  17. package/dist/{rpc-CDI7i151.mjs → rpc-DbY7NUhj.mjs} +2 -2
  18. package/dist/{run-BPZ_1RCI.mjs → run-1BBi0_ol.mjs} +94 -10
  19. package/dist/{run-DRR6psuh.mjs → run-CYx_Rhiu.mjs} +1 -1
  20. package/dist/{runStore-DKC_bMSi.mjs → runStore-C5IyfbON.mjs} +1 -1
  21. package/dist/{scheduler-E1Bw4HUY.mjs → scheduler-BkXOKjHn.mjs} +2 -2
  22. package/dist/{serveCommands-Af_7qqzA.mjs → serveCommands-CESRU6-1.mjs} +5 -5
  23. package/dist/{serveManager-DGRpRAFM.mjs → serveManager-BZtpClpC.mjs} +2 -2
  24. package/dist/{sideband-C-0cCNeL.mjs → sideband-BqD4-WWR.mjs} +1 -1
  25. package/package.json +2 -2
@@ -2,7 +2,7 @@ import { existsSync, readFileSync, mkdirSync, writeFileSync, renameSync } from '
2
2
  import { join, dirname } from 'node:path';
3
3
  import os from 'node:os';
4
4
  import { requireNotSandboxed } from './sandboxDetect-DNTcbgWD.mjs';
5
- import { A as shortId } from './run-BPZ_1RCI.mjs';
5
+ import { A as shortId } from './run-1BBi0_ol.mjs';
6
6
  import 'os';
7
7
  import 'fs/promises';
8
8
  import 'fs';
@@ -96,7 +96,7 @@ async function sessionSetTitle(title) {
96
96
  }
97
97
  async function sessionSetProjectDescription(description) {
98
98
  const dir = process.cwd();
99
- const { projectName, writeProjectInfo, sanitizeDescription, projectInfoPath } = await import('./run-BPZ_1RCI.mjs').then(function (n) { return n.a9; });
99
+ const { projectName, writeProjectInfo, sanitizeDescription, projectInfoPath } = await import('./run-1BBi0_ol.mjs').then(function (n) { return n.a9; });
100
100
  const desc = sanitizeDescription(description, 240);
101
101
  if (!desc) {
102
102
  console.error("Project description is empty.");
@@ -327,7 +327,7 @@ async function sessionBroadcast(action, args) {
327
327
  console.log(`Broadcast sent: ${action}`);
328
328
  }
329
329
  async function connectToMachineService() {
330
- const { connectAndGetMachine } = await import('./commands-BhLGBhBS.mjs');
330
+ const { connectAndGetMachine } = await import('./commands-vCeWXvYJ.mjs');
331
331
  return connectAndGetMachine();
332
332
  }
333
333
  function buildInboxMessage(args) {
@@ -405,7 +405,7 @@ async function inboxSend(targetSessionId, opts) {
405
405
  console.error("Message body is required.");
406
406
  process.exit(1);
407
407
  }
408
- const { connectAndResolveSession } = await import('./commands-BhLGBhBS.mjs');
408
+ const { connectAndResolveSession } = await import('./commands-vCeWXvYJ.mjs');
409
409
  let server;
410
410
  try {
411
411
  const { targetId, messageId } = await inboxSendCore(
@@ -459,7 +459,7 @@ async function inboxReply(messageId, body) {
459
459
  console.error("SVAMP_SESSION_ID not set. This command must be run inside a Svamp session.");
460
460
  process.exit(1);
461
461
  }
462
- const { connectAndResolveSession } = await import('./commands-BhLGBhBS.mjs');
462
+ const { connectAndResolveSession } = await import('./commands-vCeWXvYJ.mjs');
463
463
  const { server: localServer, machine: localMachine } = await connectToMachineService();
464
464
  let localDisconnected = false;
465
465
  const disconnectLocal = async () => {
@@ -1,4 +1,4 @@
1
- import { P as resolveModel } from './run-BPZ_1RCI.mjs';
1
+ import { P as resolveModel } from './run-1BBi0_ol.mjs';
2
2
  import 'os';
3
3
  import 'fs/promises';
4
4
  import 'fs';
package/dist/cli.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { e as clearStopMarker, f as stopMarkerExists, s as startDaemon, b as stopDaemon, d as daemonStatus } from './run-BPZ_1RCI.mjs';
1
+ import { e as clearStopMarker, f as stopMarkerExists, s as startDaemon, b as stopDaemon, d as daemonStatus } from './run-1BBi0_ol.mjs';
2
2
  import { ensureSupervisorViaServiceManager, LAUNCHD_LABEL } from './serviceManager-hlOVxkhW.mjs';
3
3
  import 'os';
4
4
  import 'fs/promises';
@@ -34,7 +34,7 @@ const subcommand = args[0];
34
34
  let daemonSubcommand = args[1];
35
35
  async function main() {
36
36
  try {
37
- const { getLoadedConfig } = await import('./run-BPZ_1RCI.mjs').then(function (n) { return n.af; });
37
+ const { getLoadedConfig } = await import('./run-1BBi0_ol.mjs').then(function (n) { return n.af; });
38
38
  getLoadedConfig();
39
39
  } catch {
40
40
  }
@@ -51,8 +51,18 @@ async function main() {
51
51
  console.error(`svamp daemon restart: ${err.message || err}`);
52
52
  process.exit(1);
53
53
  }
54
- const { restartDaemon } = await import('./run-BPZ_1RCI.mjs').then(function (n) { return n.ah; });
55
- await restartDaemon();
54
+ const whenIdle = args.includes("--when-idle");
55
+ const force = args.includes("--force");
56
+ const mod = await import('./run-1BBi0_ol.mjs').then(function (n) { return n.ah; });
57
+ if (whenIdle && !force) {
58
+ if (mod.isDaemonAlive()) {
59
+ mod.writePendingRestart({ reason: "svamp daemon restart --when-idle" });
60
+ console.log("\u2713 Scheduled a graceful restart \u2014 the daemon will restart when no session is actively thinking (max wait 1h).");
61
+ process.exit(0);
62
+ }
63
+ console.log("Daemon not running \u2014 restarting immediately.");
64
+ }
65
+ await mod.restartDaemon();
56
66
  process.exit(0);
57
67
  }
58
68
  if (daemonSubcommand === "start") {
@@ -344,7 +354,7 @@ async function main() {
344
354
  console.error("svamp service: Service commands are not available in sandboxed sessions.");
345
355
  process.exit(1);
346
356
  }
347
- const { handleServiceCommand } = await import('./commands-CudvGpEz.mjs');
357
+ const { handleServiceCommand } = await import('./commands-F6j9TF4Q.mjs');
348
358
  await handleServiceCommand();
349
359
  } else if (subcommand === "serve") {
350
360
  const { isSandboxed: isSandboxedServe } = await import('./sandboxDetect-DNTcbgWD.mjs');
@@ -352,7 +362,7 @@ async function main() {
352
362
  console.error("svamp serve: Serve commands are not available in sandboxed sessions.");
353
363
  process.exit(1);
354
364
  }
355
- const { handleServeCommand } = await import('./serveCommands-Af_7qqzA.mjs');
365
+ const { handleServeCommand } = await import('./serveCommands-CESRU6-1.mjs');
356
366
  await handleServeCommand();
357
367
  process.exit(0);
358
368
  } else if (subcommand === "process" || subcommand === "proc") {
@@ -361,7 +371,7 @@ async function main() {
361
371
  console.error("svamp process: Process commands are not available in sandboxed sessions.");
362
372
  process.exit(1);
363
373
  }
364
- const { processCommand } = await import('./commands-CkduYG4a.mjs');
374
+ const { processCommand } = await import('./commands-BENx03Oz.mjs');
365
375
  let machineId;
366
376
  const processArgs = args.slice(1);
367
377
  const mIdx = processArgs.findIndex((a) => a === "--machine" || a === "-m");
@@ -375,18 +385,18 @@ async function main() {
375
385
  }), machineId);
376
386
  process.exit(0);
377
387
  } else if (subcommand === "issue" || subcommand === "issues") {
378
- const { issueCommand } = await import('./commands-Bi_LZXPe.mjs');
388
+ const { issueCommand } = await import('./commands-_rMwFmFH.mjs');
379
389
  await issueCommand(args.slice(1));
380
390
  process.exit(0);
381
391
  } else if (subcommand === "workflow" || subcommand === "workflows") {
382
- const { workflowCommand } = await import('./commands-CniwP5Tm.mjs');
392
+ const { workflowCommand } = await import('./commands-CxOPcoWa.mjs');
383
393
  await workflowCommand(args.slice(1));
384
394
  process.exit(0);
385
395
  } else if (subcommand === "wise-agent" || subcommand === "wise") {
386
396
  await handleWiseAgentCommand(args.slice(1));
387
397
  process.exit(0);
388
398
  } else if (subcommand === "feature" || subcommand === "crew") {
389
- const { crewCommand } = await import('./commands-D9khoYtI.mjs');
399
+ const { crewCommand } = await import('./commands-C2u9U3y6.mjs');
390
400
  await crewCommand(args.slice(1));
391
401
  process.exit(0);
392
402
  } else if (subcommand === "--help" || subcommand === "-h") {
@@ -394,7 +404,7 @@ async function main() {
394
404
  } else if (!subcommand || subcommand === "start") {
395
405
  await handleInteractiveCommand();
396
406
  } else if (subcommand === "--version" || subcommand === "-v") {
397
- const pkg = await import('./package-CUTX-CB-.mjs').catch(() => ({ default: { version: "unknown" } }));
407
+ const pkg = await import('./package-BJYmQjS2.mjs').catch(() => ({ default: { version: "unknown" } }));
398
408
  console.log(`svamp version: ${pkg.default.version}`);
399
409
  } else {
400
410
  console.error(`Unknown command: ${subcommand}`);
@@ -403,7 +413,7 @@ async function main() {
403
413
  }
404
414
  }
405
415
  async function handleInteractiveCommand() {
406
- const { runInteractive } = await import('./run-DRR6psuh.mjs');
416
+ const { runInteractive } = await import('./run-CYx_Rhiu.mjs');
407
417
  const interactiveArgs = subcommand === "start" ? args.slice(1) : args;
408
418
  let directory = process.cwd();
409
419
  let resumeSessionId;
@@ -448,7 +458,7 @@ async function handleAgentCommand() {
448
458
  return;
449
459
  }
450
460
  if (agentArgs[0] === "list") {
451
- const { KNOWN_ACP_AGENTS, KNOWN_MCP_AGENTS: KNOWN_MCP_AGENTS2 } = await import('./run-BPZ_1RCI.mjs').then(function (n) { return n.ac; });
461
+ const { KNOWN_ACP_AGENTS, KNOWN_MCP_AGENTS: KNOWN_MCP_AGENTS2 } = await import('./run-1BBi0_ol.mjs').then(function (n) { return n.ac; });
452
462
  console.log("Known agents:");
453
463
  for (const [name, config2] of Object.entries(KNOWN_ACP_AGENTS)) {
454
464
  console.log(` ${name.padEnd(12)} ${config2.command} ${config2.args.join(" ")} (ACP)`);
@@ -460,7 +470,7 @@ async function handleAgentCommand() {
460
470
  console.log('Use "svamp agent -- <command> [args]" for a custom ACP agent.');
461
471
  return;
462
472
  }
463
- const { resolveAcpAgentConfig, KNOWN_MCP_AGENTS } = await import('./run-BPZ_1RCI.mjs').then(function (n) { return n.ac; });
473
+ const { resolveAcpAgentConfig, KNOWN_MCP_AGENTS } = await import('./run-1BBi0_ol.mjs').then(function (n) { return n.ac; });
464
474
  let cwd = process.cwd();
465
475
  const filteredArgs = [];
466
476
  for (let i = 0; i < agentArgs.length; i++) {
@@ -484,12 +494,12 @@ async function handleAgentCommand() {
484
494
  console.log(`Starting ${config.agentName} agent in ${cwd}...`);
485
495
  let backend;
486
496
  if (KNOWN_MCP_AGENTS[config.agentName]) {
487
- const { CodexMcpBackend } = await import('./run-BPZ_1RCI.mjs').then(function (n) { return n.ad; });
497
+ const { CodexMcpBackend } = await import('./run-1BBi0_ol.mjs').then(function (n) { return n.ad; });
488
498
  backend = new CodexMcpBackend({ cwd, log: logFn });
489
499
  } else {
490
- const { AcpBackend } = await import('./run-BPZ_1RCI.mjs').then(function (n) { return n.ab; });
491
- const { GeminiTransport } = await import('./run-BPZ_1RCI.mjs').then(function (n) { return n.ae; });
492
- const { DefaultTransport } = await import('./run-BPZ_1RCI.mjs').then(function (n) { return n.aa; });
500
+ const { AcpBackend } = await import('./run-1BBi0_ol.mjs').then(function (n) { return n.ab; });
501
+ const { GeminiTransport } = await import('./run-1BBi0_ol.mjs').then(function (n) { return n.ae; });
502
+ const { DefaultTransport } = await import('./run-1BBi0_ol.mjs').then(function (n) { return n.aa; });
493
503
  const transportHandler = config.agentName === "gemini" ? new GeminiTransport() : new DefaultTransport(config.agentName);
494
504
  backend = new AcpBackend({
495
505
  agentName: config.agentName,
@@ -616,7 +626,7 @@ async function handleSessionCommand() {
616
626
  process.exit(1);
617
627
  }
618
628
  }
619
- const { sessionList, sessionWhoami, sessionSpawn, sessionArchive, sessionResume, sessionDelete, sessionInfo, sessionMessages, sessionAttach, sessionMachines, sessionSend, sessionWait, sessionShare, sessionLoopStart, sessionLoopCancel, sessionLoopStatus, sessionInboxSend, sessionInboxList, sessionInboxRead, sessionInboxReply, sessionInboxClear } = await import('./commands-BhLGBhBS.mjs');
629
+ const { sessionList, sessionWhoami, sessionSpawn, sessionArchive, sessionResume, sessionDelete, sessionInfo, sessionMessages, sessionAttach, sessionMachines, sessionSend, sessionWait, sessionShare, sessionLoopStart, sessionLoopCancel, sessionLoopStatus, sessionInboxSend, sessionInboxList, sessionInboxRead, sessionInboxReply, sessionInboxClear } = await import('./commands-vCeWXvYJ.mjs');
620
630
  const parseFlagStr = (flag, shortFlag) => {
621
631
  for (let i = 1; i < sessionArgs.length; i++) {
622
632
  if ((sessionArgs[i] === flag || shortFlag) && i + 1 < sessionArgs.length) {
@@ -684,7 +694,7 @@ async function handleSessionCommand() {
684
694
  allowDomain.push(sessionArgs[++i]);
685
695
  }
686
696
  }
687
- const { parseShareArg } = await import('./commands-BhLGBhBS.mjs');
697
+ const { parseShareArg } = await import('./commands-vCeWXvYJ.mjs');
688
698
  const shareEntries = share.map((s) => parseShareArg(s));
689
699
  await sessionSpawn(agent, dir, targetMachineId, {
690
700
  message,
@@ -772,7 +782,7 @@ async function handleSessionCommand() {
772
782
  console.error(" Rewinds history: rewrites the message + drops everything after it, then restarts Claude.");
773
783
  process.exit(1);
774
784
  }
775
- const { sessionEditMessage } = await import('./commands-BhLGBhBS.mjs');
785
+ const { sessionEditMessage } = await import('./commands-vCeWXvYJ.mjs');
776
786
  await sessionEditMessage(sessionArgs[1], sessionArgs[2], sessionArgs[3], targetMachineId);
777
787
  } else if (sessionSubcommand === "refine") {
778
788
  if (!sessionArgs[1] || !sessionArgs[2]) {
@@ -780,7 +790,7 @@ async function handleSessionCommand() {
780
790
  console.error(" Asks the agent to revise its latest reply in place (no extra round).");
781
791
  process.exit(1);
782
792
  }
783
- const { sessionRefineLastReply } = await import('./commands-BhLGBhBS.mjs');
793
+ const { sessionRefineLastReply } = await import('./commands-vCeWXvYJ.mjs');
784
794
  await sessionRefineLastReply(sessionArgs[1], sessionArgs[2], targetMachineId);
785
795
  } else if (sessionSubcommand === "undo-edit" || sessionSubcommand === "undo") {
786
796
  if (!sessionArgs[1]) {
@@ -788,7 +798,7 @@ async function handleSessionCommand() {
788
798
  console.error(" Reverts the most recent edit/refine, restoring the pre-edit history.");
789
799
  process.exit(1);
790
800
  }
791
- const { sessionUndoEdit } = await import('./commands-BhLGBhBS.mjs');
801
+ const { sessionUndoEdit } = await import('./commands-vCeWXvYJ.mjs');
792
802
  await sessionUndoEdit(sessionArgs[1], targetMachineId);
793
803
  } else if (sessionSubcommand === "query") {
794
804
  const dir = sessionArgs[1];
@@ -798,7 +808,7 @@ async function handleSessionCommand() {
798
808
  console.error(" Spawns a stateless Claude session in <directory>, sends <prompt>, prints the answer, then deletes the session.");
799
809
  process.exit(1);
800
810
  }
801
- const { sessionQuery } = await import('./commands-BhLGBhBS.mjs');
811
+ const { sessionQuery } = await import('./commands-vCeWXvYJ.mjs');
802
812
  await sessionQuery(dir, prompt, targetMachineId, {
803
813
  timeout: parseFlagInt("--timeout"),
804
814
  json: hasFlag("--json"),
@@ -831,7 +841,7 @@ async function handleSessionCommand() {
831
841
  console.error("Usage: svamp session approve <session-id> [request-id] [--json]");
832
842
  process.exit(1);
833
843
  }
834
- const { sessionApprove } = await import('./commands-BhLGBhBS.mjs');
844
+ const { sessionApprove } = await import('./commands-vCeWXvYJ.mjs');
835
845
  const approveReqId = sessionArgs[2] && !sessionArgs[2].startsWith("--") ? sessionArgs[2] : void 0;
836
846
  await sessionApprove(sessionArgs[1], approveReqId, targetMachineId, {
837
847
  json: hasFlag("--json")
@@ -841,7 +851,7 @@ async function handleSessionCommand() {
841
851
  console.error("Usage: svamp session deny <session-id> [request-id] [--json]");
842
852
  process.exit(1);
843
853
  }
844
- const { sessionDeny } = await import('./commands-BhLGBhBS.mjs');
854
+ const { sessionDeny } = await import('./commands-vCeWXvYJ.mjs');
845
855
  const denyReqId = sessionArgs[2] && !sessionArgs[2].startsWith("--") ? sessionArgs[2] : void 0;
846
856
  await sessionDeny(sessionArgs[1], denyReqId, targetMachineId, {
847
857
  json: hasFlag("--json")
@@ -886,7 +896,7 @@ async function handleSessionCommand() {
886
896
  console.error("Usage: svamp session set-title <title>");
887
897
  process.exit(1);
888
898
  }
889
- const { sessionSetTitle } = await import('./agentCommands-wOdV4Do1.mjs');
899
+ const { sessionSetTitle } = await import('./agentCommands-DOzMhE_G.mjs');
890
900
  await sessionSetTitle(title);
891
901
  } else if (sessionSubcommand === "set-project-description" || sessionSubcommand === "set-project") {
892
902
  const desc = sessionArgs.slice(1).filter((a) => !a.startsWith("--")).join(" ");
@@ -894,7 +904,7 @@ async function handleSessionCommand() {
894
904
  console.error("Usage: svamp session set-project-description <text>");
895
905
  process.exit(1);
896
906
  }
897
- const { sessionSetProjectDescription } = await import('./agentCommands-wOdV4Do1.mjs');
907
+ const { sessionSetProjectDescription } = await import('./agentCommands-DOzMhE_G.mjs');
898
908
  await sessionSetProjectDescription(desc);
899
909
  } else if (sessionSubcommand === "set-link") {
900
910
  const url = sessionArgs[1];
@@ -903,11 +913,11 @@ async function handleSessionCommand() {
903
913
  process.exit(1);
904
914
  }
905
915
  const label = sessionArgs[2] && !sessionArgs[2].startsWith("--") ? sessionArgs[2] : void 0;
906
- const { sessionSetLink } = await import('./agentCommands-wOdV4Do1.mjs');
916
+ const { sessionSetLink } = await import('./agentCommands-DOzMhE_G.mjs');
907
917
  await sessionSetLink(url, label);
908
918
  } else if (sessionSubcommand === "link") {
909
919
  const op = sessionArgs[1];
910
- const lm = await import('./agentCommands-wOdV4Do1.mjs');
920
+ const lm = await import('./agentCommands-DOzMhE_G.mjs');
911
921
  if (op === "add") {
912
922
  const url = sessionArgs[2];
913
923
  if (!url || url.startsWith("--")) {
@@ -942,7 +952,7 @@ async function handleSessionCommand() {
942
952
  process.exit(1);
943
953
  }
944
954
  const level = parseFlagStr("--level") || "info";
945
- const { sessionNotify } = await import('./agentCommands-wOdV4Do1.mjs');
955
+ const { sessionNotify } = await import('./agentCommands-DOzMhE_G.mjs');
946
956
  await sessionNotify(message, level);
947
957
  } else if (sessionSubcommand === "broadcast") {
948
958
  const action = sessionArgs[1];
@@ -950,7 +960,7 @@ async function handleSessionCommand() {
950
960
  console.error("Usage: svamp session broadcast <action> [args...]\nActions: open-canvas <url> [label], close-canvas, toast <message>");
951
961
  process.exit(1);
952
962
  }
953
- const { sessionBroadcast } = await import('./agentCommands-wOdV4Do1.mjs');
963
+ const { sessionBroadcast } = await import('./agentCommands-DOzMhE_G.mjs');
954
964
  await sessionBroadcast(action, sessionArgs.slice(2).filter((a) => !a.startsWith("--")));
955
965
  } else if (sessionSubcommand === "inbox") {
956
966
  const inboxSubcmd = sessionArgs[1];
@@ -961,7 +971,7 @@ async function handleSessionCommand() {
961
971
  process.exit(1);
962
972
  }
963
973
  if (agentSessionId) {
964
- const { inboxSend } = await import('./agentCommands-wOdV4Do1.mjs');
974
+ const { inboxSend } = await import('./agentCommands-DOzMhE_G.mjs');
965
975
  await inboxSend(sessionArgs[2], {
966
976
  body: sessionArgs[3],
967
977
  subject: parseFlagStr("--subject"),
@@ -976,7 +986,7 @@ async function handleSessionCommand() {
976
986
  }
977
987
  } else if (inboxSubcmd === "list" || inboxSubcmd === "ls") {
978
988
  if (agentSessionId && !sessionArgs[2]) {
979
- const { inboxList } = await import('./agentCommands-wOdV4Do1.mjs');
989
+ const { inboxList } = await import('./agentCommands-DOzMhE_G.mjs');
980
990
  await inboxList({
981
991
  unread: hasFlag("--unread"),
982
992
  limit: parseFlagInt("--limit"),
@@ -998,7 +1008,7 @@ async function handleSessionCommand() {
998
1008
  process.exit(1);
999
1009
  }
1000
1010
  if (agentSessionId && !sessionArgs[3]) {
1001
- const { inboxList } = await import('./agentCommands-wOdV4Do1.mjs');
1011
+ const { inboxList } = await import('./agentCommands-DOzMhE_G.mjs');
1002
1012
  await sessionInboxRead(agentSessionId, sessionArgs[2], targetMachineId);
1003
1013
  } else if (sessionArgs[3]) {
1004
1014
  await sessionInboxRead(sessionArgs[2], sessionArgs[3], targetMachineId);
@@ -1008,7 +1018,7 @@ async function handleSessionCommand() {
1008
1018
  }
1009
1019
  } else if (inboxSubcmd === "reply") {
1010
1020
  if (agentSessionId && sessionArgs[2] && sessionArgs[3] && !sessionArgs[4]) {
1011
- const { inboxReply } = await import('./agentCommands-wOdV4Do1.mjs');
1021
+ const { inboxReply } = await import('./agentCommands-DOzMhE_G.mjs');
1012
1022
  await inboxReply(sessionArgs[2], sessionArgs[3]);
1013
1023
  } else if (sessionArgs[2] && sessionArgs[3] && sessionArgs[4]) {
1014
1024
  await sessionInboxReply(sessionArgs[2], sessionArgs[3], sessionArgs[4], targetMachineId);
@@ -1046,7 +1056,7 @@ async function handleMachineCommand() {
1046
1056
  return;
1047
1057
  }
1048
1058
  if (machineSubcommand === "share") {
1049
- const { machineShare } = await import('./commands-BhLGBhBS.mjs');
1059
+ const { machineShare } = await import('./commands-vCeWXvYJ.mjs');
1050
1060
  let machineId;
1051
1061
  const shareArgs = [];
1052
1062
  for (let i = 1; i < machineArgs.length; i++) {
@@ -1097,14 +1107,14 @@ async function handleMachineCommand() {
1097
1107
  process.exit(1);
1098
1108
  }
1099
1109
  if (all) {
1100
- const { fleetExec } = await import('./fleet-DCMPBC7b.mjs');
1110
+ const { fleetExec } = await import('./fleet-pMXCRilx.mjs');
1101
1111
  await fleetExec(command, { cwd });
1102
1112
  } else {
1103
- const { machineExec } = await import('./commands-BhLGBhBS.mjs');
1113
+ const { machineExec } = await import('./commands-vCeWXvYJ.mjs');
1104
1114
  await machineExec(machineId, command, cwd);
1105
1115
  }
1106
1116
  } else if (machineSubcommand === "info") {
1107
- const { machineInfo } = await import('./commands-BhLGBhBS.mjs');
1117
+ const { machineInfo } = await import('./commands-vCeWXvYJ.mjs');
1108
1118
  let machineId;
1109
1119
  for (let i = 1; i < machineArgs.length; i++) {
1110
1120
  if ((machineArgs[i] === "--machine" || machineArgs[i] === "-m") && i + 1 < machineArgs.length) {
@@ -1124,10 +1134,10 @@ async function handleMachineCommand() {
1124
1134
  level = machineArgs[++i];
1125
1135
  }
1126
1136
  }
1127
- const { machineNotify } = await import('./agentCommands-wOdV4Do1.mjs');
1137
+ const { machineNotify } = await import('./agentCommands-DOzMhE_G.mjs');
1128
1138
  await machineNotify(message, level);
1129
1139
  } else if (machineSubcommand === "ls") {
1130
- const { machineLs } = await import('./commands-BhLGBhBS.mjs');
1140
+ const { machineLs } = await import('./commands-vCeWXvYJ.mjs');
1131
1141
  let machineId;
1132
1142
  let showHidden = false;
1133
1143
  let path;
@@ -1157,10 +1167,13 @@ async function handleFleetCommand() {
1157
1167
  Subcommands (fan out across every machine in your workspace):
1158
1168
  status Show svamp + claude-code version per machine
1159
1169
  upgrade-claude [-v X] Install Claude Code (defaults to svamp-cli's pinned version)
1160
- upgrade-svamp [-v X] [--exclude-self]
1161
- npm install -g svamp-cli@X + svamp daemon restart
1162
- (--exclude-self skips this machine to avoid
1163
- interrupting the current session)
1170
+ upgrade-svamp [-v X] [--exclude-self] [--force]
1171
+ npm install -g svamp-cli@X, then restart each daemon.
1172
+ DEFAULT is graceful: each daemon restarts itself only
1173
+ when it has no actively-thinking session (never cuts an
1174
+ in-flight turn; 1h max-wait backstop). --force restarts
1175
+ immediately. --exclude-self skips this machine.
1176
+ (First roll onto a graceful-capable build needs --force.)
1164
1177
  daemon-restart [--cleanup] Restart daemons (default graceful)
1165
1178
  push-skill <name> Install/force-refresh a skill on all machines
1166
1179
 
@@ -1183,20 +1196,20 @@ Examples:
1183
1196
  };
1184
1197
  const hasFlag = (name) => fleetArgs.includes(`--${name}`);
1185
1198
  if (sub === "status") {
1186
- const { fleetStatus } = await import('./fleet-DCMPBC7b.mjs');
1199
+ const { fleetStatus } = await import('./fleet-pMXCRilx.mjs');
1187
1200
  await fleetStatus();
1188
1201
  } else if (sub === "upgrade-claude") {
1189
- const { fleetUpgradeClaude } = await import('./fleet-DCMPBC7b.mjs');
1202
+ const { fleetUpgradeClaude } = await import('./fleet-pMXCRilx.mjs');
1190
1203
  await fleetUpgradeClaude({ version: flag("version", "-v") });
1191
1204
  } else if (sub === "upgrade-svamp") {
1192
- const { fleetUpgradeSvamp } = await import('./fleet-DCMPBC7b.mjs');
1193
- await fleetUpgradeSvamp({ version: flag("version", "-v"), excludeSelf: hasFlag("exclude-self") });
1205
+ const { fleetUpgradeSvamp } = await import('./fleet-pMXCRilx.mjs');
1206
+ await fleetUpgradeSvamp({ version: flag("version", "-v"), excludeSelf: hasFlag("exclude-self"), force: hasFlag("force") });
1194
1207
  } else if (sub === "daemon-restart") {
1195
- const { fleetDaemonRestart } = await import('./fleet-DCMPBC7b.mjs');
1208
+ const { fleetDaemonRestart } = await import('./fleet-pMXCRilx.mjs');
1196
1209
  await fleetDaemonRestart({ graceful: !hasFlag("cleanup") });
1197
1210
  } else if (sub === "push-skill") {
1198
1211
  const name = fleetArgs[1];
1199
- const { fleetPushSkill } = await import('./fleet-DCMPBC7b.mjs');
1212
+ const { fleetPushSkill } = await import('./fleet-pMXCRilx.mjs');
1200
1213
  await fleetPushSkill(name);
1201
1214
  } else {
1202
1215
  console.error(`Unknown fleet subcommand: ${sub}`);
@@ -1212,7 +1225,7 @@ async function handleSkillsCommand() {
1212
1225
  await printSkillsHelp();
1213
1226
  return;
1214
1227
  }
1215
- const { skillsFind, skillsInstall, skillsList, skillsRemove, skillsPublish } = await import('./commands-Z8Ki8iA9.mjs');
1228
+ const { skillsFind, skillsInstall, skillsList, skillsRemove, skillsPublish } = await import('./commands-Bm5q9G35.mjs');
1216
1229
  if (skillsSubcommand === "find" || skillsSubcommand === "search") {
1217
1230
  const query = skillsArgs.slice(1).filter((a) => !a.startsWith("--")).join(" ");
1218
1231
  if (!query) {
@@ -1259,7 +1272,7 @@ async function loginToHypha() {
1259
1272
  process.exit(1);
1260
1273
  }
1261
1274
  const anchor = anchorArg.replace(/\/+$/, "");
1262
- const { loadInstanceConfig } = await import('./run-BPZ_1RCI.mjs').then(function (n) { return n.af; });
1275
+ const { loadInstanceConfig } = await import('./run-1BBi0_ol.mjs').then(function (n) { return n.af; });
1263
1276
  let cfg = null;
1264
1277
  try {
1265
1278
  cfg = await loadInstanceConfig({ anchor, force: true });
@@ -1370,7 +1383,7 @@ async function logoutFromHypha() {
1370
1383
  } catch {
1371
1384
  }
1372
1385
  try {
1373
- const { clearInstanceConfigCache } = await import('./run-BPZ_1RCI.mjs').then(function (n) { return n.af; });
1386
+ const { clearInstanceConfigCache } = await import('./run-1BBi0_ol.mjs').then(function (n) { return n.af; });
1374
1387
  clearInstanceConfigCache();
1375
1388
  } catch {
1376
1389
  }
@@ -1672,7 +1685,8 @@ Usage:
1672
1685
  svamp daemon start --no-auto-continue Start without auto-continuing interrupted sessions
1673
1686
  svamp daemon stop Stop the daemon (sessions preserved for restart)
1674
1687
  svamp daemon stop --cleanup Stop and mark all sessions as stopped
1675
- svamp daemon restart Graceful restart \u2014 picks up new binary, sessions resume seamlessly
1688
+ svamp daemon restart Restart now \u2014 picks up new binary, sessions resume seamlessly
1689
+ svamp daemon restart --when-idle Restart only once no session is actively thinking (deferred; 1h max-wait)
1676
1690
  svamp daemon status Show daemon status
1677
1691
  svamp daemon install Install as login service (macOS/Linux) \u2014 auto-start at login
1678
1692
  svamp daemon uninstall Remove login service
@@ -1708,7 +1722,7 @@ async function applyClaudeAuthFlags(argv) {
1708
1722
  "--use-hypha-proxy, --use-claude-login, and --anthropic-base-url/--anthropic-api-key are mutually exclusive"
1709
1723
  );
1710
1724
  }
1711
- const mod = await import('./run-BPZ_1RCI.mjs').then(function (n) { return n.a8; });
1725
+ const mod = await import('./run-1BBi0_ol.mjs').then(function (n) { return n.a8; });
1712
1726
  if (hasHypha) {
1713
1727
  let url;
1714
1728
  const hyphaIdx = argv.indexOf("--use-hypha-proxy");
@@ -1762,7 +1776,7 @@ async function applyDaemonShareFlag(argv) {
1762
1776
  }
1763
1777
  }
1764
1778
  if (collected.length === 0) return;
1765
- const { updateEnvFile } = await import('./run-BPZ_1RCI.mjs').then(function (n) { return n.a8; });
1779
+ const { updateEnvFile } = await import('./run-1BBi0_ol.mjs').then(function (n) { return n.a8; });
1766
1780
  const seen = /* @__PURE__ */ new Set();
1767
1781
  const deduped = collected.filter((e) => {
1768
1782
  const k = e.toLowerCase();
@@ -1795,7 +1809,7 @@ async function handleWiseAgentCommand(rest) {
1795
1809
  }
1796
1810
  });
1797
1811
  const message = rest.slice(1).map((a, idx) => ({ a, idx: idx + 1 })).filter(({ a, idx }) => !a.startsWith("-") && !consumed.has(String(idx))).map(({ a }) => a).join(" ");
1798
- const { wiseAskCli } = await import('./commands-BhLGBhBS.mjs');
1812
+ const { wiseAskCli } = await import('./commands-vCeWXvYJ.mjs');
1799
1813
  await wiseAskCli(machineId, message, sessionId, { json });
1800
1814
  return;
1801
1815
  }
@@ -1807,7 +1821,7 @@ async function handleWiseAgentCommand(rest) {
1807
1821
  }
1808
1822
  return void 0;
1809
1823
  };
1810
- const { runWiseVoiceCli } = await import('./headlessCli-d6XjdG6n.mjs');
1824
+ const { runWiseVoiceCli } = await import('./headlessCli-D6k9Pnum.mjs');
1811
1825
  await runWiseVoiceCli({ voice: valueOf(["--voice"]), wakeKeywordPath: valueOf(["--wake"]), model: valueOf(["--model"]) });
1812
1826
  return;
1813
1827
  }
@@ -1825,7 +1839,7 @@ async function handleWiseAgentCommand(rest) {
1825
1839
  const mode = valueOf(["--mode"]);
1826
1840
  const mission = valueOf(["--mission"]);
1827
1841
  const url = rest.slice(1).find((a) => /^https?:\/\//.test(a)) || "";
1828
- const { wiseJoinMeetingCli } = await import('./commands-BhLGBhBS.mjs');
1842
+ const { wiseJoinMeetingCli } = await import('./commands-vCeWXvYJ.mjs');
1829
1843
  await wiseJoinMeetingCli(machineId, url, sessionId, { json, mode, mission });
1830
1844
  return;
1831
1845
  }
@@ -1837,7 +1851,7 @@ async function handleWiseAgentCommand(rest) {
1837
1851
  }
1838
1852
  return void 0;
1839
1853
  };
1840
- const { wiseLeaveMeetingCli } = await import('./commands-BhLGBhBS.mjs');
1854
+ const { wiseLeaveMeetingCli } = await import('./commands-vCeWXvYJ.mjs');
1841
1855
  await wiseLeaveMeetingCli(valueOf(["--machine", "-m"]), valueOf(["--session", "-s"]), { json: rest.includes("--json") });
1842
1856
  return;
1843
1857
  }
@@ -1861,7 +1875,7 @@ async function handleWiseAgentCommand(rest) {
1861
1875
  }
1862
1876
  });
1863
1877
  const text = rest.slice(1).map((a, idx) => ({ a, idx: idx + 1 })).filter(({ a, idx }) => !a.startsWith("-") && !consumed.has(String(idx))).map(({ a }) => a).join(" ");
1864
- const { wiseAnnounceCli } = await import('./commands-BhLGBhBS.mjs');
1878
+ const { wiseAnnounceCli } = await import('./commands-vCeWXvYJ.mjs');
1865
1879
  await wiseAnnounceCli(machineId, text, sessionId, { json });
1866
1880
  return;
1867
1881
  }
@@ -1873,7 +1887,7 @@ async function handleWiseAgentCommand(rest) {
1873
1887
  }
1874
1888
  return void 0;
1875
1889
  };
1876
- const { wiseMeetingsCli } = await import('./commands-BhLGBhBS.mjs');
1890
+ const { wiseMeetingsCli } = await import('./commands-vCeWXvYJ.mjs');
1877
1891
  await wiseMeetingsCli(valueOf(["--machine", "-m"]), { json: rest.includes("--json") });
1878
1892
  return;
1879
1893
  }
@@ -1923,7 +1937,7 @@ If none is set, hitting a WISE Agent channel returns a clear "not configured" er
1923
1937
  return;
1924
1938
  }
1925
1939
  const authArgs = rest.slice(1);
1926
- const mod = await import('./auth-Bg0Z_bP-.mjs');
1940
+ const mod = await import('./auth-B_ZnoKX0.mjs');
1927
1941
  let action;
1928
1942
  try {
1929
1943
  action = mod.parseWiseAgentAuthArgs(authArgs);
@@ -1933,7 +1947,7 @@ If none is set, hitting a WISE Agent channel returns a clear "not configured" er
1933
1947
  return;
1934
1948
  }
1935
1949
  if (action) {
1936
- const { updateEnvFile } = await import('./run-BPZ_1RCI.mjs').then(function (n) { return n.a8; });
1950
+ const { updateEnvFile } = await import('./run-1BBi0_ol.mjs').then(function (n) { return n.a8; });
1937
1951
  const updates = mod.buildWiseAgentEnvUpdates(action);
1938
1952
  updateEnvFile(updates);
1939
1953
  for (const [k, v] of Object.entries(updates)) {
@@ -1947,7 +1961,7 @@ If none is set, hitting a WISE Agent channel returns a clear "not configured" er
1947
1961
  }
1948
1962
  async function handleDaemonAuthCommand(argv) {
1949
1963
  const sub = (argv[0] || "status").toLowerCase();
1950
- const mod = await import('./run-BPZ_1RCI.mjs').then(function (n) { return n.a8; });
1964
+ const mod = await import('./run-1BBi0_ol.mjs').then(function (n) { return n.a8; });
1951
1965
  if (sub === "--help" || sub === "-h" || sub === "help") {
1952
1966
  console.log(`
1953
1967
  svamp daemon auth \u2014 Configure how Claude subprocesses authenticate
@@ -2261,7 +2275,7 @@ Examples:
2261
2275
  async function printSkillsHelp() {
2262
2276
  let browseUrl = "<HYPHA_SERVER_URL>/<workspace>/artifacts/marketplace (set HYPHA_SERVER_URL)";
2263
2277
  try {
2264
- const { getArtifactBaseUrl, getSkillsCollectionName } = await import('./run-BPZ_1RCI.mjs').then(function (n) { return n.ag; });
2278
+ const { getArtifactBaseUrl, getSkillsCollectionName } = await import('./run-1BBi0_ol.mjs').then(function (n) { return n.ag; });
2265
2279
  browseUrl = `${getArtifactBaseUrl()}/${getSkillsCollectionName()}`;
2266
2280
  } catch {
2267
2281
  }
@@ -1,11 +1,11 @@
1
1
  import { writeFileSync, readFileSync } from 'fs';
2
2
  import { resolve } from 'path';
3
- import { connectAndGetMachine } from './commands-BhLGBhBS.mjs';
3
+ import { connectAndGetMachine } from './commands-vCeWXvYJ.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-BPZ_1RCI.mjs';
8
+ import './run-1BBi0_ol.mjs';
9
9
  import 'os';
10
10
  import 'fs/promises';
11
11
  import 'url';
@@ -1,7 +1,7 @@
1
1
  import os from 'os';
2
2
  import fs__default from 'fs';
3
3
  import { resolve, join, relative } from 'path';
4
- import { F as parseFrontmatter, G as getSkillsServer, H as getSkillsWorkspaceName, I as getSkillsCollectionName, J as fetchWithTimeout, K as searchSkills, L as SKILLS_DIR, M as getSkillInfo, N as downloadSkillFile, O as listSkillFiles } from './run-BPZ_1RCI.mjs';
4
+ import { F as parseFrontmatter, G as getSkillsServer, H as getSkillsWorkspaceName, I as getSkillsCollectionName, J as fetchWithTimeout, K as searchSkills, L as SKILLS_DIR, M as getSkillInfo, N as downloadSkillFile, O as listSkillFiles } from './run-1BBi0_ol.mjs';
5
5
  import 'fs/promises';
6
6
  import 'url';
7
7
  import 'child_process';
@@ -1,8 +1,8 @@
1
1
  import { existsSync } from 'node:fs';
2
2
  import { resolve } from 'node:path';
3
- import { connectAndGetMachine, resolveSessionId, createWorktree, connectAndResolveSession } from './commands-BhLGBhBS.mjs';
3
+ import { connectAndGetMachine, resolveSessionId, createWorktree, connectAndResolveSession } from './commands-vCeWXvYJ.mjs';
4
4
  import { execSync } from 'node:child_process';
5
- import { u as updateIssue, q as addComment, t as addIssue, A as shortId } from './run-BPZ_1RCI.mjs';
5
+ import { u as updateIssue, q as addComment, t as addIssue, A as shortId } from './run-1BBi0_ol.mjs';
6
6
  import 'node:os';
7
7
  import 'os';
8
8
  import 'fs/promises';
@@ -1,5 +1,5 @@
1
1
  import { spawnSync } from 'node:child_process';
2
- import { m as resolveProjectRoot } from './run-BPZ_1RCI.mjs';
2
+ import { m as resolveProjectRoot } from './run-1BBi0_ol.mjs';
3
3
  import { c as workflowSteps, s as setWorkflowEnabled, i as isWorkflowEnabled, r as removeWorkflow, g as getWorkflow, l as listWorkflows, a as saveWorkflow, b as rawWorkflow } from './store-BTs0H_y0.mjs';
4
4
  import 'os';
5
5
  import 'fs/promises';
@@ -58,7 +58,7 @@ async function serviceExpose(args) {
58
58
  process.exit(1);
59
59
  }
60
60
  if (foreground) {
61
- const { runFrpcTunnel } = await import('./frpc-nvGz8fWs.mjs');
61
+ const { runFrpcTunnel } = await import('./frpc-Di-y4cWK.mjs');
62
62
  await runFrpcTunnel(name, ports, void 0, {
63
63
  group,
64
64
  groupKey,
@@ -68,7 +68,7 @@ async function serviceExpose(args) {
68
68
  });
69
69
  return;
70
70
  }
71
- const { connectAndGetMachine } = await import('./commands-BhLGBhBS.mjs');
71
+ const { connectAndGetMachine } = await import('./commands-vCeWXvYJ.mjs');
72
72
  const { server, machine } = await connectAndGetMachine();
73
73
  try {
74
74
  const status = await machine.tunnelStart({
@@ -90,7 +90,7 @@ async function serviceExpose(args) {
90
90
  console.log(` port ${port}: ${url}`);
91
91
  }
92
92
  if (process.env.SVAMP_SESSION_ID) {
93
- const { autoAddSessionLink } = await import('./agentCommands-wOdV4Do1.mjs');
93
+ const { autoAddSessionLink } = await import('./agentCommands-DOzMhE_G.mjs');
94
94
  let added = 0;
95
95
  for (const [port, url] of urlEntries) {
96
96
  const label = urlEntries.length > 1 ? `${name}:${port}` : name;
@@ -136,7 +136,7 @@ async function serviceServe(args) {
136
136
  };
137
137
  process.on("SIGINT", cleanup);
138
138
  process.on("SIGTERM", cleanup);
139
- const { runFrpcTunnel } = await import('./frpc-nvGz8fWs.mjs');
139
+ const { runFrpcTunnel } = await import('./frpc-Di-y4cWK.mjs');
140
140
  await runFrpcTunnel(name, [caddyPort]);
141
141
  } catch (err) {
142
142
  console.error(`Error serving directory: ${err.message}`);
@@ -145,7 +145,7 @@ async function serviceServe(args) {
145
145
  }
146
146
  async function serviceList(_args) {
147
147
  try {
148
- const { connectAndGetMachine } = await import('./commands-BhLGBhBS.mjs');
148
+ const { connectAndGetMachine } = await import('./commands-vCeWXvYJ.mjs');
149
149
  const { server, machine } = await connectAndGetMachine();
150
150
  try {
151
151
  const tunnels = await machine.tunnelList({});
@@ -185,7 +185,7 @@ async function serviceDelete(args) {
185
185
  process.exit(1);
186
186
  }
187
187
  try {
188
- const { connectAndGetMachine } = await import('./commands-BhLGBhBS.mjs');
188
+ const { connectAndGetMachine } = await import('./commands-vCeWXvYJ.mjs');
189
189
  const { server, machine } = await connectAndGetMachine();
190
190
  try {
191
191
  await machine.tunnelStop({ name });
@@ -1,7 +1,7 @@
1
1
  import { execSync } from 'node:child_process';
2
2
  import { existsSync, readFileSync } from 'node:fs';
3
3
  import { join } from 'node:path';
4
- import { m as resolveProjectRoot, w as searchIssues, v as listIssues, o as resumeIssue, p as pauseIssue, q as addComment, u as updateIssue, n as getIssue, x as isVisibleTo, z as summarize, t as addIssue } from './run-BPZ_1RCI.mjs';
4
+ import { m as resolveProjectRoot, w as searchIssues, v as listIssues, o as resumeIssue, p as pauseIssue, q as addComment, u as updateIssue, n as getIssue, x as isVisibleTo, z as summarize, t as addIssue } from './run-1BBi0_ol.mjs';
5
5
  import 'os';
6
6
  import 'fs/promises';
7
7
  import 'fs';
@@ -2,7 +2,7 @@ import { existsSync, readFileSync, writeFileSync } from 'node:fs';
2
2
  import { execSync } from 'node:child_process';
3
3
  import { basename, resolve, join, isAbsolute } from 'node:path';
4
4
  import os from 'node:os';
5
- import { Q as formatHandle, T as normalizeAllowedUser, U as loadSecurityContextConfig, V as resolveSecurityContext, W as buildSecurityContextFromFlags, X as mergeSecurityContexts, c as connectToHypha, Y as buildSessionShareUrl, Z as computeOutboundHop, A as shortId, _ as registerAwaitingReply, $ as buildMachineShareUrl, a0 as parseHandle, a1 as handleMatchesMetadata } from './run-BPZ_1RCI.mjs';
5
+ import { Q as formatHandle, T as normalizeAllowedUser, U as loadSecurityContextConfig, V as resolveSecurityContext, W as buildSecurityContextFromFlags, X as mergeSecurityContexts, c as connectToHypha, Y as buildSessionShareUrl, Z as computeOutboundHop, A as shortId, _ as registerAwaitingReply, $ as buildMachineShareUrl, a0 as parseHandle, a1 as handleMatchesMetadata } from './run-1BBi0_ol.mjs';
6
6
  import 'os';
7
7
  import 'fs/promises';
8
8
  import 'fs';
@@ -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-BPZ_1RCI.mjs';
4
+ import { c as connectToHypha } from './run-1BBi0_ol.mjs';
5
5
  import { PINNED_CLAUDE_CODE_VERSION } from './pinnedClaudeCode-ivV7xAp3.mjs';
6
6
  import 'os';
7
7
  import 'fs/promises';
@@ -259,12 +259,14 @@ async function fleetUpgradeSvamp(opts) {
259
259
  console.log("\u26A0 --exclude-self: could not determine this machine's ID (no local daemon state) \u2014 nothing excluded.");
260
260
  }
261
261
  const { targets, skipped } = partitionSelf(machines, selfId);
262
- console.log(`Upgrading svamp-cli to ${version} on ${targets.length} machine(s)${selfId ? ` (excluding self: ${selfId})` : ""}...
262
+ const restartCmd = opts?.force ? "svamp daemon restart" : "svamp daemon restart --when-idle";
263
+ const mode = opts?.force ? "force (immediate)" : "graceful (restart when idle)";
264
+ console.log(`Upgrading svamp-cli to ${version} on ${targets.length} machine(s)${selfId ? ` (excluding self: ${selfId})` : ""} \u2014 ${mode}...
263
265
  `);
264
266
  try {
265
267
  printHeader(["MACHINE ID", "LABEL", "STATE", "DETAIL"], [20, 24, 6, 60]);
266
268
  for (const m of skipped) printResultRow(m, "SKIP", 'self \u2014 restart separately with "svamp daemon restart"');
267
- const cmd = `bash -lc 'npm install -g svamp-cli@${version} 2>&1 | tail -5 && svamp daemon restart 2>&1 | tail -5'`;
269
+ const cmd = `bash -lc 'npm install -g svamp-cli@${version} 2>&1 | tail -5 && ${restartCmd} 2>&1 | tail -5'`;
268
270
  const rows = await fanOut(targets, async (m) => await m.rpc.bash(cmd, void 0));
269
271
  let failures = 0;
270
272
  for (const r of rows) {
@@ -279,7 +281,13 @@ async function fleetUpgradeSvamp(opts) {
279
281
  if (!ok) failures += 1;
280
282
  }
281
283
  console.log(`
282
- ${rows.length - failures}/${rows.length} machines upgraded.`);
284
+ ${rows.length - failures}/${rows.length} machines updated (new binary installed).`);
285
+ if (opts?.force) {
286
+ console.log("Daemons restarted immediately onto the new binary.");
287
+ } else {
288
+ console.log("Graceful mode: each daemon restarts itself once it has no actively-thinking session");
289
+ console.log("(new binary already installed; takes effect at that restart). Force now with --force.");
290
+ }
283
291
  console.log("Note: daemons will auto-converge Claude Code to the pinned version on restart.");
284
292
  if (failures > 0) process.exitCode = 1;
285
293
  } finally {
@@ -4,7 +4,7 @@ import { mkdirSync, writeFileSync, unlinkSync, existsSync, chmodSync, readFileSy
4
4
  import { join } from 'path';
5
5
  import { homedir, platform, arch } from 'os';
6
6
  import { randomUUID, createHash } from 'crypto';
7
- import { h as getFrpsSubdomainHost, i as getFrpsServerPort, j as getFrpsServerAddr } from './run-BPZ_1RCI.mjs';
7
+ import { h as getFrpsSubdomainHost, i as getFrpsServerPort, j as getFrpsServerAddr } from './run-1BBi0_ol.mjs';
8
8
  import 'fs/promises';
9
9
  import 'url';
10
10
  import 'node:crypto';
@@ -1,5 +1,5 @@
1
- import { P as resolveModel, a2 as describeMisconfiguration, a3 as buildMachineDeps } from './run-BPZ_1RCI.mjs';
2
- import { handleRealtimeEvent, initMachineVoiceSession } from './sideband-C-0cCNeL.mjs';
1
+ import { P as resolveModel, a2 as describeMisconfiguration, a3 as buildMachineDeps } from './run-1BBi0_ol.mjs';
2
+ import { handleRealtimeEvent, initMachineVoiceSession } from './sideband-BqD4-WWR.mjs';
3
3
  import { WebSocket } from 'ws';
4
4
  import { execSync, spawn } from 'child_process';
5
5
  import 'os';
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { c as connectToHypha, a as createSessionStore, d as daemonStatus, g as getHyphaServerUrl, r as registerMachineService, s as startDaemon, b as stopDaemon } from './run-BPZ_1RCI.mjs';
1
+ export { c as connectToHypha, a as createSessionStore, d as daemonStatus, g as getHyphaServerUrl, r as registerMachineService, s as startDaemon, b as stopDaemon } from './run-1BBi0_ol.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.246";
2
+ var version = "0.2.247";
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";
@@ -19,7 +19,7 @@ var exports$1 = {
19
19
  var scripts = {
20
20
  build: "rm -rf dist bin/skills bin/commands && mkdir -p bin/skills && cp -r ../../skills/artifact bin/skills/artifact && cp -r ../../skills/crew bin/skills/crew && cp -r ../../commands bin/commands && tsc --noEmit && pkgroll",
21
21
  typecheck: "tsc --noEmit",
22
- test: "npx tsx test/test-context-window.mjs && npx tsx test/test-ratelimit-retry.mjs && npx tsx test/test-instance-config.mjs && npx tsx test/test-authorize.mjs && npx tsx test/test-normalize-allowed-user.mjs && npx tsx test/test-share-url.mjs && npx tsx test/test-update-sharing-normalization.mjs && npx tsx test/test-sharing-notify-sync.mjs && npx tsx test/test-staged-homes-sweep.mjs && npx tsx test/test-session-helpers.mjs && npx tsx test/test-cli-routing.mjs && npx tsx test/test-security-context.mjs && npx tsx test/test-isolation-decision.mjs && npx tsx test/test-message-helpers.mjs && npx tsx test/test-agent-config.mjs && npx tsx test/test-wrap-command.mjs && npx tsx test/test-credential-staging.mjs && npx tsx test/test-claude-auth.mjs && npx tsx test/test-btw-proxy-env.mjs && npx tsx test/test-output-formatters.mjs && npx tsx test/test-inbox-guard.mjs && npx tsx test/test-auto-topic.mjs && npx tsx test/test-project-info.mjs && npx tsx test/test-agent-types.mjs && npx tsx test/test-transport.mjs && npx tsx test/test-session-update-handlers.mjs && npx tsx test/test-session-scanner.mjs && npx tsx test/test-hypha-client.mjs && npx tsx test/test-hook-settings.mjs && npx tsx test/test-session-service-logic.mjs && npx tsx test/test-daemon-persistence.mjs && npx tsx test/test-detect-isolation.mjs && npx tsx test/test-machine-service-logic.mjs && npx tsx test/test-interactive-helpers.mjs && npx tsx test/test-codex-backend.mjs && npx tsx test/test-acp-backend.mjs && npx tsx test/test-acp-bridge.mjs && npx tsx test/test-hook-server.mjs && npx tsx test/test-session-commands.mjs && npx tsx test/test-interactive-console.mjs && npx tsx test/test-session-messages.mjs && npx tsx test/test-session-send-query.mjs && npx tsx test/test-skills.mjs && npx tsx test/test-agent-grouping.mjs && npx tsx test/test-machine-list-directory.mjs && npx tsx test/test-service-commands.mjs && npx tsx test/test-supervisor.mjs && npx tsx test/test-supervisor-lock.mjs && node test/test-supervisor-restart.mjs && npx tsx test/test-clear-detection.mjs && npx tsx test/test-session-consolidation.mjs && npx tsx test/test-inbox-store.mjs && npx tsx test/test-inbox.mjs && npx tsx test/test-inbox-cross-machine.mjs && npx tsx test/test-issue-store.mjs && npx tsx test/test-issue-close-gate.mjs && npx tsx test/test-loop-verify.mjs && npx tsx test/test-issue-rpc.mjs && npx tsx test/test-issue-pause.mjs && npx tsx test/test-workflow-store.mjs && npx tsx test/test-workflow-rpc.mjs && npx tsx test/test-workflow-scheduler.mjs && npx tsx test/test-cron.mjs && npx tsx test/test-workflow-runs.mjs && npx tsx test/test-serve-link-subdomain.mjs && npx tsx test/test-short-id.mjs && npx tsx test/test-transcript-edit.mjs && npx tsx test/test-edit-history.mjs && npx tsx test/test-friendly-name.mjs && npx tsx test/test-session-rpc-dispatch.mjs && npx tsx test/test-sandbox-cli.mjs && npx tsx test/test-serve-manager.mjs && npx tsx test/test-serve-stability.mjs && npx tsx test/test-frpc-e2e.mjs --unit-only && npx tsx test/test-frpc-status.mjs && node test/pinnedClaudeCode.test.mjs && node test/fleet.test.mjs && npx tsx test/test-session-file.mjs && npx tsx test/test-channel-rpc.mjs && npx tsx test/test-wise-agent.mjs && npx tsx test/test-channel-agent.mjs && npx tsx test/test-channels-service.mjs && npx tsx test/test-hotreload-seam.mjs && npx tsx test/test-hot-reload.mjs && npx tsx test/test-hot-reload-live.mjs && npx tsx test/test-session-core.mjs && npx tsx test/test-channel-async-reply.mjs && npx tsx test/test-channel-binding.mjs && npx tsx test/test-channel-identity.mjs && npx tsx test/test-shared-session-identity.mjs && npx tsx test/test-wise-agent-auth.mjs && npx tsx test/test-channel-http.mjs && npx tsx test/test-channel-upload.mjs && npx tsx test/test-wise-voice.mjs && npx tsx test/test-wise-headless.mjs && npx tsx test/test-wise-machine.mjs && npx tsx test/test-crew-merge.mjs && npx tsx test/test-crew-verdict-routing.mjs && npx tsx test/test-crew-standalone.mjs && npx tsx test/test-session-links.mjs && npx tsx test/test-issue-loop-pause-guard.mjs && npx tsx test/test-artifact-guard.mjs",
22
+ test: "npx tsx test/test-context-window.mjs && npx tsx test/test-ratelimit-retry.mjs && npx tsx test/test-instance-config.mjs && npx tsx test/test-authorize.mjs && npx tsx test/test-normalize-allowed-user.mjs && npx tsx test/test-share-url.mjs && npx tsx test/test-update-sharing-normalization.mjs && npx tsx test/test-sharing-notify-sync.mjs && npx tsx test/test-staged-homes-sweep.mjs && npx tsx test/test-session-helpers.mjs && npx tsx test/test-cli-routing.mjs && npx tsx test/test-security-context.mjs && npx tsx test/test-isolation-decision.mjs && npx tsx test/test-message-helpers.mjs && npx tsx test/test-agent-config.mjs && npx tsx test/test-wrap-command.mjs && npx tsx test/test-credential-staging.mjs && npx tsx test/test-claude-auth.mjs && npx tsx test/test-btw-proxy-env.mjs && npx tsx test/test-output-formatters.mjs && npx tsx test/test-inbox-guard.mjs && npx tsx test/test-auto-topic.mjs && npx tsx test/test-project-info.mjs && npx tsx test/test-agent-types.mjs && npx tsx test/test-transport.mjs && npx tsx test/test-session-update-handlers.mjs && npx tsx test/test-session-scanner.mjs && npx tsx test/test-hypha-client.mjs && npx tsx test/test-hook-settings.mjs && npx tsx test/test-session-service-logic.mjs && npx tsx test/test-daemon-persistence.mjs && npx tsx test/test-detect-isolation.mjs && npx tsx test/test-machine-service-logic.mjs && npx tsx test/test-interactive-helpers.mjs && npx tsx test/test-codex-backend.mjs && npx tsx test/test-acp-backend.mjs && npx tsx test/test-acp-bridge.mjs && npx tsx test/test-hook-server.mjs && npx tsx test/test-session-commands.mjs && npx tsx test/test-interactive-console.mjs && npx tsx test/test-session-messages.mjs && npx tsx test/test-session-send-query.mjs && npx tsx test/test-skills.mjs && npx tsx test/test-agent-grouping.mjs && npx tsx test/test-machine-list-directory.mjs && npx tsx test/test-service-commands.mjs && npx tsx test/test-supervisor.mjs && npx tsx test/test-supervisor-lock.mjs && node test/test-supervisor-restart.mjs && npx tsx test/test-clear-detection.mjs && npx tsx test/test-session-consolidation.mjs && npx tsx test/test-inbox-store.mjs && npx tsx test/test-inbox.mjs && npx tsx test/test-inbox-cross-machine.mjs && npx tsx test/test-issue-store.mjs && npx tsx test/test-issue-close-gate.mjs && npx tsx test/test-loop-verify.mjs && npx tsx test/test-issue-rpc.mjs && npx tsx test/test-issue-pause.mjs && npx tsx test/test-workflow-store.mjs && npx tsx test/test-workflow-rpc.mjs && npx tsx test/test-workflow-scheduler.mjs && npx tsx test/test-cron.mjs && npx tsx test/test-workflow-runs.mjs && npx tsx test/test-serve-link-subdomain.mjs && npx tsx test/test-short-id.mjs && npx tsx test/test-transcript-edit.mjs && npx tsx test/test-edit-history.mjs && npx tsx test/test-friendly-name.mjs && npx tsx test/test-session-rpc-dispatch.mjs && npx tsx test/test-sandbox-cli.mjs && npx tsx test/test-serve-manager.mjs && npx tsx test/test-serve-stability.mjs && npx tsx test/test-frpc-e2e.mjs --unit-only && npx tsx test/test-frpc-status.mjs && node test/pinnedClaudeCode.test.mjs && node test/fleet.test.mjs && npx tsx test/test-session-file.mjs && npx tsx test/test-channel-rpc.mjs && npx tsx test/test-wise-agent.mjs && npx tsx test/test-channel-agent.mjs && npx tsx test/test-channels-service.mjs && npx tsx test/test-hotreload-seam.mjs && npx tsx test/test-hot-reload.mjs && npx tsx test/test-hot-reload-live.mjs && npx tsx test/test-session-core.mjs && npx tsx test/test-channel-async-reply.mjs && npx tsx test/test-channel-binding.mjs && npx tsx test/test-channel-identity.mjs && npx tsx test/test-shared-session-identity.mjs && npx tsx test/test-wise-agent-auth.mjs && npx tsx test/test-channel-http.mjs && npx tsx test/test-channel-upload.mjs && npx tsx test/test-wise-voice.mjs && npx tsx test/test-wise-headless.mjs && npx tsx test/test-wise-machine.mjs && npx tsx test/test-crew-merge.mjs && npx tsx test/test-crew-verdict-routing.mjs && npx tsx test/test-crew-standalone.mjs && npx tsx test/test-session-links.mjs && npx tsx test/test-issue-loop-pause-guard.mjs && npx tsx test/test-artifact-guard.mjs && npx tsx test/test-graceful-restart.mjs",
23
23
  "test:hypha": "node --no-warnings test/test-hypha-service.mjs",
24
24
  dev: "tsx src/cli.ts",
25
25
  "dev:daemon": "tsx src/cli.ts daemon start-sync",
@@ -1,4 +1,4 @@
1
- import { m as resolveProjectRoot, u as updateIssue, n as getIssue, o as resumeIssue, p as pauseIssue, q as addComment, t as addIssue, v as listIssues, w as searchIssues, x as isVisibleTo } from './run-BPZ_1RCI.mjs';
1
+ import { m as resolveProjectRoot, u as updateIssue, n as getIssue, o as resumeIssue, p as pauseIssue, q as addComment, t as addIssue, v as listIssues, w as searchIssues, x as isVisibleTo } from './run-1BBi0_ol.mjs';
2
2
  import 'os';
3
3
  import 'fs/promises';
4
4
  import 'fs';
@@ -1,6 +1,6 @@
1
- import { m as resolveProjectRoot } from './run-BPZ_1RCI.mjs';
1
+ import { m as resolveProjectRoot } from './run-1BBi0_ol.mjs';
2
2
  import { g as getWorkflow, s as setWorkflowEnabled, r as removeWorkflow, a as saveWorkflow, b as rawWorkflow, l as listWorkflows } from './store-BTs0H_y0.mjs';
3
- import { g as getRun, l as listRuns, r as runWorkflow } from './runStore-DKC_bMSi.mjs';
3
+ import { g as getRun, l as listRuns, r as runWorkflow } from './runStore-C5IyfbON.mjs';
4
4
  import 'os';
5
5
  import 'fs/promises';
6
6
  import 'fs';
@@ -2996,7 +2996,7 @@ async function registerMachineService(server, machineId, metadata, daemonState,
2996
2996
  const tunnels = handlers.tunnels;
2997
2997
  if (!tunnels) throw new Error("Tunnel management not available");
2998
2998
  if (tunnels.has(params.name)) throw new Error(`Tunnel '${params.name}' already running`);
2999
- const { FrpcTunnel } = await import('./frpc-nvGz8fWs.mjs');
2999
+ const { FrpcTunnel } = await import('./frpc-Di-y4cWK.mjs');
3000
3000
  const tunnel = new FrpcTunnel({
3001
3001
  name: params.name,
3002
3002
  ports: params.ports,
@@ -3447,7 +3447,7 @@ QUESTION: ${params.question || "Summarize this concisely."}` }
3447
3447
  }
3448
3448
  const deps = buildSessionDeps(rpc, { cwd, ownerEmail: owner });
3449
3449
  const sender = { name: context?.user?.email || context?.user?.id || "user", kind: "user", verified: true };
3450
- const { toolsForRole } = await import('./sideband-C-0cCNeL.mjs');
3450
+ const { toolsForRole } = await import('./sideband-BqD4-WWR.mjs');
3451
3451
  const r2 = await runWiseAgent({ message: params.message, sender, config: { tools: toolsForRole(role2) }, deps, transport, model: resolved.model });
3452
3452
  return fmt(r2);
3453
3453
  }
@@ -3546,7 +3546,7 @@ QUESTION: ${params.question || "Summarize this concisely."}` }
3546
3546
  if (r.error || !r.sender) return { error: r.error || "unauthorized" };
3547
3547
  const callId = "call_" + Math.random().toString(16).slice(2, 12);
3548
3548
  const rendered = renderMessage(c, { sender: r.sender, body: { message: kwargs.message }, callId });
3549
- const { queryCore } = await import('./commands-BhLGBhBS.mjs');
3549
+ const { queryCore } = await import('./commands-vCeWXvYJ.mjs');
3550
3550
  const timeout = c.reply?.timeout_sec || 120;
3551
3551
  let result;
3552
3552
  try {
@@ -11852,6 +11852,30 @@ const SVAMP_HOME = process.env.SVAMP_HOME || join$1(os$1.homedir(), ".svamp");
11852
11852
  const DAEMON_STATE_FILE = join$1(SVAMP_HOME, "daemon.state.json");
11853
11853
  const DAEMON_LOCK_FILE = join$1(SVAMP_HOME, "daemon.lock");
11854
11854
  const DAEMON_STOP_MARKER_FILE = join$1(SVAMP_HOME, "daemon.stop");
11855
+ const PENDING_RESTART_FILE = join$1(SVAMP_HOME, "pending-restart.json");
11856
+ function writePendingRestart(p) {
11857
+ try {
11858
+ if (!existsSync$1(SVAMP_HOME)) mkdirSync$1(SVAMP_HOME, { recursive: true });
11859
+ const rec = { scheduledAt: Date.now(), ...p };
11860
+ writeFileSync$1(PENDING_RESTART_FILE, JSON.stringify(rec), "utf-8");
11861
+ } catch {
11862
+ }
11863
+ }
11864
+ function readPendingRestart() {
11865
+ try {
11866
+ if (!existsSync$1(PENDING_RESTART_FILE)) return null;
11867
+ const rec = JSON.parse(readFileSync$1(PENDING_RESTART_FILE, "utf-8"));
11868
+ return rec && typeof rec.scheduledAt === "number" ? rec : null;
11869
+ } catch {
11870
+ return null;
11871
+ }
11872
+ }
11873
+ function clearPendingRestart() {
11874
+ try {
11875
+ if (existsSync$1(PENDING_RESTART_FILE)) unlinkSync$1(PENDING_RESTART_FILE);
11876
+ } catch {
11877
+ }
11878
+ }
11855
11879
  function writeStopMarker(reason) {
11856
11880
  try {
11857
11881
  writeFileSync$1(DAEMON_STOP_MARKER_FILE, `${(/* @__PURE__ */ new Date()).toISOString()} ${reason}
@@ -12828,7 +12852,7 @@ async function startDaemon(options) {
12828
12852
  saveExposedTunnels(list);
12829
12853
  }
12830
12854
  async function createExposedTunnel(spec) {
12831
- const { FrpcTunnel } = await import('./frpc-nvGz8fWs.mjs');
12855
+ const { FrpcTunnel } = await import('./frpc-Di-y4cWK.mjs');
12832
12856
  const tunnel = new FrpcTunnel({
12833
12857
  name: spec.name,
12834
12858
  ports: spec.ports,
@@ -12848,7 +12872,7 @@ async function startDaemon(options) {
12848
12872
  return tunnel;
12849
12873
  }
12850
12874
  const tunnelRecreateState = /* @__PURE__ */ new Map();
12851
- const { ServeManager } = await import('./serveManager-DGRpRAFM.mjs');
12875
+ const { ServeManager } = await import('./serveManager-BZtpClpC.mjs');
12852
12876
  const serveManager = new ServeManager(SVAMP_HOME, (msg) => logger.log(`[SERVE] ${msg}`), hyphaServerUrl);
12853
12877
  ensureAutoInstalledSkills(logger).catch(() => {
12854
12878
  });
@@ -14873,11 +14897,11 @@ ${capturedError}${buildClaudeErrorHint(capturedError)}`;
14873
14897
  });
14874
14898
  },
14875
14899
  onIssue: async (params) => {
14876
- const { issueRpc } = await import('./rpc-s_Hibfpl.mjs');
14900
+ const { issueRpc } = await import('./rpc-BncvIQMO.mjs');
14877
14901
  return issueRpc(params?.cwd || directory, params || {}, { notifySession: notifyIssueOwner, rekickLoopOwner });
14878
14902
  },
14879
14903
  onWorkflow: async (params) => {
14880
- const { workflowRpc } = await import('./rpc-CDI7i151.mjs');
14904
+ const { workflowRpc } = await import('./rpc-DbY7NUhj.mjs');
14881
14905
  return workflowRpc(params?.cwd || directory, params || {});
14882
14906
  },
14883
14907
  onRipgrep: async (args, cwd) => {
@@ -15410,11 +15434,11 @@ ${capturedError}${buildClaudeErrorHint(capturedError)}`;
15410
15434
  });
15411
15435
  },
15412
15436
  onIssue: async (params) => {
15413
- const { issueRpc } = await import('./rpc-s_Hibfpl.mjs');
15437
+ const { issueRpc } = await import('./rpc-BncvIQMO.mjs');
15414
15438
  return issueRpc(params?.cwd || directory, params || {}, { notifySession: notifyIssueOwner, rekickLoopOwner });
15415
15439
  },
15416
15440
  onWorkflow: async (params) => {
15417
- const { workflowRpc } = await import('./rpc-CDI7i151.mjs');
15441
+ const { workflowRpc } = await import('./rpc-DbY7NUhj.mjs');
15418
15442
  return workflowRpc(params?.cwd || directory, params || {});
15419
15443
  },
15420
15444
  onRipgrep: async (args, cwd) => {
@@ -16208,6 +16232,61 @@ ${oracle.output.trim().slice(0, 500)}`, "\u{1F501} Continuing loop");
16208
16232
  );
16209
16233
  logger.log(`Restored ${persistedSessions.length} session(s) in ${Date.now() - t0}ms (concurrency ${restoreConcurrency})`);
16210
16234
  }
16235
+ {
16236
+ const anySessionBusy = () => {
16237
+ let n = 0;
16238
+ for (const s of pidToTrackedSession.values()) {
16239
+ if (s.stopped || !s.hyphaService) continue;
16240
+ try {
16241
+ if (s.hyphaService.getMetadata()?.lifecycleState === "running") n++;
16242
+ } catch {
16243
+ }
16244
+ }
16245
+ return { busy: n > 0, n };
16246
+ };
16247
+ const triggerSelfRestart = (why) => {
16248
+ logger.log(`[graceful-restart] ${why} \u2014 restarting daemon now`);
16249
+ clearPendingRestart();
16250
+ try {
16251
+ const supPidFile = join$1(SVAMP_HOME, "supervisor.pid");
16252
+ const supPid = existsSync$1(supPidFile) ? parseInt(readFileSync$1(supPidFile, "utf-8").trim(), 10) : NaN;
16253
+ if (supPid && !isNaN(supPid)) {
16254
+ process.kill(supPid, "SIGUSR2");
16255
+ return;
16256
+ }
16257
+ } catch {
16258
+ }
16259
+ logger.log("[graceful-restart] no supervisor to signal \u2014 exiting for KeepAlive respawn");
16260
+ process.exit(0);
16261
+ };
16262
+ let lastDeferLog = 0;
16263
+ const GRACEFUL_RESTART_POLL_MS = 15e3;
16264
+ const DEFAULT_MAX_WAIT_MS = 60 * 60 * 1e3;
16265
+ const gracefulTimer = setInterval(() => {
16266
+ const pending = readPendingRestart();
16267
+ if (!pending) return;
16268
+ if (pending.force) {
16269
+ triggerSelfRestart("force requested");
16270
+ return;
16271
+ }
16272
+ const { busy, n } = anySessionBusy();
16273
+ if (!busy) {
16274
+ triggerSelfRestart("all sessions idle");
16275
+ return;
16276
+ }
16277
+ const maxWait = typeof pending.maxWaitMs === "number" && pending.maxWaitMs > 0 ? pending.maxWaitMs : DEFAULT_MAX_WAIT_MS;
16278
+ if (Date.now() - pending.scheduledAt > maxWait) {
16279
+ triggerSelfRestart(`max-wait ${Math.round(maxWait / 6e4)}m elapsed (${n} still busy)`);
16280
+ return;
16281
+ }
16282
+ const now = Date.now();
16283
+ if (now - lastDeferLog > 6e4) {
16284
+ lastDeferLog = now;
16285
+ logger.log(`[graceful-restart] deferring \u2014 ${n} session(s) actively thinking`);
16286
+ }
16287
+ }, GRACEFUL_RESTART_POLL_MS);
16288
+ gracefulTimer.unref?.();
16289
+ }
16211
16290
  if (sessionsToAutoContinue.length > 0 && !options?.noAutoContinue) {
16212
16291
  logger.log(`Auto-continuing ${sessionsToAutoContinue.length} interrupted session(s)...`);
16213
16292
  for (const sessionId of sessionsToAutoContinue) {
@@ -16291,7 +16370,7 @@ ${oracle.output.trim().slice(0, 500)}`, "\u{1F501} Continuing loop");
16291
16370
  const PING_TIMEOUT_MS = 15e3;
16292
16371
  const POST_RECONNECT_GRACE_MS = 2e4;
16293
16372
  const RECONNECT_JITTER_MS = 2500;
16294
- const { WorkflowScheduler } = await import('./scheduler-E1Bw4HUY.mjs');
16373
+ const { WorkflowScheduler } = await import('./scheduler-BkXOKjHn.mjs');
16295
16374
  const workflowScheduler = new WorkflowScheduler({
16296
16375
  projectRoots: () => {
16297
16376
  const dirs = /* @__PURE__ */ new Set();
@@ -16861,12 +16940,17 @@ function daemonStatus() {
16861
16940
  var run = /*#__PURE__*/Object.freeze({
16862
16941
  __proto__: null,
16863
16942
  DAEMON_STOP_MARKER_FILE: DAEMON_STOP_MARKER_FILE,
16943
+ PENDING_RESTART_FILE: PENDING_RESTART_FILE,
16944
+ clearPendingRestart: clearPendingRestart,
16864
16945
  clearStopMarker: clearStopMarker,
16865
16946
  daemonStatus: daemonStatus,
16947
+ isDaemonAlive: isDaemonAlive,
16948
+ readPendingRestart: readPendingRestart,
16866
16949
  restartDaemon: restartDaemon,
16867
16950
  startDaemon: startDaemon,
16868
16951
  stopDaemon: stopDaemon,
16869
16952
  stopMarkerExists: stopMarkerExists,
16953
+ writePendingRestart: writePendingRestart,
16870
16954
  writeStopMarker: writeStopMarker
16871
16955
  });
16872
16956
 
@@ -1,4 +1,4 @@
1
- import{createRequire as _pkgrollCR}from"node:module";const require=_pkgrollCR(import.meta.url);import { a4 as applyClaudeProxyEnv, a5 as composeSessionId, a6 as generateFriendlyName, c as connectToHypha, a as createSessionStore, r as registerMachineService, a7 as generateHookSettings } from './run-BPZ_1RCI.mjs';
1
+ import{createRequire as _pkgrollCR}from"node:module";const require=_pkgrollCR(import.meta.url);import { a4 as applyClaudeProxyEnv, a5 as composeSessionId, a6 as generateFriendlyName, c as connectToHypha, a as createSessionStore, r as registerMachineService, a7 as generateHookSettings } from './run-1BBi0_ol.mjs';
2
2
  import os from 'node:os';
3
3
  import { resolve, join } from 'node:path';
4
4
  import { existsSync, readFileSync, watch } from 'node:fs';
@@ -3,7 +3,7 @@ import { existsSync, readFileSync, mkdirSync, writeFileSync, renameSync } from '
3
3
  import { randomBytes } from 'node:crypto';
4
4
  import { join } from 'node:path';
5
5
  import { c as workflowSteps, d as workflowsDir } from './store-BTs0H_y0.mjs';
6
- import { v as listIssues, t as addIssue } from './run-BPZ_1RCI.mjs';
6
+ import { v as listIssues, t as addIssue } from './run-1BBi0_ol.mjs';
7
7
 
8
8
  const MAX_RUNS_PER_WORKFLOW = 50;
9
9
  function maxRunsPerWorkflow() {
@@ -1,6 +1,6 @@
1
- import { m as resolveProjectRoot, y as cronMatches } from './run-BPZ_1RCI.mjs';
1
+ import { m as resolveProjectRoot, y as cronMatches } from './run-1BBi0_ol.mjs';
2
2
  import { l as listWorkflows, i as isWorkflowEnabled, w as workflowCrons } from './store-BTs0H_y0.mjs';
3
- import { r as runWorkflow } from './runStore-DKC_bMSi.mjs';
3
+ import { r as runWorkflow } from './runStore-C5IyfbON.mjs';
4
4
  import 'os';
5
5
  import 'fs/promises';
6
6
  import 'fs';
@@ -54,7 +54,7 @@ async function handleServeCommand() {
54
54
  }
55
55
  }
56
56
  async function serveAdd(args, machineId) {
57
- const { connectAndGetMachine } = await import('./commands-BhLGBhBS.mjs');
57
+ const { connectAndGetMachine } = await import('./commands-vCeWXvYJ.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-BhLGBhBS.mjs');
96
+ const { connectAndGetMachine } = await import('./commands-vCeWXvYJ.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-BhLGBhBS.mjs');
185
+ const { connectAndGetMachine } = await import('./commands-vCeWXvYJ.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-BhLGBhBS.mjs');
205
+ const { connectAndGetMachine } = await import('./commands-vCeWXvYJ.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-BhLGBhBS.mjs');
238
+ const { connectAndGetMachine } = await import('./commands-vCeWXvYJ.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 { k as getHyphaServerUrl, S as ServeAuth, l as hasCookieToken } from './run-BPZ_1RCI.mjs';
7
+ import { k as getHyphaServerUrl, S as ServeAuth, l as hasCookieToken } from './run-1BBi0_ol.mjs';
8
8
  import 'os';
9
9
  import 'fs/promises';
10
10
  import 'url';
@@ -750,7 +750,7 @@ class ServeManager {
750
750
  const mount = this.mounts.get(mountName);
751
751
  const subdomainOverride = mount?.access === "link" && mount.linkToken ? /* @__PURE__ */ new Map([[this.port, buildLinkSubdomain(subdomainSafe, mount.linkToken)]]) : void 0;
752
752
  try {
753
- const { FrpcTunnel } = await import('./frpc-nvGz8fWs.mjs');
753
+ const { FrpcTunnel } = await import('./frpc-Di-y4cWK.mjs');
754
754
  let tunnel;
755
755
  tunnel = new FrpcTunnel({
756
756
  name: tunnelName,
@@ -1,4 +1,4 @@
1
- import { R as READ_ONLY_TOOLS, B as loadMachineContext, C as buildMachineInstructions, D as machineToolsForRole, E as buildMachineTools } from './run-BPZ_1RCI.mjs';
1
+ import { R as READ_ONLY_TOOLS, B as loadMachineContext, C as buildMachineInstructions, D as machineToolsForRole, E as buildMachineTools } from './run-1BBi0_ol.mjs';
2
2
  import 'node:child_process';
3
3
  import 'os';
4
4
  import 'fs/promises';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svamp-cli",
3
- "version": "0.2.246",
3
+ "version": "0.2.247",
4
4
  "description": "Svamp CLI — AI workspace daemon on Hypha Cloud",
5
5
  "author": "Amun AI AB",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -20,7 +20,7 @@
20
20
  "scripts": {
21
21
  "build": "rm -rf dist bin/skills bin/commands && mkdir -p bin/skills && cp -r ../../skills/artifact bin/skills/artifact && cp -r ../../skills/crew bin/skills/crew && cp -r ../../commands bin/commands && tsc --noEmit && pkgroll",
22
22
  "typecheck": "tsc --noEmit",
23
- "test": "npx tsx test/test-context-window.mjs && npx tsx test/test-ratelimit-retry.mjs && npx tsx test/test-instance-config.mjs && npx tsx test/test-authorize.mjs && npx tsx test/test-normalize-allowed-user.mjs && npx tsx test/test-share-url.mjs && npx tsx test/test-update-sharing-normalization.mjs && npx tsx test/test-sharing-notify-sync.mjs && npx tsx test/test-staged-homes-sweep.mjs && npx tsx test/test-session-helpers.mjs && npx tsx test/test-cli-routing.mjs && npx tsx test/test-security-context.mjs && npx tsx test/test-isolation-decision.mjs && npx tsx test/test-message-helpers.mjs && npx tsx test/test-agent-config.mjs && npx tsx test/test-wrap-command.mjs && npx tsx test/test-credential-staging.mjs && npx tsx test/test-claude-auth.mjs && npx tsx test/test-btw-proxy-env.mjs && npx tsx test/test-output-formatters.mjs && npx tsx test/test-inbox-guard.mjs && npx tsx test/test-auto-topic.mjs && npx tsx test/test-project-info.mjs && npx tsx test/test-agent-types.mjs && npx tsx test/test-transport.mjs && npx tsx test/test-session-update-handlers.mjs && npx tsx test/test-session-scanner.mjs && npx tsx test/test-hypha-client.mjs && npx tsx test/test-hook-settings.mjs && npx tsx test/test-session-service-logic.mjs && npx tsx test/test-daemon-persistence.mjs && npx tsx test/test-detect-isolation.mjs && npx tsx test/test-machine-service-logic.mjs && npx tsx test/test-interactive-helpers.mjs && npx tsx test/test-codex-backend.mjs && npx tsx test/test-acp-backend.mjs && npx tsx test/test-acp-bridge.mjs && npx tsx test/test-hook-server.mjs && npx tsx test/test-session-commands.mjs && npx tsx test/test-interactive-console.mjs && npx tsx test/test-session-messages.mjs && npx tsx test/test-session-send-query.mjs && npx tsx test/test-skills.mjs && npx tsx test/test-agent-grouping.mjs && npx tsx test/test-machine-list-directory.mjs && npx tsx test/test-service-commands.mjs && npx tsx test/test-supervisor.mjs && npx tsx test/test-supervisor-lock.mjs && node test/test-supervisor-restart.mjs && npx tsx test/test-clear-detection.mjs && npx tsx test/test-session-consolidation.mjs && npx tsx test/test-inbox-store.mjs && npx tsx test/test-inbox.mjs && npx tsx test/test-inbox-cross-machine.mjs && npx tsx test/test-issue-store.mjs && npx tsx test/test-issue-close-gate.mjs && npx tsx test/test-loop-verify.mjs && npx tsx test/test-issue-rpc.mjs && npx tsx test/test-issue-pause.mjs && npx tsx test/test-workflow-store.mjs && npx tsx test/test-workflow-rpc.mjs && npx tsx test/test-workflow-scheduler.mjs && npx tsx test/test-cron.mjs && npx tsx test/test-workflow-runs.mjs && npx tsx test/test-serve-link-subdomain.mjs && npx tsx test/test-short-id.mjs && npx tsx test/test-transcript-edit.mjs && npx tsx test/test-edit-history.mjs && npx tsx test/test-friendly-name.mjs && npx tsx test/test-session-rpc-dispatch.mjs && npx tsx test/test-sandbox-cli.mjs && npx tsx test/test-serve-manager.mjs && npx tsx test/test-serve-stability.mjs && npx tsx test/test-frpc-e2e.mjs --unit-only && npx tsx test/test-frpc-status.mjs && node test/pinnedClaudeCode.test.mjs && node test/fleet.test.mjs && npx tsx test/test-session-file.mjs && npx tsx test/test-channel-rpc.mjs && npx tsx test/test-wise-agent.mjs && npx tsx test/test-channel-agent.mjs && npx tsx test/test-channels-service.mjs && npx tsx test/test-hotreload-seam.mjs && npx tsx test/test-hot-reload.mjs && npx tsx test/test-hot-reload-live.mjs && npx tsx test/test-session-core.mjs && npx tsx test/test-channel-async-reply.mjs && npx tsx test/test-channel-binding.mjs && npx tsx test/test-channel-identity.mjs && npx tsx test/test-shared-session-identity.mjs && npx tsx test/test-wise-agent-auth.mjs && npx tsx test/test-channel-http.mjs && npx tsx test/test-channel-upload.mjs && npx tsx test/test-wise-voice.mjs && npx tsx test/test-wise-headless.mjs && npx tsx test/test-wise-machine.mjs && npx tsx test/test-crew-merge.mjs && npx tsx test/test-crew-verdict-routing.mjs && npx tsx test/test-crew-standalone.mjs && npx tsx test/test-session-links.mjs && npx tsx test/test-issue-loop-pause-guard.mjs && npx tsx test/test-artifact-guard.mjs",
23
+ "test": "npx tsx test/test-context-window.mjs && npx tsx test/test-ratelimit-retry.mjs && npx tsx test/test-instance-config.mjs && npx tsx test/test-authorize.mjs && npx tsx test/test-normalize-allowed-user.mjs && npx tsx test/test-share-url.mjs && npx tsx test/test-update-sharing-normalization.mjs && npx tsx test/test-sharing-notify-sync.mjs && npx tsx test/test-staged-homes-sweep.mjs && npx tsx test/test-session-helpers.mjs && npx tsx test/test-cli-routing.mjs && npx tsx test/test-security-context.mjs && npx tsx test/test-isolation-decision.mjs && npx tsx test/test-message-helpers.mjs && npx tsx test/test-agent-config.mjs && npx tsx test/test-wrap-command.mjs && npx tsx test/test-credential-staging.mjs && npx tsx test/test-claude-auth.mjs && npx tsx test/test-btw-proxy-env.mjs && npx tsx test/test-output-formatters.mjs && npx tsx test/test-inbox-guard.mjs && npx tsx test/test-auto-topic.mjs && npx tsx test/test-project-info.mjs && npx tsx test/test-agent-types.mjs && npx tsx test/test-transport.mjs && npx tsx test/test-session-update-handlers.mjs && npx tsx test/test-session-scanner.mjs && npx tsx test/test-hypha-client.mjs && npx tsx test/test-hook-settings.mjs && npx tsx test/test-session-service-logic.mjs && npx tsx test/test-daemon-persistence.mjs && npx tsx test/test-detect-isolation.mjs && npx tsx test/test-machine-service-logic.mjs && npx tsx test/test-interactive-helpers.mjs && npx tsx test/test-codex-backend.mjs && npx tsx test/test-acp-backend.mjs && npx tsx test/test-acp-bridge.mjs && npx tsx test/test-hook-server.mjs && npx tsx test/test-session-commands.mjs && npx tsx test/test-interactive-console.mjs && npx tsx test/test-session-messages.mjs && npx tsx test/test-session-send-query.mjs && npx tsx test/test-skills.mjs && npx tsx test/test-agent-grouping.mjs && npx tsx test/test-machine-list-directory.mjs && npx tsx test/test-service-commands.mjs && npx tsx test/test-supervisor.mjs && npx tsx test/test-supervisor-lock.mjs && node test/test-supervisor-restart.mjs && npx tsx test/test-clear-detection.mjs && npx tsx test/test-session-consolidation.mjs && npx tsx test/test-inbox-store.mjs && npx tsx test/test-inbox.mjs && npx tsx test/test-inbox-cross-machine.mjs && npx tsx test/test-issue-store.mjs && npx tsx test/test-issue-close-gate.mjs && npx tsx test/test-loop-verify.mjs && npx tsx test/test-issue-rpc.mjs && npx tsx test/test-issue-pause.mjs && npx tsx test/test-workflow-store.mjs && npx tsx test/test-workflow-rpc.mjs && npx tsx test/test-workflow-scheduler.mjs && npx tsx test/test-cron.mjs && npx tsx test/test-workflow-runs.mjs && npx tsx test/test-serve-link-subdomain.mjs && npx tsx test/test-short-id.mjs && npx tsx test/test-transcript-edit.mjs && npx tsx test/test-edit-history.mjs && npx tsx test/test-friendly-name.mjs && npx tsx test/test-session-rpc-dispatch.mjs && npx tsx test/test-sandbox-cli.mjs && npx tsx test/test-serve-manager.mjs && npx tsx test/test-serve-stability.mjs && npx tsx test/test-frpc-e2e.mjs --unit-only && npx tsx test/test-frpc-status.mjs && node test/pinnedClaudeCode.test.mjs && node test/fleet.test.mjs && npx tsx test/test-session-file.mjs && npx tsx test/test-channel-rpc.mjs && npx tsx test/test-wise-agent.mjs && npx tsx test/test-channel-agent.mjs && npx tsx test/test-channels-service.mjs && npx tsx test/test-hotreload-seam.mjs && npx tsx test/test-hot-reload.mjs && npx tsx test/test-hot-reload-live.mjs && npx tsx test/test-session-core.mjs && npx tsx test/test-channel-async-reply.mjs && npx tsx test/test-channel-binding.mjs && npx tsx test/test-channel-identity.mjs && npx tsx test/test-shared-session-identity.mjs && npx tsx test/test-wise-agent-auth.mjs && npx tsx test/test-channel-http.mjs && npx tsx test/test-channel-upload.mjs && npx tsx test/test-wise-voice.mjs && npx tsx test/test-wise-headless.mjs && npx tsx test/test-wise-machine.mjs && npx tsx test/test-crew-merge.mjs && npx tsx test/test-crew-verdict-routing.mjs && npx tsx test/test-crew-standalone.mjs && npx tsx test/test-session-links.mjs && npx tsx test/test-issue-loop-pause-guard.mjs && npx tsx test/test-artifact-guard.mjs && npx tsx test/test-graceful-restart.mjs",
24
24
  "test:hypha": "node --no-warnings test/test-hypha-service.mjs",
25
25
  "dev": "tsx src/cli.ts",
26
26
  "dev:daemon": "tsx src/cli.ts daemon start-sync",