svamp-cli 0.2.342 → 0.2.356

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 (67) hide show
  1. package/bin/skills/artifact/SKILL.md +19 -5
  2. package/bin/skills/crew/SKILL.md +62 -13
  3. package/dist/DefaultTransport-vfp78fug.mjs +47 -0
  4. package/dist/GeminiTransport-3OkhtFRO.mjs +130 -0
  5. package/dist/KimiTransport-D8n009Tr.mjs +141 -0
  6. package/dist/acpAgentConfig-CObOPlA8.mjs +48 -0
  7. package/dist/acpBackend-UaBD4zL3.mjs +925 -0
  8. package/dist/{adminCommands-CRTBDZan.mjs → adminCommands-BvsYnRDA.mjs} +2 -18
  9. package/dist/{agentCommands-BuO988tJ.mjs → agentCommands-D91RcjqQ.mjs} +6 -23
  10. package/dist/api-BHjyC0Ph.mjs +157 -0
  11. package/dist/{auth--WS0wezs.mjs → auth-CRz8TsEl.mjs} +1 -22
  12. package/dist/bootStatus-DqtNgJch.mjs +143 -0
  13. package/dist/claudeAuth-C0wc1GTM.mjs +291 -0
  14. package/dist/cli.mjs +2948 -5
  15. package/dist/codexAppServerBackend-VGsYtbqg.mjs +786 -0
  16. package/dist/codexProvider-BtxYc5Rj.mjs +68 -0
  17. package/dist/{commands-DDuGBSsz.mjs → commands-B-yczgz_.mjs} +115 -49
  18. package/dist/{commands-DU4B-4Gh.mjs → commands-BMeDrpSv.mjs} +55 -25
  19. package/dist/{commands-DXLOKJOj.mjs → commands-BbmypSgx.mjs} +62 -27
  20. package/dist/{commands-C0HQiu-S.mjs → commands-BkdbelFo.mjs} +78 -38
  21. package/dist/{commands-DXM17M6n.mjs → commands-C13-yE2R.mjs} +42 -19
  22. package/dist/{commands-BKb1g8Gq.mjs → commands-CoOc4qiw.mjs} +20 -30
  23. package/dist/{commands-BsKgZ5sQ.mjs → commands-DW5RnHZw.mjs} +2 -19
  24. package/dist/{commands-Cwxy-C5N.mjs → commands-sPvRcG3J.mjs} +10 -32
  25. package/dist/cron-hHGdb5kU.mjs +132 -0
  26. package/dist/detectIsolation-CrV8IFDv.mjs +339 -0
  27. package/dist/envFlag-COOuJ3AH.mjs +11 -0
  28. package/dist/fileLock-BMPwCrB6.mjs +80 -0
  29. package/dist/{fleet-BHzlAvnu.mjs → fleet-Ca-UjJNL.mjs} +122 -36
  30. package/dist/flushExit-C-i6SGjj.mjs +37 -0
  31. package/dist/friendlyName-1UZcyDhu.mjs +586 -0
  32. package/dist/{headlessCli-C2gvOpOt.mjs → headlessCli-C8HzQvis.mjs} +3 -21
  33. package/dist/hookSettings-FFc1pi8j.mjs +10546 -0
  34. package/dist/{httpServer-Be1Hcddr.mjs → httpServer-BzEDbOGn.mjs} +14 -5
  35. package/dist/hyphaClient-ybivOjZo.mjs +49 -0
  36. package/dist/index.mjs +40 -8
  37. package/dist/instance-CeHz5C8v.mjs +203 -0
  38. package/dist/kimiProvider-DbxODebR.mjs +69 -0
  39. package/dist/kimiSetup-NGsoYB5h.mjs +48 -0
  40. package/dist/loopVerify-DALtTk2V.mjs +444 -0
  41. package/dist/machineTools-DygM1jXW.mjs +580 -0
  42. package/dist/model-CUHojegn.mjs +66 -0
  43. package/dist/{notifyCommands-0aZUwKQK.mjs → notifyCommands-CCUE18Q-.mjs} +3 -18
  44. package/dist/package-BrsiNutS.mjs +64 -0
  45. package/dist/pinnedCodex-XW4qvOAe.mjs +11 -0
  46. package/dist/pinnedNono-5ZHb6328.mjs +15 -0
  47. package/dist/{rpc-rAQQ1q8t.mjs → rpc-CBkSkzsI.mjs} +38 -6
  48. package/dist/{rpc-B2Lc2BAB.mjs → rpc-ccY7xvlo.mjs} +33 -22
  49. package/dist/{run-C7QVfyw4.mjs → run-DCq3aEiF.mjs} +17 -9
  50. package/dist/run-DDmeV9K3.mjs +9826 -0
  51. package/dist/sandboxDetect-Cdzsj5TC.mjs +19 -0
  52. package/dist/{scheduler-CzF4lOe_.mjs → scheduler-BkVJ27Ki.mjs} +38 -6
  53. package/dist/securityContext-Cm5UTCuD.mjs +218 -0
  54. package/dist/serveAuth-4M0vwMyj.mjs +460 -0
  55. package/dist/{serveCommands-EIEqdaVu.mjs → serveCommands-CLhkccJM.mjs} +13 -34
  56. package/dist/sharingNotificationSync-qGIQ-3yf.mjs +359 -0
  57. package/dist/{sideband-BoutiRJi.mjs → sideband-68HhGT0i.mjs} +1 -21
  58. package/dist/store-B4E6NzG6.mjs +356 -0
  59. package/dist/store-fi0f-ff1.mjs +184 -0
  60. package/dist/types-57J3Re0n.mjs +17 -0
  61. package/dist/wantsHelp-6bMOeNUz.mjs +5 -0
  62. package/dist/wrapCommand-CdNawSaa.mjs +117 -0
  63. package/package.json +3 -3
  64. package/dist/cli-B24CmIli.mjs +0 -2780
  65. package/dist/package-CTbGYaJG.mjs +0 -64
  66. package/dist/run-CF4kAVPW.mjs +0 -26508
  67. package/dist/sandboxDetect-DNTcbgWD.mjs +0 -12
