svamp-cli 0.2.142 → 0.2.144

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-vPl2hvCU.mjs';
5
+ import { m as shortId } from './run-4FVCBRiz.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-vPl2hvCU.mjs').then(function (n) { return n.a1; });
99
+ const { projectName, writeProjectInfo, sanitizeDescription, projectInfoPath } = await import('./run-4FVCBRiz.mjs').then(function (n) { return n.a1; });
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-D7lgEFnK.mjs');
183
+ const { connectAndGetMachine } = await import('./commands-Fpw-qO_m.mjs');
184
184
  return connectAndGetMachine();
185
185
  }
186
186
  function buildInboxMessage(args) {
@@ -216,25 +216,35 @@ async function inboxReplyCore(localMachine, resolve, args) {
216
216
  (m) => m.messageId === args.messageId || m.messageId.startsWith(args.messageId)
217
217
  );
218
218
  if (!original) return { kind: "not-found" };
219
+ let channelDelivered = false;
219
220
  if (original.channelId && original.correlationId) {
220
221
  const rr = await localMachine.sessionRPC(args.sessionId, "channelReply", {
221
222
  params: { channel: original.channelId, correlationId: original.correlationId, to: original.from, body: args.body }
222
223
  });
223
- if (rr?.error) return { kind: "channel-error", error: rr.error };
224
- return { kind: "channel", from: original.from, channelId: original.channelId, correlationId: original.correlationId };
224
+ if (rr?.error) {
225
+ if (!original.fromSession) return { kind: "channel-error", error: rr.error };
226
+ } else channelDelivered = true;
225
227
  }
226
- if (!original.fromSession) return { kind: "no-from-session" };
227
- const { machine, fullId } = await resolve(original.fromSession);
228
- const reply = buildInboxMessage({
229
- fromSessionId: args.sessionId,
230
- to: fullId,
231
- body: args.body,
232
- subject: original.subject ? `Re: ${original.subject}` : void 0,
233
- replyTo: original.messageId,
234
- threadId: original.threadId || original.messageId
235
- });
236
- const sendResult = await machine.sessionRPC(fullId, "sendInboxMessage", { message: reply });
237
- return { kind: "sent", targetId: fullId, messageId: sendResult.messageId, message: reply };
228
+ if (original.fromSession) {
229
+ try {
230
+ const { machine, fullId } = await resolve(original.fromSession);
231
+ const reply = buildInboxMessage({
232
+ fromSessionId: args.sessionId,
233
+ to: fullId,
234
+ body: args.body,
235
+ subject: original.subject ? `Re: ${original.subject}` : void 0,
236
+ replyTo: original.messageId,
237
+ threadId: original.threadId || original.messageId
238
+ });
239
+ const sendResult = await machine.sessionRPC(fullId, "sendInboxMessage", { message: reply });
240
+ return { kind: "sent", targetId: fullId, messageId: sendResult.messageId, message: reply };
241
+ } catch (err) {
242
+ if (channelDelivered) return { kind: "channel", from: original.from, channelId: original.channelId, correlationId: original.correlationId };
243
+ throw err;
244
+ }
245
+ }
246
+ if (channelDelivered) return { kind: "channel", from: original.from, channelId: original.channelId, correlationId: original.correlationId };
247
+ return { kind: "no-from-session" };
238
248
  }
