svamp-cli 0.2.97 → 0.2.100

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.
Files changed (41) hide show
  1. package/README.md +7 -5
  2. package/bin/skills/loop/IMPLEMENTATION_PROGRESS.md +49 -0
  3. package/bin/skills/loop/SKILL.md +99 -0
  4. package/bin/skills/loop/bin/channel-core.mjs +161 -0
  5. package/bin/skills/loop/bin/channel-server.mjs +151 -0
  6. package/bin/skills/loop/bin/inject-loop.mjs +41 -0
  7. package/bin/skills/loop/bin/loop-init.mjs +128 -0
  8. package/bin/skills/loop/bin/loop-status.mjs +38 -0
  9. package/bin/skills/loop/bin/precompact.mjs +27 -0
  10. package/bin/skills/loop/bin/routine-cli.mjs +121 -0
  11. package/bin/skills/loop/bin/routine-core.mjs +126 -0
  12. package/bin/skills/loop/bin/routine-runner.mjs +125 -0
  13. package/bin/skills/loop/bin/routine-store.mjs +49 -0
  14. package/bin/skills/loop/bin/state-fp.mjs +113 -0
  15. package/bin/skills/loop/bin/stop-gate.mjs +170 -0
  16. package/bin/skills/loop/routines.process.yaml +20 -0
  17. package/bin/skills/loop/test/test-channel-core.mjs +86 -0
  18. package/bin/skills/loop/test/test-loop-gate.mjs +246 -0
  19. package/bin/skills/loop/test/test-routine-core.mjs +54 -0
  20. package/bin/skills/loop/test/test-routine-engine.mjs +122 -0
  21. package/dist/{agentCommands-PROItll1.mjs → agentCommands-muy26BZI.mjs} +2 -2
  22. package/dist/{auth-LNLCvIUL.mjs → auth-RVq9wRhV.mjs} +1 -1
  23. package/dist/{caddy-BMbX-mFX.mjs → caddy-CuTbE3NY.mjs} +1 -14
  24. package/dist/cli.mjs +76 -77
  25. package/dist/{commands-ClSwaEXa.mjs → commands-ChzeHFd3.mjs} +1 -1
  26. package/dist/{commands-CFxWo-VJ.mjs → commands-Cu96nDGv.mjs} +2 -2
  27. package/dist/{commands-x6AC67Cu.mjs → commands-EwE87XNi.mjs} +1 -1
  28. package/dist/{commands-DlINkyF8.mjs → commands-lSqc48Ib.mjs} +6 -6
  29. package/dist/{commands-Bns4qGm-.mjs → commands-rSREfaQg.mjs} +34 -42
  30. package/dist/{fleet-CFRUR0Zf.mjs → fleet-qN96q6Qb.mjs} +1 -1
  31. package/dist/{frpc-BLM1a3zD.mjs → frpc-CIkmTNdJ.mjs} +2 -15
  32. package/dist/{headlessCli-DmyX9JHV.mjs → headlessCli-BVcAcLr1.mjs} +2 -2
  33. package/dist/index.mjs +1 -1
  34. package/dist/package-B7S5w1VE.mjs +63 -0
  35. package/dist/{run-W3GQKGcB.mjs → run-CdtYIBbd.mjs} +202 -709
  36. package/dist/{run-I7IbKfRn.mjs → run-zXRdkYtk.mjs} +1 -1
  37. package/dist/{serveCommands-B2BdjSVA.mjs → serveCommands-BZd0reEj.mjs} +5 -5
  38. package/dist/{serveManager-Dc28oGob.mjs → serveManager-lmPtmRnR.mjs} +3 -3
  39. package/dist/{sideband-DXtnQ9F-.mjs → sideband-JeID_jF-.mjs} +1 -1
  40. package/package.json +3 -3
  41. package/dist/package-DG-a1zOR.mjs +0 -63
@@ -2,7 +2,7 @@ import { existsSync, readFileSync } from 'node:fs';
2
2
  import { execSync } from 'node:child_process';
3
3
  import { basename, resolve, join } from 'node:path';
4
4
  import os from 'node:os';
