@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/tool-plane.d.ts
CHANGED
|
@@ -21,9 +21,9 @@ export declare const CAPABILITIES: readonly ["read", "write", "edit", "web_searc
|
|
|
21
21
|
declare const DIRECT_FETCH: "kernel";
|
|
22
22
|
/** The providers a user may pick for each capability that has a choice, its default first: `auto`, for web_search the
|
|
23
23
|
* Parallel where the server holds its key, else keyless Firecrawl, on every harness (a native search is never `auto`,
|
|
24
|
-
* only `native`); for web_fetch the guarded direct fetch
|
|
25
|
-
*
|
|
26
|
-
* one, and nothing else; `firecrawl-keyless`, Firecrawl's public MCP endpoint, no key, with keyless Exa behind it for
|
|
24
|
+
* only `native`); for web_fetch Parallel's extract where the server holds a Parallel key (the guarded direct fetch
|
|
25
|
+
* behind it), else keyless Firecrawl (both in DEFAULT_WEB_ORDER); `native`, the harness's own tool or its model
|
|
26
|
+
* provider's hosted one, and nothing else; `firecrawl-keyless`, Firecrawl's public MCP endpoint, no key, with keyless Exa behind it for
|
|
27
27
|
* web_search and the guarded direct fetch behind it for web_fetch; `exa-keyless`, Exa's public MCP endpoint alone, no
|
|
28
28
|
* key; `kernel`, the guarded direct fetch; `parallel`, Parallel's Search and Extract APIs on PARALLEL_API_KEY; `off`,
|
|
29
29
|
* web_search turned off: nothing is searched, and an
|
|
@@ -132,17 +132,42 @@ export type ResolveInput = {
|
|
|
132
132
|
/** The facts of the adapter the harness runs on (its own search, its wire), its owner's table entry's (harness-table.ts
|
|
133
133
|
* factsOf: a module's harness's too); undefined for one with none (pi). Always given: a caller names them. */
|
|
134
134
|
facts: AdapterFacts | undefined;
|
|
135
|
+
/** What the server's Jev means for web_search (decisions.ts jevWebWhy): said after the why of a search the run's own
|
|
136
|
+
* web_search runs. None: no Jev key, nothing to say. */
|
|
137
|
+
jevWhy?: string;
|
|
138
|
+
/** The same for web_fetch (jevWebWhy's "web_fetch"): what a fetch the run's own Web serves sends TypeSafe, said after
|
|
139
|
+
* its why. None: no Jev key, nothing to say. */
|
|
140
|
+
jevFetchWhy?: string;
|
|
135
141
|
};
|
|
136
142
|
/** Whether a run on `harness` sends through OpenRouter, where a harness's own search does not run: false for one with
|
|
137
143
|
* none (and for pi, whose hosted search is asked of the model's provider). */
|
|
138
144
|
export declare const ownSearchViaOpenRouter: (env: NodeJS.ProcessEnv, harness: string, model?: string) => boolean;
|
|
139
|
-
export declare const FIRECRAWL_FETCH = "Firecrawl's free keyless fetch, no key, the guarded direct fetch behind it. web_fetch sends each URL to Firecrawl's keyless service (never a private or local one);
|
|
145
|
+
export declare const FIRECRAWL_FETCH = "Firecrawl's free keyless fetch, no key, the guarded direct fetch behind it. web_fetch sends each URL to Firecrawl's keyless service (never a private or local one); choose kernel to fetch directly";
|
|
140
146
|
/** What `capability` resolves to on a run of `input`, and why in a plain sentence (capabilities' `why`): one rule, so
|
|
141
|
-
* the two never disagree.
|
|
147
|
+
* the two never disagree. A web_search the run's own tool runs, and a web_fetch its own Web serves (any resolution but
|
|
148
|
+
* a deny), say what Jev does with it and what it sends TypeSafe, where the server has a Jev key, or that Jev is off
|
|
149
|
+
* (`jevWhy`, `jevFetchWhy`). */
|
|
142
150
|
export declare function explainCapability(capability: Pickable, input: ResolveInput): {
|
|
143
151
|
resolves: Resolution;
|
|
144
152
|
why: string;
|
|
145
153
|
};
|
|
154
|
+
/** The order `auto` asks for each web tool: the first provider here the server can run is what auto resolves to
|
|
155
|
+
* (Parallel only where the server holds its key; keyless Firecrawl, keyless Exa and the guarded direct fetch always),
|
|
156
|
+
* keyless Firecrawl where none can. Capabilities' `why` and every run's plane read it (autoWeb). Parallel is first for
|
|
157
|
+
* both. To put Firecrawl first, swap the two ids in a list: that one line is the whole change. */
|
|
158
|
+
export declare const DEFAULT_WEB_ORDER: Readonly<{
|
|
159
|
+
web_search: readonly AutoSearch[];
|
|
160
|
+
web_fetch: readonly AutoFetch[];
|
|
161
|
+
}>;
|
|
162
|
+
type AutoSearch = "parallel" | "firecrawl-keyless" | "exa-keyless";
|
|
163
|
+
type AutoFetch = "parallel" | "firecrawl-keyless" | typeof DIRECT_FETCH;
|
|
164
|
+
/** What `auto` resolves `capability` to on a run of `input`, and why, by `order` (DEFAULT_WEB_ORDER). `auto` never
|
|
165
|
+
* resolves native, on any harness: where a native search would run, web_search's why names it as the pick it is;
|
|
166
|
+
* where none runs (noNative), it says why not. */
|
|
167
|
+
export declare function autoWeb(capability: "web_search" | "web_fetch", input: ResolveInput, order?: typeof DEFAULT_WEB_ORDER): {
|
|
168
|
+
resolves: Resolution;
|
|
169
|
+
why: string;
|
|
170
|
+
};
|
|
146
171
|
/** What `capability` resolves to on a run of `input`. */
|
|
147
172
|
export declare const resolveCapability: (capability: Pickable, input: ResolveInput) => Resolution;
|
|
148
173
|
export declare const isUnavailable: (resolution: Resolution | undefined) => resolution is `unavailable: ${string}`;
|
|
@@ -152,6 +177,9 @@ export declare const isUnavailable: (resolution: Resolution | undefined) => reso
|
|
|
152
177
|
export declare const whyUnavailable: (resolution: string) => string;
|
|
153
178
|
export declare const BROWSER_VENDOR_IDS: readonly string[];
|
|
154
179
|
export declare const BROWSER_KEYS: Readonly<Record<string, readonly string[]>>;
|
|
180
|
+
/** The browser vendor where nothing names one (a run kept before its plane was, a page's key row, the capabilities'
|
|
181
|
+
* browser): the registry's first hosted browser, the one `auto` tries first (Browserbase). */
|
|
182
|
+
export declare const DEFAULT_BROWSER_VENDOR: Resolution;
|
|
155
183
|
type BrowserVendor = string;
|
|
156
184
|
/** The keys a browser that resolves to `resolution` runs on: its vendor's (BROWSER_KEYS), none for no vendor. */
|
|
157
185
|
export declare const browserNeeds: (resolution: string | undefined) => readonly string[];
|
|
@@ -167,9 +195,12 @@ export declare function explainsView(env: NodeJS.ProcessEnv, settings: ToolSetti
|
|
|
167
195
|
why: Record<HarnessId, string>;
|
|
168
196
|
}>;
|
|
169
197
|
/** What a run is told: each pickable capability its revision names, resolved; with web_search native on pi, the model
|
|
170
|
-
* its search asks (the one the resolution read)
|
|
198
|
+
* its search asks (the one the resolution read); and `jev: "off"` where the server had Jev turned off for the web tools
|
|
199
|
+
* (AGENTRUN_WEB_JEV_OFF) when it created the run, on a plane with a web tool, so the switch reaches a runner on another
|
|
200
|
+
* host; a runner's re-check (recheckPlane) keeps it. */
|
|
171
201
|
export type Plane = Partial<Record<Pickable, Resolution>> & {
|
|
172
202
|
model?: string;
|
|
203
|
+
jev?: "off";
|
|
173
204
|
};
|
|
174
205
|
/** The facts of a pinned revision its run's tools resolve from. */
|
|
175
206
|
/** `approvals`: the revision's, kept only when "never" (the agent runs unattended: an ask is an allow, never over a deny). */
|
|
@@ -190,7 +221,7 @@ export declare function planeFor(env: NodeJS.ProcessEnv, tooling: Tooling, setti
|
|
|
190
221
|
capped?: boolean;
|
|
191
222
|
run?: boolean;
|
|
192
223
|
}): Plane;
|
|
193
|
-
/** A run's kept Plane at a later launch: as it was, but Parallel, or the browser's vendor, where the server no longer
|
|
224
|
+
/** A run's kept Plane at a later launch: as it was (its Jev off kept, and added where `env` has the switch), but Parallel, or the browser's vendor, where the server no longer
|
|
194
225
|
* holds its key, which is unavailable, never another provider; and, given `now` (the Plane it would get today and each
|
|
195
226
|
* capability's permission today), a capability set to ask or deny, or kept denied, as it resolves today: a harness's
|
|
196
227
|
* own search cannot wait for a person, and a deny that was lifted is lifted. The browser keeps its vendor, whose
|
|
@@ -200,9 +231,10 @@ export declare function recheckPlane(plane: Plane, env: NodeJS.ProcessEnv, now?:
|
|
|
200
231
|
permission: (name: Pickable) => Permission;
|
|
201
232
|
}): Plane;
|
|
202
233
|
/** The Plane kept for a run made before its plane was kept, resolved at a later launch (runs.ts): its browser stays
|
|
203
|
-
*
|
|
204
|
-
* keeps the vendor, never a refusal: the plane each launch hands over is checked again
|
|
205
|
-
* keys missing make it unavailable for that launch alone, and restored keys make the
|
|
234
|
+
* the default vendor (DEFAULT_BROWSER_VENDOR, the one vendor there was then), never today's pick, which could check its
|
|
235
|
+
* sessions at another vendor. It keeps the vendor, never a refusal: the plane each launch hands over is checked again
|
|
236
|
+
* (recheckPlane), so that vendor's keys missing make it unavailable for that launch alone, and restored keys make the
|
|
237
|
+
* next one run. */
|
|
206
238
|
export declare const keptFromBefore: (plane: Plane) => Plane;
|
|
207
239
|
/** A run's saved Plane as a launch reads it: a vendor's missing-key refusal an earlier server saved (noBrowserKey's exact
|
|
208
240
|
* words, Browserbase's or Kernel's) is that vendor again, which the launch checks again as usual (recheckPlane), so
|
|
@@ -210,7 +242,7 @@ export declare const keptFromBefore: (plane: Plane) => Plane;
|
|
|
210
242
|
* (NO_BROWSER_KEY) and `chrome` stay frozen. The same Plane where nothing changes. */
|
|
211
243
|
export declare function keptVendor(plane: Plane): Plane;
|
|
212
244
|
/** The key row (tool-keys.ts) of the browser's vendor on `resolution` with `picked` the provider in force: the vendor it
|
|
213
|
-
* resolved to, else the one picked, else the
|
|
245
|
+
* resolved to, else the one picked, else the default (DEFAULT_BROWSER_VENDOR), so a page links a missing key to the row
|
|
214
246
|
* it is saved on. */
|
|
215
247
|
export declare const browserKeyRow: (picked: string | undefined, resolution: string | undefined) => string;
|
|
216
248
|
/** The Plane a run's process is handed at a launch, under the server's `settings` now: its kept Plane (as keptVendor
|
|
@@ -226,6 +258,13 @@ export declare function relaunchPlane(kept: Plane | undefined, env: NodeJS.Proce
|
|
|
226
258
|
export declare function planeOf(env: NodeJS.ProcessEnv): Plane;
|
|
227
259
|
/** Whether a run is handed Parallel's key: one of its capabilities resolves to Parallel. */
|
|
228
260
|
export declare const handsParallel: (plane: Plane) => boolean;
|
|
261
|
+
/** Whether a run on `harness` is handed TypeSafe's key for its web tools (decisions.ts DecisionNeeds.jevWeb): one of
|
|
262
|
+
* them is served by its own Web (web-run.ts webOf), and Jev is turned off neither by the plane (the server's switch at
|
|
263
|
+
* launch, planeFor) nor in `env` (AGENTRUN_WEB_JEV_OFF: a runner's own switch adds "off", never removes it).
|
|
264
|
+
* web_fetch always is where it runs; web_search is where it resolves to Parallel or a keyless provider, or to native
|
|
265
|
+
* where that is the model provider's hosted search (pi's), never a harness's own search inside its CLI (codex's,
|
|
266
|
+
* claude-agent's: its facts' webSearch), where no Jev call can happen. */
|
|
267
|
+
export declare const handsJevWeb: (plane: Plane, env: NodeJS.ProcessEnv, harness: string | undefined) => boolean;
|
|
229
268
|
/** The issues of `value` as a settings map, its fields under `at` (none: a body's own): each settings key (a tool of the
|
|
230
269
|
* table, a catalog tool, an MCP server's wildcard) to `{provider?, permission?}`, a provider only for a capability that
|
|
231
270
|
* has a choice and one offered for it, a permission one offered for the tool. */
|
package/dist/tool-plane.js
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
// agent's own (`definition.tool_settings`) over the server's (`PUT /v2/settings/tools`), optional; (2) for web_search,
|
|
4
4
|
// Parallel where the server holds its key (env or saved, which then bills it); (3) the keyless fallback: Firecrawl's
|
|
5
5
|
// public keyless MCP endpoint (@parcha/agentrun-web providers/firecrawl-keyless.ts), with Exa's
|
|
6
|
-
// (providers/exa-keyless.ts) behind it. web_fetch's `auto` is
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
// the public-host guard refuses never goes (web-fetch.ts). The native search, a harness's own
|
|
10
|
-
// Codex's live search) or on pi one request to the run's own model provider with its hosted search
|
|
11
|
-
// runs only where it is picked, `native`: `auto` never resolves to it, on any harness.
|
|
12
|
-
// web_search's default, `auto`, is that order; a pick of `native` is native only,
|
|
6
|
+
// (providers/exa-keyless.ts) behind it. web_fetch's `auto` is Parallel's extract where the server holds a Parallel key,
|
|
7
|
+
// with the guarded direct fetch behind it, else keyless Firecrawl with the guarded direct fetch behind it. Both tools'
|
|
8
|
+
// `auto` order is one table, DEFAULT_WEB_ORDER. Through Firecrawl web_fetch sends each URL to a third party, and its
|
|
9
|
+
// `why` says so; a URL the public-host guard refuses never goes (web-fetch.ts). The native search, a harness's own
|
|
10
|
+
// (Claude's WebSearch, Codex's live search) or on pi one request to the run's own model provider with its hosted search
|
|
11
|
+
// (hosted-search.ts), runs only where it is picked, `native`: `auto` never resolves to it, on any harness.
|
|
12
|
+
// `off` turns web_search off. web_search's default, `auto`, is that order; a pick of `native` is native only,
|
|
13
13
|
// unavailable where there is none, never a keyless search. A grant names a capability, never a provider. A pick of parallel without
|
|
14
14
|
// PARALLEL_API_KEY resolves unavailable, never to something else. The server resolves a run's tools at its first
|
|
15
15
|
// launch, from its pinned revision and the settings then, keeps them for the run's life (runs.ts), and hands the run's
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
import { META_TOOLS } from "./meta-tool-names.js";
|
|
26
26
|
import { blurbOf, isAskable, isTableTool, tableTools } from "./tool-list.js";
|
|
27
27
|
import { PROVIDERS as COMPUTER_PROVIDERS } from "@parcha/agentrun-computer";
|
|
28
|
-
import { decisionKeysOf, PARALLEL_KEY_ENV } from "./decisions.js";
|
|
28
|
+
import { decisionKeysOf, jevWebWhy, PARALLEL_KEY_ENV } from "./decisions.js";
|
|
29
|
+
import { webJevOff } from "./env-switch.js";
|
|
29
30
|
import { keyNeeded } from "./key-words.js";
|
|
30
31
|
import { DEFAULT_HARNESS, HARNESSES } from "./harness.js";
|
|
31
32
|
import { factsOf as tableFactsOf, harnessOf } from "./harness-table.js";
|
|
@@ -51,9 +52,9 @@ export const CAPABILITIES = ["read", "write", "edit", "web_search", "web_fetch",
|
|
|
51
52
|
const DIRECT_FETCH = "kernel";
|
|
52
53
|
/** The providers a user may pick for each capability that has a choice, its default first: `auto`, for web_search the
|
|
53
54
|
* Parallel where the server holds its key, else keyless Firecrawl, on every harness (a native search is never `auto`,
|
|
54
|
-
* only `native`); for web_fetch the guarded direct fetch
|
|
55
|
-
*
|
|
56
|
-
* one, and nothing else; `firecrawl-keyless`, Firecrawl's public MCP endpoint, no key, with keyless Exa behind it for
|
|
55
|
+
* only `native`); for web_fetch Parallel's extract where the server holds a Parallel key (the guarded direct fetch
|
|
56
|
+
* behind it), else keyless Firecrawl (both in DEFAULT_WEB_ORDER); `native`, the harness's own tool or its model
|
|
57
|
+
* provider's hosted one, and nothing else; `firecrawl-keyless`, Firecrawl's public MCP endpoint, no key, with keyless Exa behind it for
|
|
57
58
|
* web_search and the guarded direct fetch behind it for web_fetch; `exa-keyless`, Exa's public MCP endpoint alone, no
|
|
58
59
|
* key; `kernel`, the guarded direct fetch; `parallel`, Parallel's Search and Extract APIs on PARALLEL_API_KEY; `off`,
|
|
59
60
|
* web_search turned off: nothing is searched, and an
|
|
@@ -204,10 +205,24 @@ const nativeWhy = (input) => (input.facts?.webSearch ? ownSearch(input) : `${own
|
|
|
204
205
|
/** Keyless Firecrawl in a sentence, as web_search and web_fetch use it. web_fetch's says plainly that each URL leaves
|
|
205
206
|
* the server, and how to keep it here. */
|
|
206
207
|
const FIRECRAWL_SEARCH = "Firecrawl's free keyless search, no key, keyless Exa behind it";
|
|
207
|
-
export const FIRECRAWL_FETCH = "Firecrawl's free keyless fetch, no key, the guarded direct fetch behind it. web_fetch sends each URL to Firecrawl's keyless service (never a private or local one);
|
|
208
|
+
export const FIRECRAWL_FETCH = "Firecrawl's free keyless fetch, no key, the guarded direct fetch behind it. web_fetch sends each URL to Firecrawl's keyless service (never a private or local one); choose kernel to fetch directly";
|
|
209
|
+
/** The resolutions of web_search the run's own web_search runs (web-run.ts webOf), where Jev ranks the results: native
|
|
210
|
+
* only where it is the model provider's hosted search (pi's), never a harness's own search inside its CLI. */
|
|
211
|
+
const searchesOwn = (resolves, facts) => WEB_RUNS.web_search.includes(resolves) && (resolves !== "native" || !facts?.webSearch);
|
|
212
|
+
const ranksOwn = (resolves, input) => searchesOwn(resolves, input.facts);
|
|
208
213
|
/** What `capability` resolves to on a run of `input`, and why in a plain sentence (capabilities' `why`): one rule, so
|
|
209
|
-
* the two never disagree.
|
|
214
|
+
* the two never disagree. A web_search the run's own tool runs, and a web_fetch its own Web serves (any resolution but
|
|
215
|
+
* a deny), say what Jev does with it and what it sends TypeSafe, where the server has a Jev key, or that Jev is off
|
|
216
|
+
* (`jevWhy`, `jevFetchWhy`). */
|
|
210
217
|
export function explainCapability(capability, input) {
|
|
218
|
+
const said = explained(capability, input);
|
|
219
|
+
if (capability === "web_search" && input.jevWhy && ranksOwn(said.resolves, input))
|
|
220
|
+
return { ...said, why: `${said.why}; ${input.jevWhy}` };
|
|
221
|
+
if (capability === "web_fetch" && input.jevFetchWhy && WEB_RUNS.web_fetch.includes(said.resolves))
|
|
222
|
+
return { ...said, why: `${said.why}; ${input.jevFetchWhy}` };
|
|
223
|
+
return said;
|
|
224
|
+
}
|
|
225
|
+
function explained(capability, input) {
|
|
211
226
|
const chosen = input.override ?? input.pick ?? PROVIDERS[capability][0];
|
|
212
227
|
const picked = input.override !== undefined ? "picked for this agent" : "picked in settings";
|
|
213
228
|
const key = `your Parallel key (${input.parallelKeyFrom ?? "server"})`;
|
|
@@ -222,7 +237,7 @@ export function explainCapability(capability, input) {
|
|
|
222
237
|
return { resolves: DIRECT_FETCH, why: `the guarded direct fetch, ${picked}` };
|
|
223
238
|
if (chosen === "firecrawl-keyless")
|
|
224
239
|
return { resolves: "firecrawl-keyless", why: `keyless Firecrawl, ${picked}: ${FIRECRAWL_FETCH}` };
|
|
225
|
-
return
|
|
240
|
+
return autoWeb("web_fetch", input);
|
|
226
241
|
}
|
|
227
242
|
if (capability === "browser")
|
|
228
243
|
return browserBy(chosen, picked, input.browserKeys);
|
|
@@ -238,11 +253,30 @@ export function explainCapability(capability, input) {
|
|
|
238
253
|
return { resolves: `unavailable: no native search for ${without.id}`, why: `no native search for ${without.id}` };
|
|
239
254
|
return input.permission === "ask" && input.facts !== undefined ? { resolves: NATIVE_ASKS, why: "native search cannot wait for an approval: it runs inside the harness's CLI" } : { resolves: "native", why: nativeWhy(input) };
|
|
240
255
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
256
|
+
return autoWeb("web_search", input);
|
|
257
|
+
}
|
|
258
|
+
/** The order `auto` asks for each web tool: the first provider here the server can run is what auto resolves to
|
|
259
|
+
* (Parallel only where the server holds its key; keyless Firecrawl, keyless Exa and the guarded direct fetch always),
|
|
260
|
+
* keyless Firecrawl where none can. Capabilities' `why` and every run's plane read it (autoWeb). Parallel is first for
|
|
261
|
+
* both. To put Firecrawl first, swap the two ids in a list: that one line is the whole change. */
|
|
262
|
+
export const DEFAULT_WEB_ORDER = Object.freeze({ web_search: Object.freeze(["parallel", "firecrawl-keyless"]), web_fetch: Object.freeze(["parallel", "firecrawl-keyless"]) });
|
|
263
|
+
/** What `auto` resolves `capability` to on a run of `input`, and why, by `order` (DEFAULT_WEB_ORDER). `auto` never
|
|
264
|
+
* resolves native, on any harness: where a native search would run, web_search's why names it as the pick it is;
|
|
265
|
+
* where none runs (noNative), it says why not. */
|
|
266
|
+
export function autoWeb(capability, input, order = DEFAULT_WEB_ORDER) {
|
|
267
|
+
const runs = (id) => id !== "parallel" || input.parallelKey;
|
|
268
|
+
const id = order[capability].find(runs) ?? "firecrawl-keyless";
|
|
269
|
+
const key = `your Parallel key (${input.parallelKeyFrom ?? "server"})`;
|
|
270
|
+
if (capability === "web_fetch") {
|
|
271
|
+
if (id === "parallel")
|
|
272
|
+
return { resolves: "parallel", why: `Parallel's extract on ${key}, the guarded direct fetch behind it` };
|
|
273
|
+
return id === DIRECT_FETCH ? { resolves: DIRECT_FETCH, why: "the guarded direct fetch" } : { resolves: "firecrawl-keyless", why: FIRECRAWL_FETCH };
|
|
274
|
+
}
|
|
275
|
+
const said = id === "parallel" ? key : id === "exa-keyless" ? "Exa's free search, no key" : FIRECRAWL_SEARCH;
|
|
276
|
+
const without = noNative(input);
|
|
277
|
+
if (without !== undefined)
|
|
278
|
+
return { resolves: id, why: `${without.why}; ${said}` };
|
|
279
|
+
return { resolves: id, why: id === "parallel" ? said : `${said}; ${ownSearch(input)} is an explicit pick` };
|
|
246
280
|
}
|
|
247
281
|
/** What `capability` resolves to on a run of `input`. */
|
|
248
282
|
export const resolveCapability = (capability, input) => explainCapability(capability, input).resolves;
|
|
@@ -274,6 +308,14 @@ function browserProviderIds() {
|
|
|
274
308
|
}
|
|
275
309
|
export const BROWSER_VENDOR_IDS = Object.freeze(browserProviderIds());
|
|
276
310
|
export const BROWSER_KEYS = Object.freeze(Object.fromEntries(BROWSER_VENDORS.map((vendor) => [vendor.id, vendor.keys])));
|
|
311
|
+
/** The browser vendor where nothing names one (a run kept before its plane was, a page's key row, the capabilities'
|
|
312
|
+
* browser): the registry's first hosted browser, the one `auto` tries first (Browserbase). */
|
|
313
|
+
export const DEFAULT_BROWSER_VENDOR = (() => {
|
|
314
|
+
const first = BROWSER_VENDORS[0];
|
|
315
|
+
if (!first)
|
|
316
|
+
throw new Error("the computer registry declares no hosted browser provider");
|
|
317
|
+
return first.id;
|
|
318
|
+
})();
|
|
277
319
|
const LABELS = Object.freeze(Object.fromEntries(BROWSER_VENDORS.map((vendor) => [vendor.id, vendor.label])));
|
|
278
320
|
const isVendor = (name) => typeof name === "string" && Object.hasOwn(BROWSER_KEYS, name);
|
|
279
321
|
const browserKeysOf = (env) => Object.fromEntries(BROWSER_VENDORS.map((vendor) => [vendor.id, vendor.keys.every((name) => Boolean(env[name]))]));
|
|
@@ -304,7 +346,9 @@ function browserBy(chosen, picked, keys = {}) {
|
|
|
304
346
|
/** The server's environment's part of every resolution: its gateway and Parallel's key, and where the key is from. */
|
|
305
347
|
const served = (env) => {
|
|
306
348
|
const parallelKey = PARALLEL_KEY_ENV in decisionKeysOf(env);
|
|
307
|
-
|
|
349
|
+
const jevWhy = jevWebWhy(env, "web_search");
|
|
350
|
+
const jevFetchWhy = jevWebWhy(env, "web_fetch");
|
|
351
|
+
return { gateway: Boolean(env.AGENT_MODEL_BASE_URL), parallelKey, browserKeys: browserKeysOf(env), ...(parallelKey ? { parallelKeyFrom: savedIn(env).has(PARALLEL_KEY_ENV) ? "saved" : "server" } : {}), ...(jevWhy ? { jevWhy } : {}), ...(jevFetchWhy ? { jevFetchWhy } : {}) };
|
|
308
352
|
};
|
|
309
353
|
/** Each pickable capability on each harness under the server's `settings` and an agent's `overrides`, on `model`
|
|
310
354
|
* (default each harness's host model, the one a run that names none runs on: hostModel): what it resolves to and why, as
|
|
@@ -351,27 +395,37 @@ export function planeFor(env, tooling, settings, { capped = false, run = false }
|
|
|
351
395
|
// another harness, whose agent searches with its own tool, a learned workflow's call node (learned-workflow.ts).
|
|
352
396
|
if (plane.web_search === "native" && model)
|
|
353
397
|
plane.model = model;
|
|
354
|
-
return plane;
|
|
398
|
+
return withJevSwitch(plane, env);
|
|
355
399
|
}
|
|
356
|
-
/**
|
|
400
|
+
/** `plane` with Jev's switch: `jev: "off"` where `keptOff` (the plane was made with it off) or where `env` has the switch
|
|
401
|
+
* on (AGENTRUN_WEB_JEV_OFF) and the plane has a web tool; else no `jev` field. */
|
|
402
|
+
function withJevSwitch(plane, env, keptOff = false) {
|
|
403
|
+
const { jev: _was, ...rest } = plane;
|
|
404
|
+
return keptOff || (webJevOff(env) && (rest.web_search !== undefined || rest.web_fetch !== undefined)) ? { ...rest, jev: "off" } : rest;
|
|
405
|
+
}
|
|
406
|
+
/** A run's kept Plane at a later launch: as it was (its Jev off kept, and added where `env` has the switch), but Parallel, or the browser's vendor, where the server no longer
|
|
357
407
|
* holds its key, which is unavailable, never another provider; and, given `now` (the Plane it would get today and each
|
|
358
408
|
* capability's permission today), a capability set to ask or deny, or kept denied, as it resolves today: a harness's
|
|
359
409
|
* own search cannot wait for a person, and a deny that was lifted is lifted. The browser keeps its vendor, whose
|
|
360
410
|
* sessions it has: only a deny it was kept with is lifted. */
|
|
361
411
|
export function recheckPlane(plane, env, now) {
|
|
362
412
|
const keyed = served(env).parallelKey;
|
|
363
|
-
|
|
413
|
+
const { jev: kept, ...resolved } = plane;
|
|
414
|
+
// Jev off is read when the run is created (planeFor) and is never lifted here: `env`'s switch (a runner's own) can add
|
|
415
|
+
// "off", never remove it.
|
|
416
|
+
return withJevSwitch(Object.fromEntries(Object.entries(resolved).map(([name, value]) => {
|
|
364
417
|
const fresh = name === "model" ? undefined : now?.fresh[name];
|
|
365
418
|
if (fresh !== undefined && (value === DENIED || (name !== "browser" && now.permission(name) !== "allow")))
|
|
366
419
|
return [name, fresh];
|
|
367
420
|
return [name, name === "browser" && isVendor(value) && !browserKeysOf(env)[value] ? noBrowserKey(value) : value === "parallel" && !keyed ? NO_PARALLEL_KEY : value];
|
|
368
|
-
}));
|
|
421
|
+
})), env, kept === "off");
|
|
369
422
|
}
|
|
370
423
|
/** The Plane kept for a run made before its plane was kept, resolved at a later launch (runs.ts): its browser stays
|
|
371
|
-
*
|
|
372
|
-
* keeps the vendor, never a refusal: the plane each launch hands over is checked again
|
|
373
|
-
* keys missing make it unavailable for that launch alone, and restored keys make the
|
|
374
|
-
|
|
424
|
+
* the default vendor (DEFAULT_BROWSER_VENDOR, the one vendor there was then), never today's pick, which could check its
|
|
425
|
+
* sessions at another vendor. It keeps the vendor, never a refusal: the plane each launch hands over is checked again
|
|
426
|
+
* (recheckPlane), so that vendor's keys missing make it unavailable for that launch alone, and restored keys make the
|
|
427
|
+
* next one run. */
|
|
428
|
+
export const keptFromBefore = (plane) => (plane.browser === undefined ? plane : { ...plane, browser: DEFAULT_BROWSER_VENDOR });
|
|
375
429
|
/** A run's saved Plane as a launch reads it: a vendor's missing-key refusal an earlier server saved (noBrowserKey's exact
|
|
376
430
|
* words, Browserbase's or Kernel's) is that vendor again, which the launch checks again as usual (recheckPlane), so
|
|
377
431
|
* restored keys make it run. Every other saved value stays as it is: `auto` with no key at a run's first launch
|
|
@@ -381,9 +435,9 @@ export function keptVendor(plane) {
|
|
|
381
435
|
return vendor ? { ...plane, browser: vendor } : plane;
|
|
382
436
|
}
|
|
383
437
|
/** The key row (tool-keys.ts) of the browser's vendor on `resolution` with `picked` the provider in force: the vendor it
|
|
384
|
-
* resolved to, else the one picked, else the
|
|
438
|
+
* resolved to, else the one picked, else the default (DEFAULT_BROWSER_VENDOR), so a page links a missing key to the row
|
|
385
439
|
* it is saved on. */
|
|
386
|
-
export const browserKeyRow = (picked, resolution) => (isVendor(resolution) ? resolution : isVendor(picked) ? picked :
|
|
440
|
+
export const browserKeyRow = (picked, resolution) => (isVendor(resolution) ? resolution : isVendor(picked) ? picked : DEFAULT_BROWSER_VENDOR);
|
|
387
441
|
/** The Plane a run's process is handed at a launch, under the server's `settings` now: its kept Plane (as keptVendor
|
|
388
442
|
* reads it) checked again (recheckPlane) against the one it would get today; with none kept, today's, its browser kept
|
|
389
443
|
* (keptFromBefore). At a launch after its first (a relaunch, a follow-up's, one after a restart) a capability set
|
|
@@ -407,6 +461,16 @@ export function planeOf(env) {
|
|
|
407
461
|
}
|
|
408
462
|
/** Whether a run is handed Parallel's key: one of its capabilities resolves to Parallel. */
|
|
409
463
|
export const handsParallel = (plane) => PICKABLE.some((name) => plane[name] === "parallel");
|
|
464
|
+
/** The resolutions of each web tool its run's Web runs (web-run.ts SEARCH_CHAINS, FETCH_CHAINS), where Jev ranks a
|
|
465
|
+
* search's results. */
|
|
466
|
+
const WEB_RUNS = { web_search: ["parallel", "native", "firecrawl-keyless", "exa-keyless"], web_fetch: ["parallel", "firecrawl-keyless", DIRECT_FETCH] };
|
|
467
|
+
/** Whether a run on `harness` is handed TypeSafe's key for its web tools (decisions.ts DecisionNeeds.jevWeb): one of
|
|
468
|
+
* them is served by its own Web (web-run.ts webOf), and Jev is turned off neither by the plane (the server's switch at
|
|
469
|
+
* launch, planeFor) nor in `env` (AGENTRUN_WEB_JEV_OFF: a runner's own switch adds "off", never removes it).
|
|
470
|
+
* web_fetch always is where it runs; web_search is where it resolves to Parallel or a keyless provider, or to native
|
|
471
|
+
* where that is the model provider's hosted search (pi's), never a harness's own search inside its CLI (codex's,
|
|
472
|
+
* claude-agent's: its facts' webSearch), where no Jev call can happen. */
|
|
473
|
+
export const handsJevWeb = (plane, env, harness) => plane.jev !== "off" && !webJevOff(env) && (searchesOwn(plane.web_search ?? "", tableFactsOf(env, harness)) || WEB_RUNS.web_fetch.includes(plane.web_fetch ?? ""));
|
|
410
474
|
/** The issues of `value` as a settings map, its fields under `at` (none: a body's own): each settings key (a tool of the
|
|
411
475
|
* table, a catalog tool, an MCP server's wildcard) to `{provider?, permission?}`, a provider only for a capability that
|
|
412
476
|
* has a choice and one offered for it, a permission one offered for the tool. */
|
package/dist/tools.d.ts
CHANGED
|
@@ -171,10 +171,13 @@ export type EffectRun = {
|
|
|
171
171
|
search?: SearchOn;
|
|
172
172
|
};
|
|
173
173
|
/** What a tool's own ask (ToolEntry.asks) reads: the run's host, and how many calls of a tool the run has run to a good
|
|
174
|
-
* end, from the run's record (its journal), so a pause and a new host count them all
|
|
174
|
+
* end, from the run's record (its journal), so a pause and a new host count them all; `made`, the arguments of those
|
|
175
|
+
* calls (each one whose arguments the record names), with those of the calls the gate let through that have no result
|
|
176
|
+
* yet. */
|
|
175
177
|
export type AskContext = {
|
|
176
178
|
readonly host: ToolHost;
|
|
177
179
|
ran(tool: string): Promise<number>;
|
|
180
|
+
made(tool: string): Promise<readonly unknown[]>;
|
|
178
181
|
};
|
|
179
182
|
export type ToolEntry = {
|
|
180
183
|
/** One line, for capabilities. */
|
|
@@ -352,6 +355,7 @@ export declare const toolsView: (env: NodeJS.ProcessEnv, settings?: ToolSettings
|
|
|
352
355
|
missing?: string[] | undefined;
|
|
353
356
|
reason?: string | undefined;
|
|
354
357
|
available: boolean;
|
|
358
|
+
runner_only?: boolean | undefined;
|
|
355
359
|
sandbox_only?: boolean | undefined;
|
|
356
360
|
call_only?: boolean | undefined;
|
|
357
361
|
nodes: boolean;
|
package/dist/tools.js
CHANGED
|
@@ -36,7 +36,7 @@ import { fetchFor, WEB_FETCH_TOOL, webFetchTool } from "./web-fetch.js";
|
|
|
36
36
|
import { searchFor, WEB_SEARCH_TOOL, webSearchTool } from "./web-search.js";
|
|
37
37
|
import { fakeFetch, fakeSaveOptions, fakeSearch } from "./web-fake.js";
|
|
38
38
|
import { LENGTH_TYPES, SAVE_MAX_BYTES, WEB_SAVE_TOOL, webSaveTool } from "./web-save.js";
|
|
39
|
-
import { browserNeeds, explainsView, isUnavailable, NO_PARALLEL_KEY, PICKABLE, planeOf, PROVIDERS, serverGate, whyUnavailable, withDefaults } from "./tool-plane.js";
|
|
39
|
+
import { browserNeeds, DEFAULT_BROWSER_VENDOR, explainsView, isUnavailable, NO_PARALLEL_KEY, PICKABLE, planeOf, PROVIDERS, serverGate, whyUnavailable, withDefaults } from "./tool-plane.js";
|
|
40
40
|
import { fauxFetch, PARALLEL_KEY_ENV } from "./decisions.js";
|
|
41
41
|
import { keyNeeded } from "./key-words.js";
|
|
42
42
|
import { unattachable } from "./attach-images.js";
|
|
@@ -105,7 +105,7 @@ const emailTool = (name) => ({
|
|
|
105
105
|
});
|
|
106
106
|
/** web_fetch, bound under `name`. */
|
|
107
107
|
const webFetchEntry = (name) => ({
|
|
108
|
-
summary: `Read one public web page from a public host through Firecrawl's keyless fetch where the server holds no Parallel key (each URL sent to Firecrawl, never a private or local one; the guarded direct fetch when Firecrawl answers no page or its free limit is spent), else through
|
|
108
|
+
summary: `Read one public web page from a public host through Firecrawl's keyless fetch where the server holds no Parallel key (each URL sent to Firecrawl, never a private or local one; the guarded direct fetch when Firecrawl answers no page or its free limit is spent), else through Parallel's extract (the default) or the guarded direct fetch where it is picked (Parallel's falling back to the direct fetch, saying why, when Parallel answers no page), a part at a time (offset, max_chars; the page fetched once a run): { ok, url, status, title, text, chars, truncated?, original_chars?, beyond_read?, offset?, next_offset?, html_chars?, converted?, links, links_omitted?, via, parallel?, refused?, error? }; html_chars, the page's whole length, when its HTML was cut at ${HTML_READ_CHARS.toLocaleString("en-US")} characters before it was read, so its text is only the start of the page; converted: "text" when the text is plain text, its conversion to markdown having run out of time; a private or local address, a port other than 80 or 443, or a scheme other than http(s) is refused, never sent to Parallel.`,
|
|
109
109
|
needs: [],
|
|
110
110
|
nodes: true,
|
|
111
111
|
bind: async (host) => {
|
|
@@ -118,7 +118,7 @@ const webFetchEntry = (name) => ({
|
|
|
118
118
|
// A call node's Page is the workflow's, not a model's context: it reads the most of a part by default, from the page
|
|
119
119
|
// the run read (its Web's pages) where it holds the URL. Its request to Parallel, when it makes one, is booked under the call
|
|
120
120
|
// (paid-calls.ts); a part from what the run read makes none and books nothing.
|
|
121
|
-
effect: async (args, run) => bookedIn(run.ledger, async () => fetchFor(run.env, args.url, { ...(await fetchOptions(run.env, FAUX_ENV)), offset: args.offset, maxChars: args.max_chars ?? TEXT_CAP, signal: run.signal })),
|
|
121
|
+
effect: async (args, run) => bookedIn(run.ledger, async () => fetchFor(run.env, args.url, { ...(await fetchOptions(run.env, FAUX_ENV)), offset: args.offset, maxChars: args.max_chars ?? TEXT_CAP, ...(typeof args.objective === "string" ? { objective: args.objective } : {}), signal: run.signal })),
|
|
122
122
|
});
|
|
123
123
|
/** A file or shell tool: listed here for its words and its rules, bound by the run's workspace registry
|
|
124
124
|
* (workspace/run-tools.ts), never by this table. */
|
|
@@ -309,7 +309,7 @@ const browserTool = {
|
|
|
309
309
|
// The agent's computer, where it is a browser, wins over the plane's pick: the run's sessions are that provider's,
|
|
310
310
|
// opened through the claim, with no saved sign-in or plane check of their own.
|
|
311
311
|
const computer = host.browserComputer;
|
|
312
|
-
const planeVendor = planeOf(host.env).browser ??
|
|
312
|
+
const planeVendor = planeOf(host.env).browser ?? DEFAULT_BROWSER_VENDOR;
|
|
313
313
|
const vendor = computer?.provider ?? planeVendor;
|
|
314
314
|
const planeRefused = !computer && isUnavailable(planeVendor) ? new BrowserFailureError(browserFailure("browser_unavailable", `The browser does not run here: ${whyUnavailable(planeVendor)}.`)) : undefined;
|
|
315
315
|
// The run's saved sign-in: on the runner (one process, many claims) read from the store under this run's own claim
|
|
@@ -348,7 +348,7 @@ const browserTool = {
|
|
|
348
348
|
})();
|
|
349
349
|
const refused = "refused" in made ? made.refused : undefined;
|
|
350
350
|
const parts = {
|
|
351
|
-
provider: "browser" in made ? claimBrowserProvider(made.browser, { headless: true, ...(
|
|
351
|
+
provider: "browser" in made ? claimBrowserProvider(made.browser, { headless: true, ...(kept ? { signIn: { name: SIGN_IN_KEY, pointer: kept.ref } } : {}) }) : undefined,
|
|
352
352
|
driver: stand ? stand.driver : cdpDriver(),
|
|
353
353
|
};
|
|
354
354
|
// The save flag every session carries is this launch's (asHanded), never the one stored with its conversation.
|
|
@@ -623,7 +623,7 @@ export const TOOLS = Object.freeze({
|
|
|
623
623
|
},
|
|
624
624
|
[WEB_FETCH_TOOL]: webFetchEntry(WEB_FETCH_TOOL),
|
|
625
625
|
[WEB_SEARCH_TOOL]: {
|
|
626
|
-
summary: "Search the web: Parallel's Search API where the server holds its key, else Firecrawl's keyless search with Exa's behind it; or the provider picked, the harness's own search (claude-agent's, codex's) or on pi the model provider's hosted search (Anthropic, OpenAI) only where native is picked: {
|
|
626
|
+
summary: "Search the web: Parallel's Search API where the server holds its key, else Firecrawl's keyless search with Exa's behind it; or the provider picked, the harness's own search (claude-agent's, codex's) or on pi the model provider's hosted search (Anthropic, OpenAI) only where native is picked: { objective, queries?, n? } (query is deprecated: a model's call gives objective, which the schema requires; a call node's { query } alone is the objective and its one query) -> { provider, objective, queries, results: [{ url, title, snippet, published? }], text? }, provider naming the one that served it, 1 to 25 results, each snippet at most 3,000 characters; { error } when the search gives no answer.",
|
|
627
627
|
needs: [],
|
|
628
628
|
nodes: true,
|
|
629
629
|
// On the runner its hosted search goes through the run's own route (host.search, run.search), labelled web_search.
|
|
@@ -779,7 +779,7 @@ export const toolsView = (env, settings = {}, noBox, refused = {}, runnerShell =
|
|
|
779
779
|
// Unavailable says why: a sandbox-only tool no box here can run, why none can (`noBox`); on a tool a user picks a
|
|
780
780
|
// provider for, the resolutions' own words (`web_search is turned off in settings`); else the variables it needs.
|
|
781
781
|
const reason = available ? undefined : refusal ?? boxless ?? (plane ? [...new Set(Object.values(plane).filter(isUnavailable).map(whyUnavailable))].join("; ") : `Needs ${keyNeeded(missing)}`);
|
|
782
|
-
return { name, summary: entry.summary, ...(blurbOf(name) ? { blurb: blurbOf(name) } : {}), nodes: entry.nodes, calls: entry.effect !== undefined, ...(entry.callOnly ? { call_only: true } : {}), ...(entry.sandboxOnly ? { sandbox_only: true } : {}), available, ...(reason ? { reason } : {}), ...(missing.length ? { missing } : {}), harnesses: isHostTool(name) ? [...everyHarness] : [...generalSpec], ...serverGate(name, settings), ...(plane ? { providers: [...PROVIDERS[name]], provider: picked[name].provider, default_provider: PROVIDERS[name][0], resolves: plane, why: view.why } : {}) };
|
|
782
|
+
return { name, summary: entry.summary, ...(blurbOf(name) ? { blurb: blurbOf(name) } : {}), nodes: entry.nodes, calls: entry.effect !== undefined, ...(entry.callOnly ? { call_only: true } : {}), ...(entry.sandboxOnly ? { sandbox_only: true } : {}), ...(entry.runnerOnly ? { runner_only: true } : {}), available, ...(reason ? { reason } : {}), ...(missing.length ? { missing } : {}), harnesses: isHostTool(name) ? [...everyHarness] : [...generalSpec], ...serverGate(name, settings), ...(plane ? { providers: [...PROVIDERS[name]], provider: picked[name].provider, default_provider: PROVIDERS[name][0], resolves: plane, why: view.why } : {}) };
|
|
783
783
|
});
|
|
784
784
|
// The host tools over a run's own tools (META_TOOLS): not in the table, never granted or named by a node (`meta`), listed
|
|
785
785
|
// so the owner sees them and their setting (allow or deny; a deny is not offered at all).
|
package/dist/trigger-email.js
CHANGED
|
@@ -9,11 +9,14 @@
|
|
|
9
9
|
// watches from then; one that couldn't check until a later poll says so then. A UIDVALIDITY the server changed starts
|
|
10
10
|
// over the same, as does another account saved in its place (PUT /v2/settings/email). A message's key is its Message-ID (else UIDVALIDITY:UID), so
|
|
11
11
|
// one seen twice fires once; its attrs say where it was found (mailbox, UIDVALIDITY, UID), which a run's thread is read
|
|
12
|
-
// from (email/tools.ts)
|
|
12
|
+
// from (email/tools.ts), and `dmarc: "pass"` when the receiving server's own Authentication-Results says DMARC passed
|
|
13
|
+
// for its From's domain (email/authentication.ts, read from the message this poll fetched, no other read): only then is
|
|
14
|
+
// the run's starter spared email_send's new-address ask. At most POLL_TAKES messages a poll, oldest first. A
|
|
13
15
|
// message this server sent (X-AgentRun-Sent, email/tools.ts email_send) is left, and said. An unreachable server is said
|
|
14
16
|
// on the trigger and tried at the next time; a refused sign-in counts (the engine turns the trigger off at the third).
|
|
15
|
-
import { DEFAULT_ACCOUNT, NO_ACCOUNT } from "./email/account.js";
|
|
17
|
+
import { authservIdOf, DEFAULT_ACCOUNT, NO_ACCOUNT } from "./email/account.js";
|
|
16
18
|
import { fittedPayload } from "./email/answer.js";
|
|
19
|
+
import { dmarcPassed } from "./email/authentication.js";
|
|
17
20
|
import { messages } from "./email/names.js";
|
|
18
21
|
import { ACCEPT_SCHEMA, acceptOf, acceptRefusal } from "./trigger-accept.js";
|
|
19
22
|
import { closedSchema, PAYLOAD_KEPT_BYTES, unknownSourceFields } from "./trigger-adapter.js";
|
|
@@ -65,13 +68,16 @@ function cursorOf(text) {
|
|
|
65
68
|
}
|
|
66
69
|
const kept = (cursor) => ({ [CURSOR]: JSON.stringify(cursor) });
|
|
67
70
|
/** A message as the event its trigger fires: its payload (JSON, untrusted, whole within the engine's bound), its attrs
|
|
68
|
-
* (who, what, and where it was found: the run's thread is read from there
|
|
69
|
-
|
|
71
|
+
* (who, what, and where it was found: the run's thread is read from there; `dmarc: "pass"` when the receiving server's
|
|
72
|
+
* own Authentication-Results, under `authservId`, says DMARC passed for its From's domain: email/authentication.ts),
|
|
73
|
+
* keyed by its Message-ID. */
|
|
74
|
+
function eventOf(m, cursor, payloadOf, authservId) {
|
|
70
75
|
const payload = fittedPayload(payloadOf(m), PAYLOAD_KEPT_BYTES);
|
|
76
|
+
const dmarc = dmarcPassed(m.authentication.results, m.authentication.from, authservId);
|
|
71
77
|
return {
|
|
72
78
|
key: m.message_id ?? `${cursor.uidvalidity}:${m.uid}`,
|
|
73
79
|
text: JSON.stringify(payload),
|
|
74
|
-
attrs: { from: m.from, subject: m.subject, ...(m.message_id ? { message_id: m.message_id } : {}), mailbox: cursor.mailbox, uidvalidity: cursor.uidvalidity, uid: String(m.uid) },
|
|
80
|
+
attrs: { from: m.from, subject: m.subject, ...(m.message_id ? { message_id: m.message_id } : {}), mailbox: cursor.mailbox, uidvalidity: cursor.uidvalidity, uid: String(m.uid), ...(dmarc ? { dmarc: "pass" } : {}) },
|
|
75
81
|
event: EVENT,
|
|
76
82
|
body: payload,
|
|
77
83
|
cursor: kept(cursor),
|
|
@@ -122,7 +128,7 @@ async function poll(source, account, cursor, failedBefore) {
|
|
|
122
128
|
const fresh = (await session.uids({ uid: `${cursor.uid + 1}:*` })).filter((uid) => uid > cursor.uid);
|
|
123
129
|
const taken = fresh.slice(0, POLL_TAKES);
|
|
124
130
|
const read = await session.fetch(path, taken, READ_BYTES);
|
|
125
|
-
const events = read.map((m) => eventOf(m, { ...cursor, uid: m.uid }, payloadOf));
|
|
131
|
+
const events = read.map((m) => eventOf(m, { ...cursor, uid: m.uid }, payloadOf, authservIdOf(account)));
|
|
126
132
|
const last = taken.at(-1) ?? cursor.uid;
|
|
127
133
|
const more = fresh.length - taken.length;
|
|
128
134
|
return { check: { ok: true, message: `Read ${source.mailbox}: ${messages(events.length)} new${more > 0 ? `, ${more} more at the next check` : ""}.` }, events, cursor: kept({ ...cursor, uid: last }) };
|
package/dist/triggers.d.ts
CHANGED
|
@@ -18,15 +18,6 @@ export declare const FIRING_STATUSES: readonly ["due", "started", "sent", "skipp
|
|
|
18
18
|
/** The reason of a firing the launch hook's host took (a 2xx) without starting its run here under the firing (RunCreate
|
|
19
19
|
* trigger_firing). */
|
|
20
20
|
export declare const HANDED_NO_RUN = "Handed to the host by the launch hook, which started no run here for it.";
|
|
21
|
-
/** The error code of a firing its launch hook's host released (Triggers.release): it took the firing (a 2xx) and said it
|
|
22
|
-
* will start no run for it. */
|
|
23
|
-
export declare const HOST_RELEASED = "host_released";
|
|
24
|
-
/** The reason of such a firing; its error's message is the host's own words. */
|
|
25
|
-
export declare const HOST_RELEASED_REASON = "Released by the launch hook's host, which took it and will start no run for it.";
|
|
26
|
-
/** The `details.reason` of a release refused because the firing's run started (Triggers.release), beside `details.run_id`:
|
|
27
|
-
* for a host to match without reading the words. A start refused because its host released the firing carries
|
|
28
|
-
* HOST_RELEASED there. */
|
|
29
|
-
export declare const RUN_STARTED = "run_started";
|
|
30
21
|
/** The most characters of the host's words a release keeps. */
|
|
31
22
|
export declare const RELEASE_WORDS_MAX = 500;
|
|
32
23
|
/** The most of a webhook's payload a firing passes on: the rest is cut, at a character's start (trigger-adapter.ts). */
|
|
@@ -121,8 +112,8 @@ export type RunTrigger = {
|
|
|
121
112
|
* origin and title a start here would give the run, and the target and previous-result flag it starts on
|
|
122
113
|
* (TriggerDeps.start's, so a handed run gets its target's cap, effort and previous result as one started here does; the
|
|
123
114
|
* host may lower the cap, and its effort holds when the target sets none). The start writes its run with the firing's
|
|
124
|
-
* start in the same write (store.runs.create `firing`), so a release of the firing meanwhile
|
|
125
|
-
*
|
|
115
|
+
* start in the same write (store.runs.create `firing`), so a release of the firing meanwhile refuses it (FiringMoved)
|
|
116
|
+
* and leaves no run. */
|
|
126
117
|
export type HandedStart = {
|
|
127
118
|
key: string;
|
|
128
119
|
trigger: RunTrigger;
|
|
@@ -239,8 +230,8 @@ export declare class Triggers {
|
|
|
239
230
|
private readonly starting;
|
|
240
231
|
/** Each trigger's removals and the edits that name a target (the one way it moves to another agent), one after another
|
|
241
232
|
* on this server: a move never lands between a template update's delete of its Composio instance and its conditional
|
|
242
|
-
* delete of the row (remove), so a moved trigger never stands on an instance that delete took.
|
|
243
|
-
* store
|
|
233
|
+
* delete of the row (remove), so a moved trigger never stands on an instance that delete took. One server holds a
|
|
234
|
+
* store (its owner lock), so this queue orders every edit of a trigger. Removed from the map once idle. */
|
|
244
235
|
private readonly edits;
|
|
245
236
|
/** Whether a firing waits for its trigger's room (max_active_runs): the timer then reads the store every WAIT_POLL_MS. */
|
|
246
237
|
private waiting;
|
|
@@ -646,9 +637,11 @@ export declare class Triggers {
|
|
|
646
637
|
/** The run the host starts through the API for a firing the launch hook handed it (RunCreate `trigger_firing`),
|
|
647
638
|
* written by `start` from the firing's key (the run's origin key, so the firing finds it), the trigger, input origin
|
|
648
639
|
* and title its own start would give the run, and the target and previous-result flag it starts on (the policy's
|
|
649
|
-
* start, as drive's)
|
|
650
|
-
*
|
|
651
|
-
*
|
|
640
|
+
* start, as drive's). `start` starts the firing in the run's own write (store.runs.create `firing`), which throws
|
|
641
|
+
* FiringMoved once the firing has moved since its room was checked. It can also answer a run that write never linked
|
|
642
|
+
* (startRun's re-delivery under the origin key, or another writer's run after a constraint), and handedRan then
|
|
643
|
+
* starts the firing with it. Or the run already started under that key, `replayed`. Refused, in words, unless this
|
|
644
|
+
* server has the hook and the firing, of a start_run trigger on `agentId`, may start now (startRoom). */
|
|
652
645
|
handedStart(given: unknown, agentId: string, start: (firing: HandedStart) => Promise<{
|
|
653
646
|
run_id: string;
|
|
654
647
|
}>): Promise<{
|
|
@@ -669,7 +662,7 @@ export declare class Triggers {
|
|
|
669
662
|
* its retry) with room by drive's own check (busy: max_active_runs, the overlap, firings mid-hand), then held mid-hand
|
|
670
663
|
* until its run starts; or is one its host took with no run, up to its startBy (the host may answer first and start
|
|
671
664
|
* the run after), then held mid-hand the same way, however long its run takes to write. Its startBy is pushed out to
|
|
672
|
-
* at least START_WINDOW_MS from now if it is sooner, so
|
|
665
|
+
* at least START_WINDOW_MS from now if it is sooner, so its window never closes while its run is written.
|
|
673
666
|
* Undefined when the push was not written: the firing moved meanwhile. A start that would be refused once its run is
|
|
674
667
|
* under its key (`replay`) answers that run: another start of the firing (the host's repeat) wrote it since handedStart
|
|
675
668
|
* read none. One while another start of the firing on this server is writing its run (starting) follows that start. */
|
|
@@ -684,21 +677,11 @@ export declare class Triggers {
|
|
|
684
677
|
/** The refusal of a host start of firing `key` whose run's write found the firing moved (FiringMoved): released by
|
|
685
678
|
* its host, or another not_due naming what it is now. */
|
|
686
679
|
private movedRefusal;
|
|
687
|
-
/** Firing `key`
|
|
688
|
-
*
|
|
689
|
-
* (
|
|
690
|
-
*
|
|
691
|
-
*
|
|
692
|
-
* waiting on it is driven on the next tick. The same call on a firing it released already answers that firing as it
|
|
693
|
-
* is. Refused in words: 422 not_allowed on a server with no launch hook, not_due for a firing whose run started, one
|
|
694
|
-
* still due once the engine's turn on it ends (not handed yet) or any other, with `details` { reason: RUN_STARTED,
|
|
695
|
-
* run_id } when its run started; 404 for a trigger or firing this server does not have. A release during the engine's
|
|
696
|
-
* own turn on the firing (its hook's answer read but not yet written) waits for that turn and reads the firing again,
|
|
697
|
-
* so a 2xx it writes is released. A host start of the firing already writing its run on this server is waited for
|
|
698
|
-
* first: a run it writes makes the firing started, and refused. Any other start, on this server (its room check
|
|
699
|
-
* landing after that wait) or another, is decided by the store: its run's write and this release's are each
|
|
700
|
-
* conditional on the firing being sent with no run, so the one that lands second finds it moved (a start, FiringMoved;
|
|
701
|
-
* this release, the firing read again and refused). */
|
|
680
|
+
/** Firing `key` released by the host the launch hook handed it to (`body` `{ error }`, the host's words, which `cut`
|
|
681
|
+
* takes the server's secrets out of): a firing sent with no run fails at once, host_released, as any failed firing
|
|
682
|
+
* (the openapi route says the rest). It first waits for a host start of the firing writing its run here, and for the
|
|
683
|
+
* engine's own turn on it (its hook call open, or its 2xx read but not yet written). Its write and a start's run
|
|
684
|
+
* write are each conditional on the firing being sent with no run, so the one that lands second finds it moved. */
|
|
702
685
|
release(triggerId: string, key: string, body: Json, cut: (text: string) => string): Promise<{
|
|
703
686
|
start_by?: string | undefined;
|
|
704
687
|
attempts?: number | undefined;
|
|
@@ -721,8 +704,6 @@ export declare class Triggers {
|
|
|
721
704
|
* the run already under its key (`ran`, linked or not: a stop between its write and handedRan); or the start_by of a
|
|
722
705
|
* firing its host took with no run, which the release then fails. Any other is refused in words. */
|
|
723
706
|
private releasable;
|
|
724
|
-
/** A release refused for firing `key`, `why` saying what it is. */
|
|
725
|
-
private notDue;
|
|
726
707
|
/** A release refused for firing `key` because its run `runId` started: in words, and in `details` (RUN_STARTED and the
|
|
727
708
|
* run) for a host to match. Never retryable: the run stays started. */
|
|
728
709
|
private ranRefusal;
|