@parcha/agentrun-serve 0.1.0-beta.35 → 0.1.0-beta.37
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 +298 -0
- package/README.md +417 -219
- package/dist/adapters.d.ts +12 -2
- package/dist/adapters.js +27 -2
- package/dist/agent-rows.d.ts +2 -1
- package/dist/agents-store.d.ts +2 -0
- package/dist/agents-store.js +9 -4
- package/dist/api-only.d.ts +2 -1
- package/dist/api-only.js +3 -1
- package/dist/archil-routes.d.ts +40 -7
- package/dist/archil-routes.js +167 -54
- package/dist/archil-settings.d.ts +79 -7
- package/dist/archil-settings.js +140 -14
- package/dist/attach-conformance-cli.d.ts +1 -0
- package/dist/attach-conformance-cli.js +18 -0
- package/dist/attach-conformance.d.ts +25 -0
- package/dist/attach-conformance.js +343 -0
- package/dist/attach-images.d.ts +15 -0
- package/dist/attach-images.js +59 -0
- package/dist/background.d.ts +0 -6
- package/dist/background.js +0 -28
- package/dist/box-image.d.ts +1 -97
- package/dist/box-image.js +4 -284
- package/dist/box-paths.d.ts +2 -7
- package/dist/box-paths.js +7 -13
- package/dist/box-settings.d.ts +0 -11
- package/dist/box-settings.js +4 -29
- package/dist/browser-commands.js +1 -1
- package/dist/browser-computer.d.ts +47 -3
- package/dist/browser-computer.js +286 -18
- package/dist/browser-cost.d.ts +1 -1
- package/dist/browser-live.d.ts +20 -8
- package/dist/browser-live.js +50 -27
- package/dist/browser-person.d.ts +19 -2
- package/dist/browser-person.js +55 -6
- package/dist/browser-wait-ended.d.ts +23 -0
- package/dist/browser-wait-ended.js +42 -0
- package/dist/cap.d.ts +12 -57
- package/dist/cap.js +20 -160
- package/dist/catalog.d.ts +1 -12
- package/dist/catalog.js +3 -33
- package/dist/cli.js +17 -26
- package/dist/composio-preset.d.ts +36 -0
- package/dist/composio-preset.js +179 -0
- package/dist/computer-attach.d.ts +125 -0
- package/dist/computer-attach.js +330 -0
- package/dist/computer-calls.d.ts +48 -0
- package/dist/computer-calls.js +126 -0
- package/dist/computer-channel.d.ts +57 -0
- package/dist/computer-channel.js +115 -0
- package/dist/computer-commands.d.ts +1 -1
- package/dist/computer-held-routes.d.ts +35 -0
- package/dist/computer-held-routes.js +106 -0
- package/dist/computer-held.d.ts +48 -0
- package/dist/computer-held.js +87 -0
- package/dist/computer-keys.d.ts +21 -1
- package/dist/computer-keys.js +53 -11
- package/dist/computer-live.d.ts +160 -0
- package/dist/computer-live.js +643 -0
- package/dist/computer-routes.d.ts +1 -4
- package/dist/computer-routes.js +3 -5
- package/dist/computer-setting.d.ts +2 -0
- package/dist/computer-setting.js +38 -1
- package/dist/computer-view.d.ts +24 -2
- package/dist/computer-view.js +51 -3
- package/dist/computer-viewer.d.ts +6 -0
- package/dist/computer-viewer.js +297 -0
- package/dist/computers.d.ts +79 -12
- package/dist/computers.js +147 -28
- package/dist/console/assets/index-Cn6JX1uH.js +563 -0
- package/dist/console/assets/index-DRN62V5v.css +1 -0
- package/dist/console/index.html +2 -2
- package/dist/docker-daemon.d.ts +2 -2
- package/dist/docker-daemon.js +2 -2
- package/dist/errors.js +5 -5
- package/dist/faux-computers.d.ts +9 -20
- package/dist/faux-computers.js +56 -24
- package/dist/files.d.ts +1 -9
- package/dist/files.js +1 -9
- package/dist/github-connection.d.ts +10 -2
- package/dist/github-connection.js +65 -2
- package/dist/github-faux.js +1 -1
- package/dist/github.d.ts +22 -2
- package/dist/github.js +42 -8
- package/dist/gpu-words.d.ts +14 -0
- package/dist/gpu-words.js +21 -0
- package/dist/graph-view.d.ts +3 -1
- package/dist/graph-view.js +25 -1
- package/dist/handed-values.d.ts +1 -1
- package/dist/handed-values.js +1 -1
- package/dist/harness-install.d.ts +60 -3
- package/dist/harness-install.js +322 -34
- package/dist/harness.d.ts +1 -0
- package/dist/harness.js +36 -2
- package/dist/host-tools.d.ts +9 -10
- package/dist/host-tools.js +7 -7
- package/dist/hosted-search.d.ts +5 -4
- package/dist/hosted-search.js +2 -7
- package/dist/import-sources.d.ts +10 -0
- package/dist/import-sources.js +44 -2
- package/dist/import.d.ts +3 -3
- package/dist/import.js +37 -6
- package/dist/index.d.ts +1 -3
- package/dist/index.js +1 -2
- package/dist/key-refusal.d.ts +1 -1
- package/dist/key-refusal.js +2 -2
- package/dist/learn/check.d.ts +11 -2
- package/dist/learn/check.js +124 -6
- package/dist/learn/commit.d.ts +43 -7
- package/dist/learn/commit.js +166 -22
- package/dist/learn/folder.d.ts +11 -0
- package/dist/learn/folder.js +37 -1
- package/dist/learn/general.d.ts +66 -0
- package/dist/learn/general.js +73 -0
- package/dist/learn/grade.d.ts +22 -1
- package/dist/learn/grade.js +107 -16
- package/dist/learn/index.d.ts +1 -1
- package/dist/learn/index.js +1 -1
- package/dist/learn/learning.sh +12 -1
- package/dist/learn/notes.d.ts +3 -0
- package/dist/learn/notes.js +3 -0
- package/dist/learn/reflect.d.ts +14 -2
- package/dist/learn/reflect.js +54 -30
- package/dist/learn/skills.d.ts +37 -5
- package/dist/learn/skills.js +60 -7
- package/dist/learned-nodes.d.ts +6 -2
- package/dist/learned-workflow.d.ts +43 -9
- package/dist/learned-workflow.js +128 -37
- package/dist/learning-batch.d.ts +283 -0
- package/dist/learning-batch.js +574 -0
- package/dist/learning-cost.d.ts +79 -0
- package/dist/learning-cost.js +69 -0
- package/dist/learning-evals.d.ts +33 -0
- package/dist/learning-evals.js +98 -0
- package/dist/learning-routes.d.ts +32 -4
- package/dist/learning-routes.js +48 -12
- package/dist/learning-words.d.ts +9 -0
- package/dist/learning-words.js +12 -2
- package/dist/learning.d.ts +39 -19
- package/dist/learning.js +88 -46
- package/dist/live/stream.js +6 -3
- package/dist/live/translate.d.ts +4 -3
- package/dist/live/translate.js +8 -4
- package/dist/live-reach.d.ts +37 -0
- package/dist/live-reach.js +62 -0
- package/dist/mcp-gateway.d.ts +9 -0
- package/dist/mcp-gateway.js +60 -11
- package/dist/mcp-oauth.d.ts +57 -7
- package/dist/mcp-oauth.js +133 -18
- package/dist/mcp-private-hosts.d.ts +4 -4
- package/dist/mcp-private-hosts.js +20 -12
- package/dist/mcp-probe.d.ts +27 -3
- package/dist/mcp-probe.js +106 -29
- package/dist/mcp-secret-writes.js +8 -0
- package/dist/mcp-servers-store.d.ts +38 -15
- package/dist/mcp-servers-store.js +120 -23
- package/dist/mcp-store.d.ts +10 -4
- package/dist/mcp-store.js +17 -6
- package/dist/model-form.d.ts +26 -0
- package/dist/model-form.js +80 -0
- package/dist/model.d.ts +5 -5
- package/dist/model.js +29 -16
- package/dist/openapi.d.ts +2 -0
- package/dist/openapi.js +586 -64
- package/dist/owner.d.ts +0 -1
- package/dist/owner.js +0 -2
- package/dist/page.d.ts +18 -0
- package/dist/page.js +48 -20
- package/dist/paid-calls.d.ts +1 -1
- package/dist/paid-calls.js +1 -1
- package/dist/place-offers.d.ts +96 -0
- package/dist/place-offers.js +202 -0
- package/dist/place.d.ts +9 -13
- package/dist/place.js +21 -32
- package/dist/port-models.d.ts +2 -1
- package/dist/port-models.js +5 -3
- package/dist/print.d.ts +16 -9
- package/dist/print.js +15 -17
- package/dist/propose.d.ts +4 -0
- package/dist/propose.js +34 -11
- package/dist/provider.js +3 -2
- package/dist/reflect-range.d.ts +8 -1
- package/dist/reflect-range.js +1 -1
- package/dist/run-cut.d.ts +5 -0
- package/dist/run-cut.js +19 -0
- package/dist/run-launch.d.ts +28 -3
- package/dist/run-launch.js +14 -4
- package/dist/run-learning-served.d.ts +2 -2
- package/dist/run-manifest.d.ts +2 -2
- package/dist/run-manifest.js +2 -2
- package/dist/run-reads-over-store.d.ts +1 -1
- package/dist/run-repo.d.ts +20 -0
- package/dist/run-repo.js +63 -0
- package/dist/run-secrets.js +3 -3
- package/dist/run-timeline-served.d.ts +1 -1
- package/dist/run-timeline-served.js +56 -44
- package/dist/run-view.d.ts +8 -5
- package/dist/run-view.js +18 -10
- package/dist/runnable.d.ts +2 -2
- package/dist/runnable.js +6 -2
- package/dist/runner/adapter-loop.d.ts +39 -8
- package/dist/runner/adapter-loop.js +770 -83
- package/dist/runner/adapter-run-spec.d.ts +36 -7
- package/dist/runner/adapter-run-spec.js +171 -37
- package/dist/runner/adapters/pi-computer.d.ts +7 -0
- package/dist/runner/adapters/pi-computer.js +43 -0
- package/dist/runner/adapters/pi.d.ts +20 -7
- package/dist/runner/adapters/pi.js +111 -26
- package/dist/runner/beside.d.ts +7 -3
- package/dist/runner/beside.js +26 -12
- package/dist/runner/claim-secrets.d.ts +4 -0
- package/dist/runner/claim-secrets.js +6 -1
- package/dist/runner/cli-run-spec.d.ts +27 -3
- package/dist/runner/cli-run-spec.js +198 -74
- package/dist/runner/commands.d.ts +8 -2
- package/dist/runner/commands.js +31 -6
- package/dist/runner/computer-channel.d.ts +34 -0
- package/dist/runner/computer-channel.js +61 -0
- package/dist/runner/conformance/harness.d.ts +0 -1
- package/dist/runner/conformance/harness.js +87 -18
- package/dist/runner/conformance/subject.d.ts +1 -1
- package/dist/runner/dispatch.js +3 -0
- package/dist/runner/end-of-run.d.ts +22 -12
- package/dist/runner/end-of-run.js +38 -16
- package/dist/runner/github-app.d.ts +2 -1
- package/dist/runner/github-app.js +6 -4
- package/dist/runner/harness-loops.js +16 -2
- package/dist/runner/held-run.d.ts +65 -0
- package/dist/runner/held-run.js +158 -0
- package/dist/runner/journal-kinds.d.ts +35 -6
- package/dist/runner/journal-kinds.js +20 -1
- package/dist/runner/journal-reader.d.ts +5 -4
- package/dist/runner/journal-reader.js +12 -10
- package/dist/runner/learning-ask.d.ts +7 -1
- package/dist/runner/learning-ask.js +21 -6
- package/dist/runner/learning-dispatch.d.ts +22 -0
- package/dist/runner/learning-dispatch.js +77 -10
- package/dist/runner/learning-end.d.ts +37 -1
- package/dist/runner/learning-end.js +115 -14
- package/dist/runner/learning-factory.d.ts +1 -1
- package/dist/runner/learning-factory.js +15 -5
- package/dist/runner/learning-loop.d.ts +139 -7
- package/dist/runner/learning-loop.js +369 -32
- package/dist/runner/learning-seed.d.ts +9 -0
- package/dist/runner/learning-seed.js +14 -1
- package/dist/runner/live-ticker.js +1 -0
- package/dist/runner/loop-contract.d.ts +16 -1
- package/dist/runner/loop-contract.js +6 -0
- package/dist/runner/loop.d.ts +10 -2
- package/dist/runner/loop.js +22 -1
- package/dist/runner/main.d.ts +13 -1
- package/dist/runner/main.js +38 -6
- package/dist/runner/mcp-claim.d.ts +11 -4
- package/dist/runner/mcp-claim.js +140 -23
- package/dist/runner/mcp-github.d.ts +4 -2
- package/dist/runner/mcp-github.js +1 -8
- package/dist/runner/mcp-run.d.ts +6 -4
- package/dist/runner/mcp-run.js +16 -3
- package/dist/runner/metrics.d.ts +15 -2
- package/dist/runner/metrics.js +21 -2
- package/dist/runner/model-route.d.ts +3 -0
- package/dist/runner/model-route.js +5 -2
- package/dist/runner/pr-checkout.d.ts +60 -0
- package/dist/runner/pr-checkout.js +176 -0
- package/dist/runner/reflect-hook.d.ts +19 -0
- package/dist/runner/reflect-hook.js +20 -8
- package/dist/runner/runner.d.ts +26 -0
- package/dist/runner/runner.js +231 -27
- package/dist/runner/scratch-sweep.d.ts +13 -0
- package/dist/runner/scratch-sweep.js +62 -0
- package/dist/runner/sessions.d.ts +1 -1
- package/dist/runner/spec-holds.d.ts +8 -3
- package/dist/runner/spec-holds.js +12 -10
- package/dist/runner/store-port.d.ts +7 -2
- package/dist/runner/store-secrets.js +21 -4
- package/dist/runner/subagent.d.ts +44 -0
- package/dist/runner/subagent.js +190 -0
- package/dist/runner/workflow-host.d.ts +24 -3
- package/dist/runner/workflow-host.js +24 -4
- package/dist/runner/workflow-loop.d.ts +6 -3
- package/dist/runner/workflow-loop.js +9 -8
- package/dist/runner/workflow-spec.d.ts +39 -15
- package/dist/runner/workflow-spec.js +143 -40
- package/dist/runs-over-store.d.ts +16 -6
- package/dist/runs-over-store.js +145 -29
- package/dist/seal-key.js +3 -3
- package/dist/sealed-settings-store.d.ts +5 -2
- package/dist/sealed-settings-store.js +10 -4
- package/dist/sealing.js +1 -2
- package/dist/secret-cut.d.ts +1 -1
- package/dist/secret-cut.js +1 -1
- package/dist/secret-writes.d.ts +5 -4
- package/dist/secret-writes.js +5 -4
- package/dist/server-secrets-store.d.ts +4 -3
- package/dist/server-secrets-store.js +15 -9
- package/dist/server-secrets.js +3 -2
- package/dist/server.d.ts +75 -63
- package/dist/server.js +712 -316
- package/dist/settings-wake.d.ts +21 -0
- package/dist/settings-wake.js +59 -0
- package/dist/standard-webhooks.d.ts +4 -1
- package/dist/standard-webhooks.js +8 -4
- package/dist/store/agent-body.d.ts +9 -2
- package/dist/store/agent-body.js +16 -8
- package/dist/store/command-wake.d.ts +12 -0
- package/dist/store/command-wake.js +37 -0
- package/dist/store/deadline.js +9 -5
- package/dist/store/dialect.d.ts +6 -0
- package/dist/store/dialect.js +5 -0
- package/dist/store/index.d.ts +4 -4
- package/dist/store/index.js +2 -2
- package/dist/store/journal/storage.d.ts +3 -2
- package/dist/store/journal/storage.js +15 -6
- package/dist/store/postgres/connection.js +9 -4
- package/dist/store/postgres/dialect.js +4 -0
- package/dist/store/postgres/migrations/0004_runs_outcome_stop_or_cancel.sql +11 -0
- package/dist/store/postgres/migrations/0005_learning_rounds.sql +14 -0
- package/dist/store/postgres/migrations/0006_run_changes_channel_attempts.sql +57 -0
- package/dist/store/postgres/migrations/0007_viewer_host.sql +11 -0
- package/dist/store/postgres/migrations/0008_paired_computers.sql +30 -0
- package/dist/store/postgres/migrations/0009_commands_answer.sql +10 -0
- package/dist/store/schema.d.ts +2 -1
- package/dist/store/schema.js +85 -13
- package/dist/store/seal.d.ts +13 -0
- package/dist/store/seal.js +19 -0
- package/dist/store/sqlite/connection.d.ts +5 -0
- package/dist/store/sqlite/connection.js +88 -47
- package/dist/store/sqlite/run-patch.d.ts +25 -7
- package/dist/store/sqlite/run-patch.js +58 -14
- package/dist/store/sqlite/store.js +331 -59
- package/dist/store/store.d.ts +330 -21
- package/dist/store/store.js +34 -2
- package/dist/store-reads/analytics.js +3 -2
- package/dist/store-reads/cap.d.ts +2 -4
- package/dist/store-reads/cap.js +16 -7
- package/dist/store-reads/decisions.d.ts +3 -3
- package/dist/store-reads/decisions.js +3 -6
- package/dist/store-reads/import-summary.d.ts +1 -1
- package/dist/store-reads/journal.d.ts +5 -4
- package/dist/store-reads/journal.js +118 -27
- package/dist/store-reads/learning.d.ts +34 -4
- package/dist/store-reads/learning.js +137 -23
- package/dist/store-reads/runs.d.ts +7 -5
- package/dist/store-reads/runs.js +17 -10
- package/dist/store-reads/stats.js +5 -1
- package/dist/store-reads/workflow.d.ts +1 -1
- package/dist/store-view.d.ts +5 -0
- package/dist/store-view.js +70 -29
- package/dist/template-eval.js +8 -5
- package/dist/template-github-permissions.d.ts +22 -8
- package/dist/template-github-permissions.js +35 -15
- package/dist/templates.d.ts +64 -0
- package/dist/templates.js +101 -16
- package/dist/timeline/timeline.d.ts +30 -1
- package/dist/timeline/timeline.js +29 -13
- package/dist/timeline/util.d.ts +4 -0
- package/dist/timeline/util.js +14 -0
- package/dist/tool-blurbs.js +1 -0
- package/dist/tool-budget.d.ts +27 -7
- package/dist/tool-budget.js +21 -9
- package/dist/tool-gate.d.ts +23 -10
- package/dist/tool-gate.js +60 -44
- package/dist/tool-plane.d.ts +46 -28
- package/dist/tool-plane.js +73 -31
- package/dist/tools.d.ts +31 -38
- package/dist/tools.js +117 -74
- package/dist/trigger-adapter.d.ts +4 -0
- package/dist/trigger-secrets-shown.d.ts +2 -2
- package/dist/trigger-secrets-shown.js +1 -1
- package/dist/trigger-signatures.d.ts +26 -6
- package/dist/trigger-signatures.js +44 -8
- package/dist/trigger-targets.d.ts +2 -0
- package/dist/trigger-targets.js +1 -0
- package/dist/trigger-webhook.js +5 -2
- package/dist/triggers.d.ts +10 -6
- package/dist/triggers.js +37 -7
- package/dist/turn-end.d.ts +0 -3
- package/dist/turn-end.js +0 -3
- package/dist/turns.js +16 -1
- package/dist/usage-lines.d.ts +1 -1
- package/dist/validate.d.ts +6 -0
- package/dist/validate.js +41 -4
- package/dist/web-fetch.d.ts +1 -1
- package/dist/web-search.d.ts +10 -5
- package/dist/web-search.js +7 -6
- package/dist/webhooks.d.ts +147 -103
- package/dist/webhooks.js +564 -324
- package/dist/workflow/decision-recovery.d.ts +23 -0
- package/dist/workflow/decision-recovery.js +80 -0
- package/dist/workflow/decisions.d.ts +134 -0
- package/dist/workflow/decisions.js +46 -0
- package/dist/workflow/host-session.d.ts +5 -0
- package/dist/workflow/host-session.js +85 -0
- package/dist/workflow/host-tools.d.ts +3 -0
- package/dist/workflow/host-tools.js +3 -0
- package/dist/workflow/node-runner.d.ts +113 -0
- package/dist/workflow/node-runner.js +270 -0
- package/dist/workflow/node.d.ts +89 -0
- package/dist/workflow/node.js +101 -0
- package/dist/workflow/operator-error.d.ts +4 -0
- package/dist/workflow/operator-error.js +4 -0
- package/dist/workflow/pi-versions.d.ts +32 -0
- package/dist/workflow/pi-versions.js +65 -0
- package/dist/workflow/record-file.d.ts +10 -0
- package/dist/workflow/record-file.js +56 -0
- package/dist/workflow/record-tool.d.ts +77 -0
- package/dist/workflow/record-tool.js +126 -0
- package/dist/workflow/record.d.ts +151 -0
- package/dist/workflow/record.js +401 -0
- package/dist/workflow/run-error.d.ts +16 -0
- package/dist/workflow/run-error.js +26 -0
- package/dist/workflow/runner.d.ts +6 -0
- package/dist/workflow/runner.js +240 -0
- package/dist/workflow/store.d.ts +23 -0
- package/dist/workflow/store.js +242 -0
- package/dist/workflow/task.d.ts +133 -0
- package/dist/workflow/task.js +412 -0
- package/dist/workflow/thinking.d.ts +3 -0
- package/dist/workflow/thinking.js +7 -0
- package/dist/workflow/tool-context.d.ts +21 -0
- package/dist/workflow/tool-context.js +13 -0
- package/dist/workflow/types.d.ts +126 -0
- package/dist/workflow/types.js +1 -0
- package/dist/workflow-run.d.ts +2 -2
- package/dist/workspace/agent-computer.d.ts +137 -0
- package/dist/workspace/agent-computer.js +292 -0
- package/dist/workspace/archil-claim.d.ts +11 -0
- package/dist/workspace/archil-claim.js +18 -10
- package/dist/workspace/archil-disks.d.ts +49 -0
- package/dist/workspace/archil-disks.js +185 -0
- package/dist/workspace/archil-exec.js +2 -3
- package/dist/workspace/archil-mount-credential.d.ts +20 -4
- package/dist/workspace/archil-mount-credential.js +13 -4
- package/dist/workspace/attached-computers.d.ts +41 -0
- package/dist/workspace/attached-computers.js +114 -0
- package/dist/workspace/computer-deps.d.ts +32 -17
- package/dist/workspace/computer-deps.js +37 -14
- package/dist/workspace/computer-for-claim.d.ts +58 -13
- package/dist/workspace/computer-for-claim.js +267 -26
- package/dist/workspace/computer-hold.d.ts +11 -27
- package/dist/workspace/computer-hold.js +36 -56
- package/dist/workspace/computer-janitor.d.ts +3 -2
- package/dist/workspace/computer-janitor.js +43 -9
- package/dist/workspace/computer-ledger.d.ts +5 -1
- package/dist/workspace/computer-ledger.js +11 -0
- package/dist/workspace/computer-mcp.d.ts +25 -0
- package/dist/workspace/computer-mcp.js +41 -0
- package/dist/workspace/computer-ports.d.ts +4 -13
- package/dist/workspace/computer-ports.js +4 -107
- package/dist/workspace/computer-script.d.ts +37 -0
- package/dist/workspace/computer-script.js +138 -0
- package/dist/workspace/executors.d.ts +1 -1
- package/dist/workspace/index.d.ts +7 -4
- package/dist/workspace/index.js +4 -1
- package/dist/workspace/kind-skills/desktop/SKILL.md +119 -84
- package/dist/workspace/kind-skills/phone/SKILL.md +100 -85
- package/dist/workspace/resolve-computer.d.ts +45 -11
- package/dist/workspace/resolve-computer.js +72 -14
- package/dist/workspace/run-disk.d.ts +34 -0
- package/dist/workspace/run-disk.js +91 -0
- package/dist/workspace/run-tools.d.ts +35 -18
- package/dist/workspace/run-tools.js +24 -29
- package/dist/workspace/server-run-workspace.d.ts +3 -2
- package/dist/workspace/server-run-workspace.js +17 -4
- package/dist/workspace.js +1 -1
- package/package.json +19 -21
- package/templates/README.md +9 -6
- package/templates/code-review/agent.md +27 -11
- package/templates/code-review/evals/clean-refactor/graders/coverage.md +4 -0
- package/templates/code-review/evals/clean-refactor/graders/risk.md +5 -0
- package/templates/code-review/evals/injection/graders/ignores.md +1 -1
- package/templates/code-review/evals/never-flag/case.yaml +3 -0
- package/templates/code-review/evals/never-flag/graders/only-p0.md +4 -0
- package/templates/code-review/evals/never-flag/graders/schema.md +5 -0
- package/templates/code-review/evals/never-flag/prompt.md +30 -0
- package/templates/code-review/evals/null-name/graders/finds.md +1 -1
- package/templates/code-review/evals/off-by-one/graders/finds.md +1 -1
- package/templates/code-review/evals/off-by-one/graders/no-repo-reads.md +6 -5
- package/templates/code-review/evals/re-review/graders/resolves.md +1 -1
- package/templates/code-review/evals/re-review/prompt.md +1 -1
- package/templates/code-review/evals/re-review-open/case.yaml +3 -0
- package/templates/code-review/evals/re-review-open/graders/schema.md +5 -0
- package/templates/code-review/evals/re-review-open/graders/stays-open.md +4 -0
- package/templates/code-review/evals/re-review-open/prompt.md +27 -0
- package/templates/code-review/evals/repo-rule/graders/cites.md +1 -1
- package/templates/code-review/evals/two-defects/case.yaml +3 -0
- package/templates/code-review/evals/two-defects/graders/both.md +4 -0
- package/templates/code-review/evals/two-defects/graders/schema.md +5 -0
- package/templates/code-review/evals/two-defects/prompt.md +25 -0
- package/templates/code-review/findings.schema.json +131 -27
- package/templates/code-review/rules/CODEREVIEW.md +76 -0
- package/templates/code-review/skills/review/DEEP.md +130 -0
- package/templates/code-review/skills/review/REVIEWER.md +116 -0
- package/templates/code-review/skills/review/SKILL.md +104 -154
- package/templates/market-monitor/agent.md +1 -1
- package/dist/box/record.d.ts +0 -6
- package/dist/box/record.js +0 -41
- package/dist/box/sweep.d.ts +0 -53
- package/dist/box/sweep.js +0 -193
- package/dist/box-egress-vm.d.ts +0 -118
- package/dist/box-egress-vm.js +0 -354
- package/dist/box-egress.d.ts +0 -105
- package/dist/box-egress.js +0 -256
- package/dist/box-relay-vm.d.ts +0 -84
- package/dist/box-relay-vm.js +0 -437
- package/dist/box-relay.d.ts +0 -36
- package/dist/box-relay.js +0 -207
- package/dist/boxes.d.ts +0 -109
- package/dist/boxes.js +0 -249
- package/dist/budget.d.ts +0 -71
- package/dist/budget.js +0 -199
- package/dist/console/assets/index-B7NKTU8E.css +0 -1
- package/dist/console/assets/index-CXZMgJE7.js +0 -550
- package/dist/daytona-api.d.ts +0 -10
- package/dist/daytona-api.js +0 -20
- package/dist/egress-proxy.d.ts +0 -45
- package/dist/egress-proxy.js +0 -416
- package/dist/egress-table.d.ts +0 -24
- package/dist/egress-table.js +0 -165
- package/dist/run-db.d.ts +0 -53
- package/dist/run-db.js +0 -116
- package/templates/code-review/rules/REVIEW.md +0 -41
package/dist/tools.js
CHANGED
|
@@ -29,6 +29,7 @@ import { searchFor, WEB_SEARCH_TOOL, webSearchTool } from "./web-search.js";
|
|
|
29
29
|
import { browserNeeds, explainsView, isUnavailable, NO_PARALLEL_KEY, PICKABLE, planeOf, PROVIDERS, serverGate, whyUnavailable, withDefaults } from "./tool-plane.js";
|
|
30
30
|
import { fauxFetch, PARALLEL_KEY_ENV } from "./decisions.js";
|
|
31
31
|
import { keyNeeded } from "./key-words.js";
|
|
32
|
+
import { unattachable } from "./attach-images.js";
|
|
32
33
|
import { handedSignIn } from "./secrets.js";
|
|
33
34
|
import { redactedAnswer } from "./key-refusal.js";
|
|
34
35
|
import { SIGN_IN_KEY, vendorsOver } from "./sign-ins.js";
|
|
@@ -36,11 +37,14 @@ import { answerIn, answerOnce } from "./runner/hand-back.js";
|
|
|
36
37
|
import { waitingAsk } from "./browser-commands.js";
|
|
37
38
|
import { runnerSecrets } from "./runner/redact.js";
|
|
38
39
|
import { HANDOVER_WAITING } from "./runner/journal-kinds.js";
|
|
40
|
+
import { provenFor } from "./live-reach.js";
|
|
41
|
+
import { clearWaitEnded, markWaitEnded } from "./browser-wait-ended.js";
|
|
39
42
|
import { runSignIn, verifyRunSignIn } from "./sign-ins-store.js";
|
|
40
43
|
export const ASK_TOOL = "ask_person";
|
|
41
|
-
/** Under `--faux` only: a module whose default export gives the browser's `{
|
|
42
|
-
* environment, the vendor its plane names
|
|
43
|
-
*
|
|
44
|
+
/** Under `--faux` only: a module whose default export gives the browser's `{ computer, driver }` for the run's
|
|
45
|
+
* environment, the vendor its plane names and the saved sign-in it was handed for that vendor (`{ provider, ref, save }`,
|
|
46
|
+
* or undefined): a browser computer provider and a driver in place of the vendor's and the raw-CDP driver (the tests'
|
|
47
|
+
* fake backend). */
|
|
44
48
|
export const FAUX_BROWSER_ENV = "AGENTRUN_SERVE_FAUX_BROWSER";
|
|
45
49
|
/** Under `--faux` only: a module whose default export is the fetch a run's first saved sign-in is made with on the runner,
|
|
46
50
|
* in place of the browser vendors' REST APIs (the tests' fake). Absent under --faux, none is made: no network. */
|
|
@@ -177,24 +181,28 @@ export const uploadsFrom = (work, maxBytes, mime) => ({
|
|
|
177
181
|
}
|
|
178
182
|
},
|
|
179
183
|
});
|
|
180
|
-
/**
|
|
181
|
-
*
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
184
|
+
/** An image block's `data` kept whole by the cut: its base64 is an image a model can be sent (attach-images.ts
|
|
185
|
+
* unattachable: a PNG, JPEG, GIF or WebP whose bytes are the type it names and whose header says its size), and its
|
|
186
|
+
* decoded bytes, read as text, hold nothing the cut takes out (a held value written after a valid header). */
|
|
187
|
+
const wholeImage = (block, cut) => {
|
|
188
|
+
if (unattachable(block) !== undefined)
|
|
189
|
+
return false;
|
|
190
|
+
const bytes = Buffer.from(block.data, "base64").toString("latin1");
|
|
191
|
+
return cut(bytes) === bytes;
|
|
192
|
+
};
|
|
193
|
+
/** Every string in `value` (a tool's answer: its content, its details) passed through `cut`; anything else as it is. An
|
|
194
|
+
* image block's `data` that is an image (wholeImage) is its pixels' base64, not text, and is kept whole: the cut reads a
|
|
195
|
+
* run of more than 8,192 characters with no whitespace as "[redacted]" (key-refusal.ts redactedAnswer), which no model
|
|
196
|
+
* takes as an image. Any other `data`, on a block of any type, is cut like every other string. */
|
|
197
|
+
export function cutAnswer(value, cut) {
|
|
192
198
|
if (typeof value === "string")
|
|
193
199
|
return cut(value);
|
|
194
200
|
if (Array.isArray(value))
|
|
195
|
-
return value.map((item) =>
|
|
201
|
+
return value.map((item) => cutAnswer(item, cut));
|
|
196
202
|
if (value && typeof value === "object" && Object.getPrototypeOf(value) === Object.prototype) {
|
|
197
|
-
|
|
203
|
+
const block = value;
|
|
204
|
+
const keep = block.type === "image" && wholeImage(block, cut);
|
|
205
|
+
return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, keep && key === "data" ? item : cutAnswer(item, cut)]));
|
|
198
206
|
}
|
|
199
207
|
return value;
|
|
200
208
|
}
|
|
@@ -205,7 +213,7 @@ function answersCutInside(tool, cut) {
|
|
|
205
213
|
...tool,
|
|
206
214
|
execute: (async (...args) => {
|
|
207
215
|
try {
|
|
208
|
-
return
|
|
216
|
+
return cutAnswer(await tool.execute(...args), cut);
|
|
209
217
|
}
|
|
210
218
|
catch (error) {
|
|
211
219
|
if (error instanceof Error) {
|
|
@@ -218,12 +226,6 @@ function answersCutInside(tool, cut) {
|
|
|
218
226
|
}),
|
|
219
227
|
};
|
|
220
228
|
}
|
|
221
|
-
/** Kernel's provider, opening the agent's saved profile (`ref`, its name at Kernel) where a session asks for the
|
|
222
|
-
* profile `default`: the policy, the session's record and the model see only that name. */
|
|
223
|
-
export const keptProfile = (provider, ref) => ({
|
|
224
|
-
...provider,
|
|
225
|
-
create: (spec, signal) => provider.create(spec.profile?.name === SIGN_IN_KEY ? { ...spec, profile: { ...spec.profile, name: ref } } : spec, signal),
|
|
226
|
-
});
|
|
227
229
|
/** `provider`, its sessions' profile as this launch was handed it, whatever the policy a conversation was made with (a
|
|
228
230
|
* follow-up's was made under an earlier launch, which may have had no sign-in, or another lease): with a sign-in, every
|
|
229
231
|
* session opens on the profile `default`, saving only as `kept.save` says; without one, none asks for a profile. */
|
|
@@ -244,15 +246,17 @@ export const runSignInSaved = (store, sealKey, claim, kept) => async (row, chang
|
|
|
244
246
|
const ended = row.session.endedAt ? Date.parse(row.session.endedAt) : Number.NaN;
|
|
245
247
|
return verifyRunSignIn(store, sealKey, claim, kept, Number.isFinite(ended) ? ended : Date.now());
|
|
246
248
|
};
|
|
247
|
-
/** A
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
*
|
|
255
|
-
*
|
|
249
|
+
/** A browser on pi-browser's durable adapter, its sessions a browser computer provider's of the computer registry
|
|
250
|
+
* (browser-computer.ts), each driven over its CDP URL by pi-browser's raw-CDP driver: the agent's computer, where it is
|
|
251
|
+
* a browser (the claim's, computer-for-claim.ts), else the one the run's plane names (tool-plane.ts: picked, else
|
|
252
|
+
* Browserbase where the server holds its keys, else Kernel), kept for the run's life; a plane that names none (a run kept
|
|
253
|
+
* from before the pick) is Browserbase. Its sessions' custody lives in the run's own store. No recording; the owner
|
|
254
|
+
* watches it live, takes it over and hands it back, and the agent may ask them to (browser-live.ts, browser-person.ts).
|
|
255
|
+
* A session the run still holds is released when the run is let go. Where the plane says unavailable (its vendor's key
|
|
256
|
+
* gone since), each call is refused, saying why. Its session time is the run's spend, held under its cap before it runs
|
|
257
|
+
* (browser-cost.ts). A run on the plane's vendor handed its agent's saved sign-in for that vendor (sign-ins.ts) opens
|
|
258
|
+
* every session on it, as the profile `default`, saving only where it holds the agent's save lease; one that saved says
|
|
259
|
+
* so in its run directory. */
|
|
256
260
|
const browserTool = {
|
|
257
261
|
summary: "Drive a hosted browser, Browserbase's or Kernel's (picked in tool settings, else whichever's key the server holds): open pages, read and screenshot them, and act on them.",
|
|
258
262
|
// Which vendor's keys it needs is the plane's to say (tool-plane.ts BROWSER_KEYS): neither alone is required.
|
|
@@ -264,42 +268,59 @@ const browserTool = {
|
|
|
264
268
|
// Its downloads go into work/ by path (pi-browser), which a box's command could turn through a link.
|
|
265
269
|
runnerOnly: true,
|
|
266
270
|
bind: async (host) => {
|
|
267
|
-
const [{ BACKGROUND_CONTEXT: context }, { createBrowserExtension }, { DEFAULT_BROWSER_POLICY, BrowserFailureError, browserFailure, MAX_UPLOAD_BYTES, uploadMime }, { createDrivingGates, createLiveView, liveViewProvider }, live, person] = await Promise.all([
|
|
271
|
+
const [{ BACKGROUND_CONTEXT: context }, { createBrowserExtension }, { DEFAULT_BROWSER_POLICY, BrowserFailureError, browserFailure, MAX_UPLOAD_BYTES, uploadMime }, { createDrivingGates, createLiveView, liveViewProvider }, live, person, { claimBrowserProvider, closeHeldSockets, planeBrowser, planeComputer, releaseOlderBrowsers }, { cdpDriver }] = await Promise.all([
|
|
268
272
|
import("@earendil-works/chord/context"),
|
|
269
273
|
import("@parcha/pi-browser/durable"),
|
|
270
274
|
import("@parcha/pi-browser"),
|
|
271
275
|
import("@parcha/pi-browser/live-view"),
|
|
272
276
|
import("./browser-live.js"),
|
|
273
277
|
import("./browser-person.js"),
|
|
278
|
+
import("./browser-computer.js"),
|
|
279
|
+
import("@parcha/pi-browser/driver/cdp"),
|
|
274
280
|
]);
|
|
275
281
|
// The agent's computer, where it is a browser, wins over the plane's pick: the run's sessions are that provider's,
|
|
276
|
-
// opened through the claim
|
|
277
|
-
// saved sign-in or plane check of their own.
|
|
282
|
+
// opened through the claim, with no saved sign-in or plane check of their own.
|
|
278
283
|
const computer = host.browserComputer;
|
|
279
284
|
const planeVendor = planeOf(host.env).browser ?? "browserbase";
|
|
280
285
|
const vendor = computer?.provider ?? planeVendor;
|
|
281
|
-
const
|
|
286
|
+
const planeRefused = !computer && isUnavailable(planeVendor) ? new BrowserFailureError(browserFailure("browser_unavailable", `The browser does not run here: ${whyUnavailable(planeVendor)}.`)) : undefined;
|
|
282
287
|
// The run's saved sign-in: on the runner (one process, many claims) read from the store under this run's own claim
|
|
283
288
|
// (sign-ins-store.ts runSignIn), never from the process; on the old per-run process, over its own secrets' pipe.
|
|
284
289
|
// An agent with none saved has its first made at the vendor now, over this run's own claim keys (host.env), as main's
|
|
285
290
|
// launch makes it: never the process's environment, so one run's keys never make another's.
|
|
286
291
|
const runLog = (line) => void process.stderr.write(`agentrun-serve: run ${host.where.ref.id}: ${line}\n`);
|
|
287
292
|
const vendorFetch = async () => (host.env[FAUX_ENV] ? fauxFetch(host.env, FAUX_VENDOR_API_ENV) : fetch);
|
|
288
|
-
const handed = computer ? undefined : host.claim ? (
|
|
289
|
-
const kept = !
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
293
|
+
const handed = computer ? undefined : host.claim ? (planeRefused || !host.store || !host.sealKey ? undefined : await runSignIn(host.store, host.sealKey, host.claim, vendor, { vendors: vendorsOver(() => host.env, vendorFetch), log: runLog })) : handedSignIn();
|
|
294
|
+
const kept = !planeRefused && handed?.provider === vendor ? handed : undefined;
|
|
295
|
+
// Tests only (--faux): the faux browser's computer provider and driver stand in for the plane vendor's and the raw-CDP
|
|
296
|
+
// driver. The agent's browser computer is still the claim's, so a test hands the claim a faux provider of its own.
|
|
297
|
+
const faux = !computer && host.env[FAUX_ENV] ? host.env[FAUX_BROWSER_ENV] : undefined;
|
|
298
|
+
const stand = faux ? (await import(pathToFileURL(faux).href)).default(host.env, vendor, kept) : undefined;
|
|
299
|
+
// The session's browser: the claim's (the agent's computer), else the plane's vendor on the run's tool keys, opened
|
|
300
|
+
// the same way under the run's labels. One that cannot be made refuses each call, in its words.
|
|
301
|
+
const made = planeRefused
|
|
302
|
+
? { refused: planeRefused }
|
|
303
|
+
: await (async () => {
|
|
304
|
+
try {
|
|
305
|
+
if (computer)
|
|
306
|
+
return { browser: computer };
|
|
307
|
+
const provider = stand ? stand.computer : await planeComputer(vendor, host.env);
|
|
308
|
+
const plane = planeBrowser(provider, host.claim);
|
|
309
|
+
if (host.claim && !stand)
|
|
310
|
+
await releaseOlderBrowsers(provider, host.claim);
|
|
311
|
+
return { browser: plane };
|
|
312
|
+
}
|
|
313
|
+
catch (error) {
|
|
314
|
+
if (error instanceof BrowserFailureError)
|
|
315
|
+
return { refused: error };
|
|
316
|
+
return { refused: new BrowserFailureError(browserFailure("browser_unavailable", `The browser does not run here: ${error instanceof Error ? error.message : String(error)}.`)) };
|
|
317
|
+
}
|
|
318
|
+
})();
|
|
319
|
+
const refused = "refused" in made ? made.refused : undefined;
|
|
320
|
+
const parts = {
|
|
321
|
+
provider: "browser" in made ? claimBrowserProvider(made.browser, { headless: true, ...(host.env.BROWSERBASE_CONNECT_BASE_URL ? { connectBaseUrl: host.env.BROWSERBASE_CONNECT_BASE_URL } : {}), ...(kept ? { signIn: { name: SIGN_IN_KEY, pointer: kept.ref } } : {}) }) : undefined,
|
|
322
|
+
driver: stand ? stand.driver : cdpDriver(),
|
|
323
|
+
};
|
|
303
324
|
// The save flag every session carries is this launch's (asHanded), never the one stored with its conversation.
|
|
304
325
|
const handedProvider = parts.provider ? asHanded(parts.provider, kept) : undefined;
|
|
305
326
|
// The owner's live view (browser-live.ts): pi-browser's own viewer on a loopback port of this process's, over every
|
|
@@ -331,6 +352,12 @@ const browserTool = {
|
|
|
331
352
|
// the run's own cut on the runner (host.redact: the claim's keys too, every tool's, in every form), and the secrets
|
|
332
353
|
// its env holds (runnerSecrets: hostSecrets and every launcher name's value) with its sign-in's pointer.
|
|
333
354
|
redact: (text) => redactedAnswer(host.redact ? host.redact(text) : text, [...runnerSecrets(host.env), ...(kept ? [kept.ref] : [])]),
|
|
355
|
+
// The Screen tab's ended state, one settings row the server reads per poll (browser-wait-ended.ts); cleared as a
|
|
356
|
+
// session opens (onSessions, below).
|
|
357
|
+
waitEnded: (at, why) => {
|
|
358
|
+
if (host.store && host.claim)
|
|
359
|
+
void markWaitEnded(host.store.settings, host.claim.runId, { at: new Date(at).toISOString(), why }, host.claim.epoch).catch(() => undefined);
|
|
360
|
+
},
|
|
334
361
|
note: async (kind, data) => {
|
|
335
362
|
// A hand-over's waiting entry, on the runner: the row says the run waits on the person in its browser from that
|
|
336
363
|
// commit (the server tells run.needs_input by it), and no more from its answer's, whoever writes it.
|
|
@@ -361,7 +388,14 @@ const browserTool = {
|
|
|
361
388
|
return { outcome: stood.state, at: stood.at, ...(stood.reason !== undefined ? { reason: stood.reason } : {}) };
|
|
362
389
|
},
|
|
363
390
|
});
|
|
364
|
-
|
|
391
|
+
// On a runner on another host than its server, the viewer listens on the runner's live address and takes no page or
|
|
392
|
+
// socket without the server's proof for its own path id (live-reach.ts).
|
|
393
|
+
const at = host.liveAt;
|
|
394
|
+
const admit = at ? (req) => {
|
|
395
|
+
const id = /^\/v\/([A-Za-z0-9_-]{22})(?:\/ws)?(?:\?|$)/.exec(req.url ?? "")?.[1];
|
|
396
|
+
return id !== undefined && provenFor(req, at, id);
|
|
397
|
+
} : undefined;
|
|
398
|
+
const view = createLiveView({ hostOrigin: "'self'", gates, takeOver: { take: (tag) => hands.take(tag) }, ...(at ? { listen: { bind: at.bind, host: at.host }, admit: admit } : {}) });
|
|
365
399
|
const watched = handedProvider ? liveViewProvider(handedProvider, view) : undefined;
|
|
366
400
|
const provider = () => {
|
|
367
401
|
if (refused)
|
|
@@ -370,7 +404,7 @@ const browserTool = {
|
|
|
370
404
|
};
|
|
371
405
|
// Each session's viewer reaches the server as it launches, and goes as it ends: through the store, under the run's claim
|
|
372
406
|
// (host.liveViewers); never a file in the run's folder, which is the agent's workspace.
|
|
373
|
-
const viewers = live.sessionHandovers(host.liveViewers);
|
|
407
|
+
const viewers = live.sessionHandovers(host.liveViewers, at?.host);
|
|
374
408
|
const onSession = (row, change) => viewers.changed(row, change);
|
|
375
409
|
// Its session time is the run's spend, at its provider's price, and held under the run's cap (browser-cost.ts).
|
|
376
410
|
const providerName = parts.provider?.name ?? vendor;
|
|
@@ -400,6 +434,9 @@ const browserTool = {
|
|
|
400
434
|
// A session let go ends a wait on the person's answer that kept it open (personWait, below): the run parks.
|
|
401
435
|
if (change === "released")
|
|
402
436
|
hands.sessionEnded(row.session.tag);
|
|
437
|
+
// A session that opens, whatever let the last one go: the Screen tab's ended state goes (browser-wait-ended.ts).
|
|
438
|
+
if (change === "launched" && host.store && host.claim)
|
|
439
|
+
await clearWaitEnded(host.store.settings, host.claim.runId, host.claim.epoch).catch(() => undefined);
|
|
403
440
|
await saved?.(row, change);
|
|
404
441
|
await onSession(row, change);
|
|
405
442
|
};
|
|
@@ -469,7 +506,9 @@ const browserTool = {
|
|
|
469
506
|
// (live, or held for a hand-over), the run waits for the answer in its claim, so the session, its live viewer and its
|
|
470
507
|
// page stay for the person and for the agent's next turn, as main's process kept them; the person's time on each such
|
|
471
508
|
// session is held under the run's cap the way a hand-over's is (personHands.wait). With none open, or no room under
|
|
472
|
-
// the cap for that time, the run parks (its release lets the browser go).
|
|
509
|
+
// the cap for that time, the run parks (its release lets the browser go). While it waits, pi-browser's idle release
|
|
510
|
+
// keeps its hands off those sessions (keepForPerson): the person's window (AGENTRUN_BROWSER_PERSON_WAIT_MIN), not the
|
|
511
|
+
// browser's few-minute idle window, decides when the browser goes.
|
|
473
512
|
host.personWait?.(async (harness, callId, since) => {
|
|
474
513
|
if (refused)
|
|
475
514
|
return undefined;
|
|
@@ -477,8 +516,15 @@ const browserTool = {
|
|
|
477
516
|
const open = rows.filter((row) => (row.state === "live" || row.state === "held") && row.resourceId !== null).map((row) => row.tag);
|
|
478
517
|
if (!open.length)
|
|
479
518
|
return undefined;
|
|
519
|
+
const keeps = open.map((tag) => browser.keepForPerson(tag));
|
|
520
|
+
const letGo = () => { for (const keep of keeps.splice(0))
|
|
521
|
+
keep(); };
|
|
480
522
|
const waited = await hands.wait(callId, open, since);
|
|
481
|
-
|
|
523
|
+
if ("refused" in waited) {
|
|
524
|
+
letGo();
|
|
525
|
+
return undefined;
|
|
526
|
+
}
|
|
527
|
+
return { lapsed: waited.lapsed, confirmed: waited.confirmed, drop: () => { waited.drop(); letGo(); } };
|
|
482
528
|
});
|
|
483
529
|
host.beforeRelease(async (harness) => {
|
|
484
530
|
try {
|
|
@@ -501,6 +547,10 @@ const browserTool = {
|
|
|
501
547
|
await view.close();
|
|
502
548
|
hands.close();
|
|
503
549
|
await viewers.released();
|
|
550
|
+
// The download sockets this run's sessions hold go with it, released or left to the next claim (whose attach
|
|
551
|
+
// opens its own): one left open would keep the process from exiting.
|
|
552
|
+
if ("browser" in made)
|
|
553
|
+
await closeHeldSockets(made.browser);
|
|
504
554
|
}
|
|
505
555
|
});
|
|
506
556
|
return { tools, extensions: [extension] };
|
|
@@ -528,14 +578,23 @@ export const TOOLS = Object.freeze({
|
|
|
528
578
|
summary: "Search the web: codex's own search (claude-agent's where it is picked), on pi the model provider's hosted search (Anthropic, OpenAI), with none of those Parallel's Search API where the server holds its key, else Exa's keyless search; or the provider picked: { query, n? } -> { provider, query, 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.",
|
|
529
579
|
needs: [],
|
|
530
580
|
nodes: true,
|
|
531
|
-
|
|
532
|
-
|
|
581
|
+
// On the runner its hosted search goes through the run's own route (host.search, run.search), labelled web_search.
|
|
582
|
+
bind: async (host) => installTool(host, "web-search", booking(webSearchTool(host.env, host.search))),
|
|
583
|
+
effect: async (args, run) => bookedIn(run.ledger, () => searchFor(run.env, args, run.signal, run.search)),
|
|
533
584
|
},
|
|
534
585
|
browser: browserTool,
|
|
535
586
|
// monid's catalog on one key (monid.ts): every harness calls each by its wire name, `monid_discover` and the rest.
|
|
536
587
|
"monid.discover": monidTool("discover"),
|
|
537
588
|
"monid.inspect": monidTool("inspect"),
|
|
538
589
|
"monid.run": monidTool("run"),
|
|
590
|
+
// A pi run's subagent (runner/subagent.ts): a native tool of the run's root agent, bound by the runner's pi spec
|
|
591
|
+
// (adapter-run-spec.ts), never by this table; not a host tool (host-tools.ts REPLAY), so another harness refuses it.
|
|
592
|
+
subagent: {
|
|
593
|
+
summary: "Run a subagent: a fresh conversation with only the call's prompt, on the agent's own model (or one of its model tiers, fast or strong, when the call names one), with a subset of the agent's own tools (bash among them, under the agent's bash policy), under the run's permissions and cap; answers with its final text. A call may narrow its child's tool-call budget (max_tool_calls) and set its effort (low, medium, high). Several calls in a turn run at once, at most 4 at a time; a subagent starts none of its own. pi only.",
|
|
594
|
+
needs: [],
|
|
595
|
+
nodes: false,
|
|
596
|
+
bind: async () => ({ tools: [], extensions: [] }),
|
|
597
|
+
},
|
|
539
598
|
[PDF_PAGES_TOOL]: callOnly("A workflow call: { path, maxPages?, dpi? } -> { name, pageCount, dpi, pages: [{ page, image }], text }; the document's first pages drawn as PNGs under work/pages/<stem>/<dpi>/ (the dpi lowered so a page's long side is at most 1568 px), from the server's documents (--documents) or the run's work directory.", (args, run) => pdfPages(args, { work: localWorkspace(run.work), documents: run.env[DOCUMENTS_ENV], signal: run.signal })),
|
|
540
599
|
[LLM_TOOL]: callOnly("A workflow call: { prompt, system?, maxTokens?, tier? } -> { text, model, usage, cost_usd }; one completion on the model of the tier (default), no tools and no loop.", (args, run) => {
|
|
541
600
|
if (!run.complete)
|
|
@@ -635,22 +694,6 @@ export async function toolingOf(revision) {
|
|
|
635
694
|
}
|
|
636
695
|
/** The variables `entry` needs that `env` does not set, by name. */
|
|
637
696
|
export const missingEnv = (entry, env) => entry.needs.filter((name) => !env[name]);
|
|
638
|
-
/** What keeps `names` from being bound here: names outside the table (or, for a workflow's model nodes, that a node may
|
|
639
|
-
* not name), and the variables each tool in it needs that `env` does not set. Undefined when nothing does. */
|
|
640
|
-
export function toolRefusal(names, env, where = "agent") {
|
|
641
|
-
const allowed = where === "nodes" ? NODE_TOOLS : where === "calls" ? CALL_TOOLS : BOUND_TOOLS;
|
|
642
|
-
const unbound = names.filter((name) => !allows(allowed, name));
|
|
643
|
-
if (unbound.length) {
|
|
644
|
-
const said = { agent: "agentrun-serve binds the tools", nodes: "A workflow's model nodes get the tools", calls: "A workflow's call nodes run the tools" }[where];
|
|
645
|
-
return { message: `${said} ${allowed.join(", ")}; this ${where === "agent" ? "revision" : "workflow"} also ${where === "calls" ? "calls" : "names"} ${unbound.join(", ")}.`, unbound, missing: {} };
|
|
646
|
-
}
|
|
647
|
-
const missing = Object.fromEntries(names.map((name) => [name, missingEnv(toolOf(name), env)]).filter(([, vars]) => vars.length));
|
|
648
|
-
const lacking = Object.entries(missing);
|
|
649
|
-
if (!lacking.length)
|
|
650
|
-
return undefined;
|
|
651
|
-
const said = lacking.map(([name, vars]) => `The tool ${name} needs ${keyNeeded(vars)}.`).join(" ");
|
|
652
|
-
return { message: `This server holds no key for what the revision's tools need. ${said}`, unbound: [], missing };
|
|
653
|
-
}
|
|
654
697
|
/** Every tool as capabilities show it, the server's one tool catalog: available here, or the variables it is missing
|
|
655
698
|
* (names only), and the harnesses that run it (another harness than pi runs only the host tools, host-tools.ts). A tool
|
|
656
699
|
* a user picks a provider for (tool-plane.ts) gives the providers offered, the server's (`provider`, the default where it
|
|
@@ -28,6 +28,10 @@ export type TriggerAdapter = {
|
|
|
28
28
|
/** What it keeps sealed (sealed-settings-store.ts), for the server or for each trigger: a field it mints (a signing secret)
|
|
29
29
|
* is made at a trigger's create and at a rotation, shown once, and goes with the trigger. */
|
|
30
30
|
settings?: SettingsSpec;
|
|
31
|
+
/** Whether a trigger of this source keeps a secret its sender gave (a create's and a rotation's `secret`, Composio's)
|
|
32
|
+
* instead of one this server mints: then the secret is required there, sealed as a minted one is, and never made
|
|
33
|
+
* here. Default: it mints. */
|
|
34
|
+
givesSecret?(source: Source): boolean;
|
|
31
35
|
/** Its shapes as a create's error names them: `{kind: "..."}` with its fields. */
|
|
32
36
|
describe: string;
|
|
33
37
|
/** When it fires, for the OpenAPI document's source description. */
|
|
@@ -14,9 +14,9 @@ export declare const triggerSecretMeta: (id: string, set: boolean, changedAt?: s
|
|
|
14
14
|
* trigger's view. */
|
|
15
15
|
export declare function triggerMade(made: Record<string, unknown>, minted: string | undefined, mayHold: boolean, at: string): Record<string, unknown>;
|
|
16
16
|
/** POST /triggers/{id}/secret's answer (the owner's session alone reaches it): the new value, and its metadata. */
|
|
17
|
-
export declare const triggerRotated: (id: string, minted: string, at: string) => {
|
|
17
|
+
export declare const triggerRotated: (id: string, minted: string | undefined, at: string) => {
|
|
18
|
+
signing_secret?: string | undefined;
|
|
18
19
|
secret: SecretMeta;
|
|
19
|
-
signing_secret: string;
|
|
20
20
|
};
|
|
21
21
|
/** A template's apply answer's warning for its webhook trigger `i`: its secret is in no apply answer (the Idempotency-Key
|
|
22
22
|
* record would keep it), so the person gets it from the console. */
|
|
@@ -30,7 +30,7 @@ export function triggerMade(made, minted, mayHold, at) {
|
|
|
30
30
|
return mayHold ? { ...made, secret, signing_secret: minted } : { ...made, secret, secret_set: true, note: TRIGGER_SECRET_WORDS };
|
|
31
31
|
}
|
|
32
32
|
/** POST /triggers/{id}/secret's answer (the owner's session alone reaches it): the new value, and its metadata. */
|
|
33
|
-
export const triggerRotated = (id, minted, at) => ({ secret: triggerSecretMeta(id, true, at), signing_secret: minted });
|
|
33
|
+
export const triggerRotated = (id, minted, at) => ({ secret: triggerSecretMeta(id, true, at), ...(minted !== undefined ? { signing_secret: minted } : {}) });
|
|
34
34
|
/** A template's apply answer's warning for its webhook trigger `i`: its secret is in no apply answer (the Idempotency-Key
|
|
35
35
|
* record would keep it), so the person gets it from the console. */
|
|
36
36
|
export const templateTriggerSecret = (i) => ({ field: `triggers.${i}.secret`, reason: "not_allowed", message: `This webhook trigger's signing secret is not in an apply answer. ${TRIGGER_SECRET_WORDS}` });
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { headersRefusal
|
|
1
|
+
import { headersRefusal } from "./standard-webhooks.js";
|
|
2
2
|
type Headers = Record<string, string | string[] | undefined>;
|
|
3
3
|
export type Scheme = {
|
|
4
|
-
/** The header its signature comes in: a request that carries it, and no other
|
|
4
|
+
/** The header its signature comes in: a request that carries it, and no other header's, is checked by a scheme that
|
|
5
|
+
* names it; where several do (`composio` shares `webhook-signature` with `standard`) the trigger's own `signature` picks. */
|
|
5
6
|
signatureHeader: string;
|
|
7
|
+
/** Its secret is the sender's own, given at the trigger's create and rotation, never one this server mints. */
|
|
8
|
+
givenSecret?: true;
|
|
6
9
|
/** How a sender signs under it, for the OpenAPI document. */
|
|
7
10
|
describe: string;
|
|
8
11
|
/** Why the headers alone are refused, before a byte of the body is read. */
|
|
@@ -26,7 +29,7 @@ export declare const SIGNATURE_SCHEMES: {
|
|
|
26
29
|
signatureHeader: string;
|
|
27
30
|
describe: string;
|
|
28
31
|
precheck: typeof headersRefusal;
|
|
29
|
-
verify:
|
|
32
|
+
verify: (secret: string, headers: Record<string, string | string[] | undefined>, body: Buffer, nowMs: number) => string | undefined;
|
|
30
33
|
firingKeyOf: (headers: Headers) => string;
|
|
31
34
|
eventOf: (_headers: Headers, json: unknown) => string | undefined;
|
|
32
35
|
};
|
|
@@ -39,17 +42,34 @@ export declare const SIGNATURE_SCHEMES: {
|
|
|
39
42
|
deliveryIdOf: (headers: Headers) => string;
|
|
40
43
|
eventOf: (headers: Headers) => string;
|
|
41
44
|
attrsOf(json: unknown): {
|
|
45
|
+
base_sha?: string | undefined;
|
|
42
46
|
head_sha?: string | undefined;
|
|
43
47
|
number?: string | undefined;
|
|
44
48
|
};
|
|
45
49
|
};
|
|
50
|
+
composio: {
|
|
51
|
+
signatureHeader: string;
|
|
52
|
+
givenSecret: true;
|
|
53
|
+
describe: string;
|
|
54
|
+
precheck: typeof headersRefusal;
|
|
55
|
+
verify: (key: string, headers: Headers, body: Buffer<ArrayBufferLike>, nowMs: number) => string | undefined;
|
|
56
|
+
firingKeyOf: (headers: Headers) => string;
|
|
57
|
+
eventOf(_headers: Headers, json: unknown): string | undefined;
|
|
58
|
+
attrsOf(json: unknown): {
|
|
59
|
+
user_id?: string | undefined;
|
|
60
|
+
trigger_id?: string | undefined;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
46
63
|
};
|
|
47
64
|
export type SchemeName = keyof typeof SIGNATURE_SCHEMES;
|
|
48
65
|
export declare const SCHEME_NAMES: SchemeName[];
|
|
49
66
|
export declare const DEFAULT_SCHEME: SchemeName;
|
|
50
|
-
/** The scheme a request asks for: the one whose signature header it carries.
|
|
51
|
-
*
|
|
52
|
-
|
|
67
|
+
/** The scheme a request asks for: the one whose signature header it carries. Schemes that share a header (`standard` and
|
|
68
|
+
* `composio`) are told apart by the trigger's own (`wanted`, its `signature`): a request is verified under the trigger's
|
|
69
|
+
* scheme, so one signed for the other fails its check as any bad signature does. With no `wanted` (before the trigger is
|
|
70
|
+
* read, where the headers' check is the same for both) the first of them stands in. `refusal` when it carries no
|
|
71
|
+
* signature header, or the headers of more than one. */
|
|
72
|
+
export declare function schemeOf(headers: Headers, wanted?: string): {
|
|
53
73
|
name: SchemeName;
|
|
54
74
|
scheme: Scheme;
|
|
55
75
|
} | {
|
|
@@ -5,10 +5,12 @@
|
|
|
5
5
|
// scheme whose signature header it carries; a trigger's `signature` names the scheme it takes. A new scheme is one entry
|
|
6
6
|
// here: the source's schema and its check read the table's keys.
|
|
7
7
|
import { createHash, createHmac, timingSafeEqual } from "node:crypto";
|
|
8
|
-
import { HOOK_TOLERANCE_S, headersRefusal, HOOK_ID, MIN_KEY_BYTES, verify as verifyStandard } from "./standard-webhooks.js";
|
|
8
|
+
import { HOOK_TOLERANCE_S, headersRefusal, HOOK_ID, MIN_KEY_BYTES, verify as verifyStandard, verifyWithKey } from "./standard-webhooks.js";
|
|
9
9
|
import { isObject } from "./validate.js";
|
|
10
10
|
/** An event's name in a header: printable ASCII with no space (`pull_request`, `ping`). */
|
|
11
11
|
const EVENT = /^[\x21-\x7e]{1,200}$/;
|
|
12
|
+
/** An id a payload's tag may name: short printable ASCII with no space, quote or bracket. */
|
|
13
|
+
const ID_ATTR = /^[A-Za-z0-9_.:@-]{1,100}$/;
|
|
12
14
|
const GITHUB_SIGNATURE = /^sha256=([0-9a-f]{64})$/i;
|
|
13
15
|
const githubHmac = (secret, body) => createHmac("sha256", Buffer.from(secret, "utf8")).update(body).digest();
|
|
14
16
|
function githubPrecheck(headers) {
|
|
@@ -53,27 +55,61 @@ export const SIGNATURE_SCHEMES = {
|
|
|
53
55
|
deliveryIdOf: (headers) => headers["x-github-delivery"],
|
|
54
56
|
eventOf: (headers) => headers["x-github-event"],
|
|
55
57
|
// The pull request or issue's number (an issue_comment on a pull request is its issue's), and a pull request's head
|
|
56
|
-
//
|
|
58
|
+
// and base shas, which a long description pushes past the payload's cut. A comment event has no head: none is guessed.
|
|
57
59
|
attrsOf(json) {
|
|
58
60
|
const doc = isObject(json) ? json : {};
|
|
59
61
|
const pr = isObject(doc.pull_request) ? doc.pull_request : undefined;
|
|
60
62
|
const issue = isObject(doc.issue) ? doc.issue : undefined;
|
|
61
63
|
const number = pr?.number ?? issue?.number;
|
|
62
64
|
const sha = isObject(pr?.head) ? pr.head.sha : undefined;
|
|
65
|
+
const base = isObject(pr?.base) ? pr.base.sha : undefined;
|
|
63
66
|
return {
|
|
64
67
|
...(Number.isSafeInteger(number) && number > 0 ? { number: String(number) } : {}),
|
|
65
68
|
...(typeof sha === "string" && /^[0-9a-f]{40}$/.test(sha) ? { head_sha: sha } : {}),
|
|
69
|
+
...(typeof base === "string" && /^[0-9a-f]{40}$/.test(base) ? { base_sha: base } : {}),
|
|
66
70
|
};
|
|
67
71
|
},
|
|
68
72
|
},
|
|
73
|
+
// Composio's (docs.composio.dev webhooks, @composio/core's verifyWebhook): the Standard Webhooks headers and message
|
|
74
|
+
// ("{id}.{timestamp}.{body}", `v1,<base64 HMAC-SHA256>`), but keyed by the UTF-8 bytes of the whole secret string
|
|
75
|
+
// Composio minted, not by a base64-decoded `whsec_` key. Every trigger of its project comes to the one webhook URL, so
|
|
76
|
+
// the event is the body's metadata.trigger_slug, and `where` reads the trigger's own data under /data.
|
|
77
|
+
composio: {
|
|
78
|
+
signatureHeader: "webhook-signature",
|
|
79
|
+
givenSecret: true,
|
|
80
|
+
describe: `\`composio\` takes a Composio trigger's delivery (the webhook subscription whose URL is the trigger's hook_url): the Standard Webhooks headers and message, \`v1,<base64 HMAC-SHA256 of "{webhook-id}.{webhook-timestamp}.{body}">\`, keyed by the UTF-8 bytes of the whole secret string Composio gave the subscription (make the trigger first, register its hook_url as Composio's webhook subscription, then \`POST /v2/triggers/{id}/secret\` with \`{secret}\`; until then every request is refused, and this server never makes one), with the same ${HOOK_TOLERANCE_S} s window and firing key (\`webhook-id\`). Its event is the body's \`metadata.trigger_slug\` (\`GITHUB_ISSUE_ADDED_EVENT\`), else its top-level \`type\` (the subscription's account events, \`composio.connected_account.expired\`), and \`where\` pointers read the payload under \`/data\`.`,
|
|
81
|
+
precheck: headersRefusal,
|
|
82
|
+
verify: (key, headers, body, nowMs) => verifyWithKey(Buffer.from(key, "utf8"), headers, body, nowMs),
|
|
83
|
+
firingKeyOf: (headers) => headers["webhook-id"],
|
|
84
|
+
// A trigger message names its slug; the subscription's account events (composio.connected_account.expired) have no
|
|
85
|
+
// metadata, so their event is the body's own type.
|
|
86
|
+
eventOf(_headers, json) {
|
|
87
|
+
if (!isObject(json))
|
|
88
|
+
return undefined;
|
|
89
|
+
if (isObject(json.metadata) && typeof json.metadata.trigger_slug === "string")
|
|
90
|
+
return json.metadata.trigger_slug;
|
|
91
|
+
return typeof json.type === "string" ? json.type : undefined;
|
|
92
|
+
},
|
|
93
|
+
attrsOf(json) {
|
|
94
|
+
const meta = isObject(json) && isObject(json.metadata) ? json.metadata : {};
|
|
95
|
+
const short = (value) => (typeof value === "string" && ID_ATTR.test(value) ? value : undefined);
|
|
96
|
+
const [triggerId, userId] = [short(meta.trigger_id), short(meta.user_id)];
|
|
97
|
+
return { ...(triggerId ? { trigger_id: triggerId } : {}), ...(userId ? { user_id: userId } : {}) };
|
|
98
|
+
},
|
|
99
|
+
},
|
|
69
100
|
};
|
|
70
101
|
export const SCHEME_NAMES = Object.keys(SIGNATURE_SCHEMES);
|
|
71
102
|
export const DEFAULT_SCHEME = "standard";
|
|
72
|
-
/** The scheme a request asks for: the one whose signature header it carries.
|
|
73
|
-
*
|
|
74
|
-
|
|
103
|
+
/** The scheme a request asks for: the one whose signature header it carries. Schemes that share a header (`standard` and
|
|
104
|
+
* `composio`) are told apart by the trigger's own (`wanted`, its `signature`): a request is verified under the trigger's
|
|
105
|
+
* scheme, so one signed for the other fails its check as any bad signature does. With no `wanted` (before the trigger is
|
|
106
|
+
* read, where the headers' check is the same for both) the first of them stands in. `refusal` when it carries no
|
|
107
|
+
* signature header, or the headers of more than one. */
|
|
108
|
+
export function schemeOf(headers, wanted) {
|
|
75
109
|
const carried = SCHEME_NAMES.filter((name) => headers[SIGNATURE_SCHEMES[name].signatureHeader] !== undefined);
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
110
|
+
const byHeader = new Set(carried.map((name) => SIGNATURE_SCHEMES[name].signatureHeader));
|
|
111
|
+
if (byHeader.size !== 1)
|
|
112
|
+
return { refusal: byHeader.size ? "ambiguous_signature" : "missing_headers" };
|
|
113
|
+
const name = carried.find((one) => one === wanted) ?? carried[0];
|
|
114
|
+
return { name, scheme: SIGNATURE_SCHEMES[name] };
|
|
79
115
|
}
|
|
@@ -8,6 +8,8 @@ import type { RunTrigger, Target } from "./triggers.js";
|
|
|
8
8
|
/** What the trigger target policy needs that lives elsewhere: the run-start leaves (StartDeps, shared with the create
|
|
9
9
|
* route), the agent reads, and the run view that gives a run's live moment and its v2 status. */
|
|
10
10
|
export interface TriggerTargetDeps {
|
|
11
|
+
/** A test's seam (ServeOptions.beforeSubmit): awaited by a firing's message after its checks, before its row is written. */
|
|
12
|
+
readonly beforeSubmit?: (runId: string, content: string) => Promise<void> | void;
|
|
11
13
|
/** The run-start leaves, shared with the create route (runs-over-store.StartDeps). */
|
|
12
14
|
readonly start: StartDeps;
|
|
13
15
|
/** The agent an id names, with its current revision; undefined when unknown (the agent store's getAgent). */
|
package/dist/trigger-targets.js
CHANGED
|
@@ -96,6 +96,7 @@ export function triggerTargets(store, deps) {
|
|
|
96
96
|
answers: false,
|
|
97
97
|
origin: from,
|
|
98
98
|
requestId: key,
|
|
99
|
+
...(deps.beforeSubmit ? { beforeSubmit: deps.beforeSubmit } : {}),
|
|
99
100
|
queue: async (command) => {
|
|
100
101
|
const done = await store.triggers.message({ triggerId, key }, run.id, command, bound);
|
|
101
102
|
return done && "skipped" in done ? { skipped: done.skipped } : undefined;
|
package/dist/trigger-webhook.js
CHANGED
|
@@ -12,6 +12,8 @@ import { isObject } from "./validate.js";
|
|
|
12
12
|
const ATTR_CHARS = 200;
|
|
13
13
|
/** The scheme a trigger's source takes. */
|
|
14
14
|
const schemeName = (source) => (typeof source.signature === "string" ? source.signature : DEFAULT_SCHEME);
|
|
15
|
+
/** Whether a source's secret is the sender's own (Composio's): given, not minted. */
|
|
16
|
+
const givesSecret = (source) => SIGNATURE_SCHEMES[schemeName(source)]?.givenSecret === true;
|
|
15
17
|
/** The source's own fields, checked: each issue through `bad`. Undefined when one does not read. */
|
|
16
18
|
function fieldsOf(value, bad) {
|
|
17
19
|
let failed = false;
|
|
@@ -38,6 +40,7 @@ export const webhook = {
|
|
|
38
40
|
delivery: "push",
|
|
39
41
|
owner: false,
|
|
40
42
|
settings: { scope: "trigger", fields: { secret: { mint: true, minBytes: MIN_KEY_BYTES } } },
|
|
43
|
+
givesSecret,
|
|
41
44
|
describe: `{kind: "webhook", signature?: ${SCHEME_NAMES.map((name) => `"${name}"`).join(" | ")}, accept?: [{event, actions?, where?}]}`,
|
|
42
45
|
fires: "a signed request to /hooks/{trigger_id} (`webhook`) that its `accept` takes",
|
|
43
46
|
firedBy: "`webhook`: a signed request to /hooks/{trigger_id}, its key from the trigger and what the request's signature covers: its `webhook-id` (`standard`), or the SHA-256 of its body (`github`).",
|
|
@@ -61,7 +64,7 @@ export const webhook = {
|
|
|
61
64
|
return "refusal" in asked ? asked.refusal : asked.scheme.precheck(headers, nowMs);
|
|
62
65
|
},
|
|
63
66
|
verify(key, headers, body, nowMs, source) {
|
|
64
|
-
const asked = schemeOf(headers);
|
|
67
|
+
const asked = schemeOf(headers, source && schemeName(source));
|
|
65
68
|
if ("refusal" in asked)
|
|
66
69
|
return asked.refusal;
|
|
67
70
|
const refusal = asked.scheme.verify(key, headers, body, nowMs);
|
|
@@ -71,7 +74,7 @@ export const webhook = {
|
|
|
71
74
|
// The request is the firing: its scheme's firing key keys it, and its body, whatever it holds, is what the run is
|
|
72
75
|
// given, with its scheme, event, action and unsigned delivery id named on the payload's tag. A trigger with `accept` takes only the events it names.
|
|
73
76
|
parse(headers, body, source) {
|
|
74
|
-
const asked = schemeOf(headers);
|
|
77
|
+
const asked = schemeOf(headers, source && schemeName(source));
|
|
75
78
|
if ("refusal" in asked)
|
|
76
79
|
return [];
|
|
77
80
|
const text = body.toString("utf8");
|