@parcha/agentrun-serve 0.1.0-beta.46 → 0.1.0-beta.47

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 (247) hide show
  1. package/CHANGELOG.md +164 -1
  2. package/NOTICE +4 -0
  3. package/README.md +267 -40
  4. package/dist/acp-package.d.ts +35 -6
  5. package/dist/acp-package.js +3 -3
  6. package/dist/adapter-facts.d.ts +5 -2
  7. package/dist/adapter-facts.js +6 -3
  8. package/dist/adapters.d.ts +7 -0
  9. package/dist/adapters.js +39 -0
  10. package/dist/agents-store.d.ts +5 -3
  11. package/dist/agents-store.js +13 -8
  12. package/dist/api-only.d.ts +7 -10
  13. package/dist/api-only.js +7 -10
  14. package/dist/archil-routes.js +2 -1
  15. package/dist/cap.js +12 -2
  16. package/dist/chatgpt-plan.js +2 -1
  17. package/dist/cli.js +109 -41
  18. package/dist/composio-made.d.ts +19 -2
  19. package/dist/composio-made.js +17 -5
  20. package/dist/composio-preset.d.ts +42 -7
  21. package/dist/composio-preset.js +106 -70
  22. package/dist/composio-triggers.d.ts +9 -4
  23. package/dist/composio-triggers.js +20 -13
  24. package/dist/computer-attach.d.ts +11 -10
  25. package/dist/computer-attach.js +13 -14
  26. package/dist/computer-commands.d.ts +3 -0
  27. package/dist/computer-commands.js +3 -2
  28. package/dist/computer-lost.d.ts +4 -0
  29. package/dist/computer-lost.js +8 -3
  30. package/dist/computer-setting.d.ts +2 -0
  31. package/dist/computer-setting.js +2 -0
  32. package/dist/computers.d.ts +9 -75
  33. package/dist/computers.js +20 -66
  34. package/dist/console/assets/index-BBFzAxLB.js +715 -0
  35. package/dist/console/assets/index-BRi-Rgq6.css +1 -0
  36. package/dist/console/index.html +2 -2
  37. package/dist/cost-heal.d.ts +13 -0
  38. package/dist/cost-heal.js +27 -0
  39. package/dist/dial-relay.d.ts +6 -2
  40. package/dist/dial-relay.js +9 -12
  41. package/dist/email/routes.js +2 -1
  42. package/dist/errors.d.ts +2 -0
  43. package/dist/errors.js +5 -0
  44. package/dist/exa-keyless.d.ts +1 -1
  45. package/dist/exa-keyless.js +1 -1
  46. package/dist/faux-computers.d.ts +2 -3
  47. package/dist/faux-computers.js +9 -31
  48. package/dist/github-connection.js +2 -1
  49. package/dist/harness-archive.d.ts +19 -2
  50. package/dist/harness-archive.js +49 -15
  51. package/dist/harness-check.d.ts +73 -0
  52. package/dist/harness-check.js +489 -0
  53. package/dist/harness-cursor.d.ts +45 -0
  54. package/dist/harness-cursor.js +121 -0
  55. package/dist/harness-recipe.d.ts +127 -0
  56. package/dist/harness-recipe.js +357 -0
  57. package/dist/harness-table.d.ts +12 -0
  58. package/dist/harness-table.js +62 -2
  59. package/dist/harness.d.ts +2 -0
  60. package/dist/harness.js +3 -2
  61. package/dist/host-check.d.ts +6 -0
  62. package/dist/host-check.js +14 -0
  63. package/dist/host.d.ts +10 -3
  64. package/dist/host.js +17 -3
  65. package/dist/import-sources.d.ts +2 -0
  66. package/dist/import-sources.js +2 -0
  67. package/dist/import-summary.d.ts +15 -5
  68. package/dist/import-summary.js +24 -8
  69. package/dist/import.d.ts +24 -4
  70. package/dist/import.js +108 -26
  71. package/dist/key-refusal.d.ts +1 -0
  72. package/dist/key-refusal.js +8 -3
  73. package/dist/key-words.d.ts +1 -1
  74. package/dist/key-words.js +4 -4
  75. package/dist/learn/check.d.ts +3 -0
  76. package/dist/learn/check.js +31 -20
  77. package/dist/learn/compile.js +12 -5
  78. package/dist/learn/promote.d.ts +69 -2
  79. package/dist/learn/promote.js +95 -3
  80. package/dist/learned-nodes.d.ts +4 -3
  81. package/dist/learned-workflow.js +4 -1
  82. package/dist/learning-cost.d.ts +6 -16
  83. package/dist/learning-cost.js +6 -12
  84. package/dist/learning-words.d.ts +2 -0
  85. package/dist/learning-words.js +1 -1
  86. package/dist/listen-first.d.ts +10 -0
  87. package/dist/listen-first.js +25 -1
  88. package/dist/llms.txt +1 -1
  89. package/dist/mcp-gateway.d.ts +2 -1
  90. package/dist/mcp-gateway.js +31 -15
  91. package/dist/mcp-probe.d.ts +18 -6
  92. package/dist/mcp-probe.js +41 -8
  93. package/dist/mcp-secret-writes.d.ts +8 -0
  94. package/dist/mcp-secret-writes.js +104 -4
  95. package/dist/mcp-servers-store.d.ts +11 -5
  96. package/dist/mcp-servers-store.js +46 -20
  97. package/dist/model-form.d.ts +2 -1
  98. package/dist/model-form.js +22 -8
  99. package/dist/model-gateway.d.ts +113 -0
  100. package/dist/model-gateway.js +433 -0
  101. package/dist/model.d.ts +2 -1
  102. package/dist/model.js +9 -7
  103. package/dist/monid.js +1 -1
  104. package/dist/native/binding.d.ts +4 -0
  105. package/dist/native/binding.js +9 -0
  106. package/dist/native/cli.d.ts +3 -2
  107. package/dist/native/cli.js +6 -5
  108. package/dist/openapi.d.ts +2 -0
  109. package/dist/openapi.js +322 -39
  110. package/dist/owner.d.ts +4 -2
  111. package/dist/owner.js +10 -4
  112. package/dist/page.d.ts +8 -0
  113. package/dist/page.js +9 -1
  114. package/dist/port-models.js +17 -10
  115. package/dist/provider.d.ts +3 -3
  116. package/dist/provider.js +12 -3
  117. package/dist/public-address.d.ts +28 -0
  118. package/dist/public-address.js +62 -0
  119. package/dist/run-launch.d.ts +1 -1
  120. package/dist/run-launch.js +1 -1
  121. package/dist/run-secrets.d.ts +3 -2
  122. package/dist/run-secrets.js +6 -4
  123. package/dist/runner/adapter-loop.d.ts +10 -7
  124. package/dist/runner/adapter-loop.js +57 -22
  125. package/dist/runner/adapter-run-spec.d.ts +12 -0
  126. package/dist/runner/adapter-run-spec.js +40 -6
  127. package/dist/runner/adapters/index.js +16 -0
  128. package/dist/runner/adapters/pi.d.ts +5 -2
  129. package/dist/runner/adapters/pi.js +7 -4
  130. package/dist/runner/audit.d.ts +7 -0
  131. package/dist/runner/audit.js +15 -6
  132. package/dist/runner/claim-secrets.js +5 -1
  133. package/dist/runner/cli-run-spec.js +15 -7
  134. package/dist/runner/compare-end.d.ts +43 -0
  135. package/dist/runner/compare-end.js +95 -0
  136. package/dist/runner/computer-journal.d.ts +3 -0
  137. package/dist/runner/computer-journal.js +22 -2
  138. package/dist/runner/harness-loops.d.ts +6 -1
  139. package/dist/runner/harness-loops.js +94 -54
  140. package/dist/runner/held.d.ts +5 -4
  141. package/dist/runner/journal-kinds.d.ts +4 -1
  142. package/dist/runner/journal-kinds.js +3 -0
  143. package/dist/runner/loop-contract.d.ts +10 -0
  144. package/dist/runner/main.d.ts +5 -5
  145. package/dist/runner/main.js +62 -11
  146. package/dist/runner/mcp-claim.js +40 -12
  147. package/dist/runner/metrics.d.ts +26 -0
  148. package/dist/runner/metrics.js +44 -1
  149. package/dist/runner/presence.d.ts +41 -0
  150. package/dist/runner/presence.js +89 -0
  151. package/dist/runner/promotion.d.ts +9 -4
  152. package/dist/runner/promotion.js +33 -14
  153. package/dist/runner/run-child-host.js +40 -10
  154. package/dist/runner/runner.d.ts +5 -0
  155. package/dist/runner/runner.js +8 -0
  156. package/dist/runner/store-port.d.ts +3 -0
  157. package/dist/runner/store-secrets.js +19 -7
  158. package/dist/runner/workflow-first.d.ts +5 -2
  159. package/dist/runner/workflow-first.js +6 -3
  160. package/dist/runs-over-store.d.ts +6 -2
  161. package/dist/runs-over-store.js +14 -4
  162. package/dist/sdk/runs.d.ts +1 -1
  163. package/dist/sdk/runs.js +6 -1
  164. package/dist/sdk/schema.js +1 -1
  165. package/dist/secret-writes.d.ts +16 -3
  166. package/dist/secret-writes.js +28 -3
  167. package/dist/server-secrets-store.js +5 -0
  168. package/dist/server.d.ts +31 -2
  169. package/dist/server.js +322 -51
  170. package/dist/sign-ins-secrets.js +4 -1
  171. package/dist/skills/agentrun-serve/SKILL.md +11 -0
  172. package/dist/slack-url.d.ts +5 -0
  173. package/dist/slack-url.js +11 -0
  174. package/dist/slack.d.ts +107 -0
  175. package/dist/slack.js +292 -0
  176. package/dist/start-switches.d.ts +28 -0
  177. package/dist/start-switches.js +37 -0
  178. package/dist/stats.d.ts +1 -1
  179. package/dist/stats.js +2 -1
  180. package/dist/stop-signals.d.ts +11 -0
  181. package/dist/stop-signals.js +22 -0
  182. package/dist/store/agent-body.d.ts +1 -1
  183. package/dist/store/agent-body.js +2 -2
  184. package/dist/store/index.d.ts +3 -3
  185. package/dist/store/index.js +1 -1
  186. package/dist/store/postgres/migrations/0020_runners.sql +18 -0
  187. package/dist/store/postgres/store.d.ts +1 -1
  188. package/dist/store/postgres/store.js +4 -2
  189. package/dist/store/schema.d.ts +13 -5
  190. package/dist/store/schema.js +20 -11
  191. package/dist/store/seal.d.ts +16 -4
  192. package/dist/store/sqlite/store.d.ts +1 -1
  193. package/dist/store/sqlite/store.js +106 -27
  194. package/dist/store/store.d.ts +75 -23
  195. package/dist/store/store.js +11 -0
  196. package/dist/store-reads/analytics.js +3 -2
  197. package/dist/store-reads/cap.d.ts +7 -0
  198. package/dist/store-reads/cap.js +11 -1
  199. package/dist/store-reads/journal.js +27 -1
  200. package/dist/store-reads/learning.d.ts +23 -2
  201. package/dist/store-reads/learning.js +29 -8
  202. package/dist/store-reads/runs.d.ts +9 -0
  203. package/dist/store-reads/runs.js +19 -6
  204. package/dist/store-reads/stats.d.ts +4 -1
  205. package/dist/store-reads/stats.js +15 -6
  206. package/dist/store-view.d.ts +123 -14
  207. package/dist/store-view.js +154 -21
  208. package/dist/telemetry.d.ts +7 -7
  209. package/dist/telemetry.js +38 -15
  210. package/dist/timeline/timeline.js +18 -0
  211. package/dist/tool-keys-store.js +2 -2
  212. package/dist/tool-keys.js +2 -1
  213. package/dist/tool-plane.js +2 -2
  214. package/dist/trigger-adapter.d.ts +3 -4
  215. package/dist/trigger-adapter.js +2 -2
  216. package/dist/trigger-composio.js +3 -3
  217. package/dist/trigger-email.js +0 -2
  218. package/dist/trigger-feed.js +0 -2
  219. package/dist/trigger-schedule.js +3 -0
  220. package/dist/trigger-secrets-shown.d.ts +6 -3
  221. package/dist/trigger-secrets-shown.js +22 -13
  222. package/dist/trigger-targets.d.ts +1 -1
  223. package/dist/trigger-targets.js +19 -8
  224. package/dist/triggers.d.ts +2 -2
  225. package/dist/webhooks.d.ts +82 -8
  226. package/dist/webhooks.js +128 -45
  227. package/dist/wires.d.ts +6 -1
  228. package/dist/wires.js +5 -0
  229. package/dist/workspace/attach.d.ts +3 -2
  230. package/dist/workspace/attach.js +2 -1
  231. package/dist/workspace/attached-computers.d.ts +6 -8
  232. package/dist/workspace/attached-computers.js +27 -24
  233. package/dist/workspace/computer-deps.d.ts +2 -3
  234. package/dist/workspace/computer-deps.js +3 -6
  235. package/dist/workspace/computer-for-claim.js +72 -96
  236. package/dist/workspace/computer-kept.d.ts +0 -7
  237. package/dist/workspace/computer-kept.js +0 -17
  238. package/dist/workspace/resolve-computer.d.ts +18 -14
  239. package/dist/workspace/resolve-computer.js +47 -60
  240. package/dist/workspace/synced-folder.d.ts +20 -15
  241. package/dist/workspace/synced-folder.js +33 -43
  242. package/launcher/agentrun-serve +4 -1
  243. package/package.json +10 -10
  244. package/skills/agentrun-serve/SKILL.md +11 -0
  245. package/templates/README.md +1 -1
  246. package/dist/console/assets/index-C2MYaUBa.css +0 -1
  247. package/dist/console/assets/index-CZZeCReB.js +0 -701
