@parcha/agentrun-serve 0.1.0-beta.47 → 0.1.0-beta.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/CHANGELOG.md +68 -1
  2. package/README.md +218 -20
  3. package/dist/acp-package.d.ts +24 -6
  4. package/dist/adapter-facts.d.ts +0 -4
  5. package/dist/adapter-facts.js +1 -4
  6. package/dist/adapters.d.ts +3 -12
  7. package/dist/adapters.js +1 -70
  8. package/dist/agent-delete.d.ts +33 -10
  9. package/dist/agent-delete.js +184 -26
  10. package/dist/agents-store.d.ts +6 -2
  11. package/dist/agents-store.js +18 -5
  12. package/dist/agents.d.ts +8 -1
  13. package/dist/agents.js +14 -4
  14. package/dist/answer-json.d.ts +10 -0
  15. package/dist/answer-json.js +23 -0
  16. package/dist/api-only.d.ts +5 -2
  17. package/dist/api-only.js +10 -2
  18. package/dist/archil-routes.d.ts +1 -1
  19. package/dist/archil-routes.js +4 -3
  20. package/dist/browser-live.d.ts +9 -4
  21. package/dist/browser-live.js +18 -5
  22. package/dist/browser-sessions.d.ts +56 -0
  23. package/dist/browser-sessions.js +117 -0
  24. package/dist/cap.js +7 -9
  25. package/dist/cli.js +6 -6
  26. package/dist/computer-routes.d.ts +6 -14
  27. package/dist/computer-routes.js +8 -10
  28. package/dist/computers.d.ts +6 -2
  29. package/dist/computers.js +4 -2
  30. package/dist/conformance.d.ts +4 -0
  31. package/dist/conformance.js +6 -0
  32. package/dist/console/assets/index-Bzn4eUYF.js +715 -0
  33. package/dist/console/assets/index-CR2ZGei1.css +1 -0
  34. package/dist/console/index.html +2 -2
  35. package/dist/errors.d.ts +4 -1
  36. package/dist/errors.js +15 -5
  37. package/dist/harness-check.d.ts +3 -1
  38. package/dist/harness-check.js +99 -70
  39. package/dist/harness-cursor.d.ts +10 -27
  40. package/dist/harness-cursor.js +5 -84
  41. package/dist/harness-goose.d.ts +4 -29
  42. package/dist/harness-goose.js +6 -86
  43. package/dist/harness-module.d.ts +4 -0
  44. package/dist/harness-module.js +1 -0
  45. package/dist/harness-owned.d.ts +52 -0
  46. package/dist/harness-owned.js +92 -0
  47. package/dist/harness-recipe.js +2 -24
  48. package/dist/harness-table.d.ts +109 -6
  49. package/dist/harness-table.js +242 -28
  50. package/dist/harness.js +2 -2
  51. package/dist/import.js +4 -3
  52. package/dist/key-refusal.d.ts +2 -1
  53. package/dist/key-refusal.js +18 -2
  54. package/dist/learn/check.d.ts +11 -2
  55. package/dist/learn/check.js +12 -9
  56. package/dist/learn/promote.d.ts +18 -1
  57. package/dist/learn/promote.js +47 -0
  58. package/dist/learn/repick.d.ts +34 -0
  59. package/dist/learn/repick.js +201 -0
  60. package/dist/learn/secrets.d.ts +4 -0
  61. package/dist/learn/secrets.js +23 -0
  62. package/dist/learned-workflow.d.ts +2 -0
  63. package/dist/learned-workflow.js +18 -1
  64. package/dist/learning-model.d.ts +18 -0
  65. package/dist/learning-model.js +77 -0
  66. package/dist/learning-setting.d.ts +13 -0
  67. package/dist/learning-setting.js +23 -1
  68. package/dist/llms.txt +1 -0
  69. package/dist/model-form.js +12 -12
  70. package/dist/model.d.ts +5 -4
  71. package/dist/model.js +19 -13
  72. package/dist/openapi.js +203 -15
  73. package/dist/page.d.ts +1 -0
  74. package/dist/page.js +1 -1
  75. package/dist/paid-calls.d.ts +4 -1
  76. package/dist/paid-calls.js +1 -1
  77. package/dist/run-learning-served.d.ts +1 -1
  78. package/dist/run-secrets.d.ts +2 -2
  79. package/dist/run-secrets.js +6 -5
  80. package/dist/run-trace.js +6 -3
  81. package/dist/run-usage.d.ts +110 -0
  82. package/dist/run-usage.js +312 -0
  83. package/dist/runner/adapter-loop.d.ts +4 -1
  84. package/dist/runner/adapter-loop.js +52 -22
  85. package/dist/runner/adapter-run-spec.d.ts +3 -2
  86. package/dist/runner/adapter-run-spec.js +8 -4
  87. package/dist/runner/adapters/index.d.ts +4 -2
  88. package/dist/runner/adapters/index.js +6 -42
  89. package/dist/runner/cli-run-spec.js +10 -6
  90. package/dist/runner/conformance/harness.d.ts +2 -0
  91. package/dist/runner/conformance/harness.js +18 -4
  92. package/dist/runner/conformance/host-tools.d.ts +4 -0
  93. package/dist/runner/conformance/host-tools.js +14 -0
  94. package/dist/runner/feedback-round.d.ts +29 -1
  95. package/dist/runner/feedback-round.js +54 -3
  96. package/dist/runner/journal-kinds.d.ts +3 -1
  97. package/dist/runner/learning-end.js +49 -18
  98. package/dist/runner/loop-contract.d.ts +3 -0
  99. package/dist/runner/meta-tools.js +4 -2
  100. package/dist/runner/monid-run.js +2 -2
  101. package/dist/runner/presence.d.ts +3 -0
  102. package/dist/runner/presence.js +19 -12
  103. package/dist/runner/promotion.d.ts +62 -4
  104. package/dist/runner/promotion.js +154 -17
  105. package/dist/runner/reflect-hook.js +3 -2
  106. package/dist/runner/sdk-loop.js +25 -1
  107. package/dist/runner/workflow-spec.js +3 -2
  108. package/dist/runs-over-store.d.ts +5 -3
  109. package/dist/runs-over-store.js +11 -11
  110. package/dist/sdk/check.d.ts +31 -0
  111. package/dist/sdk/check.js +58 -0
  112. package/dist/sdk/runs.d.ts +10 -2
  113. package/dist/sdk/runs.js +87 -17
  114. package/dist/sdk/schema.js +11 -3
  115. package/dist/server.d.ts +6 -3
  116. package/dist/server.js +297 -98
  117. package/dist/store/index.d.ts +2 -2
  118. package/dist/store/index.js +1 -1
  119. package/dist/store/journal/storage.js +1 -1
  120. package/dist/store/open.d.ts +1 -1
  121. package/dist/store/open.js +1 -1
  122. package/dist/store/postgres/migrations/0021_purged.sql +13 -0
  123. package/dist/store/postgres/migrations/0022_computer_intervals.sql +27 -0
  124. package/dist/store/schema.d.ts +15 -1
  125. package/dist/store/schema.js +50 -5
  126. package/dist/store/sqlite/connection.d.ts +4 -1
  127. package/dist/store/sqlite/connection.js +5 -0
  128. package/dist/store/sqlite/run-patch.d.ts +8 -3
  129. package/dist/store/sqlite/run-patch.js +15 -7
  130. package/dist/store/sqlite/store.d.ts +5 -2
  131. package/dist/store/sqlite/store.js +283 -77
  132. package/dist/store/sqlite/worker.d.ts +9 -0
  133. package/dist/store/sqlite/worker.js +18 -1
  134. package/dist/store/store.d.ts +162 -27
  135. package/dist/store/store.js +63 -0
  136. package/dist/store-reads/analytics.js +2 -1
  137. package/dist/store-reads/cap.d.ts +8 -2
  138. package/dist/store-reads/cap.js +27 -3
  139. package/dist/store-reads/learning.d.ts +1 -1
  140. package/dist/store-reads/learning.js +5 -2
  141. package/dist/store-reads/runs.js +2 -0
  142. package/dist/store-reads/stats.js +4 -2
  143. package/dist/store-view.d.ts +12 -3
  144. package/dist/store-view.js +70 -27
  145. package/dist/template-eval.js +5 -2
  146. package/dist/template-github-permissions.d.ts +5 -1
  147. package/dist/template-github-permissions.js +7 -3
  148. package/dist/timeline/index.d.ts +1 -1
  149. package/dist/timeline/index.js +1 -1
  150. package/dist/timeline/timeline.d.ts +8 -0
  151. package/dist/timeline/timeline.js +18 -6
  152. package/dist/tool-gate.d.ts +8 -4
  153. package/dist/tool-gate.js +6 -7
  154. package/dist/tool-plane.d.ts +4 -0
  155. package/dist/tool-plane.js +10 -10
  156. package/dist/tools.js +9 -0
  157. package/dist/trigger-targets.d.ts +14 -2
  158. package/dist/trigger-targets.js +73 -4
  159. package/dist/triggers.d.ts +2 -1
  160. package/dist/triggers.js +5 -2
  161. package/dist/validate.d.ts +4 -2
  162. package/dist/validate.js +18 -4
  163. package/dist/viewer-credential.d.ts +24 -0
  164. package/dist/viewer-credential.js +53 -0
  165. package/dist/workspace/computer-for-claim.d.ts +5 -1
  166. package/dist/workspace/computer-for-claim.js +47 -18
  167. package/dist/workspace/computer-intervals.d.ts +20 -0
  168. package/dist/workspace/computer-intervals.js +49 -0
  169. package/dist/workspace/computer-janitor.d.ts +7 -3
  170. package/dist/workspace/computer-janitor.js +14 -6
  171. package/dist/workspace/computer-kept.d.ts +7 -2
  172. package/dist/workspace/computer-kept.js +9 -2
  173. package/dist/workspace/resolve-computer.d.ts +9 -1
  174. package/dist/workspace/resolve-computer.js +29 -22
  175. package/dist/workspace/run-end-computers.d.ts +1 -0
  176. package/dist/workspace/run-end-computers.js +4 -1
  177. package/package.json +18 -10
  178. package/templates/code-review/agent.md +2 -3
  179. package/templates/code-review/evals/mentions-defused/case.yaml +0 -1
  180. package/templates/code-review/evals/mentions-defused/fixtures/github-mcp.json +0 -27
  181. package/templates/code-review/evals/other-repo/case.yaml +0 -1
  182. package/templates/code-review/evals/other-repo/fixtures/github-mcp.json +0 -18
  183. package/templates/code-review/evals/other-repo/graders/no-other-repo.md +1 -1
  184. package/dist/console/assets/index-BBFzAxLB.js +0 -715
  185. package/dist/console/assets/index-BRi-Rgq6.css +0 -1
