svamp-cli 0.2.6 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -148,7 +148,7 @@ async function sessionBroadcast(action, args) {
148
148
  console.log(`Broadcast sent: ${action}`);
149
149
  }
150
150
  async function connectToMachineService() {
151
- const { connectAndGetMachine } = await import('./commands-Bb11XUfY.mjs');
151
+ const { connectAndGetMachine } = await import('./commands-DXaH6BQg.mjs');
152
152
  return connectAndGetMachine();
153
153
  }
154
154
  async function inboxSend(targetSessionId, opts) {
@@ -165,7 +165,7 @@ async function inboxSend(targetSessionId, opts) {
165
165
  }
166
166
  const { server, machine } = await connectToMachineService();
167
167
  try {
168
- const { resolveSessionId } = await import('./commands-Bb11XUfY.mjs');
168
+ const { resolveSessionId } = await import('./commands-DXaH6BQg.mjs');
169
169
  const sessions = await machine.listSessions();
170
170
  const match = resolveSessionId(sessions, targetSessionId);
171
171
  const fullTargetId = match.sessionId;
package/dist/cli.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { b as stopDaemon, s as startDaemon, d as daemonStatus } from './run-XoQsDcg4.mjs';
1
+ import { b as stopDaemon, s as startDaemon, d as daemonStatus } from './run-CAcScbEG.mjs';
2
2
  import 'os';
3
3
  import 'fs/promises';
4
4
  import 'fs';
@@ -223,15 +223,24 @@ async function main() {
223
223
  console.error("svamp service: Service commands are not available in sandboxed sessions.");
224
224
  process.exit(1);
225
225
  }
226
- const { handleServiceCommand } = await import('./commands-BYbuedOK.mjs');
226
+ const { handleServiceCommand } = await import('./commands-BJJTEZD4.mjs');
227
227
  await handleServiceCommand();
228
+ } else if (subcommand === "serve") {
229
+ const { isSandboxed: isSandboxedServe } = await import('./sandboxDetect-BWA3zQlA.mjs');
230
+ if (isSandboxedServe()) {
231
+ console.error("svamp serve: Serve commands are not available in sandboxed sessions.");
232
+ process.exit(1);
233
+ }
234
+ const { handleServeCommand } = await import('./serveCommands-Dr9CAgHo.mjs');
235
+ await handleServeCommand();
236
+ process.exit(0);
228
237
  } else if (subcommand === "process" || subcommand === "proc") {
229
238
  const { isSandboxed: isSandboxedProc } = await import('./sandboxDetect-BWA3zQlA.mjs');
230
239
  if (isSandboxedProc()) {
231
240
  console.error("svamp process: Process commands are not available in sandboxed sessions.");
232
241
  process.exit(1);
233
242
  }
234
- const { processCommand } = await import('./commands-Bhf3G7y0.mjs');
243
+ const { processCommand } = await import('./commands-CAGeQm5f.mjs');
235
244
  let machineId;
236
245
  const processArgs = args.slice(1);
237
246
  const mIdx = processArgs.findIndex((a) => a === "--machine" || a === "-m");
@@ -249,7 +258,7 @@ async function main() {
249
258
  } else if (!subcommand || subcommand === "start") {
250
259
  await handleInteractiveCommand();
251
260
  } else if (subcommand === "--version" || subcommand === "-v") {
252
- const pkg = await import('./package-BdGJqGmA.mjs').catch(() => ({ default: { version: "unknown" } }));
261
+ const pkg = await import('./package-BMEGmZWU.mjs').catch(() => ({ default: { version: "unknown" } }));
253
262
  console.log(`svamp version: ${pkg.default.version}`);
254
263
  } else {
255
264
  console.error(`Unknown command: ${subcommand}`);
@@ -258,7 +267,7 @@ async function main() {
258
267
  }
259
268
  }
260
269
  async function handleInteractiveCommand() {
261
- const { runInteractive } = await import('./run-RsupAuzC.mjs');
270
+ const { runInteractive } = await import('./run-B3G5eZmn.mjs');
262
271
  const interactiveArgs = subcommand === "start" ? args.slice(1) : args;
263
272
  let directory = process.cwd();
264
273
  let resumeSessionId;
@@ -303,7 +312,7 @@ async function handleAgentCommand() {
303
312
  return;
304
313
  }
305
314
  if (agentArgs[0] === "list") {
306
- const { KNOWN_ACP_AGENTS, KNOWN_MCP_AGENTS: KNOWN_MCP_AGENTS2 } = await import('./run-XoQsDcg4.mjs').then(function (n) { return n.i; });
315
+ const { KNOWN_ACP_AGENTS, KNOWN_MCP_AGENTS: KNOWN_MCP_AGENTS2 } = await import('./run-CAcScbEG.mjs').then(function (n) { return n.i; });
307
316
  console.log("Known agents:");
308
317
  for (const [name, config2] of Object.entries(KNOWN_ACP_AGENTS)) {
309
318
  console.log(` ${name.padEnd(12)} ${config2.command} ${config2.args.join(" ")} (ACP)`);
@@ -315,7 +324,7 @@ async function handleAgentCommand() {
315
324
  console.log('Use "svamp agent -- <command> [args]" for a custom ACP agent.');
316
325
  return;
317
326
  }
318
- const { resolveAcpAgentConfig, KNOWN_MCP_AGENTS } = await import('./run-XoQsDcg4.mjs').then(function (n) { return n.i; });
327
+ const { resolveAcpAgentConfig, KNOWN_MCP_AGENTS } = await import('./run-CAcScbEG.mjs').then(function (n) { return n.i; });
319
328
  let cwd = process.cwd();
320
329
  const filteredArgs = [];
321
330
  for (let i = 0; i < agentArgs.length; i++) {
@@ -339,12 +348,12 @@ async function handleAgentCommand() {
339
348
  console.log(`Starting ${config.agentName} agent in ${cwd}...`);
340
349
  let backend;
341
350
  if (KNOWN_MCP_AGENTS[config.agentName]) {
342
- const { CodexMcpBackend } = await import('./run-XoQsDcg4.mjs').then(function (n) { return n.j; });
351
+ const { CodexMcpBackend } = await import('./run-CAcScbEG.mjs').then(function (n) { return n.j; });
343
352
  backend = new CodexMcpBackend({ cwd, log: logFn });
344
353
  } else {
345
- const { AcpBackend } = await import('./run-XoQsDcg4.mjs').then(function (n) { return n.h; });
346
- const { GeminiTransport } = await import('./run-XoQsDcg4.mjs').then(function (n) { return n.G; });
347
- const { DefaultTransport } = await import('./run-XoQsDcg4.mjs').then(function (n) { return n.D; });
354
+ const { AcpBackend } = await import('./run-CAcScbEG.mjs').then(function (n) { return n.h; });
355
+ const { GeminiTransport } = await import('./run-CAcScbEG.mjs').then(function (n) { return n.G; });
356
+ const { DefaultTransport } = await import('./run-CAcScbEG.mjs').then(function (n) { return n.D; });
348
357
  const transportHandler = config.agentName === "gemini" ? new GeminiTransport() : new DefaultTransport(config.agentName);
349
358
  backend = new AcpBackend({
350
359
  agentName: config.agentName,
@@ -471,7 +480,7 @@ async function handleSessionCommand() {
471
480
  process.exit(1);
472
481
  }
473
482
  }
474
- const { sessionList, sessionSpawn, sessionStop, sessionInfo, sessionMessages, sessionAttach, sessionMachines, sessionSend, sessionWait, sessionShare, sessionRalphStart, sessionRalphCancel, sessionRalphStatus, sessionInboxSend, sessionInboxList, sessionInboxRead, sessionInboxReply, sessionInboxClear } = await import('./commands-Bb11XUfY.mjs');
483
+ const { sessionList, sessionSpawn, sessionStop, sessionInfo, sessionMessages, sessionAttach, sessionMachines, sessionSend, sessionWait, sessionShare, sessionRalphStart, sessionRalphCancel, sessionRalphStatus, sessionInboxSend, sessionInboxList, sessionInboxRead, sessionInboxReply, sessionInboxClear } = await import('./commands-DXaH6BQg.mjs');
475
484
  const parseFlagStr = (flag, shortFlag) => {
476
485
  for (let i = 1; i < sessionArgs.length; i++) {
477
486
  if ((sessionArgs[i] === flag || shortFlag) && i + 1 < sessionArgs.length) {
@@ -531,7 +540,7 @@ async function handleSessionCommand() {
531
540
  allowDomain.push(sessionArgs[++i]);
532
541
  }
533
542
  }
534
- const { parseShareArg } = await import('./commands-Bb11XUfY.mjs');
543
+ const { parseShareArg } = await import('./commands-DXaH6BQg.mjs');
535
544
  const shareEntries = share.map((s) => parseShareArg(s));
536
545
  await sessionSpawn(agent, dir, targetMachineId, {
537
546
  message,
@@ -617,7 +626,7 @@ async function handleSessionCommand() {
617
626
  console.error("Usage: svamp session approve <session-id> [request-id] [--json]");
618
627
  process.exit(1);
619
628
  }
620
- const { sessionApprove } = await import('./commands-Bb11XUfY.mjs');
629
+ const { sessionApprove } = await import('./commands-DXaH6BQg.mjs');
621
630
  const approveReqId = sessionArgs[2] && !sessionArgs[2].startsWith("--") ? sessionArgs[2] : void 0;
622
631
  await sessionApprove(sessionArgs[1], approveReqId, targetMachineId, {
623
632
  json: hasFlag("--json")
@@ -627,7 +636,7 @@ async function handleSessionCommand() {
627
636
  console.error("Usage: svamp session deny <session-id> [request-id] [--json]");
628
637
  process.exit(1);
629
638
  }
630
- const { sessionDeny } = await import('./commands-Bb11XUfY.mjs');
639
+ const { sessionDeny } = await import('./commands-DXaH6BQg.mjs');
631
640
  const denyReqId = sessionArgs[2] && !sessionArgs[2].startsWith("--") ? sessionArgs[2] : void 0;
632
641
  await sessionDeny(sessionArgs[1], denyReqId, targetMachineId, {
633
642
  json: hasFlag("--json")
@@ -663,7 +672,7 @@ async function handleSessionCommand() {
663
672
  console.error("Usage: svamp session set-title <title>");
664
673
  process.exit(1);
665
674
  }
666
- const { sessionSetTitle } = await import('./agentCommands-C69uiQZ0.mjs');
675
+ const { sessionSetTitle } = await import('./agentCommands-BBTwxjv1.mjs');
667
676
  await sessionSetTitle(title);
668
677
  } else if (sessionSubcommand === "set-link") {
669
678
  const url = sessionArgs[1];
@@ -672,7 +681,7 @@ async function handleSessionCommand() {
672
681
  process.exit(1);
673
682
  }
674
683
  const label = sessionArgs[2] && !sessionArgs[2].startsWith("--") ? sessionArgs[2] : void 0;
675
- const { sessionSetLink } = await import('./agentCommands-C69uiQZ0.mjs');
684
+ const { sessionSetLink } = await import('./agentCommands-BBTwxjv1.mjs');
676
685
  await sessionSetLink(url, label);
677
686
  } else if (sessionSubcommand === "notify") {
678
687
  const message = sessionArgs[1];
@@ -681,7 +690,7 @@ async function handleSessionCommand() {
681
690
  process.exit(1);
682
691
  }
683
692
  const level = parseFlagStr("--level") || "info";
684
- const { sessionNotify } = await import('./agentCommands-C69uiQZ0.mjs');
693
+ const { sessionNotify } = await import('./agentCommands-BBTwxjv1.mjs');
685
694
  await sessionNotify(message, level);
686
695
  } else if (sessionSubcommand === "broadcast") {
687
696
  const action = sessionArgs[1];
@@ -689,7 +698,7 @@ async function handleSessionCommand() {
689
698
  console.error("Usage: svamp session broadcast <action> [args...]\nActions: open-canvas <url> [label], close-canvas, toast <message>");
690
699
  process.exit(1);
691
700
  }
692
- const { sessionBroadcast } = await import('./agentCommands-C69uiQZ0.mjs');
701
+ const { sessionBroadcast } = await import('./agentCommands-BBTwxjv1.mjs');
693
702
  await sessionBroadcast(action, sessionArgs.slice(2).filter((a) => !a.startsWith("--")));
694
703
  } else if (sessionSubcommand === "inbox") {
695
704
  const inboxSubcmd = sessionArgs[1];
@@ -700,7 +709,7 @@ async function handleSessionCommand() {
700
709
  process.exit(1);
701
710
  }
702
711
  if (agentSessionId) {
703
- const { inboxSend } = await import('./agentCommands-C69uiQZ0.mjs');
712
+ const { inboxSend } = await import('./agentCommands-BBTwxjv1.mjs');
704
713
  await inboxSend(sessionArgs[2], {
705
714
  body: sessionArgs[3],
706
715
  subject: parseFlagStr("--subject"),
@@ -715,7 +724,7 @@ async function handleSessionCommand() {
715
724
  }
716
725
  } else if (inboxSubcmd === "list" || inboxSubcmd === "ls") {
717
726
  if (agentSessionId && !sessionArgs[2]) {
718
- const { inboxList } = await import('./agentCommands-C69uiQZ0.mjs');
727
+ const { inboxList } = await import('./agentCommands-BBTwxjv1.mjs');
719
728
  await inboxList({
720
729
  unread: hasFlag("--unread"),
721
730
  limit: parseFlagInt("--limit"),
@@ -737,7 +746,7 @@ async function handleSessionCommand() {
737
746
  process.exit(1);
738
747
  }
739
748
  if (agentSessionId && !sessionArgs[3]) {
740
- const { inboxList } = await import('./agentCommands-C69uiQZ0.mjs');
749
+ const { inboxList } = await import('./agentCommands-BBTwxjv1.mjs');
741
750
  await sessionInboxRead(agentSessionId, sessionArgs[2], targetMachineId);
742
751
  } else if (sessionArgs[3]) {
743
752
  await sessionInboxRead(sessionArgs[2], sessionArgs[3], targetMachineId);
@@ -747,7 +756,7 @@ async function handleSessionCommand() {
747
756
  }
748
757
  } else if (inboxSubcmd === "reply") {
749
758
  if (agentSessionId && sessionArgs[2] && sessionArgs[3] && !sessionArgs[4]) {
750
- const { inboxReply } = await import('./agentCommands-C69uiQZ0.mjs');
759
+ const { inboxReply } = await import('./agentCommands-BBTwxjv1.mjs');
751
760
  await inboxReply(sessionArgs[2], sessionArgs[3]);
752
761
  } else if (sessionArgs[2] && sessionArgs[3] && sessionArgs[4]) {
753
762
  await sessionInboxReply(sessionArgs[2], sessionArgs[3], sessionArgs[4], targetMachineId);
@@ -783,7 +792,7 @@ async function handleMachineCommand() {
783
792
  return;
784
793
  }
785
794
  if (machineSubcommand === "share") {
786
- const { machineShare } = await import('./commands-Bb11XUfY.mjs');
795
+ const { machineShare } = await import('./commands-DXaH6BQg.mjs');
787
796
  let machineId;
788
797
  const shareArgs = [];
789
798
  for (let i = 1; i < machineArgs.length; i++) {
@@ -813,7 +822,7 @@ async function handleMachineCommand() {
813
822
  }
814
823
  await machineShare(machineId, { add, remove, list, configPath, showConfig });
815
824
  } else if (machineSubcommand === "exec") {
816
- const { machineExec } = await import('./commands-Bb11XUfY.mjs');
825
+ const { machineExec } = await import('./commands-DXaH6BQg.mjs');
817
826
  let machineId;
818
827
  let cwd;
819
828
  const cmdParts = [];
@@ -833,7 +842,7 @@ async function handleMachineCommand() {
833
842
  }
834
843
  await machineExec(machineId, command, cwd);
835
844
  } else if (machineSubcommand === "info") {
836
- const { machineInfo } = await import('./commands-Bb11XUfY.mjs');
845
+ const { machineInfo } = await import('./commands-DXaH6BQg.mjs');
837
846
  let machineId;
838
847
  for (let i = 1; i < machineArgs.length; i++) {
839
848
  if ((machineArgs[i] === "--machine" || machineArgs[i] === "-m") && i + 1 < machineArgs.length) {
@@ -853,10 +862,10 @@ async function handleMachineCommand() {
853
862
  level = machineArgs[++i];
854
863
  }
855
864
  }
856
- const { machineNotify } = await import('./agentCommands-C69uiQZ0.mjs');
865
+ const { machineNotify } = await import('./agentCommands-BBTwxjv1.mjs');
857
866
  await machineNotify(message, level);
858
867
  } else if (machineSubcommand === "ls") {
859
- const { machineLs } = await import('./commands-Bb11XUfY.mjs');
868
+ const { machineLs } = await import('./commands-DXaH6BQg.mjs');
860
869
  let machineId;
861
870
  let showHidden = false;
862
871
  let path;
@@ -1256,6 +1265,13 @@ Commands:
1256
1265
  svamp session approve/deny <id> Approve or deny pending permission requests
1257
1266
  svamp session --help Show ALL session commands and detailed options
1258
1267
 
1268
+ File serving:
1269
+ svamp serve <name> [directory] Serve a directory via the shared file server
1270
+ svamp serve remove <name> Remove a served mount
1271
+ svamp serve list [--all] List served mounts
1272
+ svamp serve info Show server status and URL
1273
+ svamp serve --help Show all serve commands
1274
+
1259
1275
  Other:
1260
1276
  svamp machine --help Machine sharing & security contexts
1261
1277
  svamp skills --help Skills marketplace (find, install, publish)
@@ -320,7 +320,7 @@ async function serviceServe(args) {
320
320
  if (subdomain) validateSubdomain(subdomain);
321
321
  const healthInterval = healthIntervalStr ? parseInt(healthIntervalStr, 10) : void 0;
322
322
  try {
323
- const { startStaticServer } = await import('./staticServer-CWcmMF5V.mjs');
323
+ const { startStaticServer } = await import('./staticServer-_-FoZQpD.mjs');
324
324
  const resolvedDir = require("path").resolve(directory);
325
325
  console.log(`Serving ${resolvedDir}`);
326
326
  const staticServer = await startStaticServer({
@@ -1,11 +1,11 @@
1
1
  import { writeFileSync, readFileSync } from 'fs';
2
2
  import { resolve } from 'path';
3
- import { connectAndGetMachine } from './commands-Bb11XUfY.mjs';
3
+ import { connectAndGetMachine } from './commands-DXaH6BQg.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-XoQsDcg4.mjs';
8
+ import './run-CAcScbEG.mjs';
9
9
  import 'os';
10
10
  import 'fs/promises';
11
11
  import 'url';
@@ -2,7 +2,7 @@ import { existsSync, readFileSync } from 'node:fs';
2
2
  import { execSync } from 'node:child_process';
3
3
  import { resolve, join } from 'node:path';
4
4
  import os from 'node:os';
5
- import { l as loadSecurityContextConfig, e as resolveSecurityContext, f as buildSecurityContextFromFlags, m as mergeSecurityContexts, c as connectToHypha } from './run-XoQsDcg4.mjs';
5
+ import { l as loadSecurityContextConfig, e as resolveSecurityContext, f as buildSecurityContextFromFlags, m as mergeSecurityContexts, c as connectToHypha } from './run-CAcScbEG.mjs';
6
6
  import 'os';
7
7
  import 'fs/promises';
8
8
  import 'fs';
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { c as connectToHypha, d as daemonStatus, g as getHyphaServerUrl, r as registerMachineService, a as registerSessionService, s as startDaemon, b as stopDaemon } from './run-XoQsDcg4.mjs';
1
+ export { c as connectToHypha, d as daemonStatus, g as getHyphaServerUrl, r as registerMachineService, a as registerSessionService, s as startDaemon, b as stopDaemon } from './run-CAcScbEG.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.6";
2
+ var version = "0.2.8";
3
3
  var description = "Svamp CLI — AI workspace daemon on Hypha Cloud";
4
4
  var author = "Amun AI AB";
5
5
  var license = "SEE LICENSE IN LICENSE";
@@ -19,7 +19,7 @@ var exports$1 = {
19
19
  var scripts = {
20
20
  build: "rm -rf dist && tsc --noEmit && pkgroll",
21
21
  typecheck: "tsc --noEmit",
22
- test: "npx tsx test/test-authorize.mjs && npx tsx test/test-session-helpers.mjs && npx tsx test/test-cli-routing.mjs && npx tsx test/test-security-context.mjs && npx tsx test/test-ralph-loop.mjs && npx tsx test/test-message-helpers.mjs && npx tsx test/test-agent-config.mjs && npx tsx test/test-wrap-command.mjs && npx tsx test/test-credential-staging.mjs && npx tsx test/test-output-formatters.mjs && npx tsx test/test-agent-types.mjs && npx tsx test/test-transport.mjs && npx tsx test/test-session-update-handlers.mjs && npx tsx test/test-session-scanner.mjs && npx tsx test/test-hypha-client.mjs && npx tsx test/test-hook-settings.mjs && npx tsx test/test-session-service-logic.mjs && npx tsx test/test-daemon-persistence.mjs && npx tsx test/test-detect-isolation.mjs && npx tsx test/test-machine-service-logic.mjs && npx tsx test/test-interactive-helpers.mjs && npx tsx test/test-codex-backend.mjs && npx tsx test/test-acp-backend.mjs && npx tsx test/test-acp-bridge.mjs && npx tsx test/test-hook-server.mjs && npx tsx test/test-session-commands.mjs && npx tsx test/test-interactive-console.mjs && npx tsx test/test-session-messages.mjs && npx tsx test/test-skills.mjs && npx tsx test/test-agent-grouping.mjs && npx tsx test/test-ralph-loop-integration.mjs && npx tsx test/test-ralph-loop-modes.mjs && npx tsx test/test-machine-list-directory.mjs && npx tsx test/test-service-commands.mjs && npx tsx test/test-supervisor.mjs && npx tsx test/test-clear-detection.mjs && npx tsx test/test-session-consolidation.mjs && npx tsx test/test-inbox.mjs && npx tsx test/test-session-rpc-dispatch.mjs && npx tsx test/test-sandbox-cli.mjs",
22
+ test: "npx tsx test/test-authorize.mjs && npx tsx test/test-session-helpers.mjs && npx tsx test/test-cli-routing.mjs && npx tsx test/test-security-context.mjs && npx tsx test/test-ralph-loop.mjs && npx tsx test/test-message-helpers.mjs && npx tsx test/test-agent-config.mjs && npx tsx test/test-wrap-command.mjs && npx tsx test/test-credential-staging.mjs && npx tsx test/test-output-formatters.mjs && npx tsx test/test-agent-types.mjs && npx tsx test/test-transport.mjs && npx tsx test/test-session-update-handlers.mjs && npx tsx test/test-session-scanner.mjs && npx tsx test/test-hypha-client.mjs && npx tsx test/test-hook-settings.mjs && npx tsx test/test-session-service-logic.mjs && npx tsx test/test-daemon-persistence.mjs && npx tsx test/test-detect-isolation.mjs && npx tsx test/test-machine-service-logic.mjs && npx tsx test/test-interactive-helpers.mjs && npx tsx test/test-codex-backend.mjs && npx tsx test/test-acp-backend.mjs && npx tsx test/test-acp-bridge.mjs && npx tsx test/test-hook-server.mjs && npx tsx test/test-session-commands.mjs && npx tsx test/test-interactive-console.mjs && npx tsx test/test-session-messages.mjs && npx tsx test/test-skills.mjs && npx tsx test/test-agent-grouping.mjs && npx tsx test/test-ralph-loop-integration.mjs && npx tsx test/test-ralph-loop-modes.mjs && npx tsx test/test-machine-list-directory.mjs && npx tsx test/test-service-commands.mjs && npx tsx test/test-supervisor.mjs && npx tsx test/test-clear-detection.mjs && npx tsx test/test-session-consolidation.mjs && npx tsx test/test-inbox.mjs && npx tsx test/test-session-rpc-dispatch.mjs && npx tsx test/test-sandbox-cli.mjs && npx tsx test/test-serve-manager.mjs",
23
23
  "test:hypha": "node --no-warnings test/test-hypha-service.mjs",
24
24
  dev: "tsx src/cli.ts",
25
25
  "dev:daemon": "tsx src/cli.ts daemon start-sync",
@@ -2,7 +2,7 @@ import{createRequire as _pkgrollCR}from"node:module";const require=_pkgrollCR(im
2
2
  import os from 'node:os';
3
3
  import { join, resolve } from 'node:path';
4
4
  import { mkdirSync, writeFileSync, existsSync, unlinkSync, readFileSync, watch } from 'node:fs';
5
- import { c as connectToHypha, a as registerSessionService } from './run-XoQsDcg4.mjs';
5
+ import { c as connectToHypha, a as registerSessionService } from './run-CAcScbEG.mjs';
6
6
  import { createServer } from 'node:http';
7
7
  import { spawn } from 'node:child_process';
8
8
  import { createInterface } from 'node:readline';
@@ -315,6 +315,14 @@ async function getPtyModule() {
315
315
  function generateTerminalId() {
316
316
  return `term-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
317
317
  }
318
+ function filterTerminalResponses(data) {
319
+ if (!data || data.length === 0) return data;
320
+ if (data.indexOf("\x1B") === -1) return data;
321
+ let filtered = data.replace(/\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/g, "");
322
+ filtered = filtered.replace(/\x1b\[\d+;\d+R/g, "");
323
+ filtered = filtered.replace(/\x1b\[\?\d+(?:;\d+)*c/g, "");
324
+ return filtered;
325
+ }
318
326
  function getMachineMetadataPath(svampHomeDir) {
319
327
  return join(svampHomeDir, "machine-metadata.json");
320
328
  }
@@ -858,7 +866,8 @@ async function registerMachineService(server, machineId, metadata, daemonState,
858
866
  authorizeRequest(context, currentMetadata.sharing, "admin");
859
867
  const session = terminalSessions.get(params.sessionId);
860
868
  if (!session) throw new Error(`Terminal session ${params.sessionId} not found`);
861
- session.pty.write(params.data);
869
+ const filtered = filterTerminalResponses(params.data);
870
+ if (filtered) session.pty.write(filtered);
862
871
  return { success: true };
863
872
  },
864
873
  /** Resize a terminal session. */
@@ -1101,6 +1110,41 @@ async function registerMachineService(server, machineId, metadata, daemonState,
1101
1110
  ...client.status
1102
1111
  }));
1103
1112
  },
1113
+ // ── Shared static file server ────────────────────────────────────
1114
+ /** Add a mount to the shared static file server. */
1115
+ serveAdd: async (params, context) => {
1116
+ authorizeRequest(context, currentMetadata.sharing, "interact");
1117
+ const sm = handlers.serveManager;
1118
+ if (!sm) throw new Error("Serve manager not available");
1119
+ const ownerEmail = params.ownerEmail || context?.user?.email || void 0;
1120
+ const access = params.access || "owner";
1121
+ return sm.addMount(params.name, params.directory, params.sessionId, access, ownerEmail);
1122
+ },
1123
+ /** Remove a mount from the shared static file server. */
1124
+ serveRemove: async (params, context) => {
1125
+ authorizeRequest(context, currentMetadata.sharing, "interact");
1126
+ const sm = handlers.serveManager;
1127
+ if (!sm) throw new Error("Serve manager not available");
1128
+ await sm.removeMount(params.name);
1129
+ return { removed: true };
1130
+ },
1131
+ /** List mounts. Optionally filter by sessionId or return all. */
1132
+ serveList: async (params, context) => {
1133
+ authorizeRequest(context, currentMetadata.sharing, "view");
1134
+ const sm = handlers.serveManager;
1135
+ if (!sm) throw new Error("Serve manager not available");
1136
+ if (params.all) {
1137
+ return sm.listMounts();
1138
+ }
1139
+ return sm.listMounts(params.sessionId);
1140
+ },
1141
+ /** Get shared static file server info. */
1142
+ serveInfo: async (context) => {
1143
+ authorizeRequest(context, currentMetadata.sharing, "view");
1144
+ const sm = handlers.serveManager;
1145
+ if (!sm) throw new Error("Serve manager not available");
1146
+ return sm.getInfo();
1147
+ },
1104
1148
  // WISE voice — create ephemeral token for OpenAI Realtime API
1105
1149
  wiseCreateEphemeralToken: async (params, context) => {
1106
1150
  authorizeRequest(context, currentMetadata.sharing, "interact");
@@ -1213,6 +1257,25 @@ function loadMessages(messagesDir, sessionId) {
1213
1257
  return [];
1214
1258
  }
1215
1259
  }
1260
+ function loadMessagesFromDisk(messagesDir, afterSeq, limit) {
1261
+ const filePath = join$1(messagesDir, "messages.jsonl");
1262
+ if (!existsSync(filePath)) return { messages: [], hasMore: false };
1263
+ try {
1264
+ const lines = readFileSync(filePath, "utf-8").split("\n").filter((l) => l.trim());
1265
+ const filtered = [];
1266
+ for (const line of lines) {
1267
+ try {
1268
+ const msg = JSON.parse(line);
1269
+ if (msg.seq > afterSeq) filtered.push(msg);
1270
+ } catch {
1271
+ }
1272
+ }
1273
+ const page = filtered.slice(0, limit);
1274
+ return { messages: page, hasMore: filtered.length > limit };
1275
+ } catch {
1276
+ return { messages: [], hasMore: false };
1277
+ }
1278
+ }
1216
1279
  function appendMessage(messagesDir, sessionId, msg) {
1217
1280
  try {
1218
1281
  const filePath = join$1(messagesDir, "messages.jsonl");
@@ -1336,6 +1399,10 @@ function createSessionStore(server, sessionId, initialMetadata, initialAgentStat
1336
1399
  authorizeRequest(context, metadata.sharing, "view");
1337
1400
  const after = afterSeq ?? 0;
1338
1401
  const lim = Math.min(limit ?? 100, 500);
1402
+ const minInMemorySeq = messages.length > 0 ? messages[0].seq : Infinity;
1403
+ if (after < minInMemorySeq && options?.messagesDir) {
1404
+ return loadMessagesFromDisk(options.messagesDir, after, lim);
1405
+ }
1339
1406
  const filtered = messages.filter((m) => m.seq > after);
1340
1407
  const page = filtered.slice(0, lim);
1341
1408
  return {
@@ -5901,6 +5968,8 @@ async function startDaemon(options) {
5901
5968
  const supervisor = new ProcessSupervisor(join(SVAMP_HOME, "processes"));
5902
5969
  await supervisor.init();
5903
5970
  const tunnels = /* @__PURE__ */ new Map();
5971
+ const { ServeManager } = await import('./serveManager-BPyT20Q8.mjs');
5972
+ const serveManager = new ServeManager(SVAMP_HOME, (msg) => logger.log(`[SERVE] ${msg}`), hyphaServerUrl);
5904
5973
  ensureAutoInstalledSkills(logger).catch(() => {
5905
5974
  });
5906
5975
  preventMachineSleep(logger);
@@ -6099,6 +6168,7 @@ async function startDaemon(options) {
6099
6168
  const persisted = allPersisted.find((p) => p.sessionId === sessionId) || (resumeSessionId ? allPersisted.find((p) => p.claudeResumeId === resumeSessionId) : void 0);
6100
6169
  let claudeResumeId = persisted?.claudeResumeId || (resumeSessionId || void 0);
6101
6170
  let currentPermissionMode = options2.permissionMode || persisted?.permissionMode || "default";
6171
+ const sessionCreatedAt = persisted?.createdAt || Date.now();
6102
6172
  let lastSpawnMeta = persisted?.spawnMeta || {};
6103
6173
  let sessionWasProcessing = !!options2.wasProcessing;
6104
6174
  let lastAssistantText = "";
@@ -6405,7 +6475,7 @@ async function startDaemon(options) {
6405
6475
  permissionMode: currentPermissionMode,
6406
6476
  spawnMeta: lastSpawnMeta,
6407
6477
  metadata: sessionMetadata,
6408
- createdAt: Date.now(),
6478
+ createdAt: sessionCreatedAt,
6409
6479
  machineId,
6410
6480
  wasProcessing: false
6411
6481
  });
@@ -6436,7 +6506,7 @@ async function startDaemon(options) {
6436
6506
  permissionMode: currentPermissionMode,
6437
6507
  spawnMeta: lastSpawnMeta,
6438
6508
  metadata: sessionMetadata,
6439
- createdAt: Date.now(),
6509
+ createdAt: sessionCreatedAt,
6440
6510
  machineId,
6441
6511
  wasProcessing: false
6442
6512
  });
@@ -6665,7 +6735,7 @@ The automated loop has finished. Review the progress above and let me know if yo
6665
6735
  permissionMode: currentPermissionMode,
6666
6736
  spawnMeta: lastSpawnMeta,
6667
6737
  metadata: sessionMetadata,
6668
- createdAt: Date.now(),
6738
+ createdAt: sessionCreatedAt,
6669
6739
  machineId,
6670
6740
  wasProcessing: sessionWasProcessing
6671
6741
  });
@@ -6774,7 +6844,7 @@ The automated loop has finished. Review the progress above and let me know if yo
6774
6844
  permissionMode: currentPermissionMode,
6775
6845
  spawnMeta: lastSpawnMeta,
6776
6846
  metadata: sessionMetadata,
6777
- createdAt: Date.now(),
6847
+ createdAt: sessionCreatedAt,
6778
6848
  machineId,
6779
6849
  wasProcessing: false
6780
6850
  });
@@ -6996,7 +7066,7 @@ The automated loop has finished. Review the progress above and let me know if yo
6996
7066
  permissionMode: currentPermissionMode,
6997
7067
  spawnMeta: lastSpawnMeta,
6998
7068
  metadata: sessionMetadata,
6999
- createdAt: Date.now(),
7069
+ createdAt: sessionCreatedAt,
7000
7070
  machineId,
7001
7071
  wasProcessing: sessionWasProcessing
7002
7072
  });
@@ -7067,7 +7137,7 @@ The automated loop has finished. Review the progress above and let me know if yo
7067
7137
  permissionMode: currentPermissionMode,
7068
7138
  spawnMeta: lastSpawnMeta,
7069
7139
  metadata: sessionMetadata,
7070
- createdAt: Date.now(),
7140
+ createdAt: sessionCreatedAt,
7071
7141
  machineId,
7072
7142
  wasProcessing: sessionWasProcessing
7073
7143
  });
@@ -8010,7 +8080,7 @@ The automated loop has finished. Review the progress above and let me know if yo
8010
8080
  getTrackedSessions: getCurrentChildren,
8011
8081
  getSessionRPCHandlers: (sessionId) => {
8012
8082
  for (const [, session] of pidToTrackedSession) {
8013
- if (session.svampSessionId === sessionId && session.sessionRPCHandlers) {
8083
+ if (session.svampSessionId === sessionId && !session.stopped && session.sessionRPCHandlers) {
8014
8084
  return session.sessionRPCHandlers;
8015
8085
  }
8016
8086
  }
@@ -8026,7 +8096,8 @@ The automated loop has finished. Review the progress above and let me know if yo
8026
8096
  return ids;
8027
8097
  },
8028
8098
  supervisor,
8029
- tunnels
8099
+ tunnels,
8100
+ serveManager
8030
8101
  }
8031
8102
  );
8032
8103
  logger.log(`Machine service registered: svamp-machine-${machineId}`);
@@ -8048,6 +8119,7 @@ The automated loop has finished. Review the progress above and let me know if yo
8048
8119
  // Legacy; debug service uses session index now
8049
8120
  });
8050
8121
  logger.log(`Debug service registered: svamp-debug-${machineId}`);
8122
+ await serveManager.restore();
8051
8123
  const persistedSessions = loadPersistedSessions();
8052
8124
  const sessionsToAutoContinue = [];
8053
8125
  const sessionsToRalphResume = [];
@@ -8388,6 +8460,8 @@ The automated loop has finished. Review the progress above and let me know if yo
8388
8460
  }
8389
8461
  await supervisor.stopAll().catch(() => {
8390
8462
  });
8463
+ await serveManager.shutdown().catch(() => {
8464
+ });
8391
8465
  for (const [name, client] of tunnels) {
8392
8466
  client.destroy();
8393
8467
  logger.log(`Tunnel '${name}' destroyed`);