@parcha/agentrun-serve 0.1.0-beta.56 → 0.1.0-beta.58

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 (312) hide show
  1. package/CHANGELOG.md +281 -0
  2. package/README.md +246 -66
  3. package/dist/acp-package.d.ts +2 -0
  4. package/dist/adapters.d.ts +15 -3
  5. package/dist/adapters.js +17 -6
  6. package/dist/agent-package.d.ts +3 -3
  7. package/dist/agent-package.js +17 -8
  8. package/dist/api-keys.d.ts +76 -0
  9. package/dist/api-keys.js +217 -0
  10. package/dist/api-only.d.ts +15 -5
  11. package/dist/api-only.js +32 -8
  12. package/dist/box-paths.d.ts +4 -3
  13. package/dist/box-paths.js +7 -4
  14. package/dist/browser-hold.d.ts +23 -0
  15. package/dist/browser-hold.js +48 -0
  16. package/dist/browser-person.d.ts +3 -0
  17. package/dist/browser-person.js +4 -1
  18. package/dist/chatgpt-plan.d.ts +18 -8
  19. package/dist/chatgpt-plan.js +91 -34
  20. package/dist/claude-login-token.d.ts +117 -0
  21. package/dist/claude-login-token.js +737 -0
  22. package/dist/claude-login.d.ts +120 -22
  23. package/dist/claude-login.js +347 -63
  24. package/dist/claude-sign-in.d.ts +17 -6
  25. package/dist/claude-sign-in.js +42 -39
  26. package/dist/cli.js +33 -10
  27. package/dist/composio-made.d.ts +4 -0
  28. package/dist/composio-made.js +4 -0
  29. package/dist/composio-preset.d.ts +43 -2
  30. package/dist/composio-preset.js +92 -4
  31. package/dist/computer-attach.d.ts +35 -17
  32. package/dist/computer-attach.js +301 -49
  33. package/dist/computer-held-routes.d.ts +5 -4
  34. package/dist/computer-held-routes.js +29 -8
  35. package/dist/computer-held.d.ts +6 -1
  36. package/dist/computer-held.js +14 -0
  37. package/dist/computer-record.js +4 -2
  38. package/dist/computer-viewer.js +4 -1
  39. package/dist/computers.d.ts +10 -10
  40. package/dist/computers.js +5 -5
  41. package/dist/console/assets/{backend-Boh7tC4i.js → backend-CSAWUqtZ.js} +19 -19
  42. package/dist/console/assets/index-Bwn1oTem.css +1 -0
  43. package/dist/console/assets/index-DPh29cyz.js +747 -0
  44. package/dist/console/index.html +2 -2
  45. package/dist/decisions.d.ts +1 -1
  46. package/dist/decisions.js +1 -1
  47. package/dist/dial-relay.d.ts +25 -4
  48. package/dist/dial-relay.js +129 -1
  49. package/dist/docker-host-addresses.d.ts +22 -11
  50. package/dist/docker-host-addresses.js +38 -26
  51. package/dist/env-switch.d.ts +8 -0
  52. package/dist/env-switch.js +31 -2
  53. package/dist/errors.d.ts +1 -0
  54. package/dist/errors.js +2 -0
  55. package/dist/fal-price.d.ts +56 -20
  56. package/dist/fal-price.js +400 -90
  57. package/dist/handed-values.d.ts +43 -1
  58. package/dist/handed-values.js +119 -2
  59. package/dist/harness-archive.d.ts +13 -10
  60. package/dist/harness-archive.js +60 -34
  61. package/dist/harness-check.d.ts +3 -1
  62. package/dist/harness-check.js +25 -46
  63. package/dist/harness-keys.d.ts +73 -27
  64. package/dist/harness-keys.js +194 -61
  65. package/dist/harness-recipe-entry.d.ts +8 -7
  66. package/dist/harness-recipe-entry.js +21 -32
  67. package/dist/harness-recipe.d.ts +38 -25
  68. package/dist/harness-recipe.js +49 -36
  69. package/dist/harness-sign-in.js +12 -23
  70. package/dist/harness-table.d.ts +10 -3
  71. package/dist/harness-table.js +26 -21
  72. package/dist/harness.d.ts +1 -0
  73. package/dist/harness.js +17 -5
  74. package/dist/hosted-search.d.ts +1 -1
  75. package/dist/hosted-search.js +1 -2
  76. package/dist/import-worker.d.ts +4 -2
  77. package/dist/import-worker.js +9 -2
  78. package/dist/in-flight.d.ts +26 -0
  79. package/dist/in-flight.js +52 -0
  80. package/dist/key-refusal.d.ts +9 -4
  81. package/dist/key-refusal.js +107 -25
  82. package/dist/learn/ledger.d.ts +170 -0
  83. package/dist/learn/ledger.js +218 -0
  84. package/dist/learn/promote.d.ts +3 -3
  85. package/dist/learn/promote.js +1 -1
  86. package/dist/learn/secrets.d.ts +13 -3
  87. package/dist/learn/secrets.js +118 -17
  88. package/dist/learning-cost.d.ts +28 -23
  89. package/dist/learning-cost.js +19 -23
  90. package/dist/link-check.js +1 -1
  91. package/dist/live-reach.d.ts +2 -0
  92. package/dist/live-reach.js +2 -0
  93. package/dist/llms.txt +1 -1
  94. package/dist/marketplace.d.ts +77 -0
  95. package/dist/marketplace.js +224 -0
  96. package/dist/mcp-api-only-origins.d.ts +35 -0
  97. package/dist/mcp-api-only-origins.js +57 -0
  98. package/dist/mcp-gateway.d.ts +7 -5
  99. package/dist/mcp-gateway.js +9 -12
  100. package/dist/mcp-secret-writes.js +5 -3
  101. package/dist/mcp-servers-store.d.ts +28 -6
  102. package/dist/mcp-servers-store.js +53 -4
  103. package/dist/media-duration.d.ts +3 -0
  104. package/dist/media-duration.js +90 -9
  105. package/dist/micro.d.ts +2 -0
  106. package/dist/micro.js +2 -0
  107. package/dist/model-form.d.ts +5 -4
  108. package/dist/model-form.js +11 -7
  109. package/dist/model.d.ts +10 -6
  110. package/dist/model.js +16 -11
  111. package/dist/monid.d.ts +14 -1
  112. package/dist/monid.js +103 -26
  113. package/dist/ollama-provider.d.ts +7 -1
  114. package/dist/ollama-provider.js +14 -2
  115. package/dist/openapi.js +210 -37
  116. package/dist/otel/genai.d.ts +65 -0
  117. package/dist/otel/genai.js +116 -0
  118. package/dist/otel/tracer.d.ts +55 -0
  119. package/dist/otel/tracer.js +308 -0
  120. package/dist/page.d.ts +2 -0
  121. package/dist/page.js +3 -1
  122. package/dist/paid-calls.d.ts +1 -32
  123. package/dist/paid-calls.js +4 -39
  124. package/dist/place-offers.d.ts +4 -0
  125. package/dist/place-offers.js +7 -4
  126. package/dist/provider.d.ts +11 -2
  127. package/dist/provider.js +59 -8
  128. package/dist/redact/match.d.ts +30 -3
  129. package/dist/redact/match.js +422 -41
  130. package/dist/refusal-words.d.ts +11 -0
  131. package/dist/refusal-words.js +11 -0
  132. package/dist/run-census.d.ts +67 -0
  133. package/dist/run-census.js +240 -0
  134. package/dist/run-computer.d.ts +6 -3
  135. package/dist/run-computer.js +4 -1
  136. package/dist/run-cut.d.ts +15 -6
  137. package/dist/run-cut.js +30 -9
  138. package/dist/run-files.d.ts +3 -0
  139. package/dist/run-files.js +3 -0
  140. package/dist/run-launch.d.ts +12 -1
  141. package/dist/run-launch.js +9 -10
  142. package/dist/run-learning-served.d.ts +4 -2
  143. package/dist/run-model-key.d.ts +8 -0
  144. package/dist/run-model-key.js +31 -1
  145. package/dist/run-reads-over-store.d.ts +24 -6
  146. package/dist/run-reads-over-store.js +67 -23
  147. package/dist/run-recordings.d.ts +5 -1
  148. package/dist/run-recordings.js +39 -14
  149. package/dist/run-timeline-served.d.ts +2 -0
  150. package/dist/run-timeline-served.js +2 -2
  151. package/dist/run-usage.d.ts +1 -0
  152. package/dist/run-view.d.ts +1 -2
  153. package/dist/run-view.js +2 -1
  154. package/dist/runnable.d.ts +10 -1
  155. package/dist/runnable.js +20 -8
  156. package/dist/runner/adapter-loop.d.ts +11 -0
  157. package/dist/runner/adapter-loop.js +58 -26
  158. package/dist/runner/adapter-run-spec.d.ts +55 -11
  159. package/dist/runner/adapter-run-spec.js +183 -52
  160. package/dist/runner/adapters/pi.js +25 -3
  161. package/dist/runner/beside.d.ts +9 -2
  162. package/dist/runner/beside.js +27 -9
  163. package/dist/runner/big-writes.js +1 -10
  164. package/dist/runner/claim-secrets.d.ts +27 -10
  165. package/dist/runner/claim-secrets.js +49 -22
  166. package/dist/runner/cli-run-spec.d.ts +6 -0
  167. package/dist/runner/cli-run-spec.js +97 -38
  168. package/dist/runner/computer-journal.d.ts +9 -1
  169. package/dist/runner/computer-journal.js +26 -0
  170. package/dist/runner/conformance/harness.js +1 -1
  171. package/dist/runner/feedback-round.js +3 -0
  172. package/dist/runner/harness-loops.d.ts +6 -5
  173. package/dist/runner/harness-loops.js +7 -7
  174. package/dist/runner/held.d.ts +24 -6
  175. package/dist/runner/journal-kinds.d.ts +5 -0
  176. package/dist/runner/journal-kinds.js +5 -0
  177. package/dist/runner/main.d.ts +11 -6
  178. package/dist/runner/main.js +19 -9
  179. package/dist/runner/mcp-claim.js +31 -3
  180. package/dist/runner/mcp-run.d.ts +9 -0
  181. package/dist/runner/mcp-run.js +11 -5
  182. package/dist/runner/model-route.d.ts +17 -0
  183. package/dist/runner/model-route.js +120 -2
  184. package/dist/runner/presence.d.ts +11 -1
  185. package/dist/runner/presence.js +7 -0
  186. package/dist/runner/reflect-hook.js +1 -1
  187. package/dist/runner/run-child-host.d.ts +22 -8
  188. package/dist/runner/run-child-host.js +128 -41
  189. package/dist/runner/run-child.js +5 -2
  190. package/dist/runner/runner.d.ts +17 -3
  191. package/dist/runner/runner.js +130 -34
  192. package/dist/runner/save-slots.js +2 -1
  193. package/dist/runner/store-port.d.ts +1 -1
  194. package/dist/runner/store-secrets.d.ts +6 -0
  195. package/dist/runner/store-secrets.js +49 -7
  196. package/dist/runner/subagent.d.ts +11 -0
  197. package/dist/runner/subagent.js +16 -38
  198. package/dist/runner/workflow-first.d.ts +35 -15
  199. package/dist/runner/workflow-first.js +38 -25
  200. package/dist/runner/workflow-spec.js +4 -3
  201. package/dist/runs-over-store.d.ts +15 -6
  202. package/dist/runs-over-store.js +33 -21
  203. package/dist/scrub-command.d.ts +73 -0
  204. package/dist/scrub-command.js +307 -0
  205. package/dist/secret-cut.d.ts +73 -0
  206. package/dist/secret-cut.js +291 -4
  207. package/dist/secret-rules.d.ts +143 -0
  208. package/dist/secret-rules.js +2564 -0
  209. package/dist/secrets.d.ts +7 -0
  210. package/dist/secrets.js +20 -0
  211. package/dist/server-keys.d.ts +20 -0
  212. package/dist/server-keys.js +25 -6
  213. package/dist/server.d.ts +65 -13
  214. package/dist/server.js +470 -157
  215. package/dist/skills/agentrun-serve/SKILL.md +4 -0
  216. package/dist/slots.d.ts +9 -0
  217. package/dist/slots.js +45 -0
  218. package/dist/store/index.d.ts +1 -1
  219. package/dist/store/index.js +1 -1
  220. package/dist/store/journal/storage.js +1 -1
  221. package/dist/store/postgres/migrations/0027_run_launch_census.sql +31 -0
  222. package/dist/store/postgres/migrations/0028_learning_ledger.sql +44 -0
  223. package/dist/store/schema.d.ts +23 -0
  224. package/dist/store/schema.js +58 -2
  225. package/dist/store/seal.d.ts +6 -1
  226. package/dist/store/seal.js +5 -3
  227. package/dist/store/sqlite/run-launch.d.ts +9 -1
  228. package/dist/store/sqlite/run-launch.js +24 -13
  229. package/dist/store/sqlite/run-patch.d.ts +12 -2
  230. package/dist/store/sqlite/run-patch.js +42 -5
  231. package/dist/store/sqlite/store.js +105 -12
  232. package/dist/store/store.d.ts +57 -2
  233. package/dist/store/store.js +20 -0
  234. package/dist/store-reads/learning.d.ts +84 -124
  235. package/dist/store-reads/learning.js +210 -274
  236. package/dist/store-view.d.ts +3 -0
  237. package/dist/store-view.js +3 -3
  238. package/dist/suggestions.js +3 -2
  239. package/dist/template-eval.d.ts +39 -9
  240. package/dist/template-eval.js +191 -60
  241. package/dist/template-import.js +6 -2
  242. package/dist/templates.d.ts +10 -2
  243. package/dist/templates.js +28 -8
  244. package/dist/timeline/labels.d.ts +6 -4
  245. package/dist/timeline/labels.js +18 -6
  246. package/dist/timeline/timeline.d.ts +5 -0
  247. package/dist/timeline/timeline.js +14 -8
  248. package/dist/timeline/util.js +1 -1
  249. package/dist/timeline/web-calls.d.ts +22 -7
  250. package/dist/timeline/web-calls.js +106 -35
  251. package/dist/tool-gate.d.ts +42 -3
  252. package/dist/tool-gate.js +66 -5
  253. package/dist/tool-keys-store.d.ts +2 -4
  254. package/dist/tool-keys-store.js +5 -21
  255. package/dist/tool-keys.d.ts +2 -2
  256. package/dist/tool-keys.js +2 -2
  257. package/dist/tool-list.js +1 -1
  258. package/dist/tool-plane.d.ts +2 -2
  259. package/dist/tool-plane.js +35 -33
  260. package/dist/tools.js +13 -7
  261. package/dist/trigger-targets.d.ts +4 -0
  262. package/dist/trigger-targets.js +9 -2
  263. package/dist/triggers.d.ts +67 -4
  264. package/dist/triggers.js +171 -22
  265. package/dist/until.d.ts +3 -0
  266. package/dist/until.js +11 -0
  267. package/dist/web-fake.d.ts +1 -3
  268. package/dist/web-fake.js +7 -18
  269. package/dist/web-fetch.d.ts +6 -72
  270. package/dist/web-fetch.js +11 -265
  271. package/dist/web-run.d.ts +31 -0
  272. package/dist/web-run.js +90 -0
  273. package/dist/web-save.d.ts +10 -13
  274. package/dist/web-save.js +13 -55
  275. package/dist/web-search.d.ts +9 -127
  276. package/dist/web-search.js +23 -259
  277. package/dist/wires.d.ts +13 -0
  278. package/dist/wires.js +11 -0
  279. package/dist/workflow-run.d.ts +5 -4
  280. package/dist/workflow-run.js +5 -4
  281. package/dist/workspace/attached-computers.d.ts +32 -9
  282. package/dist/workspace/attached-computers.js +77 -13
  283. package/dist/workspace/computer-deps.d.ts +8 -2
  284. package/dist/workspace/computer-deps.js +10 -3
  285. package/dist/workspace/computer-for-claim.d.ts +12 -1
  286. package/dist/workspace/computer-for-claim.js +83 -11
  287. package/dist/workspace/computer-kept.d.ts +3 -0
  288. package/dist/workspace/computer-kept.js +11 -2
  289. package/dist/workspace/index.d.ts +1 -1
  290. package/dist/workspace/index.js +1 -1
  291. package/dist/workspace/kind-skills.d.ts +4 -0
  292. package/dist/workspace/kind-skills.js +9 -0
  293. package/dist/workspace/paired-route.d.ts +91 -0
  294. package/dist/workspace/paired-route.js +153 -0
  295. package/dist/workspace/synced-folder.js +3 -4
  296. package/dist/wrapped.d.ts +20 -6
  297. package/dist/wrapped.js +66 -25
  298. package/package.json +17 -11
  299. package/skills/agentrun-serve/SKILL.md +4 -0
  300. package/templates/README.md +32 -10
  301. package/dist/console/assets/index-CQ3cJRzI.js +0 -746
  302. package/dist/console/assets/index-DKkaS3a0.css +0 -1
  303. package/dist/exa-keyless.d.ts +0 -34
  304. package/dist/exa-keyless.js +0 -118
  305. package/dist/firecrawl-keyless.d.ts +0 -41
  306. package/dist/firecrawl-keyless.js +0 -152
  307. package/dist/keyless-mcp.d.ts +0 -36
  308. package/dist/keyless-mcp.js +0 -127
  309. package/dist/text-urls.d.ts +0 -38
  310. package/dist/text-urls.js +0 -170
  311. package/dist/web-fetch-direct.d.ts +0 -119
  312. package/dist/web-fetch-direct.js +0 -190
