@parcha/agentrun-serve 0.0.0-bootstrap.0 → 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.
Files changed (229) hide show
  1. package/CHANGELOG.md +560 -0
  2. package/LICENSE +202 -0
  3. package/NOTICE +5 -0
  4. package/README.md +1724 -0
  5. package/dist/adapters.d.ts +205 -0
  6. package/dist/adapters.js +459 -0
  7. package/dist/agents.d.ts +124 -0
  8. package/dist/agents.js +302 -0
  9. package/dist/app.d.ts +7 -0
  10. package/dist/app.js +324 -0
  11. package/dist/bound-files.d.ts +4 -0
  12. package/dist/bound-files.js +164 -0
  13. package/dist/box/record.d.ts +6 -0
  14. package/dist/box/record.js +41 -0
  15. package/dist/box/sweep.d.ts +53 -0
  16. package/dist/box/sweep.js +193 -0
  17. package/dist/box-image.d.ts +98 -0
  18. package/dist/box-image.js +283 -0
  19. package/dist/box-relay.d.ts +42 -0
  20. package/dist/box-relay.js +222 -0
  21. package/dist/boxes.d.ts +54 -0
  22. package/dist/boxes.js +182 -0
  23. package/dist/cap.d.ts +224 -0
  24. package/dist/cap.js +721 -0
  25. package/dist/catalog.d.ts +20 -0
  26. package/dist/catalog.js +53 -0
  27. package/dist/cli.d.ts +2 -0
  28. package/dist/cli.js +167 -0
  29. package/dist/coding-tools.d.ts +31 -0
  30. package/dist/coding-tools.js +81 -0
  31. package/dist/console/THIRD-PARTY-NOTICES.txt +1141 -0
  32. package/dist/console/assets/index-BN7oVcO4.js +445 -0
  33. package/dist/console/assets/index-By-jkqki.css +1 -0
  34. package/dist/console/assets/jetbrains-mono-cyrillic-400-normal-BEIGL1Tu.woff2 +0 -0
  35. package/dist/console/assets/jetbrains-mono-cyrillic-400-normal-CIEtRijs.woff +0 -0
  36. package/dist/console/assets/jetbrains-mono-cyrillic-600-normal-BB5xRk30.woff +0 -0
  37. package/dist/console/assets/jetbrains-mono-cyrillic-600-normal-EVf6-Yzo.woff2 +0 -0
  38. package/dist/console/assets/jetbrains-mono-cyrillic-ext-400-normal-BHyURHCj.woff +0 -0
  39. package/dist/console/assets/jetbrains-mono-cyrillic-ext-400-normal-C_uLvvQ5.woff2 +0 -0
  40. package/dist/console/assets/jetbrains-mono-cyrillic-ext-600-normal-Dj6eZy5f.woff2 +0 -0
  41. package/dist/console/assets/jetbrains-mono-cyrillic-ext-600-normal-DpeVePZf.woff +0 -0
  42. package/dist/console/assets/jetbrains-mono-greek-400-normal-C190GLew.woff2 +0 -0
  43. package/dist/console/assets/jetbrains-mono-greek-400-normal-CNojz0t3.woff +0 -0
  44. package/dist/console/assets/jetbrains-mono-greek-600-normal-3KAm9r92.woff +0 -0
  45. package/dist/console/assets/jetbrains-mono-greek-600-normal-H7WoG9Et.woff2 +0 -0
  46. package/dist/console/assets/jetbrains-mono-latin-400-normal-B11XCQ5g.woff +0 -0
  47. package/dist/console/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
  48. package/dist/console/assets/jetbrains-mono-latin-600-normal-C8RAYTDA.woff2 +0 -0
  49. package/dist/console/assets/jetbrains-mono-latin-600-normal-DXv3JcnD.woff +0 -0
  50. package/dist/console/assets/jetbrains-mono-latin-ext-400-normal-Bc8Ftmh3.woff2 +0 -0
  51. package/dist/console/assets/jetbrains-mono-latin-ext-400-normal-DHMOLxAi.woff +0 -0
  52. package/dist/console/assets/jetbrains-mono-latin-ext-600-normal-BfB_LPfz.woff2 +0 -0
  53. package/dist/console/assets/jetbrains-mono-latin-ext-600-normal-DiQlUoE6.woff +0 -0
  54. package/dist/console/assets/jetbrains-mono-vietnamese-400-normal-BeU3T8wf.woff +0 -0
  55. package/dist/console/assets/jetbrains-mono-vietnamese-400-normal-ByoDsISC.woff2 +0 -0
  56. package/dist/console/assets/jetbrains-mono-vietnamese-600-normal-CSpzN4cI.woff +0 -0
  57. package/dist/console/assets/jetbrains-mono-vietnamese-600-normal-Dtizs43-.woff2 +0 -0
  58. package/dist/console/assets/schibsted-grotesk-latin-400-normal-Cph9ettZ.woff2 +0 -0
  59. package/dist/console/assets/schibsted-grotesk-latin-400-normal-DfGZKnlb.woff +0 -0
  60. package/dist/console/assets/schibsted-grotesk-latin-600-normal-BGBUNdzT.woff2 +0 -0
  61. package/dist/console/assets/schibsted-grotesk-latin-600-normal-COje25QW.woff +0 -0
  62. package/dist/console/assets/schibsted-grotesk-latin-ext-400-normal-4l4lq8zr.woff2 +0 -0
  63. package/dist/console/assets/schibsted-grotesk-latin-ext-400-normal-BGzXWJeR.woff +0 -0
  64. package/dist/console/assets/schibsted-grotesk-latin-ext-600-normal-8_E36CQj.woff2 +0 -0
  65. package/dist/console/assets/schibsted-grotesk-latin-ext-600-normal-C27an7Zc.woff +0 -0
  66. package/dist/console/index.html +15 -0
  67. package/dist/daytona-api.d.ts +21 -0
  68. package/dist/daytona-api.js +101 -0
  69. package/dist/decision-rows.d.ts +11 -0
  70. package/dist/decision-rows.js +116 -0
  71. package/dist/decisions.d.ts +94 -0
  72. package/dist/decisions.js +184 -0
  73. package/dist/effort-guidance.d.ts +5 -0
  74. package/dist/effort-guidance.js +14 -0
  75. package/dist/environment.d.ts +5 -0
  76. package/dist/environment.js +11 -0
  77. package/dist/errors.d.ts +72 -0
  78. package/dist/errors.js +66 -0
  79. package/dist/exa-keyless.d.ts +35 -0
  80. package/dist/exa-keyless.js +202 -0
  81. package/dist/fetch-page.d.ts +114 -0
  82. package/dist/fetch-page.js +182 -0
  83. package/dist/files.d.ts +60 -0
  84. package/dist/files.js +153 -0
  85. package/dist/grade.d.ts +96 -0
  86. package/dist/grade.js +348 -0
  87. package/dist/graph-view.d.ts +100 -0
  88. package/dist/graph-view.js +212 -0
  89. package/dist/harness-app.d.ts +38 -0
  90. package/dist/harness-app.js +626 -0
  91. package/dist/harness.d.ts +53 -0
  92. package/dist/harness.js +74 -0
  93. package/dist/home-path.d.ts +27 -0
  94. package/dist/home-path.js +78 -0
  95. package/dist/host-tools.d.ts +20 -0
  96. package/dist/host-tools.js +140 -0
  97. package/dist/host.d.ts +39 -0
  98. package/dist/host.js +81 -0
  99. package/dist/hosted-search.d.ts +27 -0
  100. package/dist/hosted-search.js +129 -0
  101. package/dist/import-sources.d.ts +104 -0
  102. package/dist/import-sources.js +629 -0
  103. package/dist/import-summary.d.ts +25 -0
  104. package/dist/import-summary.js +75 -0
  105. package/dist/import-worker.d.ts +26 -0
  106. package/dist/import-worker.js +41 -0
  107. package/dist/import.d.ts +145 -0
  108. package/dist/import.js +1221 -0
  109. package/dist/index.d.ts +7 -0
  110. package/dist/index.js +6 -0
  111. package/dist/key-check.d.ts +36 -0
  112. package/dist/key-check.js +108 -0
  113. package/dist/key-refusal.d.ts +51 -0
  114. package/dist/key-refusal.js +187 -0
  115. package/dist/learn/check.d.ts +99 -0
  116. package/dist/learn/check.js +259 -0
  117. package/dist/learn/grade.d.ts +79 -0
  118. package/dist/learn/grade.js +433 -0
  119. package/dist/learn/index.d.ts +7 -0
  120. package/dist/learn/index.js +11 -0
  121. package/dist/learn/invisible.d.ts +5 -0
  122. package/dist/learn/invisible.js +42 -0
  123. package/dist/learn/notes.d.ts +59 -0
  124. package/dist/learn/notes.js +146 -0
  125. package/dist/learn/reflect.d.ts +49 -0
  126. package/dist/learn/reflect.js +167 -0
  127. package/dist/learn/secrets.d.ts +18 -0
  128. package/dist/learn/secrets.js +111 -0
  129. package/dist/learn/skills.d.ts +84 -0
  130. package/dist/learn/skills.js +198 -0
  131. package/dist/learning-routes.d.ts +196 -0
  132. package/dist/learning-routes.js +609 -0
  133. package/dist/learning-run.d.ts +304 -0
  134. package/dist/learning-run.js +797 -0
  135. package/dist/learning-words.d.ts +73 -0
  136. package/dist/learning-words.js +171 -0
  137. package/dist/learning.d.ts +377 -0
  138. package/dist/learning.js +801 -0
  139. package/dist/llm.d.ts +40 -0
  140. package/dist/llm.js +37 -0
  141. package/dist/llms.txt +37 -0
  142. package/dist/mcp-servers.d.ts +115 -0
  143. package/dist/mcp-servers.js +445 -0
  144. package/dist/mcp.d.ts +51 -0
  145. package/dist/mcp.js +392 -0
  146. package/dist/model.d.ts +184 -0
  147. package/dist/model.js +484 -0
  148. package/dist/monid.d.ts +74 -0
  149. package/dist/monid.js +277 -0
  150. package/dist/openapi/agentrun-v2.openapi.json +4805 -0
  151. package/dist/openapi.d.ts +10 -0
  152. package/dist/openapi.js +1417 -0
  153. package/dist/owner.d.ts +55 -0
  154. package/dist/owner.js +222 -0
  155. package/dist/packs.d.ts +71 -0
  156. package/dist/packs.js +180 -0
  157. package/dist/page.d.ts +32 -0
  158. package/dist/page.js +133 -0
  159. package/dist/paid-calls.d.ts +46 -0
  160. package/dist/paid-calls.js +110 -0
  161. package/dist/pause.d.ts +68 -0
  162. package/dist/pause.js +97 -0
  163. package/dist/pdf-pages.d.ts +44 -0
  164. package/dist/pdf-pages.js +147 -0
  165. package/dist/place.d.ts +46 -0
  166. package/dist/place.js +105 -0
  167. package/dist/print.d.ts +20 -0
  168. package/dist/print.js +29 -0
  169. package/dist/propose.d.ts +38 -0
  170. package/dist/propose.js +82 -0
  171. package/dist/quiet-sqlite-warning.d.ts +1 -0
  172. package/dist/quiet-sqlite-warning.js +14 -0
  173. package/dist/request-start.d.ts +14 -0
  174. package/dist/request-start.js +226 -0
  175. package/dist/result.d.ts +3 -0
  176. package/dist/result.js +5 -0
  177. package/dist/rows.d.ts +46 -0
  178. package/dist/rows.js +121 -0
  179. package/dist/run-box.d.ts +134 -0
  180. package/dist/run-box.js +440 -0
  181. package/dist/run-manifest.d.ts +27 -0
  182. package/dist/run-manifest.js +60 -0
  183. package/dist/runnable.d.ts +80 -0
  184. package/dist/runnable.js +162 -0
  185. package/dist/runs.d.ts +840 -0
  186. package/dist/runs.js +2279 -0
  187. package/dist/secret-cut.d.ts +27 -0
  188. package/dist/secret-cut.js +109 -0
  189. package/dist/secrets.d.ts +50 -0
  190. package/dist/secrets.js +140 -0
  191. package/dist/server-lock.d.ts +44 -0
  192. package/dist/server-lock.js +140 -0
  193. package/dist/server.d.ts +626 -0
  194. package/dist/server.js +1756 -0
  195. package/dist/sessions.d.ts +4 -0
  196. package/dist/sessions.js +105 -0
  197. package/dist/skills.d.ts +31 -0
  198. package/dist/skills.js +68 -0
  199. package/dist/stats.d.ts +101 -0
  200. package/dist/stats.js +82 -0
  201. package/dist/tool-keys.d.ts +151 -0
  202. package/dist/tool-keys.js +273 -0
  203. package/dist/tool-plane.d.ts +143 -0
  204. package/dist/tool-plane.js +242 -0
  205. package/dist/tools.d.ts +147 -0
  206. package/dist/tools.js +253 -0
  207. package/dist/turn-end.d.ts +23 -0
  208. package/dist/turn-end.js +14 -0
  209. package/dist/turns.d.ts +34 -0
  210. package/dist/turns.js +202 -0
  211. package/dist/uploads.d.ts +104 -0
  212. package/dist/uploads.js +474 -0
  213. package/dist/usage.d.ts +29 -0
  214. package/dist/usage.js +58 -0
  215. package/dist/validate.d.ts +55 -0
  216. package/dist/validate.js +175 -0
  217. package/dist/web-fetch.d.ts +64 -0
  218. package/dist/web-fetch.js +262 -0
  219. package/dist/web-search.d.ts +54 -0
  220. package/dist/web-search.js +136 -0
  221. package/dist/webhooks.d.ts +182 -0
  222. package/dist/webhooks.js +487 -0
  223. package/dist/workspace-paths.d.ts +33 -0
  224. package/dist/workspace-paths.js +104 -0
  225. package/dist/workspace.d.ts +88 -0
  226. package/dist/workspace.js +369 -0
  227. package/launcher/agentrun-serve +109 -0
  228. package/package.json +96 -1
  229. package/skills/agentrun-serve/SKILL.md +128 -0
