@parcha/agentrun-serve 0.1.0-beta.47 → 0.1.0-beta.48
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 +48 -1
- package/README.md +84 -14
- package/dist/acp-package.d.ts +24 -6
- package/dist/adapter-facts.d.ts +0 -4
- package/dist/adapter-facts.js +1 -4
- package/dist/adapters.d.ts +3 -12
- package/dist/adapters.js +1 -70
- package/dist/answer-json.d.ts +10 -0
- package/dist/answer-json.js +24 -0
- package/dist/api-only.d.ts +5 -2
- package/dist/api-only.js +10 -2
- package/dist/browser-live.d.ts +9 -4
- package/dist/browser-live.js +18 -5
- package/dist/cap.js +7 -9
- package/dist/cli.js +6 -6
- package/dist/computer-routes.d.ts +8 -5
- package/dist/computer-routes.js +7 -5
- package/dist/computers.d.ts +6 -2
- package/dist/computers.js +4 -2
- package/dist/conformance.d.ts +4 -0
- package/dist/conformance.js +6 -0
- package/dist/console/assets/index-CTGegcKt.css +1 -0
- package/dist/console/assets/{index-BBFzAxLB.js → index-D1Se6mgG.js} +165 -165
- package/dist/console/index.html +2 -2
- package/dist/harness-check.d.ts +3 -1
- package/dist/harness-check.js +99 -70
- package/dist/harness-cursor.d.ts +10 -27
- package/dist/harness-cursor.js +5 -84
- package/dist/harness-goose.d.ts +4 -29
- package/dist/harness-goose.js +6 -86
- package/dist/harness-module.d.ts +4 -0
- package/dist/harness-module.js +1 -0
- package/dist/harness-owned.d.ts +52 -0
- package/dist/harness-owned.js +92 -0
- package/dist/harness-recipe.js +2 -24
- package/dist/harness-table.d.ts +109 -6
- package/dist/harness-table.js +242 -28
- package/dist/harness.js +2 -2
- package/dist/key-refusal.d.ts +2 -1
- package/dist/key-refusal.js +18 -2
- package/dist/learn/promote.d.ts +11 -0
- package/dist/learn/secrets.d.ts +4 -0
- package/dist/learn/secrets.js +23 -0
- package/dist/learning-model.d.ts +18 -0
- package/dist/learning-model.js +77 -0
- package/dist/llms.txt +1 -0
- package/dist/model-form.js +12 -12
- package/dist/model.d.ts +5 -4
- package/dist/model.js +19 -13
- package/dist/openapi.js +35 -5
- package/dist/page.d.ts +1 -0
- package/dist/page.js +1 -1
- package/dist/run-secrets.d.ts +2 -2
- package/dist/run-secrets.js +6 -5
- package/dist/run-trace.js +6 -3
- package/dist/runner/adapter-loop.d.ts +4 -1
- package/dist/runner/adapter-loop.js +1 -2
- package/dist/runner/adapter-run-spec.d.ts +3 -2
- package/dist/runner/adapter-run-spec.js +8 -4
- package/dist/runner/adapters/index.d.ts +4 -2
- package/dist/runner/adapters/index.js +6 -42
- package/dist/runner/cli-run-spec.js +10 -6
- package/dist/runner/conformance/host-tools.d.ts +4 -0
- package/dist/runner/conformance/host-tools.js +14 -0
- package/dist/runner/meta-tools.js +4 -2
- package/dist/runner/presence.d.ts +3 -0
- package/dist/runner/presence.js +19 -12
- package/dist/runner/promotion.d.ts +62 -4
- package/dist/runner/promotion.js +146 -15
- package/dist/runner/sdk-loop.js +25 -1
- package/dist/runner/workflow-spec.js +3 -2
- package/dist/runs-over-store.d.ts +2 -1
- package/dist/runs-over-store.js +2 -4
- package/dist/sdk/check.d.ts +31 -0
- package/dist/sdk/check.js +58 -0
- package/dist/sdk/runs.d.ts +10 -2
- package/dist/sdk/runs.js +87 -17
- package/dist/sdk/schema.js +11 -3
- package/dist/server.d.ts +3 -0
- package/dist/server.js +116 -40
- package/dist/store/sqlite/store.js +35 -30
- package/dist/store/store.d.ts +20 -18
- package/dist/store-view.d.ts +5 -3
- package/dist/store-view.js +9 -7
- package/dist/template-eval.js +5 -2
- package/dist/template-github-permissions.d.ts +5 -1
- package/dist/template-github-permissions.js +7 -3
- package/dist/timeline/index.d.ts +1 -1
- package/dist/timeline/index.js +1 -1
- package/dist/timeline/timeline.d.ts +8 -0
- package/dist/timeline/timeline.js +18 -6
- package/dist/tool-gate.d.ts +8 -4
- package/dist/tool-gate.js +6 -7
- package/dist/tool-plane.d.ts +4 -0
- package/dist/tool-plane.js +10 -10
- package/dist/trigger-targets.d.ts +11 -2
- package/dist/trigger-targets.js +71 -2
- package/dist/validate.js +5 -1
- package/dist/viewer-credential.d.ts +25 -0
- package/dist/viewer-credential.js +51 -0
- package/dist/workspace/resolve-computer.d.ts +5 -0
- package/dist/workspace/resolve-computer.js +19 -1
- package/package.json +18 -10
- package/templates/code-review/agent.md +2 -3
- package/templates/code-review/evals/mentions-defused/case.yaml +0 -1
- package/templates/code-review/evals/mentions-defused/fixtures/github-mcp.json +0 -27
- package/templates/code-review/evals/other-repo/case.yaml +0 -1
- package/templates/code-review/evals/other-repo/fixtures/github-mcp.json +0 -18
- package/templates/code-review/evals/other-repo/graders/no-other-repo.md +1 -1
- package/dist/console/assets/index-BRi-Rgq6.css +0 -1
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// A harness its owner installs from a pinned archive (`agentrun harness install <id>`, harness-archive.ts): Goose and
|
|
2
|
+
// Cursor, from the ACP package's pins. One shape for each: where it is installed, the command that installs it, why it
|
|
3
|
+
// is not listed or cannot run, and its install. Nothing here downloads: a run, a save and the start's probe only look at
|
|
4
|
+
// what is installed, and say the command where it is not.
|
|
5
|
+
import { existsSync } from "node:fs";
|
|
6
|
+
import { homedir } from "node:os";
|
|
7
|
+
import { join, resolve } from "node:path";
|
|
8
|
+
import { acpPackage } from "./acp-package.js";
|
|
9
|
+
import { installArchive } from "./harness-archive.js";
|
|
10
|
+
import { installDirOf, shellWord } from "./harness-install.js";
|
|
11
|
+
import { DATA_ENV, defaultData } from "./server-fs.js";
|
|
12
|
+
/** The agentrun command's own data directory, where `npx @parcha/agentrun` keeps its server's store (~/.agentrun: not the
|
|
13
|
+
* server's own default, defaultData), and so where `agentrun harness install` installs with no --data. */
|
|
14
|
+
export const commandData = (env) => join(env.HOME || homedir(), ".agentrun");
|
|
15
|
+
/** The data directory `env` names (the server's own, else the default one). */
|
|
16
|
+
const dataOf = (env) => env[DATA_ENV] || defaultData(env);
|
|
17
|
+
/** `spec`'s harness on this server. */
|
|
18
|
+
export function ownerInstalled(spec) {
|
|
19
|
+
const { id, label, tree = false } = spec;
|
|
20
|
+
const dirOf = (data) => installDirOf(data, id);
|
|
21
|
+
const installLine = (acp, data, env = process.env) => resolve(data) === commandData(env) ? spec.installLine(acp) : `${spec.installLine(acp)} --data ${shellWord(data)}`;
|
|
22
|
+
/** What is known of it in `env`'s data before its files are read: why it is missing, or its binary, its folder and the
|
|
23
|
+
* digests they must have, with how a refused check is said. */
|
|
24
|
+
const lookup = (env) => {
|
|
25
|
+
const acp = acpPackage();
|
|
26
|
+
// No package, so no code of its own: the server's own for a harness that is not installed.
|
|
27
|
+
if (!acp)
|
|
28
|
+
return { missing: { code: "HARNESS_NOT_INSTALLED", message: `HARNESS_NOT_INSTALLED: ${label}'s adapter (@parcha/agentrun-harness-acp) is not installed beside this server` } };
|
|
29
|
+
const data = dataOf(env);
|
|
30
|
+
const root = dirOf(data);
|
|
31
|
+
const line = installLine(acp, data, env);
|
|
32
|
+
const { version } = spec.pin(acp);
|
|
33
|
+
const notInstalled = spec.notInstalled(acp);
|
|
34
|
+
const platform = acp.acpPlatform();
|
|
35
|
+
const release = acp.pinnedRelease(spec.pin(acp), platform, tree);
|
|
36
|
+
if (!release)
|
|
37
|
+
return { missing: { code: "ACP_BINARY_UNPINNED", message: `ACP_BINARY_UNPINNED: ${label} ${version} has no release pinned for ${platform ?? `${process.platform}-${process.arch}`}, so it does not run here` } };
|
|
38
|
+
const binary = join(root, release.cmd);
|
|
39
|
+
if (!existsSync(binary))
|
|
40
|
+
return { missing: { code: notInstalled, message: `${notInstalled}: ${label} ${version} is not installed in ${root}. Install it with: ${line}` } };
|
|
41
|
+
return {
|
|
42
|
+
acp, binary, root, sha256: release.binarySha256, ...(tree && release.treeSha256 ? { treeSha256: release.treeSha256 } : {}),
|
|
43
|
+
refused: (error) => {
|
|
44
|
+
const code = error?.code;
|
|
45
|
+
return { code: typeof code === "string" ? code : notInstalled, message: `${error.message}. Install ${label} ${version} again with: ${line}` };
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
return {
|
|
50
|
+
id, label, dirOf, installLine,
|
|
51
|
+
verified: tree ? "its launcher's sha256 and every file's tree digest match the pin" : "the binary's sha256 matches the pin",
|
|
52
|
+
hidden: (env) => {
|
|
53
|
+
const found = lookup(env);
|
|
54
|
+
let missing;
|
|
55
|
+
if ("missing" in found)
|
|
56
|
+
missing = found.missing;
|
|
57
|
+
else {
|
|
58
|
+
try {
|
|
59
|
+
found.acp.verifyPinnedBinary(found.binary, found.sha256);
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
missing = found.refused(error);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return missing && `${missing.message}; then restart AgentRun.`;
|
|
66
|
+
},
|
|
67
|
+
missing: async (env) => {
|
|
68
|
+
const found = lookup(env);
|
|
69
|
+
if ("missing" in found)
|
|
70
|
+
return found;
|
|
71
|
+
try {
|
|
72
|
+
// A tree's digest covers its launcher: its own check is the binary's alone.
|
|
73
|
+
if (found.treeSha256)
|
|
74
|
+
await found.acp.verifyPinnedTree(found.root, found.treeSha256);
|
|
75
|
+
else
|
|
76
|
+
await found.acp.verifyPinnedBinaryAsync(found.binary, found.sha256);
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
return { missing: found.refused(error) };
|
|
80
|
+
}
|
|
81
|
+
return { binary: found.binary, sha256: found.sha256 };
|
|
82
|
+
},
|
|
83
|
+
install: async (data, options = {}, env = process.env) => {
|
|
84
|
+
const acp = acpPackage();
|
|
85
|
+
if (!acp)
|
|
86
|
+
throw new Error(`${label}'s adapter (@parcha/agentrun-harness-acp) is not installed beside this server, so it has no pin to install from`);
|
|
87
|
+
const { version, archives } = spec.pin(acp);
|
|
88
|
+
const platform = acp.acpPlatform();
|
|
89
|
+
return { version, ...(await installArchive({ id, label, retry: installLine(acp, data, env), pin: { version, archives }, ...(tree ? { tree: (root) => acp.treeDigest(root) } : {}) }, dirOf(data), { ...(platform ? { platform } : {}), ...options })) };
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
}
|
package/dist/harness-recipe.js
CHANGED
|
@@ -1,33 +1,11 @@
|
|
|
1
|
-
// A harness recipe (
|
|
2
|
-
// ship, read by the one loader here. Goose's recipe (run-adapters-acp's recipes/goose.json) and its owner's install
|
|
3
|
-
// (harness-goose.ts) are the path this generalizes: a recipe file its owner points at goes through the same five rules,
|
|
4
|
-
// each refused by a code of its own (RECIPE_CODES) before anything is downloaded or started:
|
|
5
|
-
// 1. Own keys only. `keys` names the keys saved for this harness alone (a vendor's API key). A key the server holds for
|
|
6
|
-
// anything else (the launcher's secrets: every model provider's, the gateway's, the tools', the computers', serve's
|
|
7
|
-
// own) is refused, and `env` names no key at all: a value in a recipe file is plain text.
|
|
8
|
-
// 2. A pinned binary. The binary is the release's archive for this platform, as the ACP registry lists it: an https URL
|
|
9
|
-
// and its sha256. A recipe names no command, path or binary of its own. The binary's own sha256 is pinned when the
|
|
10
|
-
// recipe gives it; where it does not (the registry lists only the archive's), the install records the first one it
|
|
11
|
-
// unpacks from the verified archive (harness-archive.ts binaryRecord, the one first-seen path), and a binary that
|
|
12
|
-
// differs from it later is refused by the installer's code (HARNESS_BINARY_MISMATCH). The archive is in a format the
|
|
13
|
-
// installer unpacks (ARCHIVE_FORMATS: tar.bz2, tar.gz).
|
|
14
|
-
// 3. Private paths. The files it writes and the state it keeps are paths inside the session's private HOME; the binary
|
|
15
|
-
// is a path inside its own folder.
|
|
16
|
-
// 4. The owner installs it. Only `agentrun harness install --recipe FILE` downloads and unpacks it (installRecipe), into
|
|
17
|
-
// `<data>/harnesses/<id>`. A check or a run that finds it missing says that command and downloads nothing; a recipe
|
|
18
|
-
// names no install step, script or hook of its own.
|
|
19
|
-
// 5. An allowlist environment. The agent's process gets the adapter's allowlist (PATH, LANG, TZ), its private HOME and
|
|
20
|
-
// tmp, the recipe's literal `env`, its own keys, and the proxy's address: nothing else of the host's. A recipe cannot
|
|
21
|
-
// ask for more (no inherit or pass-through field), names none of the variables the adapter or the proxy sets, and
|
|
22
|
-
// writes its values out (no `$NAME` for the host to fill in).
|
|
23
|
-
// Nothing here reads the network or starts a process.
|
|
1
|
+
// A harness recipe (HARNESS.md#a-recipe): the one loader, refusing by RECIPE_CODES before anything is downloaded.
|
|
24
2
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
25
3
|
import { createHash } from "node:crypto";
|
|
26
4
|
import { isAbsolute, join, normalize, resolve, sep } from "node:path";
|
|
27
5
|
import { HARNESS_ID_PATTERN, RESERVED_HARNESS_IDS } from "./harness.js";
|
|
28
6
|
import { ARCHIVE_FORMATS, archivePlatform, installArchive } from "./harness-archive.js";
|
|
29
7
|
import { BUILTIN_HARNESS_IDS } from "./harness-table.js";
|
|
30
|
-
import { commandData } from "./harness-
|
|
8
|
+
import { commandData } from "./harness-owned.js";
|
|
31
9
|
import { harnessesOf, installDirOf, shellWord } from "./harness-install.js";
|
|
32
10
|
import { keyShaped } from "./secret-name.js";
|
|
33
11
|
import { SECRET_NAMES } from "./secrets.js";
|
package/dist/harness-table.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AdapterFacts, AgentAdapter } from "@parcha/agentrun-kernel";
|
|
2
2
|
import type { ModelProxyOptions } from "@parcha/agentrun-kernel/host";
|
|
3
|
+
import type { AcpProxy, AcpRecipe } from "@parcha/agentrun-harness-acp";
|
|
3
4
|
import type { AdapterNeeds } from "./adapters.js";
|
|
4
5
|
import { type HarnessInstallEntry, type HarnessPins } from "./harness-install.js";
|
|
5
6
|
import { type ModelChoice } from "./provider.js";
|
|
@@ -41,8 +42,9 @@ export interface HarnessEntry {
|
|
|
41
42
|
readonly label: string;
|
|
42
43
|
/** What it promises (HarnessPromises). Absent: a native harness's (NATIVE_PROMISES). */
|
|
43
44
|
readonly promises?: HarnessPromises;
|
|
44
|
-
/** The runner's harness for it (runner/adapters/index.ts RunnerHarness):
|
|
45
|
-
*
|
|
45
|
+
/** The runner's harness for it (runner/adapters/index.ts RunnerHarness): ON_TABLE on an entry moduleEntryOf builds (a
|
|
46
|
+
* module's, Goose's); absent on another built-in, whose runner is the runner's own (RUNNER_HARNESSES), else ON_TABLE
|
|
47
|
+
* for one run from its facts and adapter (Cursor). */
|
|
46
48
|
readonly runner?: RunnerHarness;
|
|
47
49
|
/** Whether it takes a message mid-turn; else a message waits for the turn's end. */
|
|
48
50
|
readonly steer: boolean;
|
|
@@ -81,23 +83,119 @@ export interface HarnessEntry {
|
|
|
81
83
|
* It is still in the table, so a run or a save naming it is refused with these words. */
|
|
82
84
|
hidden?(env: NodeJS.ProcessEnv): string | undefined;
|
|
83
85
|
/** The secrets that are this harness's own (Cursor's CURSOR_API_KEY): a run of it is handed them, and a run of any
|
|
84
|
-
* other harness never is (run-secrets.ts keysFor).
|
|
86
|
+
* other harness never is (run-secrets.ts keysFor). Only a built-in's count, each for that built-in alone
|
|
87
|
+
* (builtinOwns): a module's entry that names a key here moves no key from another harness's run, and one naming a
|
|
88
|
+
* built-in's (BUILTIN_OWN_KEYS) is refused at load (HARNESS_KEY_OWNED). */
|
|
85
89
|
readonly ownKeys?: readonly string[];
|
|
86
90
|
/** What its owner reads before running it (capabilities' `card`): who bills it, what stops it, whose terms it runs
|
|
87
91
|
* under. None for a harness that runs on this server's keys and cap. */
|
|
88
92
|
card?(env: NodeJS.ProcessEnv): string | undefined;
|
|
89
93
|
}
|
|
90
|
-
/** What a
|
|
91
|
-
* the
|
|
94
|
+
/** What one run of a module's adapter harness is given (HarnessModuleKit.adapterEntry): the model as its provider names it,
|
|
95
|
+
* where the session's proxy forwards it (origin, credential, auth), the price of a request's usage, a log, the
|
|
96
|
+
* confinement its process starts under, and the skills it loads itself. serve chooses each from the run's model and
|
|
97
|
+
* this server's keys (providerFor), as it does for the built-in harnesses. */
|
|
98
|
+
export interface ModuleLaunch {
|
|
99
|
+
readonly model: string;
|
|
100
|
+
readonly provider: {
|
|
101
|
+
readonly origin: string;
|
|
102
|
+
readonly credential: () => string | Promise<string>;
|
|
103
|
+
readonly auth?: "bearer" | "x-api-key";
|
|
104
|
+
};
|
|
105
|
+
readonly price: (model: string, usage: {
|
|
106
|
+
input: number;
|
|
107
|
+
output: number;
|
|
108
|
+
cacheRead?: number;
|
|
109
|
+
cacheWrite?: number;
|
|
110
|
+
}) => number | null;
|
|
111
|
+
readonly log: (message: string, fields?: Record<string, unknown>) => void;
|
|
112
|
+
readonly confine?: AdapterNeeds["confine"];
|
|
113
|
+
/** The run's skills its skillCheck accepted, taken out of the prompt for the harness to load itself; only with a
|
|
114
|
+
* skillCheck (adapterEntry's), and only when the run has some. */
|
|
115
|
+
readonly skills?: AdapterNeeds["skills"];
|
|
116
|
+
/** The server's environment, for the module's own settings (its binary's path, say). */
|
|
117
|
+
readonly env: NodeJS.ProcessEnv;
|
|
118
|
+
}
|
|
119
|
+
/** What an ACP agent's module gives acpEntry: its facts, its recipe for a run (the binary, the run's model), and the model
|
|
120
|
+
* proxy each of its processes reaches the session's booking through (its wire's policy: what may leave on this server's
|
|
121
|
+
* key). It promises tool calls through its permission asks, billing through the proxy, and the resume `resume` says. */
|
|
122
|
+
export interface AcpEntryOptions extends ModuleChecks {
|
|
123
|
+
readonly facts: AdapterFacts;
|
|
124
|
+
/** How its run resumes after a crash, as capabilities show it: "restart" (the default, never wrong: a new session
|
|
125
|
+
* with the conversation so far) or "load" (the agent's own session/load), which its recipe must declare
|
|
126
|
+
* (`declares.load`), else its first launch is refused (HARNESS_RESUME_UNDECLARED). */
|
|
127
|
+
readonly resume?: "load" | "restart";
|
|
128
|
+
recipe(launch: ModuleLaunch): AcpRecipe;
|
|
129
|
+
proxy(launch: ModuleLaunch): AcpProxy;
|
|
130
|
+
beforeStart?(command: string): Promise<void>;
|
|
131
|
+
}
|
|
132
|
+
/** What a module's harness lacks that no model key gives it, asked before its model key, as the built-in harnesses ask
|
|
133
|
+
* for their binary first. */
|
|
134
|
+
export interface ModuleChecks {
|
|
135
|
+
/** Why it cannot run on `env` whatever key is saved (its binary is not where its setting says, say), in words that end
|
|
136
|
+
* with what to do; undefined when nothing is missing. Its offer then says this and names no key, where without it a
|
|
137
|
+
* harness that lacks both would be offered as one a key runs. An error it throws whose `code` is one its facts'
|
|
138
|
+
* `install.codes` name is refused with that fix (install, pins), so the start's reason says to restart once fixed. */
|
|
139
|
+
missing?(env: NodeJS.ProcessEnv): string | undefined | Promise<string | undefined>;
|
|
140
|
+
}
|
|
141
|
+
/** What serve hands a harness module beside the built-ins (HarnessTableModule.entries' second argument): the builders the
|
|
142
|
+
* built-in harnesses are made with, so a module's entry chooses models, refuses and is offered as theirs are, on the
|
|
143
|
+
* running server's own copy, never a second serve's. */
|
|
144
|
+
export interface HarnessModuleKit {
|
|
145
|
+
/** An adapter harness's whole entry: its models are its wire's vendor's (WIRES), its key rows those that run them, its
|
|
146
|
+
* refusal the adapter's own check. `adapter` builds its adapter for one run. */
|
|
147
|
+
adapterEntry(facts: AdapterFacts, adapter: (launch: ModuleLaunch) => AgentAdapter | Promise<AgentAdapter>, extra?: Pick<HarnessEntry, "skillCheck" | "promises"> & ModuleChecks): HarnessEntry;
|
|
148
|
+
/** An ACP agent's whole entry, on serve's own ACP adapter (@parcha/agentrun-harness-acp): adapterEntry over acpAdapter. */
|
|
149
|
+
acpEntry(options: AcpEntryOptions): HarnessEntry;
|
|
150
|
+
}
|
|
151
|
+
/** What a harness module (and a test's table module) exports: entries by id, given the built-ins to build on and the kit
|
|
152
|
+
* (HarnessModuleKit). A test's are merged over the built-in one of that id (all of it, for one the server has none of);
|
|
153
|
+
* a harness module's add whole entries of new ids. Loaded with require: the module has no top-level await. */
|
|
92
154
|
export type HarnessTableModule = {
|
|
93
|
-
entries(builtins: Readonly<Record<string, HarnessEntry
|
|
155
|
+
entries(builtins: Readonly<Record<string, HarnessEntry>>, kit: HarnessModuleKit): Record<string, Partial<HarnessEntry>>;
|
|
94
156
|
};
|
|
157
|
+
/** What serve's own check of a recipe (harness-check.ts) gives acpEntryOf beside a module's options, so it runs the
|
|
158
|
+
* launch a server runs and still reads it: the log every launch writes to (the check reads the adapter's `acp:` lines).
|
|
159
|
+
* Never the kit's: a module's launches log as their harness. */
|
|
160
|
+
export interface AcpEntryHost {
|
|
161
|
+
readonly log?: ModuleLaunch["log"];
|
|
162
|
+
}
|
|
163
|
+
/** The runner of an entry run on serve's table (its facts' adapter, cli-run-spec.ts), never by a runner's adapter of its
|
|
164
|
+
* own: a module's, and Goose's and Cursor's (resolveHarness). Its adapter says so if it is ever asked. The loop keeps the
|
|
165
|
+
* run's record, as for every CLI harness. */
|
|
166
|
+
export declare const ON_TABLE: RunnerHarness;
|
|
167
|
+
/** The code a module's ACP entry is refused by at its first launch when it promises resume "load" and its recipe
|
|
168
|
+
* declares no session/load (AcpEntryOptions.resume). */
|
|
169
|
+
export declare const HARNESS_RESUME_UNDECLARED = "HARNESS_RESUME_UNDECLARED";
|
|
170
|
+
/** What a run of a plan-billed ACP agent is given (acpEntryOf's plan branch): its model as its vendor names it (`default`
|
|
171
|
+
* for the vendor's own), a log, the confinement its process starts under and the server's environment. No provider or
|
|
172
|
+
* price: its vendor bills its owner's plan, and no request of it reaches a proxy of ours. */
|
|
173
|
+
export type PlanLaunch = Omit<ModuleLaunch, "provider" | "price" | "skills">;
|
|
174
|
+
/** What serve gives acpEntryOf for an ACP agent billed to its owner's plan (its facts' wire `plan`): Cursor's entry and
|
|
175
|
+
* harness-check's plan-billed recipes. Not the kit's: a module's acpEntry is proxy-billed. `missing` may throw a
|
|
176
|
+
* HarnessUnavailable of its own, which keeps the fix (install, pins) it names; `recipe` may throw one too (a key unset). */
|
|
177
|
+
export interface AcpPlanEntryOptions extends ModuleChecks, Pick<HarnessEntry, "ownKeys" | "card" | "hidden"> {
|
|
178
|
+
readonly facts: AdapterFacts;
|
|
179
|
+
recipe(launch: PlanLaunch): AcpRecipe | Promise<AcpRecipe>;
|
|
180
|
+
beforeStart?(command: string): Promise<void>;
|
|
181
|
+
}
|
|
182
|
+
/** An ACP agent's whole entry on serve's own ACP adapter, by its facts' wire: proxy-billed (a module's, a proxy-billed
|
|
183
|
+
* recipe's) or billed to its owner's plan (Cursor's, a plan-billed recipe's). The one way an ACP agent other than the
|
|
184
|
+
* built-in Goose starts. A module's acpEntry is the proxy-billed one alone. */
|
|
185
|
+
export declare function acpEntryOf(options: AcpEntryOptions, host?: AcpEntryHost): HarnessEntry;
|
|
186
|
+
export declare function acpEntryOf(options: AcpPlanEntryOptions, host?: AcpEntryHost): HarnessEntry;
|
|
95
187
|
/** The secrets the built-in harnesses own (each entry's ownKeys), whether or not its package is beside serve here: a
|
|
96
188
|
* server without Cursor's adapter still never hands CURSOR_API_KEY to another harness's run (run-secrets.ts keysFor). */
|
|
97
189
|
export declare const BUILTIN_OWN_KEYS: readonly string[];
|
|
98
190
|
/** The ids of the harnesses this server has built in (Goose and Cursor where their package is beside it, as a recipe
|
|
99
191
|
* needs it too): a recipe or module never takes one (harness-recipe.ts). */
|
|
100
192
|
export declare const BUILTIN_HARNESS_IDS: readonly string[];
|
|
193
|
+
/** Whether built-in harness `id` owns secret `key`: its own built-in entry names it in ownKeys. By the pair, so a key one
|
|
194
|
+
* built-in owns never crosses to another built-in, a module's entry or a test's; and none is owned where its harness's
|
|
195
|
+
* package is not beside serve (run-secrets.ts keysFor). */
|
|
196
|
+
export declare function builtinOwns(id: string, key: string): boolean;
|
|
197
|
+
/** The code a harness module's entry is refused by when its ownKeys names a key a built-in harness owns (BUILTIN_OWN_KEYS). */
|
|
198
|
+
export declare const HARNESS_KEY_OWNED = "HARNESS_KEY_OWNED";
|
|
101
199
|
/** The table `env` runs on: the built-in entries; then, only under a test runner (node --test's NODE_TEST_CONTEXT, which a
|
|
102
200
|
* server's and a run's processes there carry), a test's module's (HARNESS_TABLE_ENV) merged over them by id; then the
|
|
103
201
|
* harnesses each of the owner's harness modules adds (HARNESS_MODULES_ENV), under a test runner or not. A module adds
|
|
@@ -133,6 +231,11 @@ export declare const builtinHarness: (id: string | undefined) => HarnessEntry |
|
|
|
133
231
|
export declare const ownerTable: (env: NodeJS.ProcessEnv) => Readonly<Record<string, HarnessEntry>>;
|
|
134
232
|
/** The entry of harness `id` (none: the default, pi) on the owner's table (ownerTable); undefined for one it has not. */
|
|
135
233
|
export declare const ownerHarness: (env: NodeJS.ProcessEnv, id: string | undefined) => HarnessEntry | undefined;
|
|
234
|
+
/** The facts of harness `id`'s adapter on the owner's table (ownerTable: the built-in harnesses and those `env`'s modules
|
|
235
|
+
* add, never a test table's, so a stand-in keeps the facts of the harness it stands in for). Every reader of a harness's
|
|
236
|
+
* facts by id asks here: its models (model-form.ts), its key rows (model.ts), its search and tool names (tool-plane.ts,
|
|
237
|
+
* tool-gate.ts). Undefined for pi, for a module's harness that gives none, and for an id the table has none of. */
|
|
238
|
+
export declare const factsOf: (env: NodeJS.ProcessEnv, id: string | undefined) => AdapterFacts | undefined;
|
|
136
239
|
/** The entry of harness `id` (none: the default, pi) on `env`'s table; undefined for an id this server has none of. */
|
|
137
240
|
export declare const harnessOf: (env: NodeJS.ProcessEnv, id: string | undefined) => HarnessEntry | undefined;
|
|
138
241
|
/** Whether `id` runs on an adapter (every harness but pi): a session of its own, beside the run's process. */
|