package/dist/secrets.d.ts CHANGED
@@ -12,6 +12,10 @@ export declare const MCP_AUTH = "AGENTRUN_MCP_AUTH";
12
12
  /** The decision keys among them: a run's process gets them only on its decision descriptor (decisions.ts), never with
13
13
  * the secrets on its pipe, which are its tools' environment. */
14
14
  export declare const DECISION_KEYS: readonly string[];
15
+ /** The runner's OpenTelemetry settings (its OTEL_* variables, JSON), handed to a run's process on the same pipe so the
16
+ * run's trace is exported as the runner's would be: never in any environment (an OTLP header is a backend's key), held
17
+ * apart from the secrets, so no tool's environment has them. Read by otel/tracer.ts (handedOtel). */
18
+ export declare const OTEL_PAIR = "AGENTRUN_OTEL";
15
19
  /** NAME=VALUE pairs, each ended by a NUL: what a pipe of secrets carries. A runner writes a run's own process its pairs
16
20
  * with it (run-child-host.ts), as a launcher writes its server's. */
17
21
  export declare const encode: (pairs: Iterable<readonly [string, string]>) => Buffer;
@@ -53,6 +57,9 @@ export declare const withoutSecrets: (env: NodeJS.ProcessEnv) => NodeJS.ProcessE
53
57
  /** What a run's process is handed: the secrets named `names` that this process holds, or its server saved (`stored`),
54
58
  * as its pipe carries them. */
