@parcha/agentrun-serve 0.0.0-stage → 0.1.0-beta.29
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 +560 -0
- package/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +1723 -2
- package/dist/adapters.d.ts +205 -0
- package/dist/adapters.js +459 -0
- package/dist/agents.d.ts +124 -0
- package/dist/agents.js +302 -0
- package/dist/app.d.ts +7 -0
- package/dist/app.js +324 -0
- package/dist/bound-files.d.ts +4 -0
- package/dist/bound-files.js +164 -0
- package/dist/box/record.d.ts +6 -0
- package/dist/box/record.js +41 -0
- package/dist/box/sweep.d.ts +53 -0
- package/dist/box/sweep.js +193 -0
- package/dist/box-image.d.ts +98 -0
- package/dist/box-image.js +283 -0
- package/dist/box-relay.d.ts +42 -0
- package/dist/box-relay.js +222 -0
- package/dist/boxes.d.ts +54 -0
- package/dist/boxes.js +182 -0
- package/dist/cap.d.ts +224 -0
- package/dist/cap.js +721 -0
- package/dist/catalog.d.ts +20 -0
- package/dist/catalog.js +53 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +167 -0
- package/dist/coding-tools.d.ts +31 -0
- package/dist/coding-tools.js +81 -0
- package/dist/console/THIRD-PARTY-NOTICES.txt +1141 -0
- package/dist/console/assets/index-BN7oVcO4.js +445 -0
- package/dist/console/assets/index-By-jkqki.css +1 -0
- package/dist/console/assets/jetbrains-mono-cyrillic-400-normal-BEIGL1Tu.woff2 +0 -0
- package/dist/console/assets/jetbrains-mono-cyrillic-400-normal-CIEtRijs.woff +0 -0
- package/dist/console/assets/jetbrains-mono-cyrillic-600-normal-BB5xRk30.woff +0 -0
- package/dist/console/assets/jetbrains-mono-cyrillic-600-normal-EVf6-Yzo.woff2 +0 -0
- package/dist/console/assets/jetbrains-mono-cyrillic-ext-400-normal-BHyURHCj.woff +0 -0
- package/dist/console/assets/jetbrains-mono-cyrillic-ext-400-normal-C_uLvvQ5.woff2 +0 -0
- package/dist/console/assets/jetbrains-mono-cyrillic-ext-600-normal-Dj6eZy5f.woff2 +0 -0
- package/dist/console/assets/jetbrains-mono-cyrillic-ext-600-normal-DpeVePZf.woff +0 -0
- package/dist/console/assets/jetbrains-mono-greek-400-normal-C190GLew.woff2 +0 -0
- package/dist/console/assets/jetbrains-mono-greek-400-normal-CNojz0t3.woff +0 -0
- package/dist/console/assets/jetbrains-mono-greek-600-normal-3KAm9r92.woff +0 -0
- package/dist/console/assets/jetbrains-mono-greek-600-normal-H7WoG9Et.woff2 +0 -0
- package/dist/console/assets/jetbrains-mono-latin-400-normal-B11XCQ5g.woff +0 -0
- package/dist/console/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
- package/dist/console/assets/jetbrains-mono-latin-600-normal-C8RAYTDA.woff2 +0 -0
- package/dist/console/assets/jetbrains-mono-latin-600-normal-DXv3JcnD.woff +0 -0
- package/dist/console/assets/jetbrains-mono-latin-ext-400-normal-Bc8Ftmh3.woff2 +0 -0
- package/dist/console/assets/jetbrains-mono-latin-ext-400-normal-DHMOLxAi.woff +0 -0
- package/dist/console/assets/jetbrains-mono-latin-ext-600-normal-BfB_LPfz.woff2 +0 -0
- package/dist/console/assets/jetbrains-mono-latin-ext-600-normal-DiQlUoE6.woff +0 -0
- package/dist/console/assets/jetbrains-mono-vietnamese-400-normal-BeU3T8wf.woff +0 -0
- package/dist/console/assets/jetbrains-mono-vietnamese-400-normal-ByoDsISC.woff2 +0 -0
- package/dist/console/assets/jetbrains-mono-vietnamese-600-normal-CSpzN4cI.woff +0 -0
- package/dist/console/assets/jetbrains-mono-vietnamese-600-normal-Dtizs43-.woff2 +0 -0
- package/dist/console/assets/schibsted-grotesk-latin-400-normal-Cph9ettZ.woff2 +0 -0
- package/dist/console/assets/schibsted-grotesk-latin-400-normal-DfGZKnlb.woff +0 -0
- package/dist/console/assets/schibsted-grotesk-latin-600-normal-BGBUNdzT.woff2 +0 -0
- package/dist/console/assets/schibsted-grotesk-latin-600-normal-COje25QW.woff +0 -0
- package/dist/console/assets/schibsted-grotesk-latin-ext-400-normal-4l4lq8zr.woff2 +0 -0
- package/dist/console/assets/schibsted-grotesk-latin-ext-400-normal-BGzXWJeR.woff +0 -0
- package/dist/console/assets/schibsted-grotesk-latin-ext-600-normal-8_E36CQj.woff2 +0 -0
- package/dist/console/assets/schibsted-grotesk-latin-ext-600-normal-C27an7Zc.woff +0 -0
- package/dist/console/index.html +15 -0
- package/dist/daytona-api.d.ts +21 -0
- package/dist/daytona-api.js +101 -0
- package/dist/decision-rows.d.ts +11 -0
- package/dist/decision-rows.js +116 -0
- package/dist/decisions.d.ts +94 -0
- package/dist/decisions.js +184 -0
- package/dist/effort-guidance.d.ts +5 -0
- package/dist/effort-guidance.js +14 -0
- package/dist/environment.d.ts +5 -0
- package/dist/environment.js +11 -0
- package/dist/errors.d.ts +72 -0
- package/dist/errors.js +66 -0
- package/dist/exa-keyless.d.ts +35 -0
- package/dist/exa-keyless.js +202 -0
- package/dist/fetch-page.d.ts +114 -0
- package/dist/fetch-page.js +182 -0
- package/dist/files.d.ts +60 -0
- package/dist/files.js +153 -0
- package/dist/grade.d.ts +96 -0
- package/dist/grade.js +348 -0
- package/dist/graph-view.d.ts +100 -0
- package/dist/graph-view.js +212 -0
- package/dist/harness-app.d.ts +38 -0
- package/dist/harness-app.js +626 -0
- package/dist/harness.d.ts +53 -0
- package/dist/harness.js +74 -0
- package/dist/home-path.d.ts +27 -0
- package/dist/home-path.js +78 -0
- package/dist/host-tools.d.ts +20 -0
- package/dist/host-tools.js +140 -0
- package/dist/host.d.ts +39 -0
- package/dist/host.js +81 -0
- package/dist/hosted-search.d.ts +27 -0
- package/dist/hosted-search.js +129 -0
- package/dist/import-sources.d.ts +104 -0
- package/dist/import-sources.js +629 -0
- package/dist/import-summary.d.ts +25 -0
- package/dist/import-summary.js +75 -0
- package/dist/import-worker.d.ts +26 -0
- package/dist/import-worker.js +41 -0
- package/dist/import.d.ts +145 -0
- package/dist/import.js +1221 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +6 -0
- package/dist/key-check.d.ts +36 -0
- package/dist/key-check.js +108 -0
- package/dist/key-refusal.d.ts +51 -0
- package/dist/key-refusal.js +187 -0
- package/dist/learn/check.d.ts +99 -0
- package/dist/learn/check.js +259 -0
- package/dist/learn/grade.d.ts +79 -0
- package/dist/learn/grade.js +433 -0
- package/dist/learn/index.d.ts +7 -0
- package/dist/learn/index.js +11 -0
- package/dist/learn/invisible.d.ts +5 -0
- package/dist/learn/invisible.js +42 -0
- package/dist/learn/notes.d.ts +59 -0
- package/dist/learn/notes.js +146 -0
- package/dist/learn/reflect.d.ts +49 -0
- package/dist/learn/reflect.js +167 -0
- package/dist/learn/secrets.d.ts +18 -0
- package/dist/learn/secrets.js +111 -0
- package/dist/learn/skills.d.ts +84 -0
- package/dist/learn/skills.js +198 -0
- package/dist/learning-routes.d.ts +196 -0
- package/dist/learning-routes.js +609 -0
- package/dist/learning-run.d.ts +304 -0
- package/dist/learning-run.js +797 -0
- package/dist/learning-words.d.ts +73 -0
- package/dist/learning-words.js +171 -0
- package/dist/learning.d.ts +377 -0
- package/dist/learning.js +801 -0
- package/dist/llm.d.ts +40 -0
- package/dist/llm.js +37 -0
- package/dist/llms.txt +37 -0
- package/dist/mcp-servers.d.ts +115 -0
- package/dist/mcp-servers.js +445 -0
- package/dist/mcp.d.ts +51 -0
- package/dist/mcp.js +392 -0
- package/dist/model.d.ts +184 -0
- package/dist/model.js +484 -0
- package/dist/monid.d.ts +74 -0
- package/dist/monid.js +277 -0
- package/dist/openapi/agentrun-v2.openapi.json +4805 -0
- package/dist/openapi.d.ts +10 -0
- package/dist/openapi.js +1417 -0
- package/dist/owner.d.ts +55 -0
- package/dist/owner.js +222 -0
- package/dist/packs.d.ts +71 -0
- package/dist/packs.js +180 -0
- package/dist/page.d.ts +32 -0
- package/dist/page.js +133 -0
- package/dist/paid-calls.d.ts +46 -0
- package/dist/paid-calls.js +110 -0
- package/dist/pause.d.ts +68 -0
- package/dist/pause.js +97 -0
- package/dist/pdf-pages.d.ts +44 -0
- package/dist/pdf-pages.js +147 -0
- package/dist/place.d.ts +46 -0
- package/dist/place.js +105 -0
- package/dist/print.d.ts +20 -0
- package/dist/print.js +29 -0
- package/dist/propose.d.ts +38 -0
- package/dist/propose.js +82 -0
- package/dist/quiet-sqlite-warning.d.ts +1 -0
- package/dist/quiet-sqlite-warning.js +14 -0
- package/dist/request-start.d.ts +14 -0
- package/dist/request-start.js +226 -0
- package/dist/result.d.ts +3 -0
- package/dist/result.js +5 -0
- package/dist/rows.d.ts +46 -0
- package/dist/rows.js +121 -0
- package/dist/run-box.d.ts +134 -0
- package/dist/run-box.js +440 -0
- package/dist/run-manifest.d.ts +27 -0
- package/dist/run-manifest.js +60 -0
- package/dist/runnable.d.ts +80 -0
- package/dist/runnable.js +162 -0
- package/dist/runs.d.ts +840 -0
- package/dist/runs.js +2279 -0
- package/dist/secret-cut.d.ts +27 -0
- package/dist/secret-cut.js +109 -0
- package/dist/secrets.d.ts +50 -0
- package/dist/secrets.js +140 -0
- package/dist/server-lock.d.ts +44 -0
- package/dist/server-lock.js +140 -0
- package/dist/server.d.ts +626 -0
- package/dist/server.js +1756 -0
- package/dist/sessions.d.ts +4 -0
- package/dist/sessions.js +105 -0
- package/dist/skills.d.ts +31 -0
- package/dist/skills.js +68 -0
- package/dist/stats.d.ts +101 -0
- package/dist/stats.js +82 -0
- package/dist/tool-keys.d.ts +151 -0
- package/dist/tool-keys.js +273 -0
- package/dist/tool-plane.d.ts +143 -0
- package/dist/tool-plane.js +242 -0
- package/dist/tools.d.ts +147 -0
- package/dist/tools.js +253 -0
- package/dist/turn-end.d.ts +23 -0
- package/dist/turn-end.js +14 -0
- package/dist/turns.d.ts +34 -0
- package/dist/turns.js +202 -0
- package/dist/uploads.d.ts +104 -0
- package/dist/uploads.js +474 -0
- package/dist/usage.d.ts +29 -0
- package/dist/usage.js +58 -0
- package/dist/validate.d.ts +55 -0
- package/dist/validate.js +175 -0
- package/dist/web-fetch.d.ts +64 -0
- package/dist/web-fetch.js +262 -0
- package/dist/web-search.d.ts +54 -0
- package/dist/web-search.js +136 -0
- package/dist/webhooks.d.ts +182 -0
- package/dist/webhooks.js +487 -0
- package/dist/workspace-paths.d.ts +33 -0
- package/dist/workspace-paths.js +104 -0
- package/dist/workspace.d.ts +88 -0
- package/dist/workspace.js +369 -0
- package/launcher/agentrun-serve +109 -0
- package/package.json +94 -4
- package/skills/agentrun-serve/SKILL.md +128 -0
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import type { AgentAdapter, SessionSpec } from "@parcha/agentrun-kernel";
|
|
2
|
+
import { chooseModel, type ModelRef, openRouterOnly } from "./model.js";
|
|
3
|
+
import type { SkillCheck, SkillFiles } from "./skills.js";
|
|
4
|
+
/** The one line that installs each harness beside serve. */
|
|
5
|
+
export declare const INSTALL: Record<string, string>;
|
|
6
|
+
/** Whether this server runs from npx's cache (`npx @parcha/agentrun-serve`), where there is no project to install a
|
|
7
|
+
* package into: npm keeps what npx runs under `<npm cache>/_npx/<hash>/node_modules`. Read from where this file is, not
|
|
8
|
+
* from npm's environment (`npm_command=exec`), which every child of an npm command inherits and which npx sets too
|
|
9
|
+
* when it runs a copy a project installed, whose fix stays `npm install`. */
|
|
10
|
+
export declare const startedByNpx: (file?: string) => boolean;
|
|
11
|
+
/** Set by `npx @parcha/agentrun` on the server it starts: that command's package at its version
|
|
12
|
+
* (`@parcha/agentrun@0.3.0`), so a hint names the command the person ran, not the server's own. */
|
|
13
|
+
export declare const NPX_PACKAGE_ENV = "AGENTRUN_NPX_PACKAGE";
|
|
14
|
+
/** The version of `name` installed where Node would look for it from `from`, or undefined. */
|
|
15
|
+
export declare function installedHere(name: string, from?: string): string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* The one command that starts this same AgentRun again with `spec` beside it: the command the person ran
|
|
18
|
+
* (`npx @parcha/agentrun`, which NPX_PACKAGE_ENV names, or the server's own), this server's version, every other
|
|
19
|
+
* harness's package already here (so following one harness's hint never takes another away), and `--data` with this
|
|
20
|
+
* server's store, so the command opens this same store: always after `npx @parcha/agentrun`, whose own store
|
|
21
|
+
* (~/.agentrun) is not the server's default, and after the server's own command when the store is not its default.
|
|
22
|
+
*/
|
|
23
|
+
export declare function npxLine(spec: string, env?: NodeJS.ProcessEnv, installed?: (name: string) => string | undefined): string;
|
|
24
|
+
/** `message` with an adapter's own install line (`npmLine`, which installs `spec` into a project) as the npx line that
|
|
25
|
+
* starts this same AgentRun with `spec` beside it (npxLine), when the server runs from npx. Any other message is left
|
|
26
|
+
* as it is. */
|
|
27
|
+
export declare function installHint(message: string, npmLine: string, spec: string, npx?: boolean, env?: NodeJS.ProcessEnv, installed?: (name: string) => string | undefined): string;
|
|
28
|
+
/** For tests: a JSON `{command, args?, env?}` that speaks Codex's app-server protocol in place of Codex. agentrun-harness-codex
|
|
29
|
+
* takes it only under its own guard (AGENTRUN_CODEX_STANDIN=1, under a test runner). */
|
|
30
|
+
export declare const CODEX_STANDIN_ENV = "AGENTRUN_SERVE_CODEX_STANDIN";
|
|
31
|
+
/** The event of a harness's own lines in the run's log (its model proxy's refusals and failures): a failed run's message
|
|
32
|
+
* is never taken from one (runs.ts lastLogLine). */
|
|
33
|
+
export declare const HARNESS_LOG_EVENT = "harness";
|
|
34
|
+
/**
|
|
35
|
+
* A harness's log, into the run's log: the run process's stderr, which serve opens on the run's process.log. One JSON
|
|
36
|
+
* line per call, as pi-durable-disk writes them (`{at, event, message, ...}`). A request's path loses its query string,
|
|
37
|
+
* and every value of the environment's key-shaped variables is cut out of the line, so a key a client sent in either
|
|
38
|
+
* place, or one serve holds, never reaches the log.
|
|
39
|
+
*/
|
|
40
|
+
export declare function harnessLog(harness: string, env: NodeJS.ProcessEnv, write?: (line: string) => void): (message: string, fields?: Record<string, unknown>) => void;
|
|
41
|
+
/** What fixes a harness that is not on this machine as its adapter needs it: `install`, its package or binary is missing;
|
|
42
|
+
* `pins`, what is installed is not the pinned build. */
|
|
43
|
+
export type InstallFix = "install" | "pins";
|
|
44
|
+
/** Why this server cannot run a harness here, in words a person can act on; `fix`, when installing is the fix; `keys`,
|
|
45
|
+
* when a model key is all it lacks: the keys, any one of which, set, lets it run (a key row names it: tool-keys.ts). */
|
|
46
|
+
export declare class HarnessUnavailable extends Error {
|
|
47
|
+
readonly fix?: InstallFix | undefined;
|
|
48
|
+
readonly keys?: readonly string[] | undefined;
|
|
49
|
+
constructor(message: string, fix?: InstallFix | undefined, keys?: readonly string[] | undefined);
|
|
50
|
+
}
|
|
51
|
+
/** The reason the start's probe gives for `error`: its message, ending with the restart (RESTART) where installing is
|
|
52
|
+
* the fix. A message whose install line is npx's has no `fix`: running that line is the restart. */
|
|
53
|
+
export declare function startReason(error: unknown): string;
|
|
54
|
+
type ModelCost = {
|
|
55
|
+
input: number;
|
|
56
|
+
output: number;
|
|
57
|
+
cacheRead: number;
|
|
58
|
+
cacheWrite: number;
|
|
59
|
+
};
|
|
60
|
+
/** A child's command under the run's confinement (pi-durable-disk's confinePrefix): only added in front. */
|
|
61
|
+
export type ConfineChild = (child: Readonly<{
|
|
62
|
+
command: string;
|
|
63
|
+
args: string[];
|
|
64
|
+
}>) => {
|
|
65
|
+
command: string;
|
|
66
|
+
args: string[];
|
|
67
|
+
};
|
|
68
|
+
/** What a run's adapter needs of serve: its model, the catalog that prices it as it prices pi's runs, the run's
|
|
69
|
+
* confinement for the harness's own process, and the skills it loads itself (claude-agent's, which its own check took:
|
|
70
|
+
* skills.ts). */
|
|
71
|
+
export type AdapterNeeds = {
|
|
72
|
+
model: ModelRef;
|
|
73
|
+
models: {
|
|
74
|
+
getModel(provider: string, id: string): {
|
|
75
|
+
cost?: Partial<ModelCost>;
|
|
76
|
+
} | undefined;
|
|
77
|
+
};
|
|
78
|
+
confine?: ConfineChild;
|
|
79
|
+
skills?: readonly SkillFiles[];
|
|
80
|
+
};
|
|
81
|
+
/** The ConfineChild that starts a child under `prefix` (the argv pi's commands start under, ending in "--"); none when
|
|
82
|
+
* the run confines nothing, since an adapter refuses a confinement that adds nothing. */
|
|
83
|
+
export declare function confineOf(prefix: readonly string[]): ConfineChild | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* The base `setting` (a gateway's URL) gives the model proxy: its origin and its path, one trailing `/v1` taken off, since
|
|
86
|
+
* every route the proxy sends to begins with `/v1/`. So `https://openrouter.ai/api` and `https://openrouter.ai/api/v1` both
|
|
87
|
+
* send to `https://openrouter.ai/api/v1/...`. A provider's key goes wherever this points, so a value that could point
|
|
88
|
+
* somewhere other than it reads is refused, by the setting's name: userinfo, a query or a fragment, a "." or ".." path
|
|
89
|
+
* segment (raw or percent-encoded), a backslash, whitespace, or plain http to anything but this machine.
|
|
90
|
+
*/
|
|
91
|
+
export declare function gatewayBase(setting: string, value: string): string;
|
|
92
|
+
/** The model key a run on `harness` (claude-agent or codex) of `model` (the revision's; none, the host's default for the
|
|
93
|
+
* harness) takes: the one its requests carry on the route its provider below takes, as key-refusal.ts' runKeyOf names
|
|
94
|
+
* it. codex: the gateway's when AGENT_MODEL_BASE_URL is set, else OpenAI's, or OpenRouter's on OpenRouter's route;
|
|
95
|
+
* claude-agent: Anthropic's, for api.anthropic.com or ANTHROPIC_BASE_URL alike, or OpenRouter's on OpenRouter's route.
|
|
96
|
+
* None for pi, whose keys are its models' (model.ts' modelKeys). */
|
|
97
|
+
export declare function harnessModelKeys(harness: string, env: NodeJS.ProcessEnv, model?: string): string[];
|
|
98
|
+
/** OpenRouter's API: its Anthropic Messages endpoint (`<base>/v1/messages`) and its Responses API (`<base>/v1/responses`)
|
|
99
|
+
* under one base, its key taken as a bearer token. The OpenRouter key goes nowhere else. */
|
|
100
|
+
export declare const OPENROUTER_BASE = "https://openrouter.ai/api";
|
|
101
|
+
export { openRouterOnly };
|
|
102
|
+
/** Where codex's model requests go, and the model id sent there: a gateway at AGENT_MODEL_BASE_URL's base (gatewayBase:
|
|
103
|
+
* the proxy sends the Responses API to <base>/v1/responses) with its key, the model as model.ts chose it; OpenAI with
|
|
104
|
+
* its key, OpenAI's id; or OpenRouter's Responses API (openRouterOnly, or a model the run names on it,
|
|
105
|
+
* `openrouter/openai/<model-id>`) with OpenRouter's key, the model's whole id (`openai/gpt-6-sol`). Codex sends each key
|
|
106
|
+
* as a bearer token. */
|
|
107
|
+
export type CodexProvider = {
|
|
108
|
+
origin: string;
|
|
109
|
+
credential: () => string;
|
|
110
|
+
modelId: string;
|
|
111
|
+
};
|
|
112
|
+
export declare function codexProvider(env: NodeJS.ProcessEnv, model: ModelRef): CodexProvider;
|
|
113
|
+
/** codex's model for `ref` (a revision's; none, the host's default for codex): as model.ts chooses it, except where
|
|
114
|
+
* codex reaches OpenAI only through OpenRouter (openRouterOnly), where an OpenAI model needs no OpenAI key, only a
|
|
115
|
+
* model pi-ai's catalog lists (it prices the run): OpenRouter's key is the one codexProvider sends. A save, a run and
|
|
116
|
+
* capabilities all ask this. */
|
|
117
|
+
export declare function codexModel(env: NodeJS.ProcessEnv, ref: string | undefined): ReturnType<typeof chooseModel>;
|
|
118
|
+
/** A response's price in USD, from the same catalog that prices pi's runs; null when the model has no price. The
|
|
119
|
+
* usage's input is net of the cached tokens, which are priced at their own rate. */
|
|
120
|
+
export declare function priceOf(needs: AdapterNeeds): (_model: string, usage: {
|
|
121
|
+
input: number;
|
|
122
|
+
output: number;
|
|
123
|
+
cacheRead?: number;
|
|
124
|
+
cacheWrite?: number;
|
|
125
|
+
}) => number | null;
|
|
126
|
+
/**
|
|
127
|
+
* Where claude-agent's model requests go, as its proxy sends them and anything else that calls the same model (the
|
|
128
|
+
* learning grader) must: the endpoint's origin (the proxy appends `/v1/messages`), its key, read per request, how the
|
|
129
|
+
* endpoint takes it, the model id on the wire, and the catalog entry (pi-ai's) that prices the run.
|
|
130
|
+
*/
|
|
131
|
+
export type ClaudeProvider = {
|
|
132
|
+
origin: string;
|
|
133
|
+
credential: () => string;
|
|
134
|
+
auth: "bearer" | "x-api-key";
|
|
135
|
+
modelId: string;
|
|
136
|
+
priceModel: {
|
|
137
|
+
provider: string;
|
|
138
|
+
id: string;
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
/** Where claude-agent's requests go, Anthropic Messages only: at ANTHROPIC_BASE_URL's base (an Anthropic-compatible
|
|
142
|
+
* endpoint, with its path: <base>/v1/messages) or api.anthropic.com, with ANTHROPIC_API_KEY as `x-api-key`, priced as
|
|
143
|
+
* Anthropic's; or OpenRouter's Messages endpoint (openRouterOnly, or a model the run names on it,
|
|
144
|
+
* `openrouter/anthropic/<model-id>`), with OPENROUTER_API_KEY as a bearer token, priced as OpenRouter's (OpenRouter
|
|
145
|
+
* bills it). Either way the wire carries Anthropic's own id (`claude-sonnet-5-5`), the one the CLI knows the limits of
|
|
146
|
+
* and OpenRouter takes too. Its own settings only: AGENT_MODEL_BASE_URL is the other harnesses' gateway, and Claude's
|
|
147
|
+
* requests never go there. */
|
|
148
|
+
export declare function claudeProvider(env: NodeJS.ProcessEnv, model: ModelRef): ClaudeProvider;
|
|
149
|
+
/** Anthropic's own model id, the model id with dots as dashes: Anthropic's ids hold no dot, and OpenRouter names the same
|
|
150
|
+
* models with dots (anthropic/claude-sonnet-5.5), so a revision may name either, and the catalog prices them by
|
|
151
|
+
* Anthropic's id. */
|
|
152
|
+
export declare function claudeModelId(model: ModelRef): string;
|
|
153
|
+
/** OpenRouter's name for Anthropic's model `id` (Anthropic's own), as its catalog and pi-ai's list it: the version's
|
|
154
|
+
* last two numbers joined by a dot (claude-sonnet-5-5 is claude-sonnet-5.5; claude-opus-5 stays). */
|
|
155
|
+
export declare const openRouterName: (id: string) => string;
|
|
156
|
+
/** The catalog entry a claude-agent run on `model` is priced and capped by: claudeProvider's, or the model's own where
|
|
157
|
+
* claude-agent does not run here (its run is refused before any request). */
|
|
158
|
+
export declare function claudePriceModel(env: NodeJS.ProcessEnv, model: ModelRef): ModelRef;
|
|
159
|
+
/** claude-agent's model: the revision's (or the server's default for claude-agent, hostModel) as `provider/model-id`.
|
|
160
|
+
* Never the gateway's model, which serves the other harnesses. An Anthropic model (`anthropic/<id>`) is Anthropic's
|
|
161
|
+
* own id, dots as dashes, except where claude-agent reaches Anthropic only through OpenRouter (openRouterOnly), where it
|
|
162
|
+
* keeps the name it was given (OpenRouter's dotted one, as capabilities show it): claudeProvider names the id on the
|
|
163
|
+
* wire and the catalog entry that prices it. OpenRouter's name for an Anthropic model (pi's,
|
|
164
|
+
* `openrouter/anthropic/<id>`) runs through OpenRouter. Whether it is an Anthropic model is claudeProvider's to say. */
|
|
165
|
+
export declare function claudeModel(env: NodeJS.ProcessEnv, ref: string | undefined): {
|
|
166
|
+
model: ModelRef;
|
|
167
|
+
} | {
|
|
168
|
+
why: string;
|
|
169
|
+
host: boolean;
|
|
170
|
+
};
|
|
171
|
+
/** The installed claude-agent adapter's own check of the skills it would load (its skillProblems), from `load` (a test
|
|
172
|
+
* gives its own): what it refuses stays in the run's prompt (skills.ts), so claudeOf never hands it a skill it throws
|
|
173
|
+
* on. None where the package is not installed, or has no such check: every skill stays inlined, and claudeOf says
|
|
174
|
+
* what is missing. */
|
|
175
|
+
export declare function claudeSkillCheck(load?: () => Promise<unknown>): Promise<SkillCheck | undefined>;
|
|
176
|
+
/** What a harness's adapter takes from the run's plane (tool-plane.ts) where web_search resolves native: claude-agent,
|
|
177
|
+
* Claude's own WebSearch with the input a search request may read in beyond its body (cap.ts), which its proxy adds to
|
|
178
|
+
* that request's bound; codex, Codex's own search, live (its adapter books each search); nothing otherwise. */
|
|
179
|
+
export declare function nativeOptions(harness: string, env: NodeJS.ProcessEnv): {
|
|
180
|
+
webSearch?: true | "live";
|
|
181
|
+
webSearchAllowance?: number;
|
|
182
|
+
};
|
|
183
|
+
/** claude-agent's adapter, from `load` (the installed package; a test gives its own). */
|
|
184
|
+
export declare function claudeOf(env: NodeJS.ProcessEnv, needs: AdapterNeeds, load?: () => Promise<unknown>, npx?: boolean): Promise<AgentAdapter>;
|
|
185
|
+
/** The run's thinking level as the harness takes it: serve's levels run to max; Codex's reasoning efforts stop at xhigh. */
|
|
186
|
+
export declare const thinkingFor: (harness: string, level: string) => SessionSpec["thinking"];
|
|
187
|
+
/** The bare id Codex takes: serve's "openai/<id>" without its provider. */
|
|
188
|
+
/** codex's adapter, from `load` (the installed package; a test gives its own). */
|
|
189
|
+
export declare function codexOf(env: NodeJS.ProcessEnv, needs: AdapterNeeds, load?: () => Promise<typeof import("@parcha/agentrun-harness-codex")>, npx?: boolean): Promise<AgentAdapter>;
|
|
190
|
+
export declare function adapterFor(harness: string, env: NodeJS.ProcessEnv, needs: AdapterNeeds): Promise<AgentAdapter>;
|
|
191
|
+
/** Why `harness` cannot run here, or undefined when it can: its package and pins, its provider, and the adapter's own
|
|
192
|
+
* check of the model `given` names (with none, a model of the harness's own provider: whether it runs here at all).
|
|
193
|
+
* `atStart`: asked by the start's probe, whose offers hold until a restart, so a reason installing fixes ends saying
|
|
194
|
+
* to restart AgentRun once it is installed (startReason). */
|
|
195
|
+
export declare function harnessReason(harness: string, env: NodeJS.ProcessEnv, given: AdapterNeeds | undefined, { atStart }?: {
|
|
196
|
+
atStart?: boolean;
|
|
197
|
+
}): Promise<string | undefined>;
|
|
198
|
+
/** harnessReason's reason, with the model keys any one of which lets the harness run when a key is all it lacks
|
|
199
|
+
* (HarnessUnavailable's `keys`): the start's probe keeps them on the offer, for the key rows (tool-keys.ts). */
|
|
200
|
+
export declare function harnessRefusal(harness: string, env: NodeJS.ProcessEnv, given: AdapterNeeds | undefined, { atStart }?: {
|
|
201
|
+
atStart?: boolean;
|
|
202
|
+
}): Promise<{
|
|
203
|
+
reason: string;
|
|
204
|
+
keys?: readonly string[];
|
|
205
|
+
} | undefined>;
|