@parcha/agentrun-serve 0.1.0-beta.60 → 0.1.0-beta.62

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 (179) hide show
  1. package/CHANGELOG.md +124 -0
  2. package/README.md +139 -22
  3. package/dist/acp-package.d.ts +4 -0
  4. package/dist/api-only.d.ts +23 -1
  5. package/dist/api-only.js +43 -4
  6. package/dist/archil-settings.d.ts +9 -0
  7. package/dist/archil-settings.js +8 -1
  8. package/dist/bash-read-only.d.ts +3 -0
  9. package/dist/bash-read-only.js +6 -3
  10. package/dist/browser-person.d.ts +1 -1
  11. package/dist/browser-person.js +1 -1
  12. package/dist/calendar/tools.js +1 -1
  13. package/dist/chatgpt-plan.d.ts +26 -8
  14. package/dist/chatgpt-plan.js +89 -21
  15. package/dist/claude-login.d.ts +12 -5
  16. package/dist/claude-login.js +28 -3
  17. package/dist/cli.js +61 -18
  18. package/dist/composio-triggers.d.ts +9 -3
  19. package/dist/computers.d.ts +3 -0
  20. package/dist/computers.js +2 -1
  21. package/dist/console/assets/{backend-QnwGVBeU.js → backend-DEgVn5lC.js} +1 -1
  22. package/dist/console/assets/index-CG5tELph.js +639 -0
  23. package/dist/console/assets/share-CIeFK2Oe.js +6 -0
  24. package/dist/console/assets/{styles-CcceGcu2.js → styles-BGZxYkky.js} +2 -2
  25. package/dist/console/assets/{styles-fjQBFfMv.css → styles-D0SufbzK.css} +1 -1
  26. package/dist/console/index.html +3 -3
  27. package/dist/console/share.html +3 -3
  28. package/dist/cut-pool.d.ts +14 -0
  29. package/dist/cut-pool.js +98 -0
  30. package/dist/cut-worker.d.ts +14 -0
  31. package/dist/cut-worker.js +16 -0
  32. package/dist/decisions.d.ts +4 -0
  33. package/dist/decisions.js +9 -1
  34. package/dist/env-switch.d.ts +3 -0
  35. package/dist/env-switch.js +3 -0
  36. package/dist/errors.d.ts +1 -0
  37. package/dist/errors.js +2 -0
  38. package/dist/harness-check.js +2 -1
  39. package/dist/harness-recipe.d.ts +13 -2
  40. package/dist/harness-recipe.js +30 -7
  41. package/dist/harness-sign-in.js +2 -1
  42. package/dist/harness-table.d.ts +12 -3
  43. package/dist/harness-table.js +13 -8
  44. package/dist/import.d.ts +8 -1
  45. package/dist/import.js +36 -5
  46. package/dist/key-check.js +22 -8
  47. package/dist/key-refusal.js +6 -4
  48. package/dist/learn/secrets.d.ts +2 -1
  49. package/dist/learn/secrets.js +2 -2
  50. package/dist/learned-nodes.d.ts +37 -0
  51. package/dist/learned-nodes.js +24 -0
  52. package/dist/local-model.d.ts +144 -0
  53. package/dist/local-model.js +214 -0
  54. package/dist/mcp-gateway.d.ts +24 -0
  55. package/dist/mcp-gateway.js +97 -8
  56. package/dist/mcp-probe.d.ts +7 -0
  57. package/dist/mcp-probe.js +7 -0
  58. package/dist/mcp-servers-store.d.ts +7 -10
  59. package/dist/mcp-servers-store.js +15 -9
  60. package/dist/native/cli.js +5 -1
  61. package/dist/ollama-provider.d.ts +42 -0
  62. package/dist/ollama-provider.js +118 -2
  63. package/dist/openapi.js +85 -16
  64. package/dist/otel/tracer.d.ts +6 -3
  65. package/dist/otel/tracer.js +24 -6
  66. package/dist/page.d.ts +7 -0
  67. package/dist/page.js +17 -4
  68. package/dist/place.d.ts +28 -11
  69. package/dist/place.js +43 -14
  70. package/dist/print.d.ts +3 -2
  71. package/dist/print.js +8 -6
  72. package/dist/redact/match.d.ts +17 -4
  73. package/dist/redact/match.js +57 -15
  74. package/dist/run-export.js +4 -2
  75. package/dist/run-launch.js +16 -3
  76. package/dist/run-model-key.d.ts +2 -1
  77. package/dist/run-model-key.js +2 -1
  78. package/dist/run-reads-over-store.d.ts +7 -0
  79. package/dist/run-reads-over-store.js +32 -4
  80. package/dist/run-usage.js +3 -2
  81. package/dist/runnable.d.ts +6 -3
  82. package/dist/runnable.js +16 -6
  83. package/dist/runner/adapter-loop.d.ts +8 -1
  84. package/dist/runner/adapter-loop.js +148 -29
  85. package/dist/runner/adapter-run-spec.d.ts +9 -6
  86. package/dist/runner/adapter-run-spec.js +38 -52
  87. package/dist/runner/adapters/index.d.ts +4 -0
  88. package/dist/runner/adapters/index.js +2 -1
  89. package/dist/runner/adapters/pi.d.ts +3 -2
  90. package/dist/runner/adapters/pi.js +3 -1
  91. package/dist/runner/audit.d.ts +1 -1
  92. package/dist/runner/claim-secrets.d.ts +3 -1
  93. package/dist/runner/claim-secrets.js +18 -7
  94. package/dist/runner/cli-run-spec.js +24 -17
  95. package/dist/runner/compare-end.d.ts +1 -1
  96. package/dist/runner/dispatch.js +4 -2
  97. package/dist/runner/harness-loops.d.ts +14 -0
  98. package/dist/runner/harness-loops.js +51 -5
  99. package/dist/runner/held.d.ts +4 -1
  100. package/dist/runner/live-ticker.js +5 -4
  101. package/dist/runner/loop-contract.d.ts +4 -1
  102. package/dist/runner/mcp-claim.js +3 -2
  103. package/dist/runner/mcp-run.d.ts +24 -4
  104. package/dist/runner/mcp-run.js +47 -2
  105. package/dist/runner/meta-tools.js +4 -4
  106. package/dist/runner/metrics.d.ts +6 -0
  107. package/dist/runner/metrics.js +12 -4
  108. package/dist/runner/monid-run.js +3 -1
  109. package/dist/runner/native-loop.js +3 -3
  110. package/dist/runner/redact.d.ts +3 -0
  111. package/dist/runner/redact.js +7 -0
  112. package/dist/runner/run-child-host.d.ts +10 -6
  113. package/dist/runner/run-child-host.js +44 -29
  114. package/dist/runner/run-child.js +1 -0
  115. package/dist/runner/runner.js +2 -0
  116. package/dist/runner/sdk-loop.js +5 -3
  117. package/dist/runner/workflow-calls.d.ts +5 -1
  118. package/dist/runner/workflow-calls.js +65 -19
  119. package/dist/runner/workflow-loop.d.ts +1 -1
  120. package/dist/runner/workflow-loop.js +3 -1
  121. package/dist/runner/workflow-spec.d.ts +4 -0
  122. package/dist/runner/workflow-spec.js +18 -13
  123. package/dist/runs-over-store.d.ts +2 -2
  124. package/dist/runs-over-store.js +1 -1
  125. package/dist/secret-cut.js +7 -4
  126. package/dist/secret-rules.d.ts +0 -1
  127. package/dist/secret-rules.js +122 -88
  128. package/dist/server.d.ts +17 -1
  129. package/dist/server.js +208 -69
  130. package/dist/share-host.d.ts +111 -0
  131. package/dist/share-host.js +666 -0
  132. package/dist/slack.js +2 -1
  133. package/dist/store/postgres/migrate.js +3 -1
  134. package/dist/store-reads/analytics.d.ts +15 -0
  135. package/dist/store-reads/analytics.js +17 -0
  136. package/dist/store-reads/learning.d.ts +5 -4
  137. package/dist/store-reads/learning.js +7 -4
  138. package/dist/suggestions.js +32 -3
  139. package/dist/templates.d.ts +3 -1
  140. package/dist/templates.js +7 -3
  141. package/dist/tool-gate.d.ts +25 -9
  142. package/dist/tool-gate.js +58 -19
  143. package/dist/tool-plane.d.ts +24 -1
  144. package/dist/tool-plane.js +75 -3
  145. package/dist/tools.d.ts +12 -2
  146. package/dist/tools.js +42 -7
  147. package/dist/trigger-composio.js +1 -1
  148. package/dist/trigger-launch-hook.d.ts +2 -2
  149. package/dist/trigger-launch-hook.js +1 -1
  150. package/dist/triggers.d.ts +7 -4
  151. package/dist/triggers.js +4 -4
  152. package/dist/webhooks.d.ts +3 -0
  153. package/dist/webhooks.js +5 -0
  154. package/dist/workspace/archil-claim.d.ts +7 -3
  155. package/dist/workspace/archil-claim.js +13 -5
  156. package/dist/workspace/archil-mount-credential.d.ts +6 -0
  157. package/dist/workspace/archil-mount-credential.js +11 -0
  158. package/dist/workspace/computer-deps.d.ts +5 -3
  159. package/dist/workspace/computer-deps.js +11 -9
  160. package/dist/workspace/computer-for-claim.d.ts +6 -2
  161. package/dist/workspace/computer-for-claim.js +43 -12
  162. package/dist/workspace/computer-janitor.d.ts +7 -4
  163. package/dist/workspace/computer-janitor.js +7 -4
  164. package/dist/workspace/computer-kept.d.ts +7 -1
  165. package/dist/workspace/computer-kept.js +7 -1
  166. package/dist/workspace/kind-skills/desktop/SKILL.md +12 -3
  167. package/dist/workspace/mount-revoke-left.d.ts +16 -4
  168. package/dist/workspace/mount-revoke-left.js +42 -22
  169. package/dist/workspace/resolve-computer.d.ts +11 -5
  170. package/dist/workspace/resolve-computer.js +22 -13
  171. package/dist/workspace/run-end-computers.js +1 -1
  172. package/dist/workspace/run-tools.d.ts +10 -3
  173. package/dist/workspace/run-tools.js +5 -4
  174. package/dist/wrapped.d.ts +29 -2
  175. package/dist/wrapped.js +20 -3
  176. package/launcher/agentrun-serve +1 -1
  177. package/package.json +12 -12
  178. package/dist/console/assets/index-DZi-muIj.js +0 -629
  179. package/dist/console/assets/share-pz61zIn9.js +0 -6