@@ -0,0 +1,68 @@
1
+ function codexPermissionSettings(mode) {
2
+ switch (mode) {
3
+ case "yolo":
4
+ case "bypassPermissions":
5
+ case "danger-full-access":
6
+ return { approvalPolicy: "never", sandbox: "danger-full-access" };
7
+ case "safe-yolo":
8
+ case "acceptEdits":
9
+ return { approvalPolicy: "on-failure", sandbox: "workspace-write" };
10
+ case "read-only":
11
+ case "plan":
12
+ return { approvalPolicy: "on-request", sandbox: "read-only" };
13
+ case "default":
14
+ default:
15
+ return { approvalPolicy: "on-request", sandbox: "workspace-write" };
16
+ }
17
+ }
18
+ const CODEX_PROVIDER_KEY_ENV = "SVAMP_CODEX_API_KEY";
19
+ const PROVIDER_NAME = "svamp";
20
+ function resolveCodexProvider(env = process.env) {
21
+ return {
22
+ apiBase: env.SVAMP_CODEX_API_BASE || env.LLM_API_BASE || void 0,
23
+ apiKey: env.SVAMP_CODEX_API_KEY || env.LLM_API_KEY || void 0,
24
+ model: env.SVAMP_CODEX_MODEL || env.LLM_MODEL || void 0
25
+ };
26
+ }
27
+ function hasCustomProvider(cfg) {
28
+ return !!(cfg.apiBase && cfg.apiKey);
29
+ }
30
+ function buildCodexProviderArgs(cfg) {
31
+ if (!hasCustomProvider(cfg)) {
32
+ return { configArgs: cfg.model ? ["-c", `model=${JSON.stringify(cfg.model)}`] : [], env: {}, model: cfg.model };
33
+ }
34
+ const configArgs = [
35
+ "-c",
36
+ `model_provider=${JSON.stringify(PROVIDER_NAME)}`,
37
+ "-c",
38
+ `model_providers.${PROVIDER_NAME}.name=${JSON.stringify(PROVIDER_NAME)}`,
39
+ "-c",
40
+ `model_providers.${PROVIDER_NAME}.base_url=${JSON.stringify(cfg.apiBase)}`,
41
+ "-c",
42
+ `model_providers.${PROVIDER_NAME}.env_key=${JSON.stringify(CODEX_PROVIDER_KEY_ENV)}`,
43
+ "-c",
44
+ `model_providers.${PROVIDER_NAME}.wire_api=${JSON.stringify("responses")}`
45
+ ];
46
+ if (cfg.model) configArgs.push("-c", `model=${JSON.stringify(cfg.model)}`);
47
+ return { configArgs, env: { [CODEX_PROVIDER_KEY_ENV]: cfg.apiKey }, model: cfg.model };
48
+ }
49
+ function codexForcedModel(env = process.env) {
50
+ const f = (env.SVAMP_CODEX_FORCE_MODEL || "").toLowerCase();
51
+ if (!f || f === "0" || f === "false" || f === "no" || f === "off") return void 0;
52
+ return env.SVAMP_CODEX_MODEL || env.LLM_MODEL || void 0;
53
+ }
54
+ function codexModelMenu(env = process.env) {
55
+ return (env.SVAMP_CODEX_MODELS || "").split(",").map((s) => s.trim()).filter(Boolean).filter((m, i, a) => a.indexOf(m) === i);
56
+ }
57
+ function codexDefaultModel(env = process.env) {
58
+ const menu = codexModelMenu(env);
59
+ return env.SVAMP_CODEX_MODEL || env.LLM_MODEL || menu[0] || void 0;
60
+ }
61
+ function codexClampModel(requested, env = process.env) {
62
+ const menu = codexModelMenu(env);
63
+ if (!menu.length) return requested;
64
+ if (requested && menu.includes(requested)) return requested;
65
+ return codexDefaultModel(env);
66
+ }
67
+
68
+ export { CODEX_PROVIDER_KEY_ENV, buildCodexProviderArgs, codexClampModel, codexDefaultModel, codexForcedModel, codexModelMenu, codexPermissionSettings, hasCustomProvider, resolveCodexProvider };
@@ -2,24 +2,19 @@ import { existsSync, readFileSync, writeFileSync } from 'node:fs';
2
2
  import { execSync, execFileSync } from 'node:child_process';
