svamp-cli 0.1.7 → 0.1.9

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-aevHxpEl.mjs';
1
+ import { s as startDaemon, b as stopDaemon, d as daemonStatus } from './run-DSM8v9Sq.mjs';
2
2
  import 'os';
3
3
  import 'fs/promises';
4
4
  import 'fs';
@@ -79,7 +79,7 @@ async function main() {
79
79
  } else if (subcommand === "--help" || subcommand === "-h" || !subcommand) {
80
80
  printHelp();
81
81
  } else if (subcommand === "--version" || subcommand === "-v") {
82
- const pkg = await import('./package-DD4JHOe_.mjs').catch(() => ({ default: { version: "unknown" } }));
82
+ const pkg = await import('./package-6u7ghPWS.mjs').catch(() => ({ default: { version: "unknown" } }));
83
83
  console.log(`svamp version: ${pkg.default.version}`);
84
84
  } else {
85
85
  console.error(`Unknown command: ${subcommand}`);
@@ -94,7 +94,7 @@ async function handleAgentCommand() {
94
94
  return;
95
95
  }
96
96
  if (agentArgs[0] === "list") {
97
- const { KNOWN_ACP_AGENTS } = await import('./run-aevHxpEl.mjs').then(function (n) { return n.f; });
97
+ const { KNOWN_ACP_AGENTS } = await import('./run-DSM8v9Sq.mjs').then(function (n) { return n.f; });
98
98
  console.log("Known ACP agents:");
99
99
  for (const [name, config2] of Object.entries(KNOWN_ACP_AGENTS)) {
100
100
  console.log(` ${name.padEnd(12)} ${config2.command} ${config2.args.join(" ")}`);
@@ -103,10 +103,10 @@ async function handleAgentCommand() {
103
103
  console.log('Use "svamp agent -- <command> [args]" for a custom ACP agent.');
104
104
  return;
105
105
  }
106
- const { resolveAcpAgentConfig } = await import('./run-aevHxpEl.mjs').then(function (n) { return n.f; });
107
- const { AcpBackend } = await import('./run-aevHxpEl.mjs').then(function (n) { return n.e; });
108
- const { GeminiTransport } = await import('./run-aevHxpEl.mjs').then(function (n) { return n.G; });
109
- const { DefaultTransport } = await import('./run-aevHxpEl.mjs').then(function (n) { return n.D; });
106
+ const { resolveAcpAgentConfig } = await import('./run-DSM8v9Sq.mjs').then(function (n) { return n.f; });
107
+ const { AcpBackend } = await import('./run-DSM8v9Sq.mjs').then(function (n) { return n.e; });
108
+ const { GeminiTransport } = await import('./run-DSM8v9Sq.mjs').then(function (n) { return n.G; });
109
+ const { DefaultTransport } = await import('./run-DSM8v9Sq.mjs').then(function (n) { return n.D; });
110
110
  let cwd = process.cwd();
111
111
  const filteredArgs = [];
112
112
  for (let i = 0; i < agentArgs.length; i++) {
@@ -235,7 +235,7 @@ async function handleSessionCommand() {
235
235
  printSessionHelp();
236
236
  return;
237
237
  }
238
- const { sessionList, sessionSpawn, sessionStop, sessionInfo, sessionMessages, sessionAttach } = await import('./commands-p36abIvL.mjs');
238
+ const { sessionList, sessionSpawn, sessionStop, sessionInfo, sessionMessages, sessionAttach } = await import('./commands-CEDpieWm.mjs');
239
239
  if (sessionSubcommand === "list" || sessionSubcommand === "ls") {
240
240
  await sessionList();
241
241
  } else if (sessionSubcommand === "spawn") {
@@ -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-aevHxpEl.mjs';
4
+ import { c as connectToHypha } from './run-DSM8v9Sq.mjs';
5
5
  import 'os';
6
6
  import 'fs/promises';
7
7
  import 'fs';
@@ -70,7 +70,7 @@ async function connectAndGetMachine() {
70
70
  const origError = console.error;
71
71
  const stdoutWrite = process.stdout.write.bind(process.stdout);
72
72
  const stderrWrite = process.stderr.write.bind(process.stderr);
73
- const isHyphaLog = (chunk) => typeof chunk === "string" && (chunk.includes("WebSocket") || chunk.includes("Connection established") || chunk.includes("registering service") || chunk.includes("registered") || chunk.includes("Subscribing") || chunk.includes("subscribed") || chunk.includes("Cleaning up") || chunk.includes("disconnected") || chunk.includes("Timeout registering"));
73
+ const isHyphaLog = (chunk) => typeof chunk === "string" && (chunk.includes("WebSocket connection") || chunk.includes("Connection established") || chunk.includes("registering service built-in") || chunk.includes("registered service") || chunk.includes("registered all") || chunk.includes("Subscribing to client_") || chunk.includes("subscribed to client_") || chunk.includes("subscribe to client_") || chunk.includes("Cleaning up all sessions") || chunk.includes("WebSocket connection disconnected") || chunk.includes("local RPC disconnection") || chunk.includes("Timeout registering service") || chunk.includes("Failed to subscribe to client_disconnected") || chunk.includes("Timeout subscribing to client_disconnected"));
74
74
  console.log = () => {
75
75
  };
76
76
  console.warn = () => {
@@ -94,8 +94,6 @@ async function connectAndGetMachine() {
94
94
  console.warn = origWarn;
95
95
  console.info = origInfo;
96
96
  console.error = origError;
97
- process.stdout.write = stdoutWrite;
98
- process.stderr.write = stderrWrite;
99
97
  };
100
98
  let server;
101
99
  try {
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-aevHxpEl.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-DSM8v9Sq.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.7";
2
+ var version = "0.1.9";
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";
@@ -90,8 +90,8 @@ async function registerMachineService(server, machineId, metadata, daemonState,
90
90
  };
91
91
  const serviceInfo = await server.registerService(
92
92
  {
93
- id: `svamp-machine-${machineId}`,
94
- name: `Svamp Machine ${machineId}`,
93
+ id: "default",
94
+ name: `Svamp Machine (${metadata.displayName || machineId})`,
95
95
  type: "svamp-machine",
96
96
  config: { visibility: "public" },
97
97
  // Machine info
@@ -2355,6 +2355,17 @@ const DAEMON_STATE_FILE = join$1(SVAMP_HOME, "daemon.state.json");
2355
2355
  const DAEMON_LOCK_FILE = join$1(SVAMP_HOME, "daemon.lock");
2356
2356
  const LOGS_DIR = join$1(SVAMP_HOME, "logs");
2357
2357
  const SESSIONS_DIR = join$1(SVAMP_HOME, "sessions");
2358
+ function loadAgentConfig() {
2359
+ const configPath = join$1(SVAMP_HOME, "agent-config.json");
2360
+ if (existsSync$1(configPath)) {
2361
+ try {
2362
+ return JSON.parse(readFileSync$1(configPath, "utf-8"));
2363
+ } catch {
2364
+ return {};
2365
+ }
2366
+ }
2367
+ return {};
2368
+ }
2358
2369
  function saveSession(session) {
2359
2370
  if (!existsSync$1(SESSIONS_DIR)) {
2360
2371
  mkdirSync$1(SESSIONS_DIR, { recursive: true });
@@ -2463,6 +2474,10 @@ function isDaemonAlive() {
2463
2474
  }
2464
2475
  async function startDaemon() {
2465
2476
  const logger = createLogger();
2477
+ const agentConfig = loadAgentConfig();
2478
+ if (Object.keys(agentConfig).length > 0) {
2479
+ logger.log("Loaded agent config:", JSON.stringify(agentConfig));
2480
+ }
2466
2481
  let requestShutdown;
2467
2482
  const resolvesWhenShutdownRequested = new Promise((resolve2) => {
2468
2483
  requestShutdown = (source, errorMessage) => {
@@ -2505,7 +2520,20 @@ async function startDaemon() {
2505
2520
  logger.log('Warning: No HYPHA_TOKEN set. Run "svamp login" to authenticate.');
2506
2521
  logger.log("Connecting anonymously...");
2507
2522
  }
2508
- const machineId = process.env.SVAMP_MACHINE_ID || `machine-${os.hostname()}-${randomUUID$1().slice(0, 8)}`;
2523
+ const machineIdFile = join$1(SVAMP_HOME, "machine-id");
2524
+ let machineId = process.env.SVAMP_MACHINE_ID;
2525
+ if (!machineId) {
2526
+ if (existsSync$1(machineIdFile)) {
2527
+ machineId = readFileSync$1(machineIdFile, "utf-8").trim();
2528
+ }
2529
+ if (!machineId) {
2530
+ machineId = `machine-${os.hostname()}-${randomUUID$1().slice(0, 8)}`;
2531
+ try {
2532
+ writeFileSync$1(machineIdFile, machineId, "utf-8");
2533
+ } catch {
2534
+ }
2535
+ }
2536
+ }
2509
2537
  logger.log("Starting svamp daemon...");
2510
2538
  logger.log(` Server: ${hyphaServerUrl}`);
2511
2539
  logger.log(` Workspace: ${hyphaWorkspace || "(default)"}`);
@@ -2553,7 +2581,7 @@ async function startDaemon() {
2553
2581
  }
2554
2582
  }
2555
2583
  const sessionId = options.sessionId || randomUUID$1();
2556
- const agentName = options.agent || "claude";
2584
+ const agentName = options.agent || agentConfig.agent_type || "claude";
2557
2585
  if (agentName !== "claude" && KNOWN_ACP_AGENTS[agentName]) {
2558
2586
  return await spawnAcpSession(sessionId, directory, agentName, options, resumeSessionId);
2559
2587
  }
@@ -2612,10 +2640,10 @@ async function startDaemon() {
2612
2640
  let userMessagePending = false;
2613
2641
  let turnInitiatedByUser = true;
2614
2642
  const spawnClaude = (initialMessage, meta) => {
2615
- const permissionMode = meta?.permissionMode || currentPermissionMode;
2643
+ const permissionMode = meta?.permissionMode || agentConfig.default_permission_mode || currentPermissionMode;
2616
2644
  currentPermissionMode = permissionMode;
2617
- const model = meta?.model || void 0;
2618
- const appendSystemPrompt = meta?.appendSystemPrompt || void 0;
2645
+ const model = meta?.model || agentConfig.default_model || void 0;
2646
+ const appendSystemPrompt = meta?.appendSystemPrompt || agentConfig.append_system_prompt || void 0;
2619
2647
  const mcpConfigPath = join$1(SVAMP_HOME, "logs", `mcp-config-${sessionId}.json`);
2620
2648
  writeFileSync$1(mcpConfigPath, JSON.stringify({
2621
2649
  mcpServers: {
@@ -3445,38 +3473,9 @@ Please ensure the ${agentName} CLI is installed.`
3445
3473
  (async () => {
3446
3474
  try {
3447
3475
  await artifactSync.init();
3448
- const remoteSessions = await artifactSync.listRemoteSessions();
3449
- const localIds = new Set(loadPersistedSessions().map((p) => p.sessionId));
3450
- for (const remote of remoteSessions) {
3451
- if (!localIds.has(remote.sessionId)) {
3452
- logger.log(`[ARTIFACT SYNC] Downloading remote session ${remote.sessionId} (from machine ${remote.machineId || "unknown"})`);
3453
- const downloaded = await artifactSync.downloadSession(remote.sessionId, SESSIONS_DIR);
3454
- if (downloaded?.sessionData) {
3455
- const result = await spawnSession({
3456
- directory: downloaded.sessionData.directory || "/tmp",
3457
- sessionId: remote.sessionId,
3458
- resumeSessionId: downloaded.sessionData.claudeResumeId
3459
- });
3460
- if (result.type === "success") {
3461
- logger.log(`[ARTIFACT SYNC] Restored remote session ${remote.sessionId}`);
3462
- if (remote.machineId && remote.machineId !== machineId) {
3463
- for (const [, tracked] of pidToTrackedSession) {
3464
- if (tracked.svampSessionId === remote.sessionId && tracked.hyphaService) {
3465
- tracked.hyphaService.updateMetadata({
3466
- ...downloaded.sessionData.metadata || {},
3467
- isOrphaned: true,
3468
- originalMachineId: remote.machineId
3469
- });
3470
- break;
3471
- }
3472
- }
3473
- }
3474
- }
3475
- }
3476
- }
3477
- }
3476
+ logger.log(`[ARTIFACT SYNC] Ready (upload-only, remote sessions stay in artifact store)`);
3478
3477
  } catch (err) {
3479
- logger.log(`[ARTIFACT SYNC] Background init/restore failed: ${err.message}`);
3478
+ logger.log(`[ARTIFACT SYNC] Background init failed: ${err.message}`);
3480
3479
  }
3481
3480
  })();
3482
3481
  let appToken;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svamp-cli",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "Svamp CLI — AI workspace daemon on Hypha Cloud",
5
5
  "author": "Amun AI AB",
6
6
  "license": "SEE LICENSE IN LICENSE",