package/dist/cli.js CHANGED
@@ -14,7 +14,7 @@ import { REPEAT_MS, stopOnce, stopOnSignals } from "./stop-signals.js";
14
14
  import { resetPassword } from "./owner.js";
15
15
  import { banner } from "./print.js";
16
16
  import { parseTokens } from "./api-token.js";
17
- import { API_ONLY_ENV, API_ONLY_MCP_ORIGINS_ENV, apiOnlyMcpOriginsFrom, RUN_KEYS_ENV, switchFrom, WEB_JEV_OFF_ENV } from "./env-switch.js";
17
+ import { API_ONLY_ENV, API_ONLY_MCP_ORIGINS_ENV, apiOnlyMcpOriginsFrom, RUN_KEYS_ENV, SHARE_HOST_ENV, switchFrom, WEB_JEV_OFF_ENV } from "./env-switch.js";
18
18
  import { harnessModulesOf, harnessRecipesOf } from "./harness-table.js";
19
19
  import { hookOrigin, LAUNCH_HOOK_SECRET_ENV, LAUNCH_HOOK_URL_ENV, launchHookFrom } from "./trigger-launch-hook.js";
20
20
  import { surviveClosedPipes } from "./closed-pipes.js";
@@ -29,10 +29,10 @@ surviveClosedPipes();
29
29
  // Every outbound call through the proxy HTTPS_PROXY or HTTP_PROXY names, NO_PROXY's hosts and loopback direct
30
30
  // (env-proxy.ts): for every command, before anything calls out. Neither set, nothing changes.
31
31
  installEnvProxy();