3
3
  import { basename, resolve, join, isAbsolute } from 'node:path';
4
4
  import os from 'node:os';
5
- import { a5 as formatHandle, a6 as normalizeAllowedUser, a7 as loadSecurityContextConfig, a8 as resolveSecurityContext, a9 as buildSecurityContextFromFlags, aa as mergeSecurityContexts, c as connectToHypha, ab as buildSessionShareUrl, ac as computeOutboundHop, e as shortId, ad as registerAwaitingReply, ae as buildMachineShareUrl, af as parseHandle, ag as handleMatchesMetadata } from './run-CF4kAVPW.mjs';
6
- import 'os';
7
- import 'fs/promises';
5
+ import { c as connectToHypha } from './hyphaClient-ybivOjZo.mjs';
6
+ import { f as formatHandle, c as computeOutboundHop, s as shortId, r as registerAwaitingReply, p as parseHandle, h as handleMatchesMetadata } from './friendlyName-1UZcyDhu.mjs';
7
+ import { n as normalizeAllowedUser } from './types-57J3Re0n.mjs';
8
+ import { loadSecurityContextConfig, resolveSecurityContext, buildSecurityContextFromFlags, mergeSecurityContexts } from './securityContext-Cm5UTCuD.mjs';
9
+ import { b as buildSessionShareUrl, U as UNBOUNDED_LOOP_ITERATIONS, a as buildMachineShareUrl } from './loopVerify-DALtTk2V.mjs';
10
+ import { f as flushStdout } from './flushExit-C-i6SGjj.mjs';
11
+ import 'node:crypto';
12
+ import './instance-CeHz5C8v.mjs';
8
13
  import 'fs';
9
14
  import 'path';
10
- import 'url';
11
- import 'child_process';
12
- import 'crypto';
13
- import 'node:crypto';
14
- import 'util';
15
- import 'http';
16
- import 'net';
17
- import 'node:events';
18
- import '@agentclientprotocol/sdk';
19
- import 'node:util';
20
- import 'node:readline';
21
- import 'node:fs/promises';
22
- import 'yaml';
15
+ import 'os';
16
+ import './store-B4E6NzG6.mjs';
17
+ import './fileLock-BMPwCrB6.mjs';
23
18
 
