svamp-cli 0.1.36 → 0.1.38
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/cli.mjs +10 -10
- package/dist/{commands-EjpBlIl0.mjs → commands-Du-fdLLu.mjs} +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{package-DqJE7fYO.mjs → package-DjG7T9SX.mjs} +1 -1
- package/dist/{run-fEuWMTdD.mjs → run-CXrEt0TM.mjs} +29 -2
- package/dist/{run-CZxKcatI.mjs → run-DWJdk9GP.mjs} +23 -6
- package/package.json +1 -1
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-CXrEt0TM.mjs';
|
|
2
2
|
import 'os';
|
|
3
3
|
import 'fs/promises';
|
|
4
4
|
import 'fs';
|
|
@@ -91,7 +91,7 @@ async function main() {
|
|
|
91
91
|
} else if (!subcommand || subcommand === "start") {
|
|
92
92
|
await handleInteractiveCommand();
|
|
93
93
|
} else if (subcommand === "--version" || subcommand === "-v") {
|
|
94
|
-
const pkg = await import('./package-
|
|
94
|
+
const pkg = await import('./package-DjG7T9SX.mjs').catch(() => ({ default: { version: "unknown" } }));
|
|
95
95
|
console.log(`svamp version: ${pkg.default.version}`);
|
|
96
96
|
} else {
|
|
97
97
|
console.error(`Unknown command: ${subcommand}`);
|
|
@@ -100,7 +100,7 @@ async function main() {
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
async function handleInteractiveCommand() {
|
|
103
|
-
const { runInteractive } = await import('./run-
|
|
103
|
+
const { runInteractive } = await import('./run-DWJdk9GP.mjs');
|
|
104
104
|
const interactiveArgs = subcommand === "start" ? args.slice(1) : args;
|
|
105
105
|
let directory = process.cwd();
|
|
106
106
|
let resumeSessionId;
|
|
@@ -145,7 +145,7 @@ async function handleAgentCommand() {
|
|
|
145
145
|
return;
|
|
146
146
|
}
|
|
147
147
|
if (agentArgs[0] === "list") {
|
|
148
|
-
const { KNOWN_ACP_AGENTS, KNOWN_MCP_AGENTS: KNOWN_MCP_AGENTS2 } = await import('./run-
|
|
148
|
+
const { KNOWN_ACP_AGENTS, KNOWN_MCP_AGENTS: KNOWN_MCP_AGENTS2 } = await import('./run-CXrEt0TM.mjs').then(function (n) { return n.f; });
|
|
149
149
|
console.log("Known agents:");
|
|
150
150
|
for (const [name, config2] of Object.entries(KNOWN_ACP_AGENTS)) {
|
|
151
151
|
console.log(` ${name.padEnd(12)} ${config2.command} ${config2.args.join(" ")} (ACP)`);
|
|
@@ -157,7 +157,7 @@ async function handleAgentCommand() {
|
|
|
157
157
|
console.log('Use "svamp agent -- <command> [args]" for a custom ACP agent.');
|
|
158
158
|
return;
|
|
159
159
|
}
|
|
160
|
-
const { resolveAcpAgentConfig, KNOWN_MCP_AGENTS } = await import('./run-
|
|
160
|
+
const { resolveAcpAgentConfig, KNOWN_MCP_AGENTS } = await import('./run-CXrEt0TM.mjs').then(function (n) { return n.f; });
|
|
161
161
|
let cwd = process.cwd();
|
|
162
162
|
const filteredArgs = [];
|
|
163
163
|
for (let i = 0; i < agentArgs.length; i++) {
|
|
@@ -181,12 +181,12 @@ async function handleAgentCommand() {
|
|
|
181
181
|
console.log(`Starting ${config.agentName} agent in ${cwd}...`);
|
|
182
182
|
let backend;
|
|
183
183
|
if (KNOWN_MCP_AGENTS[config.agentName]) {
|
|
184
|
-
const { CodexMcpBackend } = await import('./run-
|
|
184
|
+
const { CodexMcpBackend } = await import('./run-CXrEt0TM.mjs').then(function (n) { return n.h; });
|
|
185
185
|
backend = new CodexMcpBackend({ cwd, log: logFn });
|
|
186
186
|
} else {
|
|
187
|
-
const { AcpBackend } = await import('./run-
|
|
188
|
-
const { GeminiTransport } = await import('./run-
|
|
189
|
-
const { DefaultTransport } = await import('./run-
|
|
187
|
+
const { AcpBackend } = await import('./run-CXrEt0TM.mjs').then(function (n) { return n.e; });
|
|
188
|
+
const { GeminiTransport } = await import('./run-CXrEt0TM.mjs').then(function (n) { return n.G; });
|
|
189
|
+
const { DefaultTransport } = await import('./run-CXrEt0TM.mjs').then(function (n) { return n.D; });
|
|
190
190
|
const transportHandler = config.agentName === "gemini" ? new GeminiTransport() : new DefaultTransport(config.agentName);
|
|
191
191
|
backend = new AcpBackend({
|
|
192
192
|
agentName: config.agentName,
|
|
@@ -304,7 +304,7 @@ async function handleSessionCommand() {
|
|
|
304
304
|
printSessionHelp();
|
|
305
305
|
return;
|
|
306
306
|
}
|
|
307
|
-
const { sessionList, sessionSpawn, sessionStop, sessionInfo, sessionMessages, sessionAttach, sessionMachines, sessionSend, sessionWait } = await import('./commands-
|
|
307
|
+
const { sessionList, sessionSpawn, sessionStop, sessionInfo, sessionMessages, sessionAttach, sessionMachines, sessionSend, sessionWait } = await import('./commands-Du-fdLLu.mjs');
|
|
308
308
|
const parseFlagStr = (flag, shortFlag) => {
|
|
309
309
|
for (let i = 1; i < sessionArgs.length; i++) {
|
|
310
310
|
if ((sessionArgs[i] === flag || shortFlag) && i + 1 < sessionArgs.length) {
|
|
@@ -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-
|
|
4
|
+
import { c as connectToHypha } from './run-CXrEt0TM.mjs';
|
|
5
5
|
import 'os';
|
|
6
6
|
import 'fs/promises';
|
|
7
7
|
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-
|
|
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-CXrEt0TM.mjs';
|
|
2
2
|
import 'os';
|
|
3
3
|
import 'fs/promises';
|
|
4
4
|
import 'fs';
|
|
@@ -3556,8 +3556,34 @@ async function startDaemon() {
|
|
|
3556
3556
|
}
|
|
3557
3557
|
});
|
|
3558
3558
|
if (isDaemonAlive()) {
|
|
3559
|
-
|
|
3560
|
-
|
|
3559
|
+
const supervised = process.env.SVAMP_SUPERVISED === "1";
|
|
3560
|
+
if (supervised) {
|
|
3561
|
+
const state = readDaemonStateFile();
|
|
3562
|
+
if (state) {
|
|
3563
|
+
console.log(`Supervised daemon: taking over from existing PID ${state.pid}`);
|
|
3564
|
+
try {
|
|
3565
|
+
process.kill(state.pid, "SIGTERM");
|
|
3566
|
+
} catch {
|
|
3567
|
+
}
|
|
3568
|
+
for (let i = 0; i < 50; i++) {
|
|
3569
|
+
await new Promise((r) => setTimeout(r, 200));
|
|
3570
|
+
try {
|
|
3571
|
+
process.kill(state.pid, 0);
|
|
3572
|
+
} catch {
|
|
3573
|
+
break;
|
|
3574
|
+
}
|
|
3575
|
+
}
|
|
3576
|
+
try {
|
|
3577
|
+
process.kill(state.pid, 0);
|
|
3578
|
+
process.kill(state.pid, "SIGKILL");
|
|
3579
|
+
} catch {
|
|
3580
|
+
}
|
|
3581
|
+
cleanupDaemonStateFile();
|
|
3582
|
+
}
|
|
3583
|
+
} else {
|
|
3584
|
+
console.log("Svamp daemon is already running");
|
|
3585
|
+
process.exit(0);
|
|
3586
|
+
}
|
|
3561
3587
|
}
|
|
3562
3588
|
const hyphaServerUrl = process.env.HYPHA_SERVER_URL;
|
|
3563
3589
|
if (!hyphaServerUrl) {
|
|
@@ -4782,6 +4808,7 @@ async function startDaemon() {
|
|
|
4782
4808
|
logger.log(`svamp-cli version changed on disk: ${DAEMON_VERSION} \u2192 ${installedVersion}. Self-restarting...`);
|
|
4783
4809
|
const supervised2 = process.env.SVAMP_SUPERVISED === "1";
|
|
4784
4810
|
if (!supervised2) {
|
|
4811
|
+
cleanupDaemonStateFile();
|
|
4785
4812
|
const { spawn: spawnSelf } = await import('child_process');
|
|
4786
4813
|
spawnSelf(process.argv[0], process.argv.slice(1), {
|
|
4787
4814
|
detached: true,
|
|
@@ -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-
|
|
5
|
+
import { c as connectToHypha, a as registerSessionService } from './run-CXrEt0TM.mjs';
|
|
6
6
|
import { createServer } from 'node:http';
|
|
7
7
|
import { spawn } from 'node:child_process';
|
|
8
8
|
import { createInterface } from 'node:readline';
|
|
@@ -417,6 +417,10 @@ async function runClaudeTurn(opts) {
|
|
|
417
417
|
args.push(...opts.claudeArgs);
|
|
418
418
|
}
|
|
419
419
|
opts.log(`[remote] Spawning: claude ${args.join(" ")}`);
|
|
420
|
+
process.stderr.write(`
|
|
421
|
+
\x1B[34m \u25B6 User:\x1B[0m ${opts.message}
|
|
422
|
+
|
|
423
|
+
`);
|
|
420
424
|
const spawnEnv = { ...process.env, CLAUDE_CODE_ENTRYPOINT: "sdk-ts" };
|
|
421
425
|
delete spawnEnv.CLAUDECODE;
|
|
422
426
|
const child = spawn(opts.claudeBin, args, {
|
|
@@ -517,11 +521,9 @@ function handleSDKMessage(msg, opts, write) {
|
|
|
517
521
|
break;
|
|
518
522
|
}
|
|
519
523
|
case "result": {
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
\x1B[32m[done]\x1B[0m ${msg.result}
|
|
524
|
+
write(`
|
|
525
|
+
\x1B[32m[done]\x1B[0m
|
|
523
526
|
`);
|
|
524
|
-
}
|
|
525
527
|
break;
|
|
526
528
|
}
|
|
527
529
|
default:
|
|
@@ -821,7 +823,19 @@ async function runInteractive(options) {
|
|
|
821
823
|
restoreConsoleLogs();
|
|
822
824
|
console.log(`\x1B[36mSvamp interactive mode\x1B[0m`);
|
|
823
825
|
if (server && sessionService) {
|
|
826
|
+
const serviceId = sessionService.serviceInfo?.id || `svamp-session-${sessionId}`;
|
|
827
|
+
const slashIdx = serviceId.indexOf("/");
|
|
828
|
+
const colonIdx = serviceId.indexOf(":");
|
|
829
|
+
let serviceUrl = "";
|
|
830
|
+
if (slashIdx > 0 && colonIdx > slashIdx) {
|
|
831
|
+
const workspace = serviceId.slice(0, slashIdx);
|
|
832
|
+
const clientAndService = serviceId.slice(slashIdx + 1);
|
|
833
|
+
serviceUrl = `${serverUrl}/${workspace}/services/${clientAndService}`;
|
|
834
|
+
}
|
|
824
835
|
console.log(`\x1B[90mSession synced to Hypha \u2014 visible in the web app\x1B[0m`);
|
|
836
|
+
if (serviceUrl) {
|
|
837
|
+
console.log(`\x1B[90mService: ${serviceUrl}\x1B[0m`);
|
|
838
|
+
}
|
|
825
839
|
console.log(`\x1B[90mSession ID: ${sessionId.slice(0, 8)}\x1B[0m`);
|
|
826
840
|
}
|
|
827
841
|
console.log("");
|
|
@@ -854,7 +868,10 @@ async function runInteractive(options) {
|
|
|
854
868
|
onMessage: (msg) => {
|
|
855
869
|
if (!sessionService) return;
|
|
856
870
|
if (msg.type === "assistant" && msg.message) {
|
|
857
|
-
sessionService.pushMessage(
|
|
871
|
+
sessionService.pushMessage({
|
|
872
|
+
type: "assistant",
|
|
873
|
+
content: msg.message.content
|
|
874
|
+
}, "agent");
|
|
858
875
|
} else if (msg.type === "user" && msg.message) {
|
|
859
876
|
const text = typeof msg.message.content === "string" ? msg.message.content : msg.message.content?.text || JSON.stringify(msg.message.content);
|
|
860
877
|
sessionService.pushMessage({ type: "text", text }, "user");
|