svamp-cli 0.2.178 → 0.2.179

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 (24) hide show
  1. package/dist/{agentCommands-BIn9btot.mjs → agentCommands-go20pLE-.mjs} +5 -5
  2. package/dist/{auth-DY_tcgLY.mjs → auth-BeRv91cp.mjs} +1 -1
  3. package/dist/cli.mjs +65 -63
  4. package/dist/{commands-CdMEMD_c.mjs → commands-BxyASXjK.mjs} +1 -1
  5. package/dist/{commands-BfdkS7Iy.mjs → commands-CXueSoWn.mjs} +1 -1
  6. package/dist/{commands-kepmDOXD.mjs → commands-D2LkJbHZ.mjs} +2 -2
  7. package/dist/{commands-J9WOCzDG.mjs → commands-DTPTgiQX.mjs} +2 -2
  8. package/dist/{commands-WgUO8QeK.mjs → commands-DYVY9T-f.mjs} +1 -1
  9. package/dist/{commands-BTyp-k7w.mjs → commands-DbaPB6M3.mjs} +5 -5
  10. package/dist/{commands-MjIkmrmC.mjs → commands-j4nqt7yR.mjs} +25 -4
  11. package/dist/{fleet-CDllUpMj.mjs → fleet-DgV81okW.mjs} +1 -1
  12. package/dist/{frpc-D4x74mG6.mjs → frpc-Bi1a1Oqy.mjs} +1 -1
  13. package/dist/{headlessCli-CmBCGmNV.mjs → headlessCli-DjSZYq-Z.mjs} +2 -2
  14. package/dist/index.mjs +1 -1
  15. package/dist/{package-B-yM7SvY.mjs → package-BL1oH1qy.mjs} +1 -1
  16. package/dist/{rpc-2TJ6ipXZ.mjs → rpc-CAi59ZCd.mjs} +1 -1
  17. package/dist/{rpc-DBH2bo8s.mjs → rpc-CND7PIf-.mjs} +3 -2
  18. package/dist/{run-B-1WDymr.mjs → run-CLeF1N9s.mjs} +140 -137
  19. package/dist/{run-BVNBqt1C.mjs → run-bBeQGLfT.mjs} +1 -1
  20. package/dist/{scheduler-C3j8Tghm.mjs → scheduler-CsaIxFN7.mjs} +8 -6
  21. package/dist/{serveCommands-BFWBxK8L.mjs → serveCommands-mDL4FmeZ.mjs} +5 -5
  22. package/dist/{serveManager-DXm1bdoU.mjs → serveManager-CqhigbGu.mjs} +2 -2
  23. package/dist/{sideband-Da1VG2iq.mjs → sideband-DLku7gcO.mjs} +1 -1
  24. package/package.json +1 -1
@@ -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 { x as shortId } from './run-B-1WDymr.mjs';
5
+ import { x as shortId } from './run-CLeF1N9s.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-B-1WDymr.mjs').then(function (n) { return n.a3; });
99
+ const { projectName, writeProjectInfo, sanitizeDescription, projectInfoPath } = await import('./run-CLeF1N9s.mjs').then(function (n) { return n.a3; });
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-MjIkmrmC.mjs');
183
+ const { connectAndGetMachine } = await import('./commands-j4nqt7yR.mjs');
184
184
  return connectAndGetMachine();
185
185
  }
