@parcha/agentrun-serve 0.1.0-beta.29 → 0.1.0-beta.31

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 (172) hide show
  1. package/CHANGELOG.md +238 -0
  2. package/README.md +739 -116
  3. package/dist/adapters.d.ts +35 -6
  4. package/dist/adapters.js +152 -26
  5. package/dist/agents.d.ts +18 -7
  6. package/dist/agents.js +19 -10
  7. package/dist/app.js +101 -26
  8. package/dist/background.d.ts +29 -0
  9. package/dist/background.js +397 -0
  10. package/dist/box-egress-vm.d.ts +125 -0
  11. package/dist/box-egress-vm.js +350 -0
  12. package/dist/box-egress.d.ts +99 -0
  13. package/dist/box-egress.js +259 -0
  14. package/dist/box-image.d.ts +1 -1
  15. package/dist/box-image.js +9 -7
  16. package/dist/box-relay-vm.d.ts +84 -0
  17. package/dist/box-relay-vm.js +410 -0
  18. package/dist/box-relay.d.ts +8 -5
  19. package/dist/box-relay.js +14 -9
  20. package/dist/boxes.d.ts +28 -5
  21. package/dist/boxes.js +44 -18
  22. package/dist/browser-cost.d.ts +41 -0
  23. package/dist/browser-cost.js +158 -0
  24. package/dist/cap.d.ts +130 -21
  25. package/dist/cap.js +339 -67
  26. package/dist/cli.js +30 -4
  27. package/dist/coding-tools.d.ts +7 -3
  28. package/dist/coding-tools.js +16 -10
  29. package/dist/console/THIRD-PARTY-NOTICES.txt +580 -0
  30. package/dist/console/assets/index-CnJBf7Lc.js +486 -0
  31. package/dist/console/assets/index-DUHbWcIP.css +1 -0
  32. package/dist/console/index.html +2 -2
  33. package/dist/content-filter.d.ts +7 -0
  34. package/dist/content-filter.js +23 -0
  35. package/dist/decision-rows.d.ts +11 -3
  36. package/dist/decision-rows.js +18 -11
  37. package/dist/decisions.d.ts +3 -3
  38. package/dist/decisions.js +4 -3
  39. package/dist/errors.d.ts +2 -0
  40. package/dist/errors.js +5 -2
  41. package/dist/files.d.ts +9 -1
  42. package/dist/files.js +10 -2
  43. package/dist/grade.d.ts +11 -11
  44. package/dist/grade.js +43 -55
  45. package/dist/graph-served.d.ts +23 -0
  46. package/dist/graph-served.js +75 -0
  47. package/dist/graph-view.d.ts +7 -5
  48. package/dist/graph-view.js +10 -3
  49. package/dist/harness-app.d.ts +4 -2
  50. package/dist/harness-app.js +110 -19
  51. package/dist/harness-opencode/adapter.d.ts +45 -0
  52. package/dist/harness-opencode/adapter.js +272 -0
  53. package/dist/harness-opencode/binary.d.ts +18 -0
  54. package/dist/harness-opencode/binary.js +87 -0
  55. package/dist/harness-opencode/config.d.ts +24 -0
  56. package/dist/harness-opencode/config.js +61 -0
  57. package/dist/harness-opencode/harness.d.ts +77 -0
  58. package/dist/harness-opencode/harness.js +620 -0
  59. package/dist/harness-opencode/host/mcp.d.ts +40 -0
  60. package/dist/harness-opencode/host/mcp.js +208 -0
  61. package/dist/harness-opencode/host/policy.d.ts +71 -0
  62. package/dist/harness-opencode/host/policy.js +419 -0
  63. package/dist/harness-opencode/host/server.d.ts +55 -0
  64. package/dist/harness-opencode/host/server.js +165 -0
  65. package/dist/harness-opencode/index.d.ts +9 -0
  66. package/dist/harness-opencode/index.js +6 -0
  67. package/dist/harness-opencode/verify.d.ts +32 -0
  68. package/dist/harness-opencode/verify.js +75 -0
  69. package/dist/harness-opencode/versions.d.ts +33 -0
  70. package/dist/harness-opencode/versions.js +64 -0
  71. package/dist/harness.d.ts +4 -1
  72. package/dist/harness.js +5 -2
  73. package/dist/host-check.d.ts +12 -0
  74. package/dist/host-check.js +34 -0
  75. package/dist/host-tools.d.ts +12 -2
  76. package/dist/host-tools.js +26 -12
  77. package/dist/host.js +6 -2
  78. package/dist/hosted-search.js +5 -1
  79. package/dist/import.d.ts +2 -2
  80. package/dist/import.js +4 -3
  81. package/dist/key-check.d.ts +3 -2
  82. package/dist/key-check.js +7 -3
  83. package/dist/key-refusal.js +8 -4
  84. package/dist/key-words.d.ts +37 -0
  85. package/dist/key-words.js +40 -0
  86. package/dist/learn/check.d.ts +10 -1
  87. package/dist/learn/check.js +19 -1
  88. package/dist/learn/grade.d.ts +6 -2
  89. package/dist/learn/grade.js +28 -14
  90. package/dist/learn/index.d.ts +3 -3
  91. package/dist/learn/index.js +3 -3
  92. package/dist/learn/notes.js +2 -1
  93. package/dist/learn/reflect.d.ts +2 -2
  94. package/dist/learn/reflect.js +53 -5
  95. package/dist/learn/secrets.js +28 -8
  96. package/dist/learn/skills.d.ts +19 -4
  97. package/dist/learn/skills.js +95 -6
  98. package/dist/learned-workflow.d.ts +59 -0
  99. package/dist/learned-workflow.js +191 -0
  100. package/dist/learning-routes.d.ts +30 -1
  101. package/dist/learning-routes.js +173 -19
  102. package/dist/learning-run.d.ts +8 -6
  103. package/dist/learning-run.js +70 -27
  104. package/dist/learning-words.d.ts +12 -5
  105. package/dist/learning-words.js +34 -13
  106. package/dist/learning.d.ts +52 -3
  107. package/dist/learning.js +204 -4
  108. package/dist/mcp-gateway.d.ts +96 -0
  109. package/dist/mcp-gateway.js +408 -0
  110. package/dist/mcp-meta.d.ts +17 -0
  111. package/dist/mcp-meta.js +38 -0
  112. package/dist/mcp-servers.d.ts +33 -9
  113. package/dist/mcp-servers.js +58 -10
  114. package/dist/mcp.js +5 -5
  115. package/dist/model.d.ts +13 -11
  116. package/dist/model.js +11 -10
  117. package/dist/openapi/agentrun-v2.openapi.json +1 -0
  118. package/dist/openapi.js +407 -54
  119. package/dist/page.d.ts +2 -0
  120. package/dist/page.js +3 -0
  121. package/dist/paid-calls.d.ts +5 -1
  122. package/dist/paid-calls.js +1 -1
  123. package/dist/pause.d.ts +2 -0
  124. package/dist/place.d.ts +29 -5
  125. package/dist/place.js +51 -11
  126. package/dist/print.d.ts +7 -0
  127. package/dist/print.js +13 -0
  128. package/dist/propose.d.ts +2 -0
  129. package/dist/propose.js +38 -8
  130. package/dist/request-start.d.ts +12 -4
  131. package/dist/request-start.js +139 -15
  132. package/dist/run-box.d.ts +56 -4
  133. package/dist/run-box.js +183 -23
  134. package/dist/runnable.d.ts +13 -3
  135. package/dist/runnable.js +63 -6
  136. package/dist/runs.d.ts +266 -37
  137. package/dist/runs.js +884 -90
  138. package/dist/secrets.d.ts +27 -0
  139. package/dist/secrets.js +38 -2
  140. package/dist/server.d.ts +141 -36
  141. package/dist/server.js +562 -118
  142. package/dist/sign-ins.d.ts +99 -0
  143. package/dist/sign-ins.js +288 -0
  144. package/dist/skills.d.ts +16 -4
  145. package/dist/skills.js +35 -7
  146. package/dist/stats.d.ts +7 -2
  147. package/dist/stats.js +28 -7
  148. package/dist/tool-gate.d.ts +281 -0
  149. package/dist/tool-gate.js +585 -0
  150. package/dist/tool-keys.d.ts +48 -11
  151. package/dist/tool-keys.js +46 -8
  152. package/dist/tool-plane.d.ts +116 -27
  153. package/dist/tool-plane.js +232 -50
  154. package/dist/tools.d.ts +69 -14
  155. package/dist/tools.js +148 -26
  156. package/dist/trigger-secrets.d.ts +32 -0
  157. package/dist/trigger-secrets.js +143 -0
  158. package/dist/triggers.d.ts +439 -0
  159. package/dist/triggers.js +863 -0
  160. package/dist/turn-end.d.ts +3 -2
  161. package/dist/turn-end.js +3 -2
  162. package/dist/usage-lines.d.ts +26 -0
  163. package/dist/usage-lines.js +28 -0
  164. package/dist/validate.d.ts +2 -0
  165. package/dist/validate.js +11 -2
  166. package/dist/web-fetch.js +3 -3
  167. package/dist/webhooks.d.ts +11 -4
  168. package/dist/webhooks.js +17 -1
  169. package/launcher/agentrun-serve +1 -1
  170. package/package.json +16 -14
  171. package/dist/console/assets/index-BN7oVcO4.js +0 -445
  172. package/dist/console/assets/index-By-jkqki.css +0 -1