@@ -1,15 +1,5 @@
1
- // Cursor on this server: where its owner installs it (`<data>/harnesses/cursor`, by `agentrun harness install cursor`,
2
- // harness-archive.ts), the command that does, whether what is there is the pinned release (its launcher and every file
3
- // beside it), the key it runs on (CURSOR_API_KEY, the owner's), the limits a run of it stops at and the card its owner
4
- // reads. Nothing here downloads: a run, a save and the start's probe only look at what is installed, and say the command
5
- // where it is not. Cursor's model is Cursor's, billed to the owner's Cursor plan: no request of it reaches a proxy of ours.
6
- import { existsSync } from "node:fs";
7
- import { join, resolve } from "node:path";
8
1
  import { acpPackage } from "./acp-package.js";
9
- import { commandData } from "./harness-goose.js";
10
- import { installArchive } from "./harness-archive.js";
11
- import { installDirOf, shellWord } from "./harness-install.js";
12
- import { DATA_ENV, defaultData } from "./server-fs.js";
2
+ import { ownerInstalled } from "./harness-owned.js";
13
3
  export const CURSOR_ID = "cursor";
14
4
  /** The key Cursor runs on: the owner's Cursor API key, read by name, handed to Cursor's runs and no other. */
15
5
  export const CURSOR_KEY = "CURSOR_API_KEY";