package/dist/llm.d.ts ADDED
@@ -0,0 +1,40 @@
1
+ import type { ModelThinkingLevel } from "@earendil-works/pi-ai";
2
+ export declare const LLM_TOOL = "llm";
3
+ export type LlmAnswer = {
4
+ text: string;
5
+ model: string;
6
+ usage: {
7
+ input_tokens: number;
8
+ output_tokens: number;
9
+ cached_input_tokens: number;
10
+ } | null;
11
+ cost_usd: number | null;
12
+ };
13
+ /** What the run's process gives the tool: one completion on its models. */
14
+ export type Complete = (args: Record<string, unknown>, signal: AbortSignal) => Promise<LlmAnswer>;
15
+ type Models = {
16
+ getModel(provider: string, id: string): unknown;
17
+ completeSimple(model: never, context: never, options?: never): Promise<{
18
+ content: {
19
+ type: string;
20
+ text?: string;
21
+ }[];
22
+ usage?: {
23
+ input: number;
24
+ output: number;
25
+ cacheRead?: number;
26
+ cacheWrite?: number;
27
+ cost?: {
28
+ total: number;
29
+ };
30
+ };
31
+ stopReason?: string;
32
+ errorMessage?: string;
33
+ }>;
34
+ };
35
+ /** The completer over `models`, each call on `pick(tier)`'s model at `thinking`. */
36
+ export declare function completer(models: Models, pick: (tier: string | undefined) => {
37
+ provider: string;
38
+ modelId: string;
39
+ } | undefined, thinking: ModelThinkingLevel): Complete;
40
+ export {};
package/dist/llm.js ADDED
@@ -0,0 +1,37 @@
1
+ export const LLM_TOOL = "llm";
2
+ const MAX_PROMPT = 400_000;
3
+ /** The completer over `models`, each call on `pick(tier)`'s model at `thinking`. */
4
+ export function completer(models, pick, thinking) {
5
+ return async (args, signal) => {
6
+ const { prompt, system, maxTokens, tier } = args;
7
+ if (typeof prompt !== "string" || !prompt.trim())
8
+ throw new Error("llm: prompt is a non-empty string");
9
+ if (prompt.length > MAX_PROMPT)
10
+ throw new Error(`llm: prompt is at most ${MAX_PROMPT} characters`);
11
+ if (system !== undefined && typeof system !== "string")
12
+ throw new Error("llm: system is a string");
13
+ if (maxTokens !== undefined && (typeof maxTokens !== "number" || !Number.isInteger(maxTokens) || maxTokens < 1 || maxTokens > 64_000))
14
+ throw new Error("llm: maxTokens is an integer from 1 to 64000");
15
+ if (tier !== undefined && !["fast", "default", "strong"].includes(tier))
16
+ throw new Error("llm: tier is fast, default or strong");
17
+ // Only a call that names no tier gets the default: a tier the run has no model for is refused, never answered by
18
+ // another tier's model.
19
+ const ref = pick(tier);
20
+ if (!ref)
21
+ throw new Error(tier === undefined ? "llm: this run has no model" : `llm: tier ${tier} has no model in this run`);
22
+ const model = models.getModel(ref.provider, ref.modelId);
23
+ if (!model)
24
+ throw new Error(`llm: the model ${ref.provider}/${ref.modelId} is not known here`);
25
+ const context = { ...(system ? { systemPrompt: system } : {}), messages: [{ role: "user", content: prompt, timestamp: Date.now() }] };
26
+ const message = await models.completeSimple(model, context, { signal, reasoning: thinking, ...(maxTokens ? { maxTokens } : {}) });
27
+ if (message.stopReason === "error" || message.stopReason === "aborted")
28
+ throw new Error(`llm: ${message.errorMessage ?? message.stopReason}`);
29
+ const text = message.content.filter((part) => part.type === "text").map((part) => part.text ?? "").join("");
30
+ const priced = (model.cost?.input ?? 0) + (model.cost?.output ?? 0) > 0;
31
+ // pi-ai counts cache reads and writes apart from `input`: the prompt's tokens are all three.
32
+ const cached = (message.usage?.cacheRead ?? 0) + (message.usage?.cacheWrite ?? 0);
33
+ const usage = message.usage ? { input_tokens: message.usage.input + cached, output_tokens: message.usage.output, cached_input_tokens: cached } : null;
34
+ const cost = priced && typeof message.usage?.cost?.total === "number" ? message.usage.cost.total : null;
35
+ return { text, model: `${ref.provider}/${ref.modelId}`, usage, cost_usd: cost };
36
+ };
37
+ }
package/dist/llms.txt ADDED
@@ -0,0 +1,37 @@
1
+ # AgentRun Server
2
+
3
+ > The open platform's server for agents: make an agent (a prompt with tools, or a typed workflow), run it, and read what it did, over one HTTP API at `/v2`, an MCP endpoint at `/v2/mcp`, and a CLI. Every run is kept, with its timeline, its files and its cost.
4
+
5
+ Auth: the API's routes take `Authorization: Bearer <token>`, all but `GET /v2/health`, `GET /v2/capabilities` and `GET /v2/openapi.json`; this file needs none. The MCP endpoint takes the Bearer token only. The token is the server's data directory's `.token` (`--data DIR`; without it, `$XDG_DATA_HOME/agentrun/agents`, else `~/.local/share/agentrun/agents`), or `AGENTRUN_TOKEN` when the server was started with it. Never print it. Links below are relative to this server.
6
+
7
+ ## Start
8
+
9
+ - In a checkout of the repository: `npm ci --ignore-scripts && npm run build`, then `node packages/serve/dist/cli.js --data DIR` (installed, `agentrun-serve --data DIR`). `--faux MODULE` answers every model request from a module, with no key and no network; `--port N` (default 7340).
10
+ - It prints `AGENTRUN_BASE_URL=...` at every start, and `AGENTRUN_API_KEY=...` with the token at the start that made it (later starts say where it is kept).
11
+ - `GET /v2/health` says when it is ready.
12
+
13
+ ## API
14
+
15
+ - [OpenAPI document](/v2/openapi.json): every route and schema, the `agentrun.v2/0` contract with this server's own routes marked `x-agentrun-serve`.
16
+ - [Capabilities](/v2/capabilities): the harnesses, tools, models and efforts this server has, and what it does not offer.
17
+ - `POST /v2/agents` with `{definition: {name, instructions, tools, harness?, model?, thinking?}}` makes an agent (a workflow one holds `workflow` in place of `instructions`). A refusal is `422 input_invalid` naming each field. `PUT /v2/agents/{id}/definition` makes its next revision.
18
+ - `POST /v2/agents/{id}/runs` with `{input, file_ids?, effort?, revision?}` starts a run, answered at once, queued. An agentic run's input is `{content: "the first message"}`. An `Idempotency-Key` header makes a retry safe.
19
+ - `POST /v2/files?path=notes.md` with the file's bytes as the body (`curl --data-binary @notes.md`) uploads a file, answered `201` with the file, ready, its `file_id` under `file`. Name it in a run's `file_ids`, and the run finds it at `inputs/notes.md`. `GET /v2/files` lists the uploads, `DELETE /v2/files/{id}` removes one.
20
+ - `GET /v2/runs/{id}`: status (`queued`, `working`, `input_required`, `completed`, `failed`, `cancelled`, `paused`), `result` (`final_answer`, or a workflow's `output`), `error`, `cost` (`usd` is null while unknown, never $0).
21
+ - `GET /v2/runs/{id}/timeline?after=0&limit=100` pages its steps; follow `next_after` until a page is `final` with `has_more` false.
22
+ - `GET /v2/runs/{id}/files`, then `GET /v2/runs/{id}/files/{path}`: what it wrote.
23
+ - `POST /v2/runs/{id}/messages` with `{content}` answers a run that asked a question (`input_required`), or follows up; `POST /v2/runs/{id}/cancel` ends one.
24
+ - The console, for a person: `/`, a run at `/#/runs/{id}`.
25
+
26
+ ## MCP
27
+
28
+ - [MCP endpoint](/v2/mcp): Streamable HTTP, one JSON-RPC message per POST, answered as JSON, stateless. Ten tools: `whoami`, `agents_list`, `agents_create`, `agents_revise`, `runs_start`, `runs_get`, `runs_events`, `runs_files`, `runs_respond`, `runs_cancel`. Each calls the routes above and answers as they do; a refusal is a tool error holding the route's `error`.
29
+ - A run is started, then polled: `runs_start`, then `runs_get` every few seconds until `completed`, `failed` or `cancelled`. `input_required` is a question (`runs_get`'s `pending`), answered with `runs_respond` or by a person in the console.
30
+ - A cancelled run cannot be continued: `runs_respond` to it is `409 not_continuable`; start a new run. A stopped run (`POST /v2/runs/{id}/stop`, or Stop in the console) can: a follow-up starts a fresh turn with its history, and the cut turn is not replayed.
31
+ - Claude Code: `claude mcp add --transport http agentrun "$AGENTRUN_BASE_URL/mcp" --header "Authorization: Bearer $AGENTRUN_API_KEY"`.
32
+ - Codex: `codex mcp add agentrun --url "$AGENTRUN_BASE_URL/mcp" --bearer-token-env-var AGENTRUN_API_KEY`.
33
+
34
+ ## Optional
35
+
36
+ - [Skill for coding agents](https://github.com/Parcha-ai/agentrun/blob/main/packages/serve/skills/agentrun-serve/SKILL.md): check the server, the token, connect over MCP, create an agent, run it and answer it, step by step.
37
+ - [README](https://github.com/Parcha-ai/agentrun/blob/main/packages/serve/README.md): every flag, model, tool and route.
@@ -0,0 +1,115 @@
1
+ export declare const MCP_SERVERS_FILE = "mcp-servers.json";
2
+ export declare const MCP_SERVER_NAME: RegExp;
3
+ export declare const MCP_AUTH_TYPES: readonly ["none", "bearer", "headers"];
4
+ export type McpTool = {
5
+ name: string;
6
+ title?: string;
7
+ description?: string;
8
+ input_schema: unknown;
9
+ output_schema?: unknown;
10
+ annotations?: unknown;
11
+ };
12
+ type Listed = {
13
+ protocol: string;
14
+ server_info: unknown;
15
+ instructions?: string;
16
+ tools: McpTool[];
17
+ };
18
+ export declare class McpServers {
19
+ private readonly version;
20
+ readonly file: string;
21
+ private readonly key;
22
+ private readonly sealCheck;
23
+ constructor(data: string, env: NodeJS.ProcessEnv, version: string);
24
+ get atRest(): "sealed" | "unavailable";
25
+ list(): {
26
+ servers: never[];
27
+ file_unreadable: true;
28
+ } | {
29
+ servers: {
30
+ auth: {
31
+ headers?: string[] | undefined;
32
+ type: "none" | "headers" | "bearer";
33
+ };
34
+ credential: "unreadable" | "seal_key_missing" | "sealed" | null;
35
+ protocol: string;
36
+ server_info: unknown;
37
+ instructions?: string;
38
+ tools: McpTool[];
39
+ url: string;
40
+ listed_at: string;
41
+ updated_at: string;
42
+ name: string;
43
+ }[];
44
+ file_unreadable?: undefined;
45
+ };
46
+ get(name: string): {
47
+ auth: {
48
+ headers?: string[] | undefined;
49
+ type: "none" | "headers" | "bearer";
50
+ };
51
+ credential: "unreadable" | "seal_key_missing" | "sealed" | null;
52
+ protocol: string;
53
+ server_info: unknown;
54
+ instructions?: string;
55
+ tools: McpTool[];
56
+ url: string;
57
+ listed_at: string;
58
+ updated_at: string;
59
+ name: string;
60
+ };
61
+ /** POST preview: `{url, auth}`, or `{name}` for a saved server with its sealed credential. Stores nothing. */
62
+ preview(body: Record<string, unknown>, stop?: AbortSignal): Promise<Listed>;
63
+ /** PUT: preview, then keep the server with the tools listed. A body with no credential keeps the sealed one, while
64
+ * the auth type and the URL's origin stay the same. */
65
+ save(name: string, body: Record<string, unknown>, stop?: AbortSignal): Promise<{
66
+ auth: {
67
+ headers?: string[] | undefined;
68
+ type: "none" | "headers" | "bearer";
69
+ };
70
+ credential: "unreadable" | "seal_key_missing" | "sealed" | null;
71
+ protocol: string;
72
+ server_info: unknown;
73
+ instructions?: string;
74
+ tools: McpTool[];
75
+ url: string;
76
+ listed_at: string;
77
+ updated_at: string;
78
+ name: string;
79
+ }>;
80
+ /** POST refresh: list the saved server's tools again, keep them, and say what was added, removed and changed. */
81
+ refresh(name: string, stop?: AbortSignal): Promise<{
82
+ added: string[];
83
+ removed: string[];
84
+ changed: string[];
85
+ server: {
86
+ auth: {
87
+ headers?: string[] | undefined;
88
+ type: "none" | "headers" | "bearer";
89
+ };
90
+ credential: "unreadable" | "seal_key_missing" | "sealed" | null;
91
+ protocol: string;
92
+ server_info: unknown;
93
+ instructions?: string;
94
+ tools: McpTool[];
95
+ url: string;
96
+ listed_at: string;
97
+ updated_at: string;
98
+ name: string;
99
+ };
100
+ }>;
101
+ remove(name: string): void;
102
+ private need;
103
+ private view;
104
+ private open;
105
+ /** The saved credential, opened, or the refusal that asks for it again. */
106
+ private opened;
107
+ /** A body's URL and auth, or 422. */
108
+ private admit;
109
+ /** The saved servers: none with no file, "unreadable" when the file does not read as this format. */
110
+ private kept;
111
+ /** The saved servers, or 409: a file that does not read is never written over, so no saved server is lost to it. */
112
+ private servers;
113
+ private write;
114
+ }
115
+ export {};