package/dist/secrets.d.ts CHANGED
@@ -5,6 +5,10 @@ export declare const SECRETS_LEN_ENV = "AGENTRUN_SECRETS_LEN";
5
5
  * key pi-ai's providers read is on it (model.ts' PROVIDER_KEYS, which the custody test checks against pi-ai's own
6
6
  * table), so a key set for any provider's model is held here, never left in an environment. */
7
7
  export declare const SECRET_NAMES: readonly string[];
8
+ /** A run's remote MCP servers' credentials, the one entry its pipe holds that is not on the launcher's list: JSON, each
9
+ * server the run's revision grants a tool of with its URL now and, when that is the run's pinned one, its headers
10
+ * (mcp-gateway.ts McpCredentials). A run that grants none gets no entry. */
11
+ export declare const MCP_AUTH = "AGENTRUN_MCP_AUTH";
8
12
  /** The decision keys among them: a run's process gets them only on its decision descriptor (decisions.ts), never with
9
13
  * the secrets on its pipe, which are its tools' environment. */
10
14
  export declare const DECISION_KEYS: readonly string[];
@@ -38,6 +42,29 @@ export declare const withoutSecrets: (env: NodeJS.ProcessEnv) => NodeJS.ProcessE
38
42
  /** What a run's process is handed: the secrets named `names` that this process holds, or its server saved (`stored`),
39
43
  * as its pipe carries them. */