5
- import { F as normalizeAllowedUser, G as loadSecurityContextConfig, H as resolveSecurityContext, I as buildSecurityContextFromFlags, J as mergeSecurityContexts, c as connectToHypha, K as buildSessionShareUrl, L as computeOutboundHop, M as buildMachineShareUrl } from './run-W3GQKGcB.mjs';
5
+ import { F as normalizeAllowedUser, G as loadSecurityContextConfig, H as resolveSecurityContext, I as buildSecurityContextFromFlags, J as mergeSecurityContexts, c as connectToHypha, K as buildSessionShareUrl, L as computeOutboundHop, M as buildMachineShareUrl } from './run-CdtYIBbd.mjs';
6
6
  import 'os';
7
7
  import 'fs/promises';
8
8
  import 'fs';
@@ -1221,8 +1221,7 @@ async function sessionInfo(sessionId, machineId, opts) {
1221
1221
  sessionLink: metadata.sessionLink?.url || void 0,
1222
1222
  tags: metadata.tags?.length ? metadata.tags : void 0,
1223
1223
  parentSessionId: metadata.parentSessionId || void 0,
1224
- pendingPermissions: pendingPermissions.length > 0 ? pendingPermissions : void 0,
1225
- ralphLoop: metadata.ralphLoop || void 0
1224
+ pendingPermissions: pendingPermissions.length > 0 ? pendingPermissions : void 0
1226
1225
  };
1227
1226
  if (opts?.json) {
1228
1227
  console.log(formatJson(statusData));
@@ -2263,69 +2262,62 @@ async function machineLs(machineId, path, showHidden) {
2263
2262
  await server.disconnect();
2264
2263
  }
2265
2264
  }
