svamp-cli 0.1.37 → 0.1.39

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 CHANGED
@@ -1,4 +1,4 @@
1
- import { s as startDaemon, b as stopDaemon, d as daemonStatus } from './run-fEuWMTdD.mjs';
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-BK_ln_DQ.mjs').catch(() => ({ default: { version: "unknown" } }));
94
+ const pkg = await import('./package-BbzWWqQK.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-LXKUEpHX.mjs');
103
+ const { runInteractive } = await import('./run-D19RL_zw.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-fEuWMTdD.mjs').then(function (n) { return n.f; });
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-fEuWMTdD.mjs').then(function (n) { return n.f; });
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-fEuWMTdD.mjs').then(function (n) { return n.h; });
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-fEuWMTdD.mjs').then(function (n) { return n.e; });
188
- const { GeminiTransport } = await import('./run-fEuWMTdD.mjs').then(function (n) { return n.G; });
189
- const { DefaultTransport } = await import('./run-fEuWMTdD.mjs').then(function (n) { return n.D; });
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-EjpBlIl0.mjs');
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-fEuWMTdD.mjs';
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-fEuWMTdD.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-CXrEt0TM.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.1.37";
2
+ var version = "0.1.39";
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";
@@ -3556,8 +3556,34 @@ async function startDaemon() {
3556
3556
  }
3557
3557
  });
3558
3558
  if (isDaemonAlive()) {
3559
- console.log("Svamp daemon is already running");
3560
- process.exit(0);
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-fEuWMTdD.mjs';
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
- if (msg.result) {
521
- write(`
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,9 +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`);
825
- console.log(`\x1B[90mServer: ${serverUrl}\x1B[0m`);
826
- console.log(`\x1B[90mService ID: ${sessionService.serviceInfo?.id || `svamp-session-${sessionId}`}\x1B[0m`);
836
+ if (serviceUrl) {
837
+ console.log(`\x1B[90mService: ${serviceUrl}\x1B[0m`);
838
+ }
827
839
  console.log(`\x1B[90mSession ID: ${sessionId.slice(0, 8)}\x1B[0m`);
828
840
  }
829
841
  console.log("");
@@ -856,7 +868,10 @@ async function runInteractive(options) {
856
868
  onMessage: (msg) => {
857
869
  if (!sessionService) return;
858
870
  if (msg.type === "assistant" && msg.message) {
859
- sessionService.pushMessage(msg.message, "agent");
871
+ sessionService.pushMessage({
872
+ type: "assistant",
873
+ message: msg.message
874
+ }, "agent");
860
875
  } else if (msg.type === "user" && msg.message) {
861
876
  const text = typeof msg.message.content === "string" ? msg.message.content : msg.message.content?.text || JSON.stringify(msg.message.content);
862
877
  sessionService.pushMessage({ type: "text", text }, "user");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svamp-cli",
3
- "version": "0.1.37",
3
+ "version": "0.1.39",
4
4
  "description": "Svamp CLI — AI workspace daemon on Hypha Cloud",
5
5
  "author": "Amun AI AB",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -1,57 +0,0 @@
1
- var name = "svamp-cli";
2
- var version = "0.1.36";
3
- var description = "Svamp CLI — AI workspace daemon on Hypha Cloud";
4
- var author = "Amun AI AB";
5
- var license = "SEE LICENSE IN LICENSE";
6
- var type = "module";
7
- var bin = {
8
- svamp: "./bin/svamp.mjs"
9
- };
10
- var files = [
11
- "dist",
12
- "bin"
13
- ];
14
- var main = "./dist/index.mjs";
15
- var exports$1 = {
16
- ".": "./dist/index.mjs",
17
- "./cli": "./dist/cli.mjs"
18
- };
19
- var scripts = {
20
- build: "tsc --noEmit && pkgroll",
21
- typecheck: "tsc --noEmit",
22
- "test:hypha": "node --no-warnings test/test-hypha-service.mjs",
23
- dev: "tsx src/cli.ts",
24
- "dev:daemon": "tsx src/cli.ts daemon start-sync",
25
- "test:e2e": "node --no-warnings test/e2e-session-tests.mjs"
26
- };
27
- var dependencies = {
28
- "@agentclientprotocol/sdk": "^0.14.1",
29
- "@modelcontextprotocol/sdk": "^1.25.3",
30
- "hypha-rpc": "0.21.20",
31
- zod: "^3.24.4"
32
- };
33
- var devDependencies = {
34
- "@types/node": ">=20",
35
- pkgroll: "^2.14.2",
36
- tsx: "^4.20.6",
37
- typescript: "5.9.3"
38
- };
39
- var packageManager = "yarn@1.22.22";
40
- var _package = {
41
- name: name,
42
- version: version,
43
- description: description,
44
- author: author,
45
- license: license,
46
- type: type,
47
- bin: bin,
48
- files: files,
49
- main: main,
50
- exports: exports$1,
51
- scripts: scripts,
52
- dependencies: dependencies,
53
- devDependencies: devDependencies,
54
- packageManager: packageManager
55
- };
56
-
57
- export { author, bin, _package as default, dependencies, description, devDependencies, exports$1 as exports, files, license, main, name, packageManager, scripts, type, version };