svamp-cli 0.2.67 → 0.2.68
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.
- package/dist/{agentCommands-CVmNxFdC.mjs → agentCommands-QnPGJFY-.mjs} +2 -2
- package/dist/cli.mjs +39 -56
- package/dist/{commands-B6yUtg85.mjs → commands-Cxb6tsha.mjs} +3 -3
- package/dist/{commands-BO8gl_-u.mjs → commands-D5kCHCfX.mjs} +12 -39
- package/dist/{commands-D7A1aWC1.mjs → commands-tUjBdy54.mjs} +2 -2
- package/dist/index.mjs +1 -1
- package/dist/{package-wAsRM-Wx.mjs → package-DhOTD1Ln.mjs} +1 -2
- package/dist/{run-B4a6wAxf.mjs → run-BvcwFt_g.mjs} +3 -3
- package/dist/{run-DZq12r28.mjs → run-HuBXfVSz.mjs} +65 -143
- package/dist/{serveCommands-B-Ij7oce.mjs → serveCommands-DDlHXpPe.mjs} +5 -5
- package/dist/{serveManager-D4f3wiSO.mjs → serveManager-DWQtF8NK.mjs} +1 -1
- package/package.json +1 -2
|
@@ -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-
|
|
151
|
+
const { connectAndGetMachine } = await import('./commands-D5kCHCfX.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-
|
|
168
|
+
const { resolveSessionId } = await import('./commands-D5kCHCfX.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 { s as startDaemon, b as stopDaemon, d as daemonStatus } from './run-
|
|
1
|
+
import { s as startDaemon, b as stopDaemon, d as daemonStatus } from './run-HuBXfVSz.mjs';
|
|
2
2
|
import 'os';
|
|
3
3
|
import 'fs/promises';
|
|
4
4
|
import 'fs';
|
|
@@ -44,7 +44,7 @@ async function main() {
|
|
|
44
44
|
console.error(`svamp daemon restart: ${err.message || err}`);
|
|
45
45
|
process.exit(1);
|
|
46
46
|
}
|
|
47
|
-
const { restartDaemon } = await import('./run-
|
|
47
|
+
const { restartDaemon } = await import('./run-HuBXfVSz.mjs').then(function (n) { return n.u; });
|
|
48
48
|
await restartDaemon();
|
|
49
49
|
process.exit(0);
|
|
50
50
|
}
|
|
@@ -280,7 +280,7 @@ async function main() {
|
|
|
280
280
|
console.error("svamp service: Service commands are not available in sandboxed sessions.");
|
|
281
281
|
process.exit(1);
|
|
282
282
|
}
|
|
283
|
-
const { handleServiceCommand } = await import('./commands-
|
|
283
|
+
const { handleServiceCommand } = await import('./commands-Cxb6tsha.mjs');
|
|
284
284
|
await handleServiceCommand();
|
|
285
285
|
} else if (subcommand === "serve") {
|
|
286
286
|
const { isSandboxed: isSandboxedServe } = await import('./sandboxDetect-DNTcbgWD.mjs');
|
|
@@ -288,7 +288,7 @@ async function main() {
|
|
|
288
288
|
console.error("svamp serve: Serve commands are not available in sandboxed sessions.");
|
|
289
289
|
process.exit(1);
|
|
290
290
|
}
|
|
291
|
-
const { handleServeCommand } = await import('./serveCommands-
|
|
291
|
+
const { handleServeCommand } = await import('./serveCommands-DDlHXpPe.mjs');
|
|
292
292
|
await handleServeCommand();
|
|
293
293
|
process.exit(0);
|
|
294
294
|
} else if (subcommand === "process" || subcommand === "proc") {
|
|
@@ -297,7 +297,7 @@ async function main() {
|
|
|
297
297
|
console.error("svamp process: Process commands are not available in sandboxed sessions.");
|
|
298
298
|
process.exit(1);
|
|
299
299
|
}
|
|
300
|
-
const { processCommand } = await import('./commands-
|
|
300
|
+
const { processCommand } = await import('./commands-tUjBdy54.mjs');
|
|
301
301
|
let machineId;
|
|
302
302
|
const processArgs = args.slice(1);
|
|
303
303
|
const mIdx = processArgs.findIndex((a) => a === "--machine" || a === "-m");
|
|
@@ -315,7 +315,7 @@ async function main() {
|
|
|
315
315
|
} else if (!subcommand || subcommand === "start") {
|
|
316
316
|
await handleInteractiveCommand();
|
|
317
317
|
} else if (subcommand === "--version" || subcommand === "-v") {
|
|
318
|
-
const pkg = await import('./package-
|
|
318
|
+
const pkg = await import('./package-DhOTD1Ln.mjs').catch(() => ({ default: { version: "unknown" } }));
|
|
319
319
|
console.log(`svamp version: ${pkg.default.version}`);
|
|
320
320
|
} else {
|
|
321
321
|
console.error(`Unknown command: ${subcommand}`);
|
|
@@ -324,7 +324,7 @@ async function main() {
|
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
326
|
async function handleInteractiveCommand() {
|
|
327
|
-
const { runInteractive } = await import('./run-
|
|
327
|
+
const { runInteractive } = await import('./run-BvcwFt_g.mjs');
|
|
328
328
|
const interactiveArgs = subcommand === "start" ? args.slice(1) : args;
|
|
329
329
|
let directory = process.cwd();
|
|
330
330
|
let resumeSessionId;
|
|
@@ -369,7 +369,7 @@ async function handleAgentCommand() {
|
|
|
369
369
|
return;
|
|
370
370
|
}
|
|
371
371
|
if (agentArgs[0] === "list") {
|
|
372
|
-
const { KNOWN_ACP_AGENTS, KNOWN_MCP_AGENTS: KNOWN_MCP_AGENTS2 } = await import('./run-
|
|
372
|
+
const { KNOWN_ACP_AGENTS, KNOWN_MCP_AGENTS: KNOWN_MCP_AGENTS2 } = await import('./run-HuBXfVSz.mjs').then(function (n) { return n.p; });
|
|
373
373
|
console.log("Known agents:");
|
|
374
374
|
for (const [name, config2] of Object.entries(KNOWN_ACP_AGENTS)) {
|
|
375
375
|
console.log(` ${name.padEnd(12)} ${config2.command} ${config2.args.join(" ")} (ACP)`);
|
|
@@ -381,7 +381,7 @@ async function handleAgentCommand() {
|
|
|
381
381
|
console.log('Use "svamp agent -- <command> [args]" for a custom ACP agent.');
|
|
382
382
|
return;
|
|
383
383
|
}
|
|
384
|
-
const { resolveAcpAgentConfig, KNOWN_MCP_AGENTS } = await import('./run-
|
|
384
|
+
const { resolveAcpAgentConfig, KNOWN_MCP_AGENTS } = await import('./run-HuBXfVSz.mjs').then(function (n) { return n.p; });
|
|
385
385
|
let cwd = process.cwd();
|
|
386
386
|
const filteredArgs = [];
|
|
387
387
|
for (let i = 0; i < agentArgs.length; i++) {
|
|
@@ -405,12 +405,12 @@ async function handleAgentCommand() {
|
|
|
405
405
|
console.log(`Starting ${config.agentName} agent in ${cwd}...`);
|
|
406
406
|
let backend;
|
|
407
407
|
if (KNOWN_MCP_AGENTS[config.agentName]) {
|
|
408
|
-
const { CodexMcpBackend } = await import('./run-
|
|
408
|
+
const { CodexMcpBackend } = await import('./run-HuBXfVSz.mjs').then(function (n) { return n.q; });
|
|
409
409
|
backend = new CodexMcpBackend({ cwd, log: logFn });
|
|
410
410
|
} else {
|
|
411
|
-
const { AcpBackend } = await import('./run-
|
|
412
|
-
const { GeminiTransport } = await import('./run-
|
|
413
|
-
const { DefaultTransport } = await import('./run-
|
|
411
|
+
const { AcpBackend } = await import('./run-HuBXfVSz.mjs').then(function (n) { return n.o; });
|
|
412
|
+
const { GeminiTransport } = await import('./run-HuBXfVSz.mjs').then(function (n) { return n.G; });
|
|
413
|
+
const { DefaultTransport } = await import('./run-HuBXfVSz.mjs').then(function (n) { return n.D; });
|
|
414
414
|
const transportHandler = config.agentName === "gemini" ? new GeminiTransport() : new DefaultTransport(config.agentName);
|
|
415
415
|
backend = new AcpBackend({
|
|
416
416
|
agentName: config.agentName,
|
|
@@ -537,7 +537,7 @@ async function handleSessionCommand() {
|
|
|
537
537
|
process.exit(1);
|
|
538
538
|
}
|
|
539
539
|
}
|
|
540
|
-
const { sessionList, sessionSpawn,
|
|
540
|
+
const { sessionList, sessionSpawn, sessionStop, sessionInfo, sessionMessages, sessionAttach, sessionMachines, sessionSend, sessionWait, sessionShare, sessionRalphStart, sessionRalphCancel, sessionRalphStatus, sessionInboxSend, sessionInboxList, sessionInboxRead, sessionInboxReply, sessionInboxClear } = await import('./commands-D5kCHCfX.mjs');
|
|
541
541
|
const parseFlagStr = (flag, shortFlag) => {
|
|
542
542
|
for (let i = 1; i < sessionArgs.length; i++) {
|
|
543
543
|
if ((sessionArgs[i] === flag || shortFlag) && i + 1 < sessionArgs.length) {
|
|
@@ -597,7 +597,7 @@ async function handleSessionCommand() {
|
|
|
597
597
|
allowDomain.push(sessionArgs[++i]);
|
|
598
598
|
}
|
|
599
599
|
}
|
|
600
|
-
const { parseShareArg } = await import('./commands-
|
|
600
|
+
const { parseShareArg } = await import('./commands-D5kCHCfX.mjs');
|
|
601
601
|
const shareEntries = share.map((s) => parseShareArg(s));
|
|
602
602
|
await sessionSpawn(agent, dir, targetMachineId, {
|
|
603
603
|
message,
|
|
@@ -614,24 +614,12 @@ async function handleSessionCommand() {
|
|
|
614
614
|
tags: tags.length > 0 ? tags : void 0,
|
|
615
615
|
parentSessionId
|
|
616
616
|
});
|
|
617
|
-
} else if (sessionSubcommand === "
|
|
617
|
+
} else if (sessionSubcommand === "stop") {
|
|
618
618
|
if (!sessionArgs[1]) {
|
|
619
|
-
console.error("Usage: svamp session
|
|
619
|
+
console.error("Usage: svamp session stop <session-id>");
|
|
620
620
|
process.exit(1);
|
|
621
621
|
}
|
|
622
|
-
await
|
|
623
|
-
} else if (sessionSubcommand === "resume") {
|
|
624
|
-
if (!sessionArgs[1]) {
|
|
625
|
-
console.error("Usage: svamp session resume <session-id>");
|
|
626
|
-
process.exit(1);
|
|
627
|
-
}
|
|
628
|
-
await sessionResume(sessionArgs[1], targetMachineId);
|
|
629
|
-
} else if (sessionSubcommand === "delete" || sessionSubcommand === "rm") {
|
|
630
|
-
if (!sessionArgs[1]) {
|
|
631
|
-
console.error("Usage: svamp session delete <session-id>");
|
|
632
|
-
process.exit(1);
|
|
633
|
-
}
|
|
634
|
-
await sessionDelete(sessionArgs[1], targetMachineId);
|
|
622
|
+
await sessionStop(sessionArgs[1], targetMachineId);
|
|
635
623
|
} else if (sessionSubcommand === "info") {
|
|
636
624
|
if (!sessionArgs[1]) {
|
|
637
625
|
console.error("Usage: svamp session info <session-id>");
|
|
@@ -695,7 +683,7 @@ async function handleSessionCommand() {
|
|
|
695
683
|
console.error("Usage: svamp session approve <session-id> [request-id] [--json]");
|
|
696
684
|
process.exit(1);
|
|
697
685
|
}
|
|
698
|
-
const { sessionApprove } = await import('./commands-
|
|
686
|
+
const { sessionApprove } = await import('./commands-D5kCHCfX.mjs');
|
|
699
687
|
const approveReqId = sessionArgs[2] && !sessionArgs[2].startsWith("--") ? sessionArgs[2] : void 0;
|
|
700
688
|
await sessionApprove(sessionArgs[1], approveReqId, targetMachineId, {
|
|
701
689
|
json: hasFlag("--json")
|
|
@@ -705,7 +693,7 @@ async function handleSessionCommand() {
|
|
|
705
693
|
console.error("Usage: svamp session deny <session-id> [request-id] [--json]");
|
|
706
694
|
process.exit(1);
|
|
707
695
|
}
|
|
708
|
-
const { sessionDeny } = await import('./commands-
|
|
696
|
+
const { sessionDeny } = await import('./commands-D5kCHCfX.mjs');
|
|
709
697
|
const denyReqId = sessionArgs[2] && !sessionArgs[2].startsWith("--") ? sessionArgs[2] : void 0;
|
|
710
698
|
await sessionDeny(sessionArgs[1], denyReqId, targetMachineId, {
|
|
711
699
|
json: hasFlag("--json")
|
|
@@ -741,7 +729,7 @@ async function handleSessionCommand() {
|
|
|
741
729
|
console.error("Usage: svamp session set-title <title>");
|
|
742
730
|
process.exit(1);
|
|
743
731
|
}
|
|
744
|
-
const { sessionSetTitle } = await import('./agentCommands-
|
|
732
|
+
const { sessionSetTitle } = await import('./agentCommands-QnPGJFY-.mjs');
|
|
745
733
|
await sessionSetTitle(title);
|
|
746
734
|
} else if (sessionSubcommand === "set-link") {
|
|
747
735
|
const url = sessionArgs[1];
|
|
@@ -750,7 +738,7 @@ async function handleSessionCommand() {
|
|
|
750
738
|
process.exit(1);
|
|
751
739
|
}
|
|
752
740
|
const label = sessionArgs[2] && !sessionArgs[2].startsWith("--") ? sessionArgs[2] : void 0;
|
|
753
|
-
const { sessionSetLink } = await import('./agentCommands-
|
|
741
|
+
const { sessionSetLink } = await import('./agentCommands-QnPGJFY-.mjs');
|
|
754
742
|
await sessionSetLink(url, label);
|
|
755
743
|
} else if (sessionSubcommand === "notify") {
|
|
756
744
|
const message = sessionArgs[1];
|
|
@@ -759,7 +747,7 @@ async function handleSessionCommand() {
|
|
|
759
747
|
process.exit(1);
|
|
760
748
|
}
|
|
761
749
|
const level = parseFlagStr("--level") || "info";
|
|
762
|
-
const { sessionNotify } = await import('./agentCommands-
|
|
750
|
+
const { sessionNotify } = await import('./agentCommands-QnPGJFY-.mjs');
|
|
763
751
|
await sessionNotify(message, level);
|
|
764
752
|
} else if (sessionSubcommand === "broadcast") {
|
|
765
753
|
const action = sessionArgs[1];
|
|
@@ -767,7 +755,7 @@ async function handleSessionCommand() {
|
|
|
767
755
|
console.error("Usage: svamp session broadcast <action> [args...]\nActions: open-canvas <url> [label], close-canvas, toast <message>");
|
|
768
756
|
process.exit(1);
|
|
769
757
|
}
|
|
770
|
-
const { sessionBroadcast } = await import('./agentCommands-
|
|
758
|
+
const { sessionBroadcast } = await import('./agentCommands-QnPGJFY-.mjs');
|
|
771
759
|
await sessionBroadcast(action, sessionArgs.slice(2).filter((a) => !a.startsWith("--")));
|
|
772
760
|
} else if (sessionSubcommand === "inbox") {
|
|
773
761
|
const inboxSubcmd = sessionArgs[1];
|
|
@@ -778,7 +766,7 @@ async function handleSessionCommand() {
|
|
|
778
766
|
process.exit(1);
|
|
779
767
|
}
|
|
780
768
|
if (agentSessionId) {
|
|
781
|
-
const { inboxSend } = await import('./agentCommands-
|
|
769
|
+
const { inboxSend } = await import('./agentCommands-QnPGJFY-.mjs');
|
|
782
770
|
await inboxSend(sessionArgs[2], {
|
|
783
771
|
body: sessionArgs[3],
|
|
784
772
|
subject: parseFlagStr("--subject"),
|
|
@@ -793,7 +781,7 @@ async function handleSessionCommand() {
|
|
|
793
781
|
}
|
|
794
782
|
} else if (inboxSubcmd === "list" || inboxSubcmd === "ls") {
|
|
795
783
|
if (agentSessionId && !sessionArgs[2]) {
|
|
796
|
-
const { inboxList } = await import('./agentCommands-
|
|
784
|
+
const { inboxList } = await import('./agentCommands-QnPGJFY-.mjs');
|
|
797
785
|
await inboxList({
|
|
798
786
|
unread: hasFlag("--unread"),
|
|
799
787
|
limit: parseFlagInt("--limit"),
|
|
@@ -815,7 +803,7 @@ async function handleSessionCommand() {
|
|
|
815
803
|
process.exit(1);
|
|
816
804
|
}
|
|
817
805
|
if (agentSessionId && !sessionArgs[3]) {
|
|
818
|
-
const { inboxList } = await import('./agentCommands-
|
|
806
|
+
const { inboxList } = await import('./agentCommands-QnPGJFY-.mjs');
|
|
819
807
|
await sessionInboxRead(agentSessionId, sessionArgs[2], targetMachineId);
|
|
820
808
|
} else if (sessionArgs[3]) {
|
|
821
809
|
await sessionInboxRead(sessionArgs[2], sessionArgs[3], targetMachineId);
|
|
@@ -825,7 +813,7 @@ async function handleSessionCommand() {
|
|
|
825
813
|
}
|
|
826
814
|
} else if (inboxSubcmd === "reply") {
|
|
827
815
|
if (agentSessionId && sessionArgs[2] && sessionArgs[3] && !sessionArgs[4]) {
|
|
828
|
-
const { inboxReply } = await import('./agentCommands-
|
|
816
|
+
const { inboxReply } = await import('./agentCommands-QnPGJFY-.mjs');
|
|
829
817
|
await inboxReply(sessionArgs[2], sessionArgs[3]);
|
|
830
818
|
} else if (sessionArgs[2] && sessionArgs[3] && sessionArgs[4]) {
|
|
831
819
|
await sessionInboxReply(sessionArgs[2], sessionArgs[3], sessionArgs[4], targetMachineId);
|
|
@@ -861,7 +849,7 @@ async function handleMachineCommand() {
|
|
|
861
849
|
return;
|
|
862
850
|
}
|
|
863
851
|
if (machineSubcommand === "share") {
|
|
864
|
-
const { machineShare } = await import('./commands-
|
|
852
|
+
const { machineShare } = await import('./commands-D5kCHCfX.mjs');
|
|
865
853
|
let machineId;
|
|
866
854
|
const shareArgs = [];
|
|
867
855
|
for (let i = 1; i < machineArgs.length; i++) {
|
|
@@ -891,7 +879,7 @@ async function handleMachineCommand() {
|
|
|
891
879
|
}
|
|
892
880
|
await machineShare(machineId, { add, remove, list, configPath, showConfig });
|
|
893
881
|
} else if (machineSubcommand === "exec") {
|
|
894
|
-
const { machineExec } = await import('./commands-
|
|
882
|
+
const { machineExec } = await import('./commands-D5kCHCfX.mjs');
|
|
895
883
|
let machineId;
|
|
896
884
|
let cwd;
|
|
897
885
|
const cmdParts = [];
|
|
@@ -911,7 +899,7 @@ async function handleMachineCommand() {
|
|
|
911
899
|
}
|
|
912
900
|
await machineExec(machineId, command, cwd);
|
|
913
901
|
} else if (machineSubcommand === "info") {
|
|
914
|
-
const { machineInfo } = await import('./commands-
|
|
902
|
+
const { machineInfo } = await import('./commands-D5kCHCfX.mjs');
|
|
915
903
|
let machineId;
|
|
916
904
|
for (let i = 1; i < machineArgs.length; i++) {
|
|
917
905
|
if ((machineArgs[i] === "--machine" || machineArgs[i] === "-m") && i + 1 < machineArgs.length) {
|
|
@@ -931,10 +919,10 @@ async function handleMachineCommand() {
|
|
|
931
919
|
level = machineArgs[++i];
|
|
932
920
|
}
|
|
933
921
|
}
|
|
934
|
-
const { machineNotify } = await import('./agentCommands-
|
|
922
|
+
const { machineNotify } = await import('./agentCommands-QnPGJFY-.mjs');
|
|
935
923
|
await machineNotify(message, level);
|
|
936
924
|
} else if (machineSubcommand === "ls") {
|
|
937
|
-
const { machineLs } = await import('./commands-
|
|
925
|
+
const { machineLs } = await import('./commands-D5kCHCfX.mjs');
|
|
938
926
|
let machineId;
|
|
939
927
|
let showHidden = false;
|
|
940
928
|
let path;
|
|
@@ -1329,9 +1317,7 @@ Commands:
|
|
|
1329
1317
|
svamp session messages <id> Show message history (--last N, --json, --raw)
|
|
1330
1318
|
svamp session info <id> Show session status & pending permissions
|
|
1331
1319
|
svamp session list List sessions
|
|
1332
|
-
svamp session
|
|
1333
|
-
svamp session resume <id> Resume an archived session
|
|
1334
|
-
svamp session delete <id> Permanently delete a session (cannot be undone)
|
|
1320
|
+
svamp session stop <id> Stop a session
|
|
1335
1321
|
svamp session attach <id> Attach interactive terminal (stdin/stdout)
|
|
1336
1322
|
svamp session approve/deny <id> Approve or deny pending permission requests
|
|
1337
1323
|
svamp session --help Show ALL session commands and detailed options
|
|
@@ -1403,7 +1389,7 @@ async function applyClaudeAuthFlags(argv) {
|
|
|
1403
1389
|
"--use-hypha-proxy, --use-claude-login, and --anthropic-base-url/--anthropic-api-key are mutually exclusive"
|
|
1404
1390
|
);
|
|
1405
1391
|
}
|
|
1406
|
-
const mod = await import('./run-
|
|
1392
|
+
const mod = await import('./run-HuBXfVSz.mjs').then(function (n) { return n.t; });
|
|
1407
1393
|
if (hasHypha) {
|
|
1408
1394
|
mod.setClaudeAuthHyphaProxy();
|
|
1409
1395
|
console.log("Claude auth configured: hypha-proxy (uses HYPHA_TOKEN live at each spawn).");
|
|
@@ -1441,7 +1427,7 @@ async function applyDaemonShareFlag(argv) {
|
|
|
1441
1427
|
}
|
|
1442
1428
|
}
|
|
1443
1429
|
if (collected.length === 0) return;
|
|
1444
|
-
const { updateEnvFile } = await import('./run-
|
|
1430
|
+
const { updateEnvFile } = await import('./run-HuBXfVSz.mjs').then(function (n) { return n.t; });
|
|
1445
1431
|
const seen = /* @__PURE__ */ new Set();
|
|
1446
1432
|
const deduped = collected.filter((e) => {
|
|
1447
1433
|
const k = e.toLowerCase();
|
|
@@ -1454,7 +1440,7 @@ async function applyDaemonShareFlag(argv) {
|
|
|
1454
1440
|
}
|
|
1455
1441
|
async function handleDaemonAuthCommand(argv) {
|
|
1456
1442
|
const sub = (argv[0] || "status").toLowerCase();
|
|
1457
|
-
const mod = await import('./run-
|
|
1443
|
+
const mod = await import('./run-HuBXfVSz.mjs').then(function (n) { return n.t; });
|
|
1458
1444
|
if (sub === "--help" || sub === "-h" || sub === "help") {
|
|
1459
1445
|
console.log(`
|
|
1460
1446
|
svamp daemon auth \u2014 Configure how Claude subprocesses authenticate
|
|
@@ -1527,8 +1513,7 @@ QUICK START \u2014 Spawn a session, give it a task, get results:
|
|
|
1527
1513
|
# The command prints the session ID (e.g., "abc12345-..."). Use it to:
|
|
1528
1514
|
svamp session messages abc1 --last 10 # read output (prefix match on ID)
|
|
1529
1515
|
svamp session send abc1 "now run lint" --wait # send follow-up, wait for done
|
|
1530
|
-
svamp session
|
|
1531
|
-
svamp session resume abc1 # bring an archived session back
|
|
1516
|
+
svamp session stop abc1 # stop when finished
|
|
1532
1517
|
|
|
1533
1518
|
# Spawn on a remote/cloud machine:
|
|
1534
1519
|
svamp session spawn claude -d /workspace -m cloud-box --message "deploy" --wait
|
|
@@ -1545,9 +1530,7 @@ COMMANDS:
|
|
|
1545
1530
|
|
|
1546
1531
|
Lifecycle:
|
|
1547
1532
|
spawn <agent> [-d <path>] [options] Spawn a new agent session
|
|
1548
|
-
|
|
1549
|
-
resume <id> Resume an archived session (spawns agent with --resume)
|
|
1550
|
-
delete <id> Permanently delete a session (cannot be undone)
|
|
1533
|
+
stop <id> Stop a running session
|
|
1551
1534
|
list [--active] [--json] List sessions (alias: ls)
|
|
1552
1535
|
machines List discoverable machines
|
|
1553
1536
|
info <id> [--json] Show status & pending permissions
|
|
@@ -68,7 +68,7 @@ async function serviceExpose(args) {
|
|
|
68
68
|
});
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
|
-
const { connectAndGetMachine } = await import('./commands-
|
|
71
|
+
const { connectAndGetMachine } = await import('./commands-D5kCHCfX.mjs');
|
|
72
72
|
const { server, machine } = await connectAndGetMachine();
|
|
73
73
|
try {
|
|
74
74
|
const status = await machine.tunnelStart({
|
|
@@ -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-
|
|
135
|
+
const { connectAndGetMachine } = await import('./commands-D5kCHCfX.mjs');
|
|
136
136
|
const { server, machine } = await connectAndGetMachine();
|
|
137
137
|
try {
|
|
138
138
|
const tunnels = await machine.tunnelList({});
|
|
@@ -161,7 +161,7 @@ async function serviceDelete(args) {
|
|
|
161
161
|
process.exit(1);
|
|
162
162
|
}
|
|
163
163
|
try {
|
|
164
|
-
const { connectAndGetMachine } = await import('./commands-
|
|
164
|
+
const { connectAndGetMachine } = await import('./commands-D5kCHCfX.mjs');
|
|
165
165
|
const { server, machine } = await connectAndGetMachine();
|
|
166
166
|
try {
|
|
167
167
|
await machine.tunnelStop({ name });
|
|
@@ -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 { n as normalizeAllowedUser, l as loadSecurityContextConfig, e as resolveSecurityContext, f as buildSecurityContextFromFlags, m as mergeSecurityContexts, c as connectToHypha, i as buildSessionShareUrl, j as buildMachineShareUrl } from './run-
|
|
5
|
+
import { n as normalizeAllowedUser, l as loadSecurityContextConfig, e as resolveSecurityContext, f as buildSecurityContextFromFlags, m as mergeSecurityContexts, c as connectToHypha, i as buildSessionShareUrl, j as buildMachineShareUrl } from './run-HuBXfVSz.mjs';
|
|
6
6
|
import 'os';
|
|
7
7
|
import 'fs/promises';
|
|
8
8
|
import 'fs';
|
|
@@ -83,7 +83,7 @@ const SESSION_RPC_PARAMS = {
|
|
|
83
83
|
permissionResponse: ["params"],
|
|
84
84
|
switchMode: ["mode"],
|
|
85
85
|
restartClaude: [],
|
|
86
|
-
|
|
86
|
+
killSession: [],
|
|
87
87
|
keepAlive: ["thinking", "mode"],
|
|
88
88
|
sessionEnd: [],
|
|
89
89
|
getActivityState: [],
|
|
@@ -97,6 +97,7 @@ const SESSION_RPC_PARAMS = {
|
|
|
97
97
|
getEffectiveRole: [],
|
|
98
98
|
updateSharing: ["newSharing"],
|
|
99
99
|
updateSecurityContext: ["newSecurityContext"],
|
|
100
|
+
setClaudeChrome: ["enabled"],
|
|
100
101
|
applySystemPrompt: ["prompt"],
|
|
101
102
|
sendInboxMessage: ["message"],
|
|
102
103
|
getInbox: ["opts"],
|
|
@@ -1033,42 +1034,14 @@ async function sessionSpawn(agent, directory, machineId, opts) {
|
|
|
1033
1034
|
await server.disconnect();
|
|
1034
1035
|
}
|
|
1035
1036
|
}
|
|
1036
|
-
async function
|
|
1037
|
+
async function sessionStop(sessionId, machineId) {
|
|
1037
1038
|
const { server, machine, fullId } = await connectAndResolveSession(sessionId, machineId);
|
|
1038
1039
|
try {
|
|
1039
|
-
const success = await machine.
|
|
1040
|
+
const success = await machine.stopSession(fullId);
|
|
1040
1041
|
if (success) {
|
|
1041
|
-
console.log(`Session ${fullId.slice(0, 8)}
|
|
1042
|
+
console.log(`Session ${fullId.slice(0, 8)} stopped.`);
|
|
1042
1043
|
} else {
|
|
1043
|
-
console.error("Failed to
|
|
1044
|
-
process.exit(1);
|
|
1045
|
-
}
|
|
1046
|
-
} finally {
|
|
1047
|
-
await server.disconnect();
|
|
1048
|
-
}
|
|
1049
|
-
}
|
|
1050
|
-
async function sessionResume(sessionId, machineId) {
|
|
1051
|
-
const { server, machine, fullId } = await connectAndResolveSession(sessionId, machineId);
|
|
1052
|
-
try {
|
|
1053
|
-
const result = await machine.resumeSession(fullId);
|
|
1054
|
-
if (result?.success) {
|
|
1055
|
-
console.log(`Session ${fullId.slice(0, 8)} resumed.`);
|
|
1056
|
-
} else {
|
|
1057
|
-
console.error(`Failed to resume session: ${result?.message || "unknown error"}`);
|
|
1058
|
-
process.exit(1);
|
|
1059
|
-
}
|
|
1060
|
-
} finally {
|
|
1061
|
-
await server.disconnect();
|
|
1062
|
-
}
|
|
1063
|
-
}
|
|
1064
|
-
async function sessionDelete(sessionId, machineId) {
|
|
1065
|
-
const { server, machine, fullId } = await connectAndResolveSession(sessionId, machineId);
|
|
1066
|
-
try {
|
|
1067
|
-
const success = await machine.deleteSession(fullId);
|
|
1068
|
-
if (success) {
|
|
1069
|
-
console.log(`Session ${fullId.slice(0, 8)} deleted.`);
|
|
1070
|
-
} else {
|
|
1071
|
-
console.error("Failed to delete session.");
|
|
1044
|
+
console.error("Failed to stop session (not found on daemon).");
|
|
1072
1045
|
process.exit(1);
|
|
1073
1046
|
}
|
|
1074
1047
|
} finally {
|
|
@@ -1312,12 +1285,12 @@ async function sessionAttach(sessionId, machineId) {
|
|
|
1312
1285
|
process.stdout.write("> ");
|
|
1313
1286
|
return;
|
|
1314
1287
|
}
|
|
1315
|
-
if (trimmed === "/
|
|
1288
|
+
if (trimmed === "/kill") {
|
|
1316
1289
|
try {
|
|
1317
|
-
await svc.
|
|
1318
|
-
console.log("Session
|
|
1290
|
+
await svc.killSession();
|
|
1291
|
+
console.log("Session killed.");
|
|
1319
1292
|
} catch (err) {
|
|
1320
|
-
console.error(`
|
|
1293
|
+
console.error(`Kill failed: ${err.message}`);
|
|
1321
1294
|
}
|
|
1322
1295
|
rl.close();
|
|
1323
1296
|
await server.disconnect();
|
|
@@ -1924,4 +1897,4 @@ async function sessionInboxClear(sessionIdPartial, machineId, opts) {
|
|
|
1924
1897
|
}
|
|
1925
1898
|
}
|
|
1926
1899
|
|
|
1927
|
-
export { connectAndGetMachine, connectAndResolveSession, createWorktree, generateWorktreeName, machineExec, machineInfo, machineLs, machineShare, parseShareArg, renderMessage, resolveSessionId, sessionApprove,
|
|
1900
|
+
export { connectAndGetMachine, connectAndResolveSession, createWorktree, generateWorktreeName, machineExec, machineInfo, machineLs, machineShare, parseShareArg, renderMessage, resolveSessionId, sessionApprove, sessionAttach, sessionDeny, sessionInboxClear, sessionInboxList, sessionInboxRead, sessionInboxReply, sessionInboxSend, sessionInfo, sessionList, sessionMachines, sessionMessages, sessionRalphCancel, sessionRalphStart, sessionRalphStatus, sessionSend, sessionShare, sessionSpawn, sessionStop, sessionWait };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { writeFileSync, readFileSync } from 'fs';
|
|
2
2
|
import { resolve } from 'path';
|
|
3
|
-
import { connectAndGetMachine } from './commands-
|
|
3
|
+
import { connectAndGetMachine } from './commands-D5kCHCfX.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-
|
|
8
|
+
import './run-HuBXfVSz.mjs';
|
|
9
9
|
import 'os';
|
|
10
10
|
import 'fs/promises';
|
|
11
11
|
import 'url';
|
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-
|
|
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-HuBXfVSz.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.
|
|
2
|
+
var version = "0.2.68";
|
|
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";
|
|
@@ -24,7 +24,6 @@ var scripts = {
|
|
|
24
24
|
dev: "tsx src/cli.ts",
|
|
25
25
|
"dev:daemon": "tsx src/cli.ts daemon start-sync",
|
|
26
26
|
"test:e2e": "node --no-warnings test/e2e-session-tests.mjs",
|
|
27
|
-
"test:archive-resume": "node --no-warnings test/test-session-archive-resume.mjs",
|
|
28
27
|
"test:frpc": "npx tsx test/test-frpc-e2e.mjs"
|
|
29
28
|
};
|
|
30
29
|
var dependencies = {
|
|
@@ -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 { resolve, join } from 'node:path';
|
|
4
4
|
import { existsSync, readFileSync, watch } from 'node:fs';
|
|
5
|
-
import { c as connectToHypha, a as registerSessionService, k as generateHookSettings } from './run-
|
|
5
|
+
import { c as connectToHypha, a as registerSessionService, k as generateHookSettings } from './run-HuBXfVSz.mjs';
|
|
6
6
|
import { createServer } from 'node:http';
|
|
7
7
|
import { spawn } from 'node:child_process';
|
|
8
8
|
import { createInterface } from 'node:readline';
|
|
@@ -684,8 +684,8 @@ async function runInteractive(options) {
|
|
|
684
684
|
log("[hypha] Restart requested");
|
|
685
685
|
return { success: false, message: "Restart not supported in interactive mode" };
|
|
686
686
|
},
|
|
687
|
-
|
|
688
|
-
log("[hypha]
|
|
687
|
+
onKillSession: async () => {
|
|
688
|
+
log("[hypha] Kill requested");
|
|
689
689
|
await cleanup();
|
|
690
690
|
process.exit(0);
|
|
691
691
|
},
|
|
@@ -754,36 +754,12 @@ async function registerMachineService(server, machineId, metadata, daemonState,
|
|
|
754
754
|
}
|
|
755
755
|
return result;
|
|
756
756
|
},
|
|
757
|
-
//
|
|
758
|
-
|
|
757
|
+
// Stop a session
|
|
758
|
+
stopSession: async (sessionId, context) => {
|
|
759
759
|
authorizeRequest(context, currentMetadata.sharing, "admin");
|
|
760
|
-
const result = handlers.
|
|
760
|
+
const result = handlers.stopSession(sessionId);
|
|
761
761
|
notifyListeners({
|
|
762
|
-
type: "session-
|
|
763
|
-
sessionId,
|
|
764
|
-
machineId
|
|
765
|
-
});
|
|
766
|
-
return result;
|
|
767
|
-
},
|
|
768
|
-
// Resume an archived session (spawns the agent with --resume <claudeResumeId>)
|
|
769
|
-
resumeSession: async (sessionId, context) => {
|
|
770
|
-
authorizeRequest(context, currentMetadata.sharing, "admin");
|
|
771
|
-
const result = await handlers.resumeSession(sessionId);
|
|
772
|
-
if (result.success) {
|
|
773
|
-
notifyListeners({
|
|
774
|
-
type: "session-resumed",
|
|
775
|
-
sessionId,
|
|
776
|
-
machineId
|
|
777
|
-
});
|
|
778
|
-
}
|
|
779
|
-
return result;
|
|
780
|
-
},
|
|
781
|
-
// Permanently delete a session (wipes session.json + messages.jsonl + .svamp/{id}/)
|
|
782
|
-
deleteSession: async (sessionId, context) => {
|
|
783
|
-
authorizeRequest(context, currentMetadata.sharing, "admin");
|
|
784
|
-
const result = handlers.deleteSession(sessionId);
|
|
785
|
-
notifyListeners({
|
|
786
|
-
type: "session-deleted",
|
|
762
|
+
type: "session-stopped",
|
|
787
763
|
sessionId,
|
|
788
764
|
machineId
|
|
789
765
|
});
|
|
@@ -1984,9 +1960,9 @@ function createSessionStore(server, sessionId, initialMetadata, initialAgentStat
|
|
|
1984
1960
|
authorizeRequest(context, metadata.sharing, "admin");
|
|
1985
1961
|
return await callbacks.onRestartClaude();
|
|
1986
1962
|
},
|
|
1987
|
-
|
|
1963
|
+
killSession: async (context) => {
|
|
1988
1964
|
authorizeRequest(context, metadata.sharing, "admin");
|
|
1989
|
-
callbacks.
|
|
1965
|
+
callbacks.onKillSession();
|
|
1990
1966
|
return { success: true };
|
|
1991
1967
|
},
|
|
1992
1968
|
// ── Activity ──
|
|
@@ -2116,6 +2092,22 @@ function createSessionStore(server, sessionId, initialMetadata, initialAgentStat
|
|
|
2116
2092
|
});
|
|
2117
2093
|
return await callbacks.onUpdateSecurityContext(resolvedContext);
|
|
2118
2094
|
},
|
|
2095
|
+
/** Toggle the Claude --chrome flag and restart the agent process.
|
|
2096
|
+
* Admin tier (owner or admin-shared user) can perform this. */
|
|
2097
|
+
setClaudeChrome: async (enabled, context) => {
|
|
2098
|
+
authorizeRequest(context, metadata.sharing, "admin");
|
|
2099
|
+
if (!callbacks.onSetClaudeChrome) {
|
|
2100
|
+
throw new Error("Chrome integration toggle is not supported for this session");
|
|
2101
|
+
}
|
|
2102
|
+
metadata = { ...metadata, claudeChrome: !!enabled };
|
|
2103
|
+
metadataVersion++;
|
|
2104
|
+
notifyListeners({
|
|
2105
|
+
type: "update-session",
|
|
2106
|
+
sessionId,
|
|
2107
|
+
metadata: { value: metadata, version: metadataVersion }
|
|
2108
|
+
});
|
|
2109
|
+
return await callbacks.onSetClaudeChrome(!!enabled);
|
|
2110
|
+
},
|
|
2119
2111
|
/** Apply a new system prompt and restart the agent process */
|
|
2120
2112
|
applySystemPrompt: async (prompt, context) => {
|
|
2121
2113
|
authorizeRequest(context, metadata.sharing, "admin");
|
|
@@ -7478,43 +7470,6 @@ function deletePersistedSession(sessionId) {
|
|
|
7478
7470
|
saveSessionIndex(index);
|
|
7479
7471
|
}
|
|
7480
7472
|
}
|
|
7481
|
-
function markSessionAsArchived(sessionId) {
|
|
7482
|
-
const index = loadSessionIndex();
|
|
7483
|
-
const entry = index[sessionId];
|
|
7484
|
-
if (!entry) return false;
|
|
7485
|
-
const filePath = getSessionFilePath(entry.directory, sessionId);
|
|
7486
|
-
if (!existsSync$1(filePath)) return false;
|
|
7487
|
-
try {
|
|
7488
|
-
const data = JSON.parse(readFileSync$1(filePath, "utf-8"));
|
|
7489
|
-
if (data.stopped === true) return true;
|
|
7490
|
-
data.stopped = true;
|
|
7491
|
-
const tmpPath = filePath + ".tmp";
|
|
7492
|
-
writeFileSync(tmpPath, JSON.stringify(data, null, 2), "utf-8");
|
|
7493
|
-
renameSync(tmpPath, filePath);
|
|
7494
|
-
return true;
|
|
7495
|
-
} catch {
|
|
7496
|
-
return false;
|
|
7497
|
-
}
|
|
7498
|
-
}
|
|
7499
|
-
function clearSessionArchivedFlag(sessionId) {
|
|
7500
|
-
const index = loadSessionIndex();
|
|
7501
|
-
const entry = index[sessionId];
|
|
7502
|
-
if (!entry) return null;
|
|
7503
|
-
const filePath = getSessionFilePath(entry.directory, sessionId);
|
|
7504
|
-
if (!existsSync$1(filePath)) return null;
|
|
7505
|
-
try {
|
|
7506
|
-
const data = JSON.parse(readFileSync$1(filePath, "utf-8"));
|
|
7507
|
-
if (data.stopped) {
|
|
7508
|
-
delete data.stopped;
|
|
7509
|
-
const tmpPath = filePath + ".tmp";
|
|
7510
|
-
writeFileSync(tmpPath, JSON.stringify(data, null, 2), "utf-8");
|
|
7511
|
-
renameSync(tmpPath, filePath);
|
|
7512
|
-
}
|
|
7513
|
-
return data;
|
|
7514
|
-
} catch {
|
|
7515
|
-
return null;
|
|
7516
|
-
}
|
|
7517
|
-
}
|
|
7518
7473
|
function loadPersistedSessions() {
|
|
7519
7474
|
const sessions = [];
|
|
7520
7475
|
const index = loadSessionIndex();
|
|
@@ -7816,7 +7771,7 @@ async function startDaemon(options) {
|
|
|
7816
7771
|
const list = loadExposedTunnels().filter((t) => t.name !== name);
|
|
7817
7772
|
saveExposedTunnels(list);
|
|
7818
7773
|
}
|
|
7819
|
-
const { ServeManager } = await import('./serveManager-
|
|
7774
|
+
const { ServeManager } = await import('./serveManager-DWQtF8NK.mjs');
|
|
7820
7775
|
const serveManager = new ServeManager(SVAMP_HOME, (msg) => logger.log(`[SERVE] ${msg}`), hyphaServerUrl);
|
|
7821
7776
|
ensureAutoInstalledSkills(logger).catch(() => {
|
|
7822
7777
|
});
|
|
@@ -8001,7 +7956,6 @@ async function startDaemon(options) {
|
|
|
8001
7956
|
startedFromDaemon: true,
|
|
8002
7957
|
startedBy: "daemon",
|
|
8003
7958
|
lifecycleState: resumeSessionId ? "idle" : "starting",
|
|
8004
|
-
...resumeSessionId && { claudeSessionId: resumeSessionId },
|
|
8005
7959
|
sharing: options2.sharing,
|
|
8006
7960
|
securityContext: options2.securityContext,
|
|
8007
7961
|
tags: options2.tags,
|
|
@@ -8010,7 +7964,8 @@ async function startDaemon(options) {
|
|
|
8010
7964
|
const parentTracked = Array.from(pidToTrackedSession.values()).find((t) => t.svampSessionId === options2.parentSessionId);
|
|
8011
7965
|
return parentTracked?.directory ? { parentSessionPath: parentTracked.directory } : {};
|
|
8012
7966
|
})(),
|
|
8013
|
-
...options2.injectPlatformGuidance !== void 0 && { injectPlatformGuidance: options2.injectPlatformGuidance }
|
|
7967
|
+
...options2.injectPlatformGuidance !== void 0 && { injectPlatformGuidance: options2.injectPlatformGuidance },
|
|
7968
|
+
...options2.claudeChrome !== void 0 && { claudeChrome: options2.claudeChrome }
|
|
8014
7969
|
};
|
|
8015
7970
|
let claudeProcess = null;
|
|
8016
7971
|
const allPersisted = loadPersistedSessions();
|
|
@@ -8172,6 +8127,13 @@ async function startDaemon(options) {
|
|
|
8172
8127
|
if (model) args.push("--model", model);
|
|
8173
8128
|
if (appendSystemPrompt) args.push("--append-system-prompt", appendSystemPrompt);
|
|
8174
8129
|
if (claudeResumeId) args.push("--resume", claudeResumeId);
|
|
8130
|
+
if (sessionMetadata.claudeChrome) {
|
|
8131
|
+
if (shouldIsolateSession()) {
|
|
8132
|
+
logger.log(`[Session ${sessionId}] claudeChrome=true but session is isolated; skipping --chrome (Chrome IPC not reachable from sandbox)`);
|
|
8133
|
+
} else {
|
|
8134
|
+
args.push("--chrome");
|
|
8135
|
+
}
|
|
8136
|
+
}
|
|
8175
8137
|
if (!hookSettings) {
|
|
8176
8138
|
try {
|
|
8177
8139
|
hookSettings = generateHookSettings({ id: sessionId });
|
|
@@ -8717,16 +8679,7 @@ The automated loop has finished. Review the progress above and let me know if yo
|
|
|
8717
8679
|
artifactSync.scheduleDebouncedSync(sessionId, getSessionDir(directory, sessionId), sessionMetadata, machineId);
|
|
8718
8680
|
}
|
|
8719
8681
|
if (isResumeFailure) {
|
|
8720
|
-
|
|
8721
|
-
logger.log(`[Session ${sessionId}] Resume failed \u2014 Claude started fresh session (tried: ${triedId}, got: ${msg.session_id})`);
|
|
8722
|
-
sessionService.pushMessage(
|
|
8723
|
-
{
|
|
8724
|
-
type: "message",
|
|
8725
|
-
message: `Resume incomplete \u2014 Claude could not restore the previous conversation. A new Claude session was started (expected ${triedId.slice(0, 8)}\u2026, got ${msg.session_id.slice(0, 8)}\u2026). Earlier messages remain in the history above for reference, but Claude does not have them in its context.`,
|
|
8726
|
-
level: "warning"
|
|
8727
|
-
},
|
|
8728
|
-
"event"
|
|
8729
|
-
);
|
|
8682
|
+
logger.log(`[Session ${sessionId}] Resume failed \u2014 Claude started fresh session (tried: ${persisted?.claudeResumeId ?? "unknown"}, got: ${msg.session_id})`);
|
|
8730
8683
|
} else if (isConversationClear) {
|
|
8731
8684
|
logger.log(`[Session ${sessionId}] Conversation cleared (/clear) \u2014 new Claude session: ${msg.session_id}`);
|
|
8732
8685
|
sessionService.clearMessages();
|
|
@@ -9148,6 +9101,24 @@ The automated loop has finished. Review the progress above and let me know if yo
|
|
|
9148
9101
|
sessionMetadata = { ...sessionMetadata, securityContext: newSecurityContext };
|
|
9149
9102
|
return await restartClaudeHandler();
|
|
9150
9103
|
},
|
|
9104
|
+
onSetClaudeChrome: async (enabled) => {
|
|
9105
|
+
logger.log(`[Session ${sessionId}] Chrome integration ${enabled ? "enabled" : "disabled"} \u2014 restarting agent`);
|
|
9106
|
+
sessionMetadata = { ...sessionMetadata, claudeChrome: enabled };
|
|
9107
|
+
if (claudeResumeId && !trackedSession.stopped) {
|
|
9108
|
+
saveSession({
|
|
9109
|
+
sessionId,
|
|
9110
|
+
directory,
|
|
9111
|
+
claudeResumeId,
|
|
9112
|
+
permissionMode: currentPermissionMode,
|
|
9113
|
+
spawnMeta: lastSpawnMeta,
|
|
9114
|
+
metadata: sessionMetadata,
|
|
9115
|
+
createdAt: sessionCreatedAt,
|
|
9116
|
+
machineId,
|
|
9117
|
+
wasProcessing: sessionWasProcessing
|
|
9118
|
+
});
|
|
9119
|
+
}
|
|
9120
|
+
return await restartClaudeHandler();
|
|
9121
|
+
},
|
|
9151
9122
|
onSharingUpdate: (newSharing) => {
|
|
9152
9123
|
logger.log(`[Session ${sessionId}] Sharing config updated \u2014 persisting to disk`);
|
|
9153
9124
|
const oldSharing = sessionMetadata.sharing;
|
|
@@ -9182,9 +9153,9 @@ The automated loop has finished. Review the progress above and let me know if yo
|
|
|
9182
9153
|
lastSpawnMeta = { ...lastSpawnMeta, appendSystemPrompt: prompt };
|
|
9183
9154
|
return await restartClaudeHandler();
|
|
9184
9155
|
},
|
|
9185
|
-
|
|
9186
|
-
logger.log(`[Session ${sessionId}]
|
|
9187
|
-
|
|
9156
|
+
onKillSession: () => {
|
|
9157
|
+
logger.log(`[Session ${sessionId}] Kill session requested`);
|
|
9158
|
+
stopSession(sessionId);
|
|
9188
9159
|
},
|
|
9189
9160
|
onInboxMessage: (message) => {
|
|
9190
9161
|
if (trackedSession?.stopped) return;
|
|
@@ -9653,9 +9624,9 @@ The automated loop has finished. Review the progress above and let me know if yo
|
|
|
9653
9624
|
onApplySystemPrompt: async () => {
|
|
9654
9625
|
return { success: false, message: "System prompt updates with restart are not yet supported for this agent type." };
|
|
9655
9626
|
},
|
|
9656
|
-
|
|
9657
|
-
logger.log(`[${agentName} Session ${sessionId}]
|
|
9658
|
-
|
|
9627
|
+
onKillSession: () => {
|
|
9628
|
+
logger.log(`[${agentName} Session ${sessionId}] Kill session requested`);
|
|
9629
|
+
stopSession(sessionId);
|
|
9659
9630
|
},
|
|
9660
9631
|
onInboxMessage: (message) => {
|
|
9661
9632
|
if (acpStopped) return;
|
|
@@ -10111,7 +10082,7 @@ The automated loop has finished. Review the progress above and let me know if yo
|
|
|
10111
10082
|
"event"
|
|
10112
10083
|
);
|
|
10113
10084
|
sessionService.sendSessionEnd();
|
|
10114
|
-
|
|
10085
|
+
stopSession(sessionId);
|
|
10115
10086
|
});
|
|
10116
10087
|
return {
|
|
10117
10088
|
type: "success",
|
|
@@ -10126,7 +10097,8 @@ The automated loop has finished. Review the progress above and let me know if yo
|
|
|
10126
10097
|
};
|
|
10127
10098
|
}
|
|
10128
10099
|
};
|
|
10129
|
-
const
|
|
10100
|
+
const stopSession = (sessionId) => {
|
|
10101
|
+
logger.log(`Stopping session: ${sessionId}`);
|
|
10130
10102
|
for (const [pid, session] of pidToTrackedSession) {
|
|
10131
10103
|
if (session.svampSessionId === sessionId) {
|
|
10132
10104
|
session.stopped = true;
|
|
@@ -10145,63 +10117,15 @@ The automated loop has finished. Review the progress above and let me know if yo
|
|
|
10145
10117
|
session.cleanupSvampConfig?.();
|
|
10146
10118
|
artifactSync.cancelSync(sessionId);
|
|
10147
10119
|
pidToTrackedSession.delete(pid);
|
|
10120
|
+
deletePersistedSession(sessionId);
|
|
10121
|
+
logger.log(`Session ${sessionId} stopped`);
|
|
10148
10122
|
return true;
|
|
10149
10123
|
}
|
|
10150
10124
|
}
|
|
10151
10125
|
artifactSync.cancelSync(sessionId);
|
|
10152
|
-
return false;
|
|
10153
|
-
};
|
|
10154
|
-
const archiveSession = (sessionId) => {
|
|
10155
|
-
logger.log(`Archiving session: ${sessionId}`);
|
|
10156
|
-
const wasInMemory = teardownTrackedSession(sessionId);
|
|
10157
|
-
const markedArchived = markSessionAsArchived(sessionId);
|
|
10158
|
-
if (wasInMemory || markedArchived) {
|
|
10159
|
-
logger.log(`Session ${sessionId} archived (inMemory=${wasInMemory}, persisted=${markedArchived})`);
|
|
10160
|
-
return true;
|
|
10161
|
-
}
|
|
10162
|
-
logger.log(`Session ${sessionId} not found in memory or on disk; nothing to archive`);
|
|
10163
|
-
return false;
|
|
10164
|
-
};
|
|
10165
|
-
const resumeSession = async (sessionId) => {
|
|
10166
|
-
logger.log(`Resuming session: ${sessionId}`);
|
|
10167
|
-
for (const session of pidToTrackedSession.values()) {
|
|
10168
|
-
if (session.svampSessionId === sessionId && !session.stopped) {
|
|
10169
|
-
logger.log(`Session ${sessionId} already running \u2014 resume is a no-op`);
|
|
10170
|
-
return { success: true, sessionId, message: "Session is already running" };
|
|
10171
|
-
}
|
|
10172
|
-
}
|
|
10173
|
-
const persisted = clearSessionArchivedFlag(sessionId);
|
|
10174
|
-
if (!persisted) {
|
|
10175
|
-
return { success: false, message: `Session ${sessionId} has no persisted record to resume` };
|
|
10176
|
-
}
|
|
10177
|
-
try {
|
|
10178
|
-
const result = await spawnSession({
|
|
10179
|
-
directory: persisted.directory,
|
|
10180
|
-
sessionId: persisted.sessionId,
|
|
10181
|
-
resumeSessionId: persisted.claudeResumeId,
|
|
10182
|
-
sharing: persisted.metadata?.sharing,
|
|
10183
|
-
securityContext: persisted.metadata?.securityContext,
|
|
10184
|
-
forceIsolation: !!persisted.metadata?.isolationMethod,
|
|
10185
|
-
parentSessionId: persisted.metadata?.parentSessionId,
|
|
10186
|
-
permissionMode: persisted.permissionMode
|
|
10187
|
-
});
|
|
10188
|
-
if (result.type === "success") {
|
|
10189
|
-
logger.log(`Resumed session ${sessionId} (claudeResumeId=${persisted.claudeResumeId || "none"})`);
|
|
10190
|
-
return { success: true, sessionId: result.sessionId };
|
|
10191
|
-
}
|
|
10192
|
-
markSessionAsArchived(sessionId);
|
|
10193
|
-
return { success: false, message: result.errorMessage || `spawnSession returned ${result.type}` };
|
|
10194
|
-
} catch (err) {
|
|
10195
|
-
markSessionAsArchived(sessionId);
|
|
10196
|
-
return { success: false, message: err.message };
|
|
10197
|
-
}
|
|
10198
|
-
};
|
|
10199
|
-
const deleteSession = (sessionId) => {
|
|
10200
|
-
logger.log(`Deleting session: ${sessionId}`);
|
|
10201
|
-
teardownTrackedSession(sessionId);
|
|
10202
10126
|
deletePersistedSession(sessionId);
|
|
10203
|
-
logger.log(`Session ${sessionId}
|
|
10204
|
-
return
|
|
10127
|
+
logger.log(`Session ${sessionId} not found in memory, cleaned up persisted state`);
|
|
10128
|
+
return false;
|
|
10205
10129
|
};
|
|
10206
10130
|
const restartSession = async (sessionId) => {
|
|
10207
10131
|
for (const session of pidToTrackedSession.values()) {
|
|
@@ -10280,9 +10204,7 @@ The automated loop has finished. Review the progress above and let me know if yo
|
|
|
10280
10204
|
initialDaemonState,
|
|
10281
10205
|
{
|
|
10282
10206
|
spawnSession,
|
|
10283
|
-
|
|
10284
|
-
resumeSession,
|
|
10285
|
-
deleteSession,
|
|
10207
|
+
stopSession,
|
|
10286
10208
|
restartSession,
|
|
10287
10209
|
requestShutdown: () => {
|
|
10288
10210
|
logger.log("Shutdown requested via hypha-app (ignored \u2014 daemon never self-terminates)");
|
|
@@ -54,7 +54,7 @@ async function handleServeCommand() {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
async function serveAdd(args, machineId) {
|
|
57
|
-
const { connectAndGetMachine } = await import('./commands-
|
|
57
|
+
const { connectAndGetMachine } = await import('./commands-D5kCHCfX.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-
|
|
96
|
+
const { connectAndGetMachine } = await import('./commands-D5kCHCfX.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-
|
|
185
|
+
const { connectAndGetMachine } = await import('./commands-D5kCHCfX.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-
|
|
205
|
+
const { connectAndGetMachine } = await import('./commands-D5kCHCfX.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-
|
|
238
|
+
const { connectAndGetMachine } = await import('./commands-D5kCHCfX.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 { S as ServeAuth, h as hasCookieToken } from './run-
|
|
7
|
+
import { S as ServeAuth, h as hasCookieToken } from './run-HuBXfVSz.mjs';
|
|
8
8
|
import 'os';
|
|
9
9
|
import 'fs/promises';
|
|
10
10
|
import 'url';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svamp-cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.68",
|
|
4
4
|
"description": "Svamp CLI — AI workspace daemon on Hypha Cloud",
|
|
5
5
|
"author": "Amun AI AB",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
"dev": "tsx src/cli.ts",
|
|
26
26
|
"dev:daemon": "tsx src/cli.ts daemon start-sync",
|
|
27
27
|
"test:e2e": "node --no-warnings test/e2e-session-tests.mjs",
|
|
28
|
-
"test:archive-resume": "node --no-warnings test/test-session-archive-resume.mjs",
|
|
29
28
|
"test:frpc": "npx tsx test/test-frpc-e2e.mjs"
|
|
30
29
|
},
|
|
31
30
|
"dependencies": {
|