40
44
  export declare function handover(names: readonly string[], stored?: StoredKeys): Buffer;
45
+ /** The MCP credentials this process was handed (MCP_AUTH), by server; none when it was handed none. */
46
+ export declare function mcpCredentials(): Record<string, {
47
+ url: string;
48
+ headers?: Record<string, string>;
49
+ }>;
50
+ /** Every header value of `credentials`: what a secret scan refuses. */
51
+ export declare const mcpSecretValues: (credentials: Record<string, {
52
+ headers?: Record<string, string>;
53
+ }>) => string[];
54
+ /** The pipe's MCP entry for `credentials`, to follow the secrets `handover` encodes. */
55
+ export declare const mcpHandover: (credentials: Record<string, unknown>) => Buffer;
56
+ /** A run's saved sign-in as its pipe carries it, after its secrets (handover). */
57
+ export declare const handoverSignIn: (value: {
58
+ provider: string;
59
+ ref: string;
60
+ save: boolean;
61
+ }) => Buffer;
62
+ /** The saved sign-in this run's process was handed over its pipe, if any: read by the browser tool alone. */
63
+ export declare function handedSignIn(): {
64
+ provider: string;
65
+ ref: string;
66
+ save: boolean;
67
+ } | undefined;
41
68
  /** pi-ai's auth context over `env` (one `withSecrets` made): its providers find their keys there, not in process.env. */
42
69
  export declare const authContextOf: (env: NodeJS.ProcessEnv) => {
43
70
  env: (name: string) => Promise<string | undefined>;
package/dist/secrets.js CHANGED
@@ -24,19 +24,29 @@ export const SECRET_NAMES = (() => {
24
24
  throw new Error("agentrun-serve's launcher names no SECRETS");
25
25
  return list.split(" ").filter(Boolean);
26
26
  })();
27
+ /** A run's remote MCP servers' credentials, the one entry its pipe holds that is not on the launcher's list: JSON, each
28
+ * server the run's revision grants a tool of with its URL now and, when that is the run's pinned one, its headers
29
+ * (mcp-gateway.ts McpCredentials). A run that grants none gets no entry. */
30
+ export const MCP_AUTH = "AGENTRUN_MCP_AUTH";
27
31
  /** The decision keys among them: a run's process gets them only on its decision descriptor (decisions.ts), never with
28
32
  * the secrets on its pipe, which are its tools' environment. */
29
33
  export const DECISION_KEYS = ["TYPESAFE_API_KEY", "PARALLEL_API_KEY"];
30
34
  const held = new Map();
31
35
  /** Whether this process was handed its secrets over a pipe, and closed it. */
32
36
  let handed;
37
+ /** The pair a run's saved sign-in comes as on the same pipe (sign-ins.ts): JSON `{provider, ref, save}`, held apart from
38
+ * the secrets, so it is no tool's environment and no key a scan looks for by name. */
39
+ const SIGN_IN_PAIR = "AGENTRUN_SIGN_IN";
40
+ let signIn;
33
41
  /** NAME=VALUE pairs, each ended by a NUL. */
34
42
  const encode = (pairs) => Buffer.concat([...pairs].map(([name, value]) => Buffer.from(`${name}=${value}\0`)));
35
43
  function decode(bytes) {
36
44
  for (const pair of bytes.toString("utf8").split("\0")) {
37
45
  const at = pair.indexOf("=");
38
- if (at > 0 && SECRET_NAMES.includes(pair.slice(0, at)))
46
+ if (at > 0 && (SECRET_NAMES.includes(pair.slice(0, at)) || pair.slice(0, at) === MCP_AUTH))
39
47
  held.set(pair.slice(0, at), pair.slice(at + 1));
48
+ else if (pair.slice(0, at) === SIGN_IN_PAIR)
49
+ signIn = pair.slice(at + 1);
40
50
  }
41
51
  }
42
52
  /** Exactly `length` bytes of `fd`: the writer keeps its end open (the launcher's FIFO is open read-write), so there is
@@ -84,7 +94,7 @@ const SECRET_NAME = /(?:^|_)(?:KEY|TOKEN|SECRET|PASSWORD)$/i;
84
94
  * every other key, token, secret or password `env` names. One shorter than the checker's MIN_SECRET,
85
95
  * whitespace aside, matches too much text by chance to be refused, and is left out. */
86
96
  export const hostSecrets = (env, stored) => {
87
- const held = SECRET_NAMES.flatMap((name) => [secret(name) ?? "", stored?.(name) ?? ""]);
97
+ const held = [...SECRET_NAMES.flatMap((name) => [secret(name) ?? "", stored?.(name) ?? ""]), ...mcpSecretValues(mcpCredentials())];
88
98
  const named = Object.entries(env).filter(([name]) => SECRET_NAME.test(name) && !SECRET_NAMES.includes(name)).map(([, value]) => value ?? "");
89
99
  return [...new Set([...held, ...named])].filter((value) => value.replace(/\s+/g, "").length >= MIN_SECRET);
90
100
  };
@@ -131,6 +141,32 @@ export function handover(names, stored) {
131
141
  return value === undefined ? [] : [[name, value]];
132
142
  }));
