svamp-cli 0.2.200 → 0.2.202

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 (26) hide show
  1. package/dist/{agentCommands-BLig9RpJ.mjs → agentCommands-BMbdp3lO.mjs} +5 -5
  2. package/dist/{auth-BFDgK8NY.mjs → auth-DFV_MjVU.mjs} +1 -1
  3. package/dist/cli.mjs +60 -60
  4. package/dist/{commands-2qJ_Bh8F.mjs → commands-BA8pUB80.mjs} +2 -2
  5. package/dist/{commands-DgCf4FCQ.mjs → commands-CVMpx7Ws.mjs} +5 -5
  6. package/dist/{commands-C0NGT-PG.mjs → commands-CW1VrEei.mjs} +2 -2
  7. package/dist/{commands-NKOF_jF-.mjs → commands-Cbg4_aEA.mjs} +2 -2
  8. package/dist/{commands-C03E7eP5.mjs → commands-Ccbl9q_M.mjs} +44 -2
  9. package/dist/{commands-CrOYWa85.mjs → commands-DfD7ACo-.mjs} +1 -1
  10. package/dist/{commands-DRI2MMHg.mjs → commands-DnTtqcre.mjs} +1 -1
  11. package/dist/{fleet-CaFacVAt.mjs → fleet-Caxg-9CC.mjs} +1 -1
  12. package/dist/{frpc-gMUAwe3q.mjs → frpc-Sq_r6a9i.mjs} +1 -1
  13. package/dist/{headlessCli-DxAlTlhs.mjs → headlessCli-CqDPtg1x.mjs} +2 -2
  14. package/dist/index.mjs +1 -1
  15. package/dist/{package-BNVXH7XA.mjs → package-Df28hcfX.mjs} +2 -2
  16. package/dist/{rpc-GTsR01jv.mjs → rpc-BJKoRzGK.mjs} +24 -19
  17. package/dist/{rpc-_aPtyAzL.mjs → rpc-DXp0vpxD.mjs} +13 -1
  18. package/dist/{run-DyqabMH2.mjs → run-B5xwuwIO.mjs} +1 -1
  19. package/dist/{run-DsGZVxkK.mjs → run-CsqoYIvO.mjs} +34 -13
  20. package/dist/runStore-CtptN7US.mjs +168 -0
  21. package/dist/{scheduler-9mJf0_7T.mjs → scheduler-CSYBbqjZ.mjs} +23 -17
  22. package/dist/{serveCommands-CrjiFbbs.mjs → serveCommands-CHWW6Mon.mjs} +5 -5
  23. package/dist/{serveManager-CtbAmKJ7.mjs → serveManager-CkEjrt25.mjs} +2 -2
  24. package/dist/{sideband-5D9B_PyP.mjs → sideband-BXQYf8dr.mjs} +1 -1
  25. package/dist/{store-DEZ8e-uE.mjs → store-BTs0H_y0.mjs} +1 -1
  26. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
- import { spawn } from 'node:child_process';
2
- import { m as resolveProjectRoot, w as cronMatches } from './run-DsGZVxkK.mjs';
3
- import { l as listWorkflows, i as isWorkflowEnabled, c as workflowCrons, w as workflowSteps } from './store-DEZ8e-uE.mjs';
1
+ import { m as resolveProjectRoot, y as cronMatches } from './run-CsqoYIvO.mjs';
2
+ import { l as listWorkflows, i as isWorkflowEnabled, w as workflowCrons } from './store-BTs0H_y0.mjs';
3
+ import { r as runWorkflow } from './runStore-CtptN7US.mjs';
4
4
  import 'os';
5
5
  import 'fs/promises';
6
6
  import 'fs';
@@ -10,6 +10,7 @@ import 'child_process';
10
10
  import 'crypto';
11
11
  import 'node:crypto';
12
12
  import 'node:fs';
13
+ import 'node:child_process';
13
14
  import 'util';
14
15
  import 'node:path';
15
16
  import 'node:events';
@@ -23,16 +24,6 @@ import 'node:fs/promises';
23
24
  import 'node:util';
24
25
  import 'yaml';
25
26
 