2266
- async function sessionRalphStart(sessionIdPartial, task, machineId, opts) {
2265
+ async function sessionLoopStart(sessionIdPartial, task, machineId, opts) {
2267
2266
  const { server, machine, fullId } = await connectAndResolveSession(sessionIdPartial, machineId);
2268
2267
  try {
2269
2268
  const svc = getSessionProxy(machine, fullId);
2270
- const { metadata } = await svc.getMetadata();
2271
- if (metadata?.ralphLoop?.active) {
2272
- console.error(`Ralph loop is already active (iteration ${metadata.ralphLoop.currentIteration}). Cancel it first with: svamp session ralph-cancel ${sessionIdPartial}`);
2273
- process.exit(1);
2274
- }
2275
- const completionPromise = opts?.completionPromise || "DONE";
2276
- const maxIterations = opts?.maxIterations ?? 0;
2277
- const cooldownSeconds = opts?.cooldownSeconds ?? 1;
2278
- const contextMode = opts?.contextMode || void 0;
2269
+ const maxIterations = opts?.maxIterations ?? 20;
2270
+ const evaluator = opts?.evaluator !== false;
2279
2271
  await svc.updateConfig({
2280
- ralph_loop: {
2272
+ loop: {
2281
2273
  task,
2282
- completion_promise: completionPromise,
2274
+ ...opts?.criteria ? { criteria: opts.criteria } : {},
2275
+ ...opts?.oracle ? { oracle: opts.oracle } : {},
2283
2276
  max_iterations: maxIterations,
2284
- cooldown_seconds: cooldownSeconds,
2285
- ...contextMode ? { context_mode: contextMode } : {}
2277
+ evaluator
2286
2278
  }
2287
2279
  });
2288
- console.log(`Ralph loop started on session ${fullId.slice(0, 8)}`);
2280
+ console.log(`Loop started on session ${fullId.slice(0, 8)}`);
2289
2281
  console.log(` Task: ${task.slice(0, 100)}${task.length > 100 ? "..." : ""}`);
2290
- console.log(` Completion promise: ${completionPromise}`);
2291
- console.log(` Max iterations: ${maxIterations > 0 ? maxIterations : "unlimited"}`);
2292
- if (contextMode) console.log(` Context mode: ${contextMode}`);
2282
+ if (opts?.criteria) console.log(` Success criteria: ${opts.criteria.slice(0, 100)}`);
2283
+ console.log(` Oracle: ${opts?.oracle || "(none)"}`);
2284
+ console.log(` Evaluator: ${evaluator ? "on" : "off"}`);
2285
+ console.log(` Max iterations: ${maxIterations}`);
2293
2286
  } finally {
2294
2287
  await server.disconnect();
2295
2288
  }
2296
2289
  }
2297
- async function sessionRalphCancel(sessionIdPartial, machineId) {
2290
+ async function sessionLoopCancel(sessionIdPartial, machineId) {
2298
2291
  const { server, machine, fullId } = await connectAndResolveSession(sessionIdPartial, machineId);
2299
2292
  try {
2300
2293
  const svc = getSessionProxy(machine, fullId);
2301
- const { metadata } = await svc.getMetadata();
2302
- if (!metadata?.ralphLoop?.active) {
2303
- console.log("No active Ralph loop on this session.");
2304
- return;
2305
- }
2306
- const iteration = metadata.ralphLoop.currentIteration;
2307
- await svc.updateConfig({ ralph_loop: null });
2308
- console.log(`Ralph loop cancelled on session ${fullId.slice(0, 8)} (was at iteration ${iteration})`);
2294
+ await svc.updateConfig({ loop: null });
2295
+ console.log(`Loop cancelled on session ${fullId.slice(0, 8)}`);
2309
2296
  } finally {
2310
2297
  await server.disconnect();
2311
2298
  }
2312
2299
  }
2313
- async function sessionRalphStatus(sessionIdPartial, machineId) {
2300
+ async function sessionLoopStatus(sessionIdPartial, machineId) {
2314
2301
  const { server, machine, fullId } = await connectAndResolveSession(sessionIdPartial, machineId);
2315
2302
  try {
2316
2303
  const svc = getSessionProxy(machine, fullId);
2317
- const { metadata } = await svc.getMetadata();
2318
- const ralph = metadata?.ralphLoop;
2319
- if (!ralph || !ralph.active) {
2320
- console.log("No Ralph loop configured on this session.");
2304
+ let state = null;
2305
+ try {
2306
+ const raw = await svc.readFile(".claude/loop/loop-state.json");
2307
+ const content = typeof raw === "string" ? raw : raw?.content;
2308
+ if (content) state = JSON.parse(Buffer.from(content, "base64").toString("utf-8"));
2309
+ } catch {
2310
+ }
2311
+ if (!state) {
2312
+ console.log("No loop configured on this session.");
2321
2313
  return;
2322
2314
  }
2323
- console.log(`Ralph loop on session ${fullId.slice(0, 8)}:`);
2324
- console.log(` Active: ${ralph.active}`);
2325
- console.log(` Task: ${ralph.task?.slice(0, 100)}${ralph.task?.length > 100 ? "..." : ""}`);
2326
- console.log(` Completion promise: ${ralph.completionPromise}`);
2327
- console.log(` Iteration: ${ralph.currentIteration}${ralph.maxIterations > 0 ? `/${ralph.maxIterations}` : " (unlimited)"}`);
2328
- console.log(` Started at: ${ralph.startedAt}`);
2315
+ console.log(`Loop on session ${fullId.slice(0, 8)}:`);
2316
+ console.log(` Phase: ${state.phase || (state.active === false ? "inactive" : "running")}`);
2317
+ console.log(` Iteration: ${state.iteration ?? 0}`);
2318
+ if (state.last_oracle) console.log(` Last oracle: ${String(state.last_oracle).split("\n")[0]}`);
2319
+ if (state.gave_up_reason) console.log(` Gave up: ${state.gave_up_reason}`);
2320
+ if (state.started_at) console.log(` Started at: ${state.started_at}`);
2329
2321
  } finally {
2330
2322
  await server.disconnect();
2331
2323
  }
@@ -2463,4 +2455,4 @@ async function sessionInboxClear(sessionIdPartial, machineId, opts) {
2463
2455
  }
2464
2456
  }
2465
2457
 
2466
- export { collectAssistantResponse, connectAndGetMachine, connectAndResolveSession, createWorktree, generateWorktreeName, machineExec, machineInfo, machineLs, machineShare, parseShareArg, queryCore, renderMessage, resolveSessionId, sendCore, sessionApprove, sessionArchive, sessionAttach, sessionDelete, sessionDeny, sessionInboxClear, sessionInboxList, sessionInboxRead, sessionInboxReply, sessionInboxSend, sessionInfo, sessionList, sessionMachines, sessionMessages, sessionQuery, sessionRalphCancel, sessionRalphStart, sessionRalphStatus, sessionResume, sessionSend, sessionShare, sessionSpawn, sessionWait, sessionWhoami, snapshotLatestSeq, validateSendOptions, wiseAskCli };
2458
+ export { collectAssistantResponse, connectAndGetMachine, connectAndResolveSession, createWorktree, generateWorktreeName, machineExec, machineInfo, machineLs, machineShare, parseShareArg, queryCore, renderMessage, resolveSessionId, sendCore, sessionApprove, sessionArchive, sessionAttach, sessionDelete, sessionDeny, sessionInboxClear, sessionInboxList, sessionInboxRead, sessionInboxReply, sessionInboxSend, sessionInfo, sessionList, sessionLoopCancel, sessionLoopStart, sessionLoopStatus, sessionMachines, sessionMessages, sessionQuery, sessionResume, sessionSend, sessionShare, sessionSpawn, sessionWait, sessionWhoami, snapshotLatestSeq, validateSendOptions, wiseAskCli };
@@ -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-W3GQKGcB.mjs';
4
+ import { c as connectToHypha } from './run-CdtYIBbd.mjs';
5
5
  import { PINNED_CLAUDE_CODE_VERSION } from './pinnedClaudeCode-HydRNEt7.mjs';
6
6
  import 'os';
7
7
  import 'fs/promises';
@@ -3,7 +3,7 @@ import { mkdirSync, writeFileSync, unlinkSync, existsSync, chmodSync, readFileSy
3
3
  import { join } from 'path';
4
4
  import { homedir, platform, arch } from 'os';
5
5
  import { createHash, randomUUID } from 'crypto';
6
- import { h as getFrpsSubdomainHost, i as getFrpsServerPort, j as getFrpsServerAddr } from './run-W3GQKGcB.mjs';
6
+ import { h as getFrpsSubdomainHost, i as getFrpsServerPort, j as getFrpsServerAddr } from './run-CdtYIBbd.mjs';
7
7
  import 'fs/promises';
8
8
  import 'url';
9
9
  import 'node:fs';
@@ -79,19 +79,6 @@ function getFrpcDownloadUrl() {
79
79
  const filename = `frp_${FRP_VERSION}_${osStr}_${archStr}`;
80
80
  return `https://github.com/fatedier/frp/releases/download/v${FRP_VERSION}/${filename}.${ext}`;
81
81
  }
82
- function isFrpcAvailable() {
83
- if (existsSync(FRPC_BIN)) return true;
84
- try {
85
- execSync("frpc --version", { stdio: "ignore" });
86
- return true;
87
- } catch {
88
- return false;
89
- }
90
- }
91
- function getFrpcPath() {
92
- if (existsSync(FRPC_BIN)) return FRPC_BIN;
93
- return "frpc";
94
- }
95
82
  async function ensureFrpc(log) {
96
83
  if (existsSync(FRPC_BIN)) {
97
84
  try {
@@ -551,4 +538,4 @@ async function runFrpcTunnel(name, ports, serverConfig, tunnelOptions) {
551
538
  }
552
539
  }
553
540
 
554
- export { FrpcTunnel, ensureFrpc, generateFrpcConfig, getFrpcPath, isFrpcAvailable, runFrpcTunnel };
541
+ export { FrpcTunnel, ensureFrpc, generateFrpcConfig, runFrpcTunnel };
@@ -1,5 +1,5 @@
1
- import { E as resolveModel, N as describeMisconfiguration, O as buildMachineDeps } from './run-W3GQKGcB.mjs';
2
- import { handleRealtimeEvent, initMachineVoiceSession } from './sideband-DXtnQ9F-.mjs';
1
+ import { E as resolveModel, N as describeMisconfiguration, O as buildMachineDeps } from './run-CdtYIBbd.mjs';
2
+ import { handleRealtimeEvent, initMachineVoiceSession } from './sideband-JeID_jF-.mjs';
3
3
  import { WebSocket } from 'ws';
4
4
  import { execSync, spawn } from 'child_process';
5
5
  import 'os';
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { c as connectToHypha, a as createSessionStore, d as daemonStatus, g as getHyphaServerUrl, r as registerMachineService, s as startDaemon, b as stopDaemon } from './run-W3GQKGcB.mjs';
1
+ export { c as connectToHypha, a as createSessionStore, d as daemonStatus, g as getHyphaServerUrl, r as registerMachineService, s as startDaemon, b as stopDaemon } from './run-CdtYIBbd.mjs';
2
2
  import 'os';
3
3
  import 'fs/promises';
4
4
  import 'fs';
@@ -0,0 +1,63 @@
1
+ var name = "svamp-cli";
2
+ var version = "0.2.100";
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: "rm -rf dist bin/skills && mkdir -p bin/skills && cp -r ../../skills/artifact bin/skills/artifact && cp -r ../../skills/loop bin/skills/loop && tsc --noEmit && pkgroll",
21
+ typecheck: "tsc --noEmit",
22
+ test: "npx tsx test/test-context-window.mjs && npx tsx test/test-instance-config.mjs && npx tsx test/test-authorize.mjs && npx tsx test/test-normalize-allowed-user.mjs && npx tsx test/test-share-url.mjs && npx tsx test/test-update-sharing-normalization.mjs && npx tsx test/test-staged-homes-sweep.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-isolation-decision.mjs && npx tsx test/test-loop-activation.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-claude-auth.mjs && npx tsx test/test-output-formatters.mjs && npx tsx test/test-inbox-guard.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-session-send-query.mjs && npx tsx test/test-skills.mjs && npx tsx test/test-agent-grouping.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-supervisor-lock.mjs && node test/test-supervisor-restart.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 && npx tsx test/test-serve-stability.mjs && npx tsx test/test-frpc-e2e.mjs --unit-only && node test/pinnedClaudeCode.test.mjs && node test/fleet.test.mjs && npx tsx test/test-routine.mjs && npx tsx test/test-routine-rpc.mjs && npx tsx test/test-session-file.mjs && npx tsx test/test-channel-rpc.mjs && npx tsx test/test-wise-agent.mjs && npx tsx test/test-channel-agent.mjs && npx tsx test/test-channels-service.mjs && npx tsx test/test-wise-agent-auth.mjs && npx tsx test/test-channel-http.mjs && npx tsx test/test-wise-voice.mjs && npx tsx test/test-wise-headless.mjs && npx tsx test/test-wise-machine.mjs",
23
+ "test:hypha": "node --no-warnings test/test-hypha-service.mjs",
24
+ dev: "tsx src/cli.ts",
25
+ "dev:daemon": "tsx src/cli.ts daemon start-sync",
26
+ "test:e2e": "node --no-warnings test/e2e-session-tests.mjs",
27
+ "test:frpc": "npx tsx test/test-frpc-e2e.mjs"
28
+ };
29
+ var dependencies = {
30
+ "@agentclientprotocol/sdk": "^0.14.1",
31
+ "@modelcontextprotocol/sdk": "^1.25.3",
32
+ "hypha-rpc": "0.21.40",
33
+ "node-pty": "1.2.0-beta.11",
34
+ ws: "^8.18.0",
35
+ yaml: "^2.8.2",
36
+ zod: "^3.24.4"
37
+ };
38
+ var devDependencies = {
39
+ "@types/node": ">=20",
40
+ "@types/ws": "^8.5.14",
41
+ pkgroll: "^2.14.2",
42
+ tsx: "^4.20.6",
43
+ typescript: "5.9.3"
44
+ };
45
+ var packageManager = "yarn@1.22.22";
46
+ var _package = {
47
+ name: name,
48
+ version: version,
49
+ description: description,
50
+ author: author,
51
+ license: license,
52
+ type: type,
53
+ bin: bin,
54
+ files: files,
55
+ main: main,
56
+ exports: exports$1,
57
+ scripts: scripts,
58
+ dependencies: dependencies,
59
+ devDependencies: devDependencies,
60
+ packageManager: packageManager
61
+ };
62
+
63
+ export { author, bin, _package as default, dependencies, description, devDependencies, exports$1 as exports, files, license, main, name, packageManager, scripts, type, version };