24
19
  function formatTime(ts) {
25
20
  if (!ts) return "-";
@@ -88,6 +83,30 @@ function formatJson(data) {
88
83
  return JSON.stringify(data, null, 2);
89
84
  }
90
85
 
86
+ function machineLabelOf(machine, index) {
87
+ return String(
88
+ machine?.metadata?.displayName || machine?.metadata?.host || machine?.machineId || machine?.id || `machine #${index}`
89
+ );
90
+ }
91
+ function describeRejection(reason) {
92
+ if (reason instanceof Error) return reason.message || String(reason);
93
+ if (typeof reason === "string") return reason;
94
+ try {
95
+ const json = JSON.stringify(reason);
96
+ return typeof json === "string" ? json : String(reason);
97
+ } catch {
98
+ return String(reason);
99
+ }
100
+ }
101
+ function warnUnreachableMachines(unreachable, total) {
102
+ if (unreachable.length === 0) return false;
103
+ const detail = unreachable.map((u) => `${u.machine}: ${u.error}`).join("; ");
104
+ console.error(
105
+ `warning: ${unreachable.length} of ${total} machine(s) did not respond \u2014 this list is INCOMPLETE (${detail})`
106
+ );
107
+ return true;
108
+ }
109
+
91
110
  const SESSION_RPC_PARAMS = {
92
111
  getMessages: ["afterSeq", "limit"],
93
112
  getMessageCount: [],
@@ -395,13 +414,19 @@ async function connectAndGetAllMachines() {
395
414
  process.exit(1);
396
415
  }
397
416
  const machines = [];
417
+ const unreachableMachines = [];
398
418
  try {
399
419
  const services = await server.listServices({ query: { type: "svamp-machine" }, include_unlisted: true, _rkwargs: true });
400
420
  const results = await Promise.allSettled(
401
421
  services.map((svc) => server.getService(svc.id || svc.name))
402
422
  );
403
- for (const r of results) {
423
+ for (let i = 0; i < results.length; i++) {
424
+ const r = results[i];
404
425
  if (r.status === "fulfilled") machines.push(r.value);
426
+ else unreachableMachines.push({
427
+ machine: String(services[i]?.id || services[i]?.name || `#${i}`),
428
+ error: describeRejection(r.reason)
429
+ });
405
430
  }
406
431
  } catch (err) {
407
432
  restoreConsole();
@@ -415,7 +440,7 @@ async function connectAndGetAllMachines() {
415
440
  await server.disconnect();
416
441
  process.exit(1);
417
442
  }
418
- return { server, machines };
443
+ return { server, machines, unreachable: unreachableMachines };
419
444
  }
420
445
  async function sessionMachines() {
421
446
  loadDotEnv();
@@ -817,9 +842,9 @@ async function sessionList(machineId, opts) {
817
842
  await server.disconnect();
818
843
  }
819
844
  } else {
820
- const { server, machines } = await connectAndGetAllMachines();
845
+ const { server, machines, unreachable: discoveryUnreachable } = await connectAndGetAllMachines();
821
846
  try {
822
- await listSessionsFromMachines(server, machines, opts);
847
+ await listSessionsFromMachines(server, machines, opts, discoveryUnreachable);
823
848
  } finally {
824
849
  await server.disconnect();
825
850
  }
@@ -837,7 +862,7 @@ function formatPeerLine(s) {
837
862
  }
838
863
  async function sessionWhoami(opts) {
839
864
  const currentSessionId = process.env.SVAMP_SESSION_ID;
840
- const { server, machines } = await connectAndGetAllMachines();
865
+ const { server, machines, unreachable } = await connectAndGetAllMachines();
841
866
  try {
842
867
  const perMachine = await Promise.allSettled(
843
868
  machines.map(async (machine) => {
@@ -849,6 +874,17 @@ async function sessionWhoami(opts) {
849
874
  })
850
875
  );
851
876
  const gathered = perMachine.filter((r) => r.status === "fulfilled").map((r) => r.value);
877
+ const whoamiUnreachable = [...unreachable];
878
+ for (let i = 0; i < perMachine.length; i++) {
879
+ const r = perMachine[i];
880
+ if (r.status === "rejected") {
881
+ whoamiUnreachable.push({
882
+ machine: machineLabelOf(machines[i], i),
883
+ error: describeRejection(r.reason)
884
+ });
885
+ }
886
+ }
887
+ warnUnreachableMachines(whoamiUnreachable, machines.length + unreachable.length);
852
888
  const machineLabel = (info) => info?.metadata?.displayName || info?.metadata?.host || info?.metadata?.hostname || info?.machineId || "unknown";
853
889
  let current = null;
854
890
  let currentSession = null;
@@ -951,7 +987,7 @@ async function sessionWhoami(opts) {
951
987
  await server.disconnect();
952
988
  }
953
989
  }
954
- async function listSessionsFromMachines(_server, machines, opts) {
990
+ async function listSessionsFromMachines(_server, machines, opts, discoveryUnreachable = []) {
955
991
  const allSessions = [];
956
992
  const machineResults = await Promise.allSettled(
957
993
  machines.map(async (machine) => {
@@ -966,11 +1002,18 @@ async function listSessionsFromMachines(_server, machines, opts) {
966
1002
  return sessions;
967
1003
  })
968
1004
  );
969
- for (const r of machineResults) {
1005
+ const unreachable = [...discoveryUnreachable];
1006
+ for (let i = 0; i < machineResults.length; i++) {
1007
+ const r = machineResults[i];
970
1008
  if (r.status === "fulfilled") allSessions.push(...r.value);
1009
+ else unreachable.push({
1010
+ machine: machineLabelOf(machines[i], i),
1011
+ error: describeRejection(r.reason)
1012
+ });
971
1013
  }
972
1014
  const filtered = opts?.active ? allSessions.filter((s) => s.active) : allSessions;
973
1015
  if (filtered.length === 0) {
1016
+ warnUnreachableMachines(unreachable, machines.length + discoveryUnreachable.length);
974
1017
  if (opts?.json) {
975
1018
  console.log(formatJson([]));
976
1019
  } else {
@@ -989,6 +1032,7 @@ async function listSessionsFromMachines(_server, machines, opts) {
989
1032
  host: m.host || s.machineHost || ""
990
1033
  };
991
1034
  });
1035
+ warnUnreachableMachines(unreachable, machines.length + discoveryUnreachable.length);
992
1036
  if (opts?.json) {
993
1037
  console.log(formatJson(enriched.map((s) => ({
994
1038
  sessionId: s.sessionId,
@@ -1724,11 +1768,13 @@ async function sendCore(machine, fullId, message, opts) {
1724
1768
  }
1725
1769
  if (opts?.asIssue) {
1726
1770
  const issue = await machine.sessionRPC(fullId, "issue", {
1727
- op: "add",
1728
- body: message,
1729
- session: fullId,
1730
- rekick: true,
1731
- ...opts.issueTitle ? { title: opts.issueTitle } : {}
1771
+ params: {
1772
+ op: "add",
1773
+ body: message,
1774
+ session: fullId,
1775
+ rekick: true,
1776
+ ...opts.issueTitle ? { title: opts.issueTitle } : {}
1777
+ }
1732
1778
  });
1733
1779
  return {
1734
1780
  sessionId: fullId,
@@ -1744,9 +1790,11 @@ async function sendCore(machine, fullId, message, opts) {
1744
1790
  const shouldWait = !!opts?.wait || wantResponse;
1745
1791
  if (opts?.plain) {
1746
1792
  const { randomUUID: ruuid } = await import('node:crypto');
1793
+ let plainBypassEnsured = false;
1747
1794
  if (shouldWait && !opts?.requireApproval) {
1748
1795
  try {
1749
1796
  await machine.sessionRPC(fullId, "switchMode", { mode: "bypassPermissions" });
1797
+ plainBypassEnsured = true;
1750
1798
  } catch {
1751
1799
  }
1752
1800
  }
@@ -1757,7 +1805,7 @@ async function sendCore(machine, fullId, message, opts) {
1757
1805
  let pWait;
1758
1806
  if (shouldWait) pWait = await waitForBusyThenIdle(machine, fullId, (opts?.timeout || 300) * 1e3);
1759
1807
  if (pWait?.pendingPermissions?.length) {
1760
- return { sessionId: fullId, mode: "send", sent: true, messageId: sendRes?.id, waited: true, status: "permission-pending", pendingPermissions: pWait.pendingPermissions };
1808
+ return { sessionId: fullId, mode: "send", sent: true, messageId: sendRes?.id, waited: true, status: "permission-pending", pendingPermissions: pWait.pendingPermissions, ...plainBypassEnsured ? { bypassEnsured: true } : {} };
1761
1809
  }
1762
1810
  let pResp;
1763
1811
  if (wantResponse) pResp = await collectAssistantResponse(machine, fullId, preSeq2);
@@ -1768,14 +1816,17 @@ async function sendCore(machine, fullId, message, opts) {
1768
1816
  messageId: sendRes?.id,
1769
1817
  waited: !!shouldWait,
1770
1818
  status: shouldWait ? "idle" : "sent",
1771
- ...wantResponse && pResp ? { response: pResp.text, responseSeqs: pResp.messageSeqs } : {}
1819
+ ...wantResponse && pResp ? { response: pResp.text, responseSeqs: pResp.messageSeqs } : {},
1820
+ ...plainBypassEnsured ? { bypassEnsured: true } : {}
1772
1821
  };
1773
1822
  }
1774
1823
  if (opts?.model) {
1775
1824
  const { randomUUID: ruuid } = await import('node:crypto');
1825
+ let modelBypassEnsured = false;
1776
1826
  if (shouldWait && !opts?.requireApproval) {
1777
1827
  try {
1778
1828
  await machine.sessionRPC(fullId, "switchMode", { mode: "bypassPermissions" });
1829
+ modelBypassEnsured = true;
1779
1830
  } catch {
1780
1831
  }
1781
1832
  }
@@ -1784,6 +1835,7 @@ async function sendCore(machine, fullId, message, opts) {
1784
1835
  } catch {
1785
1836
  }
1786
1837
  await new Promise((r) => setTimeout(r, 2e3));
1838
+ const modelPreSeq = wantResponse ? await snapshotLatestSeq(machine, fullId) : 0;
1787
1839
  const meta = { model: opts.model, sentFrom: "svamp-cli" };
1788
1840
  const contentStr = JSON.stringify({ role: "user", content: { type: "text", text: message }, meta });
1789
1841
  const sendRes = await machine.sessionRPC(fullId, "sendMessage", {
@@ -1803,12 +1855,13 @@ async function sendCore(machine, fullId, message, opts) {
1803
1855
  messageId: sendRes?.id,
1804
1856
  waited: true,
1805
1857
  status: "permission-pending",
1806
- pendingPermissions: mWait.pendingPermissions
1858
+ pendingPermissions: mWait.pendingPermissions,
1859
+ ...modelBypassEnsured ? { bypassEnsured: true } : {}
1807
1860
  };
1808
1861
  }
1809
1862
  let mResponse;
1810
1863
  if (wantResponse) {
1811
- mResponse = await collectAssistantResponse(machine, fullId, 0);
1864
+ mResponse = await collectAssistantResponse(machine, fullId, modelPreSeq);
1812
1865
  }
1813
1866
  return {
1814
1867
  sessionId: fullId,
@@ -1817,7 +1870,8 @@ async function sendCore(machine, fullId, message, opts) {
1817
1870
  messageId: sendRes?.id,
1818
1871
  waited: shouldWait,
1819
1872
  status: shouldWait ? "idle" : "sent",
1820
- ...wantResponse && mResponse ? { response: mResponse.text, responseSeqs: mResponse.messageSeqs } : {}
1873
+ ...wantResponse && mResponse ? { response: mResponse.text, responseSeqs: mResponse.messageSeqs } : {},
1874
+ ...modelBypassEnsured ? { bypassEnsured: true } : {}
1821
1875
  };
1822
1876
  }
1823
1877
  let bypassEnsured = false;
@@ -2392,6 +2446,7 @@ async function wiseAskCli(machineId, message, sessionId, opts) {
2392
2446
  const res = await machine.wiseAsk({ message, sessionId });
2393
2447
  if (opts?.json) {
2394
2448
  console.log(JSON.stringify(res, null, 2));
2449
+ await flushStdout();
2395
2450
  process.exit(res?.success ? 0 : 1);
2396
2451
  }
2397
2452
  if (res?.error) {
@@ -2419,6 +2474,7 @@ async function wiseJoinMeetingCli(machineId, url, sessionId, opts) {
2419
2474
  const res = await machine.wiseJoinMeeting({ meetingUrl: url, sessionId, mode, mission: opts?.mission });
2420
2475
  if (opts?.json) {
2421
2476
  console.log(JSON.stringify(res, null, 2));
2477
+ await flushStdout();
2422
2478
  process.exit(res?.success ? 0 : 1);
2423
2479
  }
2424
2480
  if (res?.error) {
@@ -2437,6 +2493,7 @@ async function wiseLeaveMeetingCli(machineId, sessionId, opts) {
2437
2493
  const res = await machine.wiseLeaveMeeting({ sessionId });
2438
2494
  if (opts?.json) {
2439
2495
  console.log(JSON.stringify(res, null, 2));
2496
+ await flushStdout();
2440
2497
  process.exit(res?.success ? 0 : 1);
2441
2498
  }
2442
2499
  if (res?.error) {
@@ -2459,6 +2516,7 @@ async function wiseAnnounceCli(machineId, text, sessionId, opts) {
2459
2516
  const res = await machine.wiseAnnounce({ text, sessionId });
2460
2517
  if (opts?.json) {
2461
2518
  console.log(JSON.stringify(res, null, 2));
2519
+ await flushStdout();
2462
2520
  process.exit(res?.success ? 0 : 1);
2463
2521
  }
2464
2522
  if (res?.error) {
@@ -2477,6 +2535,7 @@ async function wiseMeetingsCli(machineId, opts) {
2477
2535
  const res = await machine.wiseMeetingStatus({});
2478
2536
  if (opts?.json) {
2479
2537
  console.log(JSON.stringify(res, null, 2));
2538
+ await flushStdout();
2480
2539
  process.exit(0);
2481
2540
  }
2482
2541
  const ms = res?.meetings || [];
@@ -2536,8 +2595,7 @@ async function sessionLoopStart(sessionIdPartial, task, machineId, opts) {
2536
2595
  const svc = getSessionProxy(machine, fullId);
2537
2596
  const until = opts?.until || opts?.criteria;
2538
2597
  const isStart = !!(task || until);
2539
- const maxIterations = opts?.maxIterations ?? (isStart ? 1e4 : void 0);
2540
- const evaluator = opts?.agent ? true : opts?.evaluator !== false;
2598
+ const maxIterations = opts?.maxIterations ?? (isStart ? UNBOUNDED_LOOP_ITERATIONS : void 0);
2541
2599
  const budget = opts?.maxTokensPerHour || opts?.maxRuntimeSec ? {
2542
2600
  ...opts?.maxTokensPerHour ? { max_tokens_per_hour: opts.maxTokensPerHour } : {},
2543
2601
  ...opts?.maxRuntimeSec ? { max_runtime_sec: opts.maxRuntimeSec } : {}
@@ -2547,11 +2605,15 @@ async function sessionLoopStart(sessionIdPartial, task, machineId, opts) {
2547
2605
  ...task ? { task } : {},
2548
2606
  ...until ? { until } : {},
2549
2607
  ...opts?.oracle ? { oracle: opts.oracle } : {},
2550
- ...opts?.parent ? { parent: opts.parent } : {},
2551
2608
  ...maxIterations != null ? { max_iterations: maxIterations } : {},
2552
- ...budget ? { budget } : {},
2553
- ...opts?.engine ? { engine: opts.engine } : {},
2554
- evaluator
2609
+ ...budget ? { budget } : {}
2610
+ // #1499: `parent`, `engine` and `evaluator` are no longer sent. The /goal kickoff in
2611
+ // daemon/run.ts reads only task/until/oracle/max_iterations/budget/durable, so these
2612
+ // three travelled the whole RPC and were dropped — while the CLI echoed them back as
2613
+ // if applied. Sending a field nobody reads is how a flag becomes documented as a
2614
+ // control (#1415 was the same shape one command over). The legacy `supervisor` key's
2615
+ // normalizer still accepts `parent`/`evaluator` for back-compat; that path is
2616
+ // untouched.
2555
2617
  }
2556
2618
  });
2557
2619
  if (!isStart) {
@@ -2561,9 +2623,10 @@ async function sessionLoopStart(sessionIdPartial, task, machineId, opts) {
2561
2623
  if (task) console.log(` Task: ${task.slice(0, 100)}${task.length > 100 ? "..." : ""}`);
2562
2624
  if (until) console.log(` Until: ${until.slice(0, 100)}${until.length > 100 ? "..." : ""}`);
2563
2625
  console.log(` Oracle: ${opts?.oracle || "(none)"}`);
2564
- console.log(` Evaluator: ${evaluator ? "on" : "off"}`);
2565
- if (opts?.parent) console.log(` Parent review: ${opts.parent.slice(0, 8)}`);
2566
- if (maxIterations != null) console.log(` Max iterations: ${maxIterations}`);
2626
+ console.log(` Evaluator: on`);
2627
+ if (maxIterations != null) {
2628
+ console.log(maxIterations >= UNBOUNDED_LOOP_ITERATIONS ? ` Max iterations: unbounded (no iteration cap \u2014 cost/runtime ceilings only)` : ` Max iterations: ${maxIterations}`);
2629
+ }
2567
2630
  if (!task) console.log(` (hot-plug \u2014 gating the session's current work)`);
2568
2631
  }
2569
2632
  } finally {
@@ -2618,16 +2681,19 @@ async function sessionLoopStatus(sessionIdPartial, machineId) {
2618
2681
  return;
2619
2682
  }
2620
2683
  const config = await readJsonFile(`${base}/loop.config.json`);
2621
- const verdict = await readJsonFile(`${base}/evaluator-verdict.json`);
2622
2684
  console.log(`Loop on session ${fullId.slice(0, 8)}:`);
2623
- const maxN = config?.max_iterations;
2685
+ const maxRaw = state.max_iterations ?? config?.max_iterations;
2686
+ const maxN = typeof maxRaw === "number" && maxRaw > 0 && maxRaw < 1e6 ? maxRaw : null;
2687
+ const turns = state.ledger?.turns ?? state.iteration ?? 0;
2624
2688
  console.log(` Phase: ${state.phase || (state.active === false ? "inactive" : "running")}`);
2625
- console.log(` Iteration: ${state.iteration ?? 0}${maxN ? ` / ${maxN}` : ""}`);
2626
- if (config?.oracle?.command) console.log(` Oracle: ${config.oracle.command}`);
2689
+ console.log(` Iteration: ${turns}${maxN ? ` / ${maxN}` : " (no iteration cap)"}`);
2690
+ const oracleCmd = state.oracle?.command ?? state.oracle ?? config?.oracle?.command;
2691
+ if (typeof oracleCmd === "string" && oracleCmd) console.log(` Oracle: ${oracleCmd}`);
2627
2692
  if (state.last_oracle) console.log(` Last oracle: ${String(state.last_oracle).split("\n")[0]}`);
2628
- if (config && config.evaluator?.enabled !== false) {
2629
- console.log(` Evaluator: ${verdict ? `${verdict.verdict}${verdict.reason ? ` \u2014 ${verdict.reason}` : ""}` : "on (no verdict yet)"}`);
2630
- }
2693
+ const verdict = state.last_verdict ?? state.verdict;
2694
+ console.log(` Evaluator: ${verdict ? `${verdict.verdict ?? verdict}${verdict.reason ? ` \u2014 ${verdict.reason}` : ""}` : "on (no verdict yet)"}`);
2695
+ if (Number.isFinite(state.auto_resumes) && state.auto_resumes > 0) console.log(` Auto-resumes: ${state.auto_resumes}`);
2696
+ if (Number.isFinite(state.holds) && state.holds > 0) console.log(` Holds: ${state.holds}`);
2631
2697
  if (state.gave_up_reason) console.log(` Gave up: ${state.gave_up_reason}`);
2632
2698
  if (Array.isArray(state.extensions) && state.extensions.length) {
2633
2699
  const totalTurns = state.extensions.reduce((s, e) => s + (Number.isFinite(e?.grantedTurns) && e.grantedTurns > 0 ? Math.floor(e.grantedTurns) : 0), 0);
@@ -1,29 +1,59 @@
1
1
  import { writeFileSync, readFileSync } from 'fs';
2
2
  import { resolve } from 'path';
3
- import { connectAndGetMachine } from './commands-DDuGBSsz.mjs';
4
- import { w as wantsHelp } from './cli-B24CmIli.mjs';
3
+ import { connectAndGetMachine } from './commands-B-yczgz_.mjs';
4
+ import { w as wantsHelp } from './wantsHelp-6bMOeNUz.mjs';
5
5
  import 'node:fs';
6
6
  import 'node:child_process';
7
7
  import 'node:path';
8
8
  import 'node:os';
9
- import './run-CF4kAVPW.mjs';
10
- import 'os';
11
- import 'fs/promises';
12
- import 'url';
13
- import 'child_process';
14
- import 'crypto';
9
+ import './hyphaClient-ybivOjZo.mjs';
10
+ import './friendlyName-1UZcyDhu.mjs';
15
11
  import 'node:crypto';
16
- import 'util';
17
- import 'http';
18
- import 'net';
19
- import 'node:events';
20
- import '@agentclientprotocol/sdk';
21
- import 'node:util';
22
- import 'node:readline';
23
- import 'node:fs/promises';
24
- import 'yaml';
25
- import './serviceManager-hlOVxkhW.mjs';
12
+ import './types-57J3Re0n.mjs';
13
+ import './securityContext-Cm5UTCuD.mjs';
14
+ import './loopVerify-DALtTk2V.mjs';
15
+ import './instance-CeHz5C8v.mjs';
16
+ import 'os';
17
+ import './store-B4E6NzG6.mjs';
18
+ import './fileLock-BMPwCrB6.mjs';
19
+ import './flushExit-C-i6SGjj.mjs';
20
+
21
+ function positionalArgs(args, valueFlags) {
22
+ const out = [];
23
+ for (let i = 0; i < args.length; i++) {
24
+ const a = args[i];
25
+ if (a === "--") break;
26
+ if (a.startsWith("-") && a !== "-") {
27
+ if (!a.includes("=") && valueFlags.has(a)) i++;
28
+ continue;
29
+ }
30
+ out.push(a);
31
+ }
32
+ return out;
33
+ }
34
+ function firstPositional(args, valueFlags) {
35
+ return positionalArgs(args, valueFlags)[0];
36
+ }
26
37
 
38
+ const PROCESS_VALUE_FLAGS = /* @__PURE__ */ new Set([
39
+ "-o",
40
+ "--output",
41
+ "--save",
42
+ "--last",
43
+ "--env",
44
+ "--ttl",
45
+ "--workdir",
46
+ "--max-restarts",
47
+ "--restart-delay",
48
+ "--probe-port",
49
+ "--probe-path",
50
+ "--probe-interval",
51
+ "--probe-timeout",
52
+ "--probe-failures",
53
+ // pre-stripped by cli.ts today, listed so this set stays correct if that ever changes
54
+ "-m",
55
+ "--machine"
56
+ ]);
27
57
  function getFlag(args, flag) {
28
58
  const idx = args.indexOf(flag);
29
59
  return idx !== -1 && idx + 1 < args.length ? args[idx + 1] : void 0;
@@ -308,7 +338,7 @@ async function processCommand(args, machineId) {
308
338
  }
309
339
  }
310
340
  async function applyCommand(args, machineId) {
311
- const filePath = args.find((a) => !a.startsWith("-"));
341
+ const filePath = firstPositional(args, PROCESS_VALUE_FLAGS);
312
342
  if (!filePath) {
313
343
  console.error("Error: spec file required");
314
344
  console.error("Usage: svamp process apply <file.yaml>");
@@ -353,7 +383,7 @@ async function listCommand(args, machineId) {
353
383
  }
354
384
  }
355
385
  async function getCommand(args, machineId) {
356
- const idOrName = args.find((a) => !a.startsWith("-"));
386
+ const idOrName = firstPositional(args, PROCESS_VALUE_FLAGS);
357
387
  if (!idOrName) {
358
388
  console.error("Error: process name or id required");
359
389
  process.exit(1);
@@ -394,7 +424,7 @@ ${content}`, "utf-8");
394
424
  }
395
425
  async function startCommand(args, machineId) {
396
426
  const { flagArgs, cmdArgs } = splitOnDoubleDash(args);
397
- const idOrName = flagArgs.find((a) => !a.startsWith("-"));
427
+ const idOrName = firstPositional(flagArgs, PROCESS_VALUE_FLAGS);
398
428
  if (!idOrName) {
399
429
  console.error("Error: process name or id required");
400
430
  process.exit(1);
@@ -477,7 +507,7 @@ async function startCommand(args, machineId) {
477
507
  }
478
508
  }
479
509
  async function stopCommand(args, machineId) {
480
- const idOrName = args.find((a) => !a.startsWith("-"));
510
+ const idOrName = firstPositional(args, PROCESS_VALUE_FLAGS);
481
511
  if (!idOrName) {
482
512
  console.error("Error: process name or id required");
483
513
  process.exit(1);
@@ -491,7 +521,7 @@ async function stopCommand(args, machineId) {
491
521
  }
492
522
  }
493
523
  async function restartCommand(args, machineId) {
494
- const idOrName = args.find((a) => !a.startsWith("-"));
524
+ const idOrName = firstPositional(args, PROCESS_VALUE_FLAGS);
495
525
  if (!idOrName) {
496
526
  console.error("Error: process name or id required");
497
527
  process.exit(1);
@@ -505,7 +535,7 @@ async function restartCommand(args, machineId) {
505
535
  }
506
536
  }
507
537
  async function deleteCommand(args, machineId) {
508
- const idOrName = args.find((a) => !a.startsWith("-"));
538
+ const idOrName = firstPositional(args, PROCESS_VALUE_FLAGS);
509
539
  if (!idOrName) {
510
540
  console.error("Error: process name or id required");
511
541
  process.exit(1);
@@ -519,7 +549,7 @@ async function deleteCommand(args, machineId) {
519
549
  }
520
550
  }
521
551
  async function logsCommand(args, machineId) {
522
- const idOrName = args.find((a) => !a.startsWith("-"));
552
+ const idOrName = firstPositional(args, PROCESS_VALUE_FLAGS);
523
553
  if (!idOrName) {
524
554
  console.error("Error: process name or id required");
525
555
  process.exit(1);