@parcha/agentrun-serve 0.1.0-beta.43 → 0.1.0-beta.44
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.
- package/CHANGELOG.md +105 -0
- package/README.md +213 -24
- package/dist/cli.js +42 -8
- package/dist/composio-preset.d.ts +4 -3
- package/dist/composio-preset.js +12 -4
- package/dist/composio-triggers.d.ts +20 -2
- package/dist/composio-triggers.js +183 -17
- package/dist/computer-lost.d.ts +11 -0
- package/dist/computer-lost.js +19 -0
- package/dist/computer-record.d.ts +10 -2
- package/dist/computer-record.js +50 -18
- package/dist/computer-setting.d.ts +1 -0
- package/dist/computer-setting.js +2 -2
- package/dist/console/assets/index-BUktRvS-.css +1 -0
- package/dist/console/assets/index-nB9kTfIN.js +711 -0
- package/dist/console/index.html +2 -2
- package/dist/errors.d.ts +1 -0
- package/dist/errors.js +3 -0
- package/dist/harness-table.d.ts +51 -3
- package/dist/harness-table.js +101 -13
- package/dist/harness.d.ts +18 -1
- package/dist/harness.js +21 -9
- package/dist/host.d.ts +12 -10
- package/dist/host.js +18 -16
- package/dist/import-worker.d.ts +3 -0
- package/dist/import-worker.js +7 -5
- package/dist/import.d.ts +22 -1
- package/dist/import.js +141 -28
- package/dist/learn/check.d.ts +3 -0
- package/dist/learn/check.js +1 -1
- package/dist/learn/compile.js +1 -1
- package/dist/learn/delete.d.ts +17 -0
- package/dist/learn/delete.js +44 -0
- package/dist/learn/promote.d.ts +7 -1
- package/dist/learn/promote.js +8 -4
- package/dist/learn/skills.d.ts +4 -0
- package/dist/learn/skills.js +17 -1
- package/dist/learn/workflow-nodes.d.ts +22 -1
- package/dist/learn/workflow-nodes.js +28 -9
- package/dist/learning-cost.d.ts +100 -0
- package/dist/learning-cost.js +116 -1
- package/dist/learning-evals.d.ts +2 -0
- package/dist/learning-evals.js +4 -3
- package/dist/learning-routes.d.ts +8 -0
- package/dist/learning-routes.js +17 -0
- package/dist/learning.d.ts +1 -1
- package/dist/listen-first.d.ts +30 -0
- package/dist/listen-first.js +115 -0
- package/dist/llms.txt +2 -1
- package/dist/mcp-servers-store.d.ts +12 -12
- package/dist/model.d.ts +8 -4
- package/dist/model.js +16 -8
- package/dist/openapi.js +115 -39
- package/dist/owner.d.ts +8 -0
- package/dist/owner.js +11 -0
- package/dist/paid-calls.d.ts +6 -0
- package/dist/paid-calls.js +11 -1
- package/dist/place.d.ts +8 -3
- package/dist/place.js +13 -9
- package/dist/provider.js +15 -1
- package/dist/run-learning-served.d.ts +1 -1
- package/dist/run-model-key.d.ts +64 -0
- package/dist/run-model-key.js +147 -0
- package/dist/runner/adapter-loop.d.ts +6 -0
- package/dist/runner/adapter-loop.js +9 -2
- package/dist/runner/adapter-run-spec.d.ts +6 -3
- package/dist/runner/adapter-run-spec.js +70 -23
- package/dist/runner/adapters/index.d.ts +4 -2
- package/dist/runner/adapters/index.js +13 -4
- package/dist/runner/audit.d.ts +4 -0
- package/dist/runner/audit.js +15 -4
- package/dist/runner/beside.d.ts +2 -1
- package/dist/runner/beside.js +5 -2
- package/dist/runner/claim-secrets.d.ts +49 -0
- package/dist/runner/claim-secrets.js +110 -1
- package/dist/runner/cli-run-spec.d.ts +2 -1
- package/dist/runner/cli-run-spec.js +32 -13
- package/dist/runner/commands.d.ts +3 -6
- package/dist/runner/feedback-round.d.ts +3 -2
- package/dist/runner/feedback-round.js +7 -3
- package/dist/runner/harness-loops.js +30 -8
- package/dist/runner/journal-kinds.d.ts +5 -0
- package/dist/runner/learning-end.d.ts +3 -0
- package/dist/runner/learning-end.js +4 -0
- package/dist/runner/loop-contract.d.ts +6 -0
- package/dist/runner/loop-contract.js +4 -0
- package/dist/runner/loop.js +6 -2
- package/dist/runner/main.d.ts +1 -0
- package/dist/runner/main.js +24 -7
- package/dist/runner/memory-claim.d.ts +9 -6
- package/dist/runner/memory-claim.js +12 -9
- package/dist/runner/promotion.d.ts +5 -0
- package/dist/runner/promotion.js +46 -7
- package/dist/runner/reflect-hook.d.ts +4 -0
- package/dist/runner/reflect-hook.js +22 -3
- package/dist/runner/runner.js +57 -4
- package/dist/runner/store-secrets.js +9 -5
- package/dist/runner/workflow-spec.js +10 -2
- package/dist/runs-over-store.d.ts +5 -4
- package/dist/runs-over-store.js +13 -3
- package/dist/sdk/workflows.d.ts +1 -1
- package/dist/server.d.ts +64 -50
- package/dist/server.js +457 -120
- package/dist/store/index.d.ts +2 -2
- package/dist/store/index.js +1 -1
- package/dist/store/seal.d.ts +20 -2
- package/dist/store/seal.js +24 -8
- package/dist/store/sqlite/run-launch.d.ts +4 -1
- package/dist/store/sqlite/run-launch.js +12 -0
- package/dist/store/sqlite/store.d.ts +3 -2
- package/dist/store/sqlite/store.js +118 -16
- package/dist/store/store.d.ts +38 -3
- package/dist/store-reads/analytics.js +11 -1
- package/dist/store-reads/learning.d.ts +41 -2
- package/dist/store-reads/learning.js +158 -5
- package/dist/store-reads/stats.js +13 -3
- package/dist/store-view.d.ts +5 -1
- package/dist/store-view.js +12 -11
- package/dist/telemetry.d.ts +59 -0
- package/dist/telemetry.js +153 -0
- package/dist/tool-keys-store.d.ts +1 -1
- package/dist/tool-keys.d.ts +2 -2
- package/dist/tool-plane.d.ts +12 -12
- package/dist/tools.d.ts +11 -11
- package/dist/tools.js +18 -5
- package/dist/trigger-adapter.d.ts +3 -0
- package/dist/trigger-adapters.d.ts +4 -0
- package/dist/trigger-adapters.js +13 -0
- package/dist/trigger-composio.d.ts +58 -1
- package/dist/trigger-composio.js +160 -6
- package/dist/triggers.d.ts +4 -0
- package/dist/triggers.js +22 -3
- package/dist/validate.d.ts +11 -7
- package/dist/validate.js +8 -7
- package/dist/workspace/computer-for-claim.d.ts +15 -5
- package/dist/workspace/computer-for-claim.js +228 -32
- package/dist/workspace/resolve-computer.d.ts +8 -2
- package/dist/workspace/resolve-computer.js +1 -1
- package/package.json +10 -9
- package/dist/console/assets/index-BrcDSBD8.css +0 -1
- package/dist/console/assets/index-Bz6IWncl.js +0 -711
package/dist/model.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { isRouter, withLocalModels } from "./local-models.js";
|
|
9
9
|
import { pathToFileURL } from "node:url";
|
|
10
10
|
import { DEFAULT_HARNESS, PLAN_HARNESSES } from "./harness.js";
|
|
11
|
-
import { HARNESS_TABLE_ENV, harnessOf } from "./harness-table.js";
|
|
11
|
+
import { HARNESS_MODULES_ENV, HARNESS_TABLE_ENV, harnessOf } from "./harness-table.js";
|
|
12
12
|
import { gatewayBase } from "./provider.js";
|
|
13
13
|
import { modelFormWhy } from "./model-form.js";
|
|
14
14
|
// Leaves, which the key rows below read as this module loads, in any import order (wires.ts, adapter-facts.ts).
|
|
@@ -19,11 +19,13 @@ import { EXPIRED, PLAN_DEFAULT_MODEL, PLAN_ORIGIN, PLAN_PROVIDER, planOf, signed
|
|
|
19
19
|
/** The child's environment names the faux module by absolute path. */
|
|
20
20
|
export const FAUX_ENV = "AGENTRUN_SERVE_FAUX";
|
|
21
21
|
/** Every test hook's name starts so (AGENTRUN_SERVE_FAUX, AGENTRUN_SERVE_FAUX_WEB, ...), but the harness table's
|
|
22
|
-
* (harness-table.ts HARNESS_TABLE_ENV), which withoutFaux drops by name
|
|
22
|
+
* (harness-table.ts HARNESS_TABLE_ENV), which withoutFaux drops by name, as it drops the resolved harness modules list
|
|
23
|
+
* (HARNESS_MODULES_ENV). */
|
|
23
24
|
export const FAUX_PREFIX = "AGENTRUN_SERVE_FAUX";
|
|
24
|
-
/** `env` without a test hook's name: serve sets those from startServe's options
|
|
25
|
-
* environment holds (an operator's export, a leftover) never gives its runs fake
|
|
26
|
-
|
|
25
|
+
/** `env` without a test hook's name or the resolved harness modules list: serve sets those from startServe's options
|
|
26
|
+
* alone, so a name the server's own environment holds (an operator's export, a leftover) never gives its runs fake
|
|
27
|
+
* answers or loads a module. */
|
|
28
|
+
export const withoutFaux = (env) => Object.fromEntries(Object.entries(env).filter(([name]) => !name.startsWith(FAUX_PREFIX) && name !== HARNESS_TABLE_ENV && name !== HARNESS_MODULES_ENV));
|
|
27
29
|
/** Under `--faux` only: a module whose default export is the fetch the Anthropic and OpenAI providers send through (the
|
|
28
30
|
* tests' fake upstream), in place of their APIs. With it they are registered beside the faux model, for a tool's own
|
|
29
31
|
* request to the provider the revision's model names (web_search's, hosted-search.ts); the run's turns stay faux. */
|
|
@@ -454,7 +456,8 @@ export async function runModels(env, ref, tiers = ["default"], harness = DEFAULT
|
|
|
454
456
|
// the provider's client per wire, which pi-ai picks by the model's `api`.
|
|
455
457
|
const gatewayModels = ids.map((id) => {
|
|
456
458
|
const cost = priceOf(id);
|
|
457
|
-
// The effort each thinking level asks for, as the catalog says of the model (catalogThinking): sol's off sends none
|
|
459
|
+
// The effort each thinking level asks for, as the catalog says of the model (catalogThinking): sol's off sends none,
|
|
460
|
+
// and so does a model the catalog does not list.
|
|
458
461
|
const thinking = catalogThinking(catalog, id, namedOf.get(id));
|
|
459
462
|
const shared = { id, name: id, provider: MODEL_PROVIDER, reasoning: true, input: ["text", "image"], cost, contextWindow: 128_000, maxTokens: 32_000, ...(thinking ? { thinkingLevelMap: thinking } : {}) };
|
|
460
463
|
return wireOf(id) === "anthropic-messages" ? { ...shared, api: "anthropic-messages", baseUrl: base } : { ...shared, api: "openai-responses", baseUrl, compat: { supportsDeveloperRole: false } };
|
|
@@ -712,12 +715,17 @@ export async function catalogPrices() {
|
|
|
712
715
|
* version form: the vendor's entry (the id's segment before it, else `named`); else each level every entry that says
|
|
713
716
|
* agrees on (gpt-6.1-sol's entries differ on `minimal` alone: openai-codex's asks low), a level they differ on left to
|
|
714
717
|
* pi-ai's default. None: undefined, pi-ai's defaults. So pi through a gateway at thinking off asks gpt-6.1-sol for no
|
|
715
|
-
* effort, as its catalog entries say (off: null), not the "none" it refuses.
|
|
718
|
+
* effort, as its catalog entries say (off: null), not the "none" it refuses. A model the catalog does not list (a local
|
|
719
|
+
* model, a gateway's own alias) is never asked to stop reasoning either (off: null): pi then thinks at its lowest level,
|
|
720
|
+
* so a model that reasons anyway has its reasoning split out of the answer, never written into it. */
|
|
716
721
|
export function catalogThinking(catalog, id, named) {
|
|
717
722
|
const segments = id.split("/");
|
|
718
723
|
const own = segments.at(-1);
|
|
719
724
|
const vendor = segments.length > 1 ? segments.at(-2) : named;
|
|
720
|
-
const
|
|
725
|
+
const listed = [own, ...flippedForms(own)].flatMap((form) => catalog.get(form) ?? []);
|
|
726
|
+
if (!listed.length)
|
|
727
|
+
return { off: null };
|
|
728
|
+
const saying = listed.flatMap((entry) => (entry.thinkingLevelMap ? [{ provider: entry.provider, map: entry.thinkingLevelMap }] : []));
|
|
721
729
|
const vendors = saying.find((entry) => entry.provider === vendor);
|
|
722
730
|
if (vendors)
|
|
723
731
|
return vendors.map;
|
package/dist/openapi.js
CHANGED
|
@@ -17,7 +17,7 @@ import { TAKE_OVER_MINUTES } from "./computer-routes.js";
|
|
|
17
17
|
import { HOLD_MAX_MINUTES, HOLD_MINUTES } from "./computer-held.js";
|
|
18
18
|
import { CALL_MS, PROTOCOL_METHODS } from "./computer-channel.js";
|
|
19
19
|
import { LAUNCH_LOST, SETUP_LOST } from "./files.js";
|
|
20
|
-
import { HARNESSES } from "./harness.js";
|
|
20
|
+
import { HARNESS_ID_PATTERN, HARNESSES } from "./harness.js";
|
|
21
21
|
import { LEARNING_LABEL, LEARNING_MODES, LEARNING_REASONS, LEARNING_STATES, RUN_LEARNING_USE } from "./learning.js";
|
|
22
22
|
import { BATCH_CELL_MAX, BATCH_ROWS_MAX } from "./learning-batch.js";
|
|
23
23
|
import { AUDIT_DEFAULTS, AUDIT_MAX } from "./learning-setting.js";
|
|
@@ -28,6 +28,7 @@ import { COMPILE_AFTER_MAX } from "./learning-setting.js";
|
|
|
28
28
|
import { LOOP_COMPILES_MAX } from "./store-reads/loop.js";
|
|
29
29
|
import { GRADE_SOURCES, GRADES_KEPT, LABEL_MAX } from "./learn/promote.js";
|
|
30
30
|
import { MODEL_SOURCES, THINKING_LEVELS } from "./model.js";
|
|
31
|
+
import { MAX_MODEL_KEY_CHARS } from "./run-model-key.js";
|
|
31
32
|
import { BOX_IDS, BOX_NETWORKS, BOX_STATES } from "./place-offers.js";
|
|
32
33
|
import { PLACE_MODES } from "./place.js";
|
|
33
34
|
import { TOOL_KEYS, UNREADABLE } from "./tool-keys.js";
|
|
@@ -91,15 +92,26 @@ export const NOT_SERVED = ["exportHome", "importHome", "killRun"];
|
|
|
91
92
|
const ref = (name) => ({ $ref: `#/components/${name}` });
|
|
92
93
|
const errors = (...codes) => Object.fromEntries(codes.map((code) => [String(code), ref(`responses/${{ 400: "BadRequest", 401: "Unauthenticated", 403: "Forbidden", 404: "NotFound", 409: "Conflict", 412: "PreconditionFailed", 413: "PayloadTooLarge", 415: "UnsupportedMediaType", 422: "Unprocessable", 429: "RateLimited", 500: "Internal", 501: "Unsupported", 503: "Unavailable" }[code]}`)]));
|
|
93
94
|
const json = (schema, description) => ({ description, content: { "application/json": { schema } } });
|
|
94
|
-
/** GET /health's answer (host.ts Health). */
|
|
95
|
+
/** GET /health's answer (host.ts Health; listen-first.ts while the server is warming). */
|
|
95
96
|
const HEALTH = {
|
|
96
97
|
type: "object", additionalProperties: false, required: ["status", "checks"],
|
|
97
98
|
properties: {
|
|
98
|
-
status: { enum: ["ok", "failing"] },
|
|
99
|
-
checks: { type: "object", additionalProperties: false, required: ["store", "disk"], properties: { store: { enum: ["ok", "does_not_open"] }, disk: { enum: ["ok", "below_floor", "cannot_check"] } } },
|
|
99
|
+
status: { enum: ["ok", "failing", "warming"] },
|
|
100
|
+
checks: { type: "object", additionalProperties: false, required: ["store", "disk"], properties: { store: { enum: ["ok", "does_not_open", "opening"] }, disk: { enum: ["ok", "below_floor", "cannot_check"] } } },
|
|
100
101
|
},
|
|
101
102
|
};
|
|
102
103
|
const COUNT = { type: "integer", minimum: 0 };
|
|
104
|
+
/** What a harness promises (harness-table.ts HarnessPromises), as capabilities show it. */
|
|
105
|
+
const HARNESS_PROMISES = {
|
|
106
|
+
type: "object", additionalProperties: false, required: ["resume", "tool_gate", "billing"],
|
|
107
|
+
description: "What the harness promises, each measured on its pinned build, never named. The built-in harnesses (pi, claude-agent, codex, opencode) promise exact resume, every call gated, proxy billing.",
|
|
108
|
+
"x-agentrun-serve": "harness-table/1",
|
|
109
|
+
properties: {
|
|
110
|
+
resume: { enum: ["exact", "load", "restart"], description: "After a crash: `exact`, its state mirrored into the run's journal; `load`, the agent's own session load; `restart`, the turn restarts with a recovery note." },
|
|
111
|
+
tool_gate: { enum: ["every_call", "permission", "config"], description: "What holds its tool calls: `every_call`, each blocks until journaled; `permission`, the agent's permission requests; `config`, its own tools off by its config and this server's tools gated." },
|
|
112
|
+
billing: { enum: ["proxy", "plan"], description: "Who pays for its model: `proxy`, through the run's model proxy, on this server's keys and under its cap; `plan`, the vendor bills the person's own plan, bounded by turn and tool-call limits, not by this server's cap." },
|
|
113
|
+
},
|
|
114
|
+
};
|
|
103
115
|
const closed = (properties, description) => ({ type: "object", additionalProperties: false, required: Object.keys(properties), properties, ...(description ? { description } : {}) });
|
|
104
116
|
const USD = { type: ["number", "null"], minimum: 0, description: "The sum of the known costs, rounded to 1e-6; null when no run's cost is known, never 0 for unknown." };
|
|
105
117
|
/** Runs counted together (AgentStoreReader.analytics's AnalyticsGroup). */
|
|
@@ -1244,7 +1256,7 @@ const WRITE_ERRORS = { ...errors(400, 401, 403, 404, 412, 429, 500), "428": PREC
|
|
|
1244
1256
|
const SIGN_IN_WITHHELD = "Every text is cut of the agent's own browser sign-in pointers too, live or forgotten, and a note holding one is refused as one holding a host secret; when one of them does not open on this server (its seal key changed or is missing, or the sign-in is damaged), every learning route of the agent answers 403 `forbidden`, so nothing is shown over a shorter list.";
|
|
1245
1257
|
const WRITE_DESCRIPTION = "As a person, with no grader: one host commit on main in the agent's queue, `learning: <edited|created|retired> by a person: <file>` with a `Changed-By: user` trailer, MEMORY.md rebuilt from the active notes, and the folder's files brought in line. A note that fails the structural checks a run's notes pass (front matter, the 4 KB cap, UTF-8, hidden characters, text shaped like a secret or holding one of the host's) is 400 `bad_request` with `problems`, and nothing is written; so is an index past 200 lines. MEMORY.md is 400: the server builds it. Answers the note as it now is, with its new ETag. An archived agent's notes are written as its definition is. " + SIGN_IN_WITHHELD;
|
|
1246
1258
|
/** GET /agents/{agent_id}/learning/cost (learning-cost.ts, store-reads/learning.ts agentCostOverStore). */
|
|
1247
|
-
const COST_USD = (description) => ({ type: ["number", "null"], minimum: 0, description: `${description}
|
|
1259
|
+
const COST_USD = (description) => ({ type: ["number", "null"], minimum: 0, description: `${description} As booked (its float noise rounded off at 1e-12, the precision of a run's own cost): a decision's sub-micro-dollar cost is in it; null when unknown, never 0 for unknown.` });
|
|
1248
1260
|
const COST_MEAN = (description) => ({ oneOf: [closed({ runs: { ...COUNT, minimum: 1, description: "How many runs the mean is over." }, mean_usd: { type: "number", minimum: 0, description: "Their mean, rounded to 1e-6." } }), { type: "null" }], description });
|
|
1249
1261
|
const COST_RUN = closed({
|
|
1250
1262
|
n: { type: "integer", minimum: 1, description: "The run's number among the agent's runs counted here, oldest first: 1 is its first." },
|
|
@@ -1290,6 +1302,40 @@ const LEARNING_COST = closed({
|
|
|
1290
1302
|
agree_min: { type: "number", minimum: 0, maximum: 1, description: "The agreement bar it passed (the definition's `learning.agree_min`): `agreed` over `alone` at least this. Passing it says the workflow agreed with the agent that often, never that it is as accurate." },
|
|
1291
1303
|
}), { type: "null" }], description: "The check the serving promotion was decided on: the current champion of the learned workflow the newest served run ran. Null when none serves." },
|
|
1292
1304
|
}, "What the series shows, over every run it counts, `limit` aside."),
|
|
1305
|
+
bill: closed({
|
|
1306
|
+
baseline: COST_MEAN("The agent for one run: the mean own cost (`cost_usd`, learning left out) of the `agent` runs started before the agent's first run on a served path (`workflow`, `handed_back`, or an audit's shadow run), read from the run records (every one with none yet), each known exactly; null when there is none."),
|
|
1307
|
+
promoted: { oneOf: [closed({ n: { type: "integer", minimum: 1, description: "Its place on the bill's index." }, run_id: { type: "string" }, at: DATE_TIME }), { type: "null" }], description: "The first run that does a job started at or after the agent's first run on a served path (`at`: when that run started); null before one." },
|
|
1308
|
+
points: { type: "array", items: closed({
|
|
1309
|
+
n: { type: "integer", minimum: 1, description: "The run's place among the agent's runs that do a job (`agent`, `workflow` and `handed_back`), oldest first: a `replay` checks a revision and a shadow audits a run, so neither is on the index." },
|
|
1310
|
+
run_id: { type: "string" },
|
|
1311
|
+
actual_usd: { type: "number", minimum: 0, description: "Booked to this run, every run before it included: each run all in (`total_usd`: its own cost, its look-back with any compile turn, its grade and its audit shadow), and each replay run's cost at the run that does a job it followed. As booked (float noise rounded off at 1e-12)." },
|
|
1312
|
+
agent_usd: { type: ["number", "null"], minimum: 0, description: "The agent for all of it: `baseline` times the runs shown to here. Null with no baseline." },
|
|
1313
|
+
}), description: "One a run that does a job whose all-in cost is known exactly, every one: a run whose cost is unknown or only a bound is on neither line and counted in `withheld` (its number skipped)." },
|
|
1314
|
+
break_even: { oneOf: [closed({ n: { type: "integer", minimum: 1 }, run_id: { type: "string" } }), { type: "null" }], description: "The first run from `promoted` on after which `actual_usd` is never again over `agent_usd`, `booked_usd` against the line at the last point included: learning has paid for itself there. Null while it has not (`gap_usd` says by how much), and before a run on a served path." },
|
|
1315
|
+
gap_usd: { type: ["number", "null"], description: "While `break_even` is null: `booked_usd` less `agent_usd` at the last point (over 0: the bill is that much over the agent for all of it), spend booked after that point included. Null with a break-even, with no baseline or no run." },
|
|
1316
|
+
withheld: { ...COUNT, description: "Runs (replays included) whose cost is unknown or only a bound: on neither line." },
|
|
1317
|
+
booked_usd: { type: "number", minimum: 0, description: "The booked total: every priced run's cost (0 with none). Spend with no point to join (a replay after a run of unknown cost) is carried to the next point's `actual_usd`, and is in this when no point follows (or when there is no point at all: replays whose job runs were archived). With every run's GET /runs/{id} `cost.all_in_usd`, the sum of those and `unattributed_usd` is this." },
|
|
1318
|
+
revisions: { type: "array", items: closed({
|
|
1319
|
+
workflow: { type: "string", description: "The learned workflow, by name." },
|
|
1320
|
+
digest: { type: "string", description: "The revision: the first 16 hex characters of its workflow.json's sha256." },
|
|
1321
|
+
compile_usd: COST_USD("What the compile turns that drafted it cost: each ran in the session of a run that looked back, and is that run's learning spend no more, but this revision's. A recompile's turn is its recompiled revision's. 0 when none on record drafted it."),
|
|
1322
|
+
check_usd: COST_USD("What its check cost: its replay runs (the first draft's check or the one recompile's, each revision its own)."),
|
|
1323
|
+
spend_usd: COST_USD("Its learning spend: `compile_usd` and `check_usd` together."),
|
|
1324
|
+
k: { type: "integer", minimum: 1, description: "The served runs its spend is spread over: its check's `compile_after`." },
|
|
1325
|
+
served: { ...COUNT, description: "How many of those it has served (`workflow` or `handed_back` at this digest), at most `k`." },
|
|
1326
|
+
attributed_usd: COST_USD("What they carry: spend over k each in whole micro-dollars (a micro-dollar more on the first ones, and the sub-micro-dollar rest on the k-th, so the split is exact), on their GET /runs/{id} `cost.learning_usd`."),
|
|
1327
|
+
unattributed_usd: COST_USD("The rest: on no run until it serves `k` runs; for a `stopped` revision, on none ever."),
|
|
1328
|
+
state: { enum: ["checking", "serving", "stopped"], description: "`checking`: its check is at work; `serving`: it is its workflow's champion; `stopped`: held or replaced, so nothing more will carry it." },
|
|
1329
|
+
}), description: "Each revision of the agent's learned workflows its promotion records name, in the order first recorded, and how its learning spend is passed on to the runs it serves." },
|
|
1330
|
+
unattributed_usd: COST_USD("What no run carries: `booked_usd` less every run's GET /runs/{id} `cost.all_in_usd`. A revision's spend its served runs have not carried yet (each revision's `unattributed_usd`), a compile whose drafts all failed its checks or that the spend cap stopped (it drafted no revision to serve), and the spend of a revision whose promotion records aged out of the kept history land here, never nowhere. Null while any run's cost or learning is unknown, or a run is `withheld`."),
|
|
1331
|
+
holds: { type: "array", items: closed({
|
|
1332
|
+
n: { type: ["integer", "null"], minimum: 1, description: "The first run that does a job started at or after the hold, by its place on the bill's index (as `points` number them), placed by the server over every run, `limit` aside. Null when none has started since." },
|
|
1333
|
+
at: DATE_TIME,
|
|
1334
|
+
workflow: { type: "string", description: "The learned workflow held, by name." },
|
|
1335
|
+
by: { enum: ["audit", "check", "dsl"], description: "What held it: `audit`, its audits disagreed past the hold bar; `check`, a new revision's check held it (its draft failed its checks, or its replays fell short); `dsl`, this release's workflow DSL refused the serving revision (a hold with neither `audit` nor `check`, its `reason` the DSL's)." },
|
|
1336
|
+
reason: { type: "string", description: "The hold record's reason, in the server's words." },
|
|
1337
|
+
}), description: "Each hold the agent's promotion records keep, oldest first, at the run it bore on." },
|
|
1338
|
+
}, "The owner's bill, booked dollars only (each request at the price it was billed, cached tokens at their cached price), over every run, `limit` aside: the cumulative cost run after run against the agent doing all of it, and where learning pays for itself."),
|
|
1293
1339
|
});
|
|
1294
1340
|
const EVAL_TEXT = (description, example) => ({ type: "string", minLength: 1, maxLength: EVAL_TEXT_MAX, description, example });
|
|
1295
1341
|
const EVAL_IN = {
|
|
@@ -1329,30 +1375,32 @@ const REPLAY_OUTCOMES = closed({
|
|
|
1329
1375
|
failed: { ...COUNT, description: "Replay runs a step failed in, or still at work past the replay's deadline: no evidence either way, never scored." },
|
|
1330
1376
|
skipped_write: { ...COUNT, description: "Replay runs stopped at a write (an MCP tool its server does not mark read-only, or any tool not known to read) that the graded run's recording does not have with the same arguments: a replay never runs a write, so these are neither scored nor wrong; a replay whose every input was skipped holds the revision." },
|
|
1331
1377
|
}, "How many of its replay runs ended each way: what each run did.");
|
|
1378
|
+
/** A compiled draft's one check (learn/promote.ts CheckRecord): its bar while it replays, its numbers once decided. */
|
|
1379
|
+
const PROMOTION_CHECK = closedWith({
|
|
1380
|
+
compile_after: { type: "integer", minimum: 1, description: "The agent definition's `learning.compile_after` when the check began: how many of the agent's newest completed runs it read inputs from." },
|
|
1381
|
+
agree_min: { type: "number", minimum: 0, maximum: 1, description: "The bar on agreement: of the inputs it answered alone, the least share that must say what the agent's recorded answer said." },
|
|
1382
|
+
alone_min: { type: "number", minimum: 0, maximum: 1, description: "The bar on answering alone: the least share of the inputs it ran on that it must answer with no escalate and no failed step." },
|
|
1383
|
+
attempt: { enum: [1, 2], description: "1: the compile's first check. 2: the check of its one recompile, after the first held it; held again, it stops (`stopped`)." },
|
|
1384
|
+
}, {
|
|
1385
|
+
n: { ...COUNT, description: "The inputs it ran on (a replay stopped at a write is none; one never created, or not ended, by the check's deadline counts, as failed). 0 with nothing to run on: never promoted, it stops (`stopped`) and `reason` says why." },
|
|
1386
|
+
agreed: { ...COUNT, description: "How many of them it answered alone with the agent's recorded answer." },
|
|
1387
|
+
alone: { ...COUNT, description: "How many of them it answered alone. Promoted when `alone`/`n` >= `alone_min` and `agreed`/`alone` >= `agree_min`." },
|
|
1388
|
+
of: { type: "array", items: { type: "string" }, description: "The agent's runs whose inputs it ran on, newest first." },
|
|
1389
|
+
cost_usd: { type: ["number", "null"], minimum: 0, description: "What its replay runs cost together; null when one's cost is unknown." },
|
|
1390
|
+
outcomes: { ...REPLAY_OUTCOMES, description: "How each input it ran on came out, one per input: a replay run never created, or not ended, by the check's deadline is `failed`." },
|
|
1391
|
+
unstarted: { ...COUNT, minimum: 1, description: "How many of its replay runs were never created by the check's deadline (the server stopped after reserving them, say), each a `failed` input. Left out when none. Every one: its replay's read is `failed`." },
|
|
1392
|
+
skipped_tools: SKIPPED_TOOLS,
|
|
1393
|
+
disagreements: { type: "array", items: closedWith({ run: { type: "string" }, input: { type: "string", description: "The run's input, as text or JSON, cut at 1200 characters." }, agent: NULL_STRING }, { draft: { type: "string", description: "What it answered instead." }, escalated: { type: "string", description: "Why it handed the input back." }, failed: { const: true, description: "A step failed on it, or its run was still at work past the check's deadline, or never created by then." } }), description: "On a hold: each input it did not agree on, which the agent's next run reads as data in its one recompile." },
|
|
1394
|
+
stopped: { const: true, description: "The recompile's check held it too, or there was nothing to check it on (no input of the agent's it takes, or every input skipped at a write: `n` 0, `reason` starting \"nothing to check it on\", which asks no recompile): nothing compiles again until a hold or its owner acts; the agent keeps the runs." },
|
|
1395
|
+
});
|
|
1332
1396
|
const PROMOTION = closedWith({
|
|
1333
1397
|
workflow: { type: "string" },
|
|
1334
1398
|
digest: { type: "string", description: "The revision the record decides: the first 16 hex of its workflow.json's sha256." },
|
|
1335
1399
|
at: DATE_TIME,
|
|
1336
|
-
decided: { enum: ["promote", "hold", "replaying"], description: "`promote`: it serves first on the runs it fits. `hold`: it does not; the champion (the revision promoted last) takes them, else the agent, until a new revision. A hold with `audit` is its audits' (a serving revision: at least the definition's `learning.hold_disagree` of its newest `learning.hold_window` audit rows, GET .../learning/audits, disagreed); one
|
|
1400
|
+
decided: { enum: ["promote", "hold", "replaying"], description: "`promote`: it serves first on the runs it fits. `hold`: it does not; the champion (the revision promoted last) takes them, else the agent, until a new revision. A hold with `audit` is its audits' (a serving revision: at least the definition's `learning.hold_disagree` of its newest `learning.hold_window` audit rows, GET .../learning/audits, disagreed); one with `check`, its check's; one with neither, this release's workflow DSL refused the serving revision (`reason` names the DSL's code and where; its runs handed back to the agent): the agent's next run recompiles it once. `replaying`: its check's replay runs are at work; the champion serves meanwhile, else the agent. One revision of a workflow is checked at a time, and a running check finishes." },
|
|
1337
1401
|
reason: { type: "string", description: "Why, in words, with the numbers." },
|
|
1338
1402
|
}, {
|
|
1339
|
-
check:
|
|
1340
|
-
compile_after: { type: "integer", minimum: 1, description: "The agent definition's `learning.compile_after` when the check began: how many of the agent's newest completed runs it read inputs from." },
|
|
1341
|
-
agree_min: { type: "number", minimum: 0, maximum: 1, description: "The bar on agreement: of the inputs it answered alone, the least share that must say what the agent's recorded answer said." },
|
|
1342
|
-
alone_min: { type: "number", minimum: 0, maximum: 1, description: "The bar on answering alone: the least share of the inputs it ran on that it must answer with no escalate and no failed step." },
|
|
1343
|
-
attempt: { enum: [1, 2], description: "1: the compile's first check. 2: the check of its one recompile, after the first held it; held again, it stops (`stopped`)." },
|
|
1344
|
-
}, {
|
|
1345
|
-
n: { ...COUNT, description: "The inputs it ran on (a replay stopped at a write is none; one never created, or not ended, by the check's deadline counts, as failed). 0 with nothing to run on: never promoted, it stops (`stopped`) and `reason` says why." },
|
|
1346
|
-
agreed: { ...COUNT, description: "How many of them it answered alone with the agent's recorded answer." },
|
|
1347
|
-
alone: { ...COUNT, description: "How many of them it answered alone. Promoted when `alone`/`n` >= `alone_min` and `agreed`/`alone` >= `agree_min`." },
|
|
1348
|
-
of: { type: "array", items: { type: "string" }, description: "The agent's runs whose inputs it ran on, newest first." },
|
|
1349
|
-
cost_usd: { type: ["number", "null"], minimum: 0, description: "What its replay runs cost together; null when one's cost is unknown." },
|
|
1350
|
-
outcomes: { ...REPLAY_OUTCOMES, description: "How each input it ran on came out, one per input: a replay run never created, or not ended, by the check's deadline is `failed`." },
|
|
1351
|
-
unstarted: { ...COUNT, minimum: 1, description: "How many of its replay runs were never created by the check's deadline (the server stopped after reserving them, say), each a `failed` input. Left out when none. Every one: its replay's read is `failed`." },
|
|
1352
|
-
skipped_tools: SKIPPED_TOOLS,
|
|
1353
|
-
disagreements: { type: "array", items: closedWith({ run: { type: "string" }, input: { type: "string", description: "The run's input, as text or JSON, cut at 1200 characters." }, agent: NULL_STRING }, { draft: { type: "string", description: "What it answered instead." }, escalated: { type: "string", description: "Why it handed the input back." }, failed: { const: true, description: "A step failed on it, or its run was still at work past the check's deadline, or never created by then." } }), description: "On a hold: each input it did not agree on, which the agent's next run reads as data in its one recompile." },
|
|
1354
|
-
stopped: { const: true, description: "The recompile's check held it too, or there was nothing to check it on (no input of the agent's it takes, or every input skipped at a write: `n` 0, `reason` starting \"nothing to check it on\", which asks no recompile): nothing compiles again until a hold or its owner acts; the agent keeps the runs." },
|
|
1355
|
-
}),
|
|
1403
|
+
check: PROMOTION_CHECK,
|
|
1356
1404
|
runs: { type: "array", items: { type: "string" }, description: "Its replay runs (path `replay`)." },
|
|
1357
1405
|
inputs: { type: "array", items: { type: "string" }, description: "On a replaying record: the graded run each of `runs` replays, in the same order. Its runs are reserved before they are created; one not created a few minutes on is created by the next claim." },
|
|
1358
1406
|
replay_id: { type: "string", description: "The replay's id, on its replaying record and the one that decided it: GET .../revisions/{digest}/replays/{replay_id} reads it, whether a run's claim or its owner started it." },
|
|
@@ -1380,11 +1428,23 @@ const SERVING = closed({
|
|
|
1380
1428
|
workflow: { type: "string" },
|
|
1381
1429
|
digest: { ...NULL_STRING, description: "The revision that serves first (the champion: the one promoted last, while its newest record still says promote); null when none does and the agent takes the runs." },
|
|
1382
1430
|
replaying: { ...NULL_STRING, description: "A newer revision whose replay is at work, when there is one: it serves only once its replay promotes it; the champion serves meanwhile." },
|
|
1383
|
-
state: { enum: ["serving", "checking", "held", "stopped"], description: "`serving`: a revision serves first. `checking`: its newest revision's check is at work (the agent takes the runs meanwhile, or the champion). `held`: none serves, its newest record holds it (a check's or an audit's hold: the agent's next run recompiles it once). `stopped`: none serves and nothing compiles again (a recompile's check held it too, or a second audit hold within `learning.stop_window`, or a check whose every input stopped at a write) until a new revision lands." },
|
|
1431
|
+
state: { enum: ["serving", "checking", "held", "stopped"], description: "`serving`: a revision serves first. `checking`: its newest revision's check is at work (the agent takes the runs meanwhile, or the champion). `held`: none serves, its newest record holds it (a check's or an audit's hold, or this release's workflow DSL refused it: the agent's next run recompiles it once). `stopped`: none serves and nothing compiles again (a recompile's check held it too, or a second audit hold within `learning.stop_window`, or a check whose every input stopped at a write) until a new revision lands." },
|
|
1384
1432
|
check: { anyOf: [closed({ n: COUNT, agreed: COUNT, alone: COUNT, attempt: { enum: [1, 2] } }), { type: "null" }], description: "The numbers of the workflow's newest decided check: its inputs, those it agreed on, those it answered alone, which check of its compile it was; null when none was decided." },
|
|
1385
1433
|
audit: { anyOf: [AUDIT_LINE, { type: "null" }], description: "Its audit line: the serving (else the newest) revision's newest audit rows against the hold bar; null when no revision has a record." },
|
|
1386
1434
|
audits_off: { ...NULL_STRING, description: "Why none of the agent's runs is audited, e.g. `audits off: send_email can write`: its definition can call a tool that is not read-only (an MCP tool its server lists without `readOnlyHint`, or a built-in other than web_fetch, web_search, pdf_pages and llm, its computer's tools among them), which a shadow run would call a second time. Null when every tool it can call only reads: its served runs are audited." },
|
|
1387
1435
|
not_auditable: { ...COUNT, description: "Of the serving revision's newest `learning.stop_window` served runs, those a trigger started: never audited (a shadow run gets none of a trigger's context, and could answer where it answers). 0 when none serves." },
|
|
1436
|
+
champion: { anyOf: [closed({
|
|
1437
|
+
digest: { type: "string", description: "The champion's revision: `digest` above." },
|
|
1438
|
+
commit: { ...NULL_STRING, description: "The learning commit its text was read at: the newest its promotion records name that holds it, else the folder's main. Read by its recorded digest, never by paging the workflow's history. Null when no commit read holds it." },
|
|
1439
|
+
nodes: { anyOf: [{ type: "array", items: closed({
|
|
1440
|
+
path: { type: "string", description: "Where the node is in its parent: a chain's step by its index (`0`, `1`), any other child by its field (`2.body`); `root` for a root that is no chain." },
|
|
1441
|
+
kind: { type: "string", description: "Its node kind (`extract`, `decide`, `call`, `loop`, `escalate`, ...)." },
|
|
1442
|
+
label: { type: "string", description: "Its label; its kind when it has none." },
|
|
1443
|
+
tier: { type: ["string", "null"], enum: ["fast", "agent", null], description: "The tier its model step runs on: `fast`, or `agent` for the agent's own model. Null for a node that calls no model tier (a call, a loop, an escalate, a decision node's own provider)." },
|
|
1444
|
+
checks: { type: "array", items: closed({ on: { enum: ["when", "until"], description: "`when`: the node runs only when the predicate holds. `until`: a loop stops once it holds." }, predicate: { type: "object", description: "The predicate as the workflow holds it (the DSL's predicate: `field_equals`, `exists`, `not`, `and`, `or`, ...)." } }), description: "The checks it runs in code." },
|
|
1445
|
+
}) }, { type: "null" }], description: "Each node of its workflow.json, depth first, a chain's steps in order and the chain itself left out. Null when its text could not be read." },
|
|
1446
|
+
check: { anyOf: [PROMOTION_CHECK, { type: "null" }], description: "The check it was promoted on: its promote record's `check`. Null when it was promoted with none." },
|
|
1447
|
+
}), { type: "null" }], description: "The revision that serves first, as a person reads it: its nodes with their tiers and code checks, and the check it was promoted on. Kept while a newer revision is checked (`replaying`). Null when none serves (`digest` null)." },
|
|
1388
1448
|
});
|
|
1389
1449
|
const AUDIT_ROW = closedWith({
|
|
1390
1450
|
run: { type: "string", description: "The served run." },
|
|
@@ -1483,7 +1543,7 @@ const LEARNING_EXTENSIONS = {
|
|
|
1483
1543
|
"/agents/{agent_id}/learning/audits": {
|
|
1484
1544
|
get: {
|
|
1485
1545
|
operationId: "listLearningAudits", tags: ["agents"], summary: "The audit ledger of the agent's serving learned workflows",
|
|
1486
|
-
description: "One row per finished audit, oldest first, as the agent's learning folder keeps them (audits.jsonl): a run a promoted learned workflow
|
|
1546
|
+
description: "One row per finished audit, oldest first, as the agent's learning folder keeps them (audits.jsonl): a run a promoted learned workflow answered alone (path `workflow`; a run it handed back is never drawn) is audited at 1 in `learning.audit_every` (drawn from its id): its shadow run, the same agent on the same input with learning off, answers it again, and the row says whether the two answers say the same and what each run cost (the shadow's is the agent's learning cost; the shadow is no row of the run list, and GET /runs/{id} reads it with `audit_of`). A capped run's shadow starts at its end, capped at what its cap left, so the two never spend past it: with less than a run's smallest cap left, none starts (`skipped`). A shadow never waits on a person: one that would (an approval, a question, a raise of its cap) ends there at once with no answer (`parked`); neither is counted. Each row compares the served run's answer at the audit's start (`turn`), never a follow-up's. An owner's grade of a run the workflow answered alone is a row too. The hold rule reads them (`learning.hold_window`, `learning.hold_disagree`).",
|
|
1487
1547
|
parameters: [AGENT_ID],
|
|
1488
1548
|
responses: { "200": json(closed({ agent: { type: "string" }, audits: { type: "array", items: AUDIT_ROW } }), "The agent's audit rows."), ...errors(401, 403, 404, 429, 500) },
|
|
1489
1549
|
"x-agentrun-serve": "promotion/1",
|
|
@@ -1780,10 +1840,10 @@ const EXTENSIONS = {
|
|
|
1780
1840
|
"/health": {
|
|
1781
1841
|
get: {
|
|
1782
1842
|
operationId: "getHealth", tags: ["capabilities"], summary: "Whether this server can serve", security: [{}],
|
|
1783
|
-
description: "Readable without a credential: the store opens and the data directory's disk is above its floor. 503 with the same shape when either fails.",
|
|
1843
|
+
description: "Readable without a credential: the store opens and the data directory's disk is above its floor. 503 with the same shape when either fails. While the server is still starting (it listens before it has loaded and opened its store), 503 with `status` `warming` and `checks.store` `opening`, and a Retry-After; every other request then answers 503 `unavailable`, retryable.",
|
|
1784
1844
|
responses: {
|
|
1785
1845
|
"200": json(HEALTH, "Healthy."),
|
|
1786
|
-
"503": json(HEALTH, "Not healthy: which check failed."),
|
|
1846
|
+
"503": json(HEALTH, "Not healthy: which check failed; or warming, still starting."),
|
|
1787
1847
|
...errors(429, 500),
|
|
1788
1848
|
},
|
|
1789
1849
|
},
|
|
@@ -2390,7 +2450,7 @@ const EXTENSIONS = {
|
|
|
2390
2450
|
operationId: "listComposioEvents", tags: ["local"], summary: "List a saved Composio server's toolkit's events, for a composio trigger",
|
|
2391
2451
|
description: "Every page of Composio's trigger types for the server's toolkit, asked with its saved key: each event's slug (a composio trigger's `event`), name, description, the JSON schema of its config (a trigger's `config`, its `required` fields marked) and whether Composio polls for it rather than being sent it. 404 for a name that is no saved server, or one not saved with the Composio preset; 422 when Composio refuses the key; 424 `upstream_failed` when Composio fails.",
|
|
2392
2452
|
parameters: [MCP_NAME],
|
|
2393
|
-
responses: { "200": json(closed({ server: { type: "string" }, toolkit: { type: "string" }, events: { type: "array", items: closedWith({ slug: { type: "string" }, name: { type: "string" }, description: { type: "string" }, config: { type: "object", description: "The event's config, as a JSON schema (`properties`, `required`)." }, polled: { type: "boolean", description: "Composio polls for it (every few minutes) rather than being sent it." } }, { instructions: { type: "string" } }) } }), "The toolkit's events."), ...errors(401, 404, 422, 429, 500), ...MCP_FAILED },
|
|
2453
|
+
responses: { "200": json(closed({ server: { type: "string" }, toolkit: { type: "string" }, events: { type: "array", items: closedWith({ slug: { type: "string" }, name: { type: "string" }, description: { type: "string" }, config: { type: "object", description: "The event's config, as a JSON schema (`properties`, `required`)." }, polled: { type: "boolean", description: "Composio polls for it (every few minutes) rather than being sent it." }, sealed: { type: "array", items: { type: "string" }, description: "The fields of its config a save seals: each named like a credential (developer_api_key), taken as a password and answered as \"[sealed]\" once saved. Composio's schemas mark no field secret, so the name says it." } }, { instructions: { type: "string" } }) } }), "The toolkit's events."), ...errors(401, 404, 422, 429, 500), ...MCP_FAILED },
|
|
2394
2454
|
...COMPOSIO_TRIGGERS_MARK,
|
|
2395
2455
|
},
|
|
2396
2456
|
},
|
|
@@ -2936,15 +2996,25 @@ const MCP_RUN_AUTH = {
|
|
|
2936
2996
|
description: "The credential each per_run MCP server this run calls is called with, by server name: `{\"<server>\": {\"headers\": {...}}}`. A credential for this run alone, from whoever starts it: the server keeps it sealed for the run's life and redacts its values from what the run shows.",
|
|
2937
2997
|
"x-agentrun-serve": "mcpperrun/1",
|
|
2938
2998
|
};
|
|
2999
|
+
/** runmodelkey/1: the run's own model key (run-model-key.ts), such as a LiteLLM virtual key minted for it. */
|
|
3000
|
+
const RUN_MODEL_KEY = {
|
|
3001
|
+
type: "string", minLength: 1, maxLength: MAX_MODEL_KEY_CHARS, pattern: "^[^\\s\\x00-\\x1f\\x7f]+$",
|
|
3002
|
+
// Not x-agentrun-secret, as mcp_auth: a key for this run alone, handed by whoever may start it, never kept for others.
|
|
3003
|
+
description: `The run's own model key: a key for the model gateway at AGENT_MODEL_BASE_URL, such as a LiteLLM virtual key minted for this run, which every model request tied to the run carries in place of the server's own key (its turns, its subagents, its learned workflows' nodes, a workflow's model nodes, its end-of-run look-back). AgentRun never mints, lists or revokes it. Sealed into the run's launch bound to the gateway's origin, read at each claim (a reclaim after a crash among them), erased by the write that ends the run's turn; never in its saved body, its timeline, its view, a log or an Idempotency-Key's fingerprint (a retry with a new key answers the first request's run, its first key kept). The harness, its tools and its sandbox never see it. 422 at \`model_key\` when the run's model never goes to that gateway (no AGENT_MODEL_BASE_URL here, a native run, or a model routed elsewhere). Absent, the run spends on the server's key for its route; where the server holds none (no AGENT_MODEL_API_KEY, none saved in Settings), a start without it is 422 \`model_key_required\`, never a failure at its first model call.`,
|
|
3004
|
+
"x-agentrun-serve": "runmodelkey/1",
|
|
3005
|
+
};
|
|
2939
3006
|
const FIELD_EXTENSIONS = {
|
|
2940
3007
|
Limits: {
|
|
2941
3008
|
free_model_requests: { type: "integer", minimum: 1, description: "The most requests on free models a run makes: a free model's catalog price is all zeros, so a dollar cap cannot stop it. AGENTRUN_FREE_MODEL_REQUESTS, else 60. The request after that many is not sent, and the run ends `failed`, its error `spend_cap_reached`: \"Not sent: this run reached its 60-request limit for free models.\" (the number is this one). Every free model's request counts, the run's own, its subagents', its side calls and any cut by a crash, capped or not; a paid request, a paid tool call and a workflow decision never do. ChatGPT-plan requests don't count.", "x-agentrun-serve": "freerequests/1" },
|
|
2942
3009
|
},
|
|
2943
3010
|
MessageCreate: {
|
|
3011
|
+
model_key: { ...RUN_MODEL_KEY, description: `${RUN_MODEL_KEY.description} On a message it replaces the run's key from the run's next model request on, a turn still going included, and it is the first key of a run that started on the server's (mint one per turn); a message without one keeps the key the run holds, which is none once its last turn ended: then, where the server holds no key for the run's model, the message is 422 \`model_key_required\` and nothing is written.` },
|
|
2944
3012
|
mcp_auth: { ...MCP_RUN_AUTH, description: `${MCP_RUN_AUTH.description} Replaces the run's handed credentials in the message's own write (a follow-up that opens an ended run again hands its turn's), so the turn the message starts calls with them. A run handed none calls a per_run server's tools refused, nothing sent.` },
|
|
2945
3013
|
},
|
|
2946
3014
|
Cost: {
|
|
2947
3015
|
...SO_FAR,
|
|
3016
|
+
learning_usd: { type: ["number", "null"], minimum: 0, description: "On the run read (GET /v2/runs/{run_id}) alone, where `usd` is the run's own spend, the job's: what learning spent for it, on the agent's own model route. Its look-back turn (a compile turn asked in it left out), its grades, its audit shadow's cost (the agent on its input with learning off), and its share of its workflow revision's learning spend: the compile turn that drafted that revision and its check's replay runs, spread over the first `compile_after` runs the revision serves (GET /agents/{agent_id}/learning/cost `bill.revisions`). A compile turn is never in the `usd` or `learning_usd` of the run whose session asked it: it is its revision's (a recompile's, its recompiled revision's), or, when every draft failed its checks, on no run (`bill.unattributed_usd`). A look-back that compiles nothing is this run's alone. 0 for a replay or shadow run, whose spend is on the runs it serves. As booked (float noise rounded off at 1e-12, as `usd` is); null while the run or its shadow is at work, or a part is unknown: never $0 for unknown.", "x-agentrun-serve": "allin/1" },
|
|
3017
|
+
all_in_usd: { type: ["number", "null"], minimum: 0, description: "On the run read alone: `usd` and `learning_usd` together, what the run cost its owner all in. 0 for a replay or shadow run. Over every run of an agent, these and the cost route's `bill.unattributed_usd` add up to its `bill.booked_usd`. Null when either is, or `usd` is only a bound (`upper_bound`).", "x-agentrun-serve": "allin/1" },
|
|
2948
3018
|
plan: {
|
|
2949
3019
|
type: "object", additionalProperties: false, required: ["requests", "tokens"],
|
|
2950
3020
|
properties: {
|
|
@@ -2956,6 +3026,7 @@ const FIELD_EXTENSIONS = {
|
|
|
2956
3026
|
},
|
|
2957
3027
|
},
|
|
2958
3028
|
RunCreate: {
|
|
3029
|
+
model_key: RUN_MODEL_KEY,
|
|
2959
3030
|
mcp_auth: { ...MCP_RUN_AUTH, description: `${MCP_RUN_AUTH.description} Each names a saved MCP server whose \`auth.type\` is per_run (422 at \`mcp_auth.<server>\` otherwise, no run made). Sealed into the run's launch for its life, read at each claim, and erased by the write that ends it; never in its saved body, its timeline, its view or an Idempotency-Key's fingerprint (a retry with a new credential answers the first request's run).` },
|
|
2960
3031
|
labels: { ...RUN_LABELS, description: `The caller's own labels for the run: at most ${MAX_LABELS} keys, each 1 to 63 letters, digits, \`.\`, \`_\`, \`-\` or \`/\` starting with a letter or a digit; each value text of 1 to ${MAX_LABEL_VALUE} characters with no control character. Kept on the run as given, served on every read of it (\`labels\` on Run and RunSummary) and matched by GET /runs' \`label\`; set once, at the start. The server reads nothing else from them: put no secret in one. Another shape is 422 under \`labels\` or \`labels.<key>\`. Absent: none.` },
|
|
2961
3032
|
workflow_first: {
|
|
@@ -3001,7 +3072,7 @@ const FIELD_EXTENSIONS = {
|
|
|
3001
3072
|
bytes: { type: "integer", minimum: 0, description: "Its size now." },
|
|
3002
3073
|
finished: { type: "boolean", description: "false while it is still being written: it plays up to its last whole fragment. true once its recording stopped, and for every file once the run has ended and the file has stopped changing (a few seconds after the end)." },
|
|
3003
3074
|
}, "One video of a computer's screen during the run (H.264 in fragmented MP4)."),
|
|
3004
|
-
description: "On the run read (and an archive's or unarchive's answer) alone, never in a list: the videos of the run's screen, where its agent's computer says `record: true` (a desktop or a
|
|
3075
|
+
description: "On the run read (and an archive's or unarchive's answer) alone, never in a list: the videos of the run's screen, where its agent's computer says `record: true` (a desktop, a phone or a browser, whose every session is a computer of its own), each computer's files in the order they were recorded; empty when nothing was recorded, and for a run whose words are withheld. Read from the files on the machine whose runner recorded them. The video shows everything on the screen: see the agent's `computer.record`.",
|
|
3005
3076
|
"x-agentrun-serve": "runvideo/1",
|
|
3006
3077
|
},
|
|
3007
3078
|
input: {
|
|
@@ -3037,7 +3108,12 @@ const FIELD_EXTENSIONS = {
|
|
|
3037
3108
|
"x-agentrun-serve": "imported/1",
|
|
3038
3109
|
},
|
|
3039
3110
|
trigger: RUN_TRIGGER,
|
|
3040
|
-
audit_of: { ...NULL_STRING, description: "On the run read: a shadow run's served run. A run a promoted learned workflow
|
|
3111
|
+
audit_of: { ...NULL_STRING, description: "On the run read: a shadow run's served run. A run a promoted learned workflow answered alone (path `workflow`; a run it handed back is never drawn) may be audited (the agent definition's `learning.audit_every`): its shadow, the same agent on the same input with learning off, started at the served run's end and capped at what the served run's cap left, is no row of any run list and sends no webhook, and its cost is in the served run's `cost.learning_usd` and `cost.all_in_usd` (null while the shadow is queued or running: never $0), never in its `cost.usd`, and in the agent's learning cost (GET /agents/{agent_id}/learning/audits). Null for any other run.", "x-agentrun-serve": "promotion/1" },
|
|
3112
|
+
path: {
|
|
3113
|
+
oneOf: [{ enum: [...RUN_PATHS] }, { type: "null" }],
|
|
3114
|
+
description: "On the run read (GET /v2/runs/{run_id}): the path the run took, as its end recorded it. `agent`: no learned workflow ran (every run of an agent that does not learn); `workflow`: a learned workflow served it first and its answer stands, `result.final_answer` that answer as the workflow gave it; `handed_back`: a learned workflow served it first and handed back (an escalate node said it could not, a step failed) or the agent answered after it, `result.final_answer` the agent's; `replay`: a check's run of a new revision on one of the agent's graded inputs; `audit`: an audit's shadow run (`audit_of`), the agent on a served run's input with learning off. A host's run list holds no `audit` run, and its webhooks never name one. Null while the run has not ended, for a workflow revision's run, and for a run that learns whose end recorded no path.",
|
|
3115
|
+
"x-agentrun-serve": "allin/1",
|
|
3116
|
+
},
|
|
3041
3117
|
},
|
|
3042
3118
|
InputIssue: {
|
|
3043
3119
|
code: { type: "string", description: "A workflow definition's issue: the DSL's validation code (`STATE_PATH_UNPRODUCED`, say), with `field` the path to it under `definition.workflow`.", "x-agentrun-serve": "validate/1" },
|
|
@@ -3101,7 +3177,7 @@ const FIELD_EXTENSIONS = {
|
|
|
3101
3177
|
learned_nodes: {
|
|
3102
3178
|
type: "array",
|
|
3103
3179
|
items: { type: "object", additionalProperties: false, required: ["label", "kind", "status", "duration_ms"], properties: { label: { type: "string" }, kind: { type: "string", description: "The node's kind, as the workflow DSL names it (`extract`, `agent`, `call`, ...)." }, status: { type: "string", description: "How the node ended: `ok`, `failed` or `escalated`. Why a node failed is never shown: its text may hold part of a secret." }, duration_ms: { type: "number" }, model: { type: "string", description: "A model node's (agent, decide, extract, report): the model it ran on, as the run's model route names it. Absent on a call node." }, tier: { type: "string", description: "The tier the model node named (`fast`, `strong`); absent for none, which runs on the run's own model." } } },
|
|
3104
|
-
description: "On a learned workflow call's `tool_result` row alone (`tool_name` learned_workflow): each of the workflow's nodes that ran, in the order they ended, at most 64. Absent on every other row.",
|
|
3180
|
+
description: "On a learned workflow call's `tool_result` row alone (`tool_name` learned_workflow): each of the workflow's nodes that ran, in the order they ended, at most 64. A learned workflow's nodes write no rows of their own (no `decision` row: a workflow revision's run alone has those; a decision node, `judge` or `pick` say, is an item here), so this list is the whole of them on the timeline. A served run (GET /runs/{id} `path` `workflow` or `handed_back`) reads in this order: its `user_message`, the learned_workflow `tool_use` and this `tool_result` with its items, then, served alone (`workflow`), the `final_answer` row that is the workflow's answer (`result.final_answer`) and the `usage` row; after a hand-back (`handed_back`), a `phase` row, the agent's own rows, its `final_answer` and the `usage` row. Each model node runs on the run's own model route (its tier's model when it names one), on the run's own key and cap. Absent on every other row.",
|
|
3105
3181
|
"x-agentrun-serve": "learnednodes/1",
|
|
3106
3182
|
},
|
|
3107
3183
|
computer_calls: {
|
|
@@ -3170,13 +3246,13 @@ const FIELD_EXTENSIONS = {
|
|
|
3170
3246
|
model: { type: "string", description: "`provider/model-id`, the model an agentic revision runs on; absent, this host's default. A workflow revision keeps none.", "x-agentrun-serve": "model/1" },
|
|
3171
3247
|
model_tiers: { type: "object", additionalProperties: false, minProperties: 1, properties: { fast: { type: "string" }, strong: { type: "string" } }, description: "The model of each of an agentic revision's tiers it names, each `provider/model-id`: what a `subagent` call that names that tier runs on (a call names a tier, never a model; one that names none runs on the revision's own model). A tier it leaves out runs on this host's model for the tier (AGENT_MODEL_FAST, AGENT_MODEL_STRONG, else the default). A workflow revision keeps none.", "x-agentrun-serve": "subagent/1" },
|
|
3172
3248
|
thinking: { enum: [...THINKING_LEVELS], description: "An agentic revision's thinking level; absent, the model's. A workflow revision keeps none.", "x-agentrun-serve": "model/1" },
|
|
3173
|
-
harness: {
|
|
3249
|
+
harness: { type: "string", pattern: HARNESS_ID_PATTERN, examples: [...HARNESSES], description: "The harness that runs the revision: one of capabilities' `harnesses` ids (the built-in pi, claude-agent, codex and opencode, and any an owner's harness module adds). Absent on a request, pi; every answer names it. One this server does not run saves with a warning, and its runs are 409 agent_not_runnable naming it (capabilities.harnesses).", "x-agentrun-serve": "harness/1" },
|
|
3174
3250
|
place: {
|
|
3175
3251
|
oneOf: [
|
|
3176
3252
|
{ type: "object", additionalProperties: false, required: ["mode"], properties: { mode: { const: "runner" } } },
|
|
3177
3253
|
{ type: "object", additionalProperties: false, required: ["mode", "box"], properties: { mode: { const: "sandbox" }, box: { enum: [...BOX_IDS] } } },
|
|
3178
3254
|
],
|
|
3179
|
-
description: "Where the revision's runs execute: `runner` (no box and no shell) or `sandbox` (the agent's file and shell tools run in the box; its loop, its log and every key stay on the server). Absent on a create of an agentic revision, the place this server gives a new agent (capabilities.places.default_place): the Docker box where this server has docker, written on the revision so an answer shows it, with tools [\"bash\", \"bash_background\", \"bash_output\", \"bash_input\", \"bash_signal\", \"bash_list\"] when the definition names no tools (a list it names, an empty one included, is kept as named); where docker is unavailable,
|
|
3255
|
+
description: "Where the revision's runs execute: `runner` (no box and no shell) or `sandbox` (the agent's file and shell tools run in the box; its loop, its log and every key stay on the server). Absent on a create of an agentic revision, the place this server gives a new agent (capabilities.places.default_place): the Docker box where this server has docker, written on the revision so an answer shows it, with tools [\"bash\", \"bash_background\", \"bash_output\", \"bash_input\", \"bash_signal\", \"bash_list\"] when the definition names no tools (a list it names, an empty one included, is kept as named, and gets the box only when one of its tools runs only there: `bash` or a background tool); where docker is unavailable, where the definition's tools need no shell, or where it names a tool a box refuses (browser), none, so its runs start on the runner with no container. A revision saved with no place runs where this server's capabilities.places.default_place says at each run (the Docker box where docker is available now, else the runner) when one of its tools needs a shell; a workflow, one whose tools need no shell, and one that names a tool a box refuses, on the runner. A revision keeps the place it names, runner included. An edit that names none keeps the agent's. A box this server does not have saves with a warning, and its runs are 409 agent_not_runnable naming it (capabilities.places.boxes). Only an agentic revision in a sandbox place may name `bash` or a background tool (`bash_background`, `bash_output`, `bash_input`, `bash_signal`, `bash_list`); a workflow revision's place is runner or none (a sandbox place is 422).",
|
|
3180
3256
|
"x-agentrun-serve": "place/1",
|
|
3181
3257
|
},
|
|
3182
3258
|
computer: {
|
|
@@ -3189,7 +3265,7 @@ const FIELD_EXTENSIONS = {
|
|
|
3189
3265
|
persistent: { type: "boolean", description: "Whether the agent keeps its own computer between runs: true makes one at its first run, detaches it (not deletes it) at each run's end, and attaches it again at the next, with what was on it; false or absent, a fresh computer for each run. Only where the provider keeps one for the kind and image (GET /computers: the provider's `persistent`), else 422 not_allowed; never one that mounts the run's folder. One run at a time: a run that finds the computer held by another run still going is refused at its start, naming that run. Archiving the agent, turning this off, or a setting on another provider or image deletes the computer (GET /agents/{agent_id}'s `own_computer` shows it)." },
|
|
3190
3266
|
surface: { enum: ["code", "tools"], description: "How the agent drives a desktop or a phone. `code`: by `codemode` scripts alone, whose `tools.computer_observe`, `tools.computer_act` and `tools.computer_screenshot` are each a gated, recorded call of its own; the model is offered `codemode` and the hand-over (`computer_request_handoff`), not the step tools (a harness with its own code mode, Codex, is still handed them). `tools`: the step tools and the hand-over, listed; a `codemode` script calls them too. Absent, as `tools`. Only a desktop or a phone takes it (422 not_allowed on another kind)." },
|
|
3191
3267
|
exec: { type: "boolean", description: "`false`: the agent gets no shell and starts no program on its desktop or phone. Its computer's `exec` and `processes` groups are taken out of what its tools and scripts see (no `computer.shell`, no `computer.processes`; a script that reaches for one is refused in words), no folder is mounted in the computer, and the run gets no `bash` or background tool, wherever its folder is. The run's own computer channel (`POST /runs/{run_id}/computer/call`, the owner's) keeps every group. `true` or absent: as the computer offers. Only a desktop or a phone takes it (422 not_allowed on another kind)." },
|
|
3192
|
-
record: { type: "boolean", description: "`true`: each run records a video of its desktop's or
|
|
3268
|
+
record: { type: "boolean", description: "`true`: each run records a video of its desktop's, phone's or browser's screen (a browser's from each session's page, one file per session; H.264, fragmented MP4, at most 10 frames a second and 1280 pixels on the long side, no audio) into its run folder's `recordings/`, beside `work/`, where the agent can neither read nor change it. The video shows everything on the screen, including whatever a person types while they take over and any secret that appears on screen; pixels can't be redacted the way the run's logs are. It records while the run holds the computer, with or without a viewer, pauses while the run is parked (a resumed run goes on in a new file) and stops at the computer's release, the run's end, or its cap (500 MB across the run's files, or 2 hours from its start or the run's resume), which the run's timeline says. A server without ffmpeg refuses it (422 not_allowed). `false` or absent: nothing is recorded. A sandbox doesn't take it (422 not_allowed)." },
|
|
3193
3269
|
},
|
|
3194
3270
|
description: "The computer the revision's runs are given (Settings → Computers): its kind, the provider that serves it, the image it starts from, a sandbox's GPUs, whether the agent keeps it between runs, and, for a desktop or a phone, how the agent drives it, whether it may run programs on it and whether its runs record its screen. `place` is its v2 view where it can say it: `{kind: none}` is `place {mode: runner}`, `{kind: sandbox, provider: X}` is `place {mode: sandbox, box: X}`; a desktop, phone or browser computer leaves the run's folder on the runner, so its place reads runner. Writing either sets both, and both given must agree (422). Absent on a create, the server's default (as `place`); an edit that names neither keeps the agent's.",
|
|
3195
3271
|
"x-agentrun-serve": "computer/1",
|
|
@@ -3200,7 +3276,7 @@ const FIELD_EXTENSIONS = {
|
|
|
3200
3276
|
compile_after: { type: "integer", minimum: 1, maximum: 200, default: 20, description: "The job compiles into a learned workflow once the agent has this many completed runs of its own." },
|
|
3201
3277
|
agree_min: { type: "number", minimum: 0, maximum: 1, default: 0.8, description: "The draft's one check replays it on the inputs of those runs: promoted only when, of the inputs it answered alone, at least this share say what the agent's own recorded answer said." },
|
|
3202
3278
|
alone_min: { type: "number", minimum: 0, maximum: 1, default: 0.7, description: "...and only when it answered at least this share of them alone (no escalate, no failed step). Under either bar it is recompiled once with the inputs it did not agree on, checked the same way, then promoted or stopped: nothing compiles again." },
|
|
3203
|
-
audit_every: { type: "integer", minimum: 1, maximum: AUDIT_MAX, default: AUDIT_DEFAULTS.audit_every, description: "Once a learned workflow serves, 1 in this many of the runs it
|
|
3279
|
+
audit_every: { type: "integer", minimum: 1, maximum: AUDIT_MAX, default: AUDIT_DEFAULTS.audit_every, description: "Once a learned workflow serves, 1 in this many of the runs it answers alone (path `workflow`; a run it hands back is never drawn) is audited: drawn from the run's id, the same agent runs the same input again with learning off (a shadow run, hidden from the run list, its cost the agent's learning cost), and the two answers are compared (one row of GET .../learning/audits)." },
|
|
3204
3280
|
audit_every_later: { type: "integer", minimum: 1, maximum: AUDIT_MAX, default: AUDIT_DEFAULTS.audit_every_later, description: "1 in this many once the workflow's revision served `audit_later_after` runs." },
|
|
3205
3281
|
audit_later_after: { type: "integer", minimum: 1, maximum: AUDIT_MAX, default: AUDIT_DEFAULTS.audit_later_after, description: "The served runs after which `audit_every_later` applies." },
|
|
3206
3282
|
hold_window: { type: "integer", minimum: 1, maximum: AUDIT_MAX, default: AUDIT_DEFAULTS.hold_window, description: "The audit rows of the serving revision the hold rule reads: its newest this many (an owner's grade on a served run is one too)." },
|
|
@@ -3298,7 +3374,7 @@ const FIELD_EXTENSIONS = {
|
|
|
3298
3374
|
harnesses: {
|
|
3299
3375
|
type: "array",
|
|
3300
3376
|
description: "Each harness a revision may name, and whether this server runs it; when not, why. A harness whose one run needs more memory than this server has for runs is unavailable, its reason naming the numbers, and its runs are 409 agent_not_runnable.",
|
|
3301
|
-
items: { type: "object", additionalProperties: false, required: ["id", "available", "steer", "default_model", "models", "free_models", "run_memory_mib", "max_concurrent_runs"], properties: { id: {
|
|
3377
|
+
items: { type: "object", additionalProperties: false, required: ["id", "label", "promises", "available", "steer", "default_model", "models", "free_models", "run_memory_mib", "max_concurrent_runs"], properties: { id: { type: "string", pattern: HARNESS_ID_PATTERN, examples: [...HARNESSES], description: "The harness's id: a built-in one (pi, claude-agent, codex, opencode), or one an owner's harness module adds (`agentrun-serve --harness-module`), listed after them." }, label: { type: "string", description: "Its name in a sentence (`Pi`, `Claude`, `Codex`, `OpenCode`).", "x-agentrun-serve": "harness-table/1" }, promises: HARNESS_PROMISES, available: { type: "boolean" }, free_models: { type: "array", items: { type: "object", additionalProperties: false, required: ["id", "context_window"], properties: { id: { type: "string", description: "The model, as it is in `models`." }, context_window: { type: "integer", minimum: 1, description: "Its context window, in tokens." } } }, description: "The models in `models` that run at $0: those whose catalog price is all zeros (input, output and cache), with each one's context window. Today OpenRouter's free models on pi, on OpenRouter's key (`openrouter/inclusionai/ling-3.2-flash:free`, `openrouter/nvidia/nemotron-3-ultra-550b-a55b:free`). Never a router that picks a model per request (`openrouter/auto`, `openrouter/free`): its price is the routed model's. A free model's provider may still limit its requests per minute and per day. Empty for a harness with none." }, models: { type: "array", items: { type: "string" }, description: "The current models a person may pick for this harness, each in the exact form a definition's `model` takes on it here (`anthropic/claude-sonnet-5-5` on a provider's own key; `openrouter/anthropic/claude-sonnet-5.5` when OpenRouter's is the only key; behind a gateway, the host's own model ids that are `provider/model-id`, for the harnesses that go through it; the save takes no other form). Only those this harness runs here: a model its catalog does not know is not listed. Empty when the harness does not run here. Any other model a definition names is still saved if the harness runs it." }, run_memory_mib: { type: "integer", minimum: 1, description: "The memory a run of this harness reserves while its process lives, in MiB, measured. A start is admitted while the runs going and it fit in this server's memory less its own; over that, 429 rate_limited with retry-after, as over `limits.max_concurrent_runs`." }, max_concurrent_runs: { type: "integer", minimum: 0, description: "The most runs of this harness alone at once here: by memory and by the cap on the count, whichever is fewer. 0 when one never fits. `limits.max_concurrent_runs` is pi's, the smallest run." }, default_model: { type: ["string", "null"], description: "The model this server runs for the harness when a definition names none (provider/model-id), or null when it runs none: the harness does not run here, or no default model here runs on it." }, steer: { type: "boolean", description: "Whether a message sent while the run works lands mid-turn (`steer`); when false, it waits for the turn's end and the answer's mode is `follow_up`." }, reason: { type: "string", description: "Why it does not run here, in words a person acts on; on one that runs here but has no default model for want of a key (pi with no key), why it has none. Where the ChatGPT sign-in would run it (`needs` lists `chatgpt`), it says so: \"or sign in with ChatGPT (Settings → Model keys) to run it on your ChatGPT plan\", or, signed in no longer, \"your ChatGPT sign-in expired: sign in again (Settings → Model keys)\"." }, needs: { type: "array", items: { enum: ["key", "chatgpt"] }, minItems: 1, uniqueItems: true, description: "Present on a harness that runs nothing here for want of a model key: what would give it a model, any one of them. `key`: a model key (Settings → Model keys). `chatgpt`: the ChatGPT sign-in (codex and pi, on a server that signs in with ChatGPT, not signed in or signed in no longer, and whose AGENT_MODEL names no key's model the harness runs: that model stays its default signed in or not). Absent where it runs, and where no key would make it run.", "x-agentrun-serve": "harness-needs/1" }, installs: { const: "on_first_use", description: "claude-agent and codex only, while that harness's CLI is not installed in this server's data: it installs on first use. The first run on it, or the first agent saved on it, installs the version AgentRun pins (claude-agent: the Claude Agent SDK; codex: Codex) from npm into `<data>/harnesses/<harness>`, by the lock AgentRun ships, once (every run that needs it waits for that one install); a run shows a `phase` row, `Installing Claude Code (first use)…` or `Installing Codex (first use)…`, while it does. When npm fails the run fails, and its error names the command that installs it by hand. Absent once it is installed.", "x-agentrun-serve": "firstuse/1" } } },
|
|
3302
3378
|
// harness/2: each entry took on its memory and count (run_memory_mib, max_concurrent_runs). A client that validates
|
|
3303
3379
|
// against harness/1 refuses them, so it is a mark of its own. harness/3: each entry also lists its `models`
|
|
3304
3380
|
// (required), which a harness/2 shape disallows. harness/4: an entry may say what it `needs`. harness/5: each entry
|
|
@@ -3312,7 +3388,7 @@ const FIELD_EXTENSIONS = {
|
|
|
3312
3388
|
type: "object", additionalProperties: false, required: ["name", "summary", "nodes", "calls", "available", "harnesses", "permission", "default_permission", "permissions"],
|
|
3313
3389
|
properties: {
|
|
3314
3390
|
name: { type: "string" }, summary: { type: "string" }, blurb: { type: "string", description: "One short line for people (the editor's Tools grid); the model never sees it. Absent for an MCP server's tool.", "x-agentrun-serve": "tool-blurb/1" }, nodes: { type: "boolean" }, calls: { type: "boolean" }, call_only: { type: "boolean", description: "Only a workflow's call node runs it (pdf_pages, llm): no agentic revision or model node names it." }, meta: { type: "boolean", description: "A host tool over the run's own tools (tools_search, tools_call, codemode): no revision, model node or call node names it, so it is no grant; Settings → Tools sets it (allow or deny: a deny is not offered)." }, sandbox_only: { type: "boolean", description: "Only an agent whose place is a sandbox names it (bash, and the background tools bash_background, bash_output, bash_input, bash_signal and bash_list): it runs in the box, and a runner has no shell, except in Mode 2, where bash alone runs on Archil's serverless exec." }, available: { type: "boolean" }, reason: { type: "string", description: "Why the tool is unavailable here, present whenever `available` is false: a provider pick's own words (`web_search is turned off in settings`, `parallel picked, no PARALLEL_API_KEY`), or `Needs` and the variables it is missing; for a sandbox-only tool (bash, the background tools) that no box this server has can run, `no box is set up on this server: …` with each box's own reason (`places.boxes`); in Mode 2 bash is available with no box." }, missing: { type: "array", items: { type: "string" } },
|
|
3315
|
-
harnesses: { type: "array", items: {
|
|
3391
|
+
harnesses: { type: "array", items: { type: "string", pattern: HARNESS_ID_PATTERN, examples: [...HARNESSES] }, description: "The harnesses that run the tool here, ids of capabilities' `harnesses`: a host tool, every one; another tool, pi and any harness an owner's harness module adds without adapter facts (it runs pi's tools). A revision naming it on another harness saves with a warning and its runs are 409 agent_not_runnable.", "x-agentrun-serve": "tool-harness/1" },
|
|
3316
3392
|
providers: { type: "array", items: { type: "string" }, description: "A tool with a provider choice: the providers offered for it, its default first.", "x-agentrun-serve": "providers/1" },
|
|
3317
3393
|
provider: { type: "string", description: "A tool with a provider choice: the server's, its default where it sets none.", "x-agentrun-serve": "providers/1" },
|
|
3318
3394
|
default_provider: { type: "string", description: "A tool with a provider choice: the built-in default.", "x-agentrun-serve": "providers/1" },
|
|
@@ -3363,7 +3439,7 @@ const FIELD_EXTENSIONS = {
|
|
|
3363
3439
|
{ type: "object", additionalProperties: false, required: ["mode"], properties: { mode: { const: "runner" } } },
|
|
3364
3440
|
{ type: "object", additionalProperties: false, required: ["mode", "box"], properties: { mode: { const: "sandbox" }, box: { enum: [...BOX_IDS] } } },
|
|
3365
3441
|
],
|
|
3366
|
-
description: "The place a NEW agentic agent that names none is saved with, written on its revision at its create: the Docker box (`{\"mode\": \"sandbox\", \"box\": \"docker\"}`) where this server has docker, with tools [\"bash\", \"bash_background\", \"bash_output\", \"bash_input\", \"bash_signal\", \"bash_list\"] when the definition names no tools; else the runner, with `default_reason`. It is also where an agentic revision saved with no place runs, resolved at each run: a workflow, and a revision that names a tool a box refuses, run on the runner. (It replaces `places.default`, which said `runner`.)",
|
|
3442
|
+
description: "The place a NEW agentic agent that names none and has a shell is saved with, written on its revision at its create: the Docker box (`{\"mode\": \"sandbox\", \"box\": \"docker\"}`) where this server has docker, with tools [\"bash\", \"bash_background\", \"bash_output\", \"bash_input\", \"bash_signal\", \"bash_list\"] when the definition names no tools; else the runner, with `default_reason`. One whose named tools need no shell is saved with no place and runs on the runner. It is also where an agentic revision saved with no place and a shell tool runs, resolved at each run: a workflow, a revision whose tools need no shell, and a revision that names a tool a box refuses, run on the runner. (It replaces `places.default`, which said `runner`.)",
|
|
3367
3443
|
"x-agentrun-serve": "place/4",
|
|
3368
3444
|
},
|
|
3369
3445
|
default_reason: { type: "string", description: "Why a new agent is not given a box here, when `default_place` is the runner, in docker's own words: `new agents run on the runner, because the docker box is unavailable here: <docker's reason>`, such as `Docker isn't running on this machine (no docker command on PATH): install or start Docker, then restart AgentRun`, or, with AGENTRUN_BOXES set to a list without docker, empty or `none`, the setting that turns it on.", "x-agentrun-serve": "place/3" },
|
|
@@ -3453,7 +3529,7 @@ const BLOCKED_DETAILS = {
|
|
|
3453
3529
|
properties: {
|
|
3454
3530
|
unbound: { type: "array", items: { type: "string" }, description: "The tools the revision names that this server does not bind, or does not bind on its harness." },
|
|
3455
3531
|
missing: { type: "object", additionalProperties: { type: "array", items: { type: "string" } }, description: "Each bound tool this host cannot run yet, with the variables it is missing." },
|
|
3456
|
-
harness: {
|
|
3532
|
+
harness: { type: "string", pattern: HARNESS_ID_PATTERN, examples: [...HARNESSES], description: "The revision's harness, when this server does not run it (capabilities.harnesses)." },
|
|
3457
3533
|
denied: { type: "array", items: { type: "string" }, description: "A workflow revision: the tools its call nodes call that are set to deny here." },
|
|
3458
3534
|
asks: { type: "array", items: { type: "string" }, description: "A workflow revision: the tools its call nodes call that are set to ask here (a catalog tool's default among them). A call node cannot wait for an approval: set the tool to allow for the agent." },
|
|
3459
3535
|
box: { enum: [...BOX_IDS], description: "The box of the revision's place, when this server does not have it (capabilities.places.boxes)." },
|
package/dist/owner.d.ts
CHANGED
|
@@ -58,6 +58,14 @@ export declare class Owner {
|
|
|
58
58
|
attach(baseUrl: string): void;
|
|
59
59
|
/** The setup page's link: with its code when setup needs one, a new code printed (never answered) when none is good. */
|
|
60
60
|
setupLink(): string;
|
|
61
|
+
/** A setup code to use, for whoever asks with no credential: the one that stands is kept (never voided here), and a
|
|
62
|
+
* new one is printed only when none is good (expired, or spent). Answers which, and when the code now good runs
|
|
63
|
+
* out; never the code. Null where there is none to give: an open setup, or a setup under way, whose spent code
|
|
64
|
+
* needs no successor. */
|
|
65
|
+
renewSetupCode(): {
|
|
66
|
+
printed: boolean;
|
|
67
|
+
until: number;
|
|
68
|
+
} | null;
|
|
61
69
|
/** Whether `given` is the setup code. None given (`missing`) is no try: it never counts against the printed code. A
|
|
62
70
|
* wrong one counts, and the fifth voids it and prints a new one at once (`new`), as an expired one does. */
|
|
63
71
|
private spendCode;
|
package/dist/owner.js
CHANGED
|
@@ -173,6 +173,17 @@ export class Owner {
|
|
|
173
173
|
}
|
|
174
174
|
return `${this.base}/setup#code=${this.setupCode.code}`;
|
|
175
175
|
}
|
|
176
|
+
/** A setup code to use, for whoever asks with no credential: the one that stands is kept (never voided here), and a
|
|
177
|
+
* new one is printed only when none is good (expired, or spent). Answers which, and when the code now good runs
|
|
178
|
+
* out; never the code. Null where there is none to give: an open setup, or a setup under way, whose spent code
|
|
179
|
+
* needs no successor. */
|
|
180
|
+
renewSetupCode() {
|
|
181
|
+
if (this.openSetup || this.settingUp)
|
|
182
|
+
return null;
|
|
183
|
+
const before = this.setupCode;
|
|
184
|
+
this.setupLink();
|
|
185
|
+
return { printed: this.setupCode !== before, until: this.setupCode.until };
|
|
186
|
+
}
|
|
176
187
|
/** Whether `given` is the setup code. None given (`missing`) is no try: it never counts against the printed code. A
|
|
177
188
|
* wrong one counts, and the fifth voids it and prints a new one at once (`new`), as an expired one does. */
|
|
178
189
|
spendCode(given) {
|
package/dist/paid-calls.d.ts
CHANGED
|
@@ -82,6 +82,9 @@ export declare const bookedIn: <T>(ledger: Ledger | undefined, work: () => Promi
|
|
|
82
82
|
export declare function paidRequest(fee: Fee, send: () => Promise<Response>): Promise<Response>;
|
|
83
83
|
/** paidStep's chargeOf for a step that charged nothing and is given back: its mark settled with no charge row. */
|
|
84
84
|
export declare const GIVEN_BACK = "given back";
|
|
85
|
+
/** Whether the current work runs inside a call's ledger (bookedIn): a host tool call of the run's, or a workflow call
|
|
86
|
+
* node's tool. A lost sandbox is started again only for one (computer-for-claim.ts lostAware), never for the run's end. */
|
|
87
|
+
export declare const inToolCall: () => boolean;
|
|
85
88
|
/** The run's one ledger the current call books on (Ledger.paid), when it has one: the runner's. */
|
|
86
89
|
export declare const paidLedger: () => PaidBooking | undefined;
|
|
87
90
|
/** Stops the run the current call books in, in `words`: handed to its pause (Ledger.pause) as a cap refusal no raise
|
|
@@ -89,6 +92,9 @@ export declare const paidLedger: () => PaidBooking | undefined;
|
|
|
89
92
|
* run ends failed in them, past its cap too, as a cap refusal for good ends it. Its code is the cap's, so the refused
|
|
90
93
|
* request reads as the cap's refusal (no model error row of its own). */
|
|
91
94
|
export declare const stopRun: (words: string) => Promise<void>;
|
|
95
|
+
/** Stops the run whose pause is `pause` (its ledger's: the adapter loop's RunLedger.pause), in `words`, as stopRun does,
|
|
96
|
+
* from any caller: one outside a tool call (the owner's computer channel) too. */
|
|
97
|
+
export declare const stopRunWith: (pause: NonNullable<Ledger["pause"]>) => (words: string) => Promise<void>;
|
|
92
98
|
/** One paid step on the run's one ledger `paid`, under call `call`: admitted at `holdUsd` (refused unsent: the cap's words,
|
|
93
99
|
* or why its hold could not be kept), then `run`, then settled at `chargeOf` its outcome (null: at its hold; GIVEN_BACK:
|
|
94
100
|
* given back, nothing charged, as a hold-only step's: a request its provider refused unrun leaves no charge row). One refused
|
package/dist/paid-calls.js
CHANGED
|
@@ -101,6 +101,9 @@ export async function paidRequest(fee, send) {
|
|
|
101
101
|
export const GIVEN_BACK = "given back";
|
|
102
102
|
/** Each paid request of this process on the run's one ledger, numbered within its call (one call may make several). */
|
|
103
103
|
let paidSeq = 0;
|
|
104
|
+
/** Whether the current work runs inside a call's ledger (bookedIn): a host tool call of the run's, or a workflow call
|
|
105
|
+
* node's tool. A lost sandbox is started again only for one (computer-for-claim.ts lostAware), never for the run's end. */
|
|
106
|
+
export const inToolCall = () => ledgers.getStore() !== undefined;
|
|
104
107
|
/** The run's one ledger the current call books on (Ledger.paid), when it has one: the runner's. */
|
|
105
108
|
export const paidLedger = () => ledgers.getStore()?.paid;
|
|
106
109
|
/** Stops the run the current call books in, in `words`: handed to its pause (Ledger.pause) as a cap refusal no raise
|
|
@@ -108,7 +111,14 @@ export const paidLedger = () => ledgers.getStore()?.paid;
|
|
|
108
111
|
* run ends failed in them, past its cap too, as a cap refusal for good ends it. Its code is the cap's, so the refused
|
|
109
112
|
* request reads as the cap's refusal (no model error row of its own). */
|
|
110
113
|
export const stopRun = async (words) => {
|
|
111
|
-
|
|
114
|
+
const pause = ledgers.getStore()?.pause;
|
|
115
|
+
if (pause)
|
|
116
|
+
await stopRunWith(pause)(words);
|
|
117
|
+
};
|
|
118
|
+
/** Stops the run whose pause is `pause` (its ledger's: the adapter loop's RunLedger.pause), in `words`, as stopRun does,
|
|
119
|
+
* from any caller: one outside a tool call (the owner's computer channel) too. */
|
|
120
|
+
export const stopRunWith = (pause) => async (words) => {
|
|
121
|
+
await pause({ refuse: words, code: SPEND_CAP_REACHED, forGood: true });
|
|
112
122
|
};
|
|
113
123
|
/** One paid step on the run's one ledger `paid`, under call `call`: admitted at `holdUsd` (refused unsent: the cap's words,
|
|
114
124
|
* or why its hold could not be kept), then `run`, then settled at `chargeOf` its outcome (null: at its hold; GIVEN_BACK:
|