239
249
  async function inboxSend(targetSessionId, opts) {
240
250
  requireNotSandboxed("inbox send");
@@ -248,7 +258,7 @@ async function inboxSend(targetSessionId, opts) {
248
258
  console.error("Message body is required.");
249
259
  process.exit(1);
250
260
  }
251
- const { connectAndResolveSession } = await import('./commands-D7lgEFnK.mjs');
261
+ const { connectAndResolveSession } = await import('./commands-Fpw-qO_m.mjs');
252
262
  let server;
253
263
  try {
254
264
  const { targetId, messageId } = await inboxSendCore(
@@ -302,7 +312,7 @@ async function inboxReply(messageId, body) {
302
312
  console.error("SVAMP_SESSION_ID not set. This command must be run inside a Svamp session.");
303
313
  process.exit(1);
304
314
  }
305
- const { connectAndResolveSession } = await import('./commands-D7lgEFnK.mjs');
315
+ const { connectAndResolveSession } = await import('./commands-Fpw-qO_m.mjs');
306
316
  const { server: localServer, machine: localMachine } = await connectToMachineService();
307
317
  let localDisconnected = false;
308
318
  const disconnectLocal = async () => {
@@ -1,4 +1,4 @@
1
- import { D as resolveModel } from './run-vPl2hvCU.mjs';
1
+ import { D as resolveModel } from './run-4FVCBRiz.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-vPl2hvCU.mjs';
1
+ import { e as clearStopMarker, f as stopMarkerExists, s as startDaemon, b as stopDaemon, d as daemonStatus } from './run-4FVCBRiz.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-vPl2hvCU.mjs').then(function (n) { return n.a8; });
37
+ const { getLoadedConfig } = await import('./run-4FVCBRiz.mjs').then(function (n) { return n.a8; });
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-vPl2hvCU.mjs').then(function (n) { return n.aa; });
54
+ const { restartDaemon } = await import('./run-4FVCBRiz.mjs').then(function (n) { return n.aa; });
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-0o50QJOP.mjs');
347
+ const { handleServiceCommand } = await import('./commands-CvG0C0NI.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-I-qoAc5K.mjs');
355
+ const { handleServeCommand } = await import('./serveCommands-BIEWgKB8.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-DoQptAKr.mjs');
364
+ const { processCommand } = await import('./commands-C5gbnP4S.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-DnDqrf52.mjs');
378
+ const { routineCommand } = await import('./commands-CbVXQCul.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-DGJMJPVR.mjs');
385
+ const { crewCommand } = await import('./commands-DdQDwlts.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-wejuA4s1.mjs').catch(() => ({ default: { version: "unknown" } }));
393
+ const pkg = await import('./package-CJz438K-.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-CHutbJxU.mjs');
402
+ const { runInteractive } = await import('./run-B6-d3Gc7.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-vPl2hvCU.mjs').then(function (n) { return n.a4; });
447
+ const { KNOWN_ACP_AGENTS, KNOWN_MCP_AGENTS: KNOWN_MCP_AGENTS2 } = await import('./run-4FVCBRiz.mjs').then(function (n) { return n.a4; });
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-vPl2hvCU.mjs').then(function (n) { return n.a4; });
459
+ const { resolveAcpAgentConfig, KNOWN_MCP_AGENTS } = await import('./run-4FVCBRiz.mjs').then(function (n) { return n.a4; });
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-vPl2hvCU.mjs').then(function (n) { return n.a5; });
483
+ const { CodexMcpBackend } = await import('./run-4FVCBRiz.mjs').then(function (n) { return n.a5; });
484
484
  backend = new CodexMcpBackend({ cwd, log: logFn });
485
485
  } else {
486
- const { AcpBackend } = await import('./run-vPl2hvCU.mjs').then(function (n) { return n.a3; });
487
- const { GeminiTransport } = await import('./run-vPl2hvCU.mjs').then(function (n) { return n.a6; });
488
- const { DefaultTransport } = await import('./run-vPl2hvCU.mjs').then(function (n) { return n.a2; });
486
+ const { AcpBackend } = await import('./run-4FVCBRiz.mjs').then(function (n) { return n.a3; });
487
+ const { GeminiTransport } = await import('./run-4FVCBRiz.mjs').then(function (n) { return n.a6; });
488
+ const { DefaultTransport } = await import('./run-4FVCBRiz.mjs').then(function (n) { return n.a2; });
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, sessionChecklist, sessionInboxSend, sessionInboxList, sessionInboxRead, sessionInboxReply, sessionInboxClear } = await import('./commands-D7lgEFnK.mjs');
615
+ const { sessionList, sessionWhoami, sessionSpawn, sessionArchive, sessionResume, sessionDelete, sessionInfo, sessionMessages, sessionAttach, sessionMachines, sessionSend, sessionWait, sessionShare, sessionLoopStart, sessionLoopCancel, sessionLoopStatus, sessionChecklist, sessionInboxSend, sessionInboxList, sessionInboxRead, sessionInboxReply, sessionInboxClear } = await import('./commands-Fpw-qO_m.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-D7lgEFnK.mjs');
683
+ const { parseShareArg } = await import('./commands-Fpw-qO_m.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-D7lgEFnK.mjs');
768
+ const { sessionEditMessage } = await import('./commands-Fpw-qO_m.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-D7lgEFnK.mjs');
776
+ const { sessionRefineLastReply } = await import('./commands-Fpw-qO_m.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-D7lgEFnK.mjs');
784
+ const { sessionUndoEdit } = await import('./commands-Fpw-qO_m.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-D7lgEFnK.mjs');
794
+ const { sessionQuery } = await import('./commands-Fpw-qO_m.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-D7lgEFnK.mjs');
827
+ const { sessionApprove } = await import('./commands-Fpw-qO_m.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-D7lgEFnK.mjs');
837
+ const { sessionDeny } = await import('./commands-Fpw-qO_m.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")
@@ -912,7 +912,7 @@ async function handleSessionCommand() {
912
912
  console.error("Usage: svamp session set-title <title>");
913
913
  process.exit(1);
914
914
  }
915
- const { sessionSetTitle } = await import('./agentCommands-_Gq9XHNF.mjs');
915
+ const { sessionSetTitle } = await import('./agentCommands-CcEqWqKV.mjs');
916
916
  await sessionSetTitle(title);
917
917
  } else if (sessionSubcommand === "set-project-description" || sessionSubcommand === "set-project") {
918
918
  const desc = sessionArgs.slice(1).filter((a) => !a.startsWith("--")).join(" ");
@@ -920,7 +920,7 @@ async function handleSessionCommand() {
920
920
  console.error("Usage: svamp session set-project-description <text>");
921
921
  process.exit(1);
922
922
  }
923
- const { sessionSetProjectDescription } = await import('./agentCommands-_Gq9XHNF.mjs');
923
+ const { sessionSetProjectDescription } = await import('./agentCommands-CcEqWqKV.mjs');
924
924
  await sessionSetProjectDescription(desc);
925
925
  } else if (sessionSubcommand === "set-link") {
926
926
  const url = sessionArgs[1];
@@ -929,7 +929,7 @@ async function handleSessionCommand() {
929
929
  process.exit(1);
930
930
  }
931
931
  const label = sessionArgs[2] && !sessionArgs[2].startsWith("--") ? sessionArgs[2] : void 0;
932
- const { sessionSetLink } = await import('./agentCommands-_Gq9XHNF.mjs');
932
+ const { sessionSetLink } = await import('./agentCommands-CcEqWqKV.mjs');
933
933
  await sessionSetLink(url, label);
934
934
  } else if (sessionSubcommand === "notify") {
935
935
  const message = sessionArgs[1];
@@ -938,7 +938,7 @@ async function handleSessionCommand() {
938
938
  process.exit(1);
939
939
  }
940
940
  const level = parseFlagStr("--level") || "info";
941
- const { sessionNotify } = await import('./agentCommands-_Gq9XHNF.mjs');
941
+ const { sessionNotify } = await import('./agentCommands-CcEqWqKV.mjs');
942
942
  await sessionNotify(message, level);
943
943
  } else if (sessionSubcommand === "broadcast") {
944
944
  const action = sessionArgs[1];
@@ -946,7 +946,7 @@ async function handleSessionCommand() {
946
946
  console.error("Usage: svamp session broadcast <action> [args...]\nActions: open-canvas <url> [label], close-canvas, toast <message>");
947
947
  process.exit(1);
948
948
  }
949
- const { sessionBroadcast } = await import('./agentCommands-_Gq9XHNF.mjs');
949
+ const { sessionBroadcast } = await import('./agentCommands-CcEqWqKV.mjs');
950
950
  await sessionBroadcast(action, sessionArgs.slice(2).filter((a) => !a.startsWith("--")));
951
951
  } else if (sessionSubcommand === "inbox") {
952
952
  const inboxSubcmd = sessionArgs[1];
@@ -957,7 +957,7 @@ async function handleSessionCommand() {
957
957
  process.exit(1);
958
958
  }
959
959
  if (agentSessionId) {
960
- const { inboxSend } = await import('./agentCommands-_Gq9XHNF.mjs');
960
+ const { inboxSend } = await import('./agentCommands-CcEqWqKV.mjs');
961
961
  await inboxSend(sessionArgs[2], {
962
962
  body: sessionArgs[3],
963
963
  subject: parseFlagStr("--subject"),
@@ -972,7 +972,7 @@ async function handleSessionCommand() {
972
972
  }
973
973
  } else if (inboxSubcmd === "list" || inboxSubcmd === "ls") {
974
974
  if (agentSessionId && !sessionArgs[2]) {
975
- const { inboxList } = await import('./agentCommands-_Gq9XHNF.mjs');
975
+ const { inboxList } = await import('./agentCommands-CcEqWqKV.mjs');
976
976
  await inboxList({
977
977
  unread: hasFlag("--unread"),
978
978
  limit: parseFlagInt("--limit"),
@@ -994,7 +994,7 @@ async function handleSessionCommand() {
994
994
  process.exit(1);
995
995
  }
996
996
  if (agentSessionId && !sessionArgs[3]) {
997
- const { inboxList } = await import('./agentCommands-_Gq9XHNF.mjs');
997
+ const { inboxList } = await import('./agentCommands-CcEqWqKV.mjs');
998
998
  await sessionInboxRead(agentSessionId, sessionArgs[2], targetMachineId);
999
999
  } else if (sessionArgs[3]) {
1000
1000
  await sessionInboxRead(sessionArgs[2], sessionArgs[3], targetMachineId);
@@ -1004,7 +1004,7 @@ async function handleSessionCommand() {
1004
1004
  }
1005
1005
  } else if (inboxSubcmd === "reply") {
1006
1006
  if (agentSessionId && sessionArgs[2] && sessionArgs[3] && !sessionArgs[4]) {
1007
- const { inboxReply } = await import('./agentCommands-_Gq9XHNF.mjs');
1007
+ const { inboxReply } = await import('./agentCommands-CcEqWqKV.mjs');
1008
1008
  await inboxReply(sessionArgs[2], sessionArgs[3]);
1009
1009
  } else if (sessionArgs[2] && sessionArgs[3] && sessionArgs[4]) {
1010
1010
  await sessionInboxReply(sessionArgs[2], sessionArgs[3], sessionArgs[4], targetMachineId);
@@ -1040,7 +1040,7 @@ async function handleMachineCommand() {
1040
1040
  return;
1041
1041
  }
1042
1042
  if (machineSubcommand === "share") {
1043
- const { machineShare } = await import('./commands-D7lgEFnK.mjs');
1043
+ const { machineShare } = await import('./commands-Fpw-qO_m.mjs');
1044
1044
  let machineId;
1045
1045
  const shareArgs = [];
1046
1046
  for (let i = 1; i < machineArgs.length; i++) {
@@ -1091,14 +1091,14 @@ async function handleMachineCommand() {
1091
1091
  process.exit(1);
1092
1092
  }
1093
1093
  if (all) {
1094
- const { fleetExec } = await import('./fleet-DF-itBd1.mjs');
1094
+ const { fleetExec } = await import('./fleet-B8iKiJyy.mjs');
1095
1095
  await fleetExec(command, { cwd });
1096
1096
  } else {
1097
- const { machineExec } = await import('./commands-D7lgEFnK.mjs');
1097
+ const { machineExec } = await import('./commands-Fpw-qO_m.mjs');
1098
1098
  await machineExec(machineId, command, cwd);
1099
1099
  }
1100
1100
  } else if (machineSubcommand === "info") {
1101
- const { machineInfo } = await import('./commands-D7lgEFnK.mjs');
1101
+ const { machineInfo } = await import('./commands-Fpw-qO_m.mjs');
1102
1102
  let machineId;
1103
1103
  for (let i = 1; i < machineArgs.length; i++) {
1104
1104
  if ((machineArgs[i] === "--machine" || machineArgs[i] === "-m") && i + 1 < machineArgs.length) {
@@ -1118,10 +1118,10 @@ async function handleMachineCommand() {
1118
1118
  level = machineArgs[++i];
1119
1119
  }
1120
1120
  }
1121
- const { machineNotify } = await import('./agentCommands-_Gq9XHNF.mjs');
1121
+ const { machineNotify } = await import('./agentCommands-CcEqWqKV.mjs');
1122
1122
  await machineNotify(message, level);
1123
1123
  } else if (machineSubcommand === "ls") {
1124
- const { machineLs } = await import('./commands-D7lgEFnK.mjs');
1124
+ const { machineLs } = await import('./commands-Fpw-qO_m.mjs');
1125
1125
  let machineId;
1126
1126
  let showHidden = false;
1127
1127
  let path;
@@ -1177,20 +1177,20 @@ Examples:
1177
1177
  };
1178
1178
  const hasFlag = (name) => fleetArgs.includes(`--${name}`);
1179
1179
  if (sub === "status") {
1180
- const { fleetStatus } = await import('./fleet-DF-itBd1.mjs');
1180
+ const { fleetStatus } = await import('./fleet-B8iKiJyy.mjs');
1181
1181
  await fleetStatus();
1182
1182
  } else if (sub === "upgrade-claude") {
1183
- const { fleetUpgradeClaude } = await import('./fleet-DF-itBd1.mjs');
1183
+ const { fleetUpgradeClaude } = await import('./fleet-B8iKiJyy.mjs');
1184
1184
  await fleetUpgradeClaude({ version: flag("version", "-v") });
1185
1185
  } else if (sub === "upgrade-svamp") {
1186
- const { fleetUpgradeSvamp } = await import('./fleet-DF-itBd1.mjs');
1186
+ const { fleetUpgradeSvamp } = await import('./fleet-B8iKiJyy.mjs');
1187
1187
  await fleetUpgradeSvamp({ version: flag("version", "-v"), excludeSelf: hasFlag("exclude-self") });
1188
1188
  } else if (sub === "daemon-restart") {
1189
- const { fleetDaemonRestart } = await import('./fleet-DF-itBd1.mjs');
1189
+ const { fleetDaemonRestart } = await import('./fleet-B8iKiJyy.mjs');
1190
1190
  await fleetDaemonRestart({ graceful: !hasFlag("cleanup") });
1191
1191
  } else if (sub === "push-skill") {
1192
1192
  const name = fleetArgs[1];
1193
- const { fleetPushSkill } = await import('./fleet-DF-itBd1.mjs');
1193
+ const { fleetPushSkill } = await import('./fleet-B8iKiJyy.mjs');
1194
1194
  await fleetPushSkill(name);
1195
1195
  } else {
1196
1196
  console.error(`Unknown fleet subcommand: ${sub}`);
@@ -1206,7 +1206,7 @@ async function handleSkillsCommand() {
1206
1206
  await printSkillsHelp();
1207
1207
  return;
1208
1208
  }
1209
- const { skillsFind, skillsInstall, skillsList, skillsRemove, skillsPublish } = await import('./commands-CXEWlpdy.mjs');
1209
+ const { skillsFind, skillsInstall, skillsList, skillsRemove, skillsPublish } = await import('./commands-DujeUMvp.mjs');
1210
1210
  if (skillsSubcommand === "find" || skillsSubcommand === "search") {
1211
1211
  const query = skillsArgs.slice(1).filter((a) => !a.startsWith("--")).join(" ");
1212
1212
  if (!query) {
@@ -1253,7 +1253,7 @@ async function loginToHypha() {
1253
1253
  process.exit(1);
1254
1254
  }
1255
1255
  const anchor = anchorArg.replace(/\/+$/, "");
1256
- const { loadInstanceConfig } = await import('./run-vPl2hvCU.mjs').then(function (n) { return n.a8; });
1256
+ const { loadInstanceConfig } = await import('./run-4FVCBRiz.mjs').then(function (n) { return n.a8; });
1257
1257
  let cfg = null;
1258
1258
  try {
1259
1259
  cfg = await loadInstanceConfig({ anchor, force: true });
@@ -1364,7 +1364,7 @@ async function logoutFromHypha() {
1364
1364
  } catch {
1365
1365
  }
1366
1366
  try {
1367
- const { clearInstanceConfigCache } = await import('./run-vPl2hvCU.mjs').then(function (n) { return n.a8; });
1367
+ const { clearInstanceConfigCache } = await import('./run-4FVCBRiz.mjs').then(function (n) { return n.a8; });
1368
1368
  clearInstanceConfigCache();
1369
1369
  } catch {
1370
1370
  }
@@ -1702,7 +1702,7 @@ async function applyClaudeAuthFlags(argv) {
1702
1702
  "--use-hypha-proxy, --use-claude-login, and --anthropic-base-url/--anthropic-api-key are mutually exclusive"
1703
1703
  );
1704
1704
  }
1705
- const mod = await import('./run-vPl2hvCU.mjs').then(function (n) { return n.a7; });
1705
+ const mod = await import('./run-4FVCBRiz.mjs').then(function (n) { return n.a7; });
1706
1706
  if (hasHypha) {
1707
1707
  let url;
1708
1708
  const hyphaIdx = argv.indexOf("--use-hypha-proxy");
@@ -1756,7 +1756,7 @@ async function applyDaemonShareFlag(argv) {
1756
1756
  }
1757
1757
  }
1758
1758
  if (collected.length === 0) return;
1759
- const { updateEnvFile } = await import('./run-vPl2hvCU.mjs').then(function (n) { return n.a7; });
1759
+ const { updateEnvFile } = await import('./run-4FVCBRiz.mjs').then(function (n) { return n.a7; });
1760
1760
  const seen = /* @__PURE__ */ new Set();
1761
1761
  const deduped = collected.filter((e) => {
1762
1762
  const k = e.toLowerCase();
@@ -1789,7 +1789,7 @@ async function handleWiseAgentCommand(rest) {
1789
1789
  }
1790
1790
  });
1791
1791
  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(" ");
1792
- const { wiseAskCli } = await import('./commands-D7lgEFnK.mjs');
1792
+ const { wiseAskCli } = await import('./commands-Fpw-qO_m.mjs');
1793
1793
  await wiseAskCli(machineId, message, sessionId, { json });
1794
1794
  return;
1795
1795
  }
@@ -1801,7 +1801,7 @@ async function handleWiseAgentCommand(rest) {
1801
1801
  }
1802
1802
  return void 0;
1803
1803
  };
1804
- const { runWiseVoiceCli } = await import('./headlessCli-BQVkijQh.mjs');
1804
+ const { runWiseVoiceCli } = await import('./headlessCli-Dziw5C0a.mjs');
1805
1805
  await runWiseVoiceCli({ voice: valueOf(["--voice"]), wakeKeywordPath: valueOf(["--wake"]), model: valueOf(["--model"]) });
1806
1806
  return;
1807
1807
  }
@@ -1817,7 +1817,7 @@ async function handleWiseAgentCommand(rest) {
1817
1817
  const sessionId = rest.includes("--global") ? void 0 : valueOf(["--session", "-s"]);
1818
1818
  const json = rest.includes("--json");
1819
1819
  const url = rest.slice(1).find((a) => /^https?:\/\//.test(a)) || "";
1820
- const { wiseJoinMeetingCli } = await import('./commands-D7lgEFnK.mjs');
1820
+ const { wiseJoinMeetingCli } = await import('./commands-Fpw-qO_m.mjs');
1821
1821
  await wiseJoinMeetingCli(machineId, url, sessionId, { json });
1822
1822
  return;
1823
1823
  }
@@ -1829,7 +1829,7 @@ async function handleWiseAgentCommand(rest) {
1829
1829
  }
1830
1830
  return void 0;
1831
1831
  };
1832
- const { wiseLeaveMeetingCli } = await import('./commands-D7lgEFnK.mjs');
1832
+ const { wiseLeaveMeetingCli } = await import('./commands-Fpw-qO_m.mjs');
1833
1833
  await wiseLeaveMeetingCli(valueOf(["--machine", "-m"]), valueOf(["--session", "-s"]), { json: rest.includes("--json") });
1834
1834
  return;
1835
1835
  }
@@ -1841,7 +1841,7 @@ async function handleWiseAgentCommand(rest) {
1841
1841
  }
1842
1842
  return void 0;
1843
1843
  };
1844
- const { wiseMeetingsCli } = await import('./commands-D7lgEFnK.mjs');
1844
+ const { wiseMeetingsCli } = await import('./commands-Fpw-qO_m.mjs');
1845
1845
  await wiseMeetingsCli(valueOf(["--machine", "-m"]), { json: rest.includes("--json") });
1846
1846
  return;
1847
1847
  }
@@ -1886,7 +1886,7 @@ If none is set, hitting a WISE Agent channel returns a clear "not configured" er
1886
1886
  return;
1887
1887
  }
1888
1888
  const authArgs = rest.slice(1);
1889
- const mod = await import('./auth-C1V6j2MC.mjs');
1889
+ const mod = await import('./auth-Cn-pDzkt.mjs');
1890
1890
  let action;
1891
1891
  try {
1892
1892
  action = mod.parseWiseAgentAuthArgs(authArgs);
@@ -1896,7 +1896,7 @@ If none is set, hitting a WISE Agent channel returns a clear "not configured" er
1896
1896
  return;
1897
1897
  }
1898
1898
  if (action) {
1899
- const { updateEnvFile } = await import('./run-vPl2hvCU.mjs').then(function (n) { return n.a7; });
1899
+ const { updateEnvFile } = await import('./run-4FVCBRiz.mjs').then(function (n) { return n.a7; });
1900
1900
  const updates = mod.buildWiseAgentEnvUpdates(action);
1901
1901
  updateEnvFile(updates);
1902
1902
  for (const [k, v] of Object.entries(updates)) {
@@ -1910,7 +1910,7 @@ If none is set, hitting a WISE Agent channel returns a clear "not configured" er
1910
1910
  }
1911
1911
  async function handleDaemonAuthCommand(argv) {
1912
1912
  const sub = (argv[0] || "status").toLowerCase();
1913
- const mod = await import('./run-vPl2hvCU.mjs').then(function (n) { return n.a7; });
1913
+ const mod = await import('./run-4FVCBRiz.mjs').then(function (n) { return n.a7; });
1914
1914
  if (sub === "--help" || sub === "-h" || sub === "help") {
1915
1915
  console.log(`
1916
1916
  svamp daemon auth \u2014 Configure how Claude subprocesses authenticate
@@ -2223,7 +2223,7 @@ Examples:
2223
2223
  async function printSkillsHelp() {
2224
2224
  let browseUrl = "<HYPHA_SERVER_URL>/<workspace>/artifacts/marketplace (set HYPHA_SERVER_URL)";
2225
2225
  try {
2226
- const { getArtifactBaseUrl, getSkillsCollectionName } = await import('./run-vPl2hvCU.mjs').then(function (n) { return n.a9; });
2226
+ const { getArtifactBaseUrl, getSkillsCollectionName } = await import('./run-4FVCBRiz.mjs').then(function (n) { return n.a9; });
2227
2227
  browseUrl = `${getArtifactBaseUrl()}/${getSkillsCollectionName()}`;
2228
2228
  } catch {
2229
2229
  }
@@ -1,11 +1,11 @@
1
1
  import { writeFileSync, readFileSync } from 'fs';
2
2
  import { resolve } from 'path';
3
- import { connectAndGetMachine } from './commands-D7lgEFnK.mjs';
3
+ import { connectAndGetMachine } from './commands-Fpw-qO_m.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-vPl2hvCU.mjs';
8
+ import './run-4FVCBRiz.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-vPl2hvCU.mjs';
4
+ import { E as readChecklist, F as compileChecklist, G as RoutineStore, H as RoutineRunner } from './run-4FVCBRiz.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-D7lgEFnK.mjs');
107
+ const { connectAndGetMachine } = await import('./commands-Fpw-qO_m.mjs');
108
108
  const { server, machine } = await connectAndGetMachine();
109
109
  try {
110
110
  await machine.sessionRPC(reportTo, "sendInboxMessage", { message });
@@ -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-DorJMSBi.mjs');
61
+ const { runFrpcTunnel } = await import('./frpc-DQZjSc7h.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-D7lgEFnK.mjs');
71
+ const { connectAndGetMachine } = await import('./commands-Fpw-qO_m.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-DorJMSBi.mjs');
126
+ const { runFrpcTunnel } = await import('./frpc-DQZjSc7h.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-D7lgEFnK.mjs');
135
+ const { connectAndGetMachine } = await import('./commands-Fpw-qO_m.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-D7lgEFnK.mjs');
175
+ const { connectAndGetMachine } = await import('./commands-Fpw-qO_m.mjs');
176
176
  const { server, machine } = await connectAndGetMachine();
177
177
  try {
178
178
  await machine.tunnelStop({ name });
@@ -1,7 +1,7 @@
1
1
  import { existsSync } from 'node:fs';
2
- import { connectAndGetMachine, resolveSessionId, createWorktree, connectAndResolveSession } from './commands-D7lgEFnK.mjs';
2
+ import { connectAndGetMachine, resolveSessionId, createWorktree, connectAndResolveSession } from './commands-Fpw-qO_m.mjs';
3
3
  import { execSync } from 'node:child_process';
4
- import { m as shortId } from './run-vPl2hvCU.mjs';
4
+ import { m as shortId } from './run-4FVCBRiz.mjs';
5
5
  import 'node:path';
6
6
  import 'node:os';
7
7
  import 'os';
@@ -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-vPl2hvCU.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-4FVCBRiz.mjs';
5
5
  import 'fs/promises';
6
6
  import 'url';
7
7
  import 'child_process';
@@ -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 validateChecklist, Q as computeOutboundHop, m as shortId, T as buildMachineShareUrl, U as summarize, V as newItem, W as parseHandle, X as handleMatchesMetadata } from './run-vPl2hvCU.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 validateChecklist, Q as computeOutboundHop, m as shortId, T as buildMachineShareUrl, U as summarize, V as newItem, W as parseHandle, X as handleMatchesMetadata } from './run-4FVCBRiz.mjs';
6
6
  import 'os';
7
7
  import 'fs/promises';
8
8
  import 'fs';
@@ -2729,36 +2729,50 @@ async function sessionInboxReply(sessionIdPartial, messageId, body, machineId) {
2729
2729
  console.error(`Message ${messageId} not found in inbox.`);
2730
2730
  process.exit(1);
2731
2731
  }
2732
+ let channelDelivered = false;
2732
2733
  if (original.channelId && original.correlationId) {
2733
2734
  const rr = await machine.sessionRPC(fullId, "channelReply", { params: { channel: original.channelId, correlationId: original.correlationId, to: original.from, body } });
2734
2735
  if (rr?.error) {
2735
- console.error(`Channel reply failed: ${rr.error}`);
2736
- process.exit(1);
2736
+ if (!original.fromSession) {
2737
+ console.error(`Channel reply failed: ${rr.error}`);
2738
+ process.exit(1);
2739
+ }
2740
+ } else {
2741
+ channelDelivered = true;
2742
+ console.log(`Reply queued to "${original.from}" on channel ${original.channelId} (correlation ${original.correlationId}).`);
2743
+ }
2744
+ }
2745
+ if (original.fromSession) {
2746
+ try {
2747
+ const hop = computeOutboundHop(process.env.SVAMP_SESSION_ID || fullId);
2748
+ const reply = {
2749
+ messageId: shortId(),
2750
+ body,
2751
+ timestamp: Date.now(),
2752
+ read: false,
2753
+ from: process.env.SVAMP_SESSION_HANDLE || `session:${fullId}`,
2754
+ fromSession: fullId,
2755
+ to: original.fromSession,
2756
+ subject: original.subject ? `Re: ${original.subject}` : void 0,
2757
+ urgency: "normal",
2758
+ hopCount: hop.hopCount,
2759
+ replyTo: original.messageId,
2760
+ threadId: original.threadId || original.messageId
2761
+ };
2762
+ const sendResult = await machine.sessionRPC(original.fromSession, "sendInboxMessage", { message: reply });
2763
+ console.log(`Reply sent to session ${original.fromSession.slice(0, 8)} (id: ${sendResult.messageId.slice(0, 8)})`);
2764
+ } catch (err) {
2765
+ if (!channelDelivered) {
2766
+ console.error(`Reply failed: ${err?.message || err}`);
2767
+ process.exit(1);
2768
+ }
2737
2769
  }
2738
- console.log(`Reply queued to "${original.from}" on channel ${original.channelId} (correlation ${original.correlationId}).`);
2739
2770
  return;
2740
2771
  }
2741
- if (!original.fromSession) {
2772
+ if (!channelDelivered) {
2742
2773
  console.error("Cannot reply: original message has no fromSession (and not a channel message).");
2743
2774
  process.exit(1);
2744
2775
  }
2745
- const hop = computeOutboundHop(process.env.SVAMP_SESSION_ID || fullId);
2746
- const reply = {
2747
- messageId: shortId(),
2748
- body,
2749
- timestamp: Date.now(),
2750
- read: false,
2751
- from: process.env.SVAMP_SESSION_HANDLE || `session:${fullId}`,
2752
- fromSession: fullId,
2753
- to: original.fromSession,
2754
- subject: original.subject ? `Re: ${original.subject}` : void 0,
2755
- urgency: "normal",
2756
- hopCount: hop.hopCount,
2757
- replyTo: original.messageId,
2758
- threadId: original.threadId || original.messageId
2759
- };
2760
- const sendResult = await machine.sessionRPC(original.fromSession, "sendInboxMessage", { message: reply });
2761
- console.log(`Reply sent to session ${original.fromSession.slice(0, 8)} (id: ${sendResult.messageId.slice(0, 8)})`);
2762
2776
  } finally {
2763
2777
  await server.disconnect();
2764
2778
  }
@@ -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-vPl2hvCU.mjs';
4
+ import { c as connectToHypha } from './run-4FVCBRiz.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-vPl2hvCU.mjs';
7
+ import { h as getFrpsSubdomainHost, i as getFrpsServerPort, j as getFrpsServerAddr } from './run-4FVCBRiz.mjs';
8
8
  import 'fs/promises';
9
9
  import 'url';
10
10
  import 'node:crypto';
@@ -1,5 +1,5 @@
1
- import { D as resolveModel, Y as describeMisconfiguration, Z as buildMachineDeps } from './run-vPl2hvCU.mjs';
2
- import { handleRealtimeEvent, initMachineVoiceSession } from './sideband-Cg0Ttcuj.mjs';
1
+ import { D as resolveModel, Y as describeMisconfiguration, Z as buildMachineDeps } from './run-4FVCBRiz.mjs';
2
+ import { handleRealtimeEvent, initMachineVoiceSession } from './sideband-C9zoh2QP.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-vPl2hvCU.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-4FVCBRiz.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.142";
2
+ var version = "0.2.144";
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";
@@ -1366,7 +1366,7 @@ function routingSession(channel, ctx) {
1366
1366
  function gatewayBase(channelsServiceId, baseUrl) {
1367
1367
  const slash = channelsServiceId.indexOf("/");
1368
1368
  if (slash < 0) return `${baseUrl.replace(/\/$/, "")}/services/${channelsServiceId}`;
1369
- const ws = channelsServiceId.slice(0, slash);
1369
+ const ws = encodeURIComponent(channelsServiceId.slice(0, slash));
1370
1370
  const clientSvc = channelsServiceId.slice(slash + 1);
1371
1371
  return `${baseUrl.replace(/\/$/, "")}/${ws}/services/${clientSvc}`;
1372
1372
  }
@@ -1405,21 +1405,22 @@ const res = await get_service("${svc}").send({ channel: "${channel.id}", message
1405
1405
  if (res.status === "completed") return res.reply; // answered now \u2014 done
1406
1406
  let cursor = 0; // else poll for the async reply
1407
1407
  while (true) {
1408
- const r = await get_service("${svc}").receive({ channel: "${channel.id}", key: "${key}", cursor, wait: 25 });
1408
+ const r = await get_service("${svc}").receive({ channel: "${channel.id}", key: "${key}", correlationId: res.correlationId, cursor, wait: 25 });
1409
1409
  cursor = r.cursor;
1410
- for (const reply of r.replies) if (reply.correlationId === res.correlationId) return reply.body;
1410
+ if (r.replies.length) return r.replies[0].body; // server matched it by correlationId
1411
1411
  }
1412
1412
  \`\`\`
1413
- **HTTP:** \`POST ${recvUrl}\` with \`{"kwargs": {"channel": "${channel.id}", "key": "${key}", "cursor": 0, "wait": 25}}\` (long-poll), or stream \`GET <channel-http>/channel/${channel.id}/events?key=${key}\` (SSE).
1413
+ **HTTP:** \`POST ${recvUrl}\` with \`{"kwargs": {"channel": "${channel.id}", "key": "${key}", "correlationId": "<from send>", "cursor": 0, "wait": 25}}\` (long-poll), or stream \`GET <channel-http>/channel/${channel.id}/events?key=${key}\` (SSE).
1414
+ > Tip: always pass the \`correlationId\` from \`send\` to \`receive\` \u2014 it is the reply key, so the reply finds you with no identity matching. Omit it and \`receive\` falls back to matching your \`from\`, which you must then supply identically on every call.
1414
1415
 
1415
- ### Agent-to-agent: get the reply in your own inbox
1416
+ ### Agent-to-agent: also get the reply in your own inbox
1416
1417
  If **you are a Svamp agent session**, pass \`reply_to: { session: "<your-session-id>" }\`
1417
1418
  to \`send()\`. The reply is then delivered straight to **your session's inbox**
1418
1419
  (\`inbox reply\`-able, persistent) \u2014 symmetric agent\u2194agent messaging. Without
1419
1420
  \`reply_to.session\` you are treated as an **external caller**: the reply goes to this
1420
1421
  channel's outbox and you must poll \`receive()\` (above) for it \u2014 it will **not** appear
1421
1422
  in your inbox.` : "";
1422
- const rpcLine = hyphaOpen ? `**Hypha RPC** \u2014 preferred. Your verified Hypha identity is accepted, no key needed:` : `**Hypha RPC** \u2014 verified identity:`;
1423
+ const rpcAuthNote = hyphaOpen ? `Your verified Hypha identity is accepted \u2014 no key needed.` : `Uses your verified Hypha identity.`;
1423
1424
  return `---
1424
1425
  name: ${name}
1425
1426
  description: ${desc}
@@ -1427,12 +1428,14 @@ description: ${desc}
1427
1428
  # ${name}
1428
1429
  ${channel.description || ""}
1429
1430
 
1430
- Self-contained guide for messaging the **${channel.name}** channel. ${replyNote}
1431
+ Messaging the **${channel.name}** channel. ${replyNote}
1431
1432
  ${bindNote}
1432
- This skill (with every value below already filled in) is served at:
1433
- ${skillUrl}
1434
1433
 
1435
- ${rpcLine}
1434
+ ## Send a message \u2014 pick ONE way
1435
+ Every value below is already filled in. Only change \`message\` (and \`from\` to your name).
1436
+
1437
+ ### A) Hypha RPC \u2014 simplest if you're a Svamp/Hypha agent
1438
+ ${rpcAuthNote}
1436
1439
  \`\`\`js
1437
1440
  await get_service("${svc}").send({
1438
1441
  channel: "${channel.id}",
@@ -1441,13 +1444,16 @@ await get_service("${svc}").send({
1441
1444
  });
1442
1445
  \`\`\`
1443
1446
 
1444
- **HTTP** \u2014 any client, no Hypha SDK needed (Hypha gateway wraps args under \`kwargs\`):
1447
+ ### B) HTTP \u2014 any client (curl, fetch, \u2026)
1448
+ \u26A0\uFE0F The Hypha gateway requires args wrapped in \`kwargs\`. A raw body or a \`?channel=\`
1449
+ query is dropped and you'll get \`"channel not found"\`. Copy this exactly:
1450
+ \`\`\`bash
1451
+ curl -X POST "${sendUrl}" \\
1452
+ -H 'Content-Type: application/json' \\
1453
+ -d '{"kwargs": {"channel": "${channel.id}", "message": "your message here", "from": "your-name", "key": "${key}"${sessionKv}}}'
1445
1454
  \`\`\`
1446
- POST ${sendUrl}
1447
- Content-Type: application/json
1448
1455
 
1449
- {"kwargs": {"channel": "${channel.id}", "message": "your message here", "from": "your-name", "key": "${key}"${sessionKv}}}
1450
- \`\`\`${queueSection}`;
1456
+ Always-current copy of this skill (all ids filled in): ${skillUrl}${queueSection}`;
1451
1457
  }
1452
1458
 
1453
1459
  function resolveSender(channel, input = {}) {
@@ -1572,10 +1578,19 @@ class ChannelOutbox {
1572
1578
  this.emitter.emit(channelId, reply);
1573
1579
  return reply;
1574
1580
  }
1575
- /** Replies for `to` on `channelId` with seq > cursor (optionally one correlationId). */
1581
+ /**
1582
+ * Replies on `channelId` with seq > cursor.
1583
+ *
1584
+ * The `correlationId` is the reply KEY — the capability `send` returns to the caller.
1585
+ * When given, we match on it ALONE: knowing the unguessable id proves the caller owns
1586
+ * that conversation, so we skip the fragile sender-identity match (which required the
1587
+ * caller to pass the exact same `from` on send and receive — the #1 source of
1588
+ * "outbox is empty" confusion). Without a correlationId, fall back to "every reply
1589
+ * addressed to my identity" (for unsolicited pushes / polling all my mail).
1590
+ */
1576
1591
  since(channelId, cursor, to, correlationId) {
1577
1592
  this._evict(channelId);
1578
- return (this.byChannel.get(channelId) || []).filter((r) => r.seq > cursor && r.to === to && (!correlationId || r.correlationId === correlationId));
1593
+ return (this.byChannel.get(channelId) || []).filter((r) => r.seq > cursor && (correlationId ? r.correlationId === correlationId : r.to === to));
1579
1594
  }
1580
1595
  /** Highest seq on a channel (the cursor a caller gets back). */
1581
1596
  cursor(channelId) {
@@ -1590,7 +1605,7 @@ class ChannelOutbox {
1590
1605
  if (ready.length) return Promise.resolve({ replies: ready, cursor: this.cursor(channelId) });
1591
1606
  return new Promise((resolve) => {
1592
1607
  const onReply = (r) => {
1593
- if (r.to !== to || correlationId && r.correlationId !== correlationId) return;
1608
+ if (correlationId ? r.correlationId !== correlationId : r.to !== to) return;
1594
1609
  cleanup();
1595
1610
  resolve({ replies: this.since(channelId, cursor, to, correlationId), cursor: this.cursor(channelId) });
1596
1611
  };
@@ -2700,7 +2715,7 @@ async function registerMachineService(server, machineId, metadata, daemonState,
2700
2715
  const tunnels = handlers.tunnels;
2701
2716
  if (!tunnels) throw new Error("Tunnel management not available");
2702
2717
  if (tunnels.has(params.name)) throw new Error(`Tunnel '${params.name}' already running`);
2703
- const { FrpcTunnel } = await import('./frpc-DorJMSBi.mjs');
2718
+ const { FrpcTunnel } = await import('./frpc-DQZjSc7h.mjs');
2704
2719
  const tunnel = new FrpcTunnel({
2705
2720
  name: params.name,
2706
2721
  ports: params.ports,
@@ -3050,7 +3065,7 @@ QUESTION: ${params.question || "Summarize this concisely."}` }
3050
3065
  }
3051
3066
  const deps = buildSessionDeps(rpc, { cwd, ownerEmail: owner });
3052
3067
  const sender = { name: context?.user?.email || context?.user?.id || "user", kind: "user", verified: true };
3053
- const { toolsForRole } = await import('./sideband-Cg0Ttcuj.mjs');
3068
+ const { toolsForRole } = await import('./sideband-C9zoh2QP.mjs');
3054
3069
  const r2 = await runWiseAgent({ message: params.message, sender, config: { tools: toolsForRole(role2) }, deps, transport, model: resolved.model });
3055
3070
  return fmt(r2);
3056
3071
  }
@@ -3149,7 +3164,7 @@ QUESTION: ${params.question || "Summarize this concisely."}` }
3149
3164
  if (r.error || !r.sender) return { error: r.error || "unauthorized" };
3150
3165
  const callId = "call_" + Math.random().toString(16).slice(2, 12);
3151
3166
  const rendered = renderMessage(c, { sender: r.sender, body: { message: kwargs.message }, callId });
3152
- const { queryCore } = await import('./commands-D7lgEFnK.mjs');
3167
+ const { queryCore } = await import('./commands-Fpw-qO_m.mjs');
3153
3168
  const timeout = c.reply?.timeout_sec || 120;
3154
3169
  let result;
3155
3170
  try {
@@ -3168,6 +3183,7 @@ QUESTION: ${params.question || "Summarize this concisely."}` }
3168
3183
  if (result.status === "permission-pending") return { ok: false, call_id: callId, status: "permission-pending", error: result.error };
3169
3184
  return { ok: true, call_id: callId, correlationId: callId, status: "completed", reply: result.response };
3170
3185
  };
3186
+ const MISSING_CHANNEL_HINT = `missing "channel" \u2014 over HTTP, Hypha's gateway needs args wrapped: POST {"kwargs": {"channel": "<id>", "message": "...", "from": "...", "key": "..."}}. Over Hypha RPC use get_service("<ws>/<machine>:channels").send({channel, message, from}).`;
3171
3187
  const channelsServiceInfo = await server.registerService(
3172
3188
  {
3173
3189
  id: "channels",
@@ -3194,7 +3210,8 @@ QUESTION: ${params.question || "Summarize this concisely."}` }
3194
3210
  // list() returned. Normalize both the string and `{channel}` object shapes.
3195
3211
  describe: async (channel) => {
3196
3212
  const id = typeof channel === "string" ? channel : channel?.channel;
3197
- const rpc = id ? await findChannelOwner(id) : void 0;
3213
+ if (!id) return { error: MISSING_CHANNEL_HINT };
3214
+ const rpc = await findChannelOwner(id);
3198
3215
  if (!rpc?.channelDescribe) return { error: "channel not found" };
3199
3216
  return rpc.channelDescribe(id);
3200
3217
  },
@@ -3213,6 +3230,7 @@ ${d?.error || "not found"}`;
3213
3230
  },
3214
3231
  send: async (kwargs = {}, context) => {
3215
3232
  trackInbound();
3233
+ if (!kwargs.channel) return { error: MISSING_CHANNEL_HINT };
3216
3234
  const res = resolveChannel(kwargs.channel, kwargs.session);
3217
3235
  if ("error" in res) return { error: res.error };
3218
3236
  if (res.tier === "stateless") return dispatchStateless(res.c, res.dir, kwargs, context);
@@ -3224,6 +3242,7 @@ ${d?.error || "not found"}`;
3224
3242
  // in (the `session` target); stateless channels can't queue. Channel-identity auth.
3225
3243
  receive: async (kwargs = {}, context) => {
3226
3244
  trackInbound();
3245
+ if (!kwargs.channel) return { error: MISSING_CHANNEL_HINT };
3227
3246
  const res = resolveChannel(kwargs.channel, kwargs.session);
3228
3247
  if ("error" in res) return { error: res.error };
3229
3248
  const { c, dir } = res;
@@ -3508,7 +3527,10 @@ function formatInboxMessageXml(msg) {
3508
3527
  if (msg.from) attrs.push(`from="${escapeXml(msg.from)}"`);
3509
3528
  if (msg.channel) attrs.push(`channel="${escapeXml(msg.channel)}"`);
3510
3529
  if (msg.verified !== void 0) attrs.push(`verified="${msg.verified === true}"`);
3511
- if (msg.channelId && msg.correlationId) attrs.push(`awaiting-reply="true"`);
3530
+ if (msg.channelId && msg.correlationId) {
3531
+ attrs.push(`awaiting-reply="true"`);
3532
+ attrs.push(`reply-how="svamp session inbox reply ${escapeXml(msg.messageId)} '...your reply...'"`);
3533
+ }
3512
3534
  if (msg.to) attrs.push(`to="${escapeXml(msg.to)}"`);
3513
3535
  if (msg.subject) attrs.push(`subject="${escapeXml(msg.subject)}"`);
3514
3536
  if (msg.urgency) attrs.push(`urgency="${msg.urgency}"`);
@@ -4237,7 +4259,7 @@ function createSessionStore(server, sessionId, initialMetadata, initialAgentStat
4237
4259
  channel: c.name,
4238
4260
  subject: c.name,
4239
4261
  ...replySession ? { fromSession: replySession, threadId: callId } : {},
4240
- ...queue && !replySession ? { channelId: c.id, correlationId: callId } : {}
4262
+ ...queue ? { channelId: c.id, correlationId: callId } : {}
4241
4263
  };
4242
4264
  await rpcHandlers.sendInboxMessage(inboxMsg, ownerCtx);
4243
4265
  channelStore.recordCall(c.id, { sender: r.sender.name, verified: r.sender.verified, callId, outcome: "delivered" });
@@ -11603,7 +11625,7 @@ async function startDaemon(options) {
11603
11625
  saveExposedTunnels(list);
11604
11626
  }
11605
11627
  async function createExposedTunnel(spec) {
11606
- const { FrpcTunnel } = await import('./frpc-DorJMSBi.mjs');
11628
+ const { FrpcTunnel } = await import('./frpc-DQZjSc7h.mjs');
11607
11629
  const tunnel = new FrpcTunnel({
11608
11630
  name: spec.name,
11609
11631
  ports: spec.ports,
@@ -11623,7 +11645,7 @@ async function startDaemon(options) {
11623
11645
  return tunnel;
11624
11646
  }
11625
11647
  const tunnelRecreateState = /* @__PURE__ */ new Map();
11626
- const { ServeManager } = await import('./serveManager-Cd7jyXHD.mjs');
11648
+ const { ServeManager } = await import('./serveManager-DHTgwal8.mjs');
11627
11649
  const serveManager = new ServeManager(SVAMP_HOME, (msg) => logger.log(`[SERVE] ${msg}`), hyphaServerUrl);
11628
11650
  ensureAutoInstalledSkills(logger).catch(() => {
11629
11651
  });
@@ -1,4 +1,4 @@
1
- import{createRequire as _pkgrollCR}from"node:module";const require=_pkgrollCR(import.meta.url);import { _ as composeSessionId, $ as generateFriendlyName, c as connectToHypha, a as createSessionStore, r as registerMachineService, a0 as generateHookSettings } from './run-vPl2hvCU.mjs';
1
+ import{createRequire as _pkgrollCR}from"node:module";const require=_pkgrollCR(import.meta.url);import { _ as composeSessionId, $ as generateFriendlyName, c as connectToHypha, a as createSessionStore, r as registerMachineService, a0 as generateHookSettings } from './run-4FVCBRiz.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';
@@ -54,7 +54,7 @@ async function handleServeCommand() {
54
54
  }
55
55
  }
56
56
  async function serveAdd(args, machineId) {
57
- const { connectAndGetMachine } = await import('./commands-D7lgEFnK.mjs');
57
+ const { connectAndGetMachine } = await import('./commands-Fpw-qO_m.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-D7lgEFnK.mjs');
96
+ const { connectAndGetMachine } = await import('./commands-Fpw-qO_m.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-D7lgEFnK.mjs');
185
+ const { connectAndGetMachine } = await import('./commands-Fpw-qO_m.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-D7lgEFnK.mjs');
205
+ const { connectAndGetMachine } = await import('./commands-Fpw-qO_m.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-D7lgEFnK.mjs');
238
+ const { connectAndGetMachine } = await import('./commands-Fpw-qO_m.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-vPl2hvCU.mjs';
7
+ import { k as getHyphaServerUrl, S as ServeAuth, l as hasCookieToken } from './run-4FVCBRiz.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-DorJMSBi.mjs');
736
+ const { FrpcTunnel } = await import('./frpc-DQZjSc7h.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, z as loadMachineContext, A as buildMachineInstructions, B as machineToolsForRole, C as buildMachineTools } from './run-vPl2hvCU.mjs';
1
+ import { R as READ_ONLY_TOOLS, z as loadMachineContext, A as buildMachineInstructions, B as machineToolsForRole, C as buildMachineTools } from './run-4FVCBRiz.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.142",
3
+ "version": "0.2.144",
4
4
  "description": "Svamp CLI — AI workspace daemon on Hypha Cloud",
5
5
  "author": "Amun AI AB",
6
6
  "license": "SEE LICENSE IN LICENSE",