@@ -0,0 +1,489 @@
1
+ // `agentrun harness-check --recipe FILE`: a recipe's agent run for real, the way serve would run it, and judged. It loads
2
+ // the recipe (harness-recipe.ts: the five rules, each refused by its code), finds the binary its owner installed and
3
+ // checks its pin, then drives the ACP adapter over four turns of a live session on the run's model, and writes what it
4
+ // saw as a JSON report:
5
+ // Stage 2, the real binary: its tools are off (the first model request offers only ours), its environment is the
6
+ // allowlist (read from /proc on Linux), its pin holds at every start, its billing limits hold (proxy: a request past
7
+ // the cap is refused unsent; plan: the adapter's turn and call limits are set), and it makes no side request (the
8
+ // provider sees only the turns' Messages requests; anything it reaches for beyond loopback goes to the check's own
9
+ // proxy, which refuses and lists it).
10
+ // Stage 3, live: the agent is killed (SIGKILL) after a turn and the next turn resumes it (its own session/load, or a
11
+ // fresh session told the conversation), a denied call never runs, one of our tools runs over MCP, and another runner
12
+ // with its own directory picks the session up from the records.
13
+ // It prints the three facts a harness row carries: resume (load | restart), tool_gate (permission | config: whether the
14
+ // agent asks before a tool call) and billing (proxy | plan).
15
+ // The check spends: four short turns on the run's model, under a cap (default $0.25).
16
+ import { spawnSync } from "node:child_process";
17
+ import { randomBytes } from "node:crypto";
18
+ import { existsSync, readFileSync } from "node:fs";
19
+ import { mkdtemp, rm, writeFile } from "node:fs/promises";
20
+ import { createServer } from "node:http";
21
+ import { connect as netConnect } from "node:net";
22
+ import { tmpdir } from "node:os";
23
+ import { join } from "node:path";
24
+ import { modelPortFor, SessionFenced } from "@parcha/agentrun-kernel";
25
+ import { beforeRequestOf } from "@parcha/agentrun-kernel/kernel/cap";
26
+ import { ACP_PACKAGE } from "./acp-package.js";
27
+ import { priceOf } from "./adapters.js";
28
+ import { ARCHIVE_CODES, archivePlatform, digestOf } from "./harness-archive.js";
29
+ import { installDirOf } from "./harness-install.js";
30
+ import { AGENT_VARS, loadRecipe, pinnedDigest, recipeBinaryOf, recipeInstallLine, RecipeRefused, releaseFor } from "./harness-recipe.js";
31
+ import { providerModels } from "./model.js";
32
+ import { providerFor } from "./provider.js";
33
+ import { capModelOf } from "./runner/cli-run-spec.js";
34
+ import { keyShaped } from "./secret-name.js";
35
+ import { SECRET_NAMES } from "./secrets.js";
36
+ import { createRequire } from "node:module";
37
+ const requireHere = createRequire(import.meta.url);
38
+ /** The ACP package beside this server, or undefined. */
39
+ function acpCheckPackage() {
40
+ try {
41
+ requireHere.resolve(ACP_PACKAGE);
42
+ }
43
+ catch {
44
+ return undefined;
45
+ }
46
+ return requireHere(ACP_PACKAGE);
47
+ }
48
+ /** The proxy variables the check points at its own egress proxy, in both cases, whatever the recipe sets. */
49
+ const EGRESS_VARS = ["HTTPS_PROXY", "HTTP_PROXY", "https_proxy", "http_proxy"];
50
+ const NO_PROXY_VARS = ["NO_PROXY", "no_proxy"];
51
+ /** What a shell sets for itself when the binary is a script (its working directory, its depth): never the host's. */
52
+ const SHELL_OWN = ["PWD", "OLDPWD", "SHLVL", "_"];
53
+ export const CHECK_DEFAULT_CAP_USD = 0.25;
54
+ const TURN_MS = 240_000;
55
+ /** The check's session records, in memory for the check's life: one session, opened by each runner in turn. The newest
56
+ * open holds it; an older writer's append is fenced, as the server's store fences a runner whose claim was taken. */
57
+ function checkStore() {
58
+ const records = new Map();
59
+ const holders = new Map();
60
+ const read = async (key) => structuredClone(records.get(key) ?? []);
61
+ return {
62
+ read,
63
+ async open(key) {
64
+ const holder = (holders.get(key) ?? 0) + 1;
65
+ holders.set(key, holder);
66
+ return {
67
+ key,
68
+ read: () => read(key),
69
+ async append(added) {
70
+ if (holders.get(key) !== holder)
71
+ throw new SessionFenced(key);
72
+ records.set(key, [...(records.get(key) ?? []), ...structuredClone(added)]);
73
+ },
74
+ sync: async () => { },
75
+ };
76
+ },
77
+ };
78
+ }
79
+ const LOOPBACK = "127.0.0.1"; // key-gate: loopback-rule the one address the refusing egress proxy of a check listens on
80
+ /** A loopback HTTP proxy that records what the agent reaches for beyond loopback. It tunnels a CONNECT to one of `vendor`
81
+ * (a plan-billed recipe's model.hosts, `host` for port 443 or `host:port`) and refuses everything else. */
82
+ async function egressProxy(vendor = []) {
83
+ const asked = [];
84
+ const sockets = new Set();
85
+ const allowed = new Set(vendor.map((host) => (host.includes(":") ? host : `${host}:443`)));
86
+ const server = createServer((req, res) => {
87
+ asked.push({ method: req.method ?? "GET", target: req.url ?? "", tunneled: false });
88
+ res.writeHead(403).end();
89
+ });
90
+ server.on("connect", (req, socket, head) => {
91
+ const target = req.url ?? "";
92
+ const tunneled = allowed.has(target);
93
+ asked.push({ method: "CONNECT", target, tunneled });
94
+ if (!tunneled)
95
+ return void socket.end("HTTP/1.1 403 Forbidden\r\ncontent-length: 0\r\n\r\n");
96
+ const at = target.lastIndexOf(":");
97
+ const upstream = netConnect({ host: target.slice(0, at), port: Number(target.slice(at + 1)) }, () => {
98
+ socket.write("HTTP/1.1 200 Connection Established\r\n\r\n");
99
+ if (head.length)
100
+ upstream.write(head);
101
+ upstream.pipe(socket);
102
+ socket.pipe(upstream);
103
+ });
104
+ sockets.add(upstream);
105
+ upstream.on("close", () => (sockets.delete(upstream), socket.destroy()));
106
+ upstream.on("error", () => socket.end("HTTP/1.1 502 Bad Gateway\r\ncontent-length: 0\r\n\r\n"));
107
+ socket.on("error", () => upstream.destroy());
108
+ socket.on("close", () => upstream.destroy());
109
+ });
110
+ server.on("connection", (socket) => (sockets.add(socket), socket.on("close", () => sockets.delete(socket))));
111
+ await new Promise((resolve) => server.listen(0, LOOPBACK, resolve));
112
+ const port = server.address().port;
113
+ return {
114
+ url: `http://${LOOPBACK}:${port}`,
115
+ asked,
116
+ close: () => new Promise((resolve) => {
117
+ for (const socket of sockets)
118
+ socket.destroy();
119
+ server.close(() => resolve());
120
+ }),
121
+ };
122
+ }
123
+ /** A process's environment, by name, from /proc (Linux); undefined elsewhere or once it is gone. */
124
+ function environOf(pid) {
125
+ try {
126
+ return Object.fromEntries(readFileSync(`/proc/${pid}/environ`, "utf8").split("\0").filter(Boolean).map((kv) => [kv.slice(0, kv.indexOf("=")), kv.slice(kv.indexOf("=") + 1)]));
127
+ }
128
+ catch {
129
+ return undefined;
130
+ }
131
+ }
132
+ const alive = (pid) => {
133
+ try {
134
+ process.kill(pid, 0);
135
+ return true;
136
+ }
137
+ catch {
138
+ return false;
139
+ }
140
+ };
141
+ /** Kills the agent's process by its pid, once it is this process's own child running the recipe's binary (or what the
142
+ * binary exec'd, a script's interpreter): never another process. */
143
+ async function killAgent(pid, binary) {
144
+ let cmdline = "";
145
+ let parent;
146
+ try {
147
+ cmdline = readFileSync(`/proc/${pid}/cmdline`, "utf8");
148
+ parent = Number(readFileSync(`/proc/${pid}/stat`, "utf8").replace(/^.*\) /s, "").split(" ")[1]);
149
+ }
150
+ catch {
151
+ // Not Linux: ps says the command and the parent.
152
+ const ps = spawnSync("ps", ["-o", "ppid=,command=", "-p", String(pid)], { encoding: "utf8" }).stdout?.trim() ?? "";
153
+ parent = Number(ps.split(/\s+/)[0]);
154
+ cmdline = ps.slice(ps.indexOf(" ") + 1);
155
+ }
156
+ if (!cmdline || (parent !== process.pid && !cmdline.includes(binary)))
157
+ return false;
158
+ process.kill(pid, "SIGKILL");
159
+ for (let i = 0; i < 100 && alive(pid); i++)
160
+ await new Promise((resolve) => setTimeout(resolve, 50));
161
+ return !alive(pid);
162
+ }
163
+ /** The text of a request body, whatever the proxy sent it as. */
164
+ function bodyText(body) {
165
+ if (typeof body === "string")
166
+ return body;
167
+ if (body instanceof Uint8Array)
168
+ return Buffer.from(body).toString("utf8");
169
+ return "";
170
+ }
171
+ /** The model ref `provider/model-id`. */
172
+ function modelRef(ref) {
173
+ const at = ref.indexOf("/");
174
+ return at > 0 && at < ref.length - 1 ? { provider: ref.slice(0, at), modelId: ref.slice(at + 1) } : undefined;
175
+ }
176
+ /** Runs the check. Never throws for what it judges: a refused recipe, a missing install or a failed stage is in the
177
+ * report (`ok: false`, `failures`). */
178
+ export async function harnessCheck(options) {
179
+ const say = options.say ?? (() => { });
180
+ const checkedAt = new Date().toISOString();
181
+ const failures = [];
182
+ let loaded;
183
+ try {
184
+ loaded = loadRecipe(options.recipe);
185
+ }
186
+ catch (error) {
187
+ if (!(error instanceof RecipeRefused))
188
+ throw error;
189
+ return { ok: false, recipe: { file: options.recipe }, refused: { code: error.code, message: error.message }, checkedAt, failures: [error.message] };
190
+ }
191
+ const { recipe } = loaded;
192
+ const head = { recipe: { id: recipe.id, label: recipe.label, file: loaded.file, sha256: loaded.sha256 }, checkedAt };
193
+ const refuse = (code, message) => ({ ok: false, ...head, refused: { code, message: `${code}: ${message}` }, failures: [`${code}: ${message}`] });
194
+ say(`${recipe.label}: the recipe holds the five rules (${loaded.file})`);
195
+ // Stage 2's pins: the installed binary, the one the owner's install put there. Nothing is downloaded here.
196
+ const platform = options.platform ?? archivePlatform();
197
+ const release = releaseFor(recipe, platform);
198
+ if (!platform || !release)
199
+ return refuse("HARNESS_PLATFORM_UNSUPPORTED", `${recipe.label} ${recipe.release.version} has no release for ${platform ?? `${process.platform}-${process.arch}`}`);
200
+ const binary = recipeBinaryOf(options.data, recipe, release);
201
+ const line = recipeInstallLine(loaded.file, options.data, options.env);
202
+ const pin = pinnedDigest(options.data, recipe, release, platform);
203
+ if (!existsSync(binary) || !pin)
204
+ return refuse("HARNESS_NOT_INSTALLED", `${recipe.label} ${recipe.release.version} is not installed in ${installDirOf(options.data, recipe.id)}; a check never downloads it. Install it with: ${line}`);
205
+ const found = await digestOf(binary).catch(() => undefined);
206
+ if (found !== pin.sha256)
207
+ return refuse(ARCHIVE_CODES.binary, `${binary} has sha256 ${found ?? "(unreadable)"}, and ${pin.by === "recipe" ? "the recipe pins" : "its first install recorded"} ${pin.sha256}. Install it again with: ${line}`);
208
+ say(`${recipe.label}: the binary is the pinned one (${pin.by === "recipe" ? "the recipe's sha256" : "the first sha256 its install recorded"})`);
209
+ const acp = acpCheckPackage();
210
+ if (!acp)
211
+ return refuse("HARNESS_NOT_INSTALLED", `the ACP adapter (${ACP_PACKAGE}) is not installed beside this server`);
212
+ // The model, and who bills it.
213
+ const env = options.env;
214
+ let provider;
215
+ let price;
216
+ let capModel;
217
+ if (recipe.model.billing === "proxy") {
218
+ const ref = options.model ? modelRef(options.model) : undefined;
219
+ if (!ref)
220
+ return refuse("HARNESS_CHECK_USAGE", `${recipe.label} is billed through the proxy: name the run's model with --model provider/model-id (openrouter/anthropic/claude-haiku-4.5, anthropic/claude-haiku-4-5)`);
221
+ try {
222
+ provider = providerFor("anthropic-messages", env, ref, recipe.label);
223
+ }
224
+ catch (error) {
225
+ return refuse("HARNESS_CHECK_MODEL", error.message);
226
+ }
227
+ if (provider.login)
228
+ return refuse("HARNESS_CHECK_MODEL", `${recipe.label} runs on a model key: Claude Code's login on this machine is its CLI's alone`);
229
+ const models = await providerModels(env);
230
+ const listed = models.getModel(provider.priceModel.provider, provider.priceModel.modelId);
231
+ price = priceOf({ model: provider.priceModel, models });
232
+ capModel = capModelOf(provider.priceModel.modelId, "anthropic-messages", listed, listed === undefined);
233
+ if (!capModel.price)
234
+ return refuse("HARNESS_CHECK_MODEL", `${provider.priceModel.provider}/${provider.priceModel.modelId} has no price here, so the check's cap could not hold; name a priced model`);
235
+ }
236
+ // The session: the check's tools, its gate, its egress proxy, the recording fetch.
237
+ const nonce = randomBytes(6).toString("hex");
238
+ const echoed = [];
239
+ const deniedRan = [];
240
+ const tools = [
241
+ { name: "check_echo", description: "Echo the text back, prefixed with ECHO.", inputSchema: { type: "object", properties: { text: { type: "string" } }, required: ["text"] }, replay: "never", call: async (args) => (echoed.push(args), { text: `ECHO:${args?.text ?? ""}` }) },
242
+ { name: "check_denied", description: "A tool this run refuses: calling it shows the refusal.", inputSchema: { type: "object", properties: { text: { type: "string" } }, required: ["text"] }, replay: "never", call: async (args) => (deniedRan.push(args), { text: "this call should never have run" }) },
243
+ ];
244
+ // The gate allows check_echo alone. Everything else is denied, the agent's own calls (`acp_<kind>`) included, as a
245
+ // server's gate answers them: a call of ours whose title the adapter can't tie is one of those, so it fails mcp_tool.
246
+ const gateAsked = [];
247
+ const gate = async (call) => {
248
+ const answer = call.tool === "check_echo" ? "allow" : "deny";
249
+ gateAsked.push({ tool: call.tool, answer });
250
+ return answer === "allow" ? "allow" : { deny: "harness-check refuses this call on purpose" };
251
+ };
252
+ const forwarded = [];
253
+ const forward = options.fetch ?? fetch;
254
+ const recording = async (input, init) => {
255
+ const url = new URL(typeof input === "string" ? input : input instanceof URL ? input.href : input.url);
256
+ const text = bodyText(init?.body);
257
+ let toolNames = [];
258
+ try {
259
+ const parsed = JSON.parse(text);
260
+ toolNames = (parsed.tools ?? []).map((tool) => String(tool.name));
261
+ }
262
+ catch {
263
+ // Not JSON: no tools.
264
+ }
265
+ forwarded.push({ method: init?.method ?? "GET", path: url.pathname, tools: toolNames, text });
266
+ return forward(input, init);
267
+ };
268
+ const logs = [];
269
+ const log = (message, fields) => void logs.push({ message, ...(fields ?? {}) });
270
+ // A plan-billed agent reaches its vendor through the check's proxy, tunneled to the hosts its recipe names.
271
+ const egress = await egressProxy(recipe.model.billing === "plan" ? (recipe.model.hosts ?? []) : []);
272
+ const work = await mkdtemp(join(tmpdir(), "agentrun-harness-check-"));
273
+ const canary = `harness-check-canary-${nonce}`;
274
+ // The host's environment as the adapter reads it, by name, with the canary over it: built on `env` (its prototype), not
275
+ // spread from it, so the keys withSecrets keeps off its enumeration still read by name. The recipe's keys reach the
276
+ // agent from here alone (the adapter's recipe.keys, as a run's do): a host without one is refused before the start.
277
+ const hostEnv = Object.create(env, { HARNESS_CHECK_CANARY: { value: canary, enumerable: true } });
278
+ // The values of every key the host holds, the server's own included: withSecrets keeps those off its enumeration, so
279
+ // each is read by name.
280
+ const hostSecrets = [...new Set([...SECRET_NAMES, ...Object.keys(env).filter((name) => keyShaped(name))])]
281
+ .filter((name) => !recipe.keys.includes(name))
282
+ .map((name) => env[name])
283
+ .filter((value) => typeof value === "string" && value.length >= 8);
284
+ const childVars = { ...recipe.env };
285
+ if (recipe.model.billing === "proxy")
286
+ childVars[recipe.model.env] = provider.modelId;
287
+ for (const name of EGRESS_VARS)
288
+ childVars[name] = egress.url;
289
+ for (const name of NO_PROXY_VARS)
290
+ childVars[name] = `${LOOPBACK},localhost`; // key-gate: loopback-rule the hosts the agent reaches without the refusing proxy: the model proxy and MCP on this machine
291
+ const acpRecipe = {
292
+ id: recipe.id,
293
+ label: recipe.label,
294
+ command: binary,
295
+ args: [...recipe.args],
296
+ env: childVars,
297
+ keys: [...recipe.keys],
298
+ files: { ...recipe.files },
299
+ state: [...recipe.state],
300
+ declares: { ...recipe.declares },
301
+ billing: recipe.model.billing === "proxy" ? { kind: "proxy" } : { kind: "plan", maxTurns: recipe.model.maxTurns, maxToolCalls: recipe.model.maxToolCalls },
302
+ ...(recipe.quirks.mcpCall ? { quirks: { mcpCall: recipe.quirks.mcpCall } } : {}),
303
+ };
304
+ const messagesProxy = recipe.model.billing === "proxy" ? acp.gooseProxy({ model: provider.modelId, provider: { origin: provider.origin, credential: provider.credential, ...(provider.auth ? { auth: provider.auth } : {}) }, ...(price ? { price } : {}), log, fetch: recording }) : undefined;
305
+ const proxyAt = recipe.model.billing === "proxy" ? (recipe.model.hostEnv ?? "ANTHROPIC_HOST") : "ANTHROPIC_HOST";
306
+ const proxy = messagesProxy && (async (session) => {
307
+ // The proxy's own address, under proxyAt, beside the key that opens it alone (never a provider's).
308
+ const started = await messagesProxy(session);
309
+ const { ANTHROPIC_HOST: address, ...opens } = started.env;
310
+ return { env: { ...opens, [proxyAt]: address }, close: started.close };
311
+ });
312
+ let capUsd = options.capUsd ?? CHECK_DEFAULT_CAP_USD;
313
+ const store = checkStore();
314
+ const starts = [];
315
+ const adapterFor = (sessionsDir) => acp.acpAdapter({
316
+ recipe: acpRecipe,
317
+ sessionsDir,
318
+ env: hostEnv,
319
+ log,
320
+ // Each start of the agent's process checks the pin again: a binary swapped after the check began never runs.
321
+ beforeStart: async (command) => {
322
+ const now = await digestOf(command);
323
+ starts.push(now);
324
+ if (now !== pin.sha256)
325
+ throw new Error(`${ARCHIVE_CODES.binary}: ${command} changed after the check began (sha256 ${now})`);
326
+ },
327
+ ...(proxy ? { proxy } : {}),
328
+ });
329
+ const refusedRequests = [];
330
+ let lastBooking;
331
+ const sessionOn = async (sessionsDir) => {
332
+ const writer = await store.open("check");
333
+ const booking = await modelPortFor(writer, {
334
+ key: "check",
335
+ ...(capModel ? { beforeRequest: beforeRequestOf({ capUsd: () => capUsd, modelOf: () => capModel }) } : {}),
336
+ stop: (reason, message, code) => (refusedRequests.push({ reason, ...(code ? { code } : {}), ...(message ? { message } : {}) }), new Error(`${code ?? reason}: ${message ?? ""}`)),
337
+ });
338
+ lastBooking = booking;
339
+ const controller = new AbortController();
340
+ const session = await adapterFor(sessionsDir).open({ key: "check", label: "root", system: [], tools, context: "fresh" }, { writer, models: booking.models, signal: controller.signal, onEvent: () => { }, gate });
341
+ const turn = async (text) => {
342
+ const timer = setTimeout(() => controller.abort(new Error("the turn took too long")), options.turnMs ?? TURN_MS);
343
+ try {
344
+ await session.send(text);
345
+ return await session.turnEnd();
346
+ }
347
+ finally {
348
+ clearTimeout(timer);
349
+ }
350
+ };
351
+ return { session, turn, booking };
352
+ };
353
+ const opened = () => logs.filter((l) => l.message === "acp: the agent's session is open");
354
+ const asked = () => logs.filter((l) => l.message === "acp: the agent asked permission");
355
+ const messages = () => forwarded.filter((r) => r.method === "POST" && r.path.endsWith("/v1/messages"));
356
+ const stage2 = {};
357
+ const stage3 = {};
358
+ let resumeFact = "unknown";
359
+ try {
360
+ // Turn 1: one of our tools over MCP.
361
+ say(`${recipe.label}: turn 1, a call of our check_echo tool over MCP`);
362
+ const first = await sessionOn(join(work, "runner-a"));
363
+ const t1 = await first.turn(`Use the check_echo tool once, with the text argument set to ${nonce}. Then reply with exactly what it returned and nothing else.`);
364
+ const firstOpen = opened()[0];
365
+ // The environment while the agent runs.
366
+ const environ = firstOpen?.pid ? environOf(firstOpen.pid) : undefined;
367
+ const echoReached = messages().some((r) => r.text.includes(`ECHO:${nonce}`));
368
+ stage3.mcp_tool = { ok: t1.status === "completed" && echoed.length >= 1 && (recipe.model.billing !== "proxy" || echoReached), turn: t1.status, ...(t1.error ? { error: t1.error } : {}), calls: echoed.length, resultReachedModel: recipe.model.billing === "proxy" ? echoReached : null };
369
+ // Stage 2: the tools the agent offered its model on its first request. The proxy refuses a request that offers a tool
370
+ // its policy does not allow, so one that reached the provider at all passed that rule: the stage is whether one did.
371
+ // Its refusals are listed beside it, never counted: a port watcher's GET / is refused too.
372
+ if (recipe.model.billing === "proxy") {
373
+ const firstRequest = messages()[0];
374
+ const ours = new Set(tools.map((tool) => `agentrun__${tool.name}`));
375
+ const offered = firstRequest?.tools ?? [];
376
+ const refusals = logs.filter((l) => /refus/i.test(l.message)).map((l) => ({ message: l.message, ...(typeof l.reason === "string" ? { reason: l.reason } : {}) }));
377
+ stage2.tools_off = { ok: !!firstRequest, firstRequest: offered, notOurs: offered.filter((name) => !ours.has(name)), ...(refusals.length ? { proxyRefusals: refusals } : {}) };
378
+ }
379
+ else
380
+ stage2.tools_off = { ok: null, why: "plan billing: the vendor's model requests never reach this host, so the tools it offers are not seen" };
381
+ // Stage 2: the environment is the allowlist.
382
+ if (environ) {
383
+ // The recipe's keys too: the adapter hands each over by name (recipe.keys), never through childVars.
384
+ const expected = new Set([...Object.values(AGENT_VARS).flat(), ...Object.keys(childVars), ...recipe.keys, ...SHELL_OWN]);
385
+ const extra = Object.keys(environ).filter((name) => !expected.has(name)).sort();
386
+ const leaked = Object.entries(environ).filter(([, value]) => hostSecrets.includes(value) || value === canary).map(([name]) => name).sort();
387
+ stage2.env_allowlist = { ok: extra.length === 0 && leaked.length === 0, names: Object.keys(environ).sort(), beyondAllowlist: extra, hostSecretsSeen: leaked };
388
+ }
389
+ else
390
+ stage2.env_allowlist = { ok: null, why: process.platform === "linux" ? "the agent's process was gone before its environment was read" : "the environment is read from /proc, on Linux alone" };
391
+ // Kill the agent, then turn 2: the denied call, and what turn 1 said.
392
+ let killed = false;
393
+ if (firstOpen?.pid)
394
+ killed = await killAgent(firstOpen.pid, binary);
395
+ say(`${recipe.label}: the agent is killed (SIGKILL, pid ${firstOpen?.pid ?? "unknown"}); turn 2, a denied call and the conversation so far`);
396
+ const before = messages().length;
397
+ const t2 = await first.turn(`Use the check_denied tool once, with the text argument set to two. It will be refused; that is expected. Then reply with the text the check_echo tool returned earlier in this conversation.`);
398
+ const secondOpen = opened()[1];
399
+ // What check_echo returned in turn 1 is in the model's next request: the conversation came through the kill.
400
+ const remembered = messages().slice(before).some((r) => r.text.includes(`ECHO:${nonce}`));
401
+ resumeFact = secondOpen ? (secondOpen.loaded ? "load" : "restart") : "unknown";
402
+ stage3.resume = { ok: killed && t2.status === "completed" && !!secondOpen && secondOpen.pid !== firstOpen?.pid && (recipe.model.billing !== "proxy" || remembered), killed, turn: t2.status, ...(t2.error ? { error: t2.error } : {}), newProcess: !!secondOpen && secondOpen.pid !== firstOpen?.pid, loaded: secondOpen?.loaded ?? null, sameSession: !!secondOpen && secondOpen.sessionId === firstOpen?.sessionId, conversationCarried: recipe.model.billing === "proxy" ? remembered : null };
403
+ const deniedAsked = gateAsked.filter((g) => g.tool === "check_denied");
404
+ stage3.denied_call = { ok: deniedAsked.length >= 1 && deniedAsked.every((g) => g.answer === "deny") && deniedRan.length === 0 && t2.status === "completed", gateAsked: deniedAsked.length, ran: deniedRan.length, turn: t2.status };
405
+ await first.session.close();
406
+ // Turn 3: another runner, its own directory, from the records.
407
+ say(`${recipe.label}: turn 3, another runner picks the session up from the records`);
408
+ const other = await sessionOn(join(work, "runner-b"));
409
+ const before3 = messages().length;
410
+ const t3 = await other.turn("Reply with the word ready and nothing else.");
411
+ const thirdOpen = opened().at(-1);
412
+ const carried3 = messages().slice(before3).some((r) => r.text.includes(`ECHO:${nonce}`));
413
+ stage3.other_runner = { ok: t3.status === "completed" && (recipe.model.billing !== "proxy" || carried3), turn: t3.status, ...(t3.error ? { error: t3.error } : {}), loaded: thirdOpen?.loaded ?? null, conversationCarried: recipe.model.billing === "proxy" ? carried3 : null };
414
+ // Turn 4: the billing limit. Proxy: the cap is set at what was spent, so the next request is refused unsent.
415
+ if (recipe.model.billing === "proxy") {
416
+ const spent = other.booking.spentUsd();
417
+ capUsd = spent ?? 0;
418
+ const sentBefore = messages().length;
419
+ const t4 = await other.turn("Reply with the word ok.");
420
+ const unsent = messages().length === sentBefore;
421
+ stage2.limits = { ok: t4.status !== "completed" && unsent && refusedRequests.some((r) => r.reason === "refused"), billing: "proxy", capUsd: capUsd, turn: t4.status, refusedUnsent: unsent, ...(refusedRequests.length ? { refusal: refusedRequests.at(-1) } : {}) };
422
+ }
423
+ else
424
+ stage2.limits = { ok: true, billing: "plan", maxTurns: recipe.model.maxTurns, maxToolCalls: recipe.model.maxToolCalls, why: "the adapter stops the run at these; the vendor bills the owner's plan" };
425
+ await other.session.close();
426
+ // Stage 2: the pin held at every start; no side request.
427
+ stage2.pins = { ok: starts.length > 0 && starts.every((sha) => sha === pin.sha256), binary, sha256: pin.sha256, pinnedBy: pin.by, archiveSha256: release.sha256, starts: starts.length };
428
+ if (recipe.model.billing === "proxy") {
429
+ const paths = [...new Set(forwarded.map((r) => `${r.method} ${r.path}`))];
430
+ // What the agent asked the proxy for beyond the Messages route: refused there, never sent on.
431
+ const atProxy = logs.filter((l) => /: refused$/.test(l.message) && typeof l.path === "string" && !String(l.path).startsWith("/v1/messages")).map((l) => `${String(l.method)} ${String(l.path)}`);
432
+ // The provider's Messages route, under its own prefix (OpenRouter's is /api/v1/messages).
433
+ stage2.side_requests = { ok: forwarded.every((r) => r.method === "POST" && r.path.endsWith("/v1/messages")), toProvider: paths, sent: forwarded.length, refusedAtProxy: atProxy, beyondLoopbackRefused: egress.asked.filter((a) => !a.tunneled).map((a) => `${a.method} ${a.target}`) };
434
+ }
435
+ else
436
+ stage2.side_requests = { ok: null, toVendor: [...new Set(egress.asked.filter((a) => a.tunneled).map((a) => a.target))], beyondLoopbackRefused: egress.asked.filter((a) => !a.tunneled).map((a) => `${a.method} ${a.target}`), why: "plan billing: the vendor's requests are tunneled to model.hosts through the check's proxy, so their content is not seen here" };
437
+ }
438
+ catch (error) {
439
+ failures.push(`the check stopped: ${error.message}`);
440
+ }
441
+ finally {
442
+ await egress.close();
443
+ await rm(work, { recursive: true, force: true }).catch(() => { });
444
+ }
445
+ for (const [stage, checks] of [["stage2", stage2], ["stage3", stage3]]) {
446
+ for (const [name, check] of Object.entries(checks))
447
+ if (check.ok === false)
448
+ failures.push(`${stage}.${name} failed`);
449
+ }
450
+ for (const name of ["tools_off", "env_allowlist", "limits", "pins", "side_requests"])
451
+ if (!(name in stage2) && !failures.some((f) => f.startsWith("the check stopped")))
452
+ failures.push(`stage2.${name} did not run`);
453
+ for (const name of ["mcp_tool", "resume", "denied_call", "other_runner"])
454
+ if (!(name in stage3) && !failures.some((f) => f.startsWith("the check stopped")))
455
+ failures.push(`stage3.${name} did not run`);
456
+ return {
457
+ ok: failures.length === 0,
458
+ ...head,
459
+ platform,
460
+ ...(options.model ? { model: options.model } : {}),
461
+ binary: { path: binary, sha256: pin.sha256, pinnedBy: pin.by },
462
+ stage2,
463
+ stage3,
464
+ facts: { resume: resumeFact, tool_gate: asked().length > 0 ? "permission" : "config", billing: recipe.model.billing },
465
+ // How the tool gate was reached: each permission the agent asked for, and each question the gate was asked.
466
+ gate: {
467
+ permissionsAsked: asked().map((l) => ({ toolCallId: l.toolCallId ?? null, kind: l.kind ?? null })),
468
+ asked: gateAsked,
469
+ },
470
+ spendUsd: lastBooking ? lastBooking.spentUsd() : 0,
471
+ failures,
472
+ };
473
+ }
474
+ /** The three facts and the verdict, as the command prints them. */
475
+ export function printedFacts(report) {
476
+ if (report.refused)
477
+ return [`harness-check: refused: ${report.refused.message}`];
478
+ const lines = [];
479
+ for (const [stage, checks] of [["stage 2", report.stage2 ?? {}], ["stage 3", report.stage3 ?? {}]]) {
480
+ for (const [name, check] of Object.entries(checks))
481
+ lines.push(`${stage} ${name}: ${check.ok === true ? "pass" : check.ok === false ? "FAIL" : `unverified (${String(check.why ?? "")})`}`);
482
+ }
483
+ lines.push(`resume: ${report.facts?.resume}`, `tool_gate: ${report.facts?.tool_gate}`, `billing: ${report.facts?.billing}`);
484
+ lines.push(`spend: ${report.spendUsd === null || report.spendUsd === undefined ? "unknown" : `$${report.spendUsd.toFixed(5)}`}`);
485
+ lines.push(`harness-check: ${report.ok ? "passed" : `FAILED (${report.failures.join("; ")})`}`);
486
+ return lines;
487
+ }
488
+ /** Writes the report to `file`. */
489
+ export const writeReport = (file, report) => writeFile(file, `${JSON.stringify(report, null, 2)}\n`);
@@ -0,0 +1,45 @@
1
+ import { type AcpPackage } from "./acp-package.js";
2
+ import { type ArchiveInstallOptions } from "./harness-archive.js";
3
+ export declare const CURSOR_ID = "cursor";
4
+ /** The key Cursor runs on: the owner's Cursor API key, read by name, handed to Cursor's runs and no other. */
5
+ export declare const CURSOR_KEY = "CURSOR_API_KEY";
6
+ /** The owner's limits for a run of Cursor (CURSOR_LIMITS, the package's, by default): its turns and its tool calls. */
7
+ export declare const CURSOR_MAX_TURNS_ENV = "AGENTRUN_CURSOR_MAX_TURNS";
8
+ export declare const CURSOR_MAX_TOOL_CALLS_ENV = "AGENTRUN_CURSOR_MAX_TOOL_CALLS";
9
+ /** The provider a Cursor model is named under (`cursor/<model>`, `cursor/default` for Cursor's own default). */
10
+ export declare const CURSOR_PROVIDER = "cursor";
11
+ export declare const CURSOR_DEFAULT_MODEL = "default";
12
+ /** Why Cursor does not run here: a code and words that start with it and end with what to do. */
13
+ export type CursorMissing = {
14
+ readonly code: string;
15
+ readonly message: string;
16
+ };
17
+ /** Cursor's folder in `data`. Its launcher is at the pin's `cmd` inside it (`./dist-package/cursor-agent`). */
18
+ export declare const cursorDirOf: (data: string) => string;
19
+ /** The command that installs Cursor into `data`: naming it with --data unless it is the agentrun command's own. */
20
+ export declare function cursorInstallLine(acp: AcpPackage, data: string, env?: NodeJS.ProcessEnv): string;
21
+ /** The limits a run of Cursor stops at on `env`: the owner's (CURSOR_MAX_TURNS_ENV, CURSOR_MAX_TOOL_CALLS_ENV), else the
22
+ * package's. A setting that is no whole number is refused by name. */
23
+ export declare function cursorLimitsOf(acp: AcpPackage, env: NodeJS.ProcessEnv): {
24
+ maxTurns: number;
25
+ maxToolCalls: number;
26
+ };
27
+ /** The card Cursor's owner reads (capabilities' harness `card`), with this server's limits; none where Cursor's adapter is
28
+ * not beside the server, or its limits are set wrong (its refusal says so). */
29
+ export declare function cursorCardOf(env: NodeJS.ProcessEnv): string | undefined;
30
+ /** Why Cursor is not listed here (HarnessEntry.hidden): not installed, or its launcher not the pinned one, in words that end
31
+ * with what to do, restarting AgentRun included. Undefined once it is installed. The files beside the launcher are
32
+ * checked off the event loop, by cursorMissing at each run and the start's probe. */
33
+ export declare function cursorHidden(env: NodeJS.ProcessEnv): string | undefined;
34
+ /** Why Cursor cannot run here, its launcher and every file beside it checked off the event loop; else its launcher. */
35
+ export declare function cursorMissing(env: NodeJS.ProcessEnv): Promise<{
36
+ missing: CursorMissing;
37
+ } | {
38
+ binary: string;
39
+ }>;
40
+ /** Installs the pinned Cursor into `data` (agentrun-serve install-harness cursor). */
41
+ export declare function installCursor(data: string, options?: ArchiveInstallOptions, env?: NodeJS.ProcessEnv): Promise<{
42
+ installed: "already" | "now";
43
+ binary: string;
44
+ version: string;
45
+ }>;