32
- const USAGE = `usage: agentrun-serve [--data DIR] [--listen ADDR] [--port N] [--open] [--faux MODULE] [--faux-browser MODULE] [--faux-github] [--allow-host NAME ...] [--max-runs N] [--drain-timeout D] [--documents DIR] [--allow-code-nodes] [--learning on|off] [--no-runner] [--harness-module MODULE ...] [--harness-recipe FILE ...] [--harness-sign-in]
32
+ const USAGE = `usage: agentrun-serve [--data DIR] [--listen ADDR] [--port N] [--open] [--faux MODULE] [--faux-browser MODULE] [--faux-github] [--allow-host NAME ...] [--max-runs N] [--drain-timeout D] [--documents DIR] [--allow-code-nodes] [--learning on|off] [--no-runner] [--share-host] [--harness-module MODULE ...] [--harness-recipe FILE ...] [--harness-sign-in]
33
33
  agentrun-serve reset-password [--data DIR]
34
34
  agentrun-serve validate-template DIR
35
- agentrun-serve install-harness goose|cursor [--data DIR]
35
+ agentrun-serve install-harness goose|cursor|antigravity [--data DIR]
36
36
  agentrun-serve install-harness --recipe FILE [--data DIR]
37
37
  agentrun-serve sign-in-harness --recipe FILE [--data DIR]
38
38
  agentrun-serve check-harness --recipe FILE [--model PROVIDER/MODEL] [--data DIR] [--report FILE] [--cap USD]