186
186
  function buildInboxMessage(args) {
@@ -258,7 +258,7 @@ async function inboxSend(targetSessionId, opts) {
258
258
  console.error("Message body is required.");
259
259
  process.exit(1);
260
260
  }
261
- const { connectAndResolveSession } = await import('./commands-MjIkmrmC.mjs');
261
+ const { connectAndResolveSession } = await import('./commands-j4nqt7yR.mjs');
262
262
  let server;
263
263
  try {
264
264
  const { targetId, messageId } = await inboxSendCore(
@@ -312,7 +312,7 @@ async function inboxReply(messageId, body) {
312
312
  console.error("SVAMP_SESSION_ID not set. This command must be run inside a Svamp session.");
313
313
  process.exit(1);
314
314
  }
315
- const { connectAndResolveSession } = await import('./commands-MjIkmrmC.mjs');
315
+ const { connectAndResolveSession } = await import('./commands-j4nqt7yR.mjs');
316
316
  const { server: localServer, machine: localMachine } = await connectToMachineService();
317
317
  let localDisconnected = false;
318
318
  const disconnectLocal = async () => {
@@ -1,4 +1,4 @@
1
- import { M as resolveModel } from './run-B-1WDymr.mjs';
1
+ import { M as resolveModel } from './run-CLeF1N9s.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-B-1WDymr.mjs';
1
+ import { e as clearStopMarker, f as stopMarkerExists, s as startDaemon, b as stopDaemon, d as daemonStatus } from './run-CLeF1N9s.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-B-1WDymr.mjs').then(function (n) { return n.aa; });
37
+ const { getLoadedConfig } = await import('./run-CLeF1N9s.mjs').then(function (n) { return n.aa; });
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-B-1WDymr.mjs').then(function (n) { return n.ac; });
54
+ const { restartDaemon } = await import('./run-CLeF1N9s.mjs').then(function (n) { return n.ac; });
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-BTyp-k7w.mjs');
347
+ const { handleServiceCommand } = await import('./commands-DbaPB6M3.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-BFWBxK8L.mjs');
355
+ const { handleServeCommand } = await import('./serveCommands-mDL4FmeZ.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-kepmDOXD.mjs');
364
+ const { processCommand } = await import('./commands-D2LkJbHZ.mjs');
365
365
  let machineId;
366
366
  const processArgs = args.slice(1);
367
367
  const mIdx = processArgs.findIndex((a) => a === "--machine" || a === "-m");
@@ -375,18 +375,18 @@ async function main() {
375
375
  }), machineId);
376
376
  process.exit(0);
377
377
  } else if (subcommand === "issue" || subcommand === "issues") {
378
- const { issueCommand } = await import('./commands-BfdkS7Iy.mjs');
378
+ const { issueCommand } = await import('./commands-CXueSoWn.mjs');
379
379
  await issueCommand(args.slice(1));
380
380
  process.exit(0);
381
381
  } else if (subcommand === "workflow" || subcommand === "workflows") {
382
- const { workflowCommand } = await import('./commands-WgUO8QeK.mjs');
382
+ const { workflowCommand } = await import('./commands-DYVY9T-f.mjs');
383
383
  await workflowCommand(args.slice(1));
384
384
  process.exit(0);
385
385
  } else if (subcommand === "wise-agent" || subcommand === "wise") {
386
386
  await handleWiseAgentCommand(args.slice(1));
387
387
  process.exit(0);
388
388
  } else if (subcommand === "feature" || subcommand === "crew") {
389
- const { crewCommand } = await import('./commands-J9WOCzDG.mjs');
389
+ const { crewCommand } = await import('./commands-DTPTgiQX.mjs');
390
390
  await crewCommand(args.slice(1));
391
391
  process.exit(0);
392
392
  } else if (subcommand === "--help" || subcommand === "-h") {
@@ -394,7 +394,7 @@ async function main() {
394
394
  } else if (!subcommand || subcommand === "start") {
395
395
  await handleInteractiveCommand();
396
396
  } else if (subcommand === "--version" || subcommand === "-v") {
397
- const pkg = await import('./package-B-yM7SvY.mjs').catch(() => ({ default: { version: "unknown" } }));
397
+ const pkg = await import('./package-BL1oH1qy.mjs').catch(() => ({ default: { version: "unknown" } }));
398
398
  console.log(`svamp version: ${pkg.default.version}`);
399
399
  } else {
400
400
  console.error(`Unknown command: ${subcommand}`);
@@ -403,7 +403,7 @@ async function main() {
403
403
  }
404
404
  }
405
405
  async function handleInteractiveCommand() {
406
- const { runInteractive } = await import('./run-BVNBqt1C.mjs');
406
+ const { runInteractive } = await import('./run-bBeQGLfT.mjs');
407
407
  const interactiveArgs = subcommand === "start" ? args.slice(1) : args;
408
408
  let directory = process.cwd();
409
409
  let resumeSessionId;
@@ -448,7 +448,7 @@ async function handleAgentCommand() {
448
448
  return;
449
449
  }
450
450
  if (agentArgs[0] === "list") {
451
- const { KNOWN_ACP_AGENTS, KNOWN_MCP_AGENTS: KNOWN_MCP_AGENTS2 } = await import('./run-B-1WDymr.mjs').then(function (n) { return n.a6; });
451
+ const { KNOWN_ACP_AGENTS, KNOWN_MCP_AGENTS: KNOWN_MCP_AGENTS2 } = await import('./run-CLeF1N9s.mjs').then(function (n) { return n.a6; });
452
452
  console.log("Known agents:");
453
453
  for (const [name, config2] of Object.entries(KNOWN_ACP_AGENTS)) {
454
454
  console.log(` ${name.padEnd(12)} ${config2.command} ${config2.args.join(" ")} (ACP)`);
@@ -460,7 +460,7 @@ async function handleAgentCommand() {
460
460
  console.log('Use "svamp agent -- <command> [args]" for a custom ACP agent.');
461
461
  return;
462
462
  }
463
- const { resolveAcpAgentConfig, KNOWN_MCP_AGENTS } = await import('./run-B-1WDymr.mjs').then(function (n) { return n.a6; });
463
+ const { resolveAcpAgentConfig, KNOWN_MCP_AGENTS } = await import('./run-CLeF1N9s.mjs').then(function (n) { return n.a6; });
464
464
  let cwd = process.cwd();
465
465
  const filteredArgs = [];
466
466
  for (let i = 0; i < agentArgs.length; i++) {
@@ -484,12 +484,12 @@ async function handleAgentCommand() {
484
484
  console.log(`Starting ${config.agentName} agent in ${cwd}...`);
485
485
  let backend;
486
486
  if (KNOWN_MCP_AGENTS[config.agentName]) {
487
- const { CodexMcpBackend } = await import('./run-B-1WDymr.mjs').then(function (n) { return n.a7; });
487
+ const { CodexMcpBackend } = await import('./run-CLeF1N9s.mjs').then(function (n) { return n.a7; });
488
488
  backend = new CodexMcpBackend({ cwd, log: logFn });
489
489
  } else {
490
- const { AcpBackend } = await import('./run-B-1WDymr.mjs').then(function (n) { return n.a5; });
491
- const { GeminiTransport } = await import('./run-B-1WDymr.mjs').then(function (n) { return n.a8; });
492
- const { DefaultTransport } = await import('./run-B-1WDymr.mjs').then(function (n) { return n.a4; });
490
+ const { AcpBackend } = await import('./run-CLeF1N9s.mjs').then(function (n) { return n.a5; });
491
+ const { GeminiTransport } = await import('./run-CLeF1N9s.mjs').then(function (n) { return n.a8; });
492
+ const { DefaultTransport } = await import('./run-CLeF1N9s.mjs').then(function (n) { return n.a4; });
493
493
  const transportHandler = config.agentName === "gemini" ? new GeminiTransport() : new DefaultTransport(config.agentName);
494
494
  backend = new AcpBackend({
495
495
  agentName: config.agentName,
@@ -616,7 +616,7 @@ async function handleSessionCommand() {
616
616
  process.exit(1);
617
617
  }
618
618
  }
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-MjIkmrmC.mjs');
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-j4nqt7yR.mjs');
620
620
  const parseFlagStr = (flag, shortFlag) => {
621
621
  for (let i = 1; i < sessionArgs.length; i++) {
622
622
  if ((sessionArgs[i] === flag || shortFlag) && i + 1 < sessionArgs.length) {
@@ -684,7 +684,7 @@ async function handleSessionCommand() {
684
684
  allowDomain.push(sessionArgs[++i]);
685
685
  }
686
686
  }
687
- const { parseShareArg } = await import('./commands-MjIkmrmC.mjs');
687
+ const { parseShareArg } = await import('./commands-j4nqt7yR.mjs');
688
688
  const shareEntries = share.map((s) => parseShareArg(s));
689
689
  await sessionSpawn(agent, dir, targetMachineId, {
690
690
  message,
@@ -769,7 +769,7 @@ async function handleSessionCommand() {
769
769
  console.error(" Rewinds history: rewrites the message + drops everything after it, then restarts Claude.");
770
770
  process.exit(1);
771
771
  }
772
- const { sessionEditMessage } = await import('./commands-MjIkmrmC.mjs');
772
+ const { sessionEditMessage } = await import('./commands-j4nqt7yR.mjs');
773
773
  await sessionEditMessage(sessionArgs[1], sessionArgs[2], sessionArgs[3], targetMachineId);
774
774
  } else if (sessionSubcommand === "refine") {
775
775
  if (!sessionArgs[1] || !sessionArgs[2]) {
@@ -777,7 +777,7 @@ async function handleSessionCommand() {
777
777
  console.error(" Asks the agent to revise its latest reply in place (no extra round).");
778
778
  process.exit(1);
779
779
  }
780
- const { sessionRefineLastReply } = await import('./commands-MjIkmrmC.mjs');
780
+ const { sessionRefineLastReply } = await import('./commands-j4nqt7yR.mjs');
781
781
  await sessionRefineLastReply(sessionArgs[1], sessionArgs[2], targetMachineId);
782
782
  } else if (sessionSubcommand === "undo-edit" || sessionSubcommand === "undo") {
783
783
  if (!sessionArgs[1]) {
@@ -785,7 +785,7 @@ async function handleSessionCommand() {
785
785
  console.error(" Reverts the most recent edit/refine, restoring the pre-edit history.");
786
786
  process.exit(1);
787
787
  }
788
- const { sessionUndoEdit } = await import('./commands-MjIkmrmC.mjs');
788
+ const { sessionUndoEdit } = await import('./commands-j4nqt7yR.mjs');
789
789
  await sessionUndoEdit(sessionArgs[1], targetMachineId);
790
790
  } else if (sessionSubcommand === "query") {
791
791
  const dir = sessionArgs[1];
@@ -795,7 +795,7 @@ async function handleSessionCommand() {
795
795
  console.error(" Spawns a stateless Claude session in <directory>, sends <prompt>, prints the answer, then deletes the session.");
796
796
  process.exit(1);
797
797
  }
798
- const { sessionQuery } = await import('./commands-MjIkmrmC.mjs');
798
+ const { sessionQuery } = await import('./commands-j4nqt7yR.mjs');
799
799
  await sessionQuery(dir, prompt, targetMachineId, {
800
800
  timeout: parseFlagInt("--timeout"),
801
801
  json: hasFlag("--json"),
@@ -828,7 +828,7 @@ async function handleSessionCommand() {
828
828
  console.error("Usage: svamp session approve <session-id> [request-id] [--json]");
829
829
  process.exit(1);
830
830
  }
831
- const { sessionApprove } = await import('./commands-MjIkmrmC.mjs');
831
+ const { sessionApprove } = await import('./commands-j4nqt7yR.mjs');
832
832
  const approveReqId = sessionArgs[2] && !sessionArgs[2].startsWith("--") ? sessionArgs[2] : void 0;
833
833
  await sessionApprove(sessionArgs[1], approveReqId, targetMachineId, {
834
834
  json: hasFlag("--json")
@@ -838,7 +838,7 @@ async function handleSessionCommand() {
838
838
  console.error("Usage: svamp session deny <session-id> [request-id] [--json]");
839
839
  process.exit(1);
840
840
  }
841
- const { sessionDeny } = await import('./commands-MjIkmrmC.mjs');
841
+ const { sessionDeny } = await import('./commands-j4nqt7yR.mjs');
842
842
  const denyReqId = sessionArgs[2] && !sessionArgs[2].startsWith("--") ? sessionArgs[2] : void 0;
843
843
  await sessionDeny(sessionArgs[1], denyReqId, targetMachineId, {
844
844
  json: hasFlag("--json")
@@ -880,7 +880,7 @@ async function handleSessionCommand() {
880
880
  console.error("Usage: svamp session set-title <title>");
881
881
  process.exit(1);
882
882
  }
883
- const { sessionSetTitle } = await import('./agentCommands-BIn9btot.mjs');
883
+ const { sessionSetTitle } = await import('./agentCommands-go20pLE-.mjs');
884
884
  await sessionSetTitle(title);
885
885
  } else if (sessionSubcommand === "set-project-description" || sessionSubcommand === "set-project") {
886
886
  const desc = sessionArgs.slice(1).filter((a) => !a.startsWith("--")).join(" ");
@@ -888,7 +888,7 @@ async function handleSessionCommand() {
888
888
  console.error("Usage: svamp session set-project-description <text>");
889
889
  process.exit(1);
890
890
  }
891
- const { sessionSetProjectDescription } = await import('./agentCommands-BIn9btot.mjs');
891
+ const { sessionSetProjectDescription } = await import('./agentCommands-go20pLE-.mjs');
892
892
  await sessionSetProjectDescription(desc);
893
893
  } else if (sessionSubcommand === "set-link") {
894
894
  const url = sessionArgs[1];
@@ -897,7 +897,7 @@ async function handleSessionCommand() {
897
897
  process.exit(1);
898
898
  }
899
899
  const label = sessionArgs[2] && !sessionArgs[2].startsWith("--") ? sessionArgs[2] : void 0;
900
- const { sessionSetLink } = await import('./agentCommands-BIn9btot.mjs');
900
+ const { sessionSetLink } = await import('./agentCommands-go20pLE-.mjs');
901
901
  await sessionSetLink(url, label);
902
902
  } else if (sessionSubcommand === "notify") {
903
903
  const message = sessionArgs[1];
@@ -906,7 +906,7 @@ async function handleSessionCommand() {
906
906
  process.exit(1);
907
907
  }
908
908
  const level = parseFlagStr("--level") || "info";
909
- const { sessionNotify } = await import('./agentCommands-BIn9btot.mjs');
909
+ const { sessionNotify } = await import('./agentCommands-go20pLE-.mjs');
910
910
  await sessionNotify(message, level);
911
911
  } else if (sessionSubcommand === "broadcast") {
912
912
  const action = sessionArgs[1];
@@ -914,7 +914,7 @@ async function handleSessionCommand() {
914
914
  console.error("Usage: svamp session broadcast <action> [args...]\nActions: open-canvas <url> [label], close-canvas, toast <message>");
915
915
  process.exit(1);
916
916
  }
917
- const { sessionBroadcast } = await import('./agentCommands-BIn9btot.mjs');
917
+ const { sessionBroadcast } = await import('./agentCommands-go20pLE-.mjs');
918
918
  await sessionBroadcast(action, sessionArgs.slice(2).filter((a) => !a.startsWith("--")));
919
919
  } else if (sessionSubcommand === "inbox") {
920
920
  const inboxSubcmd = sessionArgs[1];
@@ -925,7 +925,7 @@ async function handleSessionCommand() {
925
925
  process.exit(1);
926
926
  }
927
927
  if (agentSessionId) {
928
- const { inboxSend } = await import('./agentCommands-BIn9btot.mjs');
928
+ const { inboxSend } = await import('./agentCommands-go20pLE-.mjs');
929
929
  await inboxSend(sessionArgs[2], {
930
930
  body: sessionArgs[3],
931
931
  subject: parseFlagStr("--subject"),
@@ -940,7 +940,7 @@ async function handleSessionCommand() {
940
940
  }
941
941
  } else if (inboxSubcmd === "list" || inboxSubcmd === "ls") {
942
942
  if (agentSessionId && !sessionArgs[2]) {
943
- const { inboxList } = await import('./agentCommands-BIn9btot.mjs');
943
+ const { inboxList } = await import('./agentCommands-go20pLE-.mjs');
944
944
  await inboxList({
945
945
  unread: hasFlag("--unread"),
946
946
  limit: parseFlagInt("--limit"),
@@ -962,7 +962,7 @@ async function handleSessionCommand() {
962
962
  process.exit(1);
963
963
  }
964
964
  if (agentSessionId && !sessionArgs[3]) {
965
- const { inboxList } = await import('./agentCommands-BIn9btot.mjs');
965
+ const { inboxList } = await import('./agentCommands-go20pLE-.mjs');
966
966
  await sessionInboxRead(agentSessionId, sessionArgs[2], targetMachineId);
967
967
  } else if (sessionArgs[3]) {
968
968
  await sessionInboxRead(sessionArgs[2], sessionArgs[3], targetMachineId);
@@ -972,7 +972,7 @@ async function handleSessionCommand() {
972
972
  }
973
973
  } else if (inboxSubcmd === "reply") {
974
974
  if (agentSessionId && sessionArgs[2] && sessionArgs[3] && !sessionArgs[4]) {
975
- const { inboxReply } = await import('./agentCommands-BIn9btot.mjs');
975
+ const { inboxReply } = await import('./agentCommands-go20pLE-.mjs');
976
976
  await inboxReply(sessionArgs[2], sessionArgs[3]);
977
977
  } else if (sessionArgs[2] && sessionArgs[3] && sessionArgs[4]) {
978
978
  await sessionInboxReply(sessionArgs[2], sessionArgs[3], sessionArgs[4], targetMachineId);
@@ -981,12 +981,14 @@ async function handleSessionCommand() {
981
981
  process.exit(1);
982
982
  }
983
983
  } else if (inboxSubcmd === "clear") {
984
+ const clearOpts = { all: hasFlag("--all"), messageId: parseFlagStr("--message") };
984
985
  if (agentSessionId && !sessionArgs[2]) {
985
- await sessionInboxClear(agentSessionId, targetMachineId, { all: hasFlag("--all") });
986
+ await sessionInboxClear(agentSessionId, targetMachineId, clearOpts);
986
987
  } else if (sessionArgs[2]) {
987
- await sessionInboxClear(sessionArgs[2], targetMachineId, { all: hasFlag("--all") });
988
+ await sessionInboxClear(sessionArgs[2], targetMachineId, clearOpts);
988
989
  } else {
989
- console.error("Usage: svamp session inbox clear [session-id] [--all]");
990
+ console.error("Usage: svamp session inbox clear [session-id] [--message <message-id> | --all]");
991
+ console.error(" (the positional is the SESSION id; use --message <id> to purge a specific stuck message)");
990
992
  process.exit(1);
991
993
  }
992
994
  } else {
@@ -1008,7 +1010,7 @@ async function handleMachineCommand() {
1008
1010
  return;
1009
1011
  }
1010
1012
  if (machineSubcommand === "share") {
1011
- const { machineShare } = await import('./commands-MjIkmrmC.mjs');
1013
+ const { machineShare } = await import('./commands-j4nqt7yR.mjs');
1012
1014
  let machineId;
1013
1015
  const shareArgs = [];
1014
1016
  for (let i = 1; i < machineArgs.length; i++) {
@@ -1059,14 +1061,14 @@ async function handleMachineCommand() {
1059
1061
  process.exit(1);
1060
1062
  }
1061
1063
  if (all) {
1062
- const { fleetExec } = await import('./fleet-CDllUpMj.mjs');
1064
+ const { fleetExec } = await import('./fleet-DgV81okW.mjs');
1063
1065
  await fleetExec(command, { cwd });
1064
1066
  } else {
1065
- const { machineExec } = await import('./commands-MjIkmrmC.mjs');
1067
+ const { machineExec } = await import('./commands-j4nqt7yR.mjs');
1066
1068
  await machineExec(machineId, command, cwd);
1067
1069
  }
1068
1070
  } else if (machineSubcommand === "info") {
1069
- const { machineInfo } = await import('./commands-MjIkmrmC.mjs');
1071
+ const { machineInfo } = await import('./commands-j4nqt7yR.mjs');
1070
1072
  let machineId;
1071
1073
  for (let i = 1; i < machineArgs.length; i++) {
1072
1074
  if ((machineArgs[i] === "--machine" || machineArgs[i] === "-m") && i + 1 < machineArgs.length) {
@@ -1086,10 +1088,10 @@ async function handleMachineCommand() {
1086
1088
  level = machineArgs[++i];
1087
1089
  }
1088
1090
  }
1089
- const { machineNotify } = await import('./agentCommands-BIn9btot.mjs');
1091
+ const { machineNotify } = await import('./agentCommands-go20pLE-.mjs');
1090
1092
  await machineNotify(message, level);
1091
1093
  } else if (machineSubcommand === "ls") {
1092
- const { machineLs } = await import('./commands-MjIkmrmC.mjs');
1094
+ const { machineLs } = await import('./commands-j4nqt7yR.mjs');
1093
1095
  let machineId;
1094
1096
  let showHidden = false;
1095
1097
  let path;
@@ -1145,20 +1147,20 @@ Examples:
1145
1147
  };
1146
1148
  const hasFlag = (name) => fleetArgs.includes(`--${name}`);
1147
1149
  if (sub === "status") {
1148
- const { fleetStatus } = await import('./fleet-CDllUpMj.mjs');
1150
+ const { fleetStatus } = await import('./fleet-DgV81okW.mjs');
1149
1151
  await fleetStatus();
1150
1152
  } else if (sub === "upgrade-claude") {
1151
- const { fleetUpgradeClaude } = await import('./fleet-CDllUpMj.mjs');
1153
+ const { fleetUpgradeClaude } = await import('./fleet-DgV81okW.mjs');
1152
1154
  await fleetUpgradeClaude({ version: flag("version", "-v") });
1153
1155
  } else if (sub === "upgrade-svamp") {
1154
- const { fleetUpgradeSvamp } = await import('./fleet-CDllUpMj.mjs');
1156
+ const { fleetUpgradeSvamp } = await import('./fleet-DgV81okW.mjs');
1155
1157
  await fleetUpgradeSvamp({ version: flag("version", "-v"), excludeSelf: hasFlag("exclude-self") });
1156
1158
  } else if (sub === "daemon-restart") {
1157
- const { fleetDaemonRestart } = await import('./fleet-CDllUpMj.mjs');
1159
+ const { fleetDaemonRestart } = await import('./fleet-DgV81okW.mjs');
1158
1160
  await fleetDaemonRestart({ graceful: !hasFlag("cleanup") });
1159
1161
  } else if (sub === "push-skill") {
1160
1162
  const name = fleetArgs[1];
1161
- const { fleetPushSkill } = await import('./fleet-CDllUpMj.mjs');
1163
+ const { fleetPushSkill } = await import('./fleet-DgV81okW.mjs');
1162
1164
  await fleetPushSkill(name);
1163
1165
  } else {
1164
1166
  console.error(`Unknown fleet subcommand: ${sub}`);
@@ -1174,7 +1176,7 @@ async function handleSkillsCommand() {
1174
1176
  await printSkillsHelp();
1175
1177
  return;
1176
1178
  }
1177
- const { skillsFind, skillsInstall, skillsList, skillsRemove, skillsPublish } = await import('./commands-CdMEMD_c.mjs');
1179
+ const { skillsFind, skillsInstall, skillsList, skillsRemove, skillsPublish } = await import('./commands-BxyASXjK.mjs');
1178
1180
  if (skillsSubcommand === "find" || skillsSubcommand === "search") {
1179
1181
  const query = skillsArgs.slice(1).filter((a) => !a.startsWith("--")).join(" ");
1180
1182
  if (!query) {
@@ -1221,7 +1223,7 @@ async function loginToHypha() {
1221
1223
  process.exit(1);
1222
1224
  }
1223
1225
  const anchor = anchorArg.replace(/\/+$/, "");
1224
- const { loadInstanceConfig } = await import('./run-B-1WDymr.mjs').then(function (n) { return n.aa; });
1226
+ const { loadInstanceConfig } = await import('./run-CLeF1N9s.mjs').then(function (n) { return n.aa; });
1225
1227
  let cfg = null;
1226
1228
  try {
1227
1229
  cfg = await loadInstanceConfig({ anchor, force: true });
@@ -1332,7 +1334,7 @@ async function logoutFromHypha() {
1332
1334
  } catch {
1333
1335
  }
1334
1336
  try {
1335
- const { clearInstanceConfigCache } = await import('./run-B-1WDymr.mjs').then(function (n) { return n.aa; });
1337
+ const { clearInstanceConfigCache } = await import('./run-CLeF1N9s.mjs').then(function (n) { return n.aa; });
1336
1338
  clearInstanceConfigCache();
1337
1339
  } catch {
1338
1340
  }
@@ -1670,7 +1672,7 @@ async function applyClaudeAuthFlags(argv) {
1670
1672
  "--use-hypha-proxy, --use-claude-login, and --anthropic-base-url/--anthropic-api-key are mutually exclusive"
1671
1673
  );
1672
1674
  }
1673
- const mod = await import('./run-B-1WDymr.mjs').then(function (n) { return n.a9; });
1675
+ const mod = await import('./run-CLeF1N9s.mjs').then(function (n) { return n.a9; });
1674
1676
  if (hasHypha) {
1675
1677
  let url;
1676
1678
  const hyphaIdx = argv.indexOf("--use-hypha-proxy");
@@ -1724,7 +1726,7 @@ async function applyDaemonShareFlag(argv) {
1724
1726
  }
1725
1727
  }
1726
1728
  if (collected.length === 0) return;
1727
- const { updateEnvFile } = await import('./run-B-1WDymr.mjs').then(function (n) { return n.a9; });
1729
+ const { updateEnvFile } = await import('./run-CLeF1N9s.mjs').then(function (n) { return n.a9; });
1728
1730
  const seen = /* @__PURE__ */ new Set();
1729
1731
  const deduped = collected.filter((e) => {
1730
1732
  const k = e.toLowerCase();
@@ -1757,7 +1759,7 @@ async function handleWiseAgentCommand(rest) {
1757
1759
  }
1758
1760
  });
1759
1761
  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(" ");
1760
- const { wiseAskCli } = await import('./commands-MjIkmrmC.mjs');
1762
+ const { wiseAskCli } = await import('./commands-j4nqt7yR.mjs');
1761
1763
  await wiseAskCli(machineId, message, sessionId, { json });
1762
1764
  return;
1763
1765
  }
@@ -1769,7 +1771,7 @@ async function handleWiseAgentCommand(rest) {
1769
1771
  }
1770
1772
  return void 0;
1771
1773
  };
1772
- const { runWiseVoiceCli } = await import('./headlessCli-CmBCGmNV.mjs');
1774
+ const { runWiseVoiceCli } = await import('./headlessCli-DjSZYq-Z.mjs');
1773
1775
  await runWiseVoiceCli({ voice: valueOf(["--voice"]), wakeKeywordPath: valueOf(["--wake"]), model: valueOf(["--model"]) });
1774
1776
  return;
1775
1777
  }
@@ -1787,7 +1789,7 @@ async function handleWiseAgentCommand(rest) {
1787
1789
  const mode = valueOf(["--mode"]);
1788
1790
  const mission = valueOf(["--mission"]);
1789
1791
  const url = rest.slice(1).find((a) => /^https?:\/\//.test(a)) || "";
1790
- const { wiseJoinMeetingCli } = await import('./commands-MjIkmrmC.mjs');
1792
+ const { wiseJoinMeetingCli } = await import('./commands-j4nqt7yR.mjs');
1791
1793
  await wiseJoinMeetingCli(machineId, url, sessionId, { json, mode, mission });
1792
1794
  return;
1793
1795
  }
@@ -1799,7 +1801,7 @@ async function handleWiseAgentCommand(rest) {
1799
1801
  }
1800
1802
  return void 0;
1801
1803
  };
1802
- const { wiseLeaveMeetingCli } = await import('./commands-MjIkmrmC.mjs');
1804
+ const { wiseLeaveMeetingCli } = await import('./commands-j4nqt7yR.mjs');
1803
1805
  await wiseLeaveMeetingCli(valueOf(["--machine", "-m"]), valueOf(["--session", "-s"]), { json: rest.includes("--json") });
1804
1806
  return;
1805
1807
  }
@@ -1823,7 +1825,7 @@ async function handleWiseAgentCommand(rest) {
1823
1825
  }
1824
1826
  });
1825
1827
  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(" ");
1826
- const { wiseAnnounceCli } = await import('./commands-MjIkmrmC.mjs');
1828
+ const { wiseAnnounceCli } = await import('./commands-j4nqt7yR.mjs');
1827
1829
  await wiseAnnounceCli(machineId, text, sessionId, { json });
1828
1830
  return;
1829
1831
  }
@@ -1835,7 +1837,7 @@ async function handleWiseAgentCommand(rest) {
1835
1837
  }
1836
1838
  return void 0;
1837
1839
  };
1838
- const { wiseMeetingsCli } = await import('./commands-MjIkmrmC.mjs');
1840
+ const { wiseMeetingsCli } = await import('./commands-j4nqt7yR.mjs');
1839
1841
  await wiseMeetingsCli(valueOf(["--machine", "-m"]), { json: rest.includes("--json") });
1840
1842
  return;
1841
1843
  }
@@ -1885,7 +1887,7 @@ If none is set, hitting a WISE Agent channel returns a clear "not configured" er
1885
1887
  return;
1886
1888
  }
1887
1889
  const authArgs = rest.slice(1);
1888
- const mod = await import('./auth-DY_tcgLY.mjs');
1890
+ const mod = await import('./auth-BeRv91cp.mjs');
1889
1891
  let action;
1890
1892
  try {
1891
1893
  action = mod.parseWiseAgentAuthArgs(authArgs);
@@ -1895,7 +1897,7 @@ If none is set, hitting a WISE Agent channel returns a clear "not configured" er
1895
1897
  return;
1896
1898
  }
1897
1899
  if (action) {
1898
- const { updateEnvFile } = await import('./run-B-1WDymr.mjs').then(function (n) { return n.a9; });
1900
+ const { updateEnvFile } = await import('./run-CLeF1N9s.mjs').then(function (n) { return n.a9; });
1899
1901
  const updates = mod.buildWiseAgentEnvUpdates(action);
1900
1902
  updateEnvFile(updates);
1901
1903
  for (const [k, v] of Object.entries(updates)) {
@@ -1909,7 +1911,7 @@ If none is set, hitting a WISE Agent channel returns a clear "not configured" er
1909
1911
  }
1910
1912
  async function handleDaemonAuthCommand(argv) {
1911
1913
  const sub = (argv[0] || "status").toLowerCase();
1912
- const mod = await import('./run-B-1WDymr.mjs').then(function (n) { return n.a9; });
1914
+ const mod = await import('./run-CLeF1N9s.mjs').then(function (n) { return n.a9; });
1913
1915
  if (sub === "--help" || sub === "-h" || sub === "help") {
1914
1916
  console.log(`
1915
1917
  svamp daemon auth \u2014 Configure how Claude subprocesses authenticate
@@ -2222,7 +2224,7 @@ Examples:
2222
2224
  async function printSkillsHelp() {
2223
2225
  let browseUrl = "<HYPHA_SERVER_URL>/<workspace>/artifacts/marketplace (set HYPHA_SERVER_URL)";
2224
2226
  try {
2225
- const { getArtifactBaseUrl, getSkillsCollectionName } = await import('./run-B-1WDymr.mjs').then(function (n) { return n.ab; });
2227
+ const { getArtifactBaseUrl, getSkillsCollectionName } = await import('./run-CLeF1N9s.mjs').then(function (n) { return n.ab; });
2226
2228
  browseUrl = `${getArtifactBaseUrl()}/${getSkillsCollectionName()}`;
2227
2229
  } catch {
2228
2230
  }
@@ -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 { C as parseFrontmatter, D as getSkillsServer, E as getSkillsWorkspaceName, F as getSkillsCollectionName, G as fetchWithTimeout, H as searchSkills, I as SKILLS_DIR, J as getSkillInfo, K as downloadSkillFile, L as listSkillFiles } from './run-B-1WDymr.mjs';
4
+ import { C as parseFrontmatter, D as getSkillsServer, E as getSkillsWorkspaceName, F as getSkillsCollectionName, G as fetchWithTimeout, H as searchSkills, I as SKILLS_DIR, J as getSkillInfo, K as downloadSkillFile, L as listSkillFiles } from './run-CLeF1N9s.mjs';
5
5
  import 'fs/promises';
6
6
  import 'url';
7
7
  import 'child_process';
@@ -1,5 +1,5 @@
1
1
  import { execSync } from 'node:child_process';
2
- import { m as resolveProjectRoot, t as searchIssues, q as listIssues, o as addComment, u as updateIssue, n as getIssue, w as summarize, p as addIssue } from './run-B-1WDymr.mjs';
2
+ import { m as resolveProjectRoot, t as searchIssues, q as listIssues, o as addComment, u as updateIssue, n as getIssue, w as summarize, p as addIssue } from './run-CLeF1N9s.mjs';
3
3
  import 'os';
4
4
  import 'fs/promises';
5
5
  import 'fs';
@@ -1,11 +1,11 @@
1
1
  import { writeFileSync, readFileSync } from 'fs';
2
2
  import { resolve } from 'path';
3
- import { connectAndGetMachine } from './commands-MjIkmrmC.mjs';
3
+ import { connectAndGetMachine } from './commands-j4nqt7yR.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-B-1WDymr.mjs';
8
+ import './run-CLeF1N9s.mjs';
9
9
  import 'os';
10
10
  import 'fs/promises';
11
11
  import 'url';
@@ -1,7 +1,7 @@
1
1
  import { existsSync } from 'node:fs';
2
- import { connectAndGetMachine, resolveSessionId, createWorktree, connectAndResolveSession } from './commands-MjIkmrmC.mjs';
2
+ import { connectAndGetMachine, resolveSessionId, createWorktree, connectAndResolveSession } from './commands-j4nqt7yR.mjs';
3
3
  import { execSync } from 'node:child_process';
4
- import { u as updateIssue, o as addComment, p as addIssue, x as shortId } from './run-B-1WDymr.mjs';
4
+ import { u as updateIssue, o as addComment, p as addIssue, x as shortId } from './run-CLeF1N9s.mjs';
5
5
  import 'node:path';
6
6
  import 'node:os';
7
7
  import 'os';
@@ -1,5 +1,5 @@
1
1
  import { spawnSync } from 'node:child_process';
2
- import { m as resolveProjectRoot } from './run-B-1WDymr.mjs';
2
+ import { m as resolveProjectRoot } from './run-CLeF1N9s.mjs';
3
3
  import { w as workflowSteps, r as removeWorkflow, g as getWorkflow, l as listWorkflows, s as saveWorkflow, a as rawWorkflow } from './store-BPL__e4D.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-D4x74mG6.mjs');
61
+ const { runFrpcTunnel } = await import('./frpc-Bi1a1Oqy.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-MjIkmrmC.mjs');
71
+ const { connectAndGetMachine } = await import('./commands-j4nqt7yR.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-D4x74mG6.mjs');
126
+ const { runFrpcTunnel } = await import('./frpc-Bi1a1Oqy.mjs');
127
127
  await runFrpcTunnel(name, [caddyPort]);
128
128
  } catch (err) {
129
129
  console.error(`Error serving directory: ${err.message}`);
@@ -132,7 +132,7 @@ async function serviceServe(args) {
132
132
  }
133
133
  async function serviceList(_args) {
134
134
  try {
135
- const { connectAndGetMachine } = await import('./commands-MjIkmrmC.mjs');
135
+ const { connectAndGetMachine } = await import('./commands-j4nqt7yR.mjs');
136
136
  const { server, machine } = await connectAndGetMachine();
137
137
  try {
138
138
  const tunnels = await machine.tunnelList({});
@@ -172,7 +172,7 @@ async function serviceDelete(args) {
172
172
  process.exit(1);
173
173
  }
174
174
  try {
175
- const { connectAndGetMachine } = await import('./commands-MjIkmrmC.mjs');
175
+ const { connectAndGetMachine } = await import('./commands-j4nqt7yR.mjs');
176
176
  const { server, machine } = await connectAndGetMachine();
177
177
  try {
178
178
  await machine.tunnelStop({ name });
@@ -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 { N as formatHandle, O as normalizeAllowedUser, P as loadSecurityContextConfig, Q as resolveSecurityContext, T as buildSecurityContextFromFlags, U as mergeSecurityContexts, c as connectToHypha, V as buildSessionShareUrl, W as computeOutboundHop, x as shortId, X as buildMachineShareUrl, Y as parseHandle, Z as handleMatchesMetadata } from './run-B-1WDymr.mjs';
5
+ import { N as formatHandle, O as normalizeAllowedUser, P as loadSecurityContextConfig, Q as resolveSecurityContext, T as buildSecurityContextFromFlags, U as mergeSecurityContexts, c as connectToHypha, V as buildSessionShareUrl, W as computeOutboundHop, x as shortId, X as buildMachineShareUrl, Y as parseHandle, Z as handleMatchesMetadata } from './run-CLeF1N9s.mjs';
6
6
  import 'os';
7
7
  import 'fs/promises';
8
8
  import 'fs';
@@ -569,6 +569,15 @@ function resolveSessionId(sessions, partial) {
569
569
  process.exit(1);
570
570
  }
571
571
  async function connectAndResolveSession(sessionId, machineId) {
572
+ if (sessionId === ".") {
573
+ const self = process.env.SVAMP_SESSION_ID;
574
+ if (!self) {
575
+ console.error("'.' means the current session, but SVAMP_SESSION_ID is not set here.");
576
+ console.error('In a workflow step, give the workflow an owner session (so the scheduler can resolve "."), or use an explicit session id/handle.');
577
+ process.exit(1);
578
+ }
579
+ sessionId = self;
580
+ }
572
581
  let { server, machine } = await connectAndGetMachine(machineId);
573
582
  const sessions = await machine.listSessions();
574
583
  const localMatch = findSessionMatch(sessions, sessionId);
@@ -1655,6 +1664,9 @@ async function collectAssistantResponse(machine, fullId, afterSeq) {
1655
1664
  if (collected.length) return { text: collected.join("\n").trim(), messageSeqs: seqs };
1656
1665
  return { text: resultText.join("\n").trim(), messageSeqs: resultSeqs };
1657
1666
  }
1667
+ function isSelfBtw(fullId, btw, selfSessionId) {
1668
+ return !!btw && !!selfSessionId && fullId === selfSessionId;
1669
+ }
1658
1670
  function validateSendOptions(opts) {
1659
1671
  if (opts?.plain) {
1660
1672
  const bad = [];
@@ -1844,6 +1856,14 @@ async function sessionSend(sessionId, message, machineId, opts) {
1844
1856
  process.exit(1);
1845
1857
  }
1846
1858
  const { server, machine, fullId } = await connectAndResolveSession(sessionId, machineId);
1859
+ if (isSelfBtw(fullId, opts?.btw, process.env.SVAMP_SESSION_ID)) {
1860
+ console.error("Refusing to --btw your own session: a /btw forks a query that resumes this session, which would deadlock the active turn (and the watchdog would kill it). You are already inside this session \u2014 just answer/think directly, or send to a DIFFERENT session.");
1861
+ try {
1862
+ await server.disconnect();
1863
+ } catch {
1864
+ }
1865
+ process.exit(1);
1866
+ }
1847
1867
  try {
1848
1868
  const r = await sendCore(machine, fullId, message, opts);
1849
1869
  if (r.mode === "btw") {
@@ -2690,11 +2710,12 @@ async function sessionInboxReply(sessionIdPartial, messageId, body, machineId) {
2690
2710
  async function sessionInboxClear(sessionIdPartial, machineId, opts) {
2691
2711
  const { server, machine, fullId } = await connectAndResolveSession(sessionIdPartial, machineId);
2692
2712
  try {
2693
- const result = await machine.sessionRPC(fullId, "clearInbox", { opts: { all: opts?.all } });
2694
- console.log(`Cleared inbox on session ${fullId.slice(0, 8)} (${result.remaining} remaining)`);
2713
+ const result = await machine.sessionRPC(fullId, "clearInbox", { opts: { all: opts?.all, messageId: opts?.messageId } });
2714
+ const what = opts?.messageId ? `message ${opts.messageId}` : opts?.all ? "all messages" : "read messages";
2715
+ console.log(`Cleared ${what} on session ${fullId.slice(0, 8)} (removed ${result.removed ?? "?"}, ${result.remaining} remaining)`);
2695
2716
  } finally {
2696
2717
  await server.disconnect();
2697
2718
  }
2698
2719
  }
2699
2720
 
2700
- export { collectAssistantResponse, connectAndGetMachine, connectAndResolveSession, createWorktree, generateWorktreeName, machineExec, machineInfo, machineLs, machineShare, parseShareArg, queryCore, renderMessage, resolveSessionId, sendCore, sessionApprove, sessionArchive, sessionAttach, sessionDelete, sessionDeny, sessionEditMessage, sessionInboxClear, sessionInboxList, sessionInboxRead, sessionInboxReply, sessionInboxSend, sessionInfo, sessionList, sessionLoopCancel, sessionLoopStart, sessionLoopStatus, sessionMachines, sessionMessages, sessionQuery, sessionRefineLastReply, sessionResume, sessionSend, sessionShare, sessionSpawn, sessionUndoEdit, sessionWait, sessionWhoami, snapshotLatestSeq, validateSendOptions, wiseAnnounceCli, wiseAskCli, wiseJoinMeetingCli, wiseLeaveMeetingCli, wiseMeetingsCli };
2721
+ export { collectAssistantResponse, connectAndGetMachine, connectAndResolveSession, createWorktree, generateWorktreeName, isSelfBtw, machineExec, machineInfo, machineLs, machineShare, parseShareArg, queryCore, renderMessage, resolveSessionId, sendCore, sessionApprove, sessionArchive, sessionAttach, sessionDelete, sessionDeny, sessionEditMessage, sessionInboxClear, sessionInboxList, sessionInboxRead, sessionInboxReply, sessionInboxSend, sessionInfo, sessionList, sessionLoopCancel, sessionLoopStart, sessionLoopStatus, sessionMachines, sessionMessages, sessionQuery, sessionRefineLastReply, sessionResume, sessionSend, sessionShare, sessionSpawn, sessionUndoEdit, sessionWait, sessionWhoami, snapshotLatestSeq, validateSendOptions, wiseAnnounceCli, wiseAskCli, wiseJoinMeetingCli, wiseLeaveMeetingCli, wiseMeetingsCli };
@@ -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-B-1WDymr.mjs';
4
+ import { c as connectToHypha } from './run-CLeF1N9s.mjs';
5
5
  import { PINNED_CLAUDE_CODE_VERSION } from './pinnedClaudeCode-HydRNEt7.mjs';
6
6
  import 'os';
7
7
  import 'fs/promises';
@@ -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-B-1WDymr.mjs';
7
+ import { h as getFrpsSubdomainHost, i as getFrpsServerPort, j as getFrpsServerAddr } from './run-CLeF1N9s.mjs';
8
8
  import 'fs/promises';
9
9
  import 'url';
10
10
  import 'node:crypto';
@@ -1,5 +1,5 @@
1
- import { M as resolveModel, _ as describeMisconfiguration, $ as buildMachineDeps } from './run-B-1WDymr.mjs';
2
- import { handleRealtimeEvent, initMachineVoiceSession } from './sideband-Da1VG2iq.mjs';
1
+ import { M as resolveModel, _ as describeMisconfiguration, $ as buildMachineDeps } from './run-CLeF1N9s.mjs';
2
+ import { handleRealtimeEvent, initMachineVoiceSession } from './sideband-DLku7gcO.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-B-1WDymr.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-CLeF1N9s.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.178";
2
+ var version = "0.2.179";
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";
@@ -1,4 +1,4 @@
1
- import { m as resolveProjectRoot, u as updateIssue, n as getIssue, o as addComment, p as addIssue, q as listIssues, t as searchIssues } from './run-B-1WDymr.mjs';
1
+ import { m as resolveProjectRoot, u as updateIssue, n as getIssue, o as addComment, p as addIssue, q as listIssues, t as searchIssues } from './run-CLeF1N9s.mjs';
2
2
  import 'os';
3
3
  import 'fs/promises';
4
4
  import 'fs';
@@ -1,5 +1,5 @@
1
1
  import { spawnSync } from 'node:child_process';
2
- import { m as resolveProjectRoot } from './run-B-1WDymr.mjs';
2
+ import { m as resolveProjectRoot } from './run-CLeF1N9s.mjs';
3
3
  import { g as getWorkflow, w as workflowSteps, r as removeWorkflow, s as saveWorkflow, a as rawWorkflow, l as listWorkflows } from './store-BPL__e4D.mjs';
4
4
  import 'os';
5
5
  import 'fs/promises';
@@ -57,11 +57,12 @@ function workflowRpc(cwd, params) {
57
57
  const wf = getWorkflow(root, String(params.name));
58
58
  if (!wf) throw new Error(`Workflow not found: ${params.name}`);
59
59
  const steps = workflowSteps(wf);
60
+ const stepEnv = wf.session ? { ...process.env, SVAMP_SESSION_ID: wf.session } : process.env;
60
61
  const out = [`\u25B6 running workflow "${wf.name}" (${steps.length} step${steps.length === 1 ? "" : "s"})`];
61
62
  for (let i = 0; i < steps.length; i++) {
62
63
  const step = steps[i];
63
64
  out.push(` [${i + 1}/${steps.length}] $ ${step.run}`);
64
- const r = spawnSync("sh", ["-c", step.run], { cwd: root, encoding: "utf-8", timeout: 12e4 });
65
+ const r = spawnSync("sh", ["-c", step.run], { cwd: root, encoding: "utf-8", timeout: 12e4, env: stepEnv });
65
66
  if (r.stdout) out.push(r.stdout.trimEnd());
66
67
  if (r.stderr) out.push(r.stderr.trimEnd());
67
68
  if (r.status !== 0) {
@@ -2699,7 +2699,7 @@ async function registerMachineService(server, machineId, metadata, daemonState,
2699
2699
  const tunnels = handlers.tunnels;
2700
2700
  if (!tunnels) throw new Error("Tunnel management not available");
2701
2701
  if (tunnels.has(params.name)) throw new Error(`Tunnel '${params.name}' already running`);
2702
- const { FrpcTunnel } = await import('./frpc-D4x74mG6.mjs');
2702
+ const { FrpcTunnel } = await import('./frpc-Bi1a1Oqy.mjs');
2703
2703
  const tunnel = new FrpcTunnel({
2704
2704
  name: params.name,
2705
2705
  ports: params.ports,
@@ -3146,7 +3146,7 @@ QUESTION: ${params.question || "Summarize this concisely."}` }
3146
3146
  }
3147
3147
  const deps = buildSessionDeps(rpc, { cwd, ownerEmail: owner });
3148
3148
  const sender = { name: context?.user?.email || context?.user?.id || "user", kind: "user", verified: true };
3149
- const { toolsForRole } = await import('./sideband-Da1VG2iq.mjs');
3149
+ const { toolsForRole } = await import('./sideband-DLku7gcO.mjs');
3150
3150
  const r2 = await runWiseAgent({ message: params.message, sender, config: { tools: toolsForRole(role2) }, deps, transport, model: resolved.model });
3151
3151
  return fmt(r2);
3152
3152
  }
@@ -3245,7 +3245,7 @@ QUESTION: ${params.question || "Summarize this concisely."}` }
3245
3245
  if (r.error || !r.sender) return { error: r.error || "unauthorized" };
3246
3246
  const callId = "call_" + Math.random().toString(16).slice(2, 12);
3247
3247
  const rendered = renderMessage(c, { sender: r.sender, body: { message: kwargs.message }, callId });
3248
- const { queryCore } = await import('./commands-MjIkmrmC.mjs');
3248
+ const { queryCore } = await import('./commands-j4nqt7yR.mjs');
3249
3249
  const timeout = c.reply?.timeout_sec || 120;
3250
3250
  let result;
3251
3251
  try {
@@ -3389,6 +3389,132 @@ ${d?.error || "not found"}`;
3389
3389
  };
3390
3390
  }
3391
3391
 
3392
+ const SVAMP_HOME$2 = process.env.SVAMP_HOME || join(os.homedir(), ".svamp");
3393
+ const num = (key, def) => {
3394
+ const v = Number(process.env[key]);
3395
+ return Number.isFinite(v) && v > 0 ? v : def;
3396
+ };
3397
+ const MAX_AGENT_HOPS = num("SVAMP_INBOX_MAX_HOPS", 3);
3398
+ const URGENT_BURST = num("SVAMP_INBOX_URGENT_BURST", 5);
3399
+ const URGENT_REFILL_MS = num("SVAMP_INBOX_URGENT_REFILL_MS", 6e4);
3400
+ const BREAKER_WINDOW_MS = num("SVAMP_INBOX_BREAKER_WINDOW_MS", 6e4);
3401
+ const BREAKER_MAX_WAKES = num("SVAMP_INBOX_BREAKER_MAX_WAKES", 30);
3402
+ const BREAKER_COOLDOWN_MS = num("SVAMP_INBOX_BREAKER_COOLDOWN_MS", 12e4);
3403
+ const CTX_STALE_MS = num("SVAMP_INBOX_CTX_STALE_MS", 30 * 6e4);
3404
+ function ctxPath(sessionId) {
3405
+ return join(SVAMP_HOME$2, "inbound", `${sessionId}.json`);
3406
+ }
3407
+ function writeInboundContext(sessionId, ctx) {
3408
+ try {
3409
+ const p = ctxPath(sessionId);
3410
+ mkdirSync(join(SVAMP_HOME$2, "inbound"), { recursive: true });
3411
+ const tmp = p + ".tmp";
3412
+ writeFileSync(tmp, JSON.stringify({ ...ctx, deliveredAt: Date.now() }));
3413
+ try {
3414
+ rmSync(p, { force: true });
3415
+ } catch {
3416
+ }
3417
+ writeFileSync(p, readFileSync(tmp));
3418
+ try {
3419
+ rmSync(tmp, { force: true });
3420
+ } catch {
3421
+ }
3422
+ } catch {
3423
+ }
3424
+ }
3425
+ function clearInboundContext(sessionId) {
3426
+ try {
3427
+ rmSync(ctxPath(sessionId), { force: true });
3428
+ } catch {
3429
+ }
3430
+ }
3431
+ function readInboundContext(sessionId) {
3432
+ try {
3433
+ const p = ctxPath(sessionId);
3434
+ if (!existsSync(p)) return null;
3435
+ const ctx = JSON.parse(readFileSync(p, "utf-8"));
3436
+ if (!ctx || typeof ctx.hopCount !== "number") return null;
3437
+ if (Date.now() - (ctx.deliveredAt || 0) > CTX_STALE_MS) return null;
3438
+ return ctx;
3439
+ } catch {
3440
+ return null;
3441
+ }
3442
+ }
3443
+ function computeOutboundHop(sessionId) {
3444
+ if (!sessionId) return { hopCount: 0, fromInboxTurn: false };
3445
+ const ctx = readInboundContext(sessionId);
3446
+ if (ctx) return { hopCount: (ctx.hopCount || 0) + 1, threadId: ctx.threadId, fromInboxTurn: true };
3447
+ return { hopCount: 1, fromInboxTurn: false };
3448
+ }
3449
+ const buckets = /* @__PURE__ */ new Map();
3450
+ function takeUrgentToken(sender, now) {
3451
+ let b = buckets.get(sender);
3452
+ if (!b) {
3453
+ b = { tokens: URGENT_BURST, last: now };
3454
+ buckets.set(sender, b);
3455
+ }
3456
+ const refill = Math.floor((now - b.last) / URGENT_REFILL_MS);
3457
+ if (refill > 0) {
3458
+ b.tokens = Math.min(URGENT_BURST, b.tokens + refill);
3459
+ b.last = now;
3460
+ }
3461
+ if (b.tokens > 0) {
3462
+ b.tokens -= 1;
3463
+ return true;
3464
+ }
3465
+ return false;
3466
+ }
3467
+ let wakeTimes = [];
3468
+ let breakerOpenUntil = 0;
3469
+ function isBreakerOpenAt(now) {
3470
+ return now < breakerOpenUntil;
3471
+ }
3472
+ function recordWake(now) {
3473
+ wakeTimes = wakeTimes.filter((t) => now - t < BREAKER_WINDOW_MS);
3474
+ wakeTimes.push(now);
3475
+ if (wakeTimes.length > BREAKER_MAX_WAKES) {
3476
+ breakerOpenUntil = now + BREAKER_COOLDOWN_MS;
3477
+ return true;
3478
+ }
3479
+ return false;
3480
+ }
3481
+ function senderIsHuman(message) {
3482
+ const f = message.from || "";
3483
+ return f.startsWith("cli:") || f.startsWith("user:");
3484
+ }
3485
+ function senderKey(message) {
3486
+ return message.fromSession || message.from || "unknown";
3487
+ }
3488
+ function classifyInbound(message, now = Date.now()) {
3489
+ const hop = message.hopCount ?? 0;
3490
+ const human = senderIsHuman(message);
3491
+ if (!human && !message.channel && hop > MAX_AGENT_HOPS) {
3492
+ return { action: "silent", reason: `loop-guard: hop ${hop} > ${MAX_AGENT_HOPS}` };
3493
+ }
3494
+ if (message.urgency !== "urgent") {
3495
+ return { action: "queue", reason: "non-urgent" };
3496
+ }
3497
+ if (human) {
3498
+ const tripped2 = recordWake(now);
3499
+ return { action: "wake", reason: "urgent (human)", breakerTripped: tripped2 };
3500
+ }
3501
+ if (isBreakerOpenAt(now)) {
3502
+ return { action: "queue", reason: "circuit-breaker-open" };
3503
+ }
3504
+ if (!takeUrgentToken(senderKey(message), now)) {
3505
+ return { action: "queue", reason: "rate-limited" };
3506
+ }
3507
+ const tripped = recordWake(now);
3508
+ return { action: "wake", reason: "urgent", breakerTripped: tripped };
3509
+ }
3510
+ function applyInboxClear(inbox, opts) {
3511
+ let kept;
3512
+ if (opts?.messageId) kept = inbox.filter((m) => m.messageId !== opts.messageId);
3513
+ else if (opts?.all) kept = [];
3514
+ else kept = inbox.filter((m) => !m.read);
3515
+ return { kept, removed: inbox.length - kept.length };
3516
+ }
3517
+
3392
3518
  const PARTICIPANTS_CHANNEL_ID = "sys-participants";
3393
3519
  function channelPublicView(c) {
3394
3520
  return { id: c.id, name: c.name, description: c.description, identity: { mode: c.identity?.mode }, action: c.action?.kind, bind: c.bind };
@@ -4453,16 +4579,12 @@ function createSessionStore(server, sessionId, initialMetadata, initialAgentStat
4453
4579
  },
4454
4580
  clearInbox: async (opts, context) => {
4455
4581
  authorizeRequest(context, metadata.sharing, "admin");
4456
- if (opts?.all) {
4457
- inbox.length = 0;
4458
- } else {
4459
- for (let i = inbox.length - 1; i >= 0; i--) {
4460
- if (inbox[i].read) inbox.splice(i, 1);
4461
- }
4462
- }
4582
+ const { kept, removed } = applyInboxClear(inbox, opts);
4583
+ inbox.length = 0;
4584
+ inbox.push(...kept);
4463
4585
  syncInboxToMetadata();
4464
4586
  notifyListeners({ type: "inbox-update", sessionId, cleared: true });
4465
- return { success: true, remaining: inbox.length };
4587
+ return { success: true, removed, remaining: inbox.length };
4466
4588
  },
4467
4589
  // ── Listener Registration ──
4468
4590
  registerListener: async (callback, context) => {
@@ -5005,125 +5127,6 @@ function handleMatchesMetadata(parsed, metadata) {
5005
5127
  return true;
5006
5128
  }
5007
5129
 
5008
- const SVAMP_HOME$2 = process.env.SVAMP_HOME || join(os.homedir(), ".svamp");
5009
- const num = (key, def) => {
5010
- const v = Number(process.env[key]);
5011
- return Number.isFinite(v) && v > 0 ? v : def;
5012
- };
5013
- const MAX_AGENT_HOPS = num("SVAMP_INBOX_MAX_HOPS", 3);
5014
- const URGENT_BURST = num("SVAMP_INBOX_URGENT_BURST", 5);
5015
- const URGENT_REFILL_MS = num("SVAMP_INBOX_URGENT_REFILL_MS", 6e4);
5016
- const BREAKER_WINDOW_MS = num("SVAMP_INBOX_BREAKER_WINDOW_MS", 6e4);
5017
- const BREAKER_MAX_WAKES = num("SVAMP_INBOX_BREAKER_MAX_WAKES", 30);
5018
- const BREAKER_COOLDOWN_MS = num("SVAMP_INBOX_BREAKER_COOLDOWN_MS", 12e4);
5019
- const CTX_STALE_MS = num("SVAMP_INBOX_CTX_STALE_MS", 30 * 6e4);
5020
- function ctxPath(sessionId) {
5021
- return join(SVAMP_HOME$2, "inbound", `${sessionId}.json`);
5022
- }
5023
- function writeInboundContext(sessionId, ctx) {
5024
- try {
5025
- const p = ctxPath(sessionId);
5026
- mkdirSync(join(SVAMP_HOME$2, "inbound"), { recursive: true });
5027
- const tmp = p + ".tmp";
5028
- writeFileSync(tmp, JSON.stringify({ ...ctx, deliveredAt: Date.now() }));
5029
- try {
5030
- rmSync(p, { force: true });
5031
- } catch {
5032
- }
5033
- writeFileSync(p, readFileSync(tmp));
5034
- try {
5035
- rmSync(tmp, { force: true });
5036
- } catch {
5037
- }
5038
- } catch {
5039
- }
5040
- }
5041
- function clearInboundContext(sessionId) {
5042
- try {
5043
- rmSync(ctxPath(sessionId), { force: true });
5044
- } catch {
5045
- }
5046
- }
5047
- function readInboundContext(sessionId) {
5048
- try {
5049
- const p = ctxPath(sessionId);
5050
- if (!existsSync(p)) return null;
5051
- const ctx = JSON.parse(readFileSync(p, "utf-8"));
5052
- if (!ctx || typeof ctx.hopCount !== "number") return null;
5053
- if (Date.now() - (ctx.deliveredAt || 0) > CTX_STALE_MS) return null;
5054
- return ctx;
5055
- } catch {
5056
- return null;
5057
- }
5058
- }
5059
- function computeOutboundHop(sessionId) {
5060
- if (!sessionId) return { hopCount: 0, fromInboxTurn: false };
5061
- const ctx = readInboundContext(sessionId);
5062
- if (ctx) return { hopCount: (ctx.hopCount || 0) + 1, threadId: ctx.threadId, fromInboxTurn: true };
5063
- return { hopCount: 1, fromInboxTurn: false };
5064
- }
5065
- const buckets = /* @__PURE__ */ new Map();
5066
- function takeUrgentToken(sender, now) {
5067
- let b = buckets.get(sender);
5068
- if (!b) {
5069
- b = { tokens: URGENT_BURST, last: now };
5070
- buckets.set(sender, b);
5071
- }
5072
- const refill = Math.floor((now - b.last) / URGENT_REFILL_MS);
5073
- if (refill > 0) {
5074
- b.tokens = Math.min(URGENT_BURST, b.tokens + refill);
5075
- b.last = now;
5076
- }
5077
- if (b.tokens > 0) {
5078
- b.tokens -= 1;
5079
- return true;
5080
- }
5081
- return false;
5082
- }
5083
- let wakeTimes = [];
5084
- let breakerOpenUntil = 0;
5085
- function isBreakerOpenAt(now) {
5086
- return now < breakerOpenUntil;
5087
- }
5088
- function recordWake(now) {
5089
- wakeTimes = wakeTimes.filter((t) => now - t < BREAKER_WINDOW_MS);
5090
- wakeTimes.push(now);
5091
- if (wakeTimes.length > BREAKER_MAX_WAKES) {
5092
- breakerOpenUntil = now + BREAKER_COOLDOWN_MS;
5093
- return true;
5094
- }
5095
- return false;
5096
- }
5097
- function senderIsHuman(message) {
5098
- const f = message.from || "";
5099
- return f.startsWith("cli:") || f.startsWith("user:");
5100
- }
5101
- function senderKey(message) {
5102
- return message.fromSession || message.from || "unknown";
5103
- }
5104
- function classifyInbound(message, now = Date.now()) {
5105
- const hop = message.hopCount ?? 0;
5106
- const human = senderIsHuman(message);
5107
- if (!human && !message.channel && hop > MAX_AGENT_HOPS) {
5108
- return { action: "silent", reason: `loop-guard: hop ${hop} > ${MAX_AGENT_HOPS}` };
5109
- }
5110
- if (message.urgency !== "urgent") {
5111
- return { action: "queue", reason: "non-urgent" };
5112
- }
5113
- if (human) {
5114
- const tripped2 = recordWake(now);
5115
- return { action: "wake", reason: "urgent (human)", breakerTripped: tripped2 };
5116
- }
5117
- if (isBreakerOpenAt(now)) {
5118
- return { action: "queue", reason: "circuit-breaker-open" };
5119
- }
5120
- if (!takeUrgentToken(senderKey(message), now)) {
5121
- return { action: "queue", reason: "rate-limited" };
5122
- }
5123
- const tripped = recordWake(now);
5124
- return { action: "wake", reason: "urgent", breakerTripped: tripped };
5125
- }
5126
-
5127
5130
  function resolveProjectRoot$1(directory) {
5128
5131
  try {
5129
5132
  const top = execSync("git rev-parse --show-toplevel", {
@@ -11547,7 +11550,7 @@ async function startDaemon(options) {
11547
11550
  saveExposedTunnels(list);
11548
11551
  }
11549
11552
  async function createExposedTunnel(spec) {
11550
- const { FrpcTunnel } = await import('./frpc-D4x74mG6.mjs');
11553
+ const { FrpcTunnel } = await import('./frpc-Bi1a1Oqy.mjs');
11551
11554
  const tunnel = new FrpcTunnel({
11552
11555
  name: spec.name,
11553
11556
  ports: spec.ports,
@@ -11567,7 +11570,7 @@ async function startDaemon(options) {
11567
11570
  return tunnel;
11568
11571
  }
11569
11572
  const tunnelRecreateState = /* @__PURE__ */ new Map();
11570
- const { ServeManager } = await import('./serveManager-DXm1bdoU.mjs');
11573
+ const { ServeManager } = await import('./serveManager-CqhigbGu.mjs');
11571
11574
  const serveManager = new ServeManager(SVAMP_HOME, (msg) => logger.log(`[SERVE] ${msg}`), hyphaServerUrl);
11572
11575
  ensureAutoInstalledSkills(logger).catch(() => {
11573
11576
  });
@@ -13358,11 +13361,11 @@ ${capturedError}${buildClaudeErrorHint(capturedError)}`;
13358
13361
  });
13359
13362
  },
13360
13363
  onIssue: async (params) => {
13361
- const { issueRpc } = await import('./rpc-2TJ6ipXZ.mjs');
13364
+ const { issueRpc } = await import('./rpc-CAi59ZCd.mjs');
13362
13365
  return issueRpc(params?.cwd || directory, params || {});
13363
13366
  },
13364
13367
  onWorkflow: async (params) => {
13365
- const { workflowRpc } = await import('./rpc-DBH2bo8s.mjs');
13368
+ const { workflowRpc } = await import('./rpc-CND7PIf-.mjs');
13366
13369
  return workflowRpc(params?.cwd || directory, params || {});
13367
13370
  },
13368
13371
  onRipgrep: async (args, cwd) => {
@@ -13868,11 +13871,11 @@ ${capturedError}${buildClaudeErrorHint(capturedError)}`;
13868
13871
  });
13869
13872
  },
13870
13873
  onIssue: async (params) => {
13871
- const { issueRpc } = await import('./rpc-2TJ6ipXZ.mjs');
13874
+ const { issueRpc } = await import('./rpc-CAi59ZCd.mjs');
13872
13875
  return issueRpc(params?.cwd || directory, params || {});
13873
13876
  },
13874
13877
  onWorkflow: async (params) => {
13875
- const { workflowRpc } = await import('./rpc-DBH2bo8s.mjs');
13878
+ const { workflowRpc } = await import('./rpc-CND7PIf-.mjs');
13876
13879
  return workflowRpc(params?.cwd || directory, params || {});
13877
13880
  },
13878
13881
  onRipgrep: async (args, cwd) => {
@@ -14625,7 +14628,7 @@ ${capturedError}${buildClaudeErrorHint(capturedError)}`;
14625
14628
  const PING_TIMEOUT_MS = 15e3;
14626
14629
  const POST_RECONNECT_GRACE_MS = 2e4;
14627
14630
  const RECONNECT_JITTER_MS = 2500;
14628
- const { WorkflowScheduler } = await import('./scheduler-C3j8Tghm.mjs');
14631
+ const { WorkflowScheduler } = await import('./scheduler-CsaIxFN7.mjs');
14629
14632
  const workflowScheduler = new WorkflowScheduler({
14630
14633
  projectRoots: () => {
14631
14634
  const dirs = /* @__PURE__ */ new Set();
@@ -1,4 +1,4 @@
1
- import{createRequire as _pkgrollCR}from"node:module";const require=_pkgrollCR(import.meta.url);import { a0 as composeSessionId, a1 as generateFriendlyName, c as connectToHypha, a as createSessionStore, r as registerMachineService, a2 as generateHookSettings } from './run-B-1WDymr.mjs';
1
+ import{createRequire as _pkgrollCR}from"node:module";const require=_pkgrollCR(import.meta.url);import { a0 as composeSessionId, a1 as generateFriendlyName, c as connectToHypha, a as createSessionStore, r as registerMachineService, a2 as generateHookSettings } from './run-CLeF1N9s.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';
@@ -1,5 +1,5 @@
1
1
  import { spawn } from 'node:child_process';
2
- import { m as resolveProjectRoot, v as cronMatches } from './run-B-1WDymr.mjs';
2
+ import { m as resolveProjectRoot, v as cronMatches } from './run-CLeF1N9s.mjs';
3
3
  import { l as listWorkflows, b as workflowCrons, w as workflowSteps } from './store-BPL__e4D.mjs';
4
4
  import 'os';
5
5
  import 'fs/promises';
@@ -23,9 +23,10 @@ import 'node:fs/promises';
23
23
  import 'node:util';
24
24
  import 'yaml';
25
25
 
26
- function defaultRunStep(root, command, log) {
26
+ function defaultRunStep(root, command, ownerSession, log) {
27
27
  try {
28
- const child = spawn("sh", ["-c", command], { cwd: root, detached: true, stdio: "ignore" });
28
+ const env = ownerSession ? { ...process.env, SVAMP_SESSION_ID: ownerSession } : process.env;
29
+ const child = spawn("sh", ["-c", command], { cwd: root, detached: true, stdio: "ignore", env });
29
30
  child.on("error", (e) => log?.(`[workflow] step spawn error in ${root}: ${e.message}`));
30
31
  child.unref();
31
32
  } catch (e) {
@@ -84,9 +85,10 @@ class WorkflowScheduler {
84
85
  }
85
86
  fire(root, wf) {
86
87
  const steps = workflowSteps(wf);
87
- this.deps.log?.(`[workflow] schedule fired "${wf.name}" (${steps.length} step${steps.length === 1 ? "" : "s"}) in ${root}`);
88
- const run = this.deps.runStep || ((r, c) => defaultRunStep(r, c, this.deps.log));
89
- for (const step of steps) run(root, step.run);
88
+ const owner = wf.session || null;
89
+ this.deps.log?.(`[workflow] schedule fired "${wf.name}" (${steps.length} step${steps.length === 1 ? "" : "s"}) in ${root}${owner ? ` as ${owner}` : ""}`);
90
+ const run = this.deps.runStep || ((r, c, o) => defaultRunStep(r, c, o, this.deps.log));
91
+ for (const step of steps) run(root, step.run, owner);
90
92
  }
91
93
  }
92
94
 
@@ -54,7 +54,7 @@ async function handleServeCommand() {
54
54
  }
55
55
  }
56
56
  async function serveAdd(args, machineId) {
57
- const { connectAndGetMachine } = await import('./commands-MjIkmrmC.mjs');
57
+ const { connectAndGetMachine } = await import('./commands-j4nqt7yR.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-MjIkmrmC.mjs');
96
+ const { connectAndGetMachine } = await import('./commands-j4nqt7yR.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-MjIkmrmC.mjs');
185
+ const { connectAndGetMachine } = await import('./commands-j4nqt7yR.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-MjIkmrmC.mjs');
205
+ const { connectAndGetMachine } = await import('./commands-j4nqt7yR.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-MjIkmrmC.mjs');
238
+ const { connectAndGetMachine } = await import('./commands-j4nqt7yR.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-B-1WDymr.mjs';
7
+ import { k as getHyphaServerUrl, S as ServeAuth, l as hasCookieToken } from './run-CLeF1N9s.mjs';
8
8
  import 'os';
9
9
  import 'fs/promises';
10
10
  import 'url';
@@ -733,7 +733,7 @@ class ServeManager {
733
733
  const mount = this.mounts.get(mountName);
734
734
  const subdomainOverride = mount?.access === "link" && mount.linkToken ? /* @__PURE__ */ new Map([[this.port, buildLinkSubdomain(subdomainSafe, mount.linkToken)]]) : void 0;
735
735
  try {
736
- const { FrpcTunnel } = await import('./frpc-D4x74mG6.mjs');
736
+ const { FrpcTunnel } = await import('./frpc-Bi1a1Oqy.mjs');
737
737
  let tunnel;
738
738
  tunnel = new FrpcTunnel({
739
739
  name: tunnelName,
@@ -1,4 +1,4 @@
1
- import { R as READ_ONLY_TOOLS, y as loadMachineContext, z as buildMachineInstructions, A as machineToolsForRole, B as buildMachineTools } from './run-B-1WDymr.mjs';
1
+ import { R as READ_ONLY_TOOLS, y as loadMachineContext, z as buildMachineInstructions, A as machineToolsForRole, B as buildMachineTools } from './run-CLeF1N9s.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.178",
3
+ "version": "0.2.179",
4
4
  "description": "Svamp CLI — AI workspace daemon on Hypha Cloud",
5
5
  "author": "Amun AI AB",
6
6
  "license": "SEE LICENSE IN LICENSE",