55
59
  export declare function handover(names: readonly string[], stored?: StoredKeys): Buffer;
60
+ /** The OpenTelemetry settings this process was handed (OTEL_PAIR), each an OTEL_* name's value; none when it was handed
61
+ * none. */
62
+ export declare function handedOtel(): Record<string, string>;
56
63
  /** The MCP credentials this process was handed (MCP_AUTH), by server; none when it was handed none. */
57
64
  export declare function mcpCredentials(): Record<string, {
58
65
  url: string;
package/dist/secrets.js CHANGED
@@ -39,6 +39,11 @@ let handed;
39
39
  * the secrets, so it is no tool's environment and no key a scan looks for by name. */
40
40
  const SIGN_IN_PAIR = "AGENTRUN_SIGN_IN";
41
41
  let signIn;
42
+ /** The runner's OpenTelemetry settings (its OTEL_* variables, JSON), handed to a run's process on the same pipe so the
43
+ * run's trace is exported as the runner's would be: never in any environment (an OTLP header is a backend's key), held
44
+ * apart from the secrets, so no tool's environment has them. Read by otel/tracer.ts (handedOtel). */
45
+ export const OTEL_PAIR = "AGENTRUN_OTEL";
46
+ let otel;
42
47
  /** NAME=VALUE pairs, each ended by a NUL: what a pipe of secrets carries. A runner writes a run's own process its pairs
43
48
  * with it (run-child-host.ts), as a launcher writes its server's. */
44
49
  export const encode = (pairs) => Buffer.concat([...pairs].map(([name, value]) => Buffer.from(`${name}=${value}\0`)));
@@ -49,6 +54,8 @@ function decode(bytes) {
49
54
  held.set(pair.slice(0, at), pair.slice(at + 1));
50
55
  else if (pair.slice(0, at) === SIGN_IN_PAIR)
51
56
  signIn = pair.slice(at + 1);
57
+ else if (pair.slice(0, at) === OTEL_PAIR)
58
+ otel = pair.slice(at + 1);
52
59
  }
53
60
  }