@@ -84,11 +84,17 @@ const USAGE = `usage: agentrun-serve [--data DIR] [--listen ADDR] [--port N] [--
84
84
  separated), installed into DIR with agentrun harness install --recipe FILE. Its harness runs once a
85
85
  harness-check of it passed on DIR, through this server's model proxy (a plan-billed one's keys are
86
86
  not saved on a server yet); a recipe the loader refuses, or whose id another harness has, refuses
87
- the start
87
+ the start. FILE may be the name of a recipe AgentRun ships (antigravity), unless a file of that
88
+ name is in this directory (./NAME names the file)
88
89
  --harness-sign-in run a person's runs of a plan-billed recipe with a sign-in on your own sign-in (agentrun harness
89
90
  sign-in), never a schedule's or a trigger's. One owner's own machine alone: the start is refused
90
91
  unless the server listens on loopback with no public address, keeps its store in DIR (no
91
92
  AGENTRUN_STORE_URL), runs its runs beside it as its own user, and takes one API token
93
+ --share-host serve shares alone, under /r/ (as AGENTRUN_SHARE_HOST=1): a share's page at /r/<id>, its bundle at
94
+ /r/<id>/bundle.json, the API at /r/v2/shares (a token's upload, re-scrubbed and refused on any
95
+ value the scrubber finds; its list; its delete; 100 shares a token) and /r/v2/health. Every other
96
+ address is a 404; no runner, model key or computer runs, and there is no console or owner. Its share
97
+ URLs are on AGENTRUN_PUBLIC_URL, which a start on an address other than loopback needs
92
98
  --no-runner run the server alone, with no runner beside it (default: one runner beside the server); start one or
93
99
  more \`agentrun-serve runner --data DIR\` processes on the same data directory to claim and run runs;
94
100
  each holds at most --loops N runs (default AGENTRUN_MAX_RUNS, else as many pi runs as its host's
@@ -238,21 +244,26 @@ if (process.argv[2] === "install-harness") {
238
244
  }
239
245
  };
240
246
  const { values, positionals } = read();
247
+ if (values.recipe !== undefined && positionals.length)
248
+ usage("it takes a harness's name or --recipe FILE, not both.");
249
+ // A recipe AgentRun ships (the ACP package's: Google Antigravity's), by its name, is installed as its file is.
250
+ const { acpPackage: shipping } = await import("./acp-package.js");
251
+ const shipped = positionals.length === 1 ? shipping()?.bundledRecipePath?.(positionals[0]) : undefined;
241
252
  // A recipe's harness (harness-recipe.ts): the recipe loaded under its five rules first, so a refused one downloads
242
- // nothing; then its release for this platform, as the Goose install does it.
243
- if (values.recipe !== undefined) {
244
- if (positionals.length)
245
- usage("it takes a harness's name or --recipe FILE, not both.");
246
- const [{ ArchiveInstallFailed }, { installRecipe, loadRecipe, recipeCheckLine, RecipeRefused }] = await Promise.all([import("./harness-archive.js"), import("./harness-recipe.js")]);
253
+ // nothing; then its release for this platform, as the Goose install does it. Which recipe resolved is said first.
254
+ if (values.recipe !== undefined || shipped) {
255
+ const [{ ArchiveInstallFailed }, { installRecipe, loadRecipe, recipeCheckLine, RecipeRefused, recipeSaid }] = await Promise.all([import("./harness-archive.js"), import("./harness-recipe.js")]);
247
256
  const data = resolve(values.data ?? defaultData());
248
257
  try {
249
- const { recipe, file } = loadRecipe(values.recipe);
258
+ // A shipped recipe by the name given, never by its path: a file of that name in the directory refuses it (resolveRecipe).
259
+ const { recipe, file, bundled } = loadRecipe(shipped ? positionals[0] : values.recipe);
260
+ console.error(recipeSaid(recipe.label, file, bundled));
250
261
  const said = { downloaded: "the archive is downloaded and its sha256 matches the recipe", unpacked: "unpacked", verified: "its files are checked" };
251
262
  const { version, installed, binary, pinnedBy } = await installRecipe(recipe, file, data, { onStep: (step) => console.error(`${recipe.label}: ${said[step]}`) });
252
263
  const held = { recipe: "the recipe's tree pin", "first-seen": "the tree an earlier install recorded", recorded: "their tree recorded now, as the first one; a later binary or file beside it that differs is refused" }[pinnedBy];
253
264
  console.log(installed === "already"
254
265
  ? `${recipe.label} ${version} is installed in ${dirname(binary)} (already: the pinned files are there, so nothing was downloaded; held to ${held}).`
255
- : `${recipe.label} ${version} is installed in ${dirname(binary)} (now; the binary and every file beside it held to ${held}). Check it with: ${recipeCheckLine(file, data)} --model PROVIDER/MODEL`);
266
+ : `${recipe.label} ${version} is installed in ${dirname(binary)} (now; the binary and every file beside it held to ${held}). Check it with: ${recipeCheckLine(file, data)}${recipe.model.billing === "proxy" ? " --model PROVIDER/MODEL" : ""}`);
256
267
  process.exit(0);
257
268
  }
258
269
  catch (error) {
@@ -264,7 +275,7 @@ if (process.argv[2] === "install-harness") {
264
275
  }
265
276
  // The owner-installed harnesses (harness-owned.ts), each one's id, label, install and what its install checks.
266
277
  const installers = await Promise.all([import("./harness-goose.js").then((m) => m.GOOSE), import("./harness-cursor.js").then((m) => m.CURSOR)]);
267
- const names = installers.map((each) => each.id).join(" or ");
278
+ const names = [...installers.map((each) => each.id), ...(shipping()?.BUNDLED_RECIPES ?? [])].join(" or ");
268
279
  if (positionals.length !== 1)
269
280
  usage(`it takes one harness: ${names}.`);
270
281
  const chosen = installers.find((each) => each.id === positionals[0]);
@@ -514,6 +525,7 @@ else {
514
525
  "allow-code-nodes": { type: "boolean", default: false },
515
526
  learning: { type: "string" },
516
527
  "no-runner": { type: "boolean", default: false },
528
+ "share-host": { type: "boolean", default: false },
517
529
  "harness-module": { type: "string", multiple: true, default: [] },
518
530
  "harness-recipe": { type: "string", multiple: true, default: [] },
519
531
  "harness-sign-in": { type: "boolean", default: false },
@@ -589,10 +601,13 @@ else {
589
601
  // AGENTRUN_API_ONLY_MCP_ORIGINS: the MCP origins its token may save a per_run server at (api-only.ts), read with it alone.
590
602
  let apiOnly;
591
603
  let runKeys;
604
+ // --share-host, or AGENTRUN_SHARE_HOST=1: shares under /r/ alone (share-host.ts), with no runner beside the server.
605
+ let shareHost;
592
606
  let apiOnlyMcpOrigins;
593
607
  try {
594
608
  apiOnly = switchFrom(API_ONLY_ENV);
595
609
  runKeys = switchFrom(RUN_KEYS_ENV);
610
+ shareHost = values["share-host"] === true || switchFrom(SHARE_HOST_ENV);
596
611
  switchFrom(WEB_JEV_OFF_ENV);
597
612
  apiOnlyMcpOrigins = apiOnly ? apiOnlyMcpOriginsFrom(process.env[API_ONLY_MCP_ORIGINS_ENV]) : [];
598
613
  }
@@ -610,7 +625,35 @@ else {
610
625
  console.error(`agentrun-serve: ${error.message}`);
611
626
  process.exit(2);
612
627
  }
613
- const accounts = !apiOnly && process.env.AGENTRUN_ACCOUNTS !== "0";
628
+ // Which recipe each --harness-recipe NAME resolved to, said before the start: one AgentRun ships (resolveRecipe), and a
629
+ // name a file here also holds refuses the start, saying both.
630
+ if (harnessRecipesOf(values["harness-recipe"], process.env).length) {
631
+ const { loadRecipe, RecipeRefused, recipeSaid, resolveRecipe } = await import("./harness-recipe.js");
632
+ for (const given of harnessRecipesOf(values["harness-recipe"], process.env)) {
633
+ let resolved;
634
+ try {
635
+ resolved = resolveRecipe(given);
636
+ }
637
+ catch (error) {
638
+ if (!(error instanceof RecipeRefused))
639
+ throw error;
640
+ console.error(`agentrun-serve: --harness-recipe ${given}: ${error.message}`);
641
+ process.exit(2);
642
+ }
643
+ // A refused recipe's words are the start's own, as for a file (the harness table loads each).
644
+ if (resolved.bundled) {
645
+ let label = given;
646
+ try {
647
+ label = loadRecipe(resolved.file).recipe.label;
648
+ }
649
+ catch { }
650
+ console.error(recipeSaid(label, resolved.file, true));
651
+ }
652
+ }
653
+ }
654
+ const accounts = !apiOnly && !shareHost && process.env.AGENTRUN_ACCOUNTS !== "0";
655
+ // No runner beside a share host, as --no-runner.
656
+ const noRunner = values["no-runner"] === true || shareHost;
614
657
  // The address first (listen-first.ts): the port bound and named before the rest of the server loads, then answering that
615
658
  // the server is warming until it takes the socket over. A port already taken is left to the start's own listen below,
616
659
  // which waits for a server it replaces, as it always has: no early line then. The banner's "Open " line still means ready.
@@ -652,14 +695,14 @@ else {
652
695
  ...(values["drain-timeout"] ? { drainTimeout: values["drain-timeout"] } : {}), ...(values.documents ? { documents: values.documents } : {}), ...(values["allow-code-nodes"] ? { allowCodeNodes: true } : {}), ...(values.learning !== undefined ? { learning: values.learning } : {}), log: (line) => void process.stdout.write(`${line}\n`),
653
696
  // The public address is the server's with accounts on or off: the Host names it serves, the webhook URLs it gives.
654
697
  ...(publicUrl ? { publicUrl } : {}),
655
- ...(accounts ? { accounts, openSetup: !publicUrl, countSessions: true } : {}), ...(apiOnly ? { apiOnly } : {}), ...(launchHook ? { launchHook } : {}), ...(runKeys ? { runKeys } : {}),
698
+ ...(accounts ? { accounts, openSetup: !publicUrl, countSessions: true } : {}), ...(apiOnly ? { apiOnly } : {}), ...(shareHost ? { shareHost } : {}), ...(launchHook ? { launchHook } : {}), ...(runKeys ? { runKeys } : {}),
656
699
  ...(apiOnlyMcpOrigins.length ? { apiOnlyMcpOrigins } : {}),
657
700
  // The proxies whose X-Forwarded-For the sign-in limit reads (comma-separated); none unless set.
658
701
  ...(trustedProxies.length ? { trustedProxies } : {}),
659
702
  // A local install only as its operator says, never inferred: an MCP server on loopback is refused without it.
660
703
  ...(process.env.AGENTRUN_MCP_ALLOW_LOOPBACK === "1" ? { mcpLoopback: true } : {}),
661
704
  // No runner beside this server: a paired computer's socket stays here, where no run reaches it, which the pairing says.
662
- ...(values["no-runner"] ? { runnerApart: true } : {}),
705
+ ...(noRunner ? { runnerApart: true } : {}),
663
706
  });
664
707
  }
665
708
  catch (error) {
@@ -680,7 +723,7 @@ else {
680
723
  used = telemetry.used;
681
724
  const { loops, loopsTold, drainMs } = besideRunnerOptions(serveOptions, process.env);
682
725
  // A stop asked during the server's start starts no runner: nothing is claimed for the stop to cut.
683
- if (!values["no-runner"] && askedAt === undefined) {
726
+ if (!noRunner && askedAt === undefined) {
684
727
  try {
685
728
  // The beside-runner sees the server's test switches (server.ts fauxEnvOf: --faux and its modules), which the CLI hands
686
729
  // the server as options, never through this process's environment: without them a --faux start's runner looks its faux
@@ -713,7 +756,7 @@ else {
713
756
  }
714
757
  // A token from the environment is the operator's already, and the stored one is printed by the start that made it only.
715
758
  const source = given ? "env" : givenList ? "list" : serve.tokenMade ? "made" : "file";
716
- for (const line of banner({ url: serve.url, baseUrl: serve.baseUrl, data, token: serve.token, source, tokenIds: serve.tokenIds, accounts, ...(apiOnly ? { apiOnly } : {}), ...(serve.launchCode ? { launchCode: serve.launchCode } : {}), boxes: serve.boxesLine, ...(values.listen ? { listen: values.listen } : {}), ...(publicUrl ? { publicUrl } : {}) }))
759
+ for (const line of banner({ url: serve.url, baseUrl: serve.baseUrl, data, token: serve.token, source, tokenIds: serve.tokenIds, accounts, ...(apiOnly ? { apiOnly } : {}), ...(shareHost ? { shareHost } : {}), ...(serve.launchCode ? { launchCode: serve.launchCode } : {}), ...(shareHost ? {} : { boxes: serve.boxesLine }), ...(values.listen ? { listen: values.listen } : {}), ...(publicUrl ? { publicUrl } : {}) }))
717
760
  console.log(line);
718
761
  if (launchHook)
719
762
  console.log(`Launch hook (${LAUNCH_HOOK_URL_ENV}): trigger firings go to ${hookOrigin(launchHook)}, whose host starts their runs; this server starts none for them.`);
@@ -729,7 +772,7 @@ else {
729
772
  // first visit sets the password with nothing to look up. That code works once and for 30 minutes, unlike the token, so
730
773
  // the opener's arguments and the browser's history hold nothing that outlasts the setup.
731
774
  // API-only: there is no console, so nothing to open.
732
- if (values.open && !apiOnly && canOpen(process.env))
775
+ if (values.open && !apiOnly && !shareHost && canOpen(process.env))
733
776
  spawn(process.platform === "darwin" ? "open" : "xdg-open", [serve.setupUrl ?? `${publicUrl ?? serve.url}/`], { stdio: "ignore", detached: true }).on("error", () => { }).unref();
734
777
  const record = join(resolve(data), SERVER_FILE);
735
778
  // The record goes only while it is this server's: a server that takes the lock next writes its own, which this stop must
@@ -12,6 +12,11 @@ export type ComposioCredential = {
12
12
  toolkit: string;
13
13
  auth_config?: string;
14
14
  };
15
+ /** What a saved server's own routes read of it (`route`): no user, which none of them sends Composio; only a trigger's
16
+ * own steps (`field`) read the user. */
17
+ export type ComposioRouteCredential = Omit<ComposioCredential, "user">;
18
+ /** The credential a read for `refusal` answers. */
19
+ export type ComposioCredentialOf<R extends "field" | "route"> = R extends "field" ? ComposioCredential : ComposioRouteCredential;
15
20
  /** A trigger of kind composio, as the engine keeps it. */
16
21
  type Holder = {
17
22
  id: string;
@@ -31,9 +36,10 @@ export type ComposioTriggerDeps = {
31
36
  publicUrl?: string;
32
37
  /** The composio source's sealed settings: each hook's subscription secret. */
33
38
  sealed: Sealed;
34
- /** Saved server `name`'s key, user, toolkit and auth config; refused (thrown) when it is no Composio server: by the source's field at
35
- * a trigger's create (`field`), as a 404 on its own routes (`route`). */
36
- credential(name: string, refusal: "field" | "route"): Promise<ComposioCredential>;
39
+ /** Saved server `name`'s key, toolkit and auth config, and for a trigger's own steps (`field`) its user; refused (thrown)
40
+ * when it is no Composio server: by the source's field at a trigger's create (`field`), as a 404 on its own routes
41
+ * (`route`). */
42
+ credential<R extends "field" | "route">(name: string, refusal: R): Promise<ComposioCredentialOf<R>>;
37
43
  /** Every trigger of kind composio, on or off. */
38
44
  holders(): Promise<Holder[]>;
39
45
  signal?: AbortSignal;
@@ -33,6 +33,9 @@ export interface ComputerRoutesOptions {
33
33
  /** This server's folder mode, or how to read it at each call (folderModeOf: the Archil settings, the environment's or the saved row), so turning
34
34
  * Archil on or off takes effect without building the routes again. */
35
35
  readonly mode: FolderMode | (() => FolderMode | Promise<FolderMode>);
36
+ /** In Mode 2, this server's Archil region where it has no serverless exec (archil-settings.ts noExecRegionOf), read
37
+ * at each call as `mode` is: a choice with no computer that mounts the folder has no shell then. Absent: none. */
38
+ readonly noExec?: () => Promise<string | undefined>;
36
39
  /** Why this machine cannot run a provider's computers, by its id (hostCommandRefusals at the server's start): the
37
40
  * provider is not ready, and a claim of it is refused, in these words. Absent: every provider can run here. */
38
41
  readonly hostWhy?: Readonly<Record<string, string>>;
package/dist/computers.js CHANGED
@@ -163,7 +163,8 @@ export function createComputerRoutes(options) {
163
163
  // Each provider as this server has it: the mounts its saved keys turn on, whether this server names its image, and no
164
164
  // Archil mount where its settings make its machines dial this server.
165
165
  const kinds = { ...listed, PROVIDERS: listed.PROVIDERS.map((provider) => entryHere(provider, (name) => saved.has(name) || envValue(env, name) !== undefined, settingOptions(provider.id, settings, keyTable))) };
166
- const choice = (setting) => shellChoiceOf(setting, mode === "disk" ? 2 : 1, kinds);
166
+ const noExec = mode === "disk" ? await options.noExec?.() : undefined;
167
+ const choice = (setting) => shellChoiceOf(setting, mode === "disk" ? 2 : 1, kinds, noExec);
167
168
  // The run's folder a computer of this choice holds, by the rule the claim picks it by, over the same providers.
168
169
  const folderOf = (setting) => runFolderOf(setting, mode === "disk" ? 2 : 1, kinds) ?? null;
169
170
  // Under this server's AGENTRUN_BOX_ALLOW none, a computer that needs a network is refused at a
@@ -1,4 +1,4 @@
1
- import{d as It,D as Yn}from"./index-DZi-muIj.js";import{az as bt}from"./styles-CcceGcu2.js";const we=t=>({type:"boolean",description:t}),Yt={type:"object",required:["name","pageCount","pages","text"],properties:{name:{type:"string"},pageCount:{type:"integer"},pages:{type:"array"},text:{type:"string"}}},Jn={type:"object",required:["status","text"],properties:{status:{type:"integer"},url:{type:"string"},title:{type:"string"},text:{type:"string"}}},vt={type:"object"},Ke={type:"object",additionalProperties:!1,required:["altered","seal","signature","legible"],properties:{altered:we("Does the page show signs of digital alteration: mismatched fonts, misaligned lines, pasted regions or an edited date?"),seal:we("Is a state seal or a filing stamp visible on the page?"),signature:we("Is the certificate signed by a state official?"),legible:we("Is the entity's full legal name legible on the page?")}},mt={v:2,name:"coi-batch-review",schemas:{Input:{type:"object",required:["documents"],properties:{documents:{type:"array",items:{type:"string"},minItems:1,maxItems:50}}},DocChecks:Ke,Pages:Yt,Report:vt},input:{schemaId:"Input"},output:{schemaId:"Report",path:"report"},root:{node:"chain",steps:[{node:"map",label:"each-document",itemsPath:"documents",as:"rows",maxConcurrency:4,onItemFailure:"collect",failedAs:"failed",body:{node:"chain",steps:[{node:"call",label:"render-pages",via:"tool",tool:"pdf_pages",args:{path:"{item}",maxPages:2},out:"Pages",as:"pages",deadline_s:60},{node:"judge",label:"inspect-certificate",provider:"jev",state:{document:"{item}",page:"<page1>",text:"{pages.text}"},images:{"<page1>":"{pages.pages.0.image}"},out:"DocChecks",as:"checks"},{node:"code",label:"grade",code:"(s) => ({ document: s.item, verdict: s.checks.altered || !s.checks.seal || !s.checks.legible ? 'doubtful' : 'valid', checks: s.checks })",as:"row"}]}},{node:"code",label:"batch-report",code:"(s) => ({ valid: s.rows.filter((r) => r && r.verdict === 'valid').length, doubtful: s.rows.filter((r) => r && r.verdict === 'doubtful').map((r) => r.document), failed: s.failed })",as:"report"}]}},xe={v:2,name:"kyb-onboarding",schemas:{Pages:Yt,Result:vt,Input:{type:"object",required:["company","state","registration_number","documents"],properties:{company:{type:"string"},state:{type:"string"},registration_number:{type:"string"},documents:{type:"array",items:{type:"string"}}}},Registry:{type:"object",additionalProperties:!1,required:["registered","active","name_matches"],properties:{registered:we("Is a company with this exact registration number on file with the named state's business registry?"),active:we("Is that registration currently active (in good standing, not dissolved, forfeited or revoked)?"),name_matches:we("Does the registry's legal name match the applicant's name, ignoring punctuation and suffix style?")}},CertLook:{type:"object",additionalProperties:!1,required:["altered","seal","legible"],properties:{altered:Ke.properties.altered,seal:Ke.properties.seal,legible:Ke.properties.legible}},CrossCheck:{type:"object",additionalProperties:!1,required:["same_entity","same_state","dates_consistent"],properties:{same_entity:we("Do the registry record and the certificate name the same legal entity?"),same_state:we("Do they name the same state of incorporation?"),dates_consistent:we("Is the certificate's filing date consistent with the registry's formation date (within 3 days)?")}}},input:{schemaId:"Input"},root:{node:"chain",steps:[{node:"call",label:"render-certificate",via:"tool",tool:"pdf_pages",args:{path:"{documents.0}",maxPages:1},out:"Pages",as:"cert",deadline_s:60},{node:"parallel",label:"checks",branches:[{node:"judge",label:"registry-lookup",provider:"parallel",model:"standard",state:{company:"{company}",state:"{state}",registration_number:"{registration_number}"},out:"Registry",as:"registry"},{node:"judge",label:"certificate-look",provider:"jev",state:{page:"<cert>",text:"{cert.text}"},images:{"<cert>":"{cert.pages.0.image}"},out:"CertLook",as:"look"}]},{node:"judge",label:"cross-check",provider:"jev",state:{applicant:{company:"{company}",state:"{state}"},registry:"{registry$answers}",certificate_text:"{cert.text}"},out:"CrossCheck",as:"cross"},{node:"route",label:"decide",provider:"jev",state:{registry:"{registry}",look:"{look}",cross:"{cross}"},instructions:"Decide the onboarding outcome for this business from the registry check, the certificate's look and the cross-check.",branches:{approve:{criteria:"Registered, active, the certificate looks genuine, and every cross-check agrees.",body:{node:"code",label:"record-approval",code:"(s) => ({ outcome: 'approved' })",as:"outcome"}},review:{criteria:"Mostly consistent, but one check is doubtful or the evidence disagrees on a detail.",body:{node:"code",label:"open-review-case",code:"(s) => ({ outcome: 'review', reasons: s.cross })",as:"outcome"}},reject:{criteria:"Not registered, dissolved, or the certificate is altered.",body:{node:"code",label:"record-rejection",code:"(s) => ({ outcome: 'rejected' })",as:"outcome"}}},unsure:{branch:"review",gte:.75}}]},output:{schemaId:"Result",path:"outcome"}},Vn={type:"object",additionalProperties:!1,required:["prohibited"],properties:{prohibited:we("Does this merchant sell goods the card networks prohibit: weapons, controlled substances, counterfeit goods, or unlicensed nicotine products?")}},Ve=(t,s,o)=>({node:"judge",label:t,provider:s,...o?{model:o}:{},state:{merchant:"{merchant}",url:"{url}",page_text:"{page.text}"},out:"Prohibited",as:t.replace(/-/g,"_")}),Ze={v:2,name:"prohibited-goods-jury",schemas:{Page:Jn,Result:vt,Input:{type:"object",required:["merchant","url"],properties:{merchant:{type:"string"},url:{type:"string"}}},Prohibited:Vn},input:{schemaId:"Input"},root:{node:"chain",steps:[{node:"call",label:"fetch-storefront",via:"tool",tool:"web_fetch",args:{url:"{url}"},out:"Page",as:"page",deadline_s:30},{node:"parallel",label:"jury",branches:[Ve("jev","jev"),Ve("pplx-decider","openrouter","perplexity/pplx-decider-v1.2"),Ve("liquid-d1","openrouter","liquid/d1"),Ve("clef","openrouter","cloudflare/clef")]},{node:"code",label:"aggregate",code:"(s) => { const p = [s.jev$answers, s.pplx_decider$answers, s.liquid_d1$answers, s.clef$answers].map((a) => a.answers.prohibited.noul); const mean = p.reduce((x, y) => x + y, 0) / p.length; const spread = Math.max(...p) - Math.min(...p); return { mean, spread, outcome: spread > 0.3 ? 'disagree' : 'agree' }; }",as:"agreement"},{node:"route",label:"agreement",valuePath:"agreement.outcome",branches:{agree:{body:{node:"code",label:"auto-decide",code:"(s) => ({ decision: s.agreement.mean >= 0.5 ? 'decline' : 'approve' })",as:"decision"}},disagree:{body:{node:"code",label:"human-review",code:"(s) => ({ decision: 'review', spread: s.agreement.spread })",as:"decision"}}}}]},output:{schemaId:"Result",path:"decision"}},re=6e4,le=60*re,W=24*le,se={default:"anthropic/claude-sonnet-5-5",fast:"openai/gpt-6-luna",strong:"anthropic/claude-opus-5-5",codex:"openai/gpt-6.1-sol"},Qn={v:2,name:"ticket-triage",schemas:{Ticket:{type:"object",required:["subject","body"],properties:{subject:{type:"string"},body:{type:"string"}}},Triage:{type:"object",required:["queue","urgency"],properties:{queue:{type:"string"},urgency:{type:"integer"}}}},input:{schemaId:"Ticket"},output:{schemaId:"Triage",path:"triage"},root:{node:"chain",steps:[{node:"call",label:"read the playbook",tool:"read",args:{path:"playbooks/triage.md"},as:"playbook"},{node:"pick",label:"which queue",from:"playbook.queues",instructions:"Which queue does this ticket belong to, by what the buyer or seller asks for?",as:"queue",none:"hand back"},{node:"code",label:"score the urgency",as:"triage"}]}},Zn=`# ticket-triage
1
+ import{d as It,D as Yn}from"./index-CG5tELph.js";import{az as bt}from"./styles-BGZxYkky.js";const we=t=>({type:"boolean",description:t}),Yt={type:"object",required:["name","pageCount","pages","text"],properties:{name:{type:"string"},pageCount:{type:"integer"},pages:{type:"array"},text:{type:"string"}}},Jn={type:"object",required:["status","text"],properties:{status:{type:"integer"},url:{type:"string"},title:{type:"string"},text:{type:"string"}}},vt={type:"object"},Ke={type:"object",additionalProperties:!1,required:["altered","seal","signature","legible"],properties:{altered:we("Does the page show signs of digital alteration: mismatched fonts, misaligned lines, pasted regions or an edited date?"),seal:we("Is a state seal or a filing stamp visible on the page?"),signature:we("Is the certificate signed by a state official?"),legible:we("Is the entity's full legal name legible on the page?")}},mt={v:2,name:"coi-batch-review",schemas:{Input:{type:"object",required:["documents"],properties:{documents:{type:"array",items:{type:"string"},minItems:1,maxItems:50}}},DocChecks:Ke,Pages:Yt,Report:vt},input:{schemaId:"Input"},output:{schemaId:"Report",path:"report"},root:{node:"chain",steps:[{node:"map",label:"each-document",itemsPath:"documents",as:"rows",maxConcurrency:4,onItemFailure:"collect",failedAs:"failed",body:{node:"chain",steps:[{node:"call",label:"render-pages",via:"tool",tool:"pdf_pages",args:{path:"{item}",maxPages:2},out:"Pages",as:"pages",deadline_s:60},{node:"judge",label:"inspect-certificate",provider:"jev",state:{document:"{item}",page:"<page1>",text:"{pages.text}"},images:{"<page1>":"{pages.pages.0.image}"},out:"DocChecks",as:"checks"},{node:"code",label:"grade",code:"(s) => ({ document: s.item, verdict: s.checks.altered || !s.checks.seal || !s.checks.legible ? 'doubtful' : 'valid', checks: s.checks })",as:"row"}]}},{node:"code",label:"batch-report",code:"(s) => ({ valid: s.rows.filter((r) => r && r.verdict === 'valid').length, doubtful: s.rows.filter((r) => r && r.verdict === 'doubtful').map((r) => r.document), failed: s.failed })",as:"report"}]}},xe={v:2,name:"kyb-onboarding",schemas:{Pages:Yt,Result:vt,Input:{type:"object",required:["company","state","registration_number","documents"],properties:{company:{type:"string"},state:{type:"string"},registration_number:{type:"string"},documents:{type:"array",items:{type:"string"}}}},Registry:{type:"object",additionalProperties:!1,required:["registered","active","name_matches"],properties:{registered:we("Is a company with this exact registration number on file with the named state's business registry?"),active:we("Is that registration currently active (in good standing, not dissolved, forfeited or revoked)?"),name_matches:we("Does the registry's legal name match the applicant's name, ignoring punctuation and suffix style?")}},CertLook:{type:"object",additionalProperties:!1,required:["altered","seal","legible"],properties:{altered:Ke.properties.altered,seal:Ke.properties.seal,legible:Ke.properties.legible}},CrossCheck:{type:"object",additionalProperties:!1,required:["same_entity","same_state","dates_consistent"],properties:{same_entity:we("Do the registry record and the certificate name the same legal entity?"),same_state:we("Do they name the same state of incorporation?"),dates_consistent:we("Is the certificate's filing date consistent with the registry's formation date (within 3 days)?")}}},input:{schemaId:"Input"},root:{node:"chain",steps:[{node:"call",label:"render-certificate",via:"tool",tool:"pdf_pages",args:{path:"{documents.0}",maxPages:1},out:"Pages",as:"cert",deadline_s:60},{node:"parallel",label:"checks",branches:[{node:"judge",label:"registry-lookup",provider:"parallel",model:"standard",state:{company:"{company}",state:"{state}",registration_number:"{registration_number}"},out:"Registry",as:"registry"},{node:"judge",label:"certificate-look",provider:"jev",state:{page:"<cert>",text:"{cert.text}"},images:{"<cert>":"{cert.pages.0.image}"},out:"CertLook",as:"look"}]},{node:"judge",label:"cross-check",provider:"jev",state:{applicant:{company:"{company}",state:"{state}"},registry:"{registry$answers}",certificate_text:"{cert.text}"},out:"CrossCheck",as:"cross"},{node:"route",label:"decide",provider:"jev",state:{registry:"{registry}",look:"{look}",cross:"{cross}"},instructions:"Decide the onboarding outcome for this business from the registry check, the certificate's look and the cross-check.",branches:{approve:{criteria:"Registered, active, the certificate looks genuine, and every cross-check agrees.",body:{node:"code",label:"record-approval",code:"(s) => ({ outcome: 'approved' })",as:"outcome"}},review:{criteria:"Mostly consistent, but one check is doubtful or the evidence disagrees on a detail.",body:{node:"code",label:"open-review-case",code:"(s) => ({ outcome: 'review', reasons: s.cross })",as:"outcome"}},reject:{criteria:"Not registered, dissolved, or the certificate is altered.",body:{node:"code",label:"record-rejection",code:"(s) => ({ outcome: 'rejected' })",as:"outcome"}}},unsure:{branch:"review",gte:.75}}]},output:{schemaId:"Result",path:"outcome"}},Vn={type:"object",additionalProperties:!1,required:["prohibited"],properties:{prohibited:we("Does this merchant sell goods the card networks prohibit: weapons, controlled substances, counterfeit goods, or unlicensed nicotine products?")}},Ve=(t,s,o)=>({node:"judge",label:t,provider:s,...o?{model:o}:{},state:{merchant:"{merchant}",url:"{url}",page_text:"{page.text}"},out:"Prohibited",as:t.replace(/-/g,"_")}),Ze={v:2,name:"prohibited-goods-jury",schemas:{Page:Jn,Result:vt,Input:{type:"object",required:["merchant","url"],properties:{merchant:{type:"string"},url:{type:"string"}}},Prohibited:Vn},input:{schemaId:"Input"},root:{node:"chain",steps:[{node:"call",label:"fetch-storefront",via:"tool",tool:"web_fetch",args:{url:"{url}"},out:"Page",as:"page",deadline_s:30},{node:"parallel",label:"jury",branches:[Ve("jev","jev"),Ve("pplx-decider","openrouter","perplexity/pplx-decider-v1.2"),Ve("liquid-d1","openrouter","liquid/d1"),Ve("clef","openrouter","cloudflare/clef")]},{node:"code",label:"aggregate",code:"(s) => { const p = [s.jev$answers, s.pplx_decider$answers, s.liquid_d1$answers, s.clef$answers].map((a) => a.answers.prohibited.noul); const mean = p.reduce((x, y) => x + y, 0) / p.length; const spread = Math.max(...p) - Math.min(...p); return { mean, spread, outcome: spread > 0.3 ? 'disagree' : 'agree' }; }",as:"agreement"},{node:"route",label:"agreement",valuePath:"agreement.outcome",branches:{agree:{body:{node:"code",label:"auto-decide",code:"(s) => ({ decision: s.agreement.mean >= 0.5 ? 'decline' : 'approve' })",as:"decision"}},disagree:{body:{node:"code",label:"human-review",code:"(s) => ({ decision: 'review', spread: s.agreement.spread })",as:"decision"}}}}]},output:{schemaId:"Result",path:"decision"}},re=6e4,le=60*re,W=24*le,se={default:"anthropic/claude-sonnet-5-5",fast:"openai/gpt-6-luna",strong:"anthropic/claude-opus-5-5",codex:"openai/gpt-6.1-sol"},Qn={v:2,name:"ticket-triage",schemas:{Ticket:{type:"object",required:["subject","body"],properties:{subject:{type:"string"},body:{type:"string"}}},Triage:{type:"object",required:["queue","urgency"],properties:{queue:{type:"string"},urgency:{type:"integer"}}}},input:{schemaId:"Ticket"},output:{schemaId:"Triage",path:"triage"},root:{node:"chain",steps:[{node:"call",label:"read the playbook",tool:"read",args:{path:"playbooks/triage.md"},as:"playbook"},{node:"pick",label:"which queue",from:"playbook.queues",instructions:"Which queue does this ticket belong to, by what the buyer or seller asks for?",as:"queue",none:"hand back"},{node:"code",label:"score the urgency",as:"triage"}]}},Zn=`# ticket-triage
2
2
 
3
3
  Files a ticket under its queue (billing, shipping, account, merchant, abuse) and scores its urgency from the playbook: a chargeback, a locked account or a safety problem is 4 or more.
4
4