26
- function defaultRunStep(root, command, ownerSession, log) {
27
- try {
28
- const env = ownerSession ? { ...process.env, SVAMP_SESSION_ID: ownerSession } : process.env;
29
- const child = spawn("sh", ["-c", command], { cwd: root, detached: true, stdio: "ignore", env });
30
- child.on("error", (e) => log?.(`[workflow] step spawn error in ${root}: ${e.message}`));
31
- child.unref();
32
- } catch (e) {
33
- log?.(`[workflow] step spawn threw in ${root}: ${e?.message || e}`);
34
- }
35
- }
36
27
  function cronMatchesSafe(expr, date) {
37
28
  try {
38
29
  return cronMatches(expr, date);
@@ -47,6 +38,12 @@ class WorkflowScheduler {
47
38
  // Wall-clock minute we last processed, so multiple sub-minute ticks fire a workflow at most once
48
39
  // per minute (cron granularity is one minute).
49
40
  lastMinuteKey = null;
41
+ // In-flight runs (fire-and-forget). `idle()` awaits them — used by tests; harmless in prod.
42
+ pending = /* @__PURE__ */ new Set();
43
+ /** Await all in-flight scheduled runs (test helper; the daemon never needs to block on these). */
44
+ async idle() {
45
+ await Promise.all([...this.pending]);
46
+ }
50
47
  static minuteKey(d) {
51
48
  return `${d.getFullYear()}-${d.getMonth()}-${d.getDate()}-${d.getHours()}-${d.getMinutes()}`;
52
49
  }
@@ -85,11 +82,20 @@ class WorkflowScheduler {
85
82
  return fired;
86
83
  }
87
84
  fire(root, wf) {
88
- const steps = workflowSteps(wf);
89
85
  const owner = wf.session || null;
90
- this.deps.log?.(`[workflow] schedule fired "${wf.name}" (${steps.length} step${steps.length === 1 ? "" : "s"}) in ${root}${owner ? ` as ${owner}` : ""}`);
91
- const run = this.deps.runStep || ((r, c, o) => defaultRunStep(r, c, o, this.deps.log));
92
- for (const step of steps) run(root, step.run, owner);
86
+ this.deps.log?.(`[workflow] schedule fired "${wf.name}" in ${root}${owner ? ` as ${owner}` : ""}`);
87
+ const p = runWorkflow(root, wf, {
88
+ trigger: "schedule",
89
+ actor: owner,
90
+ execStep: this.deps.execStep,
91
+ now: this.deps.now,
92
+ log: this.deps.log
93
+ }).catch((e) => {
94
+ this.deps.log?.(`[workflow] scheduled run threw for "${wf.name}": ${e?.message || e}`);
95
+ return void 0;
96
+ });
97
+ this.pending.add(p);
98
+ p.finally(() => this.pending.delete(p));
93
99
  }
94
100
  }
95
101
 
@@ -54,7 +54,7 @@ async function handleServeCommand() {
54
54
  }
55
55
  }
56
56
  async function serveAdd(args, machineId) {
57
- const { connectAndGetMachine } = await import('./commands-DRI2MMHg.mjs');
57
+ const { connectAndGetMachine } = await import('./commands-DnTtqcre.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-DRI2MMHg.mjs');
96
+ const { connectAndGetMachine } = await import('./commands-DnTtqcre.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-DRI2MMHg.mjs');
185
+ const { connectAndGetMachine } = await import('./commands-DnTtqcre.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-DRI2MMHg.mjs');
205
+ const { connectAndGetMachine } = await import('./commands-DnTtqcre.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-DRI2MMHg.mjs');
238
+ const { connectAndGetMachine } = await import('./commands-DnTtqcre.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 { k as getHyphaServerUrl, S as ServeAuth, l as hasCookieToken } from './run-DsGZVxkK.mjs';
7
+ import { k as getHyphaServerUrl, S as ServeAuth, l as hasCookieToken } from './run-CsqoYIvO.mjs';
8
8
  import 'os';
9
9
  import 'fs/promises';
10
10
  import 'url';
@@ -733,7 +733,7 @@ class ServeManager {
733
733
  const mount = this.mounts.get(mountName);
734
734
  const subdomainOverride = mount?.access === "link" && mount.linkToken ? /* @__PURE__ */ new Map([[this.port, buildLinkSubdomain(subdomainSafe, mount.linkToken)]]) : void 0;
735
735
  try {
736
- const { FrpcTunnel } = await import('./frpc-gMUAwe3q.mjs');
736
+ const { FrpcTunnel } = await import('./frpc-Sq_r6a9i.mjs');
737
737
  let tunnel;
738
738
  tunnel = new FrpcTunnel({
739
739
  name: tunnelName,
@@ -1,4 +1,4 @@
1
- import { R as READ_ONLY_TOOLS, z as loadMachineContext, A as buildMachineInstructions, B as machineToolsForRole, C as buildMachineTools } from './run-DsGZVxkK.mjs';
1
+ import { R as READ_ONLY_TOOLS, B as loadMachineContext, C as buildMachineInstructions, D as machineToolsForRole, E as buildMachineTools } from './run-CsqoYIvO.mjs';
2
2
  import 'node:child_process';
3
3
  import 'os';
4
4
  import 'fs/promises';
@@ -145,4 +145,4 @@ function removeWorkflow(projectRoot, name) {
145
145
  }
146
146
  }
147
147
 
148
- export { saveWorkflow as a, rawWorkflow as b, workflowCrons as c, getWorkflow as g, isWorkflowEnabled as i, listWorkflows as l, removeWorkflow as r, setWorkflowEnabled as s, workflowSteps as w };
148
+ export { saveWorkflow as a, rawWorkflow as b, workflowSteps as c, workflowsDir as d, getWorkflow as g, isWorkflowEnabled as i, listWorkflows as l, removeWorkflow as r, setWorkflowEnabled as s, workflowCrons as w };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svamp-cli",
3
- "version": "0.2.200",
3
+ "version": "0.2.202",
4
4
  "description": "Svamp CLI — AI workspace daemon on Hypha Cloud",
5
5
  "author": "Amun AI AB",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -20,7 +20,7 @@
20
20
  "scripts": {
21
21
  "build": "rm -rf dist bin/skills && mkdir -p bin/skills && cp -r ../../skills/artifact bin/skills/artifact && cp -r ../../skills/loop bin/skills/loop && cp -r ../../skills/crew bin/skills/crew && tsc --noEmit && pkgroll",
22
22
  "typecheck": "tsc --noEmit",
23
- "test": "npx tsx test/test-context-window.mjs && npx tsx test/test-ratelimit-retry.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-sharing-notify-sync.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-btw-proxy-env.mjs && npx tsx test/test-output-formatters.mjs && npx tsx test/test-inbox-guard.mjs && npx tsx test/test-auto-topic.mjs && npx tsx test/test-project-info.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-store.mjs && npx tsx test/test-inbox.mjs && npx tsx test/test-inbox-cross-machine.mjs && npx tsx test/test-issue-store.mjs && npx tsx test/test-issue-close-gate.mjs && npx tsx test/test-issue-rpc.mjs && npx tsx test/test-workflow-store.mjs && npx tsx test/test-workflow-rpc.mjs && npx tsx test/test-workflow-scheduler.mjs && npx tsx test/test-serve-link-subdomain.mjs && npx tsx test/test-short-id.mjs && npx tsx test/test-transcript-edit.mjs && npx tsx test/test-edit-history.mjs && npx tsx test/test-friendly-name.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 && npx tsx test/test-frpc-status.mjs && node test/pinnedClaudeCode.test.mjs && node test/fleet.test.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-hotreload-seam.mjs && npx tsx test/test-hot-reload.mjs && npx tsx test/test-hot-reload-live.mjs && npx tsx test/test-session-core.mjs && npx tsx test/test-channel-async-reply.mjs && npx tsx test/test-channel-binding.mjs && npx tsx test/test-channel-identity.mjs && npx tsx test/test-shared-session-identity.mjs && npx tsx test/test-wise-agent-auth.mjs && npx tsx test/test-channel-http.mjs && npx tsx test/test-channel-upload.mjs && npx tsx test/test-wise-voice.mjs && npx tsx test/test-wise-headless.mjs && npx tsx test/test-wise-machine.mjs && npx tsx test/test-crew-merge.mjs && npx tsx test/test-crew-verdict-routing.mjs && npx tsx test/test-crew-standalone.mjs",
23
+ "test": "npx tsx test/test-context-window.mjs && npx tsx test/test-ratelimit-retry.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-sharing-notify-sync.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-btw-proxy-env.mjs && npx tsx test/test-output-formatters.mjs && npx tsx test/test-inbox-guard.mjs && npx tsx test/test-auto-topic.mjs && npx tsx test/test-project-info.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-store.mjs && npx tsx test/test-inbox.mjs && npx tsx test/test-inbox-cross-machine.mjs && npx tsx test/test-issue-store.mjs && npx tsx test/test-issue-close-gate.mjs && npx tsx test/test-issue-rpc.mjs && npx tsx test/test-issue-pause.mjs && npx tsx test/test-workflow-store.mjs && npx tsx test/test-workflow-rpc.mjs && npx tsx test/test-workflow-scheduler.mjs && npx tsx test/test-workflow-runs.mjs && npx tsx test/test-serve-link-subdomain.mjs && npx tsx test/test-short-id.mjs && npx tsx test/test-transcript-edit.mjs && npx tsx test/test-edit-history.mjs && npx tsx test/test-friendly-name.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 && npx tsx test/test-frpc-status.mjs && node test/pinnedClaudeCode.test.mjs && node test/fleet.test.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-hotreload-seam.mjs && npx tsx test/test-hot-reload.mjs && npx tsx test/test-hot-reload-live.mjs && npx tsx test/test-session-core.mjs && npx tsx test/test-channel-async-reply.mjs && npx tsx test/test-channel-binding.mjs && npx tsx test/test-channel-identity.mjs && npx tsx test/test-shared-session-identity.mjs && npx tsx test/test-wise-agent-auth.mjs && npx tsx test/test-channel-http.mjs && npx tsx test/test-channel-upload.mjs && npx tsx test/test-wise-voice.mjs && npx tsx test/test-wise-headless.mjs && npx tsx test/test-wise-machine.mjs && npx tsx test/test-crew-merge.mjs && npx tsx test/test-crew-verdict-routing.mjs && npx tsx test/test-crew-standalone.mjs",
24
24
  "test:hypha": "node --no-warnings test/test-hypha-service.mjs",
25
25
  "dev": "tsx src/cli.ts",
26
26
  "dev:daemon": "tsx src/cli.ts daemon start-sync",