@parcha/agentrun-serve 0.1.0-beta.54 → 0.1.0-beta.56
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 +142 -2
- package/README.md +310 -98
- package/dist/adapters.d.ts +11 -0
- package/dist/adapters.js +49 -0
- package/dist/agent-package.d.ts +3 -3
- package/dist/agent-package.js +6 -13
- package/dist/agents-store.js +6 -5
- package/dist/answer-json.d.ts +6 -2
- package/dist/answer-json.js +22 -4
- package/dist/api-only.d.ts +16 -4
- package/dist/api-only.js +23 -7
- package/dist/calendar/tools.js +3 -2
- package/dist/chatgpt-plan.d.ts +16 -1
- package/dist/chatgpt-plan.js +116 -12
- package/dist/claude-login.d.ts +34 -5
- package/dist/claude-login.js +31 -7
- package/dist/claude-sign-in.d.ts +35 -0
- package/dist/claude-sign-in.js +90 -0
- package/dist/cli.js +5 -3
- package/dist/composio-made.d.ts +26 -1
- package/dist/composio-made.js +39 -2
- package/dist/composio-preset.d.ts +3 -2
- package/dist/composio-preset.js +46 -14
- package/dist/computer-held-routes.js +2 -3
- package/dist/computer-setting.d.ts +4 -2
- package/dist/computer-setting.js +0 -2
- package/dist/computers-running.d.ts +8 -0
- package/dist/computers-running.js +27 -0
- package/dist/console/assets/backend-Boh7tC4i.js +166 -0
- package/dist/console/assets/index-CQ3cJRzI.js +746 -0
- package/dist/console/assets/index-DKkaS3a0.css +1 -0
- package/dist/console/index.html +2 -2
- package/dist/docker-host-addresses.d.ts +23 -3
- package/dist/docker-host-addresses.js +90 -18
- package/dist/exa-keyless.d.ts +2 -3
- package/dist/exa-keyless.js +43 -127
- package/dist/firecrawl-keyless.d.ts +41 -0
- package/dist/firecrawl-keyless.js +152 -0
- package/dist/handed-secret.d.ts +3 -1
- package/dist/handed-secret.js +4 -2
- package/dist/harness-keys.d.ts +98 -0
- package/dist/harness-keys.js +247 -0
- package/dist/harness-recipe-entry.d.ts +14 -9
- package/dist/harness-recipe-entry.js +25 -14
- package/dist/harness-table.d.ts +16 -1
- package/dist/harness-table.js +19 -7
- package/dist/harness.d.ts +4 -0
- package/dist/harness.js +12 -1
- package/dist/host-check.d.ts +6 -0
- package/dist/host-check.js +10 -0
- package/dist/import-summary.d.ts +1 -1
- package/dist/import-summary.js +1 -1
- package/dist/import.d.ts +5 -5
- package/dist/import.js +54 -67
- package/dist/key-refusal.d.ts +21 -5
- package/dist/key-refusal.js +231 -37
- package/dist/keyless-mcp.d.ts +36 -0
- package/dist/keyless-mcp.js +127 -0
- package/dist/learn/audit.d.ts +3 -3
- package/dist/learn/audit.js +3 -3
- package/dist/learn/commit.d.ts +8 -7
- package/dist/learn/commit.js +60 -20
- package/dist/learn/compile.d.ts +4 -3
- package/dist/learn/compile.js +7 -5
- package/dist/learn/folder.d.ts +16 -3
- package/dist/learn/folder.js +46 -13
- package/dist/learn/promote.d.ts +37 -13
- package/dist/learn/promote.js +112 -40
- package/dist/learn/secrets.d.ts +20 -10
- package/dist/learn/secrets.js +44 -176
- package/dist/learning-routes.d.ts +22 -17
- package/dist/learning-routes.js +40 -39
- package/dist/learning.js +2 -2
- package/dist/llms.txt +1 -1
- package/dist/manifest.d.ts +10 -0
- package/dist/manifest.js +30 -0
- package/dist/mcp-pin-first.d.ts +4 -2
- package/dist/mcp-pin-first.js +5 -2
- package/dist/mcp-secret-writes.d.ts +16 -7
- package/dist/mcp-secret-writes.js +35 -27
- package/dist/mcp-servers-store.d.ts +30 -6
- package/dist/mcp-servers-store.js +112 -28
- package/dist/mcp-sources.d.ts +10 -2
- package/dist/mcp-sources.js +9 -2
- package/dist/mcp-store.d.ts +13 -7
- package/dist/mcp-store.js +12 -9
- package/dist/model-form.d.ts +3 -2
- package/dist/model-form.js +11 -7
- package/dist/model.d.ts +20 -4
- package/dist/model.js +68 -9
- package/dist/native/history.d.ts +1 -1
- package/dist/native/history.js +2 -2
- package/dist/ollama-provider.d.ts +92 -0
- package/dist/ollama-provider.js +495 -0
- package/dist/openapi/agentrun-v2.openapi.json +2 -2
- package/dist/openapi.d.ts +3 -3
- package/dist/openapi.js +197 -55
- package/dist/page.d.ts +11 -3
- package/dist/page.js +22 -7
- package/dist/place-offers.d.ts +25 -1
- package/dist/place-offers.js +62 -8
- package/dist/print.js +1 -1
- package/dist/purged-workflow.d.ts +35 -7
- package/dist/purged-workflow.js +73 -26
- package/dist/redact/match.d.ts +74 -0
- package/dist/redact/match.js +771 -0
- package/dist/run-computer.d.ts +2 -0
- package/dist/run-computer.js +2 -0
- package/dist/run-files.d.ts +4 -0
- package/dist/run-files.js +4 -0
- package/dist/run-keys.d.ts +2 -4
- package/dist/run-keys.js +6 -7
- package/dist/run-launch.d.ts +4 -0
- package/dist/run-launch.js +4 -0
- package/dist/run-reads-over-store.d.ts +3 -2
- package/dist/run-reads-over-store.js +66 -2
- package/dist/run-secrets.js +5 -2
- package/dist/run-timeline-served.d.ts +1 -1
- package/dist/run-timeline-served.js +4 -4
- package/dist/runner/adapter-loop.d.ts +9 -3
- package/dist/runner/adapter-loop.js +34 -15
- package/dist/runner/adapter-run-spec.d.ts +3 -0
- package/dist/runner/adapter-run-spec.js +9 -4
- package/dist/runner/audit.js +8 -4
- package/dist/runner/beside.d.ts +2 -1
- package/dist/runner/beside.js +13 -5
- package/dist/runner/claim-secrets.d.ts +5 -8
- package/dist/runner/claim-secrets.js +6 -0
- package/dist/runner/cli-run-spec.d.ts +1 -1
- package/dist/runner/cli-run-spec.js +41 -7
- package/dist/runner/harness-loops.d.ts +22 -9
- package/dist/runner/harness-loops.js +21 -11
- package/dist/runner/held.d.ts +3 -0
- package/dist/runner/learning-end.d.ts +1 -1
- package/dist/runner/learning-end.js +8 -3
- package/dist/runner/loop-contract.d.ts +9 -4
- package/dist/runner/main.js +12 -6
- package/dist/runner/mcp-claim.d.ts +3 -0
- package/dist/runner/mcp-claim.js +26 -2
- package/dist/runner/mcp-run.d.ts +3 -0
- package/dist/runner/mcp-run.js +2 -1
- package/dist/runner/metrics.d.ts +10 -10
- package/dist/runner/metrics.js +19 -38
- package/dist/runner/model-route.d.ts +3 -0
- package/dist/runner/model-route.js +6 -2
- package/dist/runner/presence.d.ts +4 -3
- package/dist/runner/presence.js +4 -2
- package/dist/runner/promotion.d.ts +15 -9
- package/dist/runner/promotion.js +25 -15
- package/dist/runner/run-child-host.d.ts +2 -0
- package/dist/runner/run-child-host.js +19 -9
- package/dist/runner/run-child.js +3 -1
- package/dist/runner/runner.d.ts +4 -0
- package/dist/runner/runner.js +33 -3
- package/dist/runner/sdk-loop.js +2 -0
- package/dist/runner/workflow-loop.d.ts +2 -2
- package/dist/runner/workflow-loop.js +1 -2
- package/dist/runner/workflow-spec.d.ts +1 -1
- package/dist/runner/workflow-spec.js +6 -6
- package/dist/sdk/check.d.ts +4 -1
- package/dist/sdk/check.js +2 -1
- package/dist/sdk/runs.d.ts +2 -2
- package/dist/sdk/runs.js +8 -6
- package/dist/secret-cut.js +2 -1
- package/dist/secret-writes.d.ts +3 -2
- package/dist/secret-writes.js +1 -1
- package/dist/server.d.ts +49 -10
- package/dist/server.js +324 -118
- package/dist/standard-webhooks.d.ts +11 -0
- package/dist/standard-webhooks.js +20 -2
- package/dist/store/dialect.d.ts +3 -0
- package/dist/store/dialect.js +1 -0
- package/dist/store/index.d.ts +2 -2
- package/dist/store/index.js +1 -1
- package/dist/store/postgres/dialect.js +3 -0
- package/dist/store/schema.js +5 -2
- package/dist/store/sqlite/store.js +133 -47
- package/dist/store/store.d.ts +64 -15
- package/dist/store/store.js +7 -0
- package/dist/store-reads/journal.d.ts +7 -2
- package/dist/store-reads/journal.js +9 -6
- package/dist/store-reads/learning.d.ts +12 -9
- package/dist/store-reads/learning.js +18 -24
- package/dist/store-view.d.ts +0 -5
- package/dist/store-view.js +10 -9
- package/dist/template-eval.d.ts +51 -6
- package/dist/template-eval.js +177 -53
- package/dist/template-import.js +4 -2
- package/dist/templates.d.ts +5 -3
- package/dist/templates.js +19 -40
- package/dist/timeline/index.d.ts +1 -1
- package/dist/timeline/index.js +1 -1
- package/dist/timeline/labels.d.ts +2 -2
- package/dist/timeline/labels.js +2 -2
- package/dist/timeline/timeline.d.ts +14 -9
- package/dist/timeline/timeline.js +15 -7
- package/dist/tool-gate.js +3 -1
- package/dist/tool-plane.d.ts +17 -9
- package/dist/tool-plane.js +38 -17
- package/dist/tools.js +2 -2
- package/dist/trigger-launch-hook.d.ts +16 -8
- package/dist/trigger-launch-hook.js +32 -23
- package/dist/trigger-targets.d.ts +18 -8
- package/dist/trigger-targets.js +42 -19
- package/dist/triggers.d.ts +85 -23
- package/dist/triggers.js +303 -96
- package/dist/validate.js +1 -1
- package/dist/web-fake.js +3 -3
- package/dist/web-fetch-direct.d.ts +4 -0
- package/dist/web-fetch-direct.js +8 -1
- package/dist/web-fetch.d.ts +12 -3
- package/dist/web-fetch.js +47 -14
- package/dist/web-search.d.ts +33 -4
- package/dist/web-search.js +100 -41
- package/dist/webhooks.js +4 -5
- package/dist/workspace/computer-deps.d.ts +2 -1
- package/dist/workspace/computer-deps.js +5 -4
- package/dist/workspace/computer-for-claim.d.ts +8 -2
- package/dist/workspace/computer-for-claim.js +28 -9
- package/dist/workspace/computer-janitor.d.ts +15 -7
- package/dist/workspace/computer-janitor.js +33 -8
- package/dist/workspace/computer-kept.d.ts +52 -4
- package/dist/workspace/computer-kept.js +118 -6
- package/dist/workspace/run-end-computers.d.ts +5 -1
- package/dist/workspace/run-end-computers.js +27 -1
- package/dist/wrapped.d.ts +57 -0
- package/dist/wrapped.js +51 -0
- package/launcher/agentrun-serve +5 -1
- package/package.json +17 -13
- package/templates/README.md +10 -9
- package/dist/console/assets/index-B_85An2t.js +0 -745
- package/dist/console/assets/index-n1YsbnYh.css +0 -1
- package/dist/import-sources.d.ts +0 -116
- package/dist/import-sources.js +0 -693
package/dist/openapi.js
CHANGED
|
@@ -8,7 +8,7 @@ import { NATIVE_BINDING, NATIVE_RUN, NATIVE_PATHS } from "./native/schema.js";
|
|
|
8
8
|
// not serve at all (NOT_SERVED) is left out of the document, and this server's own routes are added as operations marked
|
|
9
9
|
// `x-agentrun-serve` (true, or the addition that made it, as `stats/1`), listed in `info.x-agentrun-serve`.
|
|
10
10
|
import { readFileSync } from "node:fs";
|
|
11
|
-
import { CALL_RESULT_CHARS, CAPS, TRIGGER_SOURCES } from "./timeline/index.js";
|
|
11
|
+
import { CALL_RESULT_CHARS, CALLS_PAGE_ROWS, CAPS, TRIGGER_SOURCES } from "./timeline/index.js";
|
|
12
12
|
import { EMAIL_SCOPES, PASSWORD_MAX, SCOPED_TOOLS, SEND_CAP } from "./email/names.js";
|
|
13
13
|
import { PAYLOAD_KEPT_BYTES } from "./trigger-adapter.js";
|
|
14
14
|
import { TRIGGER_ADAPTERS } from "./trigger-adapters.js";
|
|
@@ -33,6 +33,7 @@ import { GRADE_SOURCES, GRADES_KEPT, LABEL_MAX } from "./learn/promote.js";
|
|
|
33
33
|
import { MODEL_SOURCES, THINKING_LEVELS } from "./model.js";
|
|
34
34
|
import { MAX_MODEL_KEY_CHARS } from "./run-model-key.js";
|
|
35
35
|
import { MIN_SECRET } from "./learn/secrets.js";
|
|
36
|
+
import { HANDED_SECRET } from "./handed-secret.js";
|
|
36
37
|
import { BOX_IDS, BOX_NETWORKS, BOX_STATES } from "./place-offers.js";
|
|
37
38
|
import { PLACE_MODES } from "./place.js";
|
|
38
39
|
import { TOOL_FIELDS, TOOL_KEYS, UNREADABLE } from "./tool-keys.js";
|
|
@@ -40,6 +41,7 @@ import { MAX_KEY as MAX_RUN_KEY } from "./run-keys.js";
|
|
|
40
41
|
import { MCP_AUTH_TYPES } from "./mcp-probe.js";
|
|
41
42
|
import { CATALOG_KEY_PATTERN, MCP_SERVER_NAME } from "./tool-names.js";
|
|
42
43
|
import { MAX_PRIVATE_HOSTS } from "./mcp-private-hosts.js";
|
|
44
|
+
import { COMPOSIO_KEY_ENV, COMPOSIO_ORIGIN } from "./composio-made.js";
|
|
43
45
|
import { COMPOSIO_AUTH_CONFIG_ID, COMPOSIO_USER_ID } from "./composio-preset.js";
|
|
44
46
|
// The predicate of MCP's fields this document marks x-agentrun-secret, registered with the one gate as it loads.
|
|
45
47
|
import "./mcp-secret-writes.js";
|
|
@@ -72,6 +74,7 @@ import { BASH_POLICIES } from "./bash-read-only.js";
|
|
|
72
74
|
// (secret-writes.ts registerSecretWrite), so every operation the document marks has its predicate wherever it is read.
|
|
73
75
|
import "./computers.js";
|
|
74
76
|
import { ARCHIL_KEY_NAMES } from "./archil-routes.js";
|
|
77
|
+
import { RUN_FILE_CUT_MAX } from "./run-files.js";
|
|
75
78
|
import { ATTACH_HEARTBEAT_MS, ATTACH_IDLE_MS, ATTACH_SUBPROTOCOL, MAX_LINE_BYTES, PAIRING_CODE_PATTERN, PAIRING_CODE_TTL_MS, PROTOCOL_VERSION } from "@parcha/agentrun-computer";
|
|
76
79
|
import { DAEMON_FETCHES_PER_MINUTE, PAIR_TRIES_PER_MINUTE, PAIRED_NAME_MAX } from "./computer-attach.js";
|
|
77
80
|
/** runlabels/1: a run's labels, given at its start and served on every read of it (run-labels.ts). */
|
|
@@ -99,7 +102,7 @@ export const UNSUPPORTED = {
|
|
|
99
102
|
* Capabilities say each is off (home.export, home.import, runs.kill). */
|
|
100
103
|
export const NOT_SERVED = ["exportHome", "importHome", "killRun"];
|
|
101
104
|
const ref = (name) => ({ $ref: `#/components/${name}` });
|
|
102
|
-
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]}`)]));
|
|
105
|
+
const errors = (...codes) => Object.fromEntries(codes.map((code) => [String(code), ref(`responses/${{ 400: "BadRequest", 401: "Unauthenticated", 403: "Forbidden", 404: "NotFound", 409: "Conflict", 410: "Gone", 412: "PreconditionFailed", 413: "PayloadTooLarge", 415: "UnsupportedMediaType", 422: "Unprocessable", 429: "RateLimited", 500: "Internal", 501: "Unsupported", 503: "Unavailable" }[code]}`)]));
|
|
103
106
|
const json = (schema, description) => ({ description, content: { "application/json": { schema } } });
|
|
104
107
|
/** GET /health's answer (host.ts Health; listen-first.ts while the server is warming). */
|
|
105
108
|
const HEALTH = {
|
|
@@ -133,6 +136,26 @@ const HARNESS_PROMISES = {
|
|
|
133
136
|
};
|
|
134
137
|
const closed = (properties, description) => ({ type: "object", additionalProperties: false, required: Object.keys(properties), properties, ...(description ? { description } : {}) });
|
|
135
138
|
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." };
|
|
139
|
+
/** wrapped/1: GET /wrapped's answer (wrapped.ts). */
|
|
140
|
+
const WRAPPED_TOKENS = closed({ input: COUNT, output: COUNT, cache_read: COUNT, cache_write: COUNT });
|
|
141
|
+
const WRAPPED = closed({
|
|
142
|
+
year: { type: "integer", minimum: 1000, maximum: 9999 },
|
|
143
|
+
sessions: { ...COUNT, description: "Sessions whose first request falls in the year." },
|
|
144
|
+
turns: { ...COUNT, description: "The person's prompts in those sessions." },
|
|
145
|
+
requests: { ...COUNT, description: "Model requests made in the year, each once, subagents' with them." },
|
|
146
|
+
tokens: { ...WRAPPED_TOKENS, description: "The year's requests' tokens: `input` is uncached input, so the whole prompt is input + cache_read + cache_write." },
|
|
147
|
+
cost_usd: { type: "number", minimum: 0, description: "The list price of the requests that could be priced; `unpriced_requests` counts those that could not." },
|
|
148
|
+
unpriced_requests: COUNT,
|
|
149
|
+
days: { type: "array", description: "Each local day with a request, ascending.", items: closed({ day: { type: "string", pattern: "^\\d{4}-\\d{2}-\\d{2}$" }, requests: COUNT, tokens: COUNT }) },
|
|
150
|
+
hours: { type: "array", minItems: 24, maxItems: 24, items: COUNT, description: "Requests by local hour of the day." },
|
|
151
|
+
weekdays: { type: "array", minItems: 7, maxItems: 7, items: COUNT, description: "Requests by local weekday, Sunday first." },
|
|
152
|
+
active_ms: { ...COUNT, description: "Time at work: the gaps between a session's requests, each counted when under 15 minutes." },
|
|
153
|
+
harnesses: { type: "array", items: closed({ harness: { type: "string" }, sessions: COUNT, requests: COUNT, tokens: COUNT }), description: "By the harness that runs what each source ran, most tokens first." },
|
|
154
|
+
models: { type: "array", items: closed({ model: { type: "string", description: "`provider/model`, or `unknown` for a request that names none." }, requests: COUNT, tokens: COUNT, cost_usd: { type: "number", minimum: 0 } }), description: "By the request's model, most tokens first." },
|
|
155
|
+
sources: { type: "array", items: closed({ source: { type: "string" }, sessions: COUNT, requests: COUNT }), description: "By the tool the sessions were read from." },
|
|
156
|
+
imported: { type: "array", items: closed({ source: { type: "string" }, runs: COUNT }), description: "The runs imported here in the year, by source (never `live`)." },
|
|
157
|
+
unread_files: { ...COUNT, description: "Session files that could not be read (gone since listed, or not openable by this user), so the numbers are short by them. A count only: no path." },
|
|
158
|
+
}, "A year of the work under this machine's home, bucketed by each request's time in the server's local zone.");
|
|
136
159
|
/** Runs counted together (AgentStoreReader.analytics's AnalyticsGroup). */
|
|
137
160
|
const GROUP = {
|
|
138
161
|
runs: COUNT, completed: { ...COUNT, description: "Completed, escalated runs included: one completed and waits for a person's review." },
|
|
@@ -472,15 +495,16 @@ const CHATGPT_SIGN_IN = {
|
|
|
472
495
|
authorize_url: { type: "string", format: "uri", description: "With `pending`: the link that sign-in opens." },
|
|
473
496
|
expires_at: { type: "string", format: "date-time", description: "With `pending`: when that sign-in stops waiting, as its start answered." },
|
|
474
497
|
models: { type: "array", items: { type: "string" }, description: "With `signed_in`: the plan's models, read from OpenAI at the sign-in, each named `chatgpt/<model-id>` in a revision." },
|
|
498
|
+
problem: { type: "string", description: "Why the last sign-in ended without signing in, in words a person acts on: a plan OpenAI gave no use of (\"This ChatGPT plan can't be used here: …\"), a workspace whose admin turned off open-source apps (\"Your ChatGPT workspace's admin has turned off open-source apps (External access → OSS → Use ChatGPT plan): …\"), another refusal at OpenAI's sign-in page or of the code (a Free plan's sign-in has ended in one of these, and the words say a Free plan may be the reason), an answer that could not be read, OpenAI out of reach, or a sign-in that could not be saved. Always fixed words, never OpenAI's code (anything on the server's machine can send its loopback callback one). Set once the browser's return or a pasted address got that far (OpenAI's tab has already said the sign-in completed), or when a sign-in waited out its 10 minutes (\"The sign-in timed out before OpenAI sent the code back: start it again.\"); the server's log line `event=chatgpt chatgpt=sign_in_failed reason=…` names it (OpenAI's status and error code, or `timed_out`; never a token or a code). Present while signed in too, when a later sign-in failed. Gone at the next start, sign-in or sign-out; a cancelled sign-in sets none." },
|
|
475
499
|
},
|
|
476
500
|
};
|
|
477
501
|
/** GET /settings/claude-login's answer (claude-login.ts ClaudeLoginView): what Claude Code's CLI says of its login, never
|
|
478
502
|
* a token. */
|
|
479
503
|
const CLAUDE_LOGIN = {
|
|
480
|
-
type: "object", additionalProperties: false, required: ["state", "place", "command", "can_start"],
|
|
504
|
+
type: "object", additionalProperties: false, required: ["state", "place", "command", "can_start", "folder", "machine"],
|
|
481
505
|
properties: {
|
|
482
506
|
state: { enum: ["off", "other_machine", "signed_in", "signed_out", "no_cli", "unknown"], description: "`off`: not turned on. `other_machine`: turned on for another machine than this server's. Else what the CLI says: `signed_in`, `signed_out`, `no_cli` (no Claude Code CLI here yet: claude-agent's first run installs the pinned one), `unknown` (it gave no answer)." },
|
|
483
|
-
place: { enum: ["agentrun", "machine"], description: "Where the login is: `agentrun`, AgentRun's own directory in its data (the default); `machine`, this machine's own Claude Code login (
|
|
507
|
+
place: { enum: ["agentrun", "machine"], description: "Where the login is: `agentrun`, AgentRun's own directory in its data (the default); `machine`, this machine's own Claude Code login (`machine.folder`), which the owner opts into." },
|
|
484
508
|
command: { type: "string", description: "The line that signs the CLI in at `place`, for a terminal on this machine." },
|
|
485
509
|
can_start: { type: "boolean", description: "Whether POST /settings/claude-login/login can start the CLI's sign-in here: the server is bound to loopback with no public address, so the browser it opens is on this machine." },
|
|
486
510
|
refused: { type: "string", description: "Why the mode can't be turned on here, in one line: more than one person can start runs on this server." },
|
|
@@ -489,6 +513,28 @@ const CLAUDE_LOGIN = {
|
|
|
489
513
|
properties: { method: { type: "string" }, email: { type: "string" }, organization: { type: "string" }, plan: { type: "string" } },
|
|
490
514
|
description: "With `signed_in`: what the CLI's status says of the account (its sign-in method, email, organization and plan), for display.",
|
|
491
515
|
},
|
|
516
|
+
folder: { type: "string", description: "The folder whose login the CLI is asked about: the login's directory at `place`. The sign-in started here and `command` sign in there, and its status is read there." },
|
|
517
|
+
machine: {
|
|
518
|
+
type: "object", additionalProperties: false, required: ["folder", "source"],
|
|
519
|
+
properties: {
|
|
520
|
+
folder: { type: "string", description: "This machine's own Claude Code login folder, as the CLI finds it for this server's user." },
|
|
521
|
+
source: { enum: ["CLAUDE_CONFIG_DIR", "default"], description: "`CLAUDE_CONFIG_DIR`: the server's environment names the folder (an absolute path). `default`: it does not, so the folder is the CLI's default, `~/.claude`; a Claude Code that keeps its login in another folder is found only when this server is started with `CLAUDE_CONFIG_DIR` set to it." },
|
|
522
|
+
},
|
|
523
|
+
description: "This machine's own Claude Code login, the folder `place: machine` uses.",
|
|
524
|
+
},
|
|
525
|
+
sign_in: {
|
|
526
|
+
type: "object", additionalProperties: false, required: ["state", "started_at", "limit_ms"],
|
|
527
|
+
properties: {
|
|
528
|
+
state: { enum: ["waiting", "signed_in", "timed_out", "failed", "not_started"], description: "`waiting`: for the browser, since `started_at`. `signed_in`: the CLI's sign-in ended signed in. `timed_out`: no answer from the browser within `limit_ms`, so it was ended; a sign-in page still open can't finish, and POST /settings/claude-login/login starts it again. `failed`: the CLI ended without signing in (`exit_code`, or the `signal` that ended it). `not_started`: the CLI could not be started (`error`)." },
|
|
529
|
+
started_at: { type: "string", format: "date-time" },
|
|
530
|
+
ended_at: { type: "string", format: "date-time" },
|
|
531
|
+
limit_ms: { type: "integer", description: "How long it waits for the browser before it is ended (10 minutes)." },
|
|
532
|
+
exit_code: { type: "integer" },
|
|
533
|
+
signal: { type: "string" },
|
|
534
|
+
error: { type: "string" },
|
|
535
|
+
},
|
|
536
|
+
description: "The CLI's sign-in this server started (POST /settings/claude-login/login), as long as this server runs: absent when none was started, or after a turn-off.",
|
|
537
|
+
},
|
|
492
538
|
},
|
|
493
539
|
};
|
|
494
540
|
/** GET /settings/tool-keys's answer (tool-keys.ts): each key's fields by name and where each is set, never a value. */
|
|
@@ -535,6 +581,21 @@ const TOOL_KEYS_VIEW = closed({
|
|
|
535
581
|
},
|
|
536
582
|
});
|
|
537
583
|
const KEY_ID = { name: "key_id", in: "path", required: true, description: "The tool key: one of GET /settings/tool-keys' ids.", schema: { type: "string" } };
|
|
584
|
+
/** GET /settings/harness-keys (harness-keys.ts HarnessKeysOverStore.list): names and SecretMeta only, never a value. */
|
|
585
|
+
const HARNESS_KEYS_VIEW = closed({
|
|
586
|
+
harnesses: {
|
|
587
|
+
type: "array",
|
|
588
|
+
description: "Each harness recipe billed to its vendor's plan that this server is started with (--harness-recipe), in the table's order. Empty when it names none.",
|
|
589
|
+
items: closed({
|
|
590
|
+
id: { type: "string", pattern: HARNESS_ID_PATTERN, description: "The harness's id, as a revision's `harness` names it." },
|
|
591
|
+
label: { type: "string", description: "Its recipe's label." },
|
|
592
|
+
keys: { type: "array", items: { $ref: "#/components/schemas/SecretMeta" }, description: "Each key its recipe runs on (its `keys`, in their order) as every secret's view says it: named harness:<harness>:<KEY>; source `console` once saved; changed_at when its value was last saved. Never a value." },
|
|
593
|
+
ready: { type: "boolean", description: "Whether every one of `keys` is saved: then its runs run on them, a scheduled or triggered one too, ahead of its owner's own sign-in (--harness-sign-in)." },
|
|
594
|
+
}),
|
|
595
|
+
},
|
|
596
|
+
});
|
|
597
|
+
const HARNESS_ID_PARAM = { name: "harness_id", in: "path", required: true, description: "The harness: one of GET /settings/harness-keys' ids.", schema: { type: "string" } };
|
|
598
|
+
const HARNESS_KEY_PARAM = { name: "key", in: "path", required: true, description: "One of the harness's `keys`, by the name its recipe gives it.", schema: { type: "string" } };
|
|
538
599
|
/** The InputIssue reasons a saved MCP server's refusals give that the contract's enum lacks (mcp-probe.ts). */
|
|
539
600
|
const MCP_ISSUE_REASONS = ["redirect", "not_https", "too_many_tools", "tools_too_large", "reserved", "expired", "registration_unavailable"];
|
|
540
601
|
/** Whether an MCP server's OAuth sign-in brings its own client, and the callback URL a hand-made one must name
|
|
@@ -587,13 +648,16 @@ const MCP_SOURCE = { enum: [...MCP_SOURCES] };
|
|
|
587
648
|
const MCP_TOOLKIT_BODY = {
|
|
588
649
|
toolkit: { type: ["string", "null"], pattern: MCP_SERVER_NAME.source, description: "The toolkit its tools are, as a template names them (`mcp:<toolkit>/<tool>`): a template's MCP need of the server's `source` and this toolkit maps to it at apply. null clears it (not on a composio server, which names its toolkit); on the GitHub App's tokens it is `github` alone. Absent: what it was. The source is what made the server, never sent: `composio` from the Composio preset, `github` on the GitHub App's tokens, else `url`." },
|
|
589
650
|
};
|
|
651
|
+
/** A Composio server's key variable as a read shows it (api_key_env on its save): the name, never the value. */
|
|
652
|
+
const MCP_KEY_ENV_SHOWN = { enum: [COMPOSIO_KEY_ENV], description: "For a Composio server saved with `api_key_env`: the variable of this server's environment its key is read from at each use. The name alone; the server keeps no copy of the value." };
|
|
653
|
+
const MCP_SECRET_SHOWN = { $ref: "#/components/schemas/SecretMeta", description: "Its credential as every secret is read (SecretMeta), never a value: named mcp:<server>; source `console` for a pasted bearer token or headers, `sign-in` for an OAuth sign-in, `env` for a Composio key read from the server's environment (`auth.api_key_env`: `set` is whether the variable is set now, changed_at null), null with none; changed_at moves when a new credential is saved or signed in, never on a save that keeps it, a refresh of the tools or a token refresh." };
|
|
590
654
|
const MCP_SERVER_VIEW = {
|
|
591
655
|
type: "object", additionalProperties: false, required: ["name", "url", "source", "toolkit", "auth", "credential", "protocol", "server_info", "tools", "listed_at", "updated_at"],
|
|
592
656
|
properties: {
|
|
593
657
|
name: { type: "string" }, url: { type: "string", format: "uri" },
|
|
594
658
|
source: { ...MCP_SOURCE, description: "Where its tools come from, recorded when it was saved from what made it, which a template's MCP needs are matched on at apply: `composio` from the Composio preset, `github` on the GitHub App's tokens, else `url`." },
|
|
595
659
|
toolkit: { type: ["string", "null"], description: "The toolkit its tools are, as a template names them (`mcp:<toolkit>/<tool>`): the Composio preset's toolkit, `github` on the GitHub App's tokens, else what a PUT's (or a sign-in's) `toolkit` said; null: none, and no template's need maps to it." },
|
|
596
|
-
auth: { type: "object", additionalProperties: false, required: ["type"], properties: { type: { enum: [...MCP_AUTH_TYPES] }, headers: { type: "array", items: { type: "string" }, description: "For `headers`: the names of the headers kept (lowercase), never a value." } } },
|
|
660
|
+
auth: { type: "object", additionalProperties: false, required: ["type"], properties: { type: { enum: [...MCP_AUTH_TYPES] }, headers: { type: "array", items: { type: "string" }, description: "For `headers`: the names of the headers kept (lowercase), never a value." }, api_key_env: MCP_KEY_ENV_SHOWN } },
|
|
597
661
|
credential: { enum: ["sealed", "unreadable", "expired", null], description: "`sealed`: kept sealed and opens here; `unreadable`: sealed under another seal key, or damaged: a PUT with the credential seals it again; `expired`: an OAuth sign-in whose refresh the authorization server refused (revoked or expired): sign in again. Null for `auth.type` none. Never a value." },
|
|
598
662
|
oauth: {
|
|
599
663
|
type: "object", additionalProperties: false, required: ["scopes", "client"],
|
|
@@ -610,7 +674,7 @@ const MCP_SERVER_VIEW = {
|
|
|
610
674
|
not_metered: { type: "array", items: { type: "string" }, description: "The tools it lists that no price meters, in its order: a call of one runs outside the run's cost and its cap (\"not metered\" on the run's timeline). Absent when every tool has a price ($0 included)." },
|
|
611
675
|
listed_at: { type: "string", format: "date-time", description: "When its tools were last listed (a PUT or a refresh)." },
|
|
612
676
|
updated_at: { type: "string", format: "date-time", description: "When it was last saved." },
|
|
613
|
-
secret:
|
|
677
|
+
secret: MCP_SECRET_SHOWN,
|
|
614
678
|
},
|
|
615
679
|
};
|
|
616
680
|
const MCP_AUTH = {
|
|
@@ -625,6 +689,8 @@ const MCP_AUTH = {
|
|
|
625
689
|
const MCP_URL = { type: "string", format: "uri", maxLength: 2048, description: "The server's Streamable HTTP endpoint: https, or http on a loopback address of this machine; no user or password." };
|
|
626
690
|
const MCP_NAME = { name: "name", in: "path", required: true, description: "The server's name: lowercase letters, digits and dashes, starting with a letter, at most 32 (no underscores, so `mcp__<server>__<tool>` splits one way). `hands` is reserved for AgentRun's own tools: a PUT under it is 422 input_invalid, field `name`, reason `reserved`.", schema: { type: "string", pattern: MCP_SERVER_NAME.source } };
|
|
627
691
|
const COMPOSIO_KEY = { type: "string", minLength: 1, maxLength: 8192, "x-agentrun-secret": true, description: "The Composio API key, sent only to Composio." };
|
|
692
|
+
/** A Composio save's `api_key_env`: the key named by a variable of the server's environment. A name, not a secret. */
|
|
693
|
+
const COMPOSIO_KEY_ENV_BODY = { enum: [COMPOSIO_KEY_ENV], description: `In place of \`api_key\`: the variable of this server's environment the Composio key is read from, ${COMPOSIO_KEY_ENV} and no other (Composio's address is fixed, so no other secret of the environment is ever sent there). The server keeps the name, never the value: it reads it at each use (this save's calls to Composio, each run's connection, a delete's), as the server and each runner were started with it, so a new value takes effect when they start again. It is a secret the launcher hands each over a pipe, never in a process's environment, and no run is handed it: a run granted a tool of the server is sent it only as the server's MCP header. The value is only ever sent to Composio's origin (\`${COMPOSIO_ORIGIN}\`): a server whose address is anywhere else is refused by name wherever the key would be read (a save, a refresh, a run's start), and nothing is sent. Another name is 422 \`invalid\` under \`api_key_env\`; unset or blank now, 422 \`missing\`; with \`api_key\` too, 422 \`not_allowed\`. A run of a server whose variable is unset is refused before it starts (409 agent_not_runnable), naming it. On an API-only server (AGENTRUN_API_ONLY=1) its token saves one so; on any other server the token's is 403, as \`api_key\` is.` };
|
|
628
694
|
const COMPOSIO_TOOLKIT = { type: "string", pattern: "^[a-z0-9][a-z0-9_-]{0,63}$", description: "The toolkit's slug as Composio names it (`github`, `slack`, `gmail`...)." };
|
|
629
695
|
/** The mark of what a composio trigger adds (composio-triggers.ts). */
|
|
630
696
|
const COMPOSIO_TRIGGERS_MARK = { "x-agentrun-serve": "composiotriggers/1" };
|
|
@@ -712,16 +778,16 @@ const AGENT_TOOL_SETTINGS = {
|
|
|
712
778
|
...Object.fromEntries(SCOPED_TOOLS.map((name) => [name, { ...TOOL_SETTINGS.properties[name], properties: { ...TOOL_SETTINGS.properties[name].properties, scope: EMAIL_SCOPE } }])),
|
|
713
779
|
},
|
|
714
780
|
};
|
|
715
|
-
/** What a capability resolves to on each harness: `native`, `kernel`, `exa-keyless`, `parallel`, `browserbase`, or `unavailable: <reason>`. */
|
|
716
|
-
const RESOLUTION = { type: "string", pattern: "^(native|kernel|exa-keyless|parallel|browserbase|unavailable: .+)$" };
|
|
781
|
+
/** What a capability resolves to on each harness: `native`, `kernel`, `firecrawl-keyless`, `exa-keyless`, `parallel`, `browserbase`, or `unavailable: <reason>`. */
|
|
782
|
+
const RESOLUTION = { type: "string", pattern: "^(native|kernel|firecrawl-keyless|exa-keyless|parallel|browserbase|unavailable: .+)$" };
|
|
717
783
|
const RESOLVES = {
|
|
718
784
|
type: "object", additionalProperties: false, required: [...HARNESSES], properties: Object.fromEntries(HARNESSES.map((harness) => [harness, RESOLUTION])),
|
|
719
|
-
description: "What the tool resolves to on each harness: native (the harness's own tool, or on pi one request to the model provider's hosted search), kernel (the guarded direct fetch; on browser, Kernel's hosted browser), exa-keyless (Exa's keyless MCP search), parallel, browserbase (Browserbase's hosted browser), or unavailable: <reason>.",
|
|
785
|
+
description: "What the tool resolves to on each harness: native (the harness's own tool, or on pi one request to the model provider's hosted search), kernel (the guarded direct fetch; on browser, Kernel's hosted browser), firecrawl-keyless (Firecrawl's keyless MCP endpoint: for web_search with keyless Exa behind it, for web_fetch with the guarded direct fetch behind it, sent each URL read), exa-keyless (Exa's keyless MCP search), parallel, browserbase (Browserbase's hosted browser), or unavailable: <reason>.",
|
|
720
786
|
};
|
|
721
787
|
/** Why a capability resolves as it does on each harness: one plain sentence each, from the same resolution. */
|
|
722
788
|
const WHY = {
|
|
723
789
|
type: "object", additionalProperties: false, required: [...HARNESSES], properties: Object.fromEntries(HARNESSES.map((harness) => [harness, { type: "string" }])),
|
|
724
|
-
description: "Why the tool resolves as it does on each harness, one plain sentence each, made by the same resolution as resolves: the harness's or model provider's own search (`Codex's own search`), what leaves none and what serves instead (`behind a gateway Codex has no own search; your Parallel key (saved)`, where saved is a key saved on API Keys and server the server's own), a pick (`keyless Exa, picked in settings: Exa's free search, no key`), or `turned off in settings`. A client shows it as is.",
|
|
790
|
+
description: "Why the tool resolves as it does on each harness, one plain sentence each, made by the same resolution as resolves: the harness's or model provider's own search (`Codex's own search`), what leaves none and what serves instead (`behind a gateway Codex has no own search; your Parallel key (saved)`, where saved is a key saved on API Keys and server the server's own), a pick (`keyless Exa, picked in settings: Exa's free search, no key`), what leaves the server (keyless Firecrawl's web_fetch says each URL goes to Firecrawl's keyless service, and how to fetch directly), or `turned off in settings`. A client shows it as is.",
|
|
725
791
|
};
|
|
726
792
|
/** GET and PUT /settings/tools's answer: each capability's provider, its default where none is set, and each permission
|
|
727
793
|
* set, by settings key. */
|
|
@@ -1157,6 +1223,13 @@ const RUN_COMPUTER = {
|
|
|
1157
1223
|
description: "The run's computer, its agent's `computer` setting: absent for a run with none.",
|
|
1158
1224
|
"x-agentrun-serve": "computer/1",
|
|
1159
1225
|
};
|
|
1226
|
+
const RUNNING_COMPUTERS = closed({
|
|
1227
|
+
runs: {
|
|
1228
|
+
type: "array",
|
|
1229
|
+
items: ref("schemas/Run"),
|
|
1230
|
+
description: "The runs still going whose agent has a computer, newest first, each as GET /runs/{run_id} answers it, so each carries its `computer`. A run with no computer, and one that has ended, is not here.",
|
|
1231
|
+
},
|
|
1232
|
+
});
|
|
1160
1233
|
/** archil/1: GET, PUT and DELETE /workspace/archil's answer (archil-routes.ts view). */
|
|
1161
1234
|
const ARCHIL_VIEW = closedWith({
|
|
1162
1235
|
on: { type: "boolean", description: "Whether Mode 2 is on: run folders on Archil disks, each agent's own (made on its first run that needs one) unless a run's launch names another. Off, they are on this server's own disk (Mode 1)." },
|
|
@@ -1247,12 +1320,12 @@ const TRIGGER_FIRING = closedWith({
|
|
|
1247
1320
|
key: { type: "string", pattern: "^fir_[0-9a-f]{32}$", description: "The firing's key: from the trigger and its nominal time, or from the trigger and the Idempotency-Key of a run now. Its run is started under it, once." },
|
|
1248
1321
|
by: firedByOf(TRIGGER_ADAPTERS),
|
|
1249
1322
|
nominal_at: { ...DATE_TIME, description: "The time it fires for, to the second; a run now's is when it was asked." },
|
|
1250
|
-
status: { enum: [...FIRING_STATUSES], description: `\`due\`: recorded, its run not started yet (a full server keeps it due, with \`retry_at\`). \`started\`: its run is \`run_id\`. \`sent\`: a message_run firing's message reached \`run_id\`; or, on a server with the launch hook (AGENTRUN_LAUNCH_HOOK_URL), the host took the firing and started no run for it here (a run it starts with \`trigger_firing\`, up to \`start_by\`, makes the firing \`started\`). \`skipped\`: the trigger's last run was still active (working, or waiting on a person), or an earlier firing was still due, or the launch hook did not take
|
|
1323
|
+
status: { enum: [...FIRING_STATUSES], description: `\`due\`: recorded, its run not started yet (a full server, or a launch hook that did not answer, answered 5xx or 429, keeps it due, with \`retry_at\`). \`started\`: its run is \`run_id\`. \`sent\`: a message_run firing's message reached \`run_id\`; or, on a server with the launch hook (AGENTRUN_LAUNCH_HOOK_URL), the host took the firing and started no run for it here (a run it starts with \`trigger_firing\`, up to \`start_by\`, makes the firing \`started\`). \`skipped\`: the trigger's last run was still active (working, or waiting on a person), or an earlier firing was still due; \`reason\` says which. \`failed\`: the run was refused, or the launch hook did not take the firing (\`hook_failed\`, its answer or its retries run out), with \`error\`; a trigger.failed webhook message says so. \`missed\`: times not fired while the server was down or its timer late (older than the catch-up window, or before the one that caught up), \`count\` of them from \`nominal_at\` on.` },
|
|
1251
1324
|
at: { ...DATE_TIME, description: "When it was recorded." },
|
|
1252
1325
|
run_id: { type: ["string", "null"] },
|
|
1253
1326
|
reason: { type: ["string", "null"] },
|
|
1254
1327
|
error: { oneOf: [closed({ code: { type: "string" }, message: { type: "string" } }), { type: "null" }] },
|
|
1255
|
-
}, { count: { type: "integer", minimum: 1, description: "On a `missed` firing: how many times it stands for, from `nominal_at` on; a cron line's are counted to 10000, and `reason` says \"or more\" past that." }, attempts: { type: "integer", minimum: 0 }, retry_at: { ...DATE_TIME, description: "On a `due` firing alone: when it is tried again." }, start_by: { ...DATE_TIME, description: "On a `sent` firing its launch hook's host took with no run: until when the host may still start that run with `trigger_firing`, 10 minutes after its 2xx (whenever the firing reached it: a catch-up, a firing that waited on `max_active_runs`, or one handed again after a restart). Not a retry: the server never hands the firing over again." }, catch_up: { const: true, description: "A time that fired late, within the trigger's catch-up window: the server was down, or its timer late." } });
|
|
1328
|
+
}, { count: { type: "integer", minimum: 1, description: "On a `missed` firing: how many times it stands for, from `nominal_at` on; a cron line's are counted to 10000, and `reason` says \"or more\" past that." }, attempts: { type: "integer", minimum: 0 }, retry_at: { ...DATE_TIME, description: "On a `due` firing alone: when it is tried again." }, start_by: { ...DATE_TIME, description: "On a `sent` firing its launch hook's host took with no run: until when the host may still start that run with `trigger_firing`, 10 minutes after its 2xx (whenever the firing reached it: a catch-up, a firing that waited on `max_active_runs`, or one handed again after a restart). Not a retry: the server never hands the firing over again. Until then the firing holds its trigger's room as a run in progress: `max_active_runs` counts it, and the overlap check skips a later firing for it. A start that begins by then holds the room until its run is written: a `start_by` less than a minute away moves to a minute after that start began, and back if the start writes no run." }, catch_up: { const: true, description: "A time that fired late, within the trigger's catch-up window: the server was down, or its timer late." } });
|
|
1256
1329
|
const TRIGGER_FIELDS = closed({
|
|
1257
1330
|
id: { type: "string" },
|
|
1258
1331
|
name: { type: "string", maxLength: 200 },
|
|
@@ -1358,7 +1431,7 @@ const TEMPLATE = closed({
|
|
|
1358
1431
|
license: NULLABLE_STRING,
|
|
1359
1432
|
author: { type: ["object", "null"], additionalProperties: false, required: ["name"], properties: { name: { type: "string" }, email: { type: "string" }, url: { type: "string" } }, description: "Who made the package; null when it names no one." },
|
|
1360
1433
|
repository: NULLABLE_STRING,
|
|
1361
|
-
output: { type: ["object", "null"], additionalProperties: false, required: ["schema", "json_schema"], properties: { schema: { type: "string", description: "The schema's file in the package; it ships beside each SKILL.md." }, json_schema: { type: ["object", "null"], description: "The JSON Schema the agent's answer meets (its last fenced json block)." } }, description: "The shape of the agent's answer; null when the package names none." },
|
|
1434
|
+
output: { type: ["object", "null"], additionalProperties: false, required: ["schema", "json_schema"], properties: { schema: { type: "string", description: "The schema's file in the package; it ships beside each SKILL.md." }, json_schema: { type: ["object", "null"], description: "The JSON Schema the agent's answer meets (its last fenced json block, or the whole answer when it is one JSON object)." } }, description: "The shape of the agent's answer; null when the package names none." },
|
|
1362
1435
|
harness: { type: ["array", "null"], items: { type: "string" }, description: "The harnesses it runs on, in the order it prefers them: apply takes the first this server runs. Null: any, the server's default." },
|
|
1363
1436
|
model: {
|
|
1364
1437
|
type: ["object", "null"], additionalProperties: false, required: ["tier"],
|
|
@@ -1474,6 +1547,7 @@ const TEMPLATE_PLAN = closed({
|
|
|
1474
1547
|
action: { enum: ["create", "revise"], description: "`create`: the apply makes a new agent; `revise`: it writes a new revision of the agent `agent_id` names." },
|
|
1475
1548
|
agent_id: { ...NULLABLE_STRING, description: "The agent a revise writes onto; null for a create." },
|
|
1476
1549
|
current_revision_id: { ...NULLABLE_STRING, description: "That agent's current revision as the plan read it; null for a create." },
|
|
1550
|
+
twins: { type: "array", items: { type: "string" }, description: "For a create: the live agents here this template already made with these parameters, by id. The apply still makes another, and its `agent_id` warning (`duplicate`) names each; an apply with `agent_id` updates one instead. Empty for a revise." },
|
|
1477
1551
|
missing_secrets: { type: "array", items: { type: "string" }, description: "The keys the package (and the model choice asked for) names that this server does not hold, and MONID_API_KEY where a monid tool it grants is pinned when the agent is saved and no monid key is here: the apply refuses until each is added." },
|
|
1478
1552
|
unmatched_mcp: { type: "array", items: closed({ source: { type: "string" }, toolkit: { type: "string" }, required: { type: "boolean", description: "True: the apply refuses (409) until a server of it is saved; false: the agent is made without its tools." } }), description: "The package's MCP needs no saved server here matches." },
|
|
1479
1553
|
triggers: {
|
|
@@ -1482,8 +1556,11 @@ const TEMPLATE_PLAN = closed({
|
|
|
1482
1556
|
items: closedWith({
|
|
1483
1557
|
name: { type: "string" },
|
|
1484
1558
|
kind: { type: "string", description: "Its source's kind." },
|
|
1485
|
-
action: { enum: ["create", "update", "remove", "skip"], description: "`create`: made (or made again: `reason` says why); `update`: changed in place; `remove`: removed; `skip`: not made (`
|
|
1486
|
-
}, {
|
|
1559
|
+
action: { enum: ["create", "update", "remove", "skip"], description: "`create`: made (or made again: `reason` says why); `update`: changed in place; `remove`: removed; `skip`: not made (`code` and `reason` say why)." },
|
|
1560
|
+
}, {
|
|
1561
|
+
code: { enum: ["not_set_up_here", "not_an_option"], description: "A skip's: `not_set_up_here` for a trigger this server makes once it is set up (a connection it lacks, a feed left empty, an API-only server's launch hook), so a later apply makes it; `not_an_option` for one it never makes (a trigger kind an API-only server serves no route for). The apply's warning for that trigger has the same `reason`." },
|
|
1562
|
+
reason: { type: "string" },
|
|
1563
|
+
}),
|
|
1487
1564
|
},
|
|
1488
1565
|
computer: { anyOf: [closed({ kind: { type: "string" }, provider: NULLABLE_STRING }), { type: "null" }], description: "The computer the apply picks from the package's list; null when the package names none." },
|
|
1489
1566
|
}),
|
|
@@ -1906,8 +1983,8 @@ const LEARNING_EXTENSIONS = {
|
|
|
1906
1983
|
"/agents/{agent_id}/learning/files/{file}": {
|
|
1907
1984
|
get: {
|
|
1908
1985
|
operationId: "readLearningFile", tags: ["agents"], summary: "One file of a learned workflow on main (its workflow.json or README.md), as text, with its ETag",
|
|
1909
|
-
description: "corrections.md and a README.md are `text/markdown`; a draft's workflow.json is `application/json`. A run's purge (`DELETE /runs/{run_id}`)
|
|
1910
|
-
parameters: [AGENT_ID, FILE_PARAM], responses: { "200": FILE_TEXT("The file's text, cut of the host's secrets.", true), ...errors(400, 401, 403, 404, 429, 500) }, ...MARK,
|
|
1986
|
+
description: "corrections.md and a README.md are `text/markdown`; a draft's workflow.json is `application/json`. A run's purge (`DELETE /runs/{run_id}`) puts each workflow whose workflow.json it changed last back to the version before it, the newest no purged run wrote (off main when it wrote it new, so both its files are `404`), and no read at an older commit serves the purged run's text either: a champion read by its digest reads no commit, a later merge's diff shows its files as added, and no run lays it. A file of a workflow still on main whose workflow.json a purged run wrote (its run purged before its purge took the text, until its `DELETE` is sent again) is `410 purged`, as an approval or a restore of it is.",
|
|
1987
|
+
parameters: [AGENT_ID, FILE_PARAM], responses: { "200": FILE_TEXT("The file's text, cut of the host's secrets.", true), ...errors(400, 401, 403, 404, 410, 429, 500) }, ...MARK,
|
|
1911
1988
|
},
|
|
1912
1989
|
},
|
|
1913
1990
|
"/agents/{agent_id}/learning/files/{file}/retire": {
|
|
@@ -1925,7 +2002,7 @@ const LEARNING_EXTENSIONS = {
|
|
|
1925
2002
|
// page write sends: a client generated from this document sends what the route takes.
|
|
1926
2003
|
security: [{ ownerSession: [] }],
|
|
1927
2004
|
requestBody: { required: true, content: { "application/json": { schema: { type: "object", additionalProperties: false, maxProperties: 0 } } } },
|
|
1928
|
-
parameters: [AGENT_ID, FILE_PARAM, IF_MATCH], responses: { "200": FILE_TEXT("The README.md, approved."), ...WRITE_ERRORS }, ...MARK,
|
|
2005
|
+
parameters: [AGENT_ID, FILE_PARAM, IF_MATCH], responses: { "200": FILE_TEXT("The README.md, approved."), ...WRITE_ERRORS, ...errors(410) }, ...MARK,
|
|
1929
2006
|
},
|
|
1930
2007
|
},
|
|
1931
2008
|
"/agents/{agent_id}/learning/files/{file}/restore": {
|
|
@@ -1934,7 +2011,7 @@ const LEARNING_EXTENSIONS = {
|
|
|
1934
2011
|
description: "A retired workflow draft (its README.md) goes back to the status its retire recorded (`retired.from`): active, given to every later run again, or waiting for its owner's OK again (a retire that recorded none restores it waiting): a restore is never an approval. In one commit on main (`learning: restored by a person: <file>`, Changed-By: user). Its files are checked again as a run's draft is (a secret's shape, the host's own values, a hidden character, its format, its workflow against the agent's tools and gate), so a value a retire took out of every run never comes back: such a draft stays retired, and the answer names the rule, never the value. Only a retired one is restored (else 400). The owner's password session alone, as an approval.",
|
|
1935
2012
|
security: [{ ownerSession: [] }],
|
|
1936
2013
|
requestBody: { required: true, content: { "application/json": { schema: { type: "object", additionalProperties: false, maxProperties: 0 } } } },
|
|
1937
|
-
parameters: [AGENT_ID, FILE_PARAM, IF_MATCH], responses: { "200": FILE_TEXT("The README.md, restored."), ...WRITE_ERRORS }, ...MARK,
|
|
2014
|
+
parameters: [AGENT_ID, FILE_PARAM, IF_MATCH], responses: { "200": FILE_TEXT("The README.md, restored."), ...WRITE_ERRORS, ...errors(410) }, ...MARK,
|
|
1938
2015
|
},
|
|
1939
2016
|
},
|
|
1940
2017
|
"/agents/{agent_id}/learning/workflows/{name}/revisions": {
|
|
@@ -2162,7 +2239,7 @@ const EXTENSIONS = {
|
|
|
2162
2239
|
"/agents/{agent_id}/package": {
|
|
2163
2240
|
get: {
|
|
2164
2241
|
operationId: "getAgentPackage", tags: ["local"], summary: "The agent's current revision as a template package",
|
|
2165
|
-
description: "The reverse of `POST /templates/{template}/apply`: the files of a package (`agent.md`, `skills/`, `rules/`, an output schema) that applies on any AgentRun as this agent. `agent.md` always names the model and approvals, and carries the harness, typed inputs, budget, learning, the computer it needs (a shell, or none) and the programs its sandbox must have, the secrets it names (the key names its package declared, as its apply kept them) and its MCP needs; its body is the instructions. Each MCP tool it is granted is written as a need of its saved server's source and toolkit, and its triggers as bodies with no agent and no secret. What names this server is left out: its box, its computer's provider, its pins of this server's tool listings, its place. Every file is read back as an import reads a package before it is answered. `report.blocked` names what would keep the package from working elsewhere (an MCP server saved nowhere here, one on this machine's loopback, one that sends its own auth header, a pin on a tool a package can't pin, a bash policy over shell tools granted without bash, an input schema a package can't say, and each field the export would copy as it is that holds a credential in the clear: a trigger's source, such as a feed URL's `?token=`, its input, or an MCP tool's pin, read as a composio trigger's config is sealed): the files leave each out, and `agentrun export` writes none of them. `report.remade` names what the target sets up again (a webhook, GitHub, Composio or email trigger, a trigger that messages one of its runs, a browser sign-in, a paired computer, a computer this server gives, what the agent learned here
|
|
2242
|
+
description: "The reverse of `POST /templates/{template}/apply`: the files of a package (`agent.md`, `skills/`, `rules/`, an output schema) that applies on any AgentRun as this agent. `agent.md` always names the model and approvals, and carries the harness, typed inputs, budget, learning, the computer it needs (a shell, or none) and the programs its sandbox must have, the secrets it names (the key names its package declared, as its apply kept them) and its MCP needs; its body is the instructions. Each MCP tool it is granted is written as a need of its saved server's source and toolkit, and its triggers as bodies with no agent and no secret. What names this server is left out: its box, its computer's provider, its pins of this server's tool listings, its place. Every file is read back as an import reads a package before it is answered. `report.blocked` names what would keep the package from working elsewhere (an MCP server saved nowhere here, one on this machine's loopback, one that sends its own auth header, a pin on a tool a package can't pin, a bash policy over shell tools granted without bash, an input schema a package can't say, and each field the export would copy as it is that holds a credential in the clear: a trigger's source, such as a feed URL's `?token=`, its input, or an MCP tool's pin, read as a composio trigger's config is sealed): the files leave each out, and `agentrun export` writes none of them. `report.remade` names what the target sets up again (a webhook, GitHub, Composio or email trigger, a trigger that messages one of its runs, a browser sign-in, a paired computer, a computer this server gives, what the agent learned here). `sha256` is hex over the files sorted by path, each written as path, a NUL byte, its bytes, a NUL byte. `409 not_exportable` for an agent whose source is elsewhere (a native, CLI learning, SDK or another system's agent), a workflow, or one with no revision.",
|
|
2166
2243
|
parameters: [ref("parameters/AgentId")],
|
|
2167
2244
|
responses: {
|
|
2168
2245
|
"200": json(closed({
|
|
@@ -2208,6 +2285,17 @@ const EXTENSIONS = {
|
|
|
2208
2285
|
"x-agentrun-serve": "capacity/1",
|
|
2209
2286
|
},
|
|
2210
2287
|
},
|
|
2288
|
+
"/wrapped": {
|
|
2289
|
+
get: {
|
|
2290
|
+
operationId: "getWrapped", tags: ["runs"], summary: "A year of the work under this machine's session files",
|
|
2291
|
+
description: "Reads the Claude Code, Codex, pi and other session files under the home of the machine this server runs on, and answers numbers and names only (no prompt, title, path or project). Everything is bucketed by each request's time in the server's local zone, so a session that spans New Year splits; a session counts for the year of its first request. Answered only by a server bound to loopback with no public URL: any other, and the API-only profile, is 403. The answer is kept for a minute.",
|
|
2292
|
+
parameters: [
|
|
2293
|
+
{ name: "year", in: "query", required: false, description: "A four-digit year, in the server's local zone. Default the current year.", schema: { type: "integer", minimum: 1000, maximum: 9999 } },
|
|
2294
|
+
],
|
|
2295
|
+
responses: { "200": json(WRAPPED, "The year, read now."), ...errors(400, 401, 403, 429, 500) },
|
|
2296
|
+
"x-agentrun-serve": "wrapped/1",
|
|
2297
|
+
},
|
|
2298
|
+
},
|
|
2211
2299
|
"/runs/{run_id}/graph": {
|
|
2212
2300
|
get: {
|
|
2213
2301
|
operationId: "getRunGraph", tags: ["runs"], summary: "A workflow run's graph, live",
|
|
@@ -2358,9 +2446,9 @@ const EXTENSIONS = {
|
|
|
2358
2446
|
"/runs/{run_id}": {
|
|
2359
2447
|
delete: {
|
|
2360
2448
|
operationId: "deleteRun", tags: ["runs"], summary: "Purge a run's content and keep its cost",
|
|
2361
|
-
description: "Purges a run that is not live: what it was given and what it did go, what it cost stays. Gone: its launch record (its input and prompt), its journal and timeline, its messages and commands, its outputs and files, the answers kept under its idempotency keys, its folders (on this machine, and its own folder on an Archil disk, its agent's or one its launch named; the disk and everything else on it are kept), its settings, the grades its agent keeps of it, and its kept learning's content (its learning's end, merged or dropped, stays, as `/stats` counts it). Its row stays as its tombstone: every route of it answers `410 purged` with `details` {run_id, agent_id, state, started_at, ended_at, cost_usd, cost_upper_bound, tools_usd, purged_at}, and no run list shows it. `/usage`, `/stats` and the spend a cap reads sum it as before: no total moves. The runs made from it are purged with it, each the same way: its audit's shadow run, the replay runs of its input and a learning run its kept learning names. Once it is purged, no replay or shadow run of it is started. Its agent, the agent's other runs and what its agent learned are kept: a promotion record keeps its decision, numbers and run ids (the run's among them), and what it copied from the run (a disagreement's input and answers, the grader's words, and the words a hold's reason quoted from them) is blanked. A run's purge removes its diff
|
|
2449
|
+
description: "Purges a run that is not live: what it was given and what it did go, what it cost stays. Gone: its launch record (its input and prompt), its journal and timeline, its messages and commands, its outputs and files, the answers kept under its idempotency keys, its folders (on this machine, and its own folder on an Archil disk, its agent's or one its launch named; the disk and everything else on it are kept), its settings, the grades its agent keeps of it, and its kept learning's content (its learning's end, merged or dropped, stays, as `/stats` counts it). Its row stays as its tombstone: every route of it answers `410 purged` with `details` {run_id, agent_id, state, started_at, ended_at, cost_usd, cost_upper_bound, tools_usd, purged_at}, and no run list shows it. `/usage`, `/stats` and the spend a cap reads sum it as before: no total moves. The runs made from it are purged with it, each the same way: its audit's shadow run, the replay runs of its input and a learning run its kept learning names. Once it is purged, no replay or shadow run of it is started. Its agent, the agent's other runs and what its agent learned are kept: a promotion record keeps its decision, numbers and run ids (the run's among them), and what it copied from the run (a disagreement's input and answers, the grader's words, and the words a hold's reason quoted from them) is blanked. A run's purge removes its diff files and its feedback lines from the folder's current files and puts each learned workflow whose workflow.json it changed last back to the version before it, the newest no purged run wrote (off main when it wrote it new), and the folder's history no longer serves its merge; the bytes stay in the folder's .git until a learning reset (DELETE /v2/agents/{id}/learning) or the agent's purge, which delete the folder whole. `204` when it is purged; a second `DELETE` is `204` too, and takes off what is left of its text in the learning folder; a run this server never had is `404`. Live (queued, working, waiting on a person or an approval, or held by a runner): `409 run_not_final` (`details.runs`, the run or each run made from it that is live, or a replay or shadow run of it a check or an audit started while the `DELETE` ran, which the next `DELETE` purges first), nothing purged; cancel it first (`POST /runs/{run_id}/cancel`). A run that ended and takes a follow-up (`idle`), or that a person stopped, is not live; one that reads so before its runner has written it ended is waited for (up to 30 seconds), then purged. `503 unavailable` while its folder on an Archil disk is not deleted there yet (Archil failing or off, a computer still holding the folder), or while its agent's learning folder can't be written: the run is not purged (or, purged before, keeps its text in that folder), and the `DELETE` sent again finishes it, as it finishes a purge that stopped part way. Takes the owner's session (the password sign-in, or the console on a server bound to loopback) or the API token: any other console session is `403 forbidden`.",
|
|
2362
2450
|
parameters: [ref("parameters/RunId")],
|
|
2363
|
-
responses: { "204": { description: "Purged, now or before. A run's purge removes its diff
|
|
2451
|
+
responses: { "204": { description: "Purged, now or before. A run's purge removes its diff files and its feedback lines from the folder's current files and puts each learned workflow whose workflow.json it changed last back to the version before it, the newest no purged run wrote (off main when it wrote it new), and the folder's history no longer serves its merge; the bytes stay in the folder's .git until a learning reset (DELETE /v2/agents/{id}/learning) or the agent's purge, which delete the folder whole." }, ...errors(401, 403, 404, 409, 429, 500, 503) },
|
|
2364
2452
|
"x-agentrun-serve": "purge/1",
|
|
2365
2453
|
},
|
|
2366
2454
|
patch: {
|
|
@@ -2403,6 +2491,14 @@ const EXTENSIONS = {
|
|
|
2403
2491
|
...COMPUTER_MARK,
|
|
2404
2492
|
},
|
|
2405
2493
|
},
|
|
2494
|
+
"/computers/running": {
|
|
2495
|
+
get: {
|
|
2496
|
+
operationId: "listRunningComputers", tags: ["local"], summary: "Every run still going that has a computer",
|
|
2497
|
+
description: "Each run that is queued, working, paused or waiting on its person and whose agent has a computer (a sandbox, a desktop, a phone or a browser), as GET /runs/{run_id} answers it: its `computer` says the kind and provider, `starting`, `ready` or `taken_over`, and a held run's hold. The runs list carries no computer, so this is the one read of the computers up across runs and agents. It costs a run read for each such run and nothing for a run with no computer. An agent's own computer kept between runs is on the agent's read (`own_computer`), and a paired computer on GET /computers (`paired`); neither is a run here.",
|
|
2498
|
+
responses: { "200": json(RUNNING_COMPUTERS, "The runs still going that have a computer, newest first."), ...errors(401, 429, 500) },
|
|
2499
|
+
...COMPUTER_MARK,
|
|
2500
|
+
},
|
|
2501
|
+
},
|
|
2406
2502
|
"/computers/{provider}/keys": {
|
|
2407
2503
|
put: {
|
|
2408
2504
|
operationId: "saveComputerKeys", tags: ["local"], summary: "Save a computer provider's keys, sealed",
|
|
@@ -2559,6 +2655,34 @@ const EXTENSIONS = {
|
|
|
2559
2655
|
"x-agentrun-serve": "toolkeys/1",
|
|
2560
2656
|
},
|
|
2561
2657
|
},
|
|
2658
|
+
"/settings/harness-keys": {
|
|
2659
|
+
get: {
|
|
2660
|
+
operationId: "listHarnessKeys", tags: ["local"], summary: "The keys each plan-billed harness recipe runs on, and which are saved: names only, never a value",
|
|
2661
|
+
responses: { "200": json(HARNESS_KEYS_VIEW, "Each plan-billed recipe's harness and its keys."), ...errors(401, 429, 500) },
|
|
2662
|
+
"x-agentrun-serve": "harnesskeys/1",
|
|
2663
|
+
},
|
|
2664
|
+
},
|
|
2665
|
+
"/settings/harness-keys/{harness_id}/{key}": {
|
|
2666
|
+
put: {
|
|
2667
|
+
operationId: "saveHarnessKey", tags: ["local"], summary: "Save one key of a plan-billed harness recipe, sealed, for that harness alone",
|
|
2668
|
+
description: "The value is sealed under the server's seal key and kept in the store as ciphertext alone, named for this harness, so no other harness's run ever gets it, nor any run's tools. The next claim of a run on the harness opens it, with no restart. A value it replaces stays sealed for the cut, so a timeline written while it was live stays cut. 404 for a harness that is not a plan-billed recipe on this server; 422 for a key its recipe does not name, or a value under 8 characters, over 1024 bytes, or holding whitespace or a control character. A secret write: the owner's signed-in session alone (ownerSession), never the token, which is 403 forbidden in words.",
|
|
2669
|
+
parameters: [HARNESS_ID_PARAM, HARNESS_KEY_PARAM],
|
|
2670
|
+
security: [{ ownerSession: [] }],
|
|
2671
|
+
requestBody: { required: true, content: { "application/json": { schema: { type: "object", additionalProperties: false, required: ["value"], properties: { value: { type: "string", minLength: 8, "x-agentrun-secret": true } } } } } },
|
|
2672
|
+
responses: { "204": { description: "Saved." }, ...errors(400, 401, 403, 404, 415, 422, 429, 500, 503) },
|
|
2673
|
+
"x-agentrun-serve": "harnesskeys/1",
|
|
2674
|
+
},
|
|
2675
|
+
delete: {
|
|
2676
|
+
operationId: "deleteHarnessKey", tags: ["local"], summary: "Forget one key of a plan-billed harness recipe",
|
|
2677
|
+
// A removal has no body to mark a field in: the operation is marked whole, a secret write all the same.
|
|
2678
|
+
"x-agentrun-secret": true,
|
|
2679
|
+
description: "Its runs no longer get it; the value stays sealed for the cut. A secret write: the owner's signed-in session alone (ownerSession), never the token, which is 403 forbidden in words.",
|
|
2680
|
+
parameters: [HARNESS_ID_PARAM, HARNESS_KEY_PARAM],
|
|
2681
|
+
security: [{ ownerSession: [] }],
|
|
2682
|
+
responses: { "204": { description: "Forgotten." }, ...errors(401, 403, 404, 422, 429, 500) },
|
|
2683
|
+
"x-agentrun-serve": "harnesskeys/1",
|
|
2684
|
+
},
|
|
2685
|
+
},
|
|
2562
2686
|
"/settings/email": {
|
|
2563
2687
|
get: {
|
|
2564
2688
|
operationId: "getEmailAccount", tags: ["local"], summary: "This server's email account: its address, servers and who signs in, never its password",
|
|
@@ -2785,7 +2909,7 @@ const EXTENSIONS = {
|
|
|
2785
2909
|
"/settings/mcp-server-names": {
|
|
2786
2910
|
get: {
|
|
2787
2911
|
operationId: "listMcpServerNames", tags: ["local"], summary: "The names of the MCP servers saved here, and nothing else of them",
|
|
2788
|
-
description: "Each saved server's name once, sorted: no URL, auth type, header, token, tool or Composio record. Served with the server's token, also on an API-only server (`AGENTRUN_API_ONLY=1`), which serves no other settings route
|
|
2912
|
+
description: "Each saved server's name once, sorted: no URL, auth type, header, token, tool or Composio record. Served with the server's token, also on an API-only server (`AGENTRUN_API_ONLY=1`), which serves no other settings route.",
|
|
2789
2913
|
responses: { "200": json({ type: "object", additionalProperties: false, required: ["names"], properties: { names: { type: "array", items: { type: "string" } } } }, "The saved servers' names."), ...errors(401, 429, 500) },
|
|
2790
2914
|
"x-agentrun-serve": "mcpservernames/1",
|
|
2791
2915
|
},
|
|
@@ -2815,7 +2939,7 @@ const EXTENSIONS = {
|
|
|
2815
2939
|
},
|
|
2816
2940
|
put: {
|
|
2817
2941
|
operationId: "saveMcpServer", tags: ["local"], summary: "Preview a remote MCP server, then save it with the tools listed and its credential sealed",
|
|
2818
|
-
description: `The credential is sealed under the server's seal key, bound to the server's name and its URL's origin, and kept in the data directory as ciphertext alone. 403 forbidden to the API token for a save that sends a credential's value, or
|
|
2942
|
+
description: `The credential is sealed under the server's seal key, bound to the server's name and its URL's origin, and kept in the data directory as ciphertext alone. 403 forbidden to the API token for a save that sends a credential's value, or over a saved server the token did not save or that holds a credential (one the owner saved stays the owner's, sealing a credential or not: its address, its credential and what the Composio preset made for it): the owner's signed-in session alone, and the refusal's \`details.console_url\` opens the console's form for it filled with the rest (no credential). 412 precondition_failed when a save that sends a new credential, or none, finds the server's credential changed while it listed its tools (another save, a sign-in or a removal landed), or the token's save finds the owner saved over its server meanwhile, or a save that keeps it finds the server at another address or holding another kind of credential by then (a Composio save over it moved it): nothing is written over it. A body with no credential keeps the sealed one while the type and the URL's origin stay the same; else it is 422. A body with no \`prices\` keeps the saved ones for the tools still listed at the same URL, so a save from any client never leaves a paid tool unmetered; \`prices: {}\` clears them. 422 too for a bad name, URL or auth, or a price that is not a finite number 0 or more or names a tool the server does not list. ${MCP_CONNECTS} Nothing is saved unless the listing succeeds. A save that moves a server the Composio preset made to another address makes it another service's server, and removes in the owner's Composio account what the preset made for it, as its delete does (the MCP server, then the connected account its connect link started and the auth config it made, unless another saved server uses them), with the key it was saved with, and answers \`composio\` saying so; 409 composio_in_use, naming them in \`details.triggers\`, while Composio triggers use it: delete them first. A save of a server the preset made lists its tools at once, then writes and cleans up one at a time with the preset's saves and the MCP servers' deletes, in its Composio project's turn.`,
|
|
2819
2943
|
parameters: [MCP_NAME],
|
|
2820
2944
|
requestBody: { required: true, content: { "application/json": { schema: { type: "object", additionalProperties: false, required: ["url"], properties: { url: MCP_URL, auth: MCP_AUTH, prices: MCP_PRICES, ...MCP_TOOLKIT_BODY } } } } },
|
|
2821
2945
|
responses: { "200": json({ ...MCP_SERVER_VIEW, properties: { ...MCP_SERVER_VIEW.properties, composio: closed({ removed: { type: "boolean", description: "Nothing the save was to remove at Composio is left there." }, note: { type: "string", description: "What it removed at Composio, what it kept and why, and what is left, with the dashboard's address to remove that by hand." } }, "Present when the save moved a server the Composio preset made off Composio: what became of what the preset made there.") } }, "The server, as saved."), ...errors(400, 401, 403, 409, 412, 415, 422, 429, 500), ...MCP_FAILED },
|
|
@@ -2823,7 +2947,7 @@ const EXTENSIONS = {
|
|
|
2823
2947
|
},
|
|
2824
2948
|
delete: {
|
|
2825
2949
|
operationId: "deleteMcpServer", tags: ["local"], summary: "Forget a saved MCP server and its credential",
|
|
2826
|
-
description: "409 composio_in_use, naming them in `details.triggers`, for a Composio server that Composio triggers still use: delete them first. A server the Composio preset made also has its MCP server deleted in the owner's Composio account, with the saved key, after the row is removed: the row is already gone while that delete waits on Composio. So does what its save made for it there that no other saved server uses: the connected account its connect link started (the link with it), and the auth config it made. What another saved server uses is kept, and goes with the last of them; what the save found there already (an auth config or an account the owner had) is never deleted. A preset's delete answers 200 with `composio`: `removed` true when nothing it was to remove is left, and `note`, what it removed, kept (and why) and left, in words. Composio's 404 means that one is already gone; when Composio refuses or does not answer, or the saved key does not open, `removed` is false and the note names what is left, to remove there. 403 forbidden to the API token when the server holds a credential
|
|
2950
|
+
description: "409 composio_in_use, naming them in `details.triggers`, for a Composio server that Composio triggers still use: delete them first. A server the Composio preset made also has its MCP server deleted in the owner's Composio account, with the saved key, after the row is removed: the row is already gone while that delete waits on Composio. So does what its save made for it there that no other saved server uses: the connected account its connect link started (the link with it), and the auth config it made. What another saved server uses is kept, and goes with the last of them; what the save found there already (an auth config or an account the owner had) is never deleted. A preset's delete answers 200 with `composio`: `removed` true when nothing it was to remove is left, and `note`, what it removed, kept (and why) and left, in words. Composio's 404 means that one is already gone; when Composio refuses or does not answer, or the saved key does not open, `removed` is false and the note names what is left, to remove there. 403 forbidden to the API token when the server holds a credential (removing it drops a secret, the owner's signed-in session's alone) or when the token did not save it: one the owner saved, sealing a credential or not, stays the owner's, and nothing is sent to Composio. A server the token saved with none is the token's to remove, a Composio server saved with `api_key_env` among them (its delete at Composio uses the variable's value the server was started with), on an API-only server (AGENTRUN_API_ONLY=1) too. 412 precondition_failed when the server's credential changed, or the owner saved over it, between that check and the removal (a save or a sign-in landed): nothing is removed, and nothing is sent to Composio.",
|
|
2827
2951
|
parameters: [MCP_NAME],
|
|
2828
2952
|
responses: {
|
|
2829
2953
|
"204": { description: "Forgotten: a server the Composio preset did not make." },
|
|
@@ -2854,10 +2978,10 @@ const EXTENSIONS = {
|
|
|
2854
2978
|
"/settings/mcp-servers/{name}/composio": {
|
|
2855
2979
|
put: {
|
|
2856
2980
|
operationId: "saveComposioServer", tags: ["local"], summary: "Have Composio make a managed MCP server for a toolkit's chosen actions, and save it as an MCP server",
|
|
2857
|
-
description: COMPOSIO_NOTE + " For a toolkit that needs the person's account it uses `auth_config_id`, an auth config the owner already has at Composio (a custom OAuth app's, say), else makes (or reuses) a Composio-managed one; it makes a Composio MCP server allowing only `tools`, asks for its address (the helper actions that connect an account left off; its path ends in `/mcp`), and saves that address as the MCP server `name` through the one MCP save: the key is sealed as an `x-api-key` header, the tools listed. With `price_usd`, every granted action the server lists is priced at it (the server's `prices`), so each call is held under its run's cap and booked as the run's tool cost, as any priced MCP call; without it a save over a server keeps its prices for the actions it still lists, and a new server's are none (\"not metered\"). When the toolkit needs an account and `user_id` has no active one, `connect_url` is Composio's page to connect it; nothing here signs in. `user_id` defaults to `agentrun`. 422 for a bad name, key, toolkit, tools, `price_usd` or `auth_config_id`, a key or request Composio refuses (each says the step); 422 under `auth_config_id` before anything is made at Composio for one Composio doesn't know (`not_found`), one of another toolkit (`wrong_toolkit`), a disabled one (`disabled`), or any on a toolkit that needs no account (`not_allowed`); 422 `not_found` under `tools` for a slug the toolkit doesn't list at its latest version (the listing above, every page), naming each, with the listed slug when it is one in another case, before anything is made at Composio; 424 `upstream_failed` when Composio fails or the saved address does not list its tools. Nothing is saved unless every step succeeds, and a save that fails removes in Composio what it made there (the MCP server, the connected account its connect link started, the auth config it made), never what it found; when Composio refuses that too, its error's message names what is left, with the dashboard's address (and a 422 on a field says it in \`details.composio\` as well). A save over a server the preset made removes, once it is saved, the MCP server that server's earlier save made, and what that save made and this one no longer stands on (the account of another `user_id`, the auth config of another toolkit), with the key it was made with, unless another saved server uses it (then it is that one's), and answers `composio` saying so, as a delete does. A save over a server as another `user_id` or auth config is 409 composio_in_use, naming them in `details.triggers`, while Composio triggers use it: delete them first; a save that leaves what they stand on alone goes through. Preset saves, the saves of the servers they made, and deletes of MCP servers run one at a time. The owner's signed-in session alone: 403 forbidden to the API token.",
|
|
2981
|
+
description: COMPOSIO_NOTE + " For a toolkit that needs the person's account it uses `auth_config_id`, an auth config the owner already has at Composio (a custom OAuth app's, say), else makes (or reuses) a Composio-managed one; it makes a Composio MCP server allowing only `tools`, asks for its address (the helper actions that connect an account left off; its path ends in `/mcp`), and saves that address as the MCP server `name` through the one MCP save: the key is sealed as an `x-api-key` header, the tools listed. With `price_usd`, every granted action the server lists is priced at it (the server's `prices`), so each call is held under its run's cap and booked as the run's tool cost, as any priced MCP call; without it a save over a server keeps its prices for the actions it still lists, and a new server's are none (\"not metered\"). When the toolkit needs an account and `user_id` has no active one, `connect_url` is Composio's page to connect it; nothing here signs in. `user_id` defaults to `agentrun`. 422 for a bad name, key, toolkit, tools, `price_usd` or `auth_config_id`, a key or request Composio refuses (each says the step); 422 under `auth_config_id` before anything is made at Composio for one Composio doesn't know (`not_found`), one of another toolkit (`wrong_toolkit`), a disabled one (`disabled`), or any on a toolkit that needs no account (`not_allowed`); 422 `not_found` under `tools` for a slug the toolkit doesn't list at its latest version (the listing above, every page), naming each, with the listed slug when it is one in another case, before anything is made at Composio; 424 `upstream_failed` when Composio fails or the saved address does not list its tools. Nothing is saved unless every step succeeds, and a save that fails removes in Composio what it made there (the MCP server, the connected account its connect link started, the auth config it made), never what it found; when Composio refuses that too, its error's message names what is left, with the dashboard's address (and a 422 on a field says it in \`details.composio\` as well). A save over a server the preset made removes, once it is saved, the MCP server that server's earlier save made, and what that save made and this one no longer stands on (the account of another `user_id`, the auth config of another toolkit), with the key it was made with, unless another saved server uses it (then it is that one's), and answers `composio` saying so, as a delete does. A save over a server as another `user_id` or auth config is 409 composio_in_use, naming them in `details.triggers`, while Composio triggers use it: delete them first; a save that leaves what they stand on alone goes through. Preset saves, the saves of the servers they made, and deletes of MCP servers run one at a time. Exactly one of `api_key` and `api_key_env`: neither is 422 `missing` under `api_key`, both 422 `not_allowed` under `api_key_env`. The body names no address and no headers: Composio answers the server's address, and the key is the one header sent; any other field (`url`, `headers`...) is 422 `not_allowed` under it, before anything is sent. The owner's signed-in session alone: 403 forbidden to the API token, except on an API-only server (AGENTRUN_API_ONLY=1), which has no owner: there its token saves a server whose key is named by `api_key_env` (never sent as `api_key`, still 403), over a new name or a server the token saved (one the owner saved, sealing a credential or not, is 403, stays as it was, and nothing is sent to Composio), and reads the saved servers' names with GET /settings/mcp-server-names. 412 precondition_failed when the server changed while the save ran (another save, a sign-in or a removal; the owner's save over the token's server among them): nothing is written over it.",
|
|
2858
2982
|
parameters: [MCP_NAME],
|
|
2859
|
-
requestBody: { required: true, content: { "application/json": { schema: closedWith({
|
|
2860
|
-
responses: { "200": json(closedWith({ server: MCP_SERVER_VIEW }, { connect_url: { type: "string", format: "uri", description: "Present when the toolkit needs an account and the user has no active one: Composio's page to connect it." }, not_served: { type: "array", items: { type: "string" }, description: "Present when Composio's server leaves out some of `tools` (it can, for an action it was allowed): the slugs it doesn't list, which a run can't call." }, composio: closed({ removed: { type: "boolean", description: "Nothing the save was to remove at Composio is left there." }, note: { type: "string", description: "What it removed at Composio, what it kept and why, and what is left, with the dashboard's address to remove that by hand." } }, "Present when the save was over a server whose earlier save made something at Composio that this one no longer stands on: what became of it.") }), "The server as saved, and where to connect the account when it must be."), ...errors(400, 401, 403, 409, 415, 422, 429, 500), ...MCP_FAILED },
|
|
2983
|
+
requestBody: { required: true, content: { "application/json": { schema: closedWith({ toolkit: COMPOSIO_TOOLKIT, tools: { type: "array", minItems: 1, maxItems: 500, items: { type: "string", minLength: 1, maxLength: 128 }, description: "The slugs of the actions to grant, from the listing." } }, { user_id: { type: "string", pattern: COMPOSIO_USER_ID.source, description: "The Composio user the actions run as; default `agentrun`. \"per_run\" is reserved for the per-run mode and is not a Composio user id: the server is saved with no user and no connected account in its address, no account is looked up and no connect link made (its tools are listed as `agentrun~tool-listing`, a user no save or run can name, since Composio refuses an address naming none), and each run names the Composio user (and connected account) its calls run as in `mcp_auth.<server>` = `{\"composio_user_id\", \"connected_account_id\"}`; a run that names none has its calls of the server refused, nothing sent. Such a server makes no Composio trigger (a trigger runs as one account). A server saved before this mode for a Composio user literally named \"per_run\" keeps calling as that user until it is saved again." }, auth_config_id: { type: "string", pattern: COMPOSIO_AUTH_CONFIG_ID.source, description: "An auth config the owner already has at Composio for this toolkit (a custom OAuth app's, say): the MCP server and its connect link are made against it, in place of the Composio-managed one. Read first; a save never deletes it. Absent: the toolkit's Composio-managed auth config, found or made." }, price_usd: { type: "number", minimum: 0, description: "What each call of the server's actions costs, in USD, a finite number 0 or more (as any `prices` value): saved as the price of every granted action the server lists, so a call is held under its run's cap and booked as the run's tool cost (its trace span's `usd`, the run's `cost.usd`). Absent: the server's prices as they stand, for the actions it still lists, whatever its new address (none on a new server: \"not metered\"). A later save that names no price, this one with no `price_usd` or PUT /settings/mcp-servers/{name} with no `prices`, keeps them." }, api_key: COMPOSIO_KEY, api_key_env: COMPOSIO_KEY_ENV_BODY }) } } },
|
|
2984
|
+
responses: { "200": json(closedWith({ server: MCP_SERVER_VIEW }, { connect_url: { type: "string", format: "uri", description: "Present when the toolkit needs an account and the user has no active one: Composio's page to connect it." }, not_served: { type: "array", items: { type: "string" }, description: "Present when Composio's server leaves out some of `tools` (it can, for an action it was allowed): the slugs it doesn't list, which a run can't call." }, composio: closed({ removed: { type: "boolean", description: "Nothing the save was to remove at Composio is left there." }, note: { type: "string", description: "What it removed at Composio, what it kept and why, and what is left, with the dashboard's address to remove that by hand." } }, "Present when the save was over a server whose earlier save made something at Composio that this one no longer stands on: what became of it.") }), "The server as saved, and where to connect the account when it must be."), ...errors(400, 401, 403, 409, 412, 415, 422, 429, 500), ...MCP_FAILED },
|
|
2861
2985
|
"x-agentrun-serve": "mcpservers/1",
|
|
2862
2986
|
},
|
|
2863
2987
|
},
|
|
@@ -3053,7 +3177,7 @@ const EXTENSIONS = {
|
|
|
3053
3177
|
"/settings/tools": {
|
|
3054
3178
|
get: {
|
|
3055
3179
|
operationId: "getToolSettings", tags: ["capabilities"], summary: "The server's tool settings",
|
|
3056
|
-
description: "Each capability that has a choice, and its provider, and each tool's permission that is set (an MCP server's wildcard mcp:<server>/* among them): web_search auto (codex's own search or, on pi, the model provider's hosted one, else Parallel where the server holds its key, which bills it, else
|
|
3180
|
+
description: "Each capability that has a choice, and its provider, and each tool's permission that is set (an MCP server's wildcard mcp:<server>/* among them): web_search auto (codex's own search or, on pi, the model provider's hosted one, else Parallel where the server holds its key, which bills it, else Firecrawl's keyless search with Exa's behind it; claude-agent's own search only as native), native (that alone), firecrawl-keyless (Firecrawl's, Exa's behind it), exa-keyless (that alone) or parallel; web_fetch auto (the guarded direct fetch where the server holds a Parallel key, else Firecrawl's keyless fetch, which is sent each URL read, never a private or local one, with the guarded direct fetch behind it), firecrawl-keyless (that, whatever the key), kernel (the guarded direct fetch alone) or parallel; browser auto (Browserbase where the server holds its keys, else Kernel where it holds Kernel's), browserbase, kernel (each that alone) or chrome (a Chrome on the server's host, not set up on any server yet: unavailable). An agent's definition.tool_settings is over these, except a permission set to deny here: a server deny is absolute and refuses the tool on this server whatever the agent sets. capabilities.tools say what each resolves to on each harness, and GET /agents/{agent_id} for that agent. An MCP tool's own key may carry its pin, the arguments its calls must carry.",
|
|
3057
3181
|
responses: { "200": json(TOOL_SETTINGS_ANSWER, "Each capability's provider."), ...errors(401, 429, 500) },
|
|
3058
3182
|
"x-agentrun-serve": "providers/1",
|
|
3059
3183
|
},
|
|
@@ -3104,7 +3228,7 @@ const EXTENSIONS = {
|
|
|
3104
3228
|
"/runs/{run_id}/approvals/{approval_id}": {
|
|
3105
3229
|
post: {
|
|
3106
3230
|
operationId: "answerApproval", tags: ["runs"], summary: "Answer a tool call that waits for the owner's approval",
|
|
3107
|
-
description: "A tool set to ask parks its run at each call: status input_required, state waiting, and its view's and its summary's pending (kind approval) naming the call; a timeline row of kind tool_approval_requested follows the call's own rows (its call's, and its result's once it ran), then a row with what came of the answer. allow runs the call once, and the session goes on with its result; deny answers the call with the refusal, the note as its reason. The first answer wins: the same answer again is 204, another 409 not_continuable with details {reason: already_answered, decision}. A cancel of the run marks the call canceled, and a stop withdraws it. A person's message while it waits declines it, with the message as the reason: the run goes on in one turn with the refusal and their words, its row reads `Declined by your message`, their words show as their own message row between the approval row and the outcome, and a later answer is 409 with details.decision deny. Only the owner's password session answers, on the page's own origin with a JSON body: a bearer token is 403 forbidden, since a run's process, an agent's MCP client or a script may hold one.",
|
|
3231
|
+
description: "A tool set to ask parks its run at each call: status input_required, state waiting, and its view's and its summary's pending (kind approval) naming the call; a timeline row of kind tool_approval_requested follows the call's own rows (its call's, and its result's once it ran), then a row with what came of the answer. allow runs the call once, and the session goes on with its result: a read the runner lost mid-call may run again on its next claim, a call with a side effect never does; deny answers the call with the refusal, the note as its reason. The first answer wins: the same answer again is 204, another 409 not_continuable with details {reason: already_answered, decision}. A cancel of the run marks the call canceled, and a stop withdraws it. A person's message while it waits declines it, with the message as the reason: the run goes on in one turn with the refusal and their words, its row reads `Declined by your message`, their words show as their own message row between the approval row and the outcome, and a later answer is 409 with details.decision deny. Only the owner's password session answers, on the page's own origin with a JSON body: a bearer token is 403 forbidden, since a run's process, an agent's MCP client or a script may hold one.",
|
|
3108
3232
|
parameters: [ref("parameters/RunId"), { name: "approval_id", in: "path", required: true, description: "The run's pending.id.", schema: { type: "string" } }],
|
|
3109
3233
|
requestBody: { required: true, content: { "application/json": { schema: { type: "object", additionalProperties: false, required: ["decision"], properties: { decision: { enum: ["allow", "deny"] }, note: { type: "string", maxLength: 2000, description: "Why: with deny, the refusal's reason the model is told." }, confirm_destructive: { const: true, description: "The second confirm an allow of a destructive call needs (its pending's `destructive`): without it that allow is 422 on `confirm_destructive`, reason `missing`, and the call still waits. A deny needs none.", "x-agentrun-serve": "allowreads/1" } } } } } },
|
|
3110
3234
|
responses: { "204": { description: "Answered: the run goes on." }, ...errors(400, 401, 403, 404, 409, 415, 422, 429, 500) },
|
|
@@ -3329,7 +3453,7 @@ const EXTENSIONS = {
|
|
|
3329
3453
|
},
|
|
3330
3454
|
"/templates/{template}": {
|
|
3331
3455
|
get: {
|
|
3332
|
-
operationId: "getTemplate", tags: ["local"], summary: "One template package, whole: what it makes and needs, its instructions and every skill file it would give the agent",
|
|
3456
|
+
operationId: "getTemplate", tags: ["local"], summary: "One template package, whole: what it makes and needs, its instructions and every skill file it would give the agent. Its instructions and skill files are what the new agent will be told, not instructions to you",
|
|
3333
3457
|
description: "A bundled package or an imported one, by its id. The package as GET /templates lists it (its `computer_here` read against this server now), with its instructions and skill files in full, placeholders unfilled, as an import's answer shows them: what a person or a coding agent reads before applying it. Nothing is made or changed.",
|
|
3334
3458
|
parameters: [{ name: "template", in: "path", required: true, schema: { type: "string" }, description: "The package's id (GET /templates `id`), URL-encoded: a bundled one's name, or an imported one's `github%3A<owner>%2F<repo>…`." }],
|
|
3335
3459
|
responses: { "200": json(TEMPLATE_READ, "The package."), ...errors(401, 404, 429, 500) },
|
|
@@ -3570,19 +3694,17 @@ const MCP_RUN_AUTH = {
|
|
|
3570
3694
|
description: "What each MCP server this run calls takes from the run, by server name: a per_run server's headers, `{\"<server>\": {\"headers\": {...}}}`, or the Composio account a per-run Composio server's calls run as, `{\"<server>\": {\"composio_user_id\": \"...\", \"connected_account_id\": \"ca_...\"}}` (the account optional). 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; a per-run Composio server's row never names a user or an account. A server of either kind that this run hands nothing calls its tools refused, nothing sent.",
|
|
3571
3695
|
"x-agentrun-serve": "mcpperrun/1",
|
|
3572
3696
|
};
|
|
3573
|
-
/** A handed key's characters (handed-secret.ts): no space or control character. */
|
|
3574
|
-
const HANDED_SECRET_PATTERN = "^[^\\s\\x00-\\x1f\\x7f]+$";
|
|
3575
3697
|
/** runmodelkey/1: the run's own model key (run-model-key.ts), such as a LiteLLM virtual key minted for it. */
|
|
3576
3698
|
const RUN_MODEL_KEY = {
|
|
3577
|
-
type: "string", minLength: MIN_SECRET, maxLength: MAX_MODEL_KEY_CHARS, pattern:
|
|
3699
|
+
type: "string", minLength: MIN_SECRET, maxLength: MAX_MODEL_KEY_CHARS, pattern: HANDED_SECRET.source,
|
|
3578
3700
|
// Not x-agentrun-secret, as mcp_auth: a key for this run alone, handed by whoever may start it, never kept for others.
|
|
3579
|
-
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 compile turn). 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 from the store by the write that ends the run's turn
|
|
3701
|
+
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 compile turn). 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 from the store 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 \`invalid\` at \`model_key\` for a key under ${MIN_SECRET} characters (no cut could hold it) or one with a character that is not visible ASCII (a space, a control character, anything past ASCII); 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.`,
|
|
3580
3702
|
"x-agentrun-serve": "runmodelkey/1",
|
|
3581
3703
|
};
|
|
3582
3704
|
/** runkeys/1: the run's own tool keys (run-keys.ts), by name. */
|
|
3583
3705
|
const RUN_TOOL_KEYS = {
|
|
3584
|
-
type: "object", propertyNames: { enum: [...TOOL_FIELDS] }, additionalProperties: { type: "string", minLength: MIN_SECRET, maxLength: MAX_RUN_KEY, pattern:
|
|
3585
|
-
description: `The run's own tool keys, by name: a value for each tool key its revision reads (its tools', its workflow nodes' and decision providers', and those its template declares), which its tools use in place of the server's key of that name. Sealed into the run's launch, opened at each claim for its tools alone, erased from the store by the write that ends the run's turn
|
|
3706
|
+
type: "object", propertyNames: { enum: [...TOOL_FIELDS] }, additionalProperties: { type: "string", minLength: MIN_SECRET, maxLength: MAX_RUN_KEY, pattern: HANDED_SECRET.source },
|
|
3707
|
+
description: `The run's own tool keys, by name: a value for each tool key its revision reads (its tools', its workflow nodes' and decision providers', and those its template declares), which its tools use in place of the server's key of that name. Sealed into the run's launch, opened at each claim for its tools alone, erased from the store 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, and cut from what the run writes. 422 at \`keys.<NAME>\` for a name that is not a tool key, or one no tool of the run's revision reads (a model key goes in \`model_key\`), and 422 \`invalid\` there for a value under ${MIN_SECRET} characters (no cut could hold it) or one with a character that is not visible ASCII (a space, a control character, anything past ASCII). On a server started with AGENTRUN_RUN_KEYS=1, a run of an agent made from a template that declares a tool key the server does not hold is 409 \`agent_not_runnable\` at \`keys.<NAME>\` without it.`,
|
|
3586
3708
|
"x-agentrun-serve": "runkeys/1",
|
|
3587
3709
|
};
|
|
3588
3710
|
const FIELD_EXTENSIONS = {
|
|
@@ -3615,6 +3737,7 @@ const FIELD_EXTENSIONS = {
|
|
|
3615
3737
|
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 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 it kept no draft (every draft failed its checks, or the cap stopped it), on no run (`bill.unattributed_usd`). 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" },
|
|
3616
3738
|
tools_usd: { type: ["number", "null"], minimum: 0, description: "On the run read (GET /v2/runs/{run_id}) alone: the part of `usd` that went to the run's paid tool calls (a monid endpoint's charge, an MCP tool's saved price, Parallel's behind `web_search` and `web_fetch`, the browser's session time, and a workflow decision Parallel answered on its own API on this server's PARALLEL_API_KEY, at Parallel's list price), as the run's ledger booked them, joined and rounded as `usd` is, so `usd` less this is its model requests and its other decisions (Jev's, an OpenRouter model's, Parallel's model reached through OpenRouter). Inside `usd`, never added to it. A paid call in the run's end-of-run turn is learning's, in `learning_usd` and never here. 0 when the run made no paid call. An MCP tool with no price is in neither (`not_metered` on its trace span). Null while a paid call's charge is unknown (one charged an unknown amount, cut, or still running), or counted at its hold; while the run is at work (until it ended, stopped or failed); for a run a follow-up opened again (a round past its first), whose job is what it had cost when its first round answered; and for an imported, native or SDK run, whose `usd` is its import's or its harness's own figure and whose tool calls the server never books: never $0 for unknown.", "x-agentrun-serve": "toolsusd/2" },
|
|
3617
3739
|
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" },
|
|
3740
|
+
degraded: { type: "boolean", const: true, description: "On the run read alone, set only when this read could not ask the purge gate (a store read of a purged run's writer failed): `learning_usd` and `all_in_usd` were then counted over the agent's workflow revisions with no purged one left out, so they may count a revision a purged run wrote as the one serving. Figures only: no text is read. Absent on every read that asked the gate.", "x-agentrun-serve": "purge/1" },
|
|
3618
3741
|
plan: {
|
|
3619
3742
|
type: "object", additionalProperties: false, required: ["requests", "tokens", "on"],
|
|
3620
3743
|
properties: {
|
|
@@ -3656,7 +3779,7 @@ const FIELD_EXTENSIONS = {
|
|
|
3656
3779
|
trigger_id: { type: "string", description: "The trigger's id, as the launch hook sent it." },
|
|
3657
3780
|
firing_id: { type: "string", pattern: "^fir_[0-9a-f]{32}$", description: "The firing's id, as the launch hook sent it (its webhook-id too)." },
|
|
3658
3781
|
},
|
|
3659
|
-
description: "On a server with the launch hook (AGENTRUN_LAUNCH_HOOK_URL): the firing the hook handed this host, which this run is for. The run is that firing's, as a run the trigger started here would be: its `trigger` names the trigger and the firing, its input's origin is the trigger's, its title is the trigger's,
|
|
3782
|
+
description: "On a server with the launch hook (AGENTRUN_LAUNCH_HOOK_URL): the firing the hook handed this host, which this run is for. The run is that firing's, as a run the trigger started here would be: its `trigger` names the trigger and the firing, its input's origin is the trigger's, its title is the trigger's, its effort is the target's when the target sets one (else this body's), its input (this body's) is followed by the trigger's previous result as the trigger's own run's is, and its cap is the target's `max_cost_usd` (with none on the target, the agent's default), which this body's `max_cost_usd` may lower and never raise. It runs on the agent's current revision and holds no computer: `revision`, `hold` or `hold_minutes` with it is 422 `not_allowed`, naming the field. The firing reads `started` with it, so the trigger's overlap check and `max_active_runs` count it. A second start for the same firing answers its run: the firing is the run's key, so the request takes no Idempotency-Key (422 with one). The host may start it before or after it answers the hook: a firing it answered 2xx with no run yet still takes this one start until its `start_by`, 10 minutes after that answer (not after `fired_at`, so a firing that reached the host late gets the same time). A firing still `due` (being handed over, or waiting on its retry after the hook failed) takes it too, while its trigger has room for it by the overlap check and `max_active_runs`. 422 when this server has no launch hook, the trigger is not one of this agent's that starts runs, or the firing can't start now (`not_due`: failed, skipped, past its `start_by`, or its trigger has no room, which the message says).",
|
|
3660
3783
|
"x-agentrun-serve": "launchhook/1",
|
|
3661
3784
|
},
|
|
3662
3785
|
},
|
|
@@ -3835,7 +3958,7 @@ const FIELD_EXTENSIONS = {
|
|
|
3835
3958
|
},
|
|
3836
3959
|
tool_result_text: {
|
|
3837
3960
|
type: ["string", "null"],
|
|
3838
|
-
description: `On a \`tool_result\` row of a timeline read with \`calls=whole\` alone: the
|
|
3961
|
+
description: `On a \`tool_result\` row of a timeline read with \`calls=whole\` alone: the call's output whole to ${CALL_RESULT_CHARS} characters (its head past that), through the run's redaction, its URLs' query values elided as \`tool_result_preview\`'s are; null for an empty output. A \`web_search\`'s or \`web_fetch\`'s is its JSON whole but for its long texts: every result's \`url\`, \`title\` and \`published\` (a page's \`url\` and \`title\`) as it came, each snippet, the provider's \`text\` and a page's \`text\` cut to fit and ending in "…" where cut, a page's \`links\` past the cut counted in \`links_cut\`; longer than ${CALL_RESULT_CHARS} only when its urls alone pass it. Absent otherwise.`,
|
|
3839
3962
|
"x-agentrun-serve": "callswhole/1",
|
|
3840
3963
|
},
|
|
3841
3964
|
learning: {
|
|
@@ -3899,7 +4022,7 @@ const FIELD_EXTENSIONS = {
|
|
|
3899
4022
|
repick_max_chars: { type: "integer", minimum: 1, maximum: REPICK_MAX_CHARS_MAX, default: REPICK_MAX_CHARS_DEFAULT, description: "The most characters of state a re-pick over the pages sends its model: past it, the longest strings (the pages) are cut first, each to one length and marked where it was cut. Its cost is the served run's, under the run's cost cap like every model request of the run. Read with `repick`, at each compile." },
|
|
3900
4023
|
} }], default: false, description: "Whether an agentic revision's runs learn: `true`, its owner's corrections and learned workflows; an object, the same with the loop's numbers set on it (`compile_after`, `agree_min`, `alone_min`, `agree_on`, `audit_every`, `audit_every_later`, `audit_later_after`, `hold_window`, `hold_disagree`, `stop_window`, `repick`, `repick_max_chars`, each optional: one left out is its default; `true` is every default); `false`, nothing. A run that learns starts from what its agent has learned, its corrections.md whole in its instructions under `# Learned` and its learned workflows behind its learned_workflow tool; once its job is due, it is asked one compile turn that writes the job as a learned workflow, checked and committed. Kept when a definition says so, true, false or an object (its numbers in one order); a number out of range or an unknown key is a 422 `wrong_type`; absent, off, and an answer shows none. An edit that leaves it out keeps the agent's. A workflow revision keeps none. On a server whose learning is off (`capabilities.features.learning`), no run learns, whatever this says.", "x-agentrun-serve": "learning/1" },
|
|
3901
4024
|
checkout: { enum: ["pull_request", "repository", "none"], description: "What the server checks out in each run's folder before its first turn, an agentic definition's alone. `repository` (suggestions/1): the repository the run names (its start's `repo`, else the first https://github.com/<owner>/<repo> its first message names), at the head of its default branch, one commit deep, detached, in `repo/` (ref `repo/head`), its files listed one a line in `repo/.git/agentrun-files` for an agent with no shell; fetched as below. `pull_request`: the pull request the run's GitHub event names (a GitHub trigger's firing: its repository, number, head and base), at its head, detached, in `repo/`, with its base and their merge base fetched beside it (refs `pr/head`, `pr/base`, `pr/merge-base`). The fetch is the server's own, one command on the run's folder, with an installation token of the server's GitHub App narrowed to that repository and `contents: read`, which the agent never holds: it is never in the folder, the checkout's git config, its remote's URL, the agent's environment or the log. With no App, or one not installed there, the fetch is anonymous, which a public repository answers. The run's system prompt says what was checked out, or why nothing was (no pull request named, the fetch failed), so it can read the change another way, such as the GitHub MCP. The checkout is removed when the run's claim ends. An edit that leaves it out keeps the agent's; `none` clears it. A template sets it from its manifest's `checkout`.", "x-agentrun-serve": "checkout/1" },
|
|
3902
|
-
max_requests: { type: "integer", minimum: 0, description: "The most requests on free models (a catalog price of all zeros, which a dollar cap cannot stop) each of the agent's runs makes, below the server's own limit (`limits.free_model_requests`, AGENTRUN_FREE_MODEL_REQUESTS): a run stops at the lower of the two. The request after that many is not sent, and the run ends `failed`, its error `spend_cap_reached`: \"Not sent: this run reached its 20-request limit for free models.\" (the number is the limit it stopped at). It counts what the server's limit counts
|
|
4025
|
+
max_requests: { type: "integer", minimum: 0, description: "The most requests on free models (a catalog price of all zeros, which a dollar cap cannot stop) each of the agent's runs makes, below the server's own limit (`limits.free_model_requests`, AGENTRUN_FREE_MODEL_REQUESTS): a run stops at the lower of the two. The request after that many is not sent, and the run ends `failed`, its error `spend_cap_reached`: \"Not sent: this run reached its 20-request limit for free models.\" (the number is the limit it stopped at). It counts what the server's limit counts, and a local model's (`ollama/<tag>`), which the server's limit does not: a run on Ollama stops at it too. A paid request never counts. Above 0 sets it, 0 clears it, and an edit that leaves it out keeps the agent's. A template sets it from its manifest's `budget.max_requests`.", "x-agentrun-serve": "maxrequests/1" },
|
|
3903
4026
|
},
|
|
3904
4027
|
AgentCreate: {
|
|
3905
4028
|
note: { type: "string", maxLength: 2000, description: "What the revision changes, kept with it (GET /agents/{agent_id}/revisions).", "x-agentrun-serve": "definitionbody/1" },
|
|
@@ -4012,7 +4135,7 @@ const FIELD_EXTENSIONS = {
|
|
|
4012
4135
|
harnesses: {
|
|
4013
4136
|
type: "array",
|
|
4014
4137
|
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.",
|
|
4015
|
-
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.
|
|
4138
|
+
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", description: "Whether a run of it starts here now, on some model in `models`. False where it does not run here, and where none of its models runs for want of a model key (a model of this machine's Ollama that takes no tools does not count: it stays in `models`, but gives a run no tools) (`needs` says what would give it one: pi with no key and no ChatGPT sign-in). True where its default model lacks a key while another of its models runs: a definition that names that model runs." }, 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. On pi: the models of this machine's Ollama first (`ollama/<tag>`, its context the model's trained context up to 65536; their requests never count toward `limits.free_model_requests`), then OpenRouter's free models, 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 with no default model here for want of a model key (`default_model` null): what would give it one, any one of them; with `available` false, none of its models runs until then. `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" }, card: { type: "string", description: "What its owner reads before running it, on a harness its vendor bills to the owner's own plan (`promises.billing` `plan`: Cursor): whose key and terms it runs on, that this server caps none of its spend, the turn and tool-call limits that stop a run, and what it may not do (Cursor makes no file edits). Absent on a harness that runs on this server's keys and cap.", "x-agentrun-serve": "harness-card/1" } } },
|
|
4016
4139
|
// harness/2: each entry took on its memory and count (run_memory_mib, max_concurrent_runs). A client that validates
|
|
4017
4140
|
// against harness/1 refuses them, so it is a mark of its own. harness/3: each entry also lists its `models`
|
|
4018
4141
|
// (required), which a harness/2 shape disallows. harness/4: an entry may say what it `needs`. harness/5: each entry
|
|
@@ -4149,12 +4272,23 @@ const FIELD_EXTENSIONS = {
|
|
|
4149
4272
|
description: "Settings → Computers: the computer kinds an agent's `computer` may name here.",
|
|
4150
4273
|
...COMPUTER_MARK,
|
|
4151
4274
|
},
|
|
4275
|
+
claude_login: {
|
|
4276
|
+
type: "boolean",
|
|
4277
|
+
description: "Whether /settings/claude-login answers here. False when AGENTRUN_CLAUDE_CODE_LOGIN=off, when the server listens past loopback (Docker) without AGENTRUN_CLAUDE_CODE_LOGIN=on, or on an API-only server (AGENTRUN_API_ONLY=1): those routes are then 404, so a client asks this first.",
|
|
4278
|
+
"x-agentrun-serve": "claudelogin/1",
|
|
4279
|
+
},
|
|
4152
4280
|
tool_keys: {
|
|
4153
4281
|
type: "object", additionalProperties: false, required: ["routes", "at_rest"],
|
|
4154
4282
|
properties: { routes: { type: "boolean" }, at_rest: { const: "sealed" } },
|
|
4155
4283
|
description: "GET, PUT and DELETE /settings/tool-keys: a tool's key saved by name, kept `sealed` under the server's seal key, which it always has (handed, or made at its first start).",
|
|
4156
4284
|
"x-agentrun-serve": "toolkeys/1",
|
|
4157
4285
|
},
|
|
4286
|
+
harness_keys: {
|
|
4287
|
+
type: "object", additionalProperties: false, required: ["routes", "at_rest", "harnesses"],
|
|
4288
|
+
properties: { routes: { type: "boolean" }, at_rest: { const: "sealed" }, harnesses: { type: "array", items: { type: "string", pattern: HARNESS_ID_PATTERN }, description: "The plan-billed harness recipes this server is started with (--harness-recipe), whose keys GET /settings/harness-keys lists. Empty when it names none." } },
|
|
4289
|
+
description: "GET /settings/harness-keys and PUT/DELETE /settings/harness-keys/{harness_id}/{key}: the keys a plan-billed harness recipe runs on, each kept `sealed` for that harness alone, opened at the claim of a run on it and never handed to another harness or to any run's tools.",
|
|
4290
|
+
"x-agentrun-serve": "harnesskeys/1",
|
|
4291
|
+
},
|
|
4158
4292
|
mcp_client: {
|
|
4159
4293
|
type: "object", additionalProperties: false, required: ["transports", "auth", "at_rest", "harnesses"],
|
|
4160
4294
|
properties: { transports: { type: "array", items: { const: "streamable-http" } }, auth: { type: "array", items: { enum: [...MCP_AUTH_TYPES] } }, at_rest: { const: "sealed" }, harnesses: { type: "array", items: { type: "string" }, description: "The harnesses whose agents call a saved server's tools, each granted as mcp:<server>/<tool> in definition.tools." } },
|
|
@@ -4185,7 +4319,7 @@ const FIELD_EXTENSIONS = {
|
|
|
4185
4319
|
started_at: { type: "boolean", description: "An SDK run's start (POST /agents/{agent_id}/sdk-runs) takes `started_at`, the run's created_at." },
|
|
4186
4320
|
title: { type: "boolean", description: "An SDK run's start takes `title`." },
|
|
4187
4321
|
labels: { type: "boolean", description: "An SDK run's start takes `labels`, as RunCreate.labels." },
|
|
4188
|
-
max_open_s: { type: "integer", description: "The longest an SDK run takes evidence and its completion, in seconds after its start: each events batch keeps it open an hour more, up to this." },
|
|
4322
|
+
max_open_s: { type: "integer", description: "The longest an SDK run takes evidence and its completion, in seconds after its start: each events batch keeps it open an hour more, up to this. Not how long one nobody sends to stays open: a run that gets no events batch closes an hour after its start, and fails as not completed before its deadline." },
|
|
4189
4323
|
},
|
|
4190
4324
|
description: "Backend SDK runs: what their start takes, and how long one may stay open.",
|
|
4191
4325
|
"x-agentrun-serve": "sdk/1",
|
|
@@ -4341,8 +4475,8 @@ export function openapiDocument(capabilityOf, adapters = TRIGGER_ADAPTERS) {
|
|
|
4341
4475
|
}
|
|
4342
4476
|
// The console's password session, the one credential approving a workflow draft takes (approveLearningFile).
|
|
4343
4477
|
doc.components.securitySchemes.ownerSession = {
|
|
4344
|
-
type: "apiKey", in: "cookie", name: "agentrun-<port
|
|
4345
|
-
description: "The owner's console session: the cookie `agentrun-<port
|
|
4478
|
+
type: "apiKey", in: "cookie", name: "agentrun-<port>-session",
|
|
4479
|
+
description: "The owner's console session: the cookie the console sets when the owner signs in with their password (accounts on). On http it is `agentrun-<port>-session`, for the port the browser opened (a container's published port, not the one it listens on); over https, `__Host-agentrun-session`. The document as served names the one for the request that fetched it. Sent from this server's own origin; a token never stands for it.",
|
|
4346
4480
|
"x-agentrun-serve": "learning/2",
|
|
4347
4481
|
};
|
|
4348
4482
|
const schemas = doc.components.schemas;
|
|
@@ -4411,10 +4545,10 @@ export function openapiDocument(capabilityOf, adapters = TRIGGER_ADAPTERS) {
|
|
|
4411
4545
|
}
|
|
4412
4546
|
// A contract field this server takes with a meaning of its own, said on it.
|
|
4413
4547
|
definition.properties.max_cost_usd = { ...definition.properties.max_cost_usd, "x-agentrun-serve-note": "The agent's default cap of each run started without a max_cost_usd of its own (a run's own wins), kept with its revision: above 0 sets it, 0 clears it (no default), and an edit that leaves the field out keeps the agent's, so leaving a field out never removes a spend limit. An agentic definition's or a workflow's alike." };
|
|
4414
|
-
definition.properties.output_schema = { ...definition.properties.output_schema, "x-agentrun-serve-note": "An agentic definition's alone (a workflow's output is its workflow's): the JSON Schema its final answer's last fenced
|
|
4548
|
+
definition.properties.output_schema = { ...definition.properties.output_schema, "x-agentrun-serve-note": "An agentic definition's alone (a workflow's output is its workflow's): the JSON Schema its final answer's json block meets (its last fenced one, or the whole answer when it is one JSON object), at most 64 KiB, refused at save when it does not compile. A completed run's result.output is that block's value when it meets the schema, else null. An edit that leaves the field out keeps the agent's. A template's answer schema (its manifest's `output`) is set here at apply. Over 32 KiB, a scheduled run is handed only the fields the producing run's schema names in `x-carried`; carried arrays lose entries from the front until they fit, and the run is told how many. A save refuses an `x-carried` that is not unique root property names." };
|
|
4415
4549
|
definition.properties.input_schema = { ...definition.properties.input_schema, "x-agentrun-serve-note": "An agentic definition's alone (a workflow's input is its workflow's own schema): a JSON Schema object schema (`type: object`), at most 64 KiB, refused at save when it does not compile. Every run's `input` is checked against it with the full compiler, by POST /agents/{agent_id}/runs, a trigger's start_run target (at save and when it fires) and a template's triggers, and refused 422 `input_invalid` with an issue at each path (`input.company`, `input.topics.1`). `content` is reserved: named, it is `{type: string}`; it is always taken as text (the run's message). It is required when the schema has no field of its own; when the schema's own fields are all optional, a run gives `content` or one of them, and an input with none is refused at `input.content`. The run's first message is `content`, then the other fields as one fenced json block under the line `Input:`. Absent: `{content: string}`. An edit that leaves the field out keeps the agent's. A template's `inputs` are set here at apply." };
|
|
4416
4550
|
const runResult = schemas.RunResult;
|
|
4417
|
-
runResult.properties.output = { ...runResult.properties.output, "x-agentrun-serve-note": "A workflow run's output, as its workflow ended; an agentic run's, its final answer's last fenced
|
|
4551
|
+
runResult.properties.output = { ...runResult.properties.output, "x-agentrun-serve-note": "A workflow run's output, as its workflow ended; an agentic run's, its final answer's json block (its last fenced one, or the whole answer when it is one JSON object) when it meets the agent's output_schema, else null (no schema, no block, not JSON, or a value the schema refuses). The runner gives the model the schema in its instructions on every harness, and asks once more, in the same session under the same cap, when the answer misses it; output_error says why one still missed." };
|
|
4418
4552
|
// instructions XOR workflow (validate.ts): a workflow revision has none. version, skills and tools: this server
|
|
4419
4553
|
// mints or keeps them when a write leaves them out (agents-store.ts definitionOf), so none of the four is required of a
|
|
4420
4554
|
// write; only instructions ever misses from an answer (a workflow revision's), so Definition keeps the rest required.
|
|
@@ -4460,8 +4594,8 @@ export function openapiDocument(capabilityOf, adapters = TRIGGER_ADAPTERS) {
|
|
|
4460
4594
|
const timeline = doc.paths["/runs/{run_id}/timeline"].get;
|
|
4461
4595
|
timeline.parameters = [
|
|
4462
4596
|
...timeline.parameters,
|
|
4463
|
-
{ name: "limit", in: "query", required: false, description:
|
|
4464
|
-
{ name: "calls", in: "query", required: false, description: `\`whole\`: each \`tool_use\` row carries its call's arguments (\`tool_input\`) and each \`tool_result\` row
|
|
4597
|
+
{ name: "limit", in: "query", required: false, description: `At most this many rows in a page (1 to 500, default 500; with \`calls=whole\`, 1 to ${CALLS_PAGE_ROWS}, default ${CALLS_PAGE_ROWS}); has_more says when another waits.`, schema: { type: "integer", minimum: 1, maximum: 500, default: 500 } },
|
|
4598
|
+
{ name: "calls", in: "query", required: false, description: `\`whole\`: each \`tool_use\` row carries its call's arguments (\`tool_input\`) and each \`tool_result\` row its output whole to ${CALL_RESULT_CHARS} characters (\`tool_result_text\`; a web call's every url, only its long texts cut), both through the run's redaction, for a reader that grades the run (a template eval). Its rows are another page sequence: a cursor (\`after\`, \`Last-Event-ID\`) from one read goes with the same \`calls\`.`, schema: { enum: ["whole"] } },
|
|
4465
4599
|
];
|
|
4466
4600
|
timeline["x-agentrun-serve-changed"] = { limit: "timelinelimit/1", calls: "callswhole/1" };
|
|
4467
4601
|
changed.push("GET /runs/{run_id}/timeline");
|
|
@@ -4515,6 +4649,16 @@ export function openapiDocument(capabilityOf, adapters = TRIGGER_ADAPTERS) {
|
|
|
4515
4649
|
for (const code of ["200", "206"])
|
|
4516
4650
|
readFile.responses[code].content = { "video/mp4": { schema: { type: "string", contentMediaType: "video/mp4" } }, ...readFile.responses[code].content };
|
|
4517
4651
|
readFile["x-agentrun-serve-changed"] = { ...readFile["x-agentrun-serve-changed"], responses: "runvideo/1" };
|
|
4652
|
+
// filecut/1: `?cut=run` reads a text file under the run's own cut, as its timeline's calls are cut, never raw. Its
|
|
4653
|
+
// text/plain answer is one of the 200's `*/*`, so a client reads it as it reads any file (bytes, or a stream).
|
|
4654
|
+
const readFileOp = doc.paths["/runs/{run_id}/files/{path}"].get;
|
|
4655
|
+
readFileOp.parameters = [
|
|
4656
|
+
...readFileOp.parameters,
|
|
4657
|
+
query("cut", `\`run\`: the file's text cut of every value the run's own cut holds (the server's keys, the keys a person saved, its secret stores' values, the sign-in refs the run was handed), each one and each secret shape replaced by \`[redacted]\` in place, as the run's timeline cuts its calls; the text is \`[redacted]\` whole when a value still shows in a form not cut in place. The cut holds this server's values, not every secret: a value handed to the run alone at its launch (a key of its own, an MCP server's headers) is not in it, and a secret of no known shape passes as written. Answered \`text/plain; charset=utf-8\` with \`x-agentrun-cut: run\` (a server that doesn't know \`cut\` answers the raw bytes, without it), the whole file (\`Range\` is not read). A file whose type is not text (text/*, JSON, NDJSON, or an extension the server doesn't type), or whose bytes are not UTF-8 or hold a NUL, is \`415 unsupported_media_type\`; one over ${RUN_FILE_CUT_MAX} bytes is \`413 payload_too_large\`; a run whose cut can't be read (the sign-in it was handed doesn't open) is \`403 forbidden\`. Without \`cut\`, the file's bytes as written.`, { type: "string", enum: ["run"] }),
|
|
4658
|
+
];
|
|
4659
|
+
readFileOp.responses["413"] = ref("responses/PayloadTooLarge");
|
|
4660
|
+
readFileOp.responses["415"] = ref("responses/UnsupportedMediaType");
|
|
4661
|
+
readFile["x-agentrun-serve-changed"] = { ...readFile["x-agentrun-serve-changed"], parameters: "filecut/1" };
|
|
4518
4662
|
// An agentic run's cancel is its end at once: the 202 reads `cancelled`, and no later end of its turn moves it.
|
|
4519
4663
|
const cancel = doc.paths["/runs/{run_id}/cancel"].post;
|
|
4520
4664
|
cancel.description = `${String(cancel.description).trimEnd()}\nHere an agentic run reads \`cancelled\` from the 202 on, \`final\` once it has stopped: a run's first terminal status is its last, so nothing its cut turn writes later (an answer, a cost over its cap) moves it. A workflow run reads \`cancelled\` once its workflow has stopped.\n`;
|
|
@@ -4722,7 +4866,7 @@ export function openapiDocument(capabilityOf, adapters = TRIGGER_ADAPTERS) {
|
|
|
4722
4866
|
doc.components.responses = {
|
|
4723
4867
|
...doc.components.responses,
|
|
4724
4868
|
Gone: {
|
|
4725
|
-
description: "`purged`: the run or agent was purged (`DELETE /runs/{run_id}`, `DELETE /agents/{agent_id}`); `details` is its tombstone.",
|
|
4869
|
+
description: "`purged`: the run or agent was purged (`DELETE /runs/{run_id}`, `DELETE /agents/{agent_id}`); `details` is its tombstone. On a learned workflow's file (`readLearningFile`, its approve and restore): the run that wrote its workflow.json was purged, and `details` is that run's tombstone.",
|
|
4726
4870
|
headers: { "X-Request-Id": ref("headers/RequestId") },
|
|
4727
4871
|
content: { "application/json": { schema: ref("schemas/Error") } },
|
|
4728
4872
|
"x-agentrun-serve": "purge/1",
|
|
@@ -4794,12 +4938,10 @@ export function openapiDocument(capabilityOf, adapters = TRIGGER_ADAPTERS) {
|
|
|
4794
4938
|
}
|
|
4795
4939
|
return doc;
|
|
4796
4940
|
}
|
|
4797
|
-
/** The document as served
|
|
4798
|
-
* (page.ts
|
|
4799
|
-
export function servedOpenapi(doc,
|
|
4800
|
-
if (port === undefined)
|
|
4801
|
-
return doc;
|
|
4941
|
+
/** The document as served with the owner's session cookie under `cookie`, the name the console sets for the request
|
|
4942
|
+
* (page.ts ownerCookieName). */
|
|
4943
|
+
export function servedOpenapi(doc, cookie) {
|
|
4802
4944
|
const components = doc.components;
|
|
4803
4945
|
const schemes = components.securitySchemes;
|
|
4804
|
-
return { ...doc, components: { ...components, securitySchemes: { ...schemes, ownerSession: { ...schemes.ownerSession, name:
|
|
4946
|
+
return { ...doc, components: { ...components, securitySchemes: { ...schemes, ownerSession: { ...schemes.ownerSession, name: cookie } } } };
|
|
4805
4947
|
}
|