@parcha/agentrun-serve 0.1.0-beta.53 → 0.1.0-beta.55

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 (224) hide show
  1. package/CHANGELOG.md +138 -3
  2. package/README.md +346 -99
  3. package/dist/adapters.d.ts +10 -0
  4. package/dist/adapters.js +46 -0
  5. package/dist/agent-package.d.ts +3 -3
  6. package/dist/agent-package.js +7 -14
  7. package/dist/agent-rows.d.ts +1 -1
  8. package/dist/agents-store.js +7 -6
  9. package/dist/api-only.d.ts +17 -6
  10. package/dist/api-only.js +22 -9
  11. package/dist/cli.js +11 -4
  12. package/dist/composio-made.d.ts +26 -1
  13. package/dist/composio-made.js +39 -2
  14. package/dist/composio-preset.d.ts +6 -4
  15. package/dist/composio-preset.js +50 -17
  16. package/dist/computer-held-routes.js +2 -3
  17. package/dist/computer-needs.d.ts +1 -1
  18. package/dist/computer-needs.js +1 -1
  19. package/dist/computer-setting.d.ts +8 -4
  20. package/dist/computer-setting.js +0 -2
  21. package/dist/computers-running.d.ts +8 -0
  22. package/dist/computers-running.js +27 -0
  23. package/dist/computers.d.ts +0 -2
  24. package/dist/computers.js +1 -1
  25. package/dist/console/assets/backend-D5EmB4N3.js +166 -0
  26. package/dist/console/assets/index-DUYLaqiR.js +746 -0
  27. package/dist/console/assets/index-DYhU4adm.css +1 -0
  28. package/dist/console/index.html +2 -2
  29. package/dist/docker-host-addresses.d.ts +23 -3
  30. package/dist/docker-host-addresses.js +90 -18
  31. package/dist/errors.d.ts +4 -0
  32. package/dist/errors.js +7 -0
  33. package/dist/exa-keyless.d.ts +2 -3
  34. package/dist/exa-keyless.js +43 -127
  35. package/dist/firecrawl-keyless.d.ts +41 -0
  36. package/dist/firecrawl-keyless.js +152 -0
  37. package/dist/github-connection.d.ts +50 -1
  38. package/dist/github-connection.js +96 -3
  39. package/dist/github-faux.d.ts +11 -2
  40. package/dist/github-faux.js +138 -7
  41. package/dist/github-pull-request.d.ts +37 -0
  42. package/dist/github-pull-request.js +110 -0
  43. package/dist/handed-secret.d.ts +3 -1
  44. package/dist/handed-secret.js +4 -2
  45. package/dist/harness-keys.d.ts +98 -0
  46. package/dist/harness-keys.js +247 -0
  47. package/dist/harness-recipe-entry.d.ts +14 -9
  48. package/dist/harness-recipe-entry.js +25 -14
  49. package/dist/harness-table.d.ts +16 -1
  50. package/dist/harness-table.js +19 -7
  51. package/dist/harness.d.ts +4 -0
  52. package/dist/harness.js +12 -1
  53. package/dist/host-check.d.ts +2 -0
  54. package/dist/host-check.js +6 -0
  55. package/dist/import-summary.d.ts +1 -1
  56. package/dist/import-summary.js +1 -1
  57. package/dist/import.d.ts +5 -5
  58. package/dist/import.js +54 -67
  59. package/dist/keyless-mcp.d.ts +36 -0
  60. package/dist/keyless-mcp.js +127 -0
  61. package/dist/learn/audit.d.ts +3 -3
  62. package/dist/learn/audit.js +3 -3
  63. package/dist/learn/commit.d.ts +8 -7
  64. package/dist/learn/commit.js +60 -20
  65. package/dist/learn/compile.d.ts +4 -3
  66. package/dist/learn/compile.js +7 -5
  67. package/dist/learn/folder.d.ts +16 -3
  68. package/dist/learn/folder.js +46 -13
  69. package/dist/learn/promote.d.ts +37 -13
  70. package/dist/learn/promote.js +112 -40
  71. package/dist/learn/secrets.js +10 -2
  72. package/dist/learning-routes.d.ts +22 -17
  73. package/dist/learning-routes.js +40 -39
  74. package/dist/learning.js +2 -2
  75. package/dist/live-reach.d.ts +34 -7
  76. package/dist/live-reach.js +76 -11
  77. package/dist/manifest.d.ts +10 -0
  78. package/dist/manifest.js +30 -0
  79. package/dist/mcp-pin-first.d.ts +4 -2
  80. package/dist/mcp-pin-first.js +5 -2
  81. package/dist/mcp-probe.js +2 -2
  82. package/dist/mcp-secret-writes.d.ts +16 -7
  83. package/dist/mcp-secret-writes.js +35 -27
  84. package/dist/mcp-servers-store.d.ts +30 -6
  85. package/dist/mcp-servers-store.js +112 -28
  86. package/dist/mcp-sources.d.ts +10 -2
  87. package/dist/mcp-sources.js +9 -2
  88. package/dist/mcp-store.d.ts +13 -7
  89. package/dist/mcp-store.js +12 -9
  90. package/dist/model-form.d.ts +3 -2
  91. package/dist/model-form.js +11 -7
  92. package/dist/model.d.ts +20 -4
  93. package/dist/model.js +68 -9
  94. package/dist/native/history.d.ts +1 -1
  95. package/dist/native/history.js +2 -2
  96. package/dist/ollama-provider.d.ts +92 -0
  97. package/dist/ollama-provider.js +495 -0
  98. package/dist/openapi/agentrun-v2.openapi.json +2 -2
  99. package/dist/openapi.js +235 -41
  100. package/dist/page.d.ts +11 -3
  101. package/dist/page.js +22 -7
  102. package/dist/place-offers.d.ts +17 -1
  103. package/dist/place-offers.js +46 -5
  104. package/dist/print.js +1 -1
  105. package/dist/purged-workflow.d.ts +35 -7
  106. package/dist/purged-workflow.js +73 -26
  107. package/dist/run-computer.d.ts +2 -0
  108. package/dist/run-computer.js +2 -0
  109. package/dist/run-files.d.ts +4 -0
  110. package/dist/run-files.js +4 -0
  111. package/dist/run-keys.d.ts +2 -4
  112. package/dist/run-keys.js +6 -7
  113. package/dist/run-launch.d.ts +4 -0
  114. package/dist/run-launch.js +4 -0
  115. package/dist/run-reads-over-store.d.ts +3 -2
  116. package/dist/run-reads-over-store.js +66 -2
  117. package/dist/run-secrets.js +5 -2
  118. package/dist/runner/adapter-loop.d.ts +6 -3
  119. package/dist/runner/adapter-loop.js +34 -15
  120. package/dist/runner/adapter-run-spec.d.ts +3 -0
  121. package/dist/runner/adapter-run-spec.js +6 -4
  122. package/dist/runner/audit.js +8 -4
  123. package/dist/runner/beside.d.ts +2 -1
  124. package/dist/runner/beside.js +6 -2
  125. package/dist/runner/claim-secrets.d.ts +5 -8
  126. package/dist/runner/claim-secrets.js +6 -0
  127. package/dist/runner/cli-run-spec.d.ts +1 -1
  128. package/dist/runner/cli-run-spec.js +39 -7
  129. package/dist/runner/harness-loops.d.ts +22 -9
  130. package/dist/runner/harness-loops.js +21 -11
  131. package/dist/runner/held.d.ts +3 -0
  132. package/dist/runner/learning-end.d.ts +1 -1
  133. package/dist/runner/learning-end.js +8 -3
  134. package/dist/runner/loop-contract.d.ts +5 -4
  135. package/dist/runner/main.js +4 -2
  136. package/dist/runner/mcp-claim.d.ts +3 -0
  137. package/dist/runner/mcp-claim.js +26 -2
  138. package/dist/runner/mcp-run.d.ts +3 -0
  139. package/dist/runner/mcp-run.js +2 -1
  140. package/dist/runner/metrics.d.ts +10 -8
  141. package/dist/runner/metrics.js +20 -27
  142. package/dist/runner/model-route.d.ts +3 -0
  143. package/dist/runner/model-route.js +6 -2
  144. package/dist/runner/pr-checkout.d.ts +21 -4
  145. package/dist/runner/pr-checkout.js +103 -4
  146. package/dist/runner/promotion.d.ts +15 -9
  147. package/dist/runner/promotion.js +25 -15
  148. package/dist/runner/run-child-host.js +24 -11
  149. package/dist/runner/run-child.js +3 -1
  150. package/dist/runner/runner-check.d.ts +3 -0
  151. package/dist/runner/runner-check.js +23 -0
  152. package/dist/runner/sdk-loop.js +2 -0
  153. package/dist/runner/workflow-loop.d.ts +2 -2
  154. package/dist/runner/workflow-loop.js +1 -2
  155. package/dist/runner/workflow-spec.d.ts +1 -1
  156. package/dist/runner/workflow-spec.js +6 -6
  157. package/dist/sdk/check.d.ts +4 -1
  158. package/dist/sdk/check.js +2 -1
  159. package/dist/sdk/runs.d.ts +2 -2
  160. package/dist/sdk/runs.js +8 -6
  161. package/dist/secret-cut.js +2 -1
  162. package/dist/secret-writes.d.ts +3 -2
  163. package/dist/secret-writes.js +1 -1
  164. package/dist/server.d.ts +55 -8
  165. package/dist/server.js +363 -118
  166. package/dist/standard-webhooks.d.ts +11 -0
  167. package/dist/standard-webhooks.js +20 -2
  168. package/dist/store/agent-body.d.ts +2 -2
  169. package/dist/store/agent-body.js +2 -2
  170. package/dist/store/index.d.ts +1 -1
  171. package/dist/store/schema.js +5 -2
  172. package/dist/store/sqlite/store.js +90 -34
  173. package/dist/store/store.d.ts +54 -14
  174. package/dist/store-reads/journal.d.ts +7 -2
  175. package/dist/store-reads/journal.js +9 -6
  176. package/dist/store-reads/learning.d.ts +12 -9
  177. package/dist/store-reads/learning.js +18 -24
  178. package/dist/store-view.d.ts +0 -5
  179. package/dist/store-view.js +9 -8
  180. package/dist/suggestions.d.ts +282 -0
  181. package/dist/suggestions.js +919 -0
  182. package/dist/telemetry.d.ts +8 -1
  183. package/dist/telemetry.js +12 -4
  184. package/dist/template-eval.d.ts +49 -4
  185. package/dist/template-eval.js +168 -45
  186. package/dist/template-import.d.ts +17 -0
  187. package/dist/template-import.js +36 -2
  188. package/dist/templates.d.ts +83 -76
  189. package/dist/templates.js +29 -48
  190. package/dist/timeline/labels.d.ts +2 -2
  191. package/dist/timeline/labels.js +2 -2
  192. package/dist/timeline/timeline.d.ts +2 -2
  193. package/dist/timeline/timeline.js +1 -1
  194. package/dist/tool-plane.d.ts +17 -9
  195. package/dist/tool-plane.js +38 -17
  196. package/dist/tools.js +2 -2
  197. package/dist/trigger-launch-hook.d.ts +19 -9
  198. package/dist/trigger-launch-hook.js +35 -25
  199. package/dist/trigger-targets.d.ts +18 -8
  200. package/dist/trigger-targets.js +42 -19
  201. package/dist/triggers.d.ts +85 -23
  202. package/dist/triggers.js +303 -96
  203. package/dist/validate.d.ts +1 -1
  204. package/dist/validate.js +2 -2
  205. package/dist/web-fake.js +3 -3
  206. package/dist/web-fetch-direct.d.ts +4 -0
  207. package/dist/web-fetch-direct.js +8 -1
  208. package/dist/web-fetch.d.ts +12 -3
  209. package/dist/web-fetch.js +47 -14
  210. package/dist/web-search.d.ts +33 -4
  211. package/dist/web-search.js +100 -41
  212. package/dist/webhooks.js +4 -5
  213. package/dist/workspace/synced-folder.d.ts +1 -1
  214. package/dist/workspace/synced-folder.js +11 -14
  215. package/launcher/agentrun-serve +5 -1
  216. package/package.json +17 -13
  217. package/templates/README.md +5 -4
  218. package/templates/agent-scout/agent.md +46 -0
  219. package/templates/agent-scout/skills/scout/SKILL.md +88 -0
  220. package/templates/agent-scout/skills/scout/suggestions.schema.json +112 -0
  221. package/dist/console/assets/index-BFgyZzF_.js +0 -734
  222. package/dist/console/assets/index-DbilxljH.css +0 -1
  223. package/dist/import-sources.d.ts +0 -116
  224. package/dist/import-sources.js +0 -693
