@parcha/agentrun-serve 0.1.0-beta.58 → 0.1.0-beta.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +325 -1
- package/README.md +332 -88
- package/dist/acp-package.d.ts +5 -1
- package/dist/acp-package.js +19 -2
- package/dist/adapters.d.ts +23 -2
- package/dist/adapters.js +106 -33
- package/dist/agents-store.js +1 -1
- package/dist/answer-text.d.ts +3 -0
- package/dist/answer-text.js +22 -0
- package/dist/attach-conformance.js +5 -4
- package/dist/box-paths.d.ts +3 -2
- package/dist/box-paths.js +5 -4
- package/dist/browser-computer.d.ts +3 -8
- package/dist/browser-computer.js +12 -35
- package/dist/browser-cost.js +94 -20
- package/dist/capacity.d.ts +1 -1
- package/dist/capacity.js +3 -3
- package/dist/chatgpt-plan.d.ts +5 -0
- package/dist/chatgpt-plan.js +25 -11
- package/dist/claude-login-token.d.ts +15 -11
- package/dist/claude-login-token.js +167 -107
- package/dist/claude-login.d.ts +76 -31
- package/dist/claude-login.js +426 -79
- package/dist/claude-sign-in.d.ts +3 -0
- package/dist/claude-sign-in.js +10 -1
- package/dist/cli.js +323 -292
- package/dist/composio-made.d.ts +1 -6
- package/dist/composio-made.js +1 -6
- package/dist/composio-owners.d.ts +26 -0
- package/dist/composio-owners.js +36 -0
- package/dist/composio-preset.d.ts +56 -23
- package/dist/composio-preset.js +173 -77
- package/dist/composio-triggers.d.ts +4 -4
- package/dist/composio-triggers.js +6 -7
- package/dist/compute-cost.js +11 -2
- package/dist/computer-attach.d.ts +6 -3
- package/dist/computer-attach.js +41 -29
- package/dist/computer-held-routes.d.ts +1 -1
- package/dist/computer-held-routes.js +9 -4
- package/dist/computer-keys.d.ts +11 -1
- package/dist/computer-keys.js +26 -1
- package/dist/computer-record.js +3 -1
- package/dist/computer-view.d.ts +5 -3
- package/dist/computer-view.js +10 -6
- package/dist/computer-viewer.js +36 -7
- package/dist/computers.d.ts +2 -1
- package/dist/computers.js +6 -3
- package/dist/console/THIRD-PARTY-NOTICES.txt +50 -0
- package/dist/console/assets/backend-BztxEAvb.js +166 -0
- package/dist/console/assets/index-LwNL4L9q.js +619 -0
- package/dist/console/assets/share-L84tlUDW.js +6 -0
- package/dist/console/assets/styles-CaRKlHke.js +291 -0
- package/dist/console/assets/styles-DQo8rzY-.css +1 -0
- package/dist/console/index.html +4 -3
- package/dist/console/share.html +17 -0
- package/dist/decisions.d.ts +17 -7
- package/dist/decisions.js +41 -15
- package/dist/dial-relay.js +10 -4
- package/dist/docker-daemon.js +4 -5
- package/dist/docker-host-addresses.js +29 -11
- package/dist/email/account.d.ts +6 -0
- package/dist/email/account.js +6 -0
- package/dist/email/authentication.d.ts +21 -0
- package/dist/email/authentication.js +106 -0
- package/dist/email/email-faux.d.ts +11 -2
- package/dist/email/email-faux.js +21 -5
- package/dist/email/mail.d.ts +25 -0
- package/dist/email/mail.js +58 -2
- package/dist/email/names.js +2 -2
- package/dist/email/tools.d.ts +9 -4
- package/dist/email/tools.js +95 -13
- package/dist/env-switch.d.ts +12 -2
- package/dist/env-switch.js +23 -3
- package/dist/errors.d.ts +1 -0
- package/dist/errors.js +2 -0
- package/dist/fal-price.d.ts +11 -1
- package/dist/fal-price.js +33 -0
- package/dist/faux-computers.js +1 -1
- package/dist/filed-answer.d.ts +2 -2
- package/dist/filed-answer.js +2 -2
- package/dist/graph-served.d.ts +10 -5
- package/dist/graph-served.js +40 -10
- package/dist/handed-values.js +1 -2
- package/dist/harness-check.d.ts +2 -1
- package/dist/harness-check.js +45 -12
- package/dist/harness-keys.js +9 -6
- package/dist/harness-opencode/facts.js +2 -0
- package/dist/harness-recipe-entry.d.ts +9 -3
- package/dist/harness-recipe-entry.js +18 -9
- package/dist/harness-recipe.d.ts +21 -0
- package/dist/harness-recipe.js +25 -3
- package/dist/harness-table.d.ts +8 -0
- package/dist/harness-table.js +17 -6
- package/dist/helper-env.d.ts +4 -1
- package/dist/helper-env.js +4 -1
- package/dist/host-check.d.ts +2 -3
- package/dist/host-check.js +13 -7
- package/dist/hosted-search.js +1 -1
- package/dist/import.d.ts +11 -8
- package/dist/import.js +437 -186
- package/dist/key-refusal.d.ts +9 -2
- package/dist/key-refusal.js +86 -32
- package/dist/learn/audit.d.ts +8 -5
- package/dist/learn/audit.js +15 -7
- package/dist/learn/compile.d.ts +5 -2
- package/dist/learn/compile.js +45 -21
- package/dist/learn/field-check.d.ts +111 -0
- package/dist/learn/field-check.js +174 -0
- package/dist/learn/ledger.d.ts +32 -29
- package/dist/learn/ledger.js +26 -19
- package/dist/learn/promote.d.ts +79 -36
- package/dist/learn/promote.js +60 -65
- package/dist/learn/secrets.d.ts +4 -0
- package/dist/learn/secrets.js +12 -0
- package/dist/learned-nodes.d.ts +8 -5
- package/dist/learned-nodes.js +8 -5
- package/dist/learned-workflow.d.ts +2 -1
- package/dist/learned-workflow.js +13 -10
- package/dist/learning-cost.d.ts +25 -8
- package/dist/learning-cost.js +23 -8
- package/dist/learning-setting.d.ts +6 -0
- package/dist/learning-setting.js +11 -1
- package/dist/listen-first.d.ts +5 -4
- package/dist/listen-first.js +4 -5
- package/dist/live-reach.d.ts +7 -0
- package/dist/live-reach.js +7 -0
- package/dist/mcp-api-only-origins.d.ts +15 -0
- package/dist/mcp-api-only-origins.js +40 -0
- package/dist/mcp-gateway.d.ts +16 -2
- package/dist/mcp-gateway.js +41 -3
- package/dist/mcp-oauth.d.ts +1 -1
- package/dist/mcp-oauth.js +3 -2
- package/dist/mcp-probe.d.ts +3 -0
- package/dist/mcp-probe.js +3 -0
- package/dist/mcp-secret-writes.d.ts +24 -2
- package/dist/mcp-secret-writes.js +30 -2
- package/dist/mcp-servers-store.d.ts +52 -14
- package/dist/mcp-servers-store.js +165 -61
- package/dist/mcp-sources.d.ts +1 -2
- package/dist/mcp-sources.js +1 -2
- package/dist/mcp-store.d.ts +5 -5
- package/dist/mcp-store.js +3 -3
- package/dist/mcp.js +1 -1
- package/dist/model-gateway.d.ts +1 -1
- package/dist/model-gateway.js +20 -36
- package/dist/ollama-provider.d.ts +23 -9
- package/dist/ollama-provider.js +49 -20
- package/dist/openapi.js +202 -51
- package/dist/otel/genai.d.ts +83 -7
- package/dist/otel/genai.js +69 -9
- package/dist/otel/tracer.d.ts +42 -13
- package/dist/otel/tracer.js +241 -56
- package/dist/page.d.ts +7 -1
- package/dist/page.js +76 -22
- package/dist/paid-calls.d.ts +6 -4
- package/dist/paid-calls.js +15 -7
- package/dist/place-offers.d.ts +55 -34
- package/dist/place-offers.js +93 -54
- package/dist/place.d.ts +13 -14
- package/dist/place.js +56 -41
- package/dist/print.js +1 -1
- package/dist/provider.d.ts +3 -2
- package/dist/provider.js +17 -8
- package/dist/redact/match.d.ts +27 -9
- package/dist/redact/match.js +266 -57
- package/dist/run-census.d.ts +1 -1
- package/dist/run-census.js +4 -5
- package/dist/run-cut.js +4 -5
- package/dist/run-export-store.d.ts +15 -0
- package/dist/run-export-store.js +30 -0
- package/dist/run-export.d.ts +139 -0
- package/dist/run-export.js +379 -0
- package/dist/run-file-cut.d.ts +5 -0
- package/dist/run-file-cut.js +13 -0
- package/dist/run-launch.js +16 -3
- package/dist/run-model-key.d.ts +15 -6
- package/dist/run-model-key.js +30 -31
- package/dist/run-reads-over-store.js +4 -4
- package/dist/run-secrets.js +3 -5
- package/dist/run-timeline-served.js +3 -1
- package/dist/runnable.js +2 -2
- package/dist/runner/adapter-loop.d.ts +35 -18
- package/dist/runner/adapter-loop.js +94 -47
- package/dist/runner/adapter-run-spec.d.ts +14 -1
- package/dist/runner/adapter-run-spec.js +64 -28
- package/dist/runner/adapters/pi.js +4 -2
- package/dist/runner/audit.d.ts +8 -5
- package/dist/runner/audit.js +37 -17
- package/dist/runner/beside.js +5 -6
- package/dist/runner/claim-secrets.d.ts +10 -3
- package/dist/runner/claim-secrets.js +29 -13
- package/dist/runner/cli-run-spec.d.ts +18 -0
- package/dist/runner/cli-run-spec.js +81 -46
- package/dist/runner/compare-end.d.ts +2 -1
- package/dist/runner/compare-end.js +25 -10
- package/dist/runner/conformance/harness.js +2 -3
- package/dist/runner/conformance/subject.d.ts +4 -1
- package/dist/runner/harness-loops.js +3 -3
- package/dist/runner/held.d.ts +5 -2
- package/dist/runner/journal-kinds.d.ts +4 -1
- package/dist/runner/journal-kinds.js +22 -4
- package/dist/runner/learned-first.js +20 -4
- package/dist/runner/learning-end.d.ts +2 -8
- package/dist/runner/learning-end.js +11 -19
- package/dist/runner/live-ticker.js +7 -5
- package/dist/runner/loop-contract.d.ts +0 -2
- package/dist/runner/loop.d.ts +7 -0
- package/dist/runner/loop.js +1 -0
- package/dist/runner/main.js +12 -11
- package/dist/runner/mcp-claim.js +21 -5
- package/dist/runner/meta-tools.js +3 -2
- package/dist/runner/metrics.d.ts +7 -0
- package/dist/runner/metrics.js +19 -0
- package/dist/runner/model-route.d.ts +10 -7
- package/dist/runner/model-route.js +79 -15
- package/dist/runner/native-loop.js +10 -8
- package/dist/runner/presence.d.ts +1 -4
- package/dist/runner/presence.js +6 -8
- package/dist/runner/promotion.d.ts +25 -13
- package/dist/runner/promotion.js +125 -50
- package/dist/runner/redact.d.ts +3 -1
- package/dist/runner/redact.js +5 -3
- package/dist/runner/responses-fetch.d.ts +36 -0
- package/dist/runner/responses-fetch.js +511 -0
- package/dist/runner/run-child-host.d.ts +20 -5
- package/dist/runner/run-child-host.js +179 -77
- package/dist/runner/run-child.js +11 -4
- package/dist/runner/runner-check.js +5 -1
- package/dist/runner/runner.d.ts +2 -3
- package/dist/runner/runner.js +13 -9
- package/dist/runner/sdk-loop.js +8 -8
- package/dist/runner/spec-holds.d.ts +8 -1
- package/dist/runner/spec-holds.js +9 -4
- package/dist/runner/workflow-calls.d.ts +9 -0
- package/dist/runner/workflow-calls.js +150 -0
- package/dist/runner/workflow-first.d.ts +120 -32
- package/dist/runner/workflow-first.js +218 -94
- package/dist/runner/workflow-spec.js +1 -1
- package/dist/runs-over-store.js +8 -7
- package/dist/save-once.d.ts +14 -0
- package/dist/save-once.js +31 -0
- package/dist/scrub-command.d.ts +34 -31
- package/dist/scrub-command.js +116 -147
- package/dist/sdk/runs.d.ts +6 -0
- package/dist/sdk/runs.js +89 -10
- package/dist/seal-key.js +4 -4
- package/dist/secret-cut.d.ts +3 -0
- package/dist/secret-cut.js +7 -1
- package/dist/secret-rules.d.ts +8 -1
- package/dist/secret-rules.js +482 -53
- package/dist/secrets.d.ts +51 -9
- package/dist/secrets.js +311 -21
- package/dist/server-keys.d.ts +4 -3
- package/dist/server-keys.js +4 -3
- package/dist/server-secrets-store.js +2 -4
- package/dist/server.d.ts +15 -3
- package/dist/server.js +312 -80
- package/dist/share-context.d.ts +22 -0
- package/dist/share-context.js +76 -0
- package/dist/shell-lex.d.ts +105 -0
- package/dist/shell-lex.js +646 -0
- package/dist/sign-ins-store.d.ts +5 -7
- package/dist/sign-ins-store.js +12 -16
- package/dist/sign-ins.d.ts +7 -11
- package/dist/sign-ins.js +40 -41
- package/dist/skills/agentrun-serve/SKILL.md +5 -2
- package/dist/start-switches.d.ts +6 -5
- package/dist/start-switches.js +8 -4
- package/dist/stats.d.ts +5 -1
- package/dist/stats.js +1 -1
- package/dist/store/agent-body.js +2 -2
- package/dist/store/dialect.d.ts +4 -0
- package/dist/store/dialect.js +1 -0
- package/dist/store/index.d.ts +2 -2
- package/dist/store/index.js +1 -1
- package/dist/store/mcp-record-keys.d.ts +10 -0
- package/dist/store/mcp-record-keys.js +13 -0
- package/dist/store/postgres/dialect.js +2 -0
- package/dist/store/postgres/migrations/0029_run_launch_census_settle.sql +28 -0
- package/dist/store/postgres/migrations/0030_learning_ledger_epoch.sql +40 -0
- package/dist/store/postgres/migrations/0031_learning_ledger_calls.sql +12 -0
- package/dist/store/postgres/store.js +4 -0
- package/dist/store/schema.d.ts +33 -10
- package/dist/store/schema.js +70 -16
- package/dist/store/seal.d.ts +4 -1
- package/dist/store/sqlite/run-launch.d.ts +3 -10
- package/dist/store/sqlite/run-launch.js +12 -23
- package/dist/store/sqlite/run-patch.d.ts +17 -10
- package/dist/store/sqlite/run-patch.js +50 -13
- package/dist/store/sqlite/store.d.ts +3 -0
- package/dist/store/sqlite/store.js +116 -34
- package/dist/store/store-schema.js +3 -4
- package/dist/store/store.d.ts +67 -32
- package/dist/store/store.js +14 -11
- package/dist/store-reads/analytics.d.ts +2 -1
- package/dist/store-reads/analytics.js +7 -5
- package/dist/store-reads/learning.d.ts +35 -26
- package/dist/store-reads/learning.js +120 -92
- package/dist/store-reads/stats.d.ts +2 -2
- package/dist/store-reads/stats.js +13 -7
- package/dist/store-view.js +10 -7
- package/dist/suggestions.d.ts +1 -1
- package/dist/suggestions.js +29 -13
- package/dist/template-eval.d.ts +72 -9
- package/dist/template-eval.js +358 -64
- package/dist/timeline/labels.d.ts +1 -1
- package/dist/timeline/labels.js +4 -3
- package/dist/timeline/timeline.d.ts +23 -11
- package/dist/timeline/timeline.js +115 -31
- package/dist/timeline/web-calls.d.ts +8 -6
- package/dist/timeline/web-calls.js +10 -6
- package/dist/tool-gate.d.ts +13 -1
- package/dist/tool-gate.js +43 -3
- package/dist/tool-keys-store.js +2 -4
- package/dist/tool-keys.d.ts +11 -0
- package/dist/tool-keys.js +16 -0
- package/dist/tool-plane.d.ts +50 -11
- package/dist/tool-plane.js +94 -30
- package/dist/tools.d.ts +5 -1
- package/dist/tools.js +7 -7
- package/dist/trigger-email.js +12 -6
- package/dist/triggers.d.ts +15 -34
- package/dist/triggers.js +119 -126
- package/dist/validate.d.ts +8 -1
- package/dist/validate.js +163 -23
- package/dist/web-fake.d.ts +2 -1
- package/dist/web-fake.js +8 -6
- package/dist/web-fetch.d.ts +8 -6
- package/dist/web-fetch.js +13 -11
- package/dist/web-holds.d.ts +32 -0
- package/dist/web-holds.js +86 -0
- package/dist/web-run.d.ts +32 -5
- package/dist/web-run.js +75 -28
- package/dist/web-save.js +23 -12
- package/dist/web-search.js +14 -25
- package/dist/wires.d.ts +4 -3
- package/dist/wires.js +5 -4
- package/dist/workspace/archil-claim.d.ts +12 -5
- package/dist/workspace/archil-claim.js +45 -5
- package/dist/workspace/attach.js +52 -19
- package/dist/workspace/attached-computers.d.ts +6 -2
- package/dist/workspace/attached-computers.js +5 -4
- package/dist/workspace/computer-deps.d.ts +23 -6
- package/dist/workspace/computer-deps.js +35 -17
- package/dist/workspace/computer-for-claim.d.ts +21 -4
- package/dist/workspace/computer-for-claim.js +160 -54
- package/dist/workspace/computer-intervals.d.ts +2 -0
- package/dist/workspace/computer-intervals.js +1 -1
- package/dist/workspace/computer-janitor.d.ts +48 -14
- package/dist/workspace/computer-janitor.js +153 -44
- package/dist/workspace/computer-kept.d.ts +158 -32
- package/dist/workspace/computer-kept.js +288 -63
- package/dist/workspace/computer-providers.d.ts +8 -3
- package/dist/workspace/computer-providers.js +12 -5
- package/dist/workspace/index.d.ts +1 -1
- package/dist/workspace/index.js +1 -1
- package/dist/workspace/local.js +41 -1
- package/dist/workspace/mount-revoke-left.d.ts +31 -0
- package/dist/workspace/mount-revoke-left.js +72 -0
- package/dist/workspace/paired-route.js +4 -5
- package/dist/workspace/resolve-computer.d.ts +5 -2
- package/dist/workspace/resolve-computer.js +9 -3
- package/dist/workspace/run-end-computers.d.ts +11 -5
- package/dist/workspace/run-end-computers.js +153 -28
- package/dist/workspace/run-tools.d.ts +22 -3
- package/dist/workspace/run-tools.js +17 -5
- package/dist/workspace/run-workspace.d.ts +14 -1
- package/dist/workspace/run-workspace.js +34 -1
- package/dist/workspace/workspace.d.ts +6 -0
- package/package.json +12 -13
- package/skills/agentrun-serve/SKILL.md +5 -2
- package/templates/README.md +22 -6
- package/dist/console/assets/backend-CSAWUqtZ.js +0 -166
- package/dist/console/assets/index-Bwn1oTem.css +0 -1
- package/dist/console/assets/index-DPh29cyz.js +0 -747
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 } from "./env-switch.js";
|
|
17
|
+
import { API_ONLY_ENV, API_ONLY_MCP_ORIGINS_ENV, apiOnlyMcpOriginsFrom, RUN_KEYS_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";
|
|
@@ -37,7 +37,7 @@ const USAGE = `usage: agentrun-serve [--data DIR] [--listen ADDR] [--port N] [--
|
|
|
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]
|
|
39
39
|
agentrun-serve eval-template DIR [--case NAME ...] [--runs N] [--server URL | --on-data DIR] [--grader-model PROVIDER/MODEL] [--report FILE] [--faux MODULE]
|
|
40
|
-
agentrun-serve import [--data DIR] [--from claude-code,codex,pi] [--dry-run] [--include-deleted] [--all] [--verbose] [--port N]
|
|
40
|
+
agentrun-serve import [--data DIR] [--from claude-code,codex,pi,opencode,copilot] [--dry-run] [--include-deleted] [--all] [--verbose] [--port N]
|
|
41
41
|
agentrun-serve learning connect|status|disconnect|retry --project PATH --runtime codex|claude-code [--url URL] [--data DIR] [--no-sync]
|
|
42
42
|
agentrun-serve runner --data DIR [--loops N] [--drain-timeout D] [--name NAME]
|
|
43
43
|
agentrun-serve runner --check --data DIR [--name NAME]
|
|
@@ -108,7 +108,10 @@ AGENTRUN_PUBLIC_URL, when set, is the address people open (a container's
|
|
|
108
108
|
published port, or a proxy's URL), and the link printed uses it; with none, Render's RENDER_EXTERNAL_URL is.
|
|
109
109
|
AGENTRUN_FREE_MODEL_REQUESTS (default 60) is the most requests on free models ($0 in the catalog) a run makes, capped
|
|
110
110
|
or not (ChatGPT-plan requests don't count): the next is not sent and the run fails, spend_cap_reached. stdout gets one line per request, per run start and
|
|
111
|
-
end, and per refused credential; AGENTRUN_LOG=quiet leaves out the request lines.
|
|
111
|
+
end, and per refused credential; AGENTRUN_LOG=quiet leaves out the request lines. AGENTRUN_LOG=debug keeps them and
|
|
112
|
+
also writes into a run's log one line per call an ACP agent announces, on a recipe that declares announces: its
|
|
113
|
+
toolCallId, kind and the tool name the recipe's field holds when it names an AgentRun tool ("native" for
|
|
114
|
+
any other call), never its input.
|
|
112
115
|
|
|
113
116
|
AGENTRUN_TELEMETRY=0 (or DO_NOT_TRACK=1) turns off the anonymous usage counts (docs/telemetry.md): a random id, the
|
|
114
117
|
version, the platform and how many runs as a range, never prompts, files or keys. Off in CI, under a test runner and under --faux too;
|
|
@@ -138,15 +141,16 @@ start: set it only on a machine you alone use, since loopback is this machine's
|
|
|
138
141
|
process reaches one only with the variable set in its own environment, on its own loopback (its own machine or
|
|
139
142
|
container), never at a server's own port (${DEFAULT_PORT}, or where the server says it listens).
|
|
140
143
|
|
|
141
|
-
\`agentrun-serve import\` reads the Claude Code, Codex and
|
|
142
|
-
~/.codex/sessions, ~/.pi/agent/sessions
|
|
143
|
-
CLAUDE.md or AGENTS.md and its skill folders, and
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
144
|
+
\`agentrun-serve import\` reads the Claude Code, Codex, pi, OpenCode and Copilot CLI sessions in your own home
|
|
145
|
+
(~/.claude/projects, ~/.codex/sessions, ~/.pi/agent/sessions, ~/.local/share/opencode, ~/.copilot/session-state) into
|
|
146
|
+
the data directory, once: each project directory an agent, with its CLAUDE.md or AGENTS.md and its skill folders, and
|
|
147
|
+
each session a run you can read but not continue. Nothing leaves this machine; the values of key-shaped environment
|
|
148
|
+
variables are cut out of what is written. --dry-run lists what it would import; run again, it imports only what it has
|
|
149
|
+
not. Sessions written in the last 10 minutes wait for the next import. What is left out is counted by why; --verbose
|
|
150
|
+
lists each file. --include-deleted keeps projects whose directory is gone (a deleted worktree's); --all keeps those and
|
|
151
|
+
temporary ones too. Each run keeps what its session used (tokens, requests, tools, time at work), priced at the
|
|
152
|
+
catalog's list prices when its source did not price it. Both end with a summary of every session found, those imported
|
|
153
|
+
before included, and the address to open the console at (--port as the server takes it).
|
|
150
154
|
|
|
151
155
|
\`agentrun-serve store-schema\` prints, as one line of JSON, the store's schema version and runner floor (the oldest version
|
|
152
156
|
a runner's build must know to run on it) beside the version this build knows, and what this build's server and runner do
|
|
@@ -370,10 +374,14 @@ if (process.argv[2] === "validate-template") {
|
|
|
370
374
|
// in the environment or the arguments). Progress on stderr, the summary on stdout, the whole report as JSON to --report.
|
|
371
375
|
// 0: every case passed; 1: one failed; 2: the flags, the package or a case is wrong, and nothing ran. --data is taken and
|
|
372
376
|
// ignored, as validate-template's is: the npx launcher hands every server command one, and an eval's store is a temp one.
|
|
373
|
-
|
|
377
|
+
class EvalTemplateUsage extends Error {
|
|
378
|
+
}
|
|
379
|
+
async function evalTemplateCommand() {
|
|
374
380
|
const { CaseError, evalTemplate, exitCodeOf, markdownReport, ON_DATA_WITH_SERVER } = await import("./template-eval.js");
|
|
375
381
|
const { PackageError } = await import("./templates.js");
|
|
376
|
-
const usage = (message) =>
|
|
382
|
+
const usage = (message) => {
|
|
383
|
+
throw new EvalTemplateUsage(`agentrun-serve eval-template: ${message}\n\n${USAGE}`);
|
|
384
|
+
};
|
|
377
385
|
const read = () => {
|
|
378
386
|
try {
|
|
379
387
|
return parseArgs({ args: process.argv.slice(3), allowPositionals: true, options: { case: { type: "string", multiple: true, default: [] }, runs: { type: "string" }, server: { type: "string" }, "grader-model": { type: "string" }, report: { type: "string" }, faux: { type: "string" }, data: { type: "string" }, "on-data": { type: "string" } } });
|
|
@@ -433,300 +441,323 @@ if (process.argv[2] === "eval-template") {
|
|
|
433
441
|
if (given.report !== undefined)
|
|
434
442
|
writeFileSync(resolve(given.report), `${JSON.stringify(report, null, 2)}\n`);
|
|
435
443
|
process.stdout.write(markdownReport(report));
|
|
436
|
-
|
|
444
|
+
return exitCodeOf(report);
|
|
437
445
|
}
|
|
438
446
|
catch (error) {
|
|
439
447
|
if (stop.signal.aborted) {
|
|
440
448
|
console.error("agentrun-serve eval-template: stopped; no report.");
|
|
441
|
-
|
|
449
|
+
return 130;
|
|
442
450
|
}
|
|
443
451
|
if (!(error instanceof PackageError || error instanceof CaseError))
|
|
444
452
|
throw error;
|
|
445
453
|
console.error(error.message);
|
|
446
|
-
|
|
454
|
+
return 2;
|
|
447
455
|
}
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
// or SIGINT. Its exit: 2 bad arguments, 3 a store schema it does not know (or one whose runner floor rose above it while it
|
|
451
|
-
// ran: its runs handed back), 1 anything else, 0 closed. `--check` checks its environment by name (runner-check.ts) and its
|
|
452
|
-
// heartbeat; `--check --env` its environment alone (0 complete, 1 a gap).
|
|
453
|
-
if (process.argv[2] === "runner") {
|
|
454
|
-
const { runnerMain } = await import("./runner/main.js");
|
|
455
|
-
process.exit(await runnerMain(process.argv.slice(3)));
|
|
456
|
-
}
|
|
457
|
-
// The store's schema and runner floor, read-only (store/store-schema.ts), for a deploy's skew check.
|
|
458
|
-
if (process.argv[2] === "store-schema") {
|
|
459
|
-
const { storeSchemaMain } = await import("./store/store-schema.js");
|
|
460
|
-
process.exit(await storeSchemaMain(process.argv.slice(3), defaultData(), USAGE));
|
|
461
|
-
}
|
|
462
|
-
if (process.argv[2] === "scrub") {
|
|
463
|
-
const { scrubMain } = await import("./scrub-command.js");
|
|
464
|
-
process.exit(await scrubMain(process.argv.slice(3), commandUsage));
|
|
465
|
-
}
|
|
466
|
-
if (process.argv[2] === "import") {
|
|
467
|
-
const { importCommand } = await import("./import.js");
|
|
468
|
-
process.exit(await importCommand(process.argv.slice(3), USAGE));
|
|
469
|
-
}
|
|
470
|
-
let values;
|
|
471
|
-
try {
|
|
472
|
-
({ values } = parseArgs({
|
|
473
|
-
// Named, not the default: started by the launcher, this module runs under `node -e`, where the default reads one more.
|
|
474
|
-
args: process.argv.slice(2),
|
|
475
|
-
options: {
|
|
476
|
-
data: { type: "string" },
|
|
477
|
-
listen: { type: "string" },
|
|
478
|
-
port: { type: "string" },
|
|
479
|
-
open: { type: "boolean", default: false },
|
|
480
|
-
faux: { type: "string" },
|
|
481
|
-
"faux-browser": { type: "string" },
|
|
482
|
-
"faux-github": { type: "boolean", default: false },
|
|
483
|
-
"allow-host": { type: "string", multiple: true, default: [] },
|
|
484
|
-
"max-runs": { type: "string" },
|
|
485
|
-
"drain-timeout": { type: "string" },
|
|
486
|
-
documents: { type: "string" },
|
|
487
|
-
"allow-code-nodes": { type: "boolean", default: false },
|
|
488
|
-
learning: { type: "string" },
|
|
489
|
-
"no-runner": { type: "boolean", default: false },
|
|
490
|
-
"harness-module": { type: "string", multiple: true, default: [] },
|
|
491
|
-
"harness-recipe": { type: "string", multiple: true, default: [] },
|
|
492
|
-
"harness-sign-in": { type: "boolean", default: false },
|
|
493
|
-
help: { type: "boolean", short: "h", default: false },
|
|
494
|
-
},
|
|
495
|
-
}));
|
|
496
|
-
}
|
|
497
|
-
catch (error) {
|
|
498
|
-
console.error(`${error.message}\n\n${USAGE}`);
|
|
499
|
-
process.exit(2);
|
|
500
|
-
}
|
|
501
|
-
if (values.help) {
|
|
502
|
-
console.log(USAGE);
|
|
503
|
-
process.exit(0);
|
|
504
|
-
}
|
|
505
|
-
const port = values.port === undefined ? DEFAULT_PORT : Number(values.port);
|
|
506
|
-
if (!Number.isInteger(port) || port < 0 || port > 65_535) {
|
|
507
|
-
console.error(`--port takes a port number\n\n${USAGE}`);
|
|
508
|
-
process.exit(2);
|
|
509
|
-
}
|
|
510
|
-
let publicUrl;
|
|
511
|
-
// Render sets RENDER_EXTERNAL_URL on every web service, so a deploy there is never an open setup.
|
|
512
|
-
const publicName = process.env.AGENTRUN_PUBLIC_URL ? "AGENTRUN_PUBLIC_URL" : process.env.RENDER_EXTERNAL_URL ? "RENDER_EXTERNAL_URL" : undefined;
|
|
513
|
-
if (publicName) {
|
|
514
|
-
const given = process.env[publicName];
|
|
515
|
-
const parsed = URL.canParse(given) ? new URL(given) : undefined;
|
|
516
|
-
if (!parsed || !/^https?:$/.test(parsed.protocol)) {
|
|
517
|
-
console.error(`${publicName} takes an http(s) URL\n\n${USAGE}`);
|
|
518
|
-
process.exit(2);
|
|
456
|
+
finally {
|
|
457
|
+
stop.unhook();
|
|
519
458
|
}
|
|
520
|
-
publicUrl = parsed.href.replace(/\/+$/, "");
|
|
521
|
-
}
|
|
522
|
-
if (values["faux-browser"] && !values.faux) {
|
|
523
|
-
console.error(`--faux-browser goes with --faux\n\n${USAGE}`);
|
|
524
|
-
process.exit(2);
|
|
525
|
-
}
|
|
526
|
-
if (values["faux-github"] && !values.faux) {
|
|
527
|
-
console.error(`--faux-github goes with --faux\n\n${USAGE}`);
|
|
528
|
-
process.exit(2);
|
|
529
|
-
}
|
|
530
|
-
const data = values.data ?? defaultData();
|
|
531
|
-
const given = secret("AGENTRUN_TOKEN") || undefined;
|
|
532
|
-
// More tokens, each with an id (api-token.ts), for a rotation with no caller refused; never printed. A list that cannot
|
|
533
|
-
// be read stops here, in words that hold no secret.
|
|
534
|
-
let givenList;
|
|
535
|
-
try {
|
|
536
|
-
givenList = parseTokens(secret("AGENTRUN_TOKENS"));
|
|
537
|
-
}
|
|
538
|
-
catch (error) {
|
|
539
|
-
console.error(`${error.message}\n\n${USAGE}`);
|
|
540
|
-
process.exit(2);
|
|
541
|
-
}
|
|
542
|
-
// The stop is listened for before anything starts: a SIGTERM or SIGINT during the start (a platform's redeploy, the
|
|
543
|
-
// moment the banner shows) is kept, never the default end by signal that cuts what the start began. Once the start has
|
|
544
|
-
// what a stop closes, the stop below takes over (stopOnSignals), and a stop asked meanwhile runs it, through the same
|
|
545
|
-
// drain. A second signal a while after the first, still during the start, is a person who wants out now: exit 130.
|
|
546
|
-
let stopping;
|
|
547
|
-
let askedAt;
|
|
548
|
-
const signalled = () => {
|
|
549
|
-
if (stopping)
|
|
550
|
-
return stopping();
|
|
551
|
-
if (askedAt === undefined)
|
|
552
|
-
askedAt = Date.now();
|
|
553
|
-
else if (Date.now() - askedAt >= REPEAT_MS)
|
|
554
|
-
process.exit(130);
|
|
555
|
-
};
|
|
556
|
-
process.on("SIGINT", signalled);
|
|
557
|
-
process.on("SIGTERM", signalled);
|
|
558
|
-
// AGENTRUN_API_ONLY=1: the run routes alone (api-only.ts), and no owner; a value that is neither on nor off stops here.
|
|
559
|
-
// AGENTRUN_RUN_KEYS=1: each run brings the tool keys this server does not hold (run-keys.ts), read the same way.
|
|
560
|
-
// AGENTRUN_API_ONLY_MCP_ORIGINS: the MCP origins its token may save a per_run server at (api-only.ts), read with it alone.
|
|
561
|
-
let apiOnly;
|
|
562
|
-
let runKeys;
|
|
563
|
-
let apiOnlyMcpOrigins;
|
|
564
|
-
try {
|
|
565
|
-
apiOnly = switchFrom(API_ONLY_ENV);
|
|
566
|
-
runKeys = switchFrom(RUN_KEYS_ENV);
|
|
567
|
-
apiOnlyMcpOrigins = apiOnly ? apiOnlyMcpOriginsFrom(process.env[API_ONLY_MCP_ORIGINS_ENV]) : [];
|
|
568
|
-
}
|
|
569
|
-
catch (error) {
|
|
570
|
-
console.error(`${error.message}\n\n${USAGE}`);
|
|
571
|
-
process.exit(2);
|
|
572
|
-
}
|
|
573
|
-
// The launch hook: the URL from the environment, its secret as the server holds its own (by name, on the launcher's
|
|
574
|
-
// list); half set or malformed stops here, in words that never hold the secret.
|
|
575
|
-
let launchHook;
|
|
576
|
-
try {
|
|
577
|
-
launchHook = launchHookFrom({ url: process.env[LAUNCH_HOOK_URL_ENV], secret: secret(LAUNCH_HOOK_SECRET_ENV) });
|
|
578
459
|
}
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
process.exit(1);
|
|
594
|
-
}
|
|
595
|
-
if (early)
|
|
596
|
-
console.log(`Starting ${publicUrl ?? urlOf(early, values.listen ?? DEFAULT_HOST)}/ (warming: health says so and the API answers 503 until the server is ready)`);
|
|
597
|
-
const [{ fauxEnvOf, startServe }, { besideRunnerOptions, besideStopping, runnerBeside }, { earlierDataRefusal, startedWith }, { canOpen }] = await Promise.all([import("./server.js"), import("./runner/beside.js"), import("./adapters.js"), import("./host.js")]);
|
|
598
|
-
// How it was started, for the hints that start it again (adapters.ts npxLine): itself and its runs read it.
|
|
599
|
-
Object.assign(process.env, startedWith({ ...(values.port !== undefined ? { port: values.port } : {}), open: values.open === true }));
|
|
600
|
-
let serve;
|
|
601
|
-
let serveOptions;
|
|
602
|
-
// The anonymous counts start once the server has (below); a feature used before then, in the start's first moment, is not counted.
|
|
603
|
-
let used;
|
|
604
|
-
const trustedProxies = (process.env.AGENTRUN_TRUSTED_PROXIES ?? "").split(",").map((entry) => entry.trim()).filter(Boolean);
|
|
605
|
-
try {
|
|
606
|
-
serve = await startServe(serveOptions = {
|
|
607
|
-
// The owner lock on a Postgres store lost for good: this server can serve nothing more, so it exits non-zero and its
|
|
608
|
-
// platform starts it again, rather than answer 503 for as long as it runs.
|
|
609
|
-
onStoreLost: (error) => {
|
|
610
|
-
console.error(`agentrun-serve: ${error.message}`);
|
|
611
|
-
process.exit(1);
|
|
612
|
-
},
|
|
613
|
-
onUsage: (event) => used?.(event),
|
|
614
|
-
data, port, ...(values.port === undefined ? { nextFreePort: true } : {}), ...(early ? { listener: early } : {}), ...(values.listen ? { host: values.listen } : {}), ...(given ? { token: given } : {}), ...(givenList ? { tokens: givenList } : {}), ...(values.faux ? { faux: values.faux } : {}), ...(values["faux-browser"] ? { fauxBrowser: values["faux-browser"] } : {}), ...(values["faux-github"] ? { fauxGitHub: true } : {}), allowHosts: values["allow-host"],
|
|
615
|
-
...(values["max-runs"] !== undefined ? { maxRuns: Number(values["max-runs"]) } : {}),
|
|
616
|
-
// The owner's harness modules: --harness-module, else AGENTRUN_SERVE_HARNESS_MODULES (harness-table.ts).
|
|
617
|
-
...(harnessModulesOf(values["harness-module"], process.env).length ? { harnessModules: harnessModulesOf(values["harness-module"], process.env) } : {}),
|
|
618
|
-
// And its harness recipes: --harness-recipe, else AGENTRUN_SERVE_HARNESS_RECIPES (harness-table.ts).
|
|
619
|
-
...(harnessRecipesOf(values["harness-recipe"], process.env).length ? { harnessRecipes: harnessRecipesOf(values["harness-recipe"], process.env) } : {}),
|
|
620
|
-
// Their runs on the owner's own sign-in, only as the owner says it here (no setting names it) and the start proves.
|
|
621
|
-
...(values["harness-sign-in"] ? { harnessSignIn: true } : {}),
|
|
622
|
-
...(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`),
|
|
623
|
-
// The public address is the server's with accounts on or off: the Host names it serves, the webhook URLs it gives.
|
|
624
|
-
...(publicUrl ? { publicUrl } : {}),
|
|
625
|
-
...(accounts ? { accounts, openSetup: !publicUrl, countSessions: true } : {}), ...(apiOnly ? { apiOnly } : {}), ...(launchHook ? { launchHook } : {}), ...(runKeys ? { runKeys } : {}),
|
|
626
|
-
...(apiOnlyMcpOrigins.length ? { apiOnlyMcpOrigins } : {}),
|
|
627
|
-
// The proxies whose X-Forwarded-For the sign-in limit reads (comma-separated); none unless set.
|
|
628
|
-
...(trustedProxies.length ? { trustedProxies } : {}),
|
|
629
|
-
// A local install only as its operator says, never inferred: an MCP server on loopback is refused without it.
|
|
630
|
-
...(process.env.AGENTRUN_MCP_ALLOW_LOOPBACK === "1" ? { mcpLoopback: true } : {}),
|
|
631
|
-
// No runner beside this server: a paired computer's socket stays here, where no run reaches it, which the pairing says.
|
|
632
|
-
...(values["no-runner"] ? { runnerApart: true } : {}),
|
|
633
|
-
});
|
|
634
|
-
}
|
|
635
|
-
catch (error) {
|
|
636
|
-
// A data directory an earlier version wrote, refused on a start `npx @parcha/agentrun` made: the ways on as that command
|
|
637
|
-
// (adapters.ts earlierDataRefusal). Any other start keeps the refusal's own words.
|
|
638
|
-
console.error(`agentrun-serve: ${earlierDataRefusal(error, data, process.env) ?? error.message}`);
|
|
639
|
-
process.exit(1);
|
|
460
|
+
// Its code is left as the process's exit code and the process ends on its own, never by process.exit: Node's
|
|
461
|
+
// process.exit stops V8's worker threads before the isolate is torn down, so a background compile job waiting for a
|
|
462
|
+
// collection only the main thread runs is never woken, and process.exit waits on that thread forever (about 1 in 160
|
|
463
|
+
// refusals hung so, after writing their words). The isolate's own teardown wakes such a job first.
|
|
464
|
+
if (process.argv[2] === "eval-template") {
|
|
465
|
+
try {
|
|
466
|
+
process.exitCode = await evalTemplateCommand();
|
|
467
|
+
}
|
|
468
|
+
catch (error) {
|
|
469
|
+
if (!(error instanceof EvalTemplateUsage))
|
|
470
|
+
throw error;
|
|
471
|
+
console.error(error.message);
|
|
472
|
+
process.exitCode = 2;
|
|
473
|
+
}
|
|
640
474
|
}
|
|
641
|
-
|
|
642
|
-
//
|
|
643
|
-
//
|
|
644
|
-
//
|
|
645
|
-
// its
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
475
|
+
else {
|
|
476
|
+
// The runner process (runner/main.ts): beside the server, its own store connection in --data, claiming runs until SIGTERM
|
|
477
|
+
// or SIGINT. Its exit: 2 bad arguments, 3 a store schema it does not know (or one whose runner floor rose above it while it
|
|
478
|
+
// ran: its runs handed back), 1 anything else, 0 closed. `--check` checks its environment by name (runner-check.ts) and its
|
|
479
|
+
// heartbeat; `--check --env` its environment alone (0 complete, 1 a gap).
|
|
480
|
+
if (process.argv[2] === "runner") {
|
|
481
|
+
const { runnerMain } = await import("./runner/main.js");
|
|
482
|
+
process.exit(await runnerMain(process.argv.slice(3)));
|
|
483
|
+
}
|
|
484
|
+
// The store's schema and runner floor, read-only (store/store-schema.ts), for a deploy's skew check.
|
|
485
|
+
if (process.argv[2] === "store-schema") {
|
|
486
|
+
const { storeSchemaMain } = await import("./store/store-schema.js");
|
|
487
|
+
process.exit(await storeSchemaMain(process.argv.slice(3), defaultData(), USAGE));
|
|
488
|
+
}
|
|
489
|
+
if (process.argv[2] === "scrub") {
|
|
490
|
+
const { scrubMain } = await import("./scrub-command.js");
|
|
491
|
+
process.exit(await scrubMain(process.argv.slice(3), commandUsage));
|
|
492
|
+
}
|
|
493
|
+
if (process.argv[2] === "import") {
|
|
494
|
+
const { importCommand } = await import("./import.js");
|
|
495
|
+
process.exit(await importCommand(process.argv.slice(3), USAGE));
|
|
496
|
+
}
|
|
497
|
+
let values;
|
|
654
498
|
try {
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
499
|
+
({ values } = parseArgs({
|
|
500
|
+
// Named, not the default: started by the launcher, this module runs under `node -e`, where the default reads one more.
|
|
501
|
+
args: process.argv.slice(2),
|
|
502
|
+
options: {
|
|
503
|
+
data: { type: "string" },
|
|
504
|
+
listen: { type: "string" },
|
|
505
|
+
port: { type: "string" },
|
|
506
|
+
open: { type: "boolean", default: false },
|
|
507
|
+
faux: { type: "string" },
|
|
508
|
+
"faux-browser": { type: "string" },
|
|
509
|
+
"faux-github": { type: "boolean", default: false },
|
|
510
|
+
"allow-host": { type: "string", multiple: true, default: [] },
|
|
511
|
+
"max-runs": { type: "string" },
|
|
512
|
+
"drain-timeout": { type: "string" },
|
|
513
|
+
documents: { type: "string" },
|
|
514
|
+
"allow-code-nodes": { type: "boolean", default: false },
|
|
515
|
+
learning: { type: "string" },
|
|
516
|
+
"no-runner": { type: "boolean", default: false },
|
|
517
|
+
"harness-module": { type: "string", multiple: true, default: [] },
|
|
518
|
+
"harness-recipe": { type: "string", multiple: true, default: [] },
|
|
519
|
+
"harness-sign-in": { type: "boolean", default: false },
|
|
520
|
+
help: { type: "boolean", short: "h", default: false },
|
|
521
|
+
},
|
|
522
|
+
}));
|
|
667
523
|
}
|
|
668
524
|
catch (error) {
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
525
|
+
console.error(`${error.message}\n\n${USAGE}`);
|
|
526
|
+
process.exit(2);
|
|
527
|
+
}
|
|
528
|
+
if (values.help) {
|
|
529
|
+
console.log(USAGE);
|
|
530
|
+
process.exit(0);
|
|
531
|
+
}
|
|
532
|
+
const port = values.port === undefined ? DEFAULT_PORT : Number(values.port);
|
|
533
|
+
if (!Number.isInteger(port) || port < 0 || port > 65_535) {
|
|
534
|
+
console.error(`--port takes a port number\n\n${USAGE}`);
|
|
535
|
+
process.exit(2);
|
|
536
|
+
}
|
|
537
|
+
let publicUrl;
|
|
538
|
+
// Render sets RENDER_EXTERNAL_URL on every web service, so a deploy there is never an open setup.
|
|
539
|
+
const publicName = process.env.AGENTRUN_PUBLIC_URL ? "AGENTRUN_PUBLIC_URL" : process.env.RENDER_EXTERNAL_URL ? "RENDER_EXTERNAL_URL" : undefined;
|
|
540
|
+
if (publicName) {
|
|
541
|
+
const given = process.env[publicName];
|
|
542
|
+
const parsed = URL.canParse(given) ? new URL(given) : undefined;
|
|
543
|
+
if (!parsed || !/^https?:$/.test(parsed.protocol)) {
|
|
544
|
+
console.error(`${publicName} takes an http(s) URL\n\n${USAGE}`);
|
|
545
|
+
process.exit(2);
|
|
677
546
|
}
|
|
547
|
+
publicUrl = parsed.href.replace(/\/+$/, "");
|
|
548
|
+
}
|
|
549
|
+
if (values["faux-browser"] && !values.faux) {
|
|
550
|
+
console.error(`--faux-browser goes with --faux\n\n${USAGE}`);
|
|
551
|
+
process.exit(2);
|
|
552
|
+
}
|
|
553
|
+
if (values["faux-github"] && !values.faux) {
|
|
554
|
+
console.error(`--faux-github goes with --faux\n\n${USAGE}`);
|
|
555
|
+
process.exit(2);
|
|
556
|
+
}
|
|
557
|
+
const data = values.data ?? defaultData();
|
|
558
|
+
const given = secret("AGENTRUN_TOKEN") || undefined;
|
|
559
|
+
// More tokens, each with an id (api-token.ts), for a rotation with no caller refused; never printed. A list that cannot
|
|
560
|
+
// be read stops here, in words that hold no secret.
|
|
561
|
+
let givenList;
|
|
562
|
+
try {
|
|
563
|
+
givenList = parseTokens(secret("AGENTRUN_TOKENS"));
|
|
564
|
+
}
|
|
565
|
+
catch (error) {
|
|
566
|
+
console.error(`${error.message}\n\n${USAGE}`);
|
|
567
|
+
process.exit(2);
|
|
568
|
+
}
|
|
569
|
+
// The stop is listened for before anything starts: a SIGTERM or SIGINT during the start (a platform's redeploy, the
|
|
570
|
+
// moment the banner shows) is kept, never the default end by signal that cuts what the start began. Once the start has
|
|
571
|
+
// what a stop closes, the stop below takes over (stopOnSignals), and a stop asked meanwhile runs it, through the same
|
|
572
|
+
// drain. A second signal a while after the first, still during the start, is a person who wants out now: exit 130.
|
|
573
|
+
let stopping;
|
|
574
|
+
let askedAt;
|
|
575
|
+
const signalled = () => {
|
|
576
|
+
if (stopping)
|
|
577
|
+
return stopping();
|
|
578
|
+
if (askedAt === undefined)
|
|
579
|
+
askedAt = Date.now();
|
|
580
|
+
else if (Date.now() - askedAt >= REPEAT_MS)
|
|
581
|
+
process.exit(130);
|
|
582
|
+
};
|
|
583
|
+
process.on("SIGINT", signalled);
|
|
584
|
+
process.on("SIGTERM", signalled);
|
|
585
|
+
// AGENTRUN_API_ONLY=1: the run routes alone (api-only.ts), and no owner; a value that is neither on nor off stops here.
|
|
586
|
+
// AGENTRUN_RUN_KEYS=1: each run brings the tool keys this server does not hold (run-keys.ts), read the same way.
|
|
587
|
+
// AGENTRUN_WEB_JEV_OFF=1: the web tools run without Jev (web-run.ts jevWebOf); read where each run's Web is made, and
|
|
588
|
+
// only checked here.
|
|
589
|
+
// 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
|
+
let apiOnly;
|
|
591
|
+
let runKeys;
|
|
592
|
+
let apiOnlyMcpOrigins;
|
|
593
|
+
try {
|
|
594
|
+
apiOnly = switchFrom(API_ONLY_ENV);
|
|
595
|
+
runKeys = switchFrom(RUN_KEYS_ENV);
|
|
596
|
+
switchFrom(WEB_JEV_OFF_ENV);
|
|
597
|
+
apiOnlyMcpOrigins = apiOnly ? apiOnlyMcpOriginsFrom(process.env[API_ONLY_MCP_ORIGINS_ENV]) : [];
|
|
598
|
+
}
|
|
599
|
+
catch (error) {
|
|
600
|
+
console.error(`${error.message}\n\n${USAGE}`);
|
|
601
|
+
process.exit(2);
|
|
602
|
+
}
|
|
603
|
+
// The launch hook: the URL from the environment, its secret as the server holds its own (by name, on the launcher's
|
|
604
|
+
// list); half set or malformed stops here, in words that never hold the secret.
|
|
605
|
+
let launchHook;
|
|
606
|
+
try {
|
|
607
|
+
launchHook = launchHookFrom({ url: process.env[LAUNCH_HOOK_URL_ENV], secret: secret(LAUNCH_HOOK_SECRET_ENV) });
|
|
608
|
+
}
|
|
609
|
+
catch (error) {
|
|
610
|
+
console.error(`agentrun-serve: ${error.message}`);
|
|
611
|
+
process.exit(2);
|
|
612
|
+
}
|
|
613
|
+
const accounts = !apiOnly && process.env.AGENTRUN_ACCOUNTS !== "0";
|
|
614
|
+
// The address first (listen-first.ts): the port bound and named before the rest of the server loads, then answering that
|
|
615
|
+
// the server is warming until it takes the socket over. A port already taken is left to the start's own listen below,
|
|
616
|
+
// which waits for a server it replaces, as it always has: no early line then. The banner's "Open " line still means ready.
|
|
617
|
+
let early;
|
|
618
|
+
try {
|
|
619
|
+
early = await listenFirst({ host: values.listen ?? DEFAULT_HOST, port, data, env: process.env });
|
|
620
|
+
}
|
|
621
|
+
catch (error) {
|
|
678
622
|
console.error(`agentrun-serve: ${error.message}`);
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
623
|
+
process.exit(1);
|
|
624
|
+
}
|
|
625
|
+
if (early)
|
|
626
|
+
console.log(`Starting ${publicUrl ?? urlOf(early, values.listen ?? DEFAULT_HOST)}/ (warming: health says so and the API answers 503 until the server is ready)`);
|
|
627
|
+
const [{ fauxEnvOf, startServe }, { besideRunnerOptions, besideStopping, runnerBeside }, { earlierDataRefusal, startedWith }, { canOpen }] = await Promise.all([import("./server.js"), import("./runner/beside.js"), import("./adapters.js"), import("./host.js")]);
|
|
628
|
+
// How it was started, for the hints that start it again (adapters.ts npxLine): itself and its runs read it.
|
|
629
|
+
Object.assign(process.env, startedWith({ ...(values.port !== undefined ? { port: values.port } : {}), open: values.open === true }));
|
|
630
|
+
let serve;
|
|
631
|
+
let serveOptions;
|
|
632
|
+
// The anonymous counts start once the server has (below); a feature used before then, in the start's first moment, is not counted.
|
|
633
|
+
let used;
|
|
634
|
+
const trustedProxies = (process.env.AGENTRUN_TRUSTED_PROXIES ?? "").split(",").map((entry) => entry.trim()).filter(Boolean);
|
|
635
|
+
try {
|
|
636
|
+
serve = await startServe(serveOptions = {
|
|
637
|
+
// The owner lock on a Postgres store lost for good: this server can serve nothing more, so it exits non-zero and its
|
|
638
|
+
// platform starts it again, rather than answer 503 for as long as it runs.
|
|
639
|
+
onStoreLost: (error) => {
|
|
640
|
+
console.error(`agentrun-serve: ${error.message}`);
|
|
641
|
+
process.exit(1);
|
|
642
|
+
},
|
|
643
|
+
onUsage: (event) => used?.(event),
|
|
644
|
+
data, port, ...(values.port === undefined ? { nextFreePort: true } : {}), ...(early ? { listener: early } : {}), ...(values.listen ? { host: values.listen } : {}), ...(given ? { token: given } : {}), ...(givenList ? { tokens: givenList } : {}), ...(values.faux ? { faux: values.faux } : {}), ...(values["faux-browser"] ? { fauxBrowser: values["faux-browser"] } : {}), ...(values["faux-github"] ? { fauxGitHub: true } : {}), allowHosts: values["allow-host"],
|
|
645
|
+
...(values["max-runs"] !== undefined ? { maxRuns: Number(values["max-runs"]) } : {}),
|
|
646
|
+
// The owner's harness modules: --harness-module, else AGENTRUN_SERVE_HARNESS_MODULES (harness-table.ts).
|
|
647
|
+
...(harnessModulesOf(values["harness-module"], process.env).length ? { harnessModules: harnessModulesOf(values["harness-module"], process.env) } : {}),
|
|
648
|
+
// And its harness recipes: --harness-recipe, else AGENTRUN_SERVE_HARNESS_RECIPES (harness-table.ts).
|
|
649
|
+
...(harnessRecipesOf(values["harness-recipe"], process.env).length ? { harnessRecipes: harnessRecipesOf(values["harness-recipe"], process.env) } : {}),
|
|
650
|
+
// Their runs on the owner's own sign-in, only as the owner says it here (no setting names it) and the start proves.
|
|
651
|
+
...(values["harness-sign-in"] ? { harnessSignIn: true } : {}),
|
|
652
|
+
...(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
|
+
// The public address is the server's with accounts on or off: the Host names it serves, the webhook URLs it gives.
|
|
654
|
+
...(publicUrl ? { publicUrl } : {}),
|
|
655
|
+
...(accounts ? { accounts, openSetup: !publicUrl, countSessions: true } : {}), ...(apiOnly ? { apiOnly } : {}), ...(launchHook ? { launchHook } : {}), ...(runKeys ? { runKeys } : {}),
|
|
656
|
+
...(apiOnlyMcpOrigins.length ? { apiOnlyMcpOrigins } : {}),
|
|
657
|
+
// The proxies whose X-Forwarded-For the sign-in limit reads (comma-separated); none unless set.
|
|
658
|
+
...(trustedProxies.length ? { trustedProxies } : {}),
|
|
659
|
+
// A local install only as its operator says, never inferred: an MCP server on loopback is refused without it.
|
|
660
|
+
...(process.env.AGENTRUN_MCP_ALLOW_LOOPBACK === "1" ? { mcpLoopback: true } : {}),
|
|
661
|
+
// 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 } : {}),
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
catch (error) {
|
|
666
|
+
// A data directory an earlier version wrote, refused on a start `npx @parcha/agentrun` made: the ways on as that command
|
|
667
|
+
// (adapters.ts earlierDataRefusal). Any other start keeps the refusal's own words.
|
|
668
|
+
console.error(`agentrun-serve: ${earlierDataRefusal(error, data, process.env) ?? error.message}`);
|
|
669
|
+
process.exit(1);
|
|
670
|
+
}
|
|
671
|
+
// The start launches one runner beside the server on the same data dir (design: "server and runner"): it claims and runs
|
|
672
|
+
// every run, sharing only the store. With --no-runner the server runs alone, so the operator starts one or more separate
|
|
673
|
+
// `agentrun runner --data DIR` processes on the same data directory instead. The runner holds what the server's flags say
|
|
674
|
+
// (besideRunnerOptions): at most --max-runs runs at once, the rest waiting queued, and on the stop each busy run finishes
|
|
675
|
+
// its turn for up to --drain-timeout.
|
|
676
|
+
let runnerProc;
|
|
677
|
+
// Anonymous usage counts (docs/telemetry.md). It hears each run's end from the runner beside the server (with --no-runner it
|
|
678
|
+
// counts no runs), and each use of suggested agents from the server (onUsage).
|
|
679
|
+
const telemetry = startTelemetry({ data: resolve(data), ...(values.faux ? { faux: true } : {}) });
|
|
680
|
+
used = telemetry.used;
|
|
681
|
+
const { loops, loopsTold, drainMs } = besideRunnerOptions(serveOptions, process.env);
|
|
682
|
+
// 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) {
|
|
684
|
+
try {
|
|
685
|
+
// The beside-runner sees the server's test switches (server.ts fauxEnvOf: --faux and its modules), which the CLI hands
|
|
686
|
+
// the server as options, never through this process's environment: without them a --faux start's runner looks its faux
|
|
687
|
+
// model up in pi-ai's own catalog and every run fails on its first request. A test switch this process inherited from
|
|
688
|
+
// its shell is taken out first, as the server's own environment drops it (runner/main.ts besideRunEnv).
|
|
689
|
+
const { besideRunEnv } = await import("./runner/main.js");
|
|
690
|
+
// With the computer janitor: what a crashed runner of this server left is ended (never under --faux). With the
|
|
691
|
+
// server's AttachHub and the name and incarnation the server gave it (Serve.beside): a paired computer's socket is in
|
|
692
|
+
// this process, and this runner's run holds it under a route that names it, so a runner apart (its own process,
|
|
693
|
+
// relaying through this server) takes it for no other run meanwhile. Its runs reach an MCP server on loopback only
|
|
694
|
+
// when this server is a local install (Serve.localInstall).
|
|
695
|
+
// Each run a process of its own, as a user of its own where the image's helper can switch (run-child-host.ts).
|
|
696
|
+
runnerProc = await runnerBeside(data, { loops, loopsTold, drainMs, env: besideRunEnv(process.env, fauxEnvOf(serveOptions)), janitor: true, ownProcesses: true, hub: serve.attachHub, beside: serve.beside, dial: serve.dial, mcpLoopback: serve.localInstall, mcpOwn: serve.own, ollamaHost: serve.ollamaHost, onRunEnded: telemetry.runEnded });
|
|
697
|
+
}
|
|
698
|
+
catch (error) {
|
|
699
|
+
// A run isolation the runner cannot give (run-child-host.ts runIsolationOf) is said, and the server serves on with no
|
|
700
|
+
// runner, as the runner subcommand stays up claiming nothing (runner/main.ts): a platform that restarts a stopped
|
|
701
|
+
// container would otherwise loop on it.
|
|
702
|
+
const { RunIsolationRefused } = await import("./runner/run-child-host.js");
|
|
703
|
+
if (!(error instanceof RunIsolationRefused)) {
|
|
704
|
+
console.error(`agentrun-serve: the runner could not start: ${error.message}`);
|
|
705
|
+
await serve.close();
|
|
706
|
+
process.exit(1);
|
|
707
|
+
}
|
|
708
|
+
console.error(`agentrun-serve: ${error.message}`);
|
|
709
|
+
// And said in the store, as the runner subcommand says it (presence.ts): while no runner that claims is there, the
|
|
710
|
+
// server refuses a launch in these words and fails the runs left queued, never queueing one for good.
|
|
711
|
+
serve.refuseRuns(error.message);
|
|
712
|
+
}
|
|
682
713
|
}
|
|
714
|
+
// A token from the environment is the operator's already, and the stored one is printed by the start that made it only.
|
|
715
|
+
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 } : {}) }))
|
|
717
|
+
console.log(line);
|
|
718
|
+
if (launchHook)
|
|
719
|
+
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.`);
|
|
720
|
+
// Open setup (no public address, a loopback listener): the link that sets the password. Any other start printed the
|
|
721
|
+
// setup link with its code as the code was made (owner.ts).
|
|
722
|
+
if (serve.setupUrl && serve.setupOpen)
|
|
723
|
+
console.log(`Set your password: ${serve.setupUrl} (the first visit sets it)`);
|
|
724
|
+
// The notice of the anonymous counts, once, on stderr: the npx command passes stderr through and keeps stdout to itself.
|
|
725
|
+
if (telemetry.notice)
|
|
726
|
+
console.error(telemetry.notice);
|
|
727
|
+
// The console's page, once the server listens: never its sign-in link, whose token would sit in the opener's arguments
|
|
728
|
+
// and the browser's history. With no owner yet, the setup page instead, its code filled in when setup takes one: the
|
|
729
|
+
// first visit sets the password with nothing to look up. That code works once and for 30 minutes, unlike the token, so
|
|
730
|
+
// the opener's arguments and the browser's history hold nothing that outlasts the setup.
|
|
731
|
+
// API-only: there is no console, so nothing to open.
|
|
732
|
+
if (values.open && !apiOnly && canOpen(process.env))
|
|
733
|
+
spawn(process.platform === "darwin" ? "open" : "xdg-open", [serve.setupUrl ?? `${publicUrl ?? serve.url}/`], { stdio: "ignore", detached: true }).on("error", () => { }).unref();
|
|
734
|
+
const record = join(resolve(data), SERVER_FILE);
|
|
735
|
+
// The record goes only while it is this server's: a server that takes the lock next writes its own, which this stop must
|
|
736
|
+
// not remove. One stop per press or process-manager stop; a later signal, or a stop past its deadline, stops at once
|
|
737
|
+
// (stop-signals.ts). The stop is in place before the record is written: a SIGTERM sent the moment the record appears is
|
|
738
|
+
// a clean stop that removes it, never the default end by signal that leaves it behind.
|
|
739
|
+
const stop = stopOnSignals({
|
|
740
|
+
close: () => {
|
|
741
|
+
removeOwnRecord(record);
|
|
742
|
+
// A drain that has runs to wait on says so, as a run's own process did on the server's stop.
|
|
743
|
+
const busy = runnerProc?.runner.held().length ?? 0;
|
|
744
|
+
if (busy > 0 && drainMs > 0)
|
|
745
|
+
console.error(`agentrun-serve: stopping: waiting up to ${Math.ceil(drainMs / 1000)} s for ${busy} ${busy === 1 ? "run" : "runs"} to finish ${busy === 1 ? "its turn" : "their turns"}`);
|
|
746
|
+
// The counts' last write (telemetry.ts) is waited for once the runner has said its last run's end.
|
|
747
|
+
return Promise.all([(runnerProc?.close() ?? Promise.resolve()).then(() => telemetry.close()), serve.close()]).then(() => undefined);
|
|
748
|
+
},
|
|
749
|
+
// The stop's deadline waits out the runner's whole close: its drain, then the stop of the loops left, so a run's end
|
|
750
|
+
// and release are never cut short (besideStopping).
|
|
751
|
+
stopping: () => (runnerProc ? besideStopping(serve.stopping(), runnerProc.runner.held().length, drainMs) : serve.stopping()),
|
|
752
|
+
done: (code) => (removeOwnRecord(record), process.exit(code)),
|
|
753
|
+
say: (line) => console.error(line),
|
|
754
|
+
});
|
|
755
|
+
stopping = stop;
|
|
756
|
+
// Written whole under a name of its own, then renamed into place: a reader in another process (the npx command, a test
|
|
757
|
+
// waiting for this server) that finds the record reads all of it, never a file made but not yet filled.
|
|
758
|
+
writeDurableSync(record, `${JSON.stringify({ base_url: serve.baseUrl, pid: process.pid, ...(serve.tokenFile ? { token_file: serve.tokenFile } : {}) })}\n`);
|
|
759
|
+
chmodSync(record, 0o600);
|
|
760
|
+
// A stop asked during the start runs now, as one asked from here on would.
|
|
761
|
+
if (askedAt !== undefined)
|
|
762
|
+
stop(askedAt);
|
|
683
763
|
}
|
|
684
|
-
// A token from the environment is the operator's already, and the stored one is printed by the start that made it only.
|
|
685
|
-
const source = given ? "env" : givenList ? "list" : serve.tokenMade ? "made" : "file";
|
|
686
|
-
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 } : {}) }))
|
|
687
|
-
console.log(line);
|
|
688
|
-
if (launchHook)
|
|
689
|
-
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.`);
|
|
690
|
-
// Open setup (no public address, a loopback listener): the link that sets the password. Any other start printed the
|
|
691
|
-
// setup link with its code as the code was made (owner.ts).
|
|
692
|
-
if (serve.setupUrl && serve.setupOpen)
|
|
693
|
-
console.log(`Set your password: ${serve.setupUrl} (the first visit sets it)`);
|
|
694
|
-
// The notice of the anonymous counts, once, on stderr: the npx command passes stderr through and keeps stdout to itself.
|
|
695
|
-
if (telemetry.notice)
|
|
696
|
-
console.error(telemetry.notice);
|
|
697
|
-
// The console's page, once the server listens: never its sign-in link, whose token would sit in the opener's arguments
|
|
698
|
-
// and the browser's history. With no owner yet, the setup page instead, its code filled in when setup takes one: the
|
|
699
|
-
// first visit sets the password with nothing to look up. That code works once and for 30 minutes, unlike the token, so
|
|
700
|
-
// the opener's arguments and the browser's history hold nothing that outlasts the setup.
|
|
701
|
-
// API-only: there is no console, so nothing to open.
|
|
702
|
-
if (values.open && !apiOnly && canOpen(process.env))
|
|
703
|
-
spawn(process.platform === "darwin" ? "open" : "xdg-open", [serve.setupUrl ?? `${publicUrl ?? serve.url}/`], { stdio: "ignore", detached: true }).on("error", () => { }).unref();
|
|
704
|
-
const record = join(resolve(data), SERVER_FILE);
|
|
705
|
-
// The record goes only while it is this server's: a server that takes the lock next writes its own, which this stop must
|
|
706
|
-
// not remove. One stop per press or process-manager stop; a later signal, or a stop past its deadline, stops at once
|
|
707
|
-
// (stop-signals.ts). The stop is in place before the record is written: a SIGTERM sent the moment the record appears is
|
|
708
|
-
// a clean stop that removes it, never the default end by signal that leaves it behind.
|
|
709
|
-
const stop = stopOnSignals({
|
|
710
|
-
close: () => {
|
|
711
|
-
removeOwnRecord(record);
|
|
712
|
-
// A drain that has runs to wait on says so, as a run's own process did on the server's stop.
|
|
713
|
-
const busy = runnerProc?.runner.held().length ?? 0;
|
|
714
|
-
if (busy > 0 && drainMs > 0)
|
|
715
|
-
console.error(`agentrun-serve: stopping: waiting up to ${Math.ceil(drainMs / 1000)} s for ${busy} ${busy === 1 ? "run" : "runs"} to finish ${busy === 1 ? "its turn" : "their turns"}`);
|
|
716
|
-
// The counts' last write (telemetry.ts) is waited for once the runner has said its last run's end.
|
|
717
|
-
return Promise.all([(runnerProc?.close() ?? Promise.resolve()).then(() => telemetry.close()), serve.close()]).then(() => undefined);
|
|
718
|
-
},
|
|
719
|
-
// The stop's deadline waits out the runner's whole close: its drain, then the stop of the loops left, so a run's end
|
|
720
|
-
// and release are never cut short (besideStopping).
|
|
721
|
-
stopping: () => (runnerProc ? besideStopping(serve.stopping(), runnerProc.runner.held().length, drainMs) : serve.stopping()),
|
|
722
|
-
done: (code) => (removeOwnRecord(record), process.exit(code)),
|
|
723
|
-
say: (line) => console.error(line),
|
|
724
|
-
});
|
|
725
|
-
stopping = stop;
|
|
726
|
-
// Written whole under a name of its own, then renamed into place: a reader in another process (the npx command, a test
|
|
727
|
-
// waiting for this server) that finds the record reads all of it, never a file made but not yet filled.
|
|
728
|
-
writeDurableSync(record, `${JSON.stringify({ base_url: serve.baseUrl, pid: process.pid, ...(serve.tokenFile ? { token_file: serve.tokenFile } : {}) })}\n`);
|
|
729
|
-
chmodSync(record, 0o600);
|
|
730
|
-
// A stop asked during the start runs now, as one asked from here on would.
|
|
731
|
-
if (askedAt !== undefined)
|
|
732
|
-
stop(askedAt);
|