54
61
  /** Exactly `length` bytes of `fd`, read as the launcher's writer writes them: the end of file before then is a writer
@@ -197,6 +204,19 @@ export function handover(names, stored) {
197
204
  return value === undefined ? [] : [[name, value]];
198
205
  }));
199
206
  }
207
+ /** The OpenTelemetry settings this process was handed (OTEL_PAIR), each an OTEL_* name's value; none when it was handed
208
+ * none. */
209
+ export function handedOtel() {
210
+ try {
211
+ const parsed = JSON.parse(otel ?? "{}");
212
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
213
+ return {};
214
+ return Object.fromEntries(Object.entries(parsed).filter((pair) => pair[0].startsWith("OTEL_") && typeof pair[1] === "string"));
215
+ }
216
+ catch {
217
+ return {};
218
+ }
219
+ }
200
220
  /** The MCP credentials this process was handed (MCP_AUTH), by server; none when it was handed none. */
201
221
  export function mcpCredentials() {
202
222
  try {
@@ -1,4 +1,24 @@
1
1
  import { type SealedKeys } from "./store/index.js";
2
+ /** Why a saved value does not open: sealed under another seal key (its fingerprint no longer matches), or damaged. */
3
+ export declare const UNREADABLE: readonly ["seal_key_changed", "file_unreadable"];
4
+ export type Unreadable = (typeof UNREADABLE)[number];
5
+ /** A sealed row opened now, or why not. */
6
+ export type Opened = {
7
+ value: string;
8
+ } | {
9
+ unreadable: Unreadable;
10
+ };
11
+ /** Why a saved harness key (harness-keys.ts) is not one its recipe's runs get, so it is entered again: saved for another
12
+ * recipe file of its id (`recipe_changed`; or bound to none), or one of UNREADABLE. Here, beside UNREADABLE, so the API
13
+ * document reads it without loading the keys layer. */
14
+ export declare const HARNESS_KEY_REENTER: readonly ["recipe_changed", "seal_key_changed", "file_unreadable"];
15
+ /** The fingerprint of a seal key: an HMAC of a fixed label under it, stable across restarts, so a value whose fingerprint
16
+ * no longer matches was sealed under another key (seal_key_changed), told apart from one that is simply damaged. No
17
+ * secret: neither the key nor a hash of it. Kept beside the sealed rows, in a settings row of the layer that writes them. */
18
+ export declare const sealFingerprint: (key: Buffer) => string;
19
+ /** Opens the sealed bytes of the row `name` now, or why not: a fingerprint kept for it that no longer matches `sealKey`'s
20
+ * (seal_key_changed); else unseal, which fails as file_unreadable. `fp` undefined: none was kept, so only unseal tells. */
21
+ export declare function openSealed(sealKey: Buffer, name: string, sealed: Uint8Array, fp: string | undefined): Opened;
2
22
  /** Saves `value` sealed under `name` (e.g. a model provider's key, or an account key like "archil.api_key"). */
3
23
  export declare function putSealedKey(store: {
4
24
  sealedKeys: Pick<SealedKeys, "put">;
@@ -3,7 +3,30 @@
3
3
  // them; only this process does, when asked, with the seal key the launcher hands it (AGENTRUN_SEAL_KEY). A value that does
4
4
  // not open (another seal key, or damaged) reads as not set, never a clear fallback, as the file-based tool keys do. The
5
5
  // store-backed replacement for the tool-keys.json field store; the cut wires it.
6
+ import { createHmac } from "node:crypto";
6
7
  import { sealColumn, sealedAt, unsealColumn } from "./store/index.js";
8
+ /** Why a saved value does not open: sealed under another seal key (its fingerprint no longer matches), or damaged. */
9
+ export const UNREADABLE = ["seal_key_changed", "file_unreadable"];
10
+ /** Why a saved harness key (harness-keys.ts) is not one its recipe's runs get, so it is entered again: saved for another
11
+ * recipe file of its id (`recipe_changed`; or bound to none), or one of UNREADABLE. Here, beside UNREADABLE, so the API
12
+ * document reads it without loading the keys layer. */
13
+ export const HARNESS_KEY_REENTER = ["recipe_changed", ...UNREADABLE];
14
+ /** The fingerprint of a seal key: an HMAC of a fixed label under it, stable across restarts, so a value whose fingerprint
15
+ * no longer matches was sealed under another key (seal_key_changed), told apart from one that is simply damaged. No
16
+ * secret: neither the key nor a hash of it. Kept beside the sealed rows, in a settings row of the layer that writes them. */
17
+ export const sealFingerprint = (key) => createHmac("sha256", key).update("agentrun-serve sealed_keys key check").digest("base64url");
18
+ /** Opens the sealed bytes of the row `name` now, or why not: a fingerprint kept for it that no longer matches `sealKey`'s
19
+ * (seal_key_changed); else unseal, which fails as file_unreadable. `fp` undefined: none was kept, so only unseal tells. */
20
+ export function openSealed(sealKey, name, sealed, fp) {
21
+ if (fp !== undefined && fp !== sealFingerprint(sealKey))
22
+ return { unreadable: "seal_key_changed" };
23
+ try {
24
+ return { value: unsealColumn(sealKey, sealedAt.sealedKey(name), sealed).toString("utf8") };
25
+ }
26
+ catch {
27
+ return { unreadable: "file_unreadable" };
28
+ }
29
+ }
7
30
  /** Saves `value` sealed under `name` (e.g. a model provider's key, or an account key like "archil.api_key"). */
8
31
  export async function putSealedKey(store, sealKey, name, value) {
9
32
  await store.sealedKeys.put(name, sealColumn(sealKey, sealedAt.sealedKey(name), value));
@@ -14,12 +37,8 @@ export async function getSealedKey(store, sealKey, name) {
14
37
  const sealed = await store.sealedKeys.get(name);
15
38
  if (sealed === undefined)
16
39
  return undefined;
17
- try {
18
- return unsealColumn(sealKey, sealedAt.sealedKey(name), sealed).toString("utf8");
19
- }
20
- catch {
21
- return undefined;
22
- }
40
+ const opened = openSealed(sealKey, name, sealed, undefined);
41
+ return "value" in opened ? opened.value : undefined;
23
42
  }
24
43
  /** The key's row goes. */
25
44
  export async function removeSealedKey(store, name) {
package/dist/server.d.ts CHANGED
@@ -40,12 +40,15 @@ export type ServeOptions = {
40
40
  openSetup?: boolean;
41
41
  /** With accounts: the address people open (AGENTRUN_PUBLIC_URL), which the printed setup link uses. */
42
42
  publicUrl?: string;
43
- /** With open setup: the home whose Claude Code, Codex and pi sessions setup offers to import (default this user's),
44
- * and the temp directory whose projects it leaves out (default the OS's). */
43
+ /** The home whose Claude Code, Codex and pi sessions setup offers to import and GET /v2/wrapped reads (default this
44
+ * user's), and the temp directory whose projects setup leaves out (default the OS's). */
45
45
  sessionsHome?: {
46
46
  home: string;
47
47
  temp?: string;
48
48
  };
49
+ /** How long GET /v2/wrapped waits for its read of `sessionsHome`'s home before it answers 503 with a retry, while the
50
+ * read goes on (default WRAPPED_WAIT_MS, 15 s). */
51
+ wrappedWaitMs?: number;
49
52
  /** With open setup on this machine, and no owner yet: count the sessions setup would import as the server starts, so
50
53
  * the offer has its numbers by the time the page opens (the CLI sets it). */
51
54
  countSessions?: boolean;
@@ -94,6 +97,8 @@ export type ServeOptions = {
94
97
  * (the console, sign-in, setup, settings, MCP, triggers, hooks, ...) with a 404 before anything reads the request.
95
98
  * It has no owner: accounts and open setup are off, there being no page to sign in to. */
96
99
  apiOnly?: boolean;
100
+ /** AGENTRUN_API_ONLY_MCP_ORIGINS, read as the environment's is (the serve README's API-only section); only with apiOnly. */
101
+ apiOnlyMcpOrigins?: readonly string[];
97
102
  /** The launch hook (AGENTRUN_LAUNCH_HOOK_URL and _SECRET, trigger-launch-hook.ts): each trigger firing that would start
98
103
  * a run is handed to the host instead, which starts it through the API. None, firings start their runs here. */
99
104
  launchHook?: LaunchHook;
@@ -141,14 +146,11 @@ export type ServeOptions = {
141
146
  * with goes through (the tests' fake for that check alone), in place of monid's API; the runs' calls go through
142
147
  * `fauxMonid`'s. */
143
148
  fauxMonidCheck?: string;
144
- /** With `faux` only: a module whose default export is the fetch the Anthropic and OpenAI providers send through, in
145
- * place of their APIs, for web_search's own request to the provider the revision's model names (model.ts). */
146
- fauxUpstream?: string;
147
149
  /** With `faux` only: a module whose default export is the fetch web_search's keyless Exa search sends through, in place
148
- * of Exa's MCP endpoint (exa-keyless.ts). */
150
+ * of Exa's MCP endpoint (web-run.ts FAUX_EXA_ENV). */
149
151
  fauxExa?: string;
150
152
  /** With `faux` only: the URL of a fake MCP server (a test's, on loopback) that web_search's and web_fetch's keyless
151
- * Firecrawl ask in place of Firecrawl's endpoint (firecrawl-keyless.ts). A URL, not a module: it is passed as given.
153
+ * Firecrawl ask in place of Firecrawl's endpoint (web-run.ts FAUX_FIRECRAWL_ENV). A URL, not a module: it is passed as given.
152
154
  * Under `faux` with none, keyless Firecrawl is never asked. */
153
155
  fauxFirecrawl?: string;
154
156
  /** A module of harness table entries merged over the built-in ones (harness-table.ts HARNESS_TABLE_ENV): a test's
@@ -177,6 +179,9 @@ export type ServeOptions = {
177
179
  /** Under `faux`: a file read as this server's /proc/self/mountinfo (box-paths.ts), a container's in a test; absent (and
178
180
  * no FAUX_MOUNTINFO_ENV), a faux server is on a host. */
179
181
  fauxMountinfo?: string;
182
+ /** Under `faux`: the directory a Docker computer's computerd build is looked for in at the start (the computer
183
+ * package's dockerDaemonOf), in place of that package's own build; absent, a faux server doesn't check for one. */
184
+ fauxDaemonDir?: string;
180
185
  /** For tests: whether Docker's start probe takes this server to be in a container (place-offers.ts containerReason),
181
186
  * in place of its own marks; a faux server's is a host's. */
182
187
  probeContainer?: ContainerFacts;
@@ -194,8 +199,9 @@ export type ServeOptions = {
194
199
  * LISTER_IDLE_MS). `Infinity`: it builds only when Serve.listingSettled asks, so a test reads what a list builds alone. */
195
200
  listerIdleMs?: number;
196
201
  /** No runner beside this server in its process (the CLI's --no-runner, the image's server-and-runner): a paired
197
- * computer's socket is held here, where no run reaches it, so a pairing code, the pair answer and each paired computer
198
- * say so and how to start the server instead (attached-computers.ts RUNNER_APART_WORDS). */
202
+ * computer's socket is held here while no run holds it, and relayed to the runner that holds a run of it
203
+ * (workspace/paired-route.ts); while no runner relays, a pairing code, the pair answer and each paired computer say no
204
+ * run reaches it, and what to do instead (attached-computers.ts RUNNER_APART_WORDS). */
199
205
  runnerApart?: boolean;
200
206
  /** For tests: the attach socket's liveness timing (computer-attach.ts AttachTiming), a relayed dial's included; the
201
207
  * protocol's by default. */
@@ -262,6 +268,9 @@ export type ServeOptions = {
262
268
  /** A test's seam: the GitHub a template import reads, its API's origin and the one host it may be sent to, in place of
263
269
  * GitHub's own (template-source.ts GITHUB_HOSTS). */
264
270
  templateImportApi?: string;
271
+ /** A test's seam: the marketplace whose list GET /marketplace/templates answers, its address, or null for none, in
272
+ * place of AGENTRUN_MARKETPLACE's (marketplace.ts marketplaceUrlOf). */
273
+ marketplace?: string | null;
265
274
  /** The waits before each try again of a webhook delivery (default 5 s, 5 min, 30 min, 2 h, 5 h and 10 h: webhooks.ts RETRY_MS). */
266
275
  webhookRetryMs?: readonly number[];
267
276
  /** The bound on one webhook try, whole milliseconds under the 60 s claim it holds its message by (default 15 s:
@@ -306,6 +315,14 @@ export type Serve = {
306
315
  /** The live sockets of the computers paired with this server (computer-attach.ts): a runner beside the server in this
307
316
  * process takes it (runner/beside.ts), so its runs can use them. */
308
317
  attachHub: AttachHub;
318
+ /** The name and incarnation the runner beside this server in its process runs under (runner/beside.ts), new at each
319
+ * start: its run's route of a paired box names them, and this server's attach routes read such a route as this hub's
320
+ * (computer-attach.ts beside), so the box stays here for the run and a runner apart's take for another run is
321
+ * refused meanwhile. */
322
+ beside: {
323
+ readonly runner: string;
324
+ readonly incarnation: string;
325
+ };
309
326
  /** What a dial provider's create takes of this server (HostedProvider's dial): the address its machines dial
310
327
  * (AGENTRUN_PUBLIC_URL, absent without one), the tokens it mints for them (computer-attach.ts machineTokens) and the
311
328
  * hub their sockets land in. The runner beside the server hands it to its remote providers (runner/beside.ts). */
@@ -406,6 +423,7 @@ export declare function readingOf(base: NodeJS.ProcessEnv, maxRuns: number, stor
406
423
  installs?: "on_first_use";
407
424
  card?: string;
408
425
  models: string[];
426
+ ready_models: string[];
409
427
  free_models: {
410
428
  id: string;
411
429
  context_window: number;
@@ -628,20 +646,26 @@ export declare function readingOf(base: NodeJS.ProcessEnv, maxRuns: number, stor
628
646
  at_rest: string;
629
647
  };
630
648
  /** GET /settings/harness-keys and PUT/DELETE of one key: a plan-billed recipe's keys, saved for that harness alone
631
- * (harness-keys.ts); `harnesses` its ids here, so the console offers the page only where there is one. */
649
+ * (harness-keys.ts); `harnesses` its ids here, and `kept` each id with keys saved whose recipe it no longer names
650
+ * (a running server's, from its store: HarnessKeysOverStore.unnamed), so the console offers the page only where
651
+ * there is one or a key to remove. */
632
652
  harness_keys: {
633
653
  routes: boolean;
634
654
  at_rest: string;
635
655
  harnesses: string[];
656
+ kept: string[];
636
657
  };
637
658
  /** /settings/mcp-servers: remote MCP servers previewed and saved, each credential sealed under the server's seal key,
638
659
  * which always exists (seal-key.ts), so MCP credentials are always kept sealed. Every harness of the table runs a
639
- * grant (runnable.ts takes one on any), a module's among them. */
660
+ * grant (runnable.ts takes one on any), a module's among them. `composio_per_run`: a per-run Composio server takes
661
+ * each run's own Composio account (mcp_auth's ComposioRunBinding, composioperrun/1), said here so a backend in
662
+ * front learns it from this answer, which an API-only server serves, not from the API document, which it refuses. */
640
663
  mcp_client: {
641
664
  transports: string[];
642
665
  auth: ("headers" | "none" | "bearer" | "oauth" | "github_app" | "per_run")[];
643
666
  at_rest: string;
644
667
  harnesses: string[];
668
+ composio_per_run: boolean;
645
669
  };
646
670
  /** This server's learning switch (`--learning`): on, a run learns when its agent says `learning: true`; off, none does. */
647
671
  learning: "on" | "off";
@@ -653,6 +677,13 @@ export declare function readingOf(base: NodeJS.ProcessEnv, maxRuns: number, stor
653
677
  signing: string;
654
678
  at_rest: string;
655
679
  };
680
+ /** /settings/api-keys: the keys a person makes in the console for their apps (api-keys.ts), each shown once and
681
+ * kept as a keyed hash alone; `limit`, the most a server keeps. */
682
+ api_keys: {
683
+ routes: boolean;
684
+ limit: number;
685
+ at_rest: string;
686
+ };
656
687
  /** /settings/slack: one Slack incoming-webhook URL each of `events` is posted to as a readable message (slack.ts); the
657
688
  * URL kept sealed, never shown. */
658
689
  slack: {
@@ -741,6 +772,7 @@ export declare function capabilities(env?: NodeJS.ProcessEnv, maxRuns?: number,
741
772
  installs?: "on_first_use";
742
773
  card?: string;
743
774
  models: string[];
775
+ ready_models: string[];
744
776
  free_models: {
745
777
  id: string;
746
778
  context_window: number;
@@ -963,20 +995,26 @@ export declare function capabilities(env?: NodeJS.ProcessEnv, maxRuns?: number,
963
995
  at_rest: string;
964
996
  };
965
997
  /** GET /settings/harness-keys and PUT/DELETE of one key: a plan-billed recipe's keys, saved for that harness alone
966
- * (harness-keys.ts); `harnesses` its ids here, so the console offers the page only where there is one. */
998
+ * (harness-keys.ts); `harnesses` its ids here, and `kept` each id with keys saved whose recipe it no longer names
999
+ * (a running server's, from its store: HarnessKeysOverStore.unnamed), so the console offers the page only where
1000
+ * there is one or a key to remove. */
967
1001
  harness_keys: {
968
1002
  routes: boolean;
969
1003
  at_rest: string;
970
1004
  harnesses: string[];
1005
+ kept: string[];
971
1006
  };
972
1007
  /** /settings/mcp-servers: remote MCP servers previewed and saved, each credential sealed under the server's seal key,
973
1008
  * which always exists (seal-key.ts), so MCP credentials are always kept sealed. Every harness of the table runs a
974
- * grant (runnable.ts takes one on any), a module's among them. */
1009
+ * grant (runnable.ts takes one on any), a module's among them. `composio_per_run`: a per-run Composio server takes
1010
+ * each run's own Composio account (mcp_auth's ComposioRunBinding, composioperrun/1), said here so a backend in
1011
+ * front learns it from this answer, which an API-only server serves, not from the API document, which it refuses. */
975
1012
  mcp_client: {
976
1013
  transports: string[];
977
1014
  auth: ("headers" | "none" | "bearer" | "oauth" | "github_app" | "per_run")[];
978
1015
  at_rest: string;
979
1016
  harnesses: string[];
1017
+ composio_per_run: boolean;
980
1018
  };
981
1019
  /** This server's learning switch (`--learning`): on, a run learns when its agent says `learning: true`; off, none does. */
982
1020
  learning: "on" | "off";
@@ -988,6 +1026,13 @@ export declare function capabilities(env?: NodeJS.ProcessEnv, maxRuns?: number,
988
1026
  signing: string;
989
1027
  at_rest: string;
990
1028
  };
1029
+ /** /settings/api-keys: the keys a person makes in the console for their apps (api-keys.ts), each shown once and
1030
+ * kept as a keyed hash alone; `limit`, the most a server keeps. */
1031
+ api_keys: {
1032
+ routes: boolean;
1033
+ limit: number;
1034
+ at_rest: string;
1035
+ };
991
1036
  /** /settings/slack: one Slack incoming-webhook URL each of `events` is posted to as a readable message (slack.ts); the
992
1037
  * URL kept sealed, never shown. */
993
1038
  slack: {
@@ -1055,6 +1100,8 @@ type LearningCaps = {
1055
1100
  export declare function forCaller<T extends {
1056
1101
  learning: LearningCaps;
1057
1102
  }>(caps: T, ownerSession: boolean): T;
1103
+ /** Why a server started on its owner's own sign-in makes no API key for an app, in one line. */
1104
+ export declare const HARNESS_SIGN_IN_REFUSES_API_KEYS = "This server runs on its owner's own sign-in (--harness-sign-in), which is one person's: it creates no API key for an app, and a key created before opens nothing here. Revoke the ones listed that you no longer want.";
1058
1105
  /** A start with --harness-sign-in on a server that is not one owner's own, on their own machine. */
1059
1106
  export declare const HARNESS_SIGN_IN_NOT_LOCAL = "HARNESS_SIGN_IN_NOT_LOCAL";
1060
1107
  /** Why `options` on `data` is not one owner's own server on their own machine, each reason in words; none when it is. One
@@ -1065,6 +1112,11 @@ export declare const HARNESS_SIGN_IN_NOT_LOCAL = "HARNESS_SIGN_IN_NOT_LOCAL";
1065
1112
  * starts under (harnessSignInRefusal), and where the Ollama at this machine's default address is a model of the person
1066
1113
  * who starts runs (ollama-provider.ts ollamaHostOf). */
1067
1114
  export declare function whyNotOwnMachine(options: Pick<ServeOptions, "host" | "publicUrl" | "runnerApart" | "apiOnly" | "token" | "tokens">, data: string, ownUser: boolean): string[];
1115
+ /** Why `options` on `data` is not one owner's server on their own machine as far as who reaches it goes, each reason in
1116
+ * words: whyNotOwnMachine's facts but its runner's. What may read this machine's own files for whoever asks (GET
1117
+ * /v2/wrapped). `keys`: the live API keys made in the console (api-keys.ts), each one more caller, as a second token is
1118
+ * (claude-login.ts whyNotOneOwner counts them too); 0 where none can open the server. */
1119
+ export declare function whyNotOwnersServer(options: Pick<ServeOptions, "host" | "publicUrl" | "apiOnly" | "token" | "tokens">, data: string, keys?: number): string[];
1068
1120
  /** Why `options` on `data` may not run a recipe on its owner's own sign-in (--harness-sign-in), in words; undefined when
1069
1121
  * it may: one owner's own server on their own machine alone (whyNotOwnMachine). A check, a schedule and a shared server
1070
1122
  * run on a key (HARNESS.md#sign-in). */