@@ -8,7 +8,8 @@ import { packageSha256 } from "./agent-package.js";
8
8
  import { ApiError, invalid } from "./errors.js";
9
9
  import { UPLOAD_PREFIX } from "./store/index.js";
10
10
  import { fetchPackageFiles, ImportRefused, IMPORT_LIMITS, parseSource, resolveSha } from "./template-source.js";
11
- import { MANIFEST, manifestName, memoryFiles, PackageError, readPackage } from "./templates.js";
11
+ import { manifestOf } from "./manifest.js";
12
+ import { MANIFEST, memoryFiles, PackageError, readPackage } from "./templates.js";
12
13
  import { isObject, unknownFields } from "./validate.js";
13
14
  /** The settings key that holds the GitHub accounts this server's owner trusts as publishers, lower-cased. */
14
15
  export const TRUSTED_PUBLISHERS = "templates.trusted_publishers";
@@ -163,7 +164,8 @@ async function uploadTemplate(deps, raw, dryRun) {
163
164
  let files;
164
165
  try {
165
166
  files = uploadFiles(raw);
166
- const id = `${UPLOAD_PREFIX}${manifestName(files.get(MANIFEST)?.toString("utf8") ?? "") ?? ""}`;
167
+ const name = manifestOf(files.get(MANIFEST)?.toString("utf8") ?? "")?.name;
168
+ const id = `${UPLOAD_PREFIX}${typeof name === "string" ? name : ""}`;
167
169
  pkg = importedPackage(id, { source: id, sha: uploadSha(files), publisher: "" }, files);
168
170
  }
169
171
  catch (error) {
@@ -211,6 +213,38 @@ export async function importTemplate(deps, raw, signal) {
211
213
  deps.registry.put(pkg);
212
214
  return { status: 201, pkg, trusted: true, replaced };
213
215
  }
216
+ /** A package made into an agent here as an imported template, from files this server wrote itself (a suggested agent's,
217
+ * suggestions.ts): checked, kept, then applied. Once `apply` has made the agent nothing after it can fail (the registry
218
+ * is in memory), so a thrown error always means no agent was made, which is what Suggestions.create reads it as. An
219
+ * apply refused (a missing model key, say) takes the kept package back as it was before (removed, or the earlier one),
220
+ * but only while the row is still the one this call kept: an import of the same id meanwhile (POST /v2/templates/import)
221
+ * stands. */
222
+ export async function applyImported(deps, id, origin, files) {
223
+ const pkg = importedPackage(id, origin, files);
224
+ const templates = deps.store.importedTemplates;
225
+ const row = async () => (await templates.list()).find((one) => one.id === pkg.id);
226
+ const before = await row();
227
+ await templates.put({ id: pkg.id, source: origin.source, sha: origin.sha, publisher: origin.publisher, files: Object.fromEntries([...files].map(([path, data]) => [path, data.toString("base64")])) });
228
+ // The row as this call kept it, stamped by the store: the undo below touches it only while it is still this one.
229
+ const kept = await row();
230
+ let made;
231
+ try {
232
+ made = await deps.apply(pkg);
233
+ }
234
+ catch (error) {
235
+ const now = await row().catch(() => undefined);
236
+ const ours = kept !== undefined && now !== undefined && now.importedAt === kept.importedAt && now.sha === kept.sha && now.source === kept.source;
237
+ if (ours) {
238
+ const undo = before
239
+ ? templates.put({ id: before.id, source: before.source, sha: before.sha, publisher: before.publisher, files: before.files })
240
+ : templates.remove(pkg.id).then(() => undefined);
241
+ await undo.catch(() => { });
242
+ }
243
+ throw error;
244
+ }
245
+ deps.registry.put(pkg);
246
+ return made;
247
+ }
214
248
  /** DELETE /v2/templates/{id}: an imported package removed from the store and the registry. A bundled one is 403; none of
215
249
  * that id, 404. Agents applied from it stay. */
216
250
  export async function deleteTemplate(deps, id) {
@@ -32,6 +32,11 @@ export declare const INPUT_TYPES: readonly ["string", "number", "integer", "bool
32
32
  * formats it knows. cron and timezone are for the form alone (a schedule picker, a zone choice); where a parameter fills
33
33
  * a schedule, the schedule's own check reads the value at apply. */
34
34
  export declare const INPUT_FORMATS: readonly ["uri", "email", "hostname", "date", "date-time", "uuid", "cron", "timezone"];
35
+ /** An input's or a parameter's keys: what a form and a JSON Schema say of one field, in the order an export writes them
36
+ * (agent-package.ts). */
37
+ export declare const INPUT_KEYS: readonly ["type", "title", "description", "pattern", "format", "minLength", "maxLength", "minimum", "maximum", "enum", "examples", "default", "required", "items"];
38
+ /** A list input's `items`: a scalar's keys alone. */
39
+ export declare const ITEM_KEYS: readonly ["type", "pattern", "format", "minLength", "maxLength", "minimum", "maximum", "enum"];
35
40
  /** The keys a package may need: those Settings saves (a tool's or a model provider's), each one a run is handed. */
36
41
  export declare const PACKAGE_SECRETS: readonly string[];
37
42
  /** A package's bounds: each file, all its files together (POST /agents' own body limit), and how many it holds. */
@@ -41,9 +46,6 @@ export declare const MAX_PACKAGE_FILES = 256;
41
46
  /** A file of a package's evals/ (a case's fake MCP server fixture, say), which no agent is given: its own bound, apart
42
47
  * from the agent's files' limits above. The answer's schema is given to the agent, so under evals/ too it keeps those. */
43
48
  export declare const MAX_EVAL_FILE_BYTES: number;
44
- /** The `name` agent.md's front matter gives (`text`), as text, or undefined: what an upload's folder is named before
45
- * readPackage checks it whole (the name read as readPackage's front matter reads it). */
46
- export declare function manifestName(text: string): string | undefined;
47
49
  /** An MCP server a package uses, by where it comes from (`source`, `toolkit`), never by the name an owner saves it under:
48
50
  * inside the package its tools are `mcp:<toolkit>/<tool>`. `tools`, those the agent uses and the package asks the owner to
49
51
  * grant (a consent screen shows each, with `reason`), and `allow`, those of them expected to run without asking (reads);
@@ -137,8 +139,9 @@ export type Package = {
137
139
  bash: BashPolicy;
138
140
  };
139
141
  /** What the server checks out in each run's folder before its first turn (the definition's `checkout`,
140
- * runner/pr-checkout.ts): the pull request the run's GitHub event names. */
141
- checkout?: "pull_request";
142
+ * runner/pr-checkout.ts): the pull request the run's GitHub event names, or the default branch of the repository the
143
+ * run names. */
144
+ checkout?: "pull_request" | "repository";
142
145
  /** The setup an apply takes (manifest `parameters`), compiled as `inputs` are (fieldsSchema): a closed object schema,
143
146
  * with no properties when the package names none. */
144
147
  parameters: Json;
@@ -286,7 +289,7 @@ export declare function packageView(p: Package): {
286
289
  } | null;
287
290
  computer: ("none" | "shell")[] | null;
288
291
  needs: string[] | null;
289
- checkout: "pull_request" | null;
292
+ checkout: "pull_request" | "repository" | null;
290
293
  mcp: {
291
294
  source: "url" | "github" | "composio";
292
295
  toolkit: string;
@@ -312,80 +315,84 @@ export declare function packageView(p: Package): {
312
315
  skills: string[];
313
316
  evals: string[];
314
317
  };
315
- /** A package as an import answers it: its listing, and every text its agent would be given, the instructions and each
316
- * skill file by path (a rule and the answer's schema beside each SKILL.md among them), so a person reads what a third
317
- * party's package would tell their agent before it is installed. */
318
- export declare function packageDetail(p: Package): {
318
+ /** A package whole, as an import and a read of one answer it: its listing with the computer it would get here
319
+ * (`computerHere`), and every text its agent would be given, the instructions and each skill file by path (a rule and
320
+ * the answer's schema beside each SKILL.md among them), so a person reads what a package would tell their agent before
321
+ * it is applied. */
322
+ export declare function packageDetail<Pick>(p: Package, computerHere: (p: Package) => Pick): {
323
+ template: {
324
+ computer_here: Pick;
325
+ id: string;
326
+ bundled: boolean;
327
+ source: string | null;
328
+ sha: string | null;
329
+ publisher: string | null;
330
+ name: string;
331
+ display_name: string | null;
332
+ version: string;
333
+ description: string;
334
+ license: string | null;
335
+ author: Json | null;
336
+ repository: string | null;
337
+ category: "engineering" | "security" | "sales" | "marketing" | "research" | "finance" | "operations" | "compliance" | "personal" | null;
338
+ tags: string[];
339
+ output: {
340
+ schema: string;
341
+ json_schema: Json | null;
342
+ } | null;
343
+ harness: string[] | null;
344
+ model: {
345
+ choices?: {
346
+ id: string;
347
+ label: string;
348
+ model: string;
349
+ harness: string;
350
+ warning: string | null;
351
+ note: string | null;
352
+ secrets: string[];
353
+ }[] | undefined;
354
+ tier: string;
355
+ prefer?: string;
356
+ fast?: string;
357
+ strong?: string;
358
+ } | null;
359
+ effort: string | null;
360
+ tools: string[] | null;
361
+ tool_policy: {
362
+ bash: BashPolicy;
363
+ } | null;
364
+ computer: ("none" | "shell")[] | null;
365
+ needs: string[] | null;
366
+ checkout: "pull_request" | "repository" | null;
367
+ mcp: {
368
+ source: "url" | "github" | "composio";
369
+ toolkit: string;
370
+ required: boolean;
371
+ reason: string | null;
372
+ tools: {
373
+ pin?: Record<string, PinValue> | undefined;
374
+ name: string;
375
+ tool: string;
376
+ asks: string;
377
+ }[];
378
+ }[];
379
+ parameters: Json;
380
+ input_schema: Json | null;
381
+ secrets: string[];
382
+ budget: {
383
+ per_run_usd: number;
384
+ max_requests?: number;
385
+ } | null;
386
+ learning: LearningSetting;
387
+ approvals_default: "ask" | "never";
388
+ triggers: Json[];
389
+ skills: string[];
390
+ evals: string[];
391
+ };
319
392
  instructions: string;
320
393
  skill_files: {
321
394
  [x: string]: string;
322
395
  };
323
- id: string;
324
- bundled: boolean;
325
- source: string | null;
326
- sha: string | null;
327
- publisher: string | null;
328
- name: string;
329
- display_name: string | null;
330
- version: string;
331
- description: string;
332
- license: string | null;
333
- author: Json | null;
334
- repository: string | null;
335
- category: "engineering" | "security" | "sales" | "marketing" | "research" | "finance" | "operations" | "compliance" | "personal" | null;
336
- tags: string[];
337
- output: {
338
- schema: string;
339
- json_schema: Json | null;
340
- } | null;
341
- harness: string[] | null;
342
- model: {
343
- choices?: {
344
- id: string;
345
- label: string;
346
- model: string;
347
- harness: string;
348
- warning: string | null;
349
- note: string | null;
350
- secrets: string[];
351
- }[] | undefined;
352
- tier: string;
353
- prefer?: string;
354
- fast?: string;
355
- strong?: string;
356
- } | null;
357
- effort: string | null;
358
- tools: string[] | null;
359
- tool_policy: {
360
- bash: BashPolicy;
361
- } | null;
362
- computer: ("none" | "shell")[] | null;
363
- needs: string[] | null;
364
- checkout: "pull_request" | null;
365
- mcp: {
366
- source: "url" | "github" | "composio";
367
- toolkit: string;
368
- required: boolean;
369
- reason: string | null;
370
- tools: {
371
- pin?: Record<string, PinValue> | undefined;
372
- name: string;
373
- tool: string;
374
- asks: string;
375
- }[];
376
- }[];
377
- parameters: Json;
378
- input_schema: Json | null;
379
- secrets: string[];
380
- budget: {
381
- per_run_usd: number;
382
- max_requests?: number;
383
- } | null;
384
- learning: LearningSetting;
385
- approvals_default: "ask" | "never";
386
- triggers: Json[];
387
- skills: string[];
388
- evals: string[];
389
396
  };
390
397
  /** The packages this server serves: the ones it ships, read at its start, and the ones imported here (the store keeps
391
398
  * them; the server loads them beside the bundled ones at its start). An id is one package; a bundled one is never
package/dist/templates.js CHANGED
@@ -9,6 +9,7 @@ import { basename, join } from "node:path";
9
9
  import { fileURLToPath } from "node:url";
10
10
  import { parseDocument } from "yaml";
11
11
  import { invalid } from "./errors.js";
12
+ import { frontMatter } from "./manifest.js";
12
13
  import { DOCKER_IMAGE_FIX, needsIssues } from "./computer-needs.js";
13
14
  // Where a package's MCP tools come from (a Composio toolkit, GitHub's MCP server, or any other server by its address): a
14
15
  // saved MCP server records one too, and apply maps each need to a server whose record matches.
@@ -55,10 +56,11 @@ export const INPUT_TYPES = [...SCALAR_TYPES, "array"];
55
56
  * formats it knows. cron and timezone are for the form alone (a schedule picker, a zone choice); where a parameter fills
56
57
  * a schedule, the schedule's own check reads the value at apply. */
57
58
  export const INPUT_FORMATS = ["uri", "email", "hostname", "date", "date-time", "uuid", "cron", "timezone"];
58
- /** An input's or a parameter's keys: what a form and a JSON Schema say of one field. */
59
- const INPUT_KEYS = ["type", "required", "pattern", "enum", "format", "default", "description", "title", "examples", "minimum", "maximum", "minLength", "maxLength", "items"];
59
+ /** An input's or a parameter's keys: what a form and a JSON Schema say of one field, in the order an export writes them
60
+ * (agent-package.ts). */
61
+ export const INPUT_KEYS = ["type", "title", "description", "pattern", "format", "minLength", "maxLength", "minimum", "maximum", "enum", "examples", "default", "required", "items"];
60
62
  /** A list input's `items`: a scalar's keys alone. */
61
- const ITEM_KEYS = ["type", "pattern", "enum", "format", "minimum", "maximum", "minLength", "maxLength"];
63
+ export const ITEM_KEYS = ["type", "pattern", "format", "minLength", "maxLength", "minimum", "maximum", "enum"];
62
64
  const NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
63
65
  const PARAMETER = /^[a-z][a-z0-9_]{0,63}$/;
64
66
  /** The keys a package may need: those Settings saves (a tool's or a model provider's), each one a run is handed. */
@@ -85,24 +87,6 @@ const SEMVER = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[
85
87
  const PLACEHOLDER = /\$\{parameters\.([^}]*)\}/g;
86
88
  /** Text that is one placeholder alone: it takes the parameter's value with its type (a pin's, a trigger's input's). */
87
89
  const WHOLE = /^\$\{parameters\.([^}]*)\}$/;
88
- const FRONT = /^---\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/;
89
- /** The `name` agent.md's front matter gives (`text`), as text, or undefined: what an upload's folder is named before
90
- * readPackage checks it whole (the name read as readPackage's front matter reads it). */
91
- export function manifestName(text) {
92
- const match = FRONT.exec(text);
93
- if (!match)
94
- return undefined;
95
- const doc = parseDocument(match[1], { schema: "core", merge: false, uniqueKeys: true, strict: true });
96
- if (doc.errors.length)
97
- return undefined;
98
- try {
99
- const data = doc.toJS({ maxAliasCount: 0 });
100
- return isObject(data) && typeof data.name === "string" ? data.name : undefined;
101
- }
102
- catch {
103
- return undefined;
104
- }
105
- }
106
90
  /** A package's model choices at most, a choice label's length, and a warning's or a note's. */
107
91
  const MAX_CHOICES = 3;
108
92
  const MAX_CHOICE_LABEL = 40;
@@ -531,9 +515,12 @@ export function readPackage(from, { evalFixtures = true } = {}) {
531
515
  const dir = src.where;
532
516
  const problems = [];
533
517
  const bad = (where, message) => void problems.push(`${where}: ${message}`);
518
+ /** The entries of the folder at `sub`, every read of a folder's entries here: a hidden file or folder (.env,
519
+ * .DS_Store, .cache/) is no part of a package, at its top or anywhere under it, so it is left out, never refused. */
520
+ const entries = (sub) => src.entries(sub).filter((entry) => !entry.name.startsWith("."));
534
521
  /** The regular files under `sub`, by path from it with forward slashes; a link or any other kind of entry is a
535
522
  * problem (a package is read from disk, and a link would carry a file from outside it into an agent). */
536
- const files = (sub) => src.entries(sub).sort((a, b) => (a.name < b.name ? -1 : 1)).flatMap((entry) => {
523
+ const files = (sub) => entries(sub).sort((a, b) => (a.name < b.name ? -1 : 1)).flatMap((entry) => {
537
524
  const path = sub ? `${sub}/${entry.name}` : entry.name;
538
525
  if (entry.isDirectory())
539
526
  return files(path);
@@ -546,25 +533,17 @@ export function readPackage(from, { evalFixtures = true } = {}) {
546
533
  /** A file's YAML front matter and body. */
547
534
  const front = (path, required = true) => {
548
535
  const content = text(path);
549
- const match = FRONT.exec(content);
550
- if (!match) {
536
+ const read = frontMatter(content);
537
+ if (!read) {
551
538
  if (required)
552
539
  bad(path, "has no YAML front matter between --- lines");
553
540
  return required ? undefined : { data: {}, body: content };
554
541
  }
555
- const doc = parseDocument(match[1], { schema: "core", merge: false, uniqueKeys: true, strict: true });
556
- if (doc.errors.length)
557
- return bad(path, `its front matter is not YAML: ${doc.errors[0].message.split("\n")[0]}`), undefined;
558
- let data;
559
- try {
560
- data = doc.toJS({ maxAliasCount: 0 });
561
- }
562
- catch (error) {
563
- return bad(path, `its front matter is refused: ${error.message}`), undefined;
564
- }
565
- if (!isObject(data))
542
+ if ("problem" in read)
543
+ return bad(path, `its front matter ${read.problem}`), undefined;
544
+ if (!isObject(read.data))
566
545
  return bad(path, "its front matter is not a mapping"), undefined;
567
- return { data, body: content.slice(match[0].length) };
546
+ return { data: read.data, body: read.body };
568
547
  };
569
548
  const list = (value, field, test = (item) => item !== "") => {
570
549
  if (value === undefined)
@@ -582,7 +561,7 @@ export function readPackage(from, { evalFixtures = true } = {}) {
582
561
  throw new PackageError(dir, ["it is not a folder: a package is one"]);
583
562
  if (kind(MANIFEST) !== "file")
584
563
  throw new PackageError(dir, [`${MANIFEST}: missing: a package is a folder with agent.md (its manifest in the front matter, the agent's instructions in the body)`]);
585
- for (const entry of src.entries("")) {
564
+ for (const entry of entries("")) {
586
565
  if (entry.isDirectory() && !["skills", "rules", "evals"].includes(entry.name))
587
566
  bad(`${entry.name}/`, "a package's folders are skills/, rules/ and evals/");
588
567
  }
@@ -712,8 +691,9 @@ export function readPackage(from, { evalFixtures = true } = {}) {
712
691
  needs = [...f.needs];
713
692
  }
714
693
  // The server's checkout before each run's first turn: the pull request the run's GitHub event names, at its head.
715
- if (f.checkout !== undefined && f.checkout !== "pull_request")
716
- bad(MANIFEST, "checkout is pull_request: the server checks out the pull request the run's GitHub event names, at its head, in repo/ before the first turn");
694
+ // Or the head of the default branch of the repository the run names.
695
+ if (f.checkout !== undefined && f.checkout !== "pull_request" && f.checkout !== "repository")
696
+ bad(MANIFEST, "checkout is pull_request or repository: the server checks out, in repo/ before the first turn, the pull request the run's GitHub event names (at its head), or the head of the default branch of the repository the run names");
717
697
  // The setup an apply takes, in the inputs' grammar, by the same compiler; none, a schema of no fields.
718
698
  const parameters = fieldsSchema(f.parameters, "parameters", (message) => bad(MANIFEST, message)) ?? { type: "object", additionalProperties: false, properties: {} };
719
699
  const fields = fieldsOf(parameters);
@@ -882,7 +862,7 @@ export function readPackage(from, { evalFixtures = true } = {}) {
882
862
  });
883
863
  // skills/<name>/SKILL.md, each named as its folder and described, as Agent Skills are; rules/*.md beside each.
884
864
  const skills = {};
885
- const skillDirs = kind("skills") === "dir" ? src.entries("skills") : [];
865
+ const skillDirs = kind("skills") === "dir" ? entries("skills") : [];
886
866
  for (const entry of skillDirs) {
887
867
  if (!entry.isDirectory() || !NAME.test(entry.name)) {
888
868
  bad(`skills/${entry.name}`, "skills/ holds only skill folders, each named in lowercase letters, digits and dashes");
@@ -899,7 +879,7 @@ export function readPackage(from, { evalFixtures = true } = {}) {
899
879
  for (const path of own)
900
880
  skills[`${entry.name}/${path}`] = text(`skills/${entry.name}/${path}`);
901
881
  }
902
- const rules = kind("rules") === "dir" ? src.entries("rules") : [];
882
+ const rules = kind("rules") === "dir" ? entries("rules") : [];
903
883
  if (rules.length && !skillDirs.length)
904
884
  bad("rules/", "rules ship beside each skill's SKILL.md, and the package has no skill");
905
885
  const ruleNames = [];
@@ -923,7 +903,7 @@ export function readPackage(from, { evalFixtures = true } = {}) {
923
903
  // evals/<case>/: prompt.md (the run's input), graders/*.md (each its type in its front matter), case.yaml and
924
904
  // fixtures/ if it has them. The layout only: no eval runs here.
925
905
  const evals = [];
926
- for (const entry of kind("evals") === "dir" ? src.entries("evals") : []) {
906
+ for (const entry of kind("evals") === "dir" ? entries("evals") : []) {
927
907
  const at = `evals/${entry.name}`;
928
908
  if (!entry.isDirectory() || !NAME.test(entry.name)) {
929
909
  bad(at, "evals/ holds only case folders, each named in lowercase letters, digits and dashes");
@@ -974,7 +954,7 @@ export function readPackage(from, { evalFixtures = true } = {}) {
974
954
  ...(typeof f.license === "string" ? { license: f.license } : {}), ...(isObject(f.author) ? { author: f.author } : {}), ...(typeof f.repository === "string" ? { repository: f.repository } : {}),
975
955
  ...(typeof f.category === "string" ? { category: f.category } : {}), tags,
976
956
  ...(harness ? { harness } : {}), ...(isObject(f.model) ? { model: { ...f.model, ...(choices ? { choices } : {}) } } : {}), ...(typeof f.effort === "string" ? { effort: f.effort } : {}),
977
- ...(tools ? { tools } : {}), mcp, ...(computer ? { computer } : {}), ...(needs ? { needs } : {}), ...(toolPolicy ? { toolPolicy } : {}), ...(f.checkout === "pull_request" ? { checkout: "pull_request" } : {}), parameters, ...(inputSchema ? { inputSchema } : {}), secrets, ...(isObject(f.budget) ? { budget: { per_run_usd: f.budget.per_run_usd, ...(f.budget.max_requests !== undefined ? { max_requests: f.budget.max_requests } : {}) } } : {}), ...(f.learning !== undefined ? { learning: learningSettingOf(f.learning) } : {}), ...(f.approvals === "ask" || f.approvals === "never" ? { approvals: f.approvals } : {}),
957
+ ...(tools ? { tools } : {}), mcp, ...(computer ? { computer } : {}), ...(needs ? { needs } : {}), ...(toolPolicy ? { toolPolicy } : {}), ...(f.checkout === "pull_request" || f.checkout === "repository" ? { checkout: f.checkout } : {}), parameters, ...(inputSchema ? { inputSchema } : {}), secrets, ...(isObject(f.budget) ? { budget: { per_run_usd: f.budget.per_run_usd, ...(f.budget.max_requests !== undefined ? { max_requests: f.budget.max_requests } : {}) } } : {}), ...(f.learning !== undefined ? { learning: learningSettingOf(f.learning) } : {}), ...(f.approvals === "ask" || f.approvals === "never" ? { approvals: f.approvals } : {}),
978
958
  triggers: triggers, ...(isObject(f.output) ? { output: { schema: f.output.schema } } : {}), ...(isObject(outputSchema) ? { outputSchema } : {}), instructions, skills, ...(ruleNames.length ? { rules: ruleNames.sort() } : {}), evals,
979
959
  };
980
960
  // What an apply makes, made here with each parameter's default, else a sample of its type, and checked as POST
@@ -1065,11 +1045,12 @@ function modelView(model) {
1065
1045
  const { choices, ...rest } = model;
1066
1046
  return { ...rest, ...(choices ? { choices: choices.map(({ id, label, model: ref, harness, warning, note, secrets }) => ({ id, label, model: ref, harness, warning: warning ?? null, note: note ?? null, secrets })) } : {}) };
1067
1047
  }
1068
- /** A package as an import answers it: its listing, and every text its agent would be given, the instructions and each
1069
- * skill file by path (a rule and the answer's schema beside each SKILL.md among them), so a person reads what a third
1070
- * party's package would tell their agent before it is installed. */
1071
- export function packageDetail(p) {
1072
- return { ...packageView(p), instructions: p.instructions, skill_files: { ...p.skills } };
1048
+ /** A package whole, as an import and a read of one answer it: its listing with the computer it would get here
1049
+ * (`computerHere`), and every text its agent would be given, the instructions and each skill file by path (a rule and
1050
+ * the answer's schema beside each SKILL.md among them), so a person reads what a package would tell their agent before
1051
+ * it is applied. */
1052
+ export function packageDetail(p, computerHere) {
1053
+ return { template: { ...packageView(p), computer_here: computerHere(p) }, instructions: p.instructions, skill_files: { ...p.skills } };
1073
1054
  }
1074
1055
  /** The packages this server serves: the ones it ships, read at its start, and the ones imported here (the store keeps
1075
1056
  * them; the server loads them beside the bundled ones at its start). An id is one package; a bundled one is never
@@ -59,7 +59,7 @@ export declare const callFailed: (tool: string, result: {
59
59
  export declare function registerTurnEnding(tool: string): void;
60
60
  /** Whether `tool` ends its turn (registerTurnEnding). */
61
61
  export declare const endsTurn: (tool: string) => boolean;
62
- /** The label of a call; `result` is given once the call has finished. Unknown tools get Grep's own fallback. */
62
+ /** The label of a call; `result` is given once the call has finished. Unknown tools get the default fallback. */
63
63
  export declare function labelOf(tool: string, args: Obj, result?: ToolResultView, extra?: Record<string, LabelFn>): string;
64
64
  /** One line for several calls of one tool: `Read 4 pages: a.example, b.example, +2 more`. */
65
65
  export declare function foldLabel(tool: string, calls: readonly {
@@ -68,7 +68,7 @@ export declare function foldLabel(tool: string, calls: readonly {
68
68
  }[], options?: {
69
69
  path?: (path: string) => string;
70
70
  }): string;
71
- /** The input worth showing: Grep's keys first, then the browser and file ones, and last the app a computer's look or act
71
+ /** The input worth showing: the base keys first, then the browser and file ones, and last the app a computer's look or act
72
72
  * names (never what an act types: its steps; nor a codemode script, which can hold it). */
73
73
  export declare function inputPreview(args: Obj, max: number): string | null;
74
74
  /** Files a finished call put in the workspace. */
@@ -51,7 +51,7 @@ export function registerTurnEnding(tool) {
51
51
  }
52
52
  /** Whether `tool` ends its turn (registerTurnEnding). */
53
53
  export const endsTurn = (tool) => turnEnding.has(tool);
54
- /** The label of a call; `result` is given once the call has finished. Unknown tools get Grep's own fallback. */
54
+ /** The label of a call; `result` is given once the call has finished. Unknown tools get the default fallback. */
55
55
  export function labelOf(tool, args, result, extra) {
56
56
  const own = extra && Object.hasOwn(extra, tool) ? extra[tool] : undefined;
57
57
  return (own ?? labels.get(tool))?.(args, result) ?? mcpLabel(tool) ?? `Using tool: ${tool}`;
@@ -65,7 +65,7 @@ export function foldLabel(tool, calls, options = {}) {
65
65
  const subjects = calls.flatMap((call) => spec?.subject?.(named(call.input), call.output) ?? []);
66
66
  return subjects.length ? `${head}: ${list(subjects)}` : head;
67
67
  }
68
- /** The input worth showing: Grep's keys first, then the browser and file ones, and last the app a computer's look or act
68
+ /** The input worth showing: the base keys first, then the browser and file ones, and last the app a computer's look or act
69
69
  * names (never what an act types: its steps; nor a codemode script, which can hold it). */
70
70
  export function inputPreview(args, max) {
71
71
  for (const key of ["description", "command", "query", "file_path", "url", "path", "code", "app"]) {
@@ -9,7 +9,7 @@ export type TimelineKind = "thinking" | "text_block" | "tool_use" | "tool_result
9
9
  | "learning"
10
10
  /** A tool call that waited for a person's approval, after its result's row (serve's tool gate). */
11
11
  | "tool_approval_requested";
12
- /** Grep's public `TimelineEvent` (its 13 fields) plus the open additions, all optional. */
12
+ /** The public `TimelineEvent` (its 13 base fields) plus the open additions, all optional. */
13
13
  export type TimelineEvent = {
14
14
  id: string;
15
15
  timestamp: string;
@@ -118,7 +118,7 @@ export type AgentEventLike = {
118
118
  type: string;
119
119
  [key: string]: unknown;
120
120
  };
121
- /** Grep's caps, so a row is the same on both sides. `thinking` cuts the first sentence of a thinking summary. */
121
+ /** The base caps, so a row is the same on both sides. `thinking` cuts the first sentence of a thinking summary. */
122
122
  export declare const CAPS: {
123
123
  summary: number;
124
124
  preview: number;
@@ -8,7 +8,7 @@ export const nestingCallOf = (callId) => {
8
8
  const at = callId.lastIndexOf("/");
9
9
  return at > 0 ? callId.slice(0, at) : undefined;
10
10
  };
11
- /** Grep's caps, so a row is the same on both sides. `thinking` cuts the first sentence of a thinking summary. */
11
+ /** The base caps, so a row is the same on both sides. `thinking` cuts the first sentence of a thinking summary. */
12
12
  export const CAPS = { summary: 500, preview: 500, text: 2000, thinking: 100 };
13
13
  /** The most of a call's output a read for a grader shows (`calls`, tool_result_text): a tool's output's head, still one
14
14
  * redaction pass of the size an answer's pieces take (key-refusal.ts ANSWER_PIECE). A web call's is not its head: a
@@ -16,18 +16,24 @@ type EmailScope = (typeof EMAIL_SCOPES)[number];
16
16
  * catalog grants).
17
17
  */
18
18
  export declare const CAPABILITIES: readonly ["read", "write", "edit", "web_search", "web_fetch", "browser", "ask_person"];
19
- /** The providers a user may pick for each capability that has a choice, its default first: `auto`, the native search
20
- * where there is one (never on claude-agent, where Claude's own search is picked as `native`), else Parallel where the
21
- * server holds its key, else keyless Exa; `native`, the harness's own tool or its model provider's hosted one, and
22
- * nothing else; `exa-keyless`, Exa's public MCP endpoint, no key; `kernel`, the guarded direct fetch; `parallel`,
23
- * Parallel's Search and Extract APIs on PARALLEL_API_KEY; `off`, web_search turned off: nothing is searched, and an
19
+ /** web_fetch's guarded direct fetch, by its id: "kernel", the kernel's own fetch, never the Kernel browser provider.
20
+ * Named once here, so the scan of vendor ids (scripts/check-vendor-ids.mjs) counts it once. */
21
+ declare const DIRECT_FETCH: "kernel";
22
+ /** The providers a user may pick for each capability that has a choice, its default first: `auto`, for web_search the
23
+ * native search where there is one (never on claude-agent, where Claude's own search is picked as `native`), else
24
+ * Parallel where the server holds its key, else keyless Firecrawl; for web_fetch the guarded direct fetch where the
25
+ * server holds a Parallel key, else keyless Firecrawl; `native`, the harness's own tool or its model provider's hosted
26
+ * one, and nothing else; `firecrawl-keyless`, Firecrawl's public MCP endpoint, no key, with keyless Exa behind it for
27
+ * web_search and the guarded direct fetch behind it for web_fetch; `exa-keyless`, Exa's public MCP endpoint alone, no
28
+ * key; `kernel`, the guarded direct fetch; `parallel`, Parallel's Search and Extract APIs on PARALLEL_API_KEY; `off`,
29
+ * web_search turned off: nothing is searched, and an
24
30
  * agent naming it is refused until it is turned on again. The browser's: `auto`, the computer registry's first browser
25
31
  * provider whose keys the server holds (Browserbase, else Kernel); a browser provider's id (`browserbase`, `kernel`:
26
32
  * BROWSER_VENDOR_IDS), that one alone; `chrome`, a Chrome on the server's own host, which no server sets up yet
27
33
  * (browserBy). */
28
34
  export declare const PROVIDERS: Readonly<{
29
- web_search: readonly ["auto", "native", "exa-keyless", "parallel", "off"];
30
- web_fetch: readonly ["kernel", "parallel"];
35
+ web_search: readonly ["auto", "native", "firecrawl-keyless", "exa-keyless", "parallel", "off"];
36
+ web_fetch: readonly ["auto", "firecrawl-keyless", "kernel", "parallel"];
31
37
  browser: readonly string[];
32
38
  }>;
33
39
  export type Pickable = keyof typeof PROVIDERS;
@@ -89,8 +95,9 @@ export declare const sortedPin: (pin: Pin) => Pin;
89
95
  /** The tools' settings, the server's (`/v2/settings/tools`) and an agent's own (`definition.tool_settings`), one shape:
90
96
  * by settings key. */
91
97
  export type ToolSettingsMap = Partial<Record<string, ToolSetting>>;
92
- /** What a capability resolves to on a run: the native tool, the kernel's own, keyless Exa, Parallel, or why not. */
93
- export type Resolution = "native" | "kernel" | "exa-keyless" | "parallel" | "browserbase" | `unavailable: ${string}`;
98
+ /** What a capability resolves to on a run: the native tool, the kernel's own, keyless Firecrawl (keyless Exa behind it),
99
+ * keyless Exa, Parallel, or why not. */
100
+ export type Resolution = "native" | typeof DIRECT_FETCH | "firecrawl-keyless" | "exa-keyless" | "parallel" | "browserbase" | `unavailable: ${string}`;
94
101
  export declare const NO_PARALLEL_KEY: Resolution;
95
102
  /** web_search with `off` picked: no search leaves the server. */
96
103
  export declare const SEARCH_OFF: Resolution;
@@ -129,6 +136,7 @@ export type ResolveInput = {
129
136
  /** Whether a run on `harness` sends through OpenRouter, where a harness's own search does not run: false for one with
130
137
  * none (and for pi, whose hosted search is asked of the model's provider). */
131
138
  export declare const ownSearchViaOpenRouter: (env: NodeJS.ProcessEnv, harness: string, model?: string) => boolean;
139
+ export declare const FIRECRAWL_FETCH = "Firecrawl's free keyless fetch, no key, the guarded direct fetch behind it. web_fetch sends each URL to Firecrawl's keyless service (never a private or local one); set PARALLEL_API_KEY or choose kernel to fetch directly";
132
140
  /** What `capability` resolves to on a run of `input`, and why in a plain sentence (capabilities' `why`): one rule, so
133
141
  * the two never disagree. */
134
142
  export declare function explainCapability(capability: Pickable, input: ResolveInput): {