133
143
  }
144
+ /** The MCP credentials this process was handed (MCP_AUTH), by server; none when it was handed none. */
145
+ export function mcpCredentials() {
146
+ try {
147
+ const parsed = JSON.parse(held.get(MCP_AUTH) ?? "{}");
148
+ return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
149
+ }
150
+ catch {
151
+ return {};
152
+ }
153
+ }
154
+ /** Every header value of `credentials`: what a secret scan refuses. */
155
+ export const mcpSecretValues = (credentials) => Object.values(credentials).flatMap((server) => Object.values(server.headers ?? {})).flatMap((value) => [value, value.replace(/^Bearer\s+/i, "")]);
156
+ /** The pipe's MCP entry for `credentials`, to follow the secrets `handover` encodes. */
157
+ export const mcpHandover = (credentials) => encode([[MCP_AUTH, JSON.stringify(credentials)]]);
158
+ /** A run's saved sign-in as its pipe carries it, after its secrets (handover). */
159
+ export const handoverSignIn = (value) => encode([[SIGN_IN_PAIR, JSON.stringify(value)]]);
160
+ /** The saved sign-in this run's process was handed over its pipe, if any: read by the browser tool alone. */
161
+ export function handedSignIn() {
162
+ try {
163
+ const value = signIn === undefined ? undefined : JSON.parse(signIn);
164
+ return value && typeof value.provider === "string" && typeof value.ref === "string" && value.ref && typeof value.save === "boolean" ? { provider: value.provider, ref: value.ref, save: value.save } : undefined;
165
+ }
166
+ catch {
167
+ return undefined;
168
+ }
169
+ }
134
170
  /** pi-ai's auth context over `env` (one `withSecrets` made): its providers find their keys there, not in process.env. */
135
171
  export const authContextOf = (env) => ({
136
172
  env: async (name) => env[name],
package/dist/server.d.ts CHANGED
@@ -1,10 +1,14 @@
1
1
  import { type ModelNeeds } from "./model.js";
2
2
  import { type HarnessCapability } from "./harness.js";
3
+ import type { MessageOrigin } from "@parcha/pi-durable-agent/timeline";
3
4
  import { type LearningMode } from "./learning.js";
5
+ import { type Place } from "./place.js";
4
6
  import { type CarryBackRetry } from "./runs.js";
5
7
  import { type BoxHost } from "./box/sweep.js";
6
8
  import { type BoxOffer } from "./boxes.js";
9
+ import { type ImageState } from "./box-image.js";
7
10
  import { type StoredKeys } from "./secrets.js";
11
+ import { type TriggerClock } from "./triggers.js";
8
12
  import { type ToolSettingsMap } from "./tool-plane.js";
9
13
  export declare const CONTRACT = "agentrun.v2/0";
10
14
  export declare const DEFAULT_PORT = 7340;
@@ -48,8 +52,11 @@ export type ServeOptions = {
48
52
  /** A faux model module (no key, no network): see the README. */
49
53
  faux?: string;
50
54
  /** With `faux` only: a module whose default export gives the `browser` tool's `{ provider, driver }` (the tests' fake
51
- * backend), in place of Browserbase's. */
55
+ * backend), in place of Browserbase's or Kernel's. */
52
56
  fauxBrowser?: string;
57
+ /** With `faux` only: a module whose default export is the fetch the check of a Kernel key goes through (the tests'
58
+ * fake), in place of Kernel's API. */
59
+ fauxKernel?: string;
53
60
  /** With `faux` only: a module whose default export gives `fetch_page` its `{ lookup, fetchImpl }` (the tests' fake
54
61
  * network), in place of the system's resolver and undici. */
55
62
  fauxWeb?: string;
@@ -65,6 +72,13 @@ export type ServeOptions = {
65
72
  /** With `faux` only: a module whose default export is the fetch the monid tools send through (the tests' fake), in
66
73
  * place of monid's API. */
67
74
  fauxMonid?: string;
75
+ /** With `faux` only: a module whose default export is the fetch the check of a Browserbase key goes through (the
76
+ * tests' fake), in place of Browserbase's API. */
77
+ fauxBrowserbase?: string;
78
+ /** With `faux` only: a module whose default export is the fetch the start's check of a monid key the server is started
79
+ * with goes through (the tests' fake for that check alone), in place of monid's API; the runs' calls go through
80
+ * `fauxMonid`'s. */
81
+ fauxMonidCheck?: string;
68
82
  /** With `faux` only: a module whose default export is the fetch the Anthropic and OpenAI providers send through, in
69
83
  * place of their APIs, for web_search's own request to the provider the revision's model names (model.ts). */
70
84
  fauxUpstream?: string;
@@ -76,7 +90,16 @@ export type ServeOptions = {
76
90
  /** With `faux` only: a module whose default export, given the data root, is the box provider runs' Docker boxes come
77
91
  * from (the tests' faux box, pi-transport's local box): docker is then available, and nothing asks Docker. */
78
92
  fauxBox?: string;
79
- /** Extra `Host` names to accept besides the loopback ones. */
93
+ /** Under `faux` only: a module that stands in for the VM provider's SDK (its client class, by the SDK's name for it),
94
+ * so the VM box runs on the tests' fake, never the provider. */
95
+ fauxVm?: string;
96
+ /** Under `faux`: a module whose default export gives a box's egress proxy its `lookup` and `dial` (box-egress.ts), the
97
+ * tests' fake network. */
98
+ fauxEgress?: string;
99
+ /** With `faux` only: the platform this server takes itself to run on (tests: `darwin`, to take a Mac's path to a box's
100
+ * network, box-egress-vm.ts, on another machine). */
101
+ fauxPlatform?: NodeJS.Platform;
102
+ /** Extra `Host` names to accept besides the loopback ones, on any port (host-check.ts). */
80
103
  allowHosts?: string[];
81
104
  /** The console's built files, answered at / (default dist/console beside the server, which this package's build copies
82
105
  * from apps/console/dist). */
@@ -92,6 +115,9 @@ export type ServeOptions = {
92
115
  settleRetryMs?: number;
93
116
  /** Where the log lines go (print.ts); none without it. AGENTRUN_LOG=quiet leaves out the request lines. */
94
117
  log?: (line: string) => void;
118
+ /** Told the Docker box image's state at the start, when this server has a Docker box, then each change (box-image.ts):
119
+ * the CLI says a first build in words, as it starts and as it ends. */
120
+ onBoxImage?: (state: ImageState) => void;
95
121
  /** The lines a person reads about a stop on this data root: this server's, as its close begins and runs' processes are
96
122
  * left to finish their turn, and this start's, when it waits for a server that is stopping (server-lock.ts). Default:
97
123
  * standard error, after `agentrun-serve: `. */
@@ -106,6 +132,13 @@ export type ServeOptions = {
106
132
  beforeReopenLaunch?: (runId: string) => Promise<void> | void;
107
133
  /** A test's seam: awaited by a message before it goes to the run's door, so a test can act while it is in flight. */
108
134
  beforeSubmit?: (runId: string, content: string) => Promise<void> | void;
135
+ /** A test's seam: told each run read in from its store (runs.ts onRunLoad). */
136
+ onRunLoad?: (runId: string) => void;
137
+ /** A test's seam: awaited before a run's serve.json is written (runs.ts beforeMetaSave). */
138
+ beforeMetaSave?: (runId: string, meta: Readonly<Record<string, unknown>>) => Promise<void> | void;
139
+ /** A test's seam: who wrote a message sent to a run through its messages route (`origin`, as a raised cap's follow-up
140
+ * carries it), so a test sends a server-written message down the path a person's message takes. */
141
+ messageOrigin?: (runId: string, content: string) => MessageOrigin | undefined;
109
142
  /** How long a request waits for a run's door, its process coming up or a settle in progress (default 45 s). */
110
143
  readyTimeoutMs?: number;
111
144
  /** How long a run's end-of-run turn may take before it is aborted and the run finishes without it (default 5 min). */
@@ -123,6 +156,8 @@ export type ServeOptions = {
123
156
  * default AGENTRUN_SERVE_LEARNING_BUDGET, else 8000): every note whole while they fit, else the index and the notes
124
157
  * changed last, whole, while they fit (learning.ts learnedOf). */
125
158
  learningBudget?: number;
159
+ /** A test's seam: the triggers' clock and timer (triggers.ts), in place of Date.now and setTimeout. */
160
+ triggerClock?: TriggerClock;
126
161
  /** 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). */
127
162
  webhookRetryMs?: readonly number[];
128
163
  /** The box runs' harnesses run in (4a's Box: its reap; on a shared server its run cgroups): the boxes runs leave are
@@ -204,9 +239,18 @@ export declare function readingOf(base: NodeJS.ProcessEnv, maxRuns: number, stor
204
239
  }[];
205
240
  /** The places a revision may name (`definition.place`), this host's default, and whether this server has each box. */
206
241
  places: {
242
+ boxes: BoxOffer[];
243
+ allow: string[];
244
+ default_place: Place;
207
245
  modes: ("runner" | "sandbox")[];
208
246
  default: "runner";
247
+ } | {
209
248
  boxes: BoxOffer[];
249
+ allow: string[];
250
+ default_place: Place;
251
+ default_reason: string;
252
+ modes: ("runner" | "sandbox")[];
253
+ default: "runner";
210
254
  };
211
255
  models: {
212
256
  ready: boolean;
@@ -226,12 +270,15 @@ export declare function readingOf(base: NodeJS.ProcessEnv, maxRuns: number, stor
226
270
  * web tool, what it resolves to on each harness under this server's tool settings; `key`, the tool key that unlocks
227
271
  * it (tool-keys.ts), when one does. */
228
272
  tools: ({
229
- providers?: ("auto" | "off" | "parallel" | "native" | "exa-keyless" | "kernel")[] | undefined;
273
+ providers?: ("browserbase" | "kernel" | "chrome" | "auto" | "off" | "parallel" | "native" | "exa-keyless")[] | undefined;
230
274
  provider?: string | undefined;
231
- default_provider?: "auto" | "kernel" | undefined;
232
- resolves?: Record<"pi" | "claude-agent" | "codex", import("./tool-plane.js").Resolution> | undefined;
233
- why?: Record<"pi" | "claude-agent" | "codex", string> | undefined;
234
- harnesses: ("pi" | "claude-agent" | "codex")[];
275
+ default_provider?: "kernel" | "auto" | undefined;
276
+ resolves?: Record<"pi" | "claude-agent" | "codex" | "opencode", import("./tool-plane.js").Resolution> | undefined;
277
+ why?: Record<"pi" | "claude-agent" | "codex" | "opencode", string> | undefined;
278
+ harnesses: ("pi" | "claude-agent" | "codex" | "opencode")[];
279
+ permission: "ask" | "deny" | "allow";
280
+ default_permission: "ask" | "deny" | "allow";
281
+ permissions: ("ask" | "deny" | "allow")[];
235
282
  missing?: string[] | undefined;
236
283
  reason?: string | undefined;
237
284
  available: boolean;
@@ -243,12 +290,15 @@ export declare function readingOf(base: NodeJS.ProcessEnv, maxRuns: number, stor
243
290
  calls: boolean;
244
291
  } | {
245
292
  key: string | undefined;
246
- providers?: ("auto" | "off" | "parallel" | "native" | "exa-keyless" | "kernel")[] | undefined;
293
+ providers?: ("browserbase" | "kernel" | "chrome" | "auto" | "off" | "parallel" | "native" | "exa-keyless")[] | undefined;
247
294
  provider?: string | undefined;
248
- default_provider?: "auto" | "kernel" | undefined;
249
- resolves?: Record<"pi" | "claude-agent" | "codex", import("./tool-plane.js").Resolution> | undefined;
250
- why?: Record<"pi" | "claude-agent" | "codex", string> | undefined;
251
- harnesses: ("pi" | "claude-agent" | "codex")[];
295
+ default_provider?: "kernel" | "auto" | undefined;
296
+ resolves?: Record<"pi" | "claude-agent" | "codex" | "opencode", import("./tool-plane.js").Resolution> | undefined;
297
+ why?: Record<"pi" | "claude-agent" | "codex" | "opencode", string> | undefined;
298
+ harnesses: ("pi" | "claude-agent" | "codex" | "opencode")[];
299
+ permission: "ask" | "deny" | "allow";
300
+ default_permission: "ask" | "deny" | "allow";
301
+ permissions: ("ask" | "deny" | "allow")[];
252
302
  missing?: string[] | undefined;
253
303
  reason?: string | undefined;
254
304
  available: boolean;
@@ -339,10 +389,14 @@ export declare function readingOf(base: NodeJS.ProcessEnv, maxRuns: number, stor
339
389
  };
340
390
  efforts: ("low" | "high" | "medium")[];
341
391
  thinking: ("low" | "high" | "medium" | "xhigh" | "max")[];
392
+ /** The browser a run's `browser` tool drives: the vendor it resolves to under the server's settings when the tool is
393
+ * available here (tools[]), Browserbase's or Kernel's, else none. */
342
394
  browser: string;
343
- /** A tool setting's `permission` (definition.tool_settings, /v2/settings/tools): false until the tool gate lands,
344
- * and a save that names one is refused. */
395
+ /** A tool setting's `permission` (definition.tool_settings, /v2/settings/tools): allow, ask or deny, which the tool
396
+ * gate holds every tool call to (tool-gate.ts); an ask is answered at POST /runs/{id}/approvals/{approval_id}. */
345
397
  tool_permissions: boolean;
398
+ /** An agent's browser stays signed in between its runs (sign-ins.ts): with a seal key to keep each pointer under, and a
399
+ * browser vendor here (Browserbase's or Kernel's; local Chrome keeps none). */
346
400
  sign_ins: boolean;
347
401
  vault: boolean;
348
402
  query: boolean;
@@ -357,8 +411,9 @@ export declare function readingOf(base: NodeJS.ProcessEnv, maxRuns: number, stor
357
411
  mcp_client: {
358
412
  routes: boolean;
359
413
  transports: string[];
360
- auth: ("none" | "headers" | "bearer")[];
414
+ auth: ("headers" | "none" | "bearer")[];
361
415
  at_rest: string;
416
+ harnesses: string[];
362
417
  };
363
418
  /** This server's learning switch (`--learning`): on, a run learns when its agent says `learning: true`; off, none does. */
364
419
  learning: "off" | "on";
@@ -366,10 +421,28 @@ export declare function readingOf(base: NodeJS.ProcessEnv, maxRuns: number, stor
366
421
  * ends (webhooks.ts); its secret kept sealed under the same seal key, so with none no webhook is set. */
367
422
  webhooks: {
368
423
  routes: boolean;
369
- events: ("run.needs_input" | "run.ended")[];
424
+ events: ("run.needs_input" | "run.ended" | "trigger.failed")[];
370
425
  signing: string;
371
426
  at_rest: string;
372
427
  };
428
+ /** /triggers: what starts an agent's capped runs with no caller (triggers.ts). */
429
+ triggers: {
430
+ routes: boolean;
431
+ sources: ("schedule" | "webhook")[];
432
+ targets: ("start_run" | "message_run")[];
433
+ overlap: "skip"[];
434
+ min_every_s: number;
435
+ history_kept: number;
436
+ catchup_window_s: number;
437
+ failures_to_pause: number;
438
+ webhook: {
439
+ signing: string;
440
+ tolerance_s: number;
441
+ max_body_bytes: number;
442
+ payload_kept_bytes: number;
443
+ at_rest: string;
444
+ };
445
+ };
373
446
  };
374
447
  regions: {
375
448
  id: string;
@@ -394,12 +467,6 @@ export declare function readingOf(base: NodeJS.ProcessEnv, maxRuns: number, stor
394
467
  };
395
468
  };
396
469
  }>;
397
- /** The capabilities document GET /v2/capabilities answers for `env`: each harness's offer resolved, its `default_model`
398
- * included (harnessOffers), and whether a revision that names no model runs here (`models.ready`, and what it `needs`
399
- * when not), so what this returns is what the route serves and what the document's schema holds.
400
- * `learning` is the server's learning switch (`--learning`), AGENTRUN_SERVE_LEARNING's when not given; with this
401
- * server's tool settings, what each web tool resolves to (tool-plane.ts); `boxes`, the box offers its places show;
402
- * `gradeModel`, its `--grade-model`. */
403
470
  export declare function capabilities(env?: NodeJS.ProcessEnv, maxRuns?: number, learning?: LearningMode, toolSettings?: ToolSettingsMap, boxes?: readonly BoxOffer[], gradeModel?: string): Promise<{
404
471
  backend: string;
405
472
  contract: string;
@@ -421,9 +488,18 @@ export declare function capabilities(env?: NodeJS.ProcessEnv, maxRuns?: number,
421
488
  }[];
422
489
  /** The places a revision may name (`definition.place`), this host's default, and whether this server has each box. */
423
490
  places: {
491
+ boxes: BoxOffer[];
492
+ allow: string[];
493
+ default_place: Place;
424
494
  modes: ("runner" | "sandbox")[];
425
495
  default: "runner";
496
+ } | {
426
497
  boxes: BoxOffer[];
498
+ allow: string[];
499
+ default_place: Place;
500
+ default_reason: string;
501
+ modes: ("runner" | "sandbox")[];
502
+ default: "runner";
427
503
  };
428
504
  models: {
429
505
  ready: boolean;
@@ -443,12 +519,15 @@ export declare function capabilities(env?: NodeJS.ProcessEnv, maxRuns?: number,
443
519
  * web tool, what it resolves to on each harness under this server's tool settings; `key`, the tool key that unlocks
444
520
  * it (tool-keys.ts), when one does. */
445
521
  tools: ({
446
- providers?: ("auto" | "off" | "parallel" | "native" | "exa-keyless" | "kernel")[] | undefined;
522
+ providers?: ("browserbase" | "kernel" | "chrome" | "auto" | "off" | "parallel" | "native" | "exa-keyless")[] | undefined;
447
523
  provider?: string | undefined;
448
- default_provider?: "auto" | "kernel" | undefined;
449
- resolves?: Record<"pi" | "claude-agent" | "codex", import("./tool-plane.js").Resolution> | undefined;
450
- why?: Record<"pi" | "claude-agent" | "codex", string> | undefined;
451
- harnesses: ("pi" | "claude-agent" | "codex")[];
524
+ default_provider?: "kernel" | "auto" | undefined;
525
+ resolves?: Record<"pi" | "claude-agent" | "codex" | "opencode", import("./tool-plane.js").Resolution> | undefined;
526
+ why?: Record<"pi" | "claude-agent" | "codex" | "opencode", string> | undefined;
527
+ harnesses: ("pi" | "claude-agent" | "codex" | "opencode")[];
528
+ permission: "ask" | "deny" | "allow";
529
+ default_permission: "ask" | "deny" | "allow";
530
+ permissions: ("ask" | "deny" | "allow")[];
452
531
  missing?: string[] | undefined;
453
532
  reason?: string | undefined;
454
533
  available: boolean;
@@ -460,12 +539,15 @@ export declare function capabilities(env?: NodeJS.ProcessEnv, maxRuns?: number,
460
539
  calls: boolean;
461
540
  } | {
462
541
  key: string | undefined;
463
- providers?: ("auto" | "off" | "parallel" | "native" | "exa-keyless" | "kernel")[] | undefined;
542
+ providers?: ("browserbase" | "kernel" | "chrome" | "auto" | "off" | "parallel" | "native" | "exa-keyless")[] | undefined;
464
543
  provider?: string | undefined;
465
- default_provider?: "auto" | "kernel" | undefined;
466
- resolves?: Record<"pi" | "claude-agent" | "codex", import("./tool-plane.js").Resolution> | undefined;
467
- why?: Record<"pi" | "claude-agent" | "codex", string> | undefined;
468
- harnesses: ("pi" | "claude-agent" | "codex")[];
544
+ default_provider?: "kernel" | "auto" | undefined;
545
+ resolves?: Record<"pi" | "claude-agent" | "codex" | "opencode", import("./tool-plane.js").Resolution> | undefined;
546
+ why?: Record<"pi" | "claude-agent" | "codex" | "opencode", string> | undefined;
547
+ harnesses: ("pi" | "claude-agent" | "codex" | "opencode")[];
548
+ permission: "ask" | "deny" | "allow";
549
+ default_permission: "ask" | "deny" | "allow";
550
+ permissions: ("ask" | "deny" | "allow")[];
469
551
  missing?: string[] | undefined;
470
552
  reason?: string | undefined;
471
553
  available: boolean;
@@ -556,10 +638,14 @@ export declare function capabilities(env?: NodeJS.ProcessEnv, maxRuns?: number,
556
638
  };
557
639
  efforts: ("low" | "high" | "medium")[];
558
640
  thinking: ("low" | "high" | "medium" | "xhigh" | "max")[];
641
+ /** The browser a run's `browser` tool drives: the vendor it resolves to under the server's settings when the tool is
642
+ * available here (tools[]), Browserbase's or Kernel's, else none. */
559
643
  browser: string;
560
- /** A tool setting's `permission` (definition.tool_settings, /v2/settings/tools): false until the tool gate lands,
561
- * and a save that names one is refused. */
644
+ /** A tool setting's `permission` (definition.tool_settings, /v2/settings/tools): allow, ask or deny, which the tool
645
+ * gate holds every tool call to (tool-gate.ts); an ask is answered at POST /runs/{id}/approvals/{approval_id}. */
562
646
  tool_permissions: boolean;
647
+ /** An agent's browser stays signed in between its runs (sign-ins.ts): with a seal key to keep each pointer under, and a
648
+ * browser vendor here (Browserbase's or Kernel's; local Chrome keeps none). */
563
649
  sign_ins: boolean;
564
650
  vault: boolean;
565
651
  query: boolean;
@@ -574,8 +660,9 @@ export declare function capabilities(env?: NodeJS.ProcessEnv, maxRuns?: number,
574
660
  mcp_client: {
575
661
  routes: boolean;
576
662
  transports: string[];
577
- auth: ("none" | "headers" | "bearer")[];
663
+ auth: ("headers" | "none" | "bearer")[];
578
664
  at_rest: string;
665
+ harnesses: string[];
579
666
  };
580
667
  /** This server's learning switch (`--learning`): on, a run learns when its agent says `learning: true`; off, none does. */
581
668
  learning: "off" | "on";
@@ -583,10 +670,28 @@ export declare function capabilities(env?: NodeJS.ProcessEnv, maxRuns?: number,
583
670
  * ends (webhooks.ts); its secret kept sealed under the same seal key, so with none no webhook is set. */
584
671
  webhooks: {
585
672
  routes: boolean;
586
- events: ("run.needs_input" | "run.ended")[];
673
+ events: ("run.needs_input" | "run.ended" | "trigger.failed")[];
587
674
  signing: string;
588
675
  at_rest: string;
589
676
  };
677
+ /** /triggers: what starts an agent's capped runs with no caller (triggers.ts). */
678
+ triggers: {
679
+ routes: boolean;
680
+ sources: ("schedule" | "webhook")[];
681
+ targets: ("start_run" | "message_run")[];
682
+ overlap: "skip"[];
683
+ min_every_s: number;
684
+ history_kept: number;
685
+ catchup_window_s: number;
686
+ failures_to_pause: number;
687
+ webhook: {
688
+ signing: string;
689
+ tolerance_s: number;
690
+ max_body_bytes: number;
691
+ payload_kept_bytes: number;
692
+ at_rest: string;
693
+ };
694
+ };
590
695
  };
591
696
  regions: {
592
697
  id: string;