svamp-cli 0.2.129 → 0.2.130

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.
@@ -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 { m as shortId } from './run-BaTwfE1Q.mjs';
5
+ import { m as shortId } from './run-DMahGhJP.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-BaTwfE1Q.mjs').then(function (n) { return n.Z; });
99
+ const { projectName, writeProjectInfo, sanitizeDescription, projectInfoPath } = await import('./run-DMahGhJP.mjs').then(function (n) { return n.Z; });
100
100
  const desc = sanitizeDescription(description, 240);
101
101
  if (!desc) {
102
102
  console.error("Project description is empty.");
@@ -180,7 +180,7 @@ async function sessionBroadcast(action, args) {
180
180
  console.log(`Broadcast sent: ${action}`);
181
181
  }
182
182
  async function connectToMachineService() {
183
- const { connectAndGetMachine } = await import('./commands-BV30A1zt.mjs');
183
+ const { connectAndGetMachine } = await import('./commands-QGaI-ukW.mjs');
184
184
  return connectAndGetMachine();
185
185
  }
186
186
  async function inboxSend(targetSessionId, opts) {
@@ -197,7 +197,7 @@ async function inboxSend(targetSessionId, opts) {
197
197
  }
198
198
  const { server, machine } = await connectToMachineService();
199
199
  try {
200
- const { resolveSessionId } = await import('./commands-BV30A1zt.mjs');
200
+ const { resolveSessionId } = await import('./commands-QGaI-ukW.mjs');
201
201
  const sessions = await machine.listSessions();
202
202
  const match = resolveSessionId(sessions, targetSessionId);
203
203
  const fullTargetId = match.sessionId;
@@ -1,4 +1,4 @@
1
- import { D as resolveModel } from './run-BaTwfE1Q.mjs';
1
+ import { D as resolveModel } from './run-DMahGhJP.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-BaTwfE1Q.mjs';
1
+ import { e as clearStopMarker, f as stopMarkerExists, s as startDaemon, b as stopDaemon, d as daemonStatus } from './run-DMahGhJP.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-BaTwfE1Q.mjs').then(function (n) { return n.a4; });
37
+ const { getLoadedConfig } = await import('./run-DMahGhJP.mjs').then(function (n) { return n.a4; });
38
38
  getLoadedConfig();
39
39
  } catch {
40
40
  }
@@ -51,7 +51,7 @@ 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-BaTwfE1Q.mjs').then(function (n) { return n.a6; });
54
+ const { restartDaemon } = await import('./run-DMahGhJP.mjs').then(function (n) { return n.a6; });
55
55
  await restartDaemon();
56
56
  process.exit(0);
57
57
  }
@@ -344,7 +344,7 @@ async function main() {
344
344
  console.error("svamp service: Service commands are not available in sandboxed sessions.");
345
345
  process.exit(1);
346
346
  }
347
- const { handleServiceCommand } = await import('./commands-CK1ZOskY.mjs');
347
+ const { handleServiceCommand } = await import('./commands-BeOI6l78.mjs');
348
348
  await handleServiceCommand();
349
349
  } else if (subcommand === "serve") {
350
350
  const { isSandboxed: isSandboxedServe } = await import('./sandboxDetect-DNTcbgWD.mjs');
@@ -352,7 +352,7 @@ async function main() {
352
352
  console.error("svamp serve: Serve commands are not available in sandboxed sessions.");
353
353
  process.exit(1);
354
354
  }
355
- const { handleServeCommand } = await import('./serveCommands-GzGpHWlP.mjs');
355
+ const { handleServeCommand } = await import('./serveCommands-C8iIs7jb.mjs');
356
356
  await handleServeCommand();
357
357
  process.exit(0);
358
358
  } else if (subcommand === "process" || subcommand === "proc") {
@@ -361,7 +361,7 @@ async function main() {
361
361
  console.error("svamp process: Process commands are not available in sandboxed sessions.");
362
362
  process.exit(1);
363
363
  }
364
- const { processCommand } = await import('./commands-oF0MQ_jX.mjs');
364
+ const { processCommand } = await import('./commands-D830hGXM.mjs');
365
365
  let machineId;
366
366
  const processArgs = args.slice(1);
367
367
  const mIdx = processArgs.findIndex((a) => a === "--machine" || a === "-m");
@@ -375,14 +375,14 @@ async function main() {
375
375
  }), machineId);
376
376
  process.exit(0);
377
377
  } else if (subcommand === "trigger" || subcommand === "triggers" || subcommand === "routine" || subcommand === "routines") {
378
- const { routineCommand } = await import('./commands-DEZSgxop.mjs');
378
+ const { routineCommand } = await import('./commands-MdYMcyaZ.mjs');
379
379
  await routineCommand(args.slice(1));
380
380
  process.exit(0);
381
381
  } else if (subcommand === "wise-agent" || subcommand === "wise") {
382
382
  await handleWiseAgentCommand(args.slice(1));
383
383
  process.exit(0);
384
384
  } else if (subcommand === "feature" || subcommand === "crew") {
385
- const { crewCommand } = await import('./commands-CWIKYhzM.mjs');
385
+ const { crewCommand } = await import('./commands-BFGR6-V-.mjs');
386
386
  await crewCommand(args.slice(1));
387
387
  process.exit(0);
388
388
  } else if (subcommand === "--help" || subcommand === "-h") {
@@ -390,7 +390,7 @@ async function main() {
390
390
  } else if (!subcommand || subcommand === "start") {
391
391
  await handleInteractiveCommand();
392
392
  } else if (subcommand === "--version" || subcommand === "-v") {
393
- const pkg = await import('./package-DzPfT1Xs.mjs').catch(() => ({ default: { version: "unknown" } }));
393
+ const pkg = await import('./package-BK6btwnG.mjs').catch(() => ({ default: { version: "unknown" } }));
394
394
  console.log(`svamp version: ${pkg.default.version}`);
395
395
  } else {
396
396
  console.error(`Unknown command: ${subcommand}`);
@@ -399,7 +399,7 @@ async function main() {
399
399
  }
400
400
  }
401
401
  async function handleInteractiveCommand() {
402
- const { runInteractive } = await import('./run-C6Q6ZlNu.mjs');
402
+ const { runInteractive } = await import('./run---5cgexR.mjs');
403
403
  const interactiveArgs = subcommand === "start" ? args.slice(1) : args;
404
404
  let directory = process.cwd();
405
405
  let resumeSessionId;
@@ -444,7 +444,7 @@ async function handleAgentCommand() {
444
444
  return;
445
445
  }
446
446
  if (agentArgs[0] === "list") {
447
- const { KNOWN_ACP_AGENTS, KNOWN_MCP_AGENTS: KNOWN_MCP_AGENTS2 } = await import('./run-BaTwfE1Q.mjs').then(function (n) { return n.a0; });
447
+ const { KNOWN_ACP_AGENTS, KNOWN_MCP_AGENTS: KNOWN_MCP_AGENTS2 } = await import('./run-DMahGhJP.mjs').then(function (n) { return n.a0; });
448
448
  console.log("Known agents:");
449
449
  for (const [name, config2] of Object.entries(KNOWN_ACP_AGENTS)) {
450
450
  console.log(` ${name.padEnd(12)} ${config2.command} ${config2.args.join(" ")} (ACP)`);
@@ -456,7 +456,7 @@ async function handleAgentCommand() {
456
456
  console.log('Use "svamp agent -- <command> [args]" for a custom ACP agent.');
457
457
  return;
458
458
  }
459
- const { resolveAcpAgentConfig, KNOWN_MCP_AGENTS } = await import('./run-BaTwfE1Q.mjs').then(function (n) { return n.a0; });
459
+ const { resolveAcpAgentConfig, KNOWN_MCP_AGENTS } = await import('./run-DMahGhJP.mjs').then(function (n) { return n.a0; });
460
460
  let cwd = process.cwd();
461
461
  const filteredArgs = [];
462
462
  for (let i = 0; i < agentArgs.length; i++) {
@@ -480,12 +480,12 @@ async function handleAgentCommand() {
480
480
  console.log(`Starting ${config.agentName} agent in ${cwd}...`);
481
481
  let backend;
482
482
  if (KNOWN_MCP_AGENTS[config.agentName]) {
483
- const { CodexMcpBackend } = await import('./run-BaTwfE1Q.mjs').then(function (n) { return n.a1; });
483
+ const { CodexMcpBackend } = await import('./run-DMahGhJP.mjs').then(function (n) { return n.a1; });
484
484
  backend = new CodexMcpBackend({ cwd, log: logFn });
485
485
  } else {
486
- const { AcpBackend } = await import('./run-BaTwfE1Q.mjs').then(function (n) { return n.$; });
487
- const { GeminiTransport } = await import('./run-BaTwfE1Q.mjs').then(function (n) { return n.a2; });
488
- const { DefaultTransport } = await import('./run-BaTwfE1Q.mjs').then(function (n) { return n._; });
486
+ const { AcpBackend } = await import('./run-DMahGhJP.mjs').then(function (n) { return n.$; });
487
+ const { GeminiTransport } = await import('./run-DMahGhJP.mjs').then(function (n) { return n.a2; });
488
+ const { DefaultTransport } = await import('./run-DMahGhJP.mjs').then(function (n) { return n._; });
489
489
  const transportHandler = config.agentName === "gemini" ? new GeminiTransport() : new DefaultTransport(config.agentName);
490
490
  backend = new AcpBackend({
491
491
  agentName: config.agentName,
@@ -612,7 +612,7 @@ async function handleSessionCommand() {
612
612
  process.exit(1);
613
613
  }
614
614
  }
615
- 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-BV30A1zt.mjs');
615
+ 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-QGaI-ukW.mjs');
616
616
  const parseFlagStr = (flag, shortFlag) => {
617
617
  for (let i = 1; i < sessionArgs.length; i++) {
618
618
  if ((sessionArgs[i] === flag || shortFlag) && i + 1 < sessionArgs.length) {
@@ -680,7 +680,7 @@ async function handleSessionCommand() {
680
680
  allowDomain.push(sessionArgs[++i]);
681
681
  }
682
682
  }
683
- const { parseShareArg } = await import('./commands-BV30A1zt.mjs');
683
+ const { parseShareArg } = await import('./commands-QGaI-ukW.mjs');
684
684
  const shareEntries = share.map((s) => parseShareArg(s));
685
685
  await sessionSpawn(agent, dir, targetMachineId, {
686
686
  message,
@@ -765,7 +765,7 @@ async function handleSessionCommand() {
765
765
  console.error(" Rewinds history: rewrites the message + drops everything after it, then restarts Claude.");
766
766
  process.exit(1);
767
767
  }
768
- const { sessionEditMessage } = await import('./commands-BV30A1zt.mjs');
768
+ const { sessionEditMessage } = await import('./commands-QGaI-ukW.mjs');
769
769
  await sessionEditMessage(sessionArgs[1], sessionArgs[2], sessionArgs[3], targetMachineId);
770
770
  } else if (sessionSubcommand === "refine") {
771
771
  if (!sessionArgs[1] || !sessionArgs[2]) {
@@ -773,7 +773,7 @@ async function handleSessionCommand() {
773
773
  console.error(" Asks the agent to revise its latest reply in place (no extra round).");
774
774
  process.exit(1);
775
775
  }
776
- const { sessionRefineLastReply } = await import('./commands-BV30A1zt.mjs');
776
+ const { sessionRefineLastReply } = await import('./commands-QGaI-ukW.mjs');
777
777
  await sessionRefineLastReply(sessionArgs[1], sessionArgs[2], targetMachineId);
778
778
  } else if (sessionSubcommand === "undo-edit" || sessionSubcommand === "undo") {
779
779
  if (!sessionArgs[1]) {
@@ -781,7 +781,7 @@ async function handleSessionCommand() {
781
781
  console.error(" Reverts the most recent edit/refine, restoring the pre-edit history.");
782
782
  process.exit(1);
783
783
  }
784
- const { sessionUndoEdit } = await import('./commands-BV30A1zt.mjs');
784
+ const { sessionUndoEdit } = await import('./commands-QGaI-ukW.mjs');
785
785
  await sessionUndoEdit(sessionArgs[1], targetMachineId);
786
786
  } else if (sessionSubcommand === "query") {
787
787
  const dir = sessionArgs[1];
@@ -791,7 +791,7 @@ async function handleSessionCommand() {
791
791
  console.error(" Spawns a stateless Claude session in <directory>, sends <prompt>, prints the answer, then deletes the session.");
792
792
  process.exit(1);
793
793
  }
794
- const { sessionQuery } = await import('./commands-BV30A1zt.mjs');
794
+ const { sessionQuery } = await import('./commands-QGaI-ukW.mjs');
795
795
  await sessionQuery(dir, prompt, targetMachineId, {
796
796
  timeout: parseFlagInt("--timeout"),
797
797
  json: hasFlag("--json"),
@@ -824,7 +824,7 @@ async function handleSessionCommand() {
824
824
  console.error("Usage: svamp session approve <session-id> [request-id] [--json]");
825
825
  process.exit(1);
826
826
  }
827
- const { sessionApprove } = await import('./commands-BV30A1zt.mjs');
827
+ const { sessionApprove } = await import('./commands-QGaI-ukW.mjs');
828
828
  const approveReqId = sessionArgs[2] && !sessionArgs[2].startsWith("--") ? sessionArgs[2] : void 0;
829
829
  await sessionApprove(sessionArgs[1], approveReqId, targetMachineId, {
830
830
  json: hasFlag("--json")
@@ -834,7 +834,7 @@ async function handleSessionCommand() {
834
834
  console.error("Usage: svamp session deny <session-id> [request-id] [--json]");
835
835
  process.exit(1);
836
836
  }
837
- const { sessionDeny } = await import('./commands-BV30A1zt.mjs');
837
+ const { sessionDeny } = await import('./commands-QGaI-ukW.mjs');
838
838
  const denyReqId = sessionArgs[2] && !sessionArgs[2].startsWith("--") ? sessionArgs[2] : void 0;
839
839
  await sessionDeny(sessionArgs[1], denyReqId, targetMachineId, {
840
840
  json: hasFlag("--json")
@@ -876,7 +876,7 @@ async function handleSessionCommand() {
876
876
  console.error("Usage: svamp session set-title <title>");
877
877
  process.exit(1);
878
878
  }
879
- const { sessionSetTitle } = await import('./agentCommands-CZk6NL7b.mjs');
879
+ const { sessionSetTitle } = await import('./agentCommands-DOUG625_.mjs');
880
880
  await sessionSetTitle(title);
881
881
  } else if (sessionSubcommand === "set-project-description" || sessionSubcommand === "set-project") {
882
882
  const desc = sessionArgs.slice(1).filter((a) => !a.startsWith("--")).join(" ");
@@ -884,7 +884,7 @@ async function handleSessionCommand() {
884
884
  console.error("Usage: svamp session set-project-description <text>");
885
885
  process.exit(1);
886
886
  }
887
- const { sessionSetProjectDescription } = await import('./agentCommands-CZk6NL7b.mjs');
887
+ const { sessionSetProjectDescription } = await import('./agentCommands-DOUG625_.mjs');
888
888
  await sessionSetProjectDescription(desc);
889
889
  } else if (sessionSubcommand === "set-link") {
890
890
  const url = sessionArgs[1];
@@ -893,7 +893,7 @@ async function handleSessionCommand() {
893
893
  process.exit(1);
894
894
  }
895
895
  const label = sessionArgs[2] && !sessionArgs[2].startsWith("--") ? sessionArgs[2] : void 0;
896
- const { sessionSetLink } = await import('./agentCommands-CZk6NL7b.mjs');
896
+ const { sessionSetLink } = await import('./agentCommands-DOUG625_.mjs');
897
897
  await sessionSetLink(url, label);
898
898
  } else if (sessionSubcommand === "notify") {
899
899
  const message = sessionArgs[1];
@@ -902,7 +902,7 @@ async function handleSessionCommand() {
902
902
  process.exit(1);
903
903
  }
904
904
  const level = parseFlagStr("--level") || "info";
905
- const { sessionNotify } = await import('./agentCommands-CZk6NL7b.mjs');
905
+ const { sessionNotify } = await import('./agentCommands-DOUG625_.mjs');
906
906
  await sessionNotify(message, level);
907
907
  } else if (sessionSubcommand === "broadcast") {
908
908
  const action = sessionArgs[1];
@@ -910,7 +910,7 @@ async function handleSessionCommand() {
910
910
  console.error("Usage: svamp session broadcast <action> [args...]\nActions: open-canvas <url> [label], close-canvas, toast <message>");
911
911
  process.exit(1);
912
912
  }
913
- const { sessionBroadcast } = await import('./agentCommands-CZk6NL7b.mjs');
913
+ const { sessionBroadcast } = await import('./agentCommands-DOUG625_.mjs');
914
914
  await sessionBroadcast(action, sessionArgs.slice(2).filter((a) => !a.startsWith("--")));
915
915
  } else if (sessionSubcommand === "inbox") {
916
916
  const inboxSubcmd = sessionArgs[1];
@@ -921,7 +921,7 @@ async function handleSessionCommand() {
921
921
  process.exit(1);
922
922
  }
923
923
  if (agentSessionId) {
924
- const { inboxSend } = await import('./agentCommands-CZk6NL7b.mjs');
924
+ const { inboxSend } = await import('./agentCommands-DOUG625_.mjs');
925
925
  await inboxSend(sessionArgs[2], {
926
926
  body: sessionArgs[3],
927
927
  subject: parseFlagStr("--subject"),
@@ -936,7 +936,7 @@ async function handleSessionCommand() {
936
936
  }
937
937
  } else if (inboxSubcmd === "list" || inboxSubcmd === "ls") {
938
938
  if (agentSessionId && !sessionArgs[2]) {
939
- const { inboxList } = await import('./agentCommands-CZk6NL7b.mjs');
939
+ const { inboxList } = await import('./agentCommands-DOUG625_.mjs');
940
940
  await inboxList({
941
941
  unread: hasFlag("--unread"),
942
942
  limit: parseFlagInt("--limit"),
@@ -958,7 +958,7 @@ async function handleSessionCommand() {
958
958
  process.exit(1);
959
959
  }
960
960
  if (agentSessionId && !sessionArgs[3]) {
961
- const { inboxList } = await import('./agentCommands-CZk6NL7b.mjs');
961
+ const { inboxList } = await import('./agentCommands-DOUG625_.mjs');
962
962
  await sessionInboxRead(agentSessionId, sessionArgs[2], targetMachineId);
963
963
  } else if (sessionArgs[3]) {
964
964
  await sessionInboxRead(sessionArgs[2], sessionArgs[3], targetMachineId);
@@ -968,7 +968,7 @@ async function handleSessionCommand() {
968
968
  }
969
969
  } else if (inboxSubcmd === "reply") {
970
970
  if (agentSessionId && sessionArgs[2] && sessionArgs[3] && !sessionArgs[4]) {
971
- const { inboxReply } = await import('./agentCommands-CZk6NL7b.mjs');
971
+ const { inboxReply } = await import('./agentCommands-DOUG625_.mjs');
972
972
  await inboxReply(sessionArgs[2], sessionArgs[3]);
973
973
  } else if (sessionArgs[2] && sessionArgs[3] && sessionArgs[4]) {
974
974
  await sessionInboxReply(sessionArgs[2], sessionArgs[3], sessionArgs[4], targetMachineId);
@@ -1004,7 +1004,7 @@ async function handleMachineCommand() {
1004
1004
  return;
1005
1005
  }
1006
1006
  if (machineSubcommand === "share") {
1007
- const { machineShare } = await import('./commands-BV30A1zt.mjs');
1007
+ const { machineShare } = await import('./commands-QGaI-ukW.mjs');
1008
1008
  let machineId;
1009
1009
  const shareArgs = [];
1010
1010
  for (let i = 1; i < machineArgs.length; i++) {
@@ -1055,14 +1055,14 @@ async function handleMachineCommand() {
1055
1055
  process.exit(1);
1056
1056
  }
1057
1057
  if (all) {
1058
- const { fleetExec } = await import('./fleet-BwmE0enl.mjs');
1058
+ const { fleetExec } = await import('./fleet-nj6bMyhh.mjs');
1059
1059
  await fleetExec(command, { cwd });
1060
1060
  } else {
1061
- const { machineExec } = await import('./commands-BV30A1zt.mjs');
1061
+ const { machineExec } = await import('./commands-QGaI-ukW.mjs');
1062
1062
  await machineExec(machineId, command, cwd);
1063
1063
  }
1064
1064
  } else if (machineSubcommand === "info") {
1065
- const { machineInfo } = await import('./commands-BV30A1zt.mjs');
1065
+ const { machineInfo } = await import('./commands-QGaI-ukW.mjs');
1066
1066
  let machineId;
1067
1067
  for (let i = 1; i < machineArgs.length; i++) {
1068
1068
  if ((machineArgs[i] === "--machine" || machineArgs[i] === "-m") && i + 1 < machineArgs.length) {
@@ -1082,10 +1082,10 @@ async function handleMachineCommand() {
1082
1082
  level = machineArgs[++i];
1083
1083
  }
1084
1084
  }
1085
- const { machineNotify } = await import('./agentCommands-CZk6NL7b.mjs');
1085
+ const { machineNotify } = await import('./agentCommands-DOUG625_.mjs');
1086
1086
  await machineNotify(message, level);
1087
1087
  } else if (machineSubcommand === "ls") {
1088
- const { machineLs } = await import('./commands-BV30A1zt.mjs');
1088
+ const { machineLs } = await import('./commands-QGaI-ukW.mjs');
1089
1089
  let machineId;
1090
1090
  let showHidden = false;
1091
1091
  let path;
@@ -1141,20 +1141,20 @@ Examples:
1141
1141
  };
1142
1142
  const hasFlag = (name) => fleetArgs.includes(`--${name}`);
1143
1143
  if (sub === "status") {
1144
- const { fleetStatus } = await import('./fleet-BwmE0enl.mjs');
1144
+ const { fleetStatus } = await import('./fleet-nj6bMyhh.mjs');
1145
1145
  await fleetStatus();
1146
1146
  } else if (sub === "upgrade-claude") {
1147
- const { fleetUpgradeClaude } = await import('./fleet-BwmE0enl.mjs');
1147
+ const { fleetUpgradeClaude } = await import('./fleet-nj6bMyhh.mjs');
1148
1148
  await fleetUpgradeClaude({ version: flag("version", "-v") });
1149
1149
  } else if (sub === "upgrade-svamp") {
1150
- const { fleetUpgradeSvamp } = await import('./fleet-BwmE0enl.mjs');
1150
+ const { fleetUpgradeSvamp } = await import('./fleet-nj6bMyhh.mjs');
1151
1151
  await fleetUpgradeSvamp({ version: flag("version", "-v"), excludeSelf: hasFlag("exclude-self") });
1152
1152
  } else if (sub === "daemon-restart") {
1153
- const { fleetDaemonRestart } = await import('./fleet-BwmE0enl.mjs');
1153
+ const { fleetDaemonRestart } = await import('./fleet-nj6bMyhh.mjs');
1154
1154
  await fleetDaemonRestart({ graceful: !hasFlag("cleanup") });
1155
1155
  } else if (sub === "push-skill") {
1156
1156
  const name = fleetArgs[1];
1157
- const { fleetPushSkill } = await import('./fleet-BwmE0enl.mjs');
1157
+ const { fleetPushSkill } = await import('./fleet-nj6bMyhh.mjs');
1158
1158
  await fleetPushSkill(name);
1159
1159
  } else {
1160
1160
  console.error(`Unknown fleet subcommand: ${sub}`);
@@ -1170,7 +1170,7 @@ async function handleSkillsCommand() {
1170
1170
  await printSkillsHelp();
1171
1171
  return;
1172
1172
  }
1173
- const { skillsFind, skillsInstall, skillsList, skillsRemove, skillsPublish } = await import('./commands-CCqAWMnX.mjs');
1173
+ const { skillsFind, skillsInstall, skillsList, skillsRemove, skillsPublish } = await import('./commands-B8vUCW50.mjs');
1174
1174
  if (skillsSubcommand === "find" || skillsSubcommand === "search") {
1175
1175
  const query = skillsArgs.slice(1).filter((a) => !a.startsWith("--")).join(" ");
1176
1176
  if (!query) {
@@ -1217,7 +1217,7 @@ async function loginToHypha() {
1217
1217
  process.exit(1);
1218
1218
  }
1219
1219
  const anchor = anchorArg.replace(/\/+$/, "");
1220
- const { loadInstanceConfig } = await import('./run-BaTwfE1Q.mjs').then(function (n) { return n.a4; });
1220
+ const { loadInstanceConfig } = await import('./run-DMahGhJP.mjs').then(function (n) { return n.a4; });
1221
1221
  let cfg = null;
1222
1222
  try {
1223
1223
  cfg = await loadInstanceConfig({ anchor, force: true });
@@ -1328,7 +1328,7 @@ async function logoutFromHypha() {
1328
1328
  } catch {
1329
1329
  }
1330
1330
  try {
1331
- const { clearInstanceConfigCache } = await import('./run-BaTwfE1Q.mjs').then(function (n) { return n.a4; });
1331
+ const { clearInstanceConfigCache } = await import('./run-DMahGhJP.mjs').then(function (n) { return n.a4; });
1332
1332
  clearInstanceConfigCache();
1333
1333
  } catch {
1334
1334
  }
@@ -1666,7 +1666,7 @@ async function applyClaudeAuthFlags(argv) {
1666
1666
  "--use-hypha-proxy, --use-claude-login, and --anthropic-base-url/--anthropic-api-key are mutually exclusive"
1667
1667
  );
1668
1668
  }
1669
- const mod = await import('./run-BaTwfE1Q.mjs').then(function (n) { return n.a3; });
1669
+ const mod = await import('./run-DMahGhJP.mjs').then(function (n) { return n.a3; });
1670
1670
  if (hasHypha) {
1671
1671
  let url;
1672
1672
  const hyphaIdx = argv.indexOf("--use-hypha-proxy");
@@ -1720,7 +1720,7 @@ async function applyDaemonShareFlag(argv) {
1720
1720
  }
1721
1721
  }
1722
1722
  if (collected.length === 0) return;
1723
- const { updateEnvFile } = await import('./run-BaTwfE1Q.mjs').then(function (n) { return n.a3; });
1723
+ const { updateEnvFile } = await import('./run-DMahGhJP.mjs').then(function (n) { return n.a3; });
1724
1724
  const seen = /* @__PURE__ */ new Set();
1725
1725
  const deduped = collected.filter((e) => {
1726
1726
  const k = e.toLowerCase();
@@ -1753,7 +1753,7 @@ async function handleWiseAgentCommand(rest) {
1753
1753
  }
1754
1754
  });
1755
1755
  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(" ");
1756
- const { wiseAskCli } = await import('./commands-BV30A1zt.mjs');
1756
+ const { wiseAskCli } = await import('./commands-QGaI-ukW.mjs');
1757
1757
  await wiseAskCli(machineId, message, sessionId, { json });
1758
1758
  return;
1759
1759
  }
@@ -1765,7 +1765,7 @@ async function handleWiseAgentCommand(rest) {
1765
1765
  }
1766
1766
  return void 0;
1767
1767
  };
1768
- const { runWiseVoiceCli } = await import('./headlessCli-Cj4WQsCx.mjs');
1768
+ const { runWiseVoiceCli } = await import('./headlessCli-D8x-uGEN.mjs');
1769
1769
  await runWiseVoiceCli({ voice: valueOf(["--voice"]), wakeKeywordPath: valueOf(["--wake"]), model: valueOf(["--model"]) });
1770
1770
  return;
1771
1771
  }
@@ -1807,7 +1807,7 @@ If none is set, hitting a WISE Agent channel returns a clear "not configured" er
1807
1807
  return;
1808
1808
  }
1809
1809
  const authArgs = rest.slice(1);
1810
- const mod = await import('./auth-C4miUceQ.mjs');
1810
+ const mod = await import('./auth-UNUDBJKU.mjs');
1811
1811
  let action;
1812
1812
  try {
1813
1813
  action = mod.parseWiseAgentAuthArgs(authArgs);
@@ -1817,7 +1817,7 @@ If none is set, hitting a WISE Agent channel returns a clear "not configured" er
1817
1817
  return;
1818
1818
  }
1819
1819
  if (action) {
1820
- const { updateEnvFile } = await import('./run-BaTwfE1Q.mjs').then(function (n) { return n.a3; });
1820
+ const { updateEnvFile } = await import('./run-DMahGhJP.mjs').then(function (n) { return n.a3; });
1821
1821
  const updates = mod.buildWiseAgentEnvUpdates(action);
1822
1822
  updateEnvFile(updates);
1823
1823
  for (const [k, v] of Object.entries(updates)) {
@@ -1831,7 +1831,7 @@ If none is set, hitting a WISE Agent channel returns a clear "not configured" er
1831
1831
  }
1832
1832
  async function handleDaemonAuthCommand(argv) {
1833
1833
  const sub = (argv[0] || "status").toLowerCase();
1834
- const mod = await import('./run-BaTwfE1Q.mjs').then(function (n) { return n.a3; });
1834
+ const mod = await import('./run-DMahGhJP.mjs').then(function (n) { return n.a3; });
1835
1835
  if (sub === "--help" || sub === "-h" || sub === "help") {
1836
1836
  console.log(`
1837
1837
  svamp daemon auth \u2014 Configure how Claude subprocesses authenticate
@@ -2144,7 +2144,7 @@ Examples:
2144
2144
  async function printSkillsHelp() {
2145
2145
  let browseUrl = "<HYPHA_SERVER_URL>/<workspace>/artifacts/marketplace (set HYPHA_SERVER_URL)";
2146
2146
  try {
2147
- const { getArtifactBaseUrl, getSkillsCollectionName } = await import('./run-BaTwfE1Q.mjs').then(function (n) { return n.a5; });
2147
+ const { getArtifactBaseUrl, getSkillsCollectionName } = await import('./run-DMahGhJP.mjs').then(function (n) { return n.a5; });
2148
2148
  browseUrl = `${getArtifactBaseUrl()}/${getSkillsCollectionName()}`;
2149
2149
  } catch {
2150
2150
  }
@@ -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 { p as parseFrontmatter, n as getSkillsServer, o as getSkillsWorkspaceName, q as getSkillsCollectionName, t as fetchWithTimeout, u as searchSkills, v as SKILLS_DIR, w as getSkillInfo, x as downloadSkillFile, y as listSkillFiles } from './run-BaTwfE1Q.mjs';
4
+ import { p as parseFrontmatter, n as getSkillsServer, o as getSkillsWorkspaceName, q as getSkillsCollectionName, t as fetchWithTimeout, u as searchSkills, v as SKILLS_DIR, w as getSkillInfo, x as downloadSkillFile, y as listSkillFiles } from './run-DMahGhJP.mjs';
5
5
  import 'fs/promises';
6
6
  import 'url';
7
7
  import 'child_process';
@@ -1,7 +1,7 @@
1
1
  import { existsSync } from 'node:fs';
2
- import { connectAndGetMachine, resolveSessionId, createWorktree, connectAndResolveSession } from './commands-BV30A1zt.mjs';
2
+ import { connectAndGetMachine, resolveSessionId, createWorktree, connectAndResolveSession } from './commands-QGaI-ukW.mjs';
3
3
  import { execSync } from 'node:child_process';
4
- import { m as shortId } from './run-BaTwfE1Q.mjs';
4
+ import { m as shortId } from './run-DMahGhJP.mjs';
5
5
  import 'node:path';
6
6
  import 'node:os';
7
7
  import 'os';
@@ -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-BpBOWRbL.mjs');
61
+ const { runFrpcTunnel } = await import('./frpc-DrfDPPux.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-BV30A1zt.mjs');
71
+ const { connectAndGetMachine } = await import('./commands-QGaI-ukW.mjs');
72
72
  const { server, machine } = await connectAndGetMachine();
73
73
  try {
74
74
  const status = await machine.tunnelStart({
@@ -123,7 +123,7 @@ async function serviceServe(args) {
123
123
  };
124
124
  process.on("SIGINT", cleanup);
125
125
  process.on("SIGTERM", cleanup);
126
- const { runFrpcTunnel } = await import('./frpc-BpBOWRbL.mjs');
126
+ const { runFrpcTunnel } = await import('./frpc-DrfDPPux.mjs');
127
127
  await runFrpcTunnel(name, [caddyPort]);
128
128
  } catch (err) {
129
129
  console.error(`Error serving directory: ${err.message}`);
@@ -132,18 +132,29 @@ async function serviceServe(args) {
132
132
  }
133
133
  async function serviceList(_args) {
134
134
  try {
135
- const { connectAndGetMachine } = await import('./commands-BV30A1zt.mjs');
135
+ const { connectAndGetMachine } = await import('./commands-QGaI-ukW.mjs');
136
136
  const { server, machine } = await connectAndGetMachine();
137
137
  try {
138
138
  const tunnels = await machine.tunnelList({});
139
139
  if (!tunnels || tunnels.length === 0) {
140
- console.log("No active daemon-managed tunnels.");
140
+ console.log("No daemon-managed tunnels configured.");
141
141
  console.log("Standalone foreground tunnels (from `svamp service expose`) are not listed here \u2014 check `pgrep -af frpc`.");
142
142
  return;
143
143
  }
144
- console.log("Active daemon-managed tunnels:");
144
+ const label = (t) => typeof t.state === "string" ? t.state : t.connected ? "connected" : "disconnected";
145
+ const icon = { connected: "\u2713", reconnecting: "\u21BB", failed: "\u2717", disconnected: "\u2717" };
146
+ console.log("Daemon-managed tunnels:");
145
147
  for (const t of tunnels) {
146
- console.log(` ${t.name} \u2014 ${t.connected ? "connected" : "disconnected"}`);
148
+ const st = label(t);
149
+ const ports = Array.isArray(t.ports) && t.ports.length ? ` :${t.ports.join(",")}` : "";
150
+ let extra = "";
151
+ if (st !== "connected") {
152
+ const bits = [];
153
+ if (t.restartAttempts) bits.push(`${t.restartAttempts} restarts`);
154
+ if (t.probe && !t.probe.ok && t.probe.stalenessMs) bits.push(`probe stale ${Math.round(t.probe.stalenessMs / 1e3)}s`);
155
+ if (bits.length) extra = ` (${bits.join(", ")})`;
156
+ }
157
+ console.log(` ${icon[st] ?? "\u2022"} ${t.name}${ports} \u2014 ${st}${extra}`);
147
158
  }
148
159
  } finally {
149
160
  await server.disconnect();
@@ -161,7 +172,7 @@ async function serviceDelete(args) {
161
172
  process.exit(1);
162
173
  }
163
174
  try {
164
- const { connectAndGetMachine } = await import('./commands-BV30A1zt.mjs');
175
+ const { connectAndGetMachine } = await import('./commands-QGaI-ukW.mjs');
165
176
  const { server, machine } = await connectAndGetMachine();
166
177
  try {
167
178
  await machine.tunnelStop({ name });
@@ -1,11 +1,11 @@
1
1
  import { writeFileSync, readFileSync } from 'fs';
2
2
  import { resolve } from 'path';
3
- import { connectAndGetMachine } from './commands-BV30A1zt.mjs';
3
+ import { connectAndGetMachine } from './commands-QGaI-ukW.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-BaTwfE1Q.mjs';
8
+ import './run-DMahGhJP.mjs';
9
9
  import 'os';
10
10
  import 'fs/promises';
11
11
  import 'url';
@@ -1,7 +1,7 @@
1
1
  import { execSync, execFileSync } from 'node:child_process';
2
2
  import { randomUUID } from 'node:crypto';
3
3
  import { createServer } from 'node:http';
4
- import { E as readChecklist, F as compileChecklist, G as RoutineStore, H as RoutineRunner } from './run-BaTwfE1Q.mjs';
4
+ import { E as readChecklist, F as compileChecklist, G as RoutineStore, H as RoutineRunner } from './run-DMahGhJP.mjs';
5
5
  import 'os';
6
6
  import 'fs/promises';
7
7
  import 'fs';
@@ -104,7 +104,7 @@ Criteria: ${res.criteria || "(none)"}
104
104
  urgency: "normal",
105
105
  hopCount: 1
106
106
  };
107
- const { connectAndGetMachine } = await import('./commands-BV30A1zt.mjs');
107
+ const { connectAndGetMachine } = await import('./commands-QGaI-ukW.mjs');
108
108
  const { server, machine } = await connectAndGetMachine();
109
109
  try {
110
110
  await machine.sessionRPC(reportTo, "sendInboxMessage", { message });
@@ -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 { I as formatHandle, J as normalizeAllowedUser, K as loadSecurityContextConfig, L as resolveSecurityContext, M as buildSecurityContextFromFlags, N as mergeSecurityContexts, c as connectToHypha, O as buildSessionShareUrl, P as computeOutboundHop, m as shortId, Q as buildMachineShareUrl, T as parseHandle, U as handleMatchesMetadata } from './run-BaTwfE1Q.mjs';
5
+ import { I as formatHandle, J as normalizeAllowedUser, K as loadSecurityContextConfig, L as resolveSecurityContext, M as buildSecurityContextFromFlags, N as mergeSecurityContexts, c as connectToHypha, O as buildSessionShareUrl, P as computeOutboundHop, m as shortId, Q as buildMachineShareUrl, T as parseHandle, U as handleMatchesMetadata } from './run-DMahGhJP.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-BaTwfE1Q.mjs';
4
+ import { c as connectToHypha } from './run-DMahGhJP.mjs';
5
5
  import { PINNED_CLAUDE_CODE_VERSION } from './pinnedClaudeCode-HydRNEt7.mjs';
6
6
  import 'os';
7
7
  import 'fs/promises';
@@ -1,9 +1,10 @@
1
1
  import { spawn, execSync } from 'child_process';
2
+ import { createServer } from 'net';
2
3
  import { mkdirSync, writeFileSync, unlinkSync, existsSync, chmodSync, readFileSync } from 'fs';
3
4
  import { join } from 'path';
4
5
  import { homedir, platform, arch } from 'os';
5
- import { createHash, randomUUID } from 'crypto';
6
- import { h as getFrpsSubdomainHost, i as getFrpsServerPort, j as getFrpsServerAddr } from './run-BaTwfE1Q.mjs';
6
+ import { randomUUID, createHash } from 'crypto';
7
+ import { h as getFrpsSubdomainHost, i as getFrpsServerPort, j as getFrpsServerAddr } from './run-DMahGhJP.mjs';
7
8
  import 'fs/promises';
8
9
  import 'url';
9
10
  import 'node:crypto';
@@ -124,7 +125,7 @@ async function ensureFrpc(log) {
124
125
  }
125
126
  return FRPC_BIN;
126
127
  }
127
- function generateFrpcConfig(config, proxies) {
128
+ function generateFrpcConfig(config, proxies, admin) {
128
129
  const useWSS = config.serverPort === 443;
129
130
  const lines = [
130
131
  "# Auto-generated by svamp \u2014 do not edit",
@@ -154,6 +155,14 @@ function generateFrpcConfig(config, proxies) {
154
155
  'log.level = "info"',
155
156
  ""
156
157
  ];
158
+ if (admin) {
159
+ lines.push("# Local admin/status API (loopback only \u2014 polled by the svamp daemon)");
160
+ lines.push('webServer.addr = "127.0.0.1"');
161
+ lines.push(`webServer.port = ${admin.port}`);
162
+ lines.push(`webServer.user = "${admin.user}"`);
163
+ lines.push(`webServer.password = "${admin.password}"`);
164
+ lines.push("");
165
+ }
157
166
  for (const proxy of proxies) {
158
167
  lines.push(`[[proxies]]`);
159
168
  lines.push(`name = "${proxy.name}"`);
@@ -189,6 +198,42 @@ function generateFrpcConfig(config, proxies) {
189
198
  }
190
199
  return lines.join("\n");
191
200
  }
201
+ function getFreePort() {
202
+ return new Promise((resolve, reject) => {
203
+ const srv = createServer();
204
+ srv.unref();
205
+ srv.on("error", reject);
206
+ srv.listen(0, "127.0.0.1", () => {
207
+ const addr = srv.address();
208
+ const port = typeof addr === "object" && addr ? addr.port : 0;
209
+ srv.close(() => port ? resolve(port) : reject(new Error("no port")));
210
+ });
211
+ });
212
+ }
213
+ function parseFrpcStatus(payload, proxyNames) {
214
+ const byName = /* @__PURE__ */ new Map();
215
+ if (payload && typeof payload === "object") {
216
+ for (const group of Object.values(payload)) {
217
+ if (!Array.isArray(group)) continue;
218
+ for (const p of group) {
219
+ if (p && typeof p.name === "string") {
220
+ byName.set(p.name, { status: String(p.status ?? ""), err: p.err ? String(p.err) : void 0 });
221
+ }
222
+ }
223
+ }
224
+ }
225
+ const missing = [];
226
+ const failed = [];
227
+ for (const name of proxyNames) {
228
+ const entry = byName.get(name);
229
+ if (!entry) {
230
+ missing.push(name);
231
+ continue;
232
+ }
233
+ if (entry.status !== "running") failed.push({ name, status: entry.status, err: entry.err });
234
+ }
235
+ return { allRunning: missing.length === 0 && failed.length === 0, missing, failed };
236
+ }
192
237
  class FrpcTunnel {
193
238
  process = null;
194
239
  _connected = false;
@@ -211,6 +256,11 @@ class FrpcTunnel {
211
256
  _lastProbeOkAt = 0;
212
257
  _lastProbeFailAt = 0;
213
258
  _probeOk = false;
259
+ // frpc admin/status API state (set when options.adminStatus is true).
260
+ _adminPort = 0;
261
+ _adminUser = "svamp";
262
+ _adminPassword = randomUUID();
263
+ _statusTimer = null;
214
264
  constructor(options) {
215
265
  this.options = options;
216
266
  this.log = options.log || ((msg) => console.log(`[FRPC] ${msg}`));
@@ -255,7 +305,18 @@ class FrpcTunnel {
255
305
  if (this._destroyed) return;
256
306
  if (this.process) return;
257
307
  const frpcPath = await ensureFrpc(this.log);
258
- const configContent = generateFrpcConfig(this.serverConfig, this.proxies);
308
+ let admin;
309
+ if (this.options.adminStatus) {
310
+ if (!this._adminPort) {
311
+ try {
312
+ this._adminPort = await getFreePort();
313
+ } catch (err) {
314
+ this.log(`admin port alloc failed: ${err?.message ?? err}`);
315
+ }
316
+ }
317
+ if (this._adminPort) admin = { port: this._adminPort, user: this._adminUser, password: this._adminPassword };
318
+ }
319
+ const configContent = generateFrpcConfig(this.serverConfig, this.proxies, admin);
259
320
  writeFileSync(this.configPath, configContent);
260
321
  this.log(`Config written to ${this.configPath}`);
261
322
  return new Promise((resolve, reject) => {
@@ -335,6 +396,8 @@ class FrpcTunnel {
335
396
  }
336
397
  }
337
398
  });
399
+ } else if (this.options.adminStatus && this._adminPort) {
400
+ this.startAdminStatusLoop();
338
401
  }
339
402
  setTimeout(() => {
340
403
  if (!resolved) {
@@ -433,11 +496,86 @@ class FrpcTunnel {
433
496
  this._probeTimer = null;
434
497
  }
435
498
  }
499
+ /**
500
+ * Poll frpc's loopback admin API (`/api/status`) to track whether this
501
+ * tunnel's proxies are registered ("running"). Feeds the same `_probeOk` /
502
+ * staleness fields the daemon health loop watches, so a ghosted/stuck proxy
503
+ * is detected and recreated even with no HTTP health endpoint on the backend.
504
+ *
505
+ * Conservative semantics (critical infra — must not churn healthy tunnels):
506
+ * - all proxies "running" → ok (refresh lastProbeOkAt)
507
+ * - a proxy present but not running, or missing after a grace period
508
+ * → fail (sets lastProbeFailAt; daemon recreates after staleness)
509
+ * - admin API unreachable → INCONCLUSIVE: leave _probeOk untouched
510
+ * (a transient blip can't flip ok→fail)
511
+ */
512
+ startAdminStatusLoop() {
513
+ this.stopAdminStatusLoop();
514
+ if (!this._adminPort) return;
515
+ const proxyNames = this.proxies.map((p) => p.name);
516
+ const intervalMs = this.options.probeIntervalMs ?? 3e4;
517
+ const startedAt = Date.now();
518
+ const auth = "Basic " + Buffer.from(`${this._adminUser}:${this._adminPassword}`).toString("base64");
519
+ this._probeOk = true;
520
+ this._lastProbeOkAt = Date.now();
521
+ let inFlight = false;
522
+ const poll = async () => {
523
+ if (this._destroyed || inFlight || !this.process) return;
524
+ inFlight = true;
525
+ try {
526
+ const ctrl = new AbortController();
527
+ const timer = setTimeout(() => ctrl.abort(), 5e3);
528
+ let payload;
529
+ try {
530
+ const resp = await fetch(`http://127.0.0.1:${this._adminPort}/api/status`, {
531
+ headers: { Authorization: auth },
532
+ signal: ctrl.signal
533
+ });
534
+ if (!resp.ok) throw new Error(`admin status ${resp.status}`);
535
+ payload = await resp.json();
536
+ } finally {
537
+ clearTimeout(timer);
538
+ }
539
+ const { allRunning, missing, failed } = parseFrpcStatus(payload, proxyNames);
540
+ const graceElapsed = Date.now() - startedAt > 2e4;
541
+ if (allRunning || !failed.length && !graceElapsed) {
542
+ const wasFailing = !this._probeOk;
543
+ this._probeOk = true;
544
+ this._lastProbeOkAt = Date.now();
545
+ if (wasFailing) this.log(`admin status ok: all proxies running`);
546
+ } else {
547
+ const wasOk = this._probeOk;
548
+ this._probeOk = false;
549
+ this._lastProbeFailAt = Date.now();
550
+ if (wasOk) {
551
+ const detail = [
552
+ ...failed.map((f) => `${f.name}=${f.status}${f.err ? ` (${f.err})` : ""}`),
553
+ ...missing.map((m) => `${m}=missing`)
554
+ ].join(", ");
555
+ this.log(`admin status fail: ${detail}`);
556
+ this.options.onProbeFail?.(new Error(`frpc proxy not running: ${detail}`));
557
+ }
558
+ }
559
+ } catch {
560
+ } finally {
561
+ inFlight = false;
562
+ }
563
+ };
564
+ if (intervalMs > 0) this._statusTimer = setInterval(poll, intervalMs);
565
+ setTimeout(() => void poll(), 3e3);
566
+ }
567
+ stopAdminStatusLoop() {
568
+ if (this._statusTimer) {
569
+ clearInterval(this._statusTimer);
570
+ this._statusTimer = null;
571
+ }
572
+ }
436
573
  /** Disconnect and stop the frpc process. */
437
574
  destroy() {
438
575
  this._destroyed = true;
439
576
  this._connected = false;
440
577
  this.stopProbeLoop();
578
+ this.stopAdminStatusLoop();
441
579
  if (this.process) {
442
580
  this.process.kill("SIGTERM");
443
581
  const p = this.process;
@@ -473,8 +611,8 @@ class FrpcTunnel {
473
611
  firstErrorAt: this._firstErrorAt,
474
612
  restartAttempts: this._restartAttempts,
475
613
  failingDurationMs: this._firstErrorAt > 0 ? Date.now() - this._firstErrorAt : 0,
476
- probe: this.resolveProbeUrl() ? {
477
- url: this.resolveProbeUrl(),
614
+ probe: this.resolveProbeUrl() || this.options.adminStatus && this._adminPort ? {
615
+ url: this.resolveProbeUrl() || `frpc-admin:${this._adminPort}/api/status`,
478
616
  ok: this._probeOk,
479
617
  lastOkAt: this._lastProbeOkAt,
480
618
  lastFailAt: this._lastProbeFailAt,
@@ -485,7 +623,8 @@ class FrpcTunnel {
485
623
  /** Update the Hypha token. Rewrites config; takes effect on next frpc restart. */
486
624
  updateToken(newToken) {
487
625
  this.serverConfig.hyphaToken = newToken;
488
- const configContent = generateFrpcConfig(this.serverConfig, this.proxies);
626
+ const admin = this.options.adminStatus && this._adminPort ? { port: this._adminPort, user: this._adminUser, password: this._adminPassword } : void 0;
627
+ const configContent = generateFrpcConfig(this.serverConfig, this.proxies, admin);
489
628
  writeFileSync(this.configPath, configContent);
490
629
  this.log("Config updated with fresh token");
491
630
  }
@@ -539,4 +678,4 @@ async function runFrpcTunnel(name, ports, serverConfig, tunnelOptions) {
539
678
  }
540
679
  }
541
680
 
542
- export { FrpcTunnel, ensureFrpc, generateFrpcConfig, runFrpcTunnel };
681
+ export { FrpcTunnel, ensureFrpc, generateFrpcConfig, getFreePort, parseFrpcStatus, runFrpcTunnel };
@@ -1,5 +1,5 @@
1
- import { D as resolveModel, V as describeMisconfiguration, W as buildMachineDeps } from './run-BaTwfE1Q.mjs';
2
- import { handleRealtimeEvent, initMachineVoiceSession } from './sideband-D_Hzijan.mjs';
1
+ import { D as resolveModel, V as describeMisconfiguration, W as buildMachineDeps } from './run-DMahGhJP.mjs';
2
+ import { handleRealtimeEvent, initMachineVoiceSession } from './sideband-Bk7iN3dp.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-BaTwfE1Q.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-DMahGhJP.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.129";
2
+ var version = "0.2.130";
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 && mkdir -p bin/skills && cp -r ../../skills/artifact bin/skills/artifact && cp -r ../../skills/loop bin/skills/loop && cp -r ../../skills/crew bin/skills/crew && tsc --noEmit && pkgroll",
21
21
  typecheck: "tsc --noEmit",
22
- test: "npx tsx test/test-context-window.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-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-loop-activation.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-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.mjs && npx tsx test/test-checklist.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 && node test/pinnedClaudeCode.test.mjs && node test/fleet.test.mjs && npx tsx test/test-routine.mjs && npx tsx test/test-routine-rpc.mjs && npx tsx test/test-checklist-watchdog.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-channel-async-reply.mjs && npx tsx test/test-channel-binding.mjs && npx tsx test/test-channel-identity.mjs && npx tsx test/test-wise-agent-auth.mjs && npx tsx test/test-channel-http.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",
22
+ test: "npx tsx test/test-context-window.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-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-loop-activation.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-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.mjs && npx tsx test/test-checklist.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-routine.mjs && npx tsx test/test-routine-rpc.mjs && npx tsx test/test-checklist-watchdog.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-channel-async-reply.mjs && npx tsx test/test-channel-binding.mjs && npx tsx test/test-channel-identity.mjs && npx tsx test/test-wise-agent-auth.mjs && npx tsx test/test-channel-http.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",
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{createRequire as _pkgrollCR}from"node:module";const require=_pkgrollCR(import.meta.url);import { X as generateFriendlyName, m as shortId, c as connectToHypha, a as createSessionStore, r as registerMachineService, Y as generateHookSettings } from './run-BaTwfE1Q.mjs';
1
+ import{createRequire as _pkgrollCR}from"node:module";const require=_pkgrollCR(import.meta.url);import { X as generateFriendlyName, m as shortId, c as connectToHypha, a as createSessionStore, r as registerMachineService, Y as generateHookSettings } from './run-DMahGhJP.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';
@@ -2677,7 +2677,7 @@ async function registerMachineService(server, machineId, metadata, daemonState,
2677
2677
  const tunnels = handlers.tunnels;
2678
2678
  if (!tunnels) throw new Error("Tunnel management not available");
2679
2679
  if (tunnels.has(params.name)) throw new Error(`Tunnel '${params.name}' already running`);
2680
- const { FrpcTunnel } = await import('./frpc-BpBOWRbL.mjs');
2680
+ const { FrpcTunnel } = await import('./frpc-DrfDPPux.mjs');
2681
2681
  const tunnel = new FrpcTunnel({
2682
2682
  name: params.name,
2683
2683
  ports: params.ports,
@@ -2686,6 +2686,10 @@ async function registerMachineService(server, machineId, metadata, daemonState,
2686
2686
  healthCheckType: params.healthCheckType,
2687
2687
  healthCheckPath: params.healthCheckPath,
2688
2688
  healthCheckInterval: params.healthCheckInterval,
2689
+ // Poll frpc's loopback admin API for backend-agnostic
2690
+ // ghost/stuck-proxy detection (the daemon health loop recreates
2691
+ // on persistent failure).
2692
+ adminStatus: true,
2689
2693
  onError: (err) => console.error(`[FRPC] ${params.name}: ${err.message}`),
2690
2694
  onConnect: () => console.log(`[FRPC] ${params.name}: connected`),
2691
2695
  onDisconnect: () => console.log(`[FRPC] ${params.name}: disconnected, will auto-reconnect`)
@@ -2718,14 +2722,47 @@ async function registerMachineService(server, machineId, metadata, daemonState,
2718
2722
  handlers.forgetExposedTunnel?.(params.name);
2719
2723
  return { name: params.name, stopped: true };
2720
2724
  },
2721
- /** List active tunnels with health status. */
2725
+ /**
2726
+ * List the full CONFIGURED set of daemon-managed tunnels with a
2727
+ * derived per-tunnel `state`, not just the ones currently live. The
2728
+ * configured set comes from the persisted specs (survives restarts +
2729
+ * mid-recreate gaps); each is joined with its live FrpcTunnel status
2730
+ * if present. A tunnel that's persisted but not live (failed restore,
2731
+ * recreating) shows up as `reconnecting` instead of silently vanishing.
2732
+ */
2722
2733
  tunnelList: async (context) => {
2723
2734
  authorizeRequest(context, currentMetadata.sharing, "view");
2724
2735
  const tunnels = handlers.tunnels;
2725
2736
  if (!tunnels) return [];
2726
- return Array.from(tunnels.entries()).map(([, tunnel]) => ({
2727
- ...tunnel.status
2728
- }));
2737
+ const specs = handlers.listExposedTunnels?.() ?? [];
2738
+ const seen = /* @__PURE__ */ new Set();
2739
+ const rows = [];
2740
+ const stateOf = (s) => {
2741
+ if (!s) return "reconnecting";
2742
+ if (s.probe && !s.probe.ok) return "failed";
2743
+ if (s.connected) return "connected";
2744
+ return s.restartAttempts > 0 ? "reconnecting" : "failed";
2745
+ };
2746
+ for (const spec of specs) {
2747
+ seen.add(spec.name);
2748
+ const tunnel = tunnels.get(spec.name);
2749
+ const status = tunnel ? tunnel.status : null;
2750
+ rows.push({
2751
+ name: spec.name,
2752
+ ports: spec.ports,
2753
+ group: spec.group,
2754
+ configured: true,
2755
+ live: !!tunnel,
2756
+ state: stateOf(status),
2757
+ ...status ?? {}
2758
+ });
2759
+ }
2760
+ for (const [name, tunnel] of tunnels) {
2761
+ if (seen.has(name)) continue;
2762
+ const status = tunnel.status;
2763
+ rows.push({ ...status, name, configured: false, live: true, state: stateOf(status) });
2764
+ }
2765
+ return rows;
2729
2766
  },
2730
2767
  // ── Shared static file server ────────────────────────────────────
2731
2768
  /** Add a mount to the shared static file server. */
@@ -2938,7 +2975,7 @@ QUESTION: ${params.question || "Summarize this concisely."}` }
2938
2975
  }
2939
2976
  const deps = buildSessionDeps(rpc, { cwd, ownerEmail: owner });
2940
2977
  const sender = { name: context?.user?.email || context?.user?.id || "user", kind: "user", verified: true };
2941
- const { toolsForRole } = await import('./sideband-D_Hzijan.mjs');
2978
+ const { toolsForRole } = await import('./sideband-Bk7iN3dp.mjs');
2942
2979
  const r2 = await runWiseAgent({ message: params.message, sender, config: { tools: toolsForRole(role2) }, deps, transport, model: resolved.model });
2943
2980
  return fmt(r2);
2944
2981
  }
@@ -3037,7 +3074,7 @@ QUESTION: ${params.question || "Summarize this concisely."}` }
3037
3074
  if (r.error || !r.sender) return { error: r.error || "unauthorized" };
3038
3075
  const callId = "call_" + Math.random().toString(16).slice(2, 12);
3039
3076
  const rendered = renderMessage(c, { sender: r.sender, body: { message: kwargs.message }, callId });
3040
- const { queryCore } = await import('./commands-BV30A1zt.mjs');
3077
+ const { queryCore } = await import('./commands-QGaI-ukW.mjs');
3041
3078
  const timeout = c.reply?.timeout_sec || 120;
3042
3079
  let result;
3043
3080
  try {
@@ -3519,9 +3556,20 @@ function patchStoredText(msg, newText) {
3519
3556
  return true;
3520
3557
  }
3521
3558
  if (data?.type === "assistant" && Array.isArray(data?.message?.content)) {
3522
- const textBlocks = data.message.content.filter((b) => b && b.type === "text" && typeof b.text === "string");
3523
- if (textBlocks.length === 1) {
3559
+ const content = data.message.content;
3560
+ const isText = (b) => b && b.type === "text" && typeof b.text === "string";
3561
+ const textBlocks = content.filter(isText);
3562
+ if (textBlocks.length >= 1) {
3524
3563
  textBlocks[0].text = newText;
3564
+ let seen = false;
3565
+ data.message.content = content.filter((b) => {
3566
+ if (!isText(b)) return true;
3567
+ if (!seen) {
3568
+ seen = true;
3569
+ return true;
3570
+ }
3571
+ return false;
3572
+ });
3525
3573
  return true;
3526
3574
  }
3527
3575
  }
@@ -7734,11 +7782,21 @@ function applyTranscriptEdit(file, index, newText) {
7734
7782
  if (target.type === "assistant") {
7735
7783
  const content = target?.message?.content;
7736
7784
  if (!Array.isArray(content)) return { ok: false, reason: "assistant content is not a block array" };
7737
- const textBlocks = content.filter((b) => b && b.type === "text" && typeof b.text === "string");
7738
- if (textBlocks.length !== 1) {
7739
- return { ok: false, reason: `expected exactly 1 text block, found ${textBlocks.length}` };
7785
+ const isText = (b) => b && b.type === "text" && typeof b.text === "string";
7786
+ const textBlocks = content.filter(isText);
7787
+ if (textBlocks.length === 0) {
7788
+ return { ok: false, reason: "expected at least 1 text block, found 0" };
7740
7789
  }
7741
7790
  textBlocks[0].text = newText;
7791
+ let seen = false;
7792
+ target.message.content = content.filter((b) => {
7793
+ if (!isText(b)) return true;
7794
+ if (!seen) {
7795
+ seen = true;
7796
+ return true;
7797
+ }
7798
+ return false;
7799
+ });
7742
7800
  } else if (target.type === "user") {
7743
7801
  if (typeof target?.message?.content !== "string") {
7744
7802
  return { ok: false, reason: "user content is not a string" };
@@ -11328,7 +11386,28 @@ async function startDaemon(options) {
11328
11386
  const list = loadExposedTunnels().filter((t) => t.name !== name);
11329
11387
  saveExposedTunnels(list);
11330
11388
  }
11331
- const { ServeManager } = await import('./serveManager-cPgahjYE.mjs');
11389
+ async function createExposedTunnel(spec) {
11390
+ const { FrpcTunnel } = await import('./frpc-DrfDPPux.mjs');
11391
+ const tunnel = new FrpcTunnel({
11392
+ name: spec.name,
11393
+ ports: spec.ports,
11394
+ group: spec.group,
11395
+ groupKey: spec.groupKey,
11396
+ healthCheckType: spec.healthCheckType,
11397
+ healthCheckPath: spec.healthCheckPath,
11398
+ healthCheckInterval: spec.healthCheckInterval,
11399
+ // Backend-agnostic ghost/stuck-proxy detection via frpc's loopback
11400
+ // admin API — exposed backends rarely have an HTTP health endpoint.
11401
+ adminStatus: true,
11402
+ onError: (err) => logger.log(`[FRPC ${spec.name}] ${err.message}`),
11403
+ onConnect: () => logger.log(`[FRPC ${spec.name}] connected`),
11404
+ onDisconnect: () => logger.log(`[FRPC ${spec.name}] disconnected, will auto-reconnect`)
11405
+ });
11406
+ await tunnel.connect();
11407
+ return tunnel;
11408
+ }
11409
+ const tunnelRecreateState = /* @__PURE__ */ new Map();
11410
+ const { ServeManager } = await import('./serveManager-Csqa6icR.mjs');
11332
11411
  const serveManager = new ServeManager(SVAMP_HOME, (msg) => logger.log(`[SERVE] ${msg}`), hyphaServerUrl);
11333
11412
  ensureAutoInstalledSkills(logger).catch(() => {
11334
11413
  });
@@ -13988,7 +14067,8 @@ ${capturedError}${buildClaudeErrorHint(capturedError)}`;
13988
14067
  serveManager,
13989
14068
  sharingNotificationSync,
13990
14069
  persistExposedTunnel,
13991
- forgetExposedTunnel
14070
+ forgetExposedTunnel,
14071
+ listExposedTunnels: () => loadExposedTunnels().map((t) => ({ name: t.name, ports: t.ports, group: t.group, addedAt: t.addedAt }))
13992
14072
  }
13993
14073
  );
13994
14074
  logger.log(`Machine service registered: svamp-machine-${machineId}`);
@@ -14016,23 +14096,10 @@ ${capturedError}${buildClaudeErrorHint(capturedError)}`;
14016
14096
  const specs = loadExposedTunnels();
14017
14097
  if (specs.length === 0) return;
14018
14098
  logger.log(`[exposed-tunnels] Restoring ${specs.length} tunnel(s) from ${EXPOSED_TUNNELS_FILE}`);
14019
- const { FrpcTunnel } = await import('./frpc-BpBOWRbL.mjs');
14020
14099
  for (const spec of specs) {
14021
14100
  if (tunnels.has(spec.name)) continue;
14022
14101
  try {
14023
- const tunnel = new FrpcTunnel({
14024
- name: spec.name,
14025
- ports: spec.ports,
14026
- group: spec.group,
14027
- groupKey: spec.groupKey,
14028
- healthCheckType: spec.healthCheckType,
14029
- healthCheckPath: spec.healthCheckPath,
14030
- healthCheckInterval: spec.healthCheckInterval,
14031
- onError: (err) => logger.log(`[FRPC ${spec.name}] ${err.message}`),
14032
- onConnect: () => logger.log(`[FRPC ${spec.name}] connected (restored)`),
14033
- onDisconnect: () => logger.log(`[FRPC ${spec.name}] disconnected, will auto-reconnect`)
14034
- });
14035
- await tunnel.connect();
14102
+ const tunnel = await createExposedTunnel(spec);
14036
14103
  tunnels.set(spec.name, tunnel);
14037
14104
  logger.log(`[exposed-tunnels] Restored: ${spec.name} \u2192 ports ${spec.ports.join(",")}`);
14038
14105
  } catch (err) {
@@ -14390,11 +14457,39 @@ ${capturedError}${buildClaudeErrorHint(capturedError)}`;
14390
14457
  for (const [name, tunnel] of tunnels) {
14391
14458
  const health = tunnel.status;
14392
14459
  const reason = tunnelLooksDead(health);
14393
- if (reason) {
14394
- logger.log(`frpc tunnel '${name}' ${reason} \u2014 destroying stale tunnel`);
14395
- tunnel.destroy();
14460
+ if (!reason) {
14461
+ tunnelRecreateState.delete(name);
14462
+ continue;
14463
+ }
14464
+ const spec = loadExposedTunnels().find((t) => t.name === name);
14465
+ if (!spec) {
14466
+ logger.log(`frpc tunnel '${name}' ${reason}, no persisted spec \u2014 destroying (cannot recreate)`);
14467
+ try {
14468
+ tunnel.destroy();
14469
+ } catch {
14470
+ }
14396
14471
  tunnels.delete(name);
14472
+ tunnelRecreateState.delete(name);
14473
+ continue;
14397
14474
  }
14475
+ const now = Date.now();
14476
+ const st = tunnelRecreateState.get(name) ?? { nextAttemptAt: 0, attempts: 0 };
14477
+ if (now < st.nextAttemptAt) continue;
14478
+ st.attempts++;
14479
+ st.nextAttemptAt = now + Math.min(15e3 * Math.pow(2, st.attempts - 1), 5 * 6e4);
14480
+ tunnelRecreateState.set(name, st);
14481
+ logger.log(`frpc tunnel '${name}' ${reason} \u2014 recreating (attempt ${st.attempts})`);
14482
+ try {
14483
+ tunnel.destroy();
14484
+ } catch {
14485
+ }
14486
+ tunnels.delete(name);
14487
+ createExposedTunnel(spec).then((fresh) => {
14488
+ tunnels.set(name, fresh);
14489
+ logger.log(`frpc tunnel '${name}' recreated`);
14490
+ }).catch((err) => {
14491
+ logger.log(`frpc tunnel '${name}' recreate failed: ${err.message} (will retry)`);
14492
+ });
14398
14493
  }
14399
14494
  } finally {
14400
14495
  heartbeatRunning = false;
@@ -54,7 +54,7 @@ async function handleServeCommand() {
54
54
  }
55
55
  }
56
56
  async function serveAdd(args, machineId) {
57
- const { connectAndGetMachine } = await import('./commands-BV30A1zt.mjs');
57
+ const { connectAndGetMachine } = await import('./commands-QGaI-ukW.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-BV30A1zt.mjs');
96
+ const { connectAndGetMachine } = await import('./commands-QGaI-ukW.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-BV30A1zt.mjs');
185
+ const { connectAndGetMachine } = await import('./commands-QGaI-ukW.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-BV30A1zt.mjs');
205
+ const { connectAndGetMachine } = await import('./commands-QGaI-ukW.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-BV30A1zt.mjs');
238
+ const { connectAndGetMachine } = await import('./commands-QGaI-ukW.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-BaTwfE1Q.mjs';
7
+ import { k as getHyphaServerUrl, S as ServeAuth, l as hasCookieToken } from './run-DMahGhJP.mjs';
8
8
  import 'os';
9
9
  import 'fs/promises';
10
10
  import 'url';
@@ -713,7 +713,7 @@ class ServeManager {
713
713
  const mount = this.mounts.get(mountName);
714
714
  const subdomainOverride = mount?.access === "link" && mount.linkToken ? /* @__PURE__ */ new Map([[this.port, `static-${subdomainSafe}-${mount.linkToken}`]]) : void 0;
715
715
  try {
716
- const { FrpcTunnel } = await import('./frpc-BpBOWRbL.mjs');
716
+ const { FrpcTunnel } = await import('./frpc-DrfDPPux.mjs');
717
717
  let tunnel;
718
718
  tunnel = new FrpcTunnel({
719
719
  name: tunnelName,
@@ -1,4 +1,4 @@
1
- import { R as READ_ONLY_TOOLS, z as loadMachineContext, A as buildMachineInstructions, B as machineToolsForRole, C as buildMachineTools } from './run-BaTwfE1Q.mjs';
1
+ import { R as READ_ONLY_TOOLS, z as loadMachineContext, A as buildMachineInstructions, B as machineToolsForRole, C as buildMachineTools } from './run-DMahGhJP.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.129",
3
+ "version": "0.2.130",
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 && mkdir -p bin/skills && cp -r ../../skills/artifact bin/skills/artifact && cp -r ../../skills/loop bin/skills/loop && cp -r ../../skills/crew bin/skills/crew && tsc --noEmit && pkgroll",
22
22
  "typecheck": "tsc --noEmit",
23
- "test": "npx tsx test/test-context-window.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-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-loop-activation.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-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.mjs && npx tsx test/test-checklist.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 && node test/pinnedClaudeCode.test.mjs && node test/fleet.test.mjs && npx tsx test/test-routine.mjs && npx tsx test/test-routine-rpc.mjs && npx tsx test/test-checklist-watchdog.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-channel-async-reply.mjs && npx tsx test/test-channel-binding.mjs && npx tsx test/test-channel-identity.mjs && npx tsx test/test-wise-agent-auth.mjs && npx tsx test/test-channel-http.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",
23
+ "test": "npx tsx test/test-context-window.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-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-loop-activation.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-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.mjs && npx tsx test/test-checklist.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-routine.mjs && npx tsx test/test-routine-rpc.mjs && npx tsx test/test-checklist-watchdog.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-channel-async-reply.mjs && npx tsx test/test-channel-binding.mjs && npx tsx test/test-channel-identity.mjs && npx tsx test/test-wise-agent-auth.mjs && npx tsx test/test-channel-http.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",
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",