@@ -19,13 +9,10 @@ export const CURSOR_MAX_TOOL_CALLS_ENV = "AGENTRUN_CURSOR_MAX_TOOL_CALLS";
19
9
  /** The provider a Cursor model is named under (`cursor/<model>`, `cursor/default` for Cursor's own default). */
20
10
  export const CURSOR_PROVIDER = "cursor";
21
11
  export const CURSOR_DEFAULT_MODEL = "default";
22
- const dataOf = (env) => env[DATA_ENV] || defaultData(env);
23
- /** Cursor's folder in `data`. Its launcher is at the pin's `cmd` inside it (`./dist-package/cursor-agent`). */
24
- export const cursorDirOf = (data) => installDirOf(data, CURSOR_ID);
25
- /** The command that installs Cursor into `data`: naming it with --data unless it is the agentrun command's own. */
26
- export function cursorInstallLine(acp, data, env = process.env) {
27
- return resolve(data) === commandData(env) ? acp.CURSOR_INSTALL : `${acp.CURSOR_INSTALL} --data ${shellWord(data)}`;
28
- }
12
+ /** Cursor as an owner-installed harness, pinned by its tree: its pin, its install line and its not-installed code are its
13
+ * package's. */
14
+ export const CURSOR = ownerInstalled({ id: CURSOR_ID, label: "Cursor", pin: (acp) => acp.CURSOR_PIN, installLine: (acp) => acp.CURSOR_INSTALL, notInstalled: (acp) => acp.CURSOR_CODES.notInstalled, tree: true });
15
+ export const { hidden: cursorHidden, missing: cursorMissing } = CURSOR;
29
16
  /** The limits a run of Cursor stops at on `env`: the owner's (CURSOR_MAX_TURNS_ENV, CURSOR_MAX_TOOL_CALLS_ENV), else the
30
17
  * package's. A setting that is no whole number is refused by name. */
31
18
  export function cursorLimitsOf(acp, env) {
@@ -53,69 +40,3 @@ export function cursorCardOf(env) {
53
40
  return undefined;
54
41
  }
55
42
  }
56
- /** What is known of Cursor in `env`'s data before its files are read: why it is missing, or its launcher, its folder and
57
- * the digests they must have, with how a refused check is said. */
58
- function lookup(env) {
59
- const acp = acpPackage();
60
- if (!acp)
61
- return { missing: { code: "HARNESS_NOT_INSTALLED", message: "HARNESS_NOT_INSTALLED: Cursor's adapter (@parcha/agentrun-harness-acp) is not installed beside this server" } };
62
- const data = dataOf(env);
63
- const root = cursorDirOf(data);
64
- const line = cursorInstallLine(acp, data, env);
65
- const { version } = acp.CURSOR_PIN;
66
- const platform = acp.acpPlatform();
67
- const release = acp.cursorRelease(platform);
68
- if (!release)
69
- return { missing: { code: "ACP_BINARY_UNPINNED", message: `ACP_BINARY_UNPINNED: Cursor ${version} has no release pinned for ${platform ?? `${process.platform}-${process.arch}`}, so it does not run here` } };
70
- const binary = join(root, release.cmd);
71
- if (!existsSync(binary))
72
- return { missing: { code: acp.CURSOR_CODES.notInstalled, message: `${acp.CURSOR_CODES.notInstalled}: Cursor ${version} is not installed in ${root}. Install it with: ${line}` } };
73
- return {
74
- acp, binary, root, launcher: release.binarySha256, tree: release.treeSha256,
75
- refused: (error) => {
76
- const code = error?.code;
77
- return { code: typeof code === "string" ? code : acp.CURSOR_CODES.notInstalled, message: `${error.message}. Install Cursor ${version} again with: ${line}` };
78
- },
79
- };
80
- }
81
- /** Why Cursor is not listed here (HarnessEntry.hidden): not installed, or its launcher not the pinned one, in words that end
82
- * with what to do, restarting AgentRun included. Undefined once it is installed. The files beside the launcher are
83
- * checked off the event loop, by cursorMissing at each run and the start's probe. */
84
- export function cursorHidden(env) {
85
- const found = lookup(env);
86
- let missing;
87
- if ("missing" in found)
88
- missing = found.missing;
89
- else {
90
- try {
91
- found.acp.verifyPinnedBinary(found.binary, found.launcher);
92
- }
93
- catch (error) {
94
- missing = found.refused(error);
95
- }
96
- }
97
- return missing && `${missing.message}; then restart AgentRun.`;
98
- }
99
- /** Why Cursor cannot run here, its launcher and every file beside it checked off the event loop; else its launcher. */
100
- export async function cursorMissing(env) {
101
- const found = lookup(env);
102
- if ("missing" in found)
103
- return found;
104
- try {
105
- await found.acp.verifyPinnedBinaryAsync(found.binary, found.launcher);
106
- await found.acp.verifyPinnedTree(found.root, found.tree);
107
- }
108
- catch (error) {
109
- return { missing: found.refused(error) };
110
- }
111
- return { binary: found.binary };
112
- }
113
- /** Installs the pinned Cursor into `data` (agentrun-serve install-harness cursor). */
114
- export async function installCursor(data, options = {}, env = process.env) {
115
- const acp = acpPackage();
116
- if (!acp)
117
- throw new Error("Cursor's adapter (@parcha/agentrun-harness-acp) is not installed beside this server, so it has no pin to install from");
118
- const { id, version, archives } = acp.CURSOR_PIN;
119
- const platform = acp.acpPlatform();
120
- return { version, ...(await installArchive({ id, label: "Cursor", retry: cursorInstallLine(acp, data, env), pin: { version, archives }, tree: (root) => acp.treeDigest(root) }, cursorDirOf(data), { ...(platform ? { platform } : {}), ...options })) };
121
- }
@@ -1,34 +1,9 @@
1
- import { type AcpPackage } from "./acp-package.js";
2
- import { type ArchiveInstallOptions } from "./harness-archive.js";
3
1
  export declare const GOOSE_ID = "goose";
4
- /** Why Goose does not run here: a code (HARNESS_NOT_INSTALLED, ACP_BINARY_MISMATCH, ACP_BINARY_UNPINNED, ...) and words
5
- * that start with it and end with the command that installs it. */
6
- export type GooseMissing = {
7
- readonly code: string;
8
- readonly message: string;
9
- };
10
- /** Goose's folder in `data`, and its binary there. */
11
- export declare const gooseDirOf: (data: string) => string;
12
- export declare const gooseBinaryOf: (data: string) => string;
13
- /** The agentrun command's own data directory, where `npx @parcha/agentrun` keeps its server's store (~/.agentrun: not the
14
- * server's own default, defaultData), and so where `agentrun harness install` installs with no --data. */
15
- export declare const commandData: (env: NodeJS.ProcessEnv) => string;
16
- /** The command that installs Goose into `data`: naming it with --data unless it is the agentrun command's own (commandData). */
17
- export declare function gooseInstallLine(acp: AcpPackage, data: string, env?: NodeJS.ProcessEnv): string;
18
- /** Why Goose is not listed here (HarnessEntry.hidden): not installed, or not the pinned binary, in words that end with what
19
- * to do, restarting AgentRun included (its harnesses are read at its start). Undefined once it is installed and verified.
20
- * The binary's sha256 is kept once per file identity (the package's check), so only the first look reads it. */
21
- export declare function gooseHidden(env: NodeJS.ProcessEnv): string | undefined;
22
- /** Why Goose cannot run here, its binary checked off the event loop; undefined when it can (with the binary to run). */
23
- export declare function gooseMissing(env: NodeJS.ProcessEnv): Promise<{
24
- missing: GooseMissing;
2
+ /** Goose as an owner-installed harness: its pin, its install line and its not-installed code are its package's. */
3
+ export declare const GOOSE: import("./harness-owned.js").OwnerInstalled;
4
+ export declare const gooseHidden: (env: NodeJS.ProcessEnv) => string | undefined, gooseMissing: (env: NodeJS.ProcessEnv) => Promise<{
5
+ missing: import("./harness-owned.js").OwnerMissing;
25
6
  } | {
26
7
  binary: string;
27
8
  sha256: string;
28
9
  }>;
29
- /** Installs the pinned Goose into `data` (agentrun-serve install-harness goose). */
30
- export declare function installGoose(data: string, options?: ArchiveInstallOptions, env?: NodeJS.ProcessEnv): Promise<{
31
- installed: "already" | "now";
32
- binary: string;
33
- version: string;
34
- }>;
@@ -1,87 +1,7 @@
1
- // Goose on this server: where its owner installs it (`<data>/harnesses/goose/goose`, by `agentrun harness install goose`,
2
- // harness-archive.ts), the command that does, and whether the binary there is the pinned one. Nothing here downloads:
3
- // a run, a save and the start's probe only look at what is installed, and say the command where it is not.
4
- import { existsSync } from "node:fs";
5
- import { homedir } from "node:os";
6
- import { join, resolve } from "node:path";
7
- import { acpPackage } from "./acp-package.js";
8
- import { installArchive } from "./harness-archive.js";
9
- import { installDirOf, shellWord } from "./harness-install.js";
10
- import { DATA_ENV, defaultData } from "./server-fs.js";
1
+ // Goose on this server: installed by its owner (`<data>/harnesses/goose/goose`, by `agentrun harness install goose`),
2
+ // held to its pinned binary (harness-owned.ts).
3
+ import { ownerInstalled } from "./harness-owned.js";
11
4
  export const GOOSE_ID = "goose";
12
- /** The data directory `env` names (the server's own, else the default one). */
13
- const dataOf = (env) => env[DATA_ENV] || defaultData(env);
14
- /** Goose's folder in `data`, and its binary there. */
15
- export const gooseDirOf = (data) => installDirOf(data, GOOSE_ID);
16
- export const gooseBinaryOf = (data) => join(gooseDirOf(data), GOOSE_ID);
17
- /** The agentrun command's own data directory, where `npx @parcha/agentrun` keeps its server's store (~/.agentrun: not the
18
- * server's own default, defaultData), and so where `agentrun harness install` installs with no --data. */
19
- export const commandData = (env) => join(env.HOME || homedir(), ".agentrun");
20
- /** The command that installs Goose into `data`: naming it with --data unless it is the agentrun command's own (commandData). */
21
- export function gooseInstallLine(acp, data, env = process.env) {
22
- return resolve(data) === commandData(env) ? acp.GOOSE_INSTALL : `${acp.GOOSE_INSTALL} --data ${shellWord(data)}`;
23
- }
24
- /** What is known of Goose in `env`'s data before its binary is read: why it is missing, or the binary and the digest it
25
- * must have, with how a refused check is said. */
26
- function lookup(env) {
27
- const acp = acpPackage();
28
- if (!acp)
29
- return { missing: { code: "HARNESS_NOT_INSTALLED", message: "HARNESS_NOT_INSTALLED: Goose's adapter (@parcha/agentrun-harness-acp) is not installed beside this server" } };
30
- const data = dataOf(env);
31
- const binary = gooseBinaryOf(data);
32
- const line = gooseInstallLine(acp, data, env);
33
- const { version, archives } = acp.GOOSE_PIN;
34
- const platform = acp.acpPlatform();
35
- const sha256 = platform ? archives[platform]?.binarySha256 : undefined;
36
- if (!sha256)
37
- return { missing: { code: "ACP_BINARY_UNPINNED", message: `ACP_BINARY_UNPINNED: Goose ${version} has no binary pinned for ${platform ?? `${process.platform}-${process.arch}`}, so it does not run here` } };
38
- if (!existsSync(binary))
39
- return { missing: { code: acp.GOOSE_NOT_INSTALLED, message: `${acp.GOOSE_NOT_INSTALLED}: Goose ${version} is not installed in ${gooseDirOf(data)}. Install it with: ${line}` } };
40
- return {
41
- acp, binary, sha256,
42
- refused: (error) => {
43
- const code = error?.code;
44
- return { code: typeof code === "string" ? code : acp.GOOSE_NOT_INSTALLED, message: `${error.message}. Install Goose ${version} again with: ${line}` };
45
- },
46
- };
47
- }
48
- /** Why Goose is not listed here (HarnessEntry.hidden): not installed, or not the pinned binary, in words that end with what
49
- * to do, restarting AgentRun included (its harnesses are read at its start). Undefined once it is installed and verified.
50
- * The binary's sha256 is kept once per file identity (the package's check), so only the first look reads it. */
51
- export function gooseHidden(env) {
52
- const found = lookup(env);
53
- let missing;
54
- if ("missing" in found)
55
- missing = found.missing;
56
- else {
57
- try {
58
- found.acp.verifyPinnedBinary(found.binary, found.sha256);
59
- }
60
- catch (error) {
61
- missing = found.refused(error);
62
- }
63
- }
64
- return missing && `${missing.message}; then restart AgentRun.`;
65
- }
66
- /** Why Goose cannot run here, its binary checked off the event loop; undefined when it can (with the binary to run). */
67
- export async function gooseMissing(env) {
68
- const found = lookup(env);
69
- if ("missing" in found)
70
- return found;
71
- try {
72
- await found.acp.verifyPinnedBinaryAsync(found.binary, found.sha256);
73
- }
74
- catch (error) {
75
- return { missing: found.refused(error) };
76
- }
77
- return { binary: found.binary, sha256: found.sha256 };
78
- }
79
- /** Installs the pinned Goose into `data` (agentrun-serve install-harness goose). */
80
- export async function installGoose(data, options = {}, env = process.env) {
81
- const acp = acpPackage();
82
- if (!acp)
83
- throw new Error("Goose's adapter (@parcha/agentrun-harness-acp) is not installed beside this server, so it has no pin to install from");
84
- const { id, version, archives } = acp.GOOSE_PIN;
85
- const platform = acp.acpPlatform();
86
- return { version, ...(await installArchive({ id, label: "Goose", retry: gooseInstallLine(acp, data, env), pin: { version, archives } }, gooseDirOf(data), { ...(platform ? { platform } : {}), ...options })) };
87
- }
5
+ /** Goose as an owner-installed harness: its pin, its install line and its not-installed code are its package's. */
6
+ export const GOOSE = ownerInstalled({ id: GOOSE_ID, label: "Goose", pin: (acp) => acp.GOOSE_PIN, installLine: (acp) => acp.GOOSE_INSTALL, notInstalled: (acp) => acp.GOOSE_NOT_INSTALLED });
7
+ export const { hidden: gooseHidden, missing: gooseMissing } = GOOSE;
@@ -0,0 +1,4 @@
1
+ export type { AcpEntryOptions, HarnessEntry, HarnessModuleKit, HarnessPromises, HarnessTableModule, ModuleChecks, ModuleLaunch, Refusal, SessionRoute } from "./harness-table.js";
2
+ export type { HarnessLaunch, RunnerHarness } from "./runner/adapters/index.js";
3
+ export type { AdapterNeeds } from "./adapters.js";
4
+ export type { ModelChoice } from "./provider.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,52 @@
1
+ import { type AcpPackage, type AcpPin } from "./acp-package.js";
2
+ import { type ArchiveInstallOptions, installArchive } from "./harness-archive.js";
3
+ /** Why an owner-installed harness does not run here: a code (HARNESS_NOT_INSTALLED, ACP_BINARY_MISMATCH,
4
+ * ACP_BINARY_UNPINNED, ...) and words that start with it and end with what to do. */
5
+ export type OwnerMissing = {
6
+ readonly code: string;
7
+ readonly message: string;
8
+ };
9
+ /** The agentrun command's own data directory, where `npx @parcha/agentrun` keeps its server's store (~/.agentrun: not the
10
+ * server's own default, defaultData), and so where `agentrun harness install` installs with no --data. */
11
+ export declare const commandData: (env: NodeJS.ProcessEnv) => string;
12
+ /** What an owner-installed harness is, from the ACP package: its pin, the command that installs it and the code a
13
+ * missing install is refused by. `tree`: its release is pinned by the digest of every file it unpacks to, its launcher
14
+ * among them (Cursor's), not by its binary alone (Goose's). */
15
+ export interface OwnerInstalledSpec {
16
+ readonly id: string;
17
+ readonly label: string;
18
+ readonly pin: (acp: AcpPackage) => AcpPin;
19
+ readonly installLine: (acp: AcpPackage) => string;
20
+ readonly notInstalled: (acp: AcpPackage) => string;
21
+ readonly tree?: boolean;
22
+ }
23
+ /** An owner-installed harness on this server. */
24
+ export interface OwnerInstalled {
25
+ readonly id: string;
26
+ readonly label: string;
27
+ /** What the install's last step checks, as the installer says it. */
28
+ readonly verified: string;
29
+ /** Its folder in `data`. */
30
+ dirOf(data: string): string;
31
+ /** The command that installs it into `data`: naming it with --data unless it is the agentrun command's own. */
32
+ installLine(acp: AcpPackage, data: string, env?: NodeJS.ProcessEnv): string;
33
+ /** Why it is not listed here (HarnessEntry.hidden): not installed, or its binary not the pinned one, in words that end
34
+ * with what to do, restarting AgentRun included (its harnesses are read at its start). Undefined once it is. The
35
+ * binary's sha256 is kept once per file identity (the package's check), so only the first look reads it; a tree is
36
+ * checked off the event loop, by `missing` at each run and the start's probe. */
37
+ hidden(env: NodeJS.ProcessEnv): string | undefined;
38
+ /** Why it cannot run here, its binary (or every file of its tree) checked off the event loop; else its binary, with the
39
+ * binary's pinned sha256. */
40
+ missing(env: NodeJS.ProcessEnv): Promise<{
41
+ missing: OwnerMissing;
42
+ } | {
43
+ binary: string;
44
+ sha256: string;
45
+ }>;
46
+ /** Installs its pinned release into `data` (agentrun-serve install-harness <id>). */
47
+ install(data: string, options?: ArchiveInstallOptions, env?: NodeJS.ProcessEnv): Promise<{
48
+ version: string;
49
+ } & Awaited<ReturnType<typeof installArchive>>>;
50
+ }
51
+ /** `spec`'s harness on this server. */
52
+ export declare function ownerInstalled(spec: OwnerInstalledSpec): OwnerInstalled;
@@ -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
+ }
@@ -1,33 +1,11 @@
1
- // A harness recipe (door 1 of bring your own harness): a JSON file that says how to run an ACP agent AgentRun does not
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-goose.js";
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";
@@ -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): absent on a built-in, whose runner is the
45
- * runner's own (RUNNER_HARNESSES); a harness module's entry brings its own. */
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 test's table module exports: entries by id, each merged over the built-in one of that id (all of it, for one
91
- * the server has none of), given the built-ins to build on. Loaded with require: the module has no top-level await. */
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>>): Record<string, Partial<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. */