@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/browser-computer.js
CHANGED
|
@@ -1,21 +1,289 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { BrowserFailureError, browserFailure, cdpCall } from "@parcha/pi-browser";
|
|
2
|
+
import { BROWSER_IMAGE, isBrowserProvider, PROVIDERS, providerFor, releaseOlder, runLabels } from "@parcha/agentrun-computer";
|
|
3
|
+
import { KEY_TABLE, providerOptions } from "./computer-keys.js";
|
|
4
|
+
import { claimBrowser } from "./workspace/computer-for-claim.js";
|
|
5
|
+
/** Custody's own refusal of a second saver, in its words: no session was started. */
|
|
6
|
+
const ONE_SAVER = "one session at a time may save to this agent's saved sign-in, and another session is saving to it now. Wait for it to end, or start without saving. No session was started.";
|
|
7
|
+
const STILL_ENDING = "the session that was saving to this agent's saved sign-in is still ending. Try again in a moment. No session was started.";
|
|
8
|
+
const SAVER_WAIT_MS = 20_000;
|
|
9
|
+
/** A failure custody reads: the provider's words, and a status where the code is one custody tells apart. */
|
|
10
|
+
function withStatus(error) {
|
|
11
|
+
const code = error?.code;
|
|
12
|
+
const status = code === "denied" ? 403 : code === "not_found" ? 404 : code === "limit" ? 429 : undefined;
|
|
13
|
+
return status === undefined || typeof error !== "object" || error === null ? error : Object.assign(error, { status });
|
|
14
|
+
}
|
|
15
|
+
const statused = async (work) => {
|
|
16
|
+
try {
|
|
17
|
+
return await work;
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
throw withStatus(error);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const goneCode = (error) => {
|
|
24
|
+
const code = error?.code;
|
|
25
|
+
return code === "gone" || code === "not_found";
|
|
26
|
+
};
|
|
27
|
+
/** What a session holds in this process, by provider and session id: its download-behaviour socket. */
|
|
28
|
+
const sockets = new Map();
|
|
29
|
+
const opening = new Map();
|
|
30
|
+
/** The sockets each run's browser (the ClaimBrowser its provider is over) opened, by the same keys: let go with the run. */
|
|
31
|
+
const heldBy = new WeakMap();
|
|
32
|
+
const savers = new Map();
|
|
33
|
+
const freeSaver = (tag) => {
|
|
34
|
+
for (const [key, held] of savers)
|
|
35
|
+
if (held.tag === tag)
|
|
36
|
+
savers.delete(key);
|
|
37
|
+
};
|
|
38
|
+
const isSaver = (tag) => [...savers.values()].some((held) => held.tag === tag);
|
|
39
|
+
/** True when `work` ends within `ms`; false at the deadline. */
|
|
40
|
+
async function within(work, ms) {
|
|
41
|
+
let timer;
|
|
42
|
+
try {
|
|
43
|
+
return await Promise.race([work.then(() => true), new Promise((resolve) => { timer = setTimeout(() => resolve(false), Math.max(0, ms)); })]);
|
|
44
|
+
}
|
|
45
|
+
finally {
|
|
46
|
+
clearTimeout(timer);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/** The one-saver rule: a holder that no longer runs is replaced once its settle time is waited out; the same tag keeps it;
|
|
50
|
+
* the same owner's successor (a relaunch asks for its replacement while the old session is still being released) waits
|
|
51
|
+
* for the release; any other is refused. */
|
|
52
|
+
async function claimSaver(key, tag, owner, signal, sleep) {
|
|
53
|
+
for (const end = Date.now() + SAVER_WAIT_MS;;) {
|
|
54
|
+
const held = savers.get(key);
|
|
55
|
+
if (!held || held.tag === tag)
|
|
56
|
+
return void savers.set(key, { tag, owner });
|
|
57
|
+
const running = held.running ? await held.running().catch(() => true) : true;
|
|
58
|
+
if (running) {
|
|
59
|
+
if (held.owner !== owner)
|
|
60
|
+
throw new BrowserFailureError(browserFailure("refused", `browser profile: ${ONE_SAVER}`));
|
|
61
|
+
if (Date.now() > end)
|
|
62
|
+
throw new BrowserFailureError(browserFailure("refused", `browser profile: ${STILL_ENDING}`));
|
|
63
|
+
signal?.throwIfAborted();
|
|
64
|
+
await sleep(100);
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
if (held.settle && !(await within(held.settle(), end - Date.now())))
|
|
68
|
+
throw new BrowserFailureError(browserFailure("refused", `browser profile: ${STILL_ENDING}`));
|
|
69
|
+
if (savers.get(key) === held)
|
|
70
|
+
savers.delete(key);
|
|
71
|
+
signal?.throwIfAborted();
|
|
72
|
+
await sleep(0);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/** pi-browser's provider over `computer`, a browser computer the claim or the plane opened. */
|
|
76
|
+
export function claimBrowserProvider(computer, options = {}) {
|
|
77
|
+
const features = computer.features;
|
|
78
|
+
const sleep = options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
79
|
+
const held = (id) => `${computer.provider}|${id}`;
|
|
80
|
+
const mine = heldBy.get(computer) ?? new Set();
|
|
81
|
+
heldBy.set(computer, mine);
|
|
82
|
+
const caps = {
|
|
83
|
+
profiles: features.profiles !== undefined && options.signIn !== undefined,
|
|
84
|
+
// What a session is created with that its record may say: Verified where the provider offers stealth; no proxy,
|
|
85
|
+
// place, region or context by id (serve's policy asks none).
|
|
86
|
+
settings: { proxies: false, verified: features.stealth === true, geolocation: false, region: false, context: false },
|
|
87
|
+
};
|
|
88
|
+
const status = async (ref, signal) => ((await statused(computer.running(ref.id, signal))) ? "running" : "gone");
|
|
89
|
+
const running = (ref) => async () => (await status(ref, AbortSignal.timeout(2_000))) === "running";
|
|
90
|
+
const settle = features.profiles?.settleMs ? () => sleep(features.profiles.settleMs) : undefined;
|
|
91
|
+
const holdSaver = (ref) => {
|
|
92
|
+
for (const one of savers.values())
|
|
93
|
+
if (one.tag === ref.tag)
|
|
94
|
+
Object.assign(one, { running: running(ref), ...(settle ? { settle } : {}) });
|
|
95
|
+
};
|
|
96
|
+
const endSocket = (id) => {
|
|
97
|
+
sockets.get(held(id))?.close();
|
|
98
|
+
sockets.delete(held(id));
|
|
99
|
+
mine.delete(held(id));
|
|
100
|
+
};
|
|
101
|
+
const provider = {
|
|
8
102
|
name: computer.provider,
|
|
9
|
-
caps
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
103
|
+
caps,
|
|
104
|
+
async create(spec, signal) {
|
|
105
|
+
signal?.throwIfAborted();
|
|
106
|
+
const profile = spec.profile;
|
|
107
|
+
if (profile && (!options.signIn || profile.name !== options.signIn.name || !features.profiles)) {
|
|
108
|
+
throw new BrowserFailureError(browserFailure("refused", `browser profile: this run has no saved sign-in named "${profile.name}" to open. No session was started.`));
|
|
109
|
+
}
|
|
110
|
+
const pointer = profile ? options.signIn.pointer : undefined;
|
|
111
|
+
if (profile?.save && pointer)
|
|
112
|
+
await claimSaver(`${computer.provider}|${pointer}`, spec.tag, `${spec.metadata.run}|${spec.metadata.label}`, signal, sleep);
|
|
113
|
+
const session = {
|
|
114
|
+
viewport: { width: spec.viewport.width, height: spec.viewport.height },
|
|
115
|
+
...(features.stealth && spec.verified ? { stealth: true } : {}),
|
|
116
|
+
...(features.headless && options.headless ? { headless: true } : {}),
|
|
117
|
+
...(pointer ? { profile: { pointer, save: profile.save } } : {}),
|
|
118
|
+
};
|
|
119
|
+
// The vendor ends a session at its lifetime from create (wall-clock) or after that long with no client
|
|
120
|
+
// (inactivity): custody's session timeout for the one, its idle release for the other (the session timeout where
|
|
121
|
+
// idle release is off, 0). Never below the vendor's shortest (Kernel's 10 s), which it would refuse.
|
|
122
|
+
const asked = features.timeout === "inactivity" && spec.idleTimeoutS > 0 ? spec.idleTimeoutS : spec.maxLifetimeS;
|
|
123
|
+
const lifetimeS = Math.max(asked, Math.ceil((features.minLifetimeMs ?? 0) / 1000));
|
|
124
|
+
let id;
|
|
125
|
+
try {
|
|
126
|
+
id = await computer.open(spec.tag, lifetimeS, session, signal);
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
// A refusal made nothing, so no session saves. Any other failure may have left its computer running (the provider
|
|
130
|
+
// looks it up by its create label and releases it, and may fail at that too): the claim stays, held by whether the
|
|
131
|
+
// tag still finds a computer, so the next saver replaces it only once none is left.
|
|
132
|
+
if (error?.code === "denied")
|
|
133
|
+
freeSaver(spec.tag);
|
|
134
|
+
else if (isSaver(spec.tag)) {
|
|
135
|
+
for (const one of savers.values()) {
|
|
136
|
+
if (one.tag === spec.tag)
|
|
137
|
+
Object.assign(one, { running: async () => (await computer.find(spec.tag, AbortSignal.timeout(2_000))).length > 0, ...(settle ? { settle } : {}) });
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
throw withStatus(error);
|
|
141
|
+
}
|
|
142
|
+
const ref = { id, tag: spec.tag };
|
|
143
|
+
if (isSaver(spec.tag))
|
|
144
|
+
holdSaver(ref);
|
|
145
|
+
return ref;
|
|
146
|
+
},
|
|
147
|
+
async findByTag(tag, signal) {
|
|
148
|
+
const found = (await statused(computer.find(tag, signal))).map((id) => ({ id, tag }));
|
|
149
|
+
// No browser left under a saver's tag: one may have just ended (a create whose reply was lost, found and released
|
|
150
|
+
// by the provider), and the vendor may still be writing the profile back, so its settle time is waited out first.
|
|
151
|
+
if (found.length === 0) {
|
|
152
|
+
if (isSaver(tag) && settle)
|
|
153
|
+
await settle();
|
|
154
|
+
freeSaver(tag);
|
|
155
|
+
}
|
|
156
|
+
for (const ref of found)
|
|
157
|
+
if (isSaver(ref.tag))
|
|
158
|
+
holdSaver(ref);
|
|
159
|
+
return found;
|
|
160
|
+
},
|
|
161
|
+
status,
|
|
162
|
+
async attach(ref, signal) {
|
|
163
|
+
signal?.throwIfAborted();
|
|
164
|
+
const url = rewriteConnectUrl(await statused(computer.url(ref.id)), options.connectBaseUrl);
|
|
165
|
+
// A provider that keeps a session's downloads keeps only what the browser was told to save into its folder, and
|
|
166
|
+
// that lasts as long as the socket that told it: one per session, held until its release. A failure costs the
|
|
167
|
+
// files, not the session.
|
|
168
|
+
const downloads = features.downloads;
|
|
169
|
+
if (downloads && computer.downloads && !sockets.get(held(ref.id))?.open) {
|
|
170
|
+
let pending = opening.get(held(ref.id));
|
|
171
|
+
if (!pending) {
|
|
172
|
+
pending = (async () => {
|
|
173
|
+
const socket = await cdpCall(url, "Browser.setDownloadBehavior", { behavior: "allow", downloadPath: downloads.path, eventsEnabled: true }).catch(() => undefined);
|
|
174
|
+
if (socket) {
|
|
175
|
+
sockets.set(held(ref.id), socket);
|
|
176
|
+
mine.add(held(ref.id));
|
|
177
|
+
}
|
|
178
|
+
})().finally(() => opening.delete(held(ref.id)));
|
|
179
|
+
opening.set(held(ref.id), pending);
|
|
180
|
+
}
|
|
181
|
+
await pending;
|
|
182
|
+
}
|
|
183
|
+
return { sdkCdpUrl: url };
|
|
184
|
+
},
|
|
185
|
+
// The protocol's release takes no signal: a release is never cut short, so no session is left billing.
|
|
186
|
+
async release(ref) {
|
|
187
|
+
await opening.get(held(ref.id));
|
|
188
|
+
endSocket(ref.id);
|
|
189
|
+
try {
|
|
190
|
+
await computer.close(ref.id);
|
|
191
|
+
}
|
|
192
|
+
catch (error) {
|
|
193
|
+
// Already gone is released.
|
|
194
|
+
if (!goneCode(error))
|
|
195
|
+
throw withStatus(error);
|
|
196
|
+
}
|
|
197
|
+
if (isSaver(ref.tag) && settle)
|
|
198
|
+
await settle();
|
|
199
|
+
freeSaver(ref.tag);
|
|
200
|
+
},
|
|
20
201
|
};
|
|
202
|
+
const kept = computer.downloads;
|
|
203
|
+
if (kept) {
|
|
204
|
+
provider.downloads = {
|
|
205
|
+
async list(ref) {
|
|
206
|
+
return (await statused(kept.list(ref.id))).map((file) => ({ name: file.name, sizeBytes: file.sizeBytes, modifiedAt: file.modifiedAt }));
|
|
207
|
+
},
|
|
208
|
+
read: (ref, name, maxBytes) => statused(kept.read(ref.id, name, maxBytes)),
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
return provider;
|
|
212
|
+
}
|
|
213
|
+
/** The plane's vendor as a computer provider of the registry, made with the run's tool keys by the registry's names
|
|
214
|
+
* (computer-keys.ts providerOptions): the same provider an agent's browser computer is, on the keys the tool plane
|
|
215
|
+
* resolved it by. */
|
|
216
|
+
export async function planeComputer(vendor, env) {
|
|
217
|
+
const keys = Object.fromEntries((KEY_TABLE.keys[vendor] ?? []).flatMap((key) => (typeof env[key.name] === "string" && env[key.name] !== "" ? [[key.name, env[key.name]]] : [])));
|
|
218
|
+
const options = providerOptions(vendor, keys);
|
|
219
|
+
if (!options.ok)
|
|
220
|
+
throw new BrowserFailureError(browserFailure("browser_unavailable", `The browser does not run here: ${options.error.message}.`));
|
|
221
|
+
// The server's own variables the provider's descriptor says it reads (hostEnv: the gateway a server behind one reaches
|
|
222
|
+
// the vendor through), as the claim's providers get them (workspace/computer-deps.ts): the key checks and the sign-in
|
|
223
|
+
// creation already go through that gateway, so the browser's sessions do too.
|
|
224
|
+
const names = PROVIDERS.find((one) => one.id === vendor)?.hostEnv;
|
|
225
|
+
const hostEnv = names ? { env: Object.fromEntries(names.flatMap((name) => (env[name] === undefined ? [] : [[name, String(env[name])]]))) } : {};
|
|
226
|
+
return providerFor(vendor, { ...options.options, ...hostEnv });
|
|
227
|
+
}
|
|
228
|
+
/** The run's browser sessions of a lower claim epoch released, as a computer's are when a claim starts it (the janitor's
|
|
229
|
+
* releaseOlder): a runner that died after the vendor made a session and before its id was kept left one this claim's
|
|
230
|
+
* labels would never find. One that ended may have been saving to the run's sign-in, and this process holds no saver
|
|
231
|
+
* for it, so when any was ended the provider's settle time is waited out before the plane's browser opens a session. */
|
|
232
|
+
export async function releaseOlderBrowsers(provider, run, { signal, sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)) } = {}) {
|
|
233
|
+
const older = await releaseOlder(provider, run.runId, run.epoch, signal ? { signal } : {});
|
|
234
|
+
if (!older.ok)
|
|
235
|
+
throw new BrowserFailureError(browserFailure("browser_unavailable", `The browser does not run here: ${older.error.message}.`));
|
|
236
|
+
const settleMs = provider.capabilities().browser?.profiles?.settleMs ?? 0;
|
|
237
|
+
if (settleMs > 0 && older.value.released.length + older.value.detached.length > 0)
|
|
238
|
+
await sleep(settleMs);
|
|
239
|
+
}
|
|
240
|
+
/** A Browserbase connect URL moved onto the credential proxy that fronts its sockets: only `*.browserbase.com` hosts, with
|
|
241
|
+
* the signing query kept. */
|
|
242
|
+
export function rewriteConnectUrl(connectUrl, connectBaseUrl) {
|
|
243
|
+
if (!connectBaseUrl)
|
|
244
|
+
return connectUrl;
|
|
245
|
+
try {
|
|
246
|
+
const target = new URL(connectBaseUrl);
|
|
247
|
+
const url = new URL(connectUrl);
|
|
248
|
+
if (!/(?:^|\.)browserbase\.com$/i.test(url.hostname))
|
|
249
|
+
return connectUrl;
|
|
250
|
+
url.protocol = target.protocol;
|
|
251
|
+
url.host = target.host;
|
|
252
|
+
url.pathname = target.pathname.replace(/\/$/, "") + url.pathname;
|
|
253
|
+
return url.toString();
|
|
254
|
+
}
|
|
255
|
+
catch {
|
|
256
|
+
return connectUrl;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
/** A run's browser over `provider`, a browser computer provider (the plane's vendor, or a test's stand-in), as the claim
|
|
260
|
+
* opens an agent's browser computer: each session made under the run's labels (`run`, when the run holds a claim, so a
|
|
261
|
+
* sweep finds what it left), for at most the provider's longest lifetime. A provider of another kind is refused. */
|
|
262
|
+
export function planeBrowser(provider, run) {
|
|
263
|
+
if (!isBrowserProvider(provider))
|
|
264
|
+
throw new BrowserFailureError(browserFailure("browser_unavailable", `The browser does not run here: the ${provider.id} provider gives no browser.`));
|
|
265
|
+
const spec = { image: BROWSER_IMAGE, lifetimeMs: provider.capabilities().maxLifetimeMs, network: "open", labels: run ? runLabels(run.runId, run.epoch) : {} };
|
|
266
|
+
return claimBrowser(provider, spec).browser;
|
|
267
|
+
}
|
|
268
|
+
/** When the run's process lets the run go: closes the download sockets its browser's sessions hold, released or not (a
|
|
269
|
+
* runner that closes leaves a session to the next claim, whose attach opens its own). An open socket would keep the
|
|
270
|
+
* process from exiting. A socket still opening is closed once it opens. */
|
|
271
|
+
export async function closeHeldSockets(computer) {
|
|
272
|
+
const mine = heldBy.get(computer);
|
|
273
|
+
if (!mine)
|
|
274
|
+
return;
|
|
275
|
+
await Promise.all([...opening.keys()].filter((key) => key.startsWith(`${computer.provider}|`)).map((key) => opening.get(key)));
|
|
276
|
+
for (const key of mine) {
|
|
277
|
+
sockets.get(key)?.close();
|
|
278
|
+
sockets.delete(key);
|
|
279
|
+
}
|
|
280
|
+
mine.clear();
|
|
281
|
+
}
|
|
282
|
+
/** Tests only: forgets every session's socket and saver this process holds. */
|
|
283
|
+
export function resetBrowserComputerHoldings() {
|
|
284
|
+
for (const socket of sockets.values())
|
|
285
|
+
socket.close();
|
|
286
|
+
sockets.clear();
|
|
287
|
+
opening.clear();
|
|
288
|
+
savers.clear();
|
|
21
289
|
}
|
package/dist/browser-cost.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Context } from "@earendil-works/chord";
|
|
1
|
+
import type { Context } from "@earendil-works/chord/context";
|
|
2
2
|
import type { Refusal } from "@parcha/agentrun-kernel";
|
|
3
3
|
import { type Harness, type Conversation, type Session, type ToolRegistration, type Tx } from "@earendil-works/pi-durable";
|
|
4
4
|
import type { SessionCharge } from "@parcha/pi-browser";
|
package/dist/browser-live.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type IncomingMessage, type ServerResponse } from "node:http";
|
|
2
2
|
import type { Duplex } from "node:stream";
|
|
3
|
+
import { type LiveReach } from "./live-reach.js";
|
|
3
4
|
import type { Claim, Store, ViewerKind } from "./store/store.js";
|
|
4
5
|
/** What the run's process hands the server for one session's viewer; `at`, when (the newest is the one shown). `kind`, the
|
|
5
6
|
* computer it views, as the store's row says it. */
|
|
@@ -10,10 +11,11 @@ export type LiveHandover = {
|
|
|
10
11
|
tag: string;
|
|
11
12
|
at?: number;
|
|
12
13
|
kind?: ViewerKind;
|
|
14
|
+
host?: string;
|
|
13
15
|
};
|
|
14
16
|
/** The viewer `fullscreen` URL pi-browser's live view gives (an http URL on the loopback address, /v/<id>#t=<token>) for session `tag`, as
|
|
15
17
|
* a hand-over; undefined for any other shape (a vendor's own URL never is one). */
|
|
16
|
-
export declare function handoverOf(fullscreen: string, tag: string): LiveHandover | undefined;
|
|
18
|
+
export declare function handoverOf(fullscreen: string, tag: string, liveHost?: string): LiveHandover | undefined;
|
|
17
19
|
/** The store's live viewers (store.liveViewers: put and drop under the runner's claim, of() for the server) carry the
|
|
18
20
|
* hand-over across processes, once serve and the runner share only the store. The token is never plaintext there: the
|
|
19
21
|
* runner seals it under the seal key it holds, and the server opens it for the owner's answer alone. */
|
|
@@ -41,8 +43,14 @@ export declare const familyReaches: (family: LiveFamily, handover: LiveHandover)
|
|
|
41
43
|
* the fragment. */
|
|
42
44
|
export declare const viewerLink: (runId: string, handover: LiveHandover, family?: LiveFamily) => string;
|
|
43
45
|
/** The run's viewer answers at its port for this session: its page is there (200), not released (404). Bounded: a dead
|
|
44
|
-
* process's port answers nothing, or another listener's 404.
|
|
45
|
-
|
|
46
|
+
* process's port answers nothing, or another listener's 404. A viewer on a runner on another host (its row's host) is
|
|
47
|
+
* asked only when `reach` counts that host among this server's runners', with the proxy's proof; else it does not
|
|
48
|
+
* answer, and nothing is dialled (live-reach.ts). */
|
|
49
|
+
export declare function viewerAnswers(handover: LiveHandover, reach?: LiveReach, ms?: number): Promise<boolean>;
|
|
50
|
+
/** The newest viewer of run `runId` its runner put over the store whose port answers (`answers`, viewerAnswers), among the
|
|
51
|
+
* kinds `family`'s address reaches (familyReaches: every kind under the computer family, a browser's alone under the
|
|
52
|
+
* browser's); undefined when none does. */
|
|
53
|
+
export declare function answeringViewer(store: LiveViewerStore, sealKey: Buffer, runId: string, answers: (handover: LiveHandover) => Promise<boolean>, family?: LiveFamily): Promise<LiveHandover | undefined>;
|
|
46
54
|
/** The owner's link to run `runId`'s viewer as the server reads it over the store, under the browser's own address
|
|
47
55
|
* (/browser/live): the newest its runner put whose port answers (`answers`, viewerAnswers), as `{ viewer }`; undefined
|
|
48
56
|
* when none does. What run-reads-over-store's runBrowserState takes as its `liveViewer` dep. */
|
|
@@ -65,8 +73,8 @@ export type ViewerSeam = {
|
|
|
65
73
|
* else: with no seam no viewer is handed over, and nothing is written (never a file in the run's folder, the agent's
|
|
66
74
|
* workspace). `changed`: a session launched (its viewer put) or released (its own hand-over dropped, never another's);
|
|
67
75
|
* `reopened`: a kept session's viewer opened again after a restart; `released`: the run let its sessions go, every
|
|
68
|
-
* hand-over of it dropped. */
|
|
69
|
-
export declare function sessionHandovers(seam: ViewerSeam | undefined): {
|
|
76
|
+
* hand-over of it dropped. `liveHost`: the runner's live host, when it is on another host than its server. */
|
|
77
|
+
export declare function sessionHandovers(seam: ViewerSeam | undefined, liveHost?: string): {
|
|
70
78
|
changed: (row: {
|
|
71
79
|
session: {
|
|
72
80
|
tag: string;
|
|
@@ -87,7 +95,9 @@ export declare const liveRest: (rest: string) => boolean;
|
|
|
87
95
|
* id, the viewer's files while the run has one open (its newest); undefined at any other address, or with none open (the
|
|
88
96
|
* route's 404). The WebSocket's upgrade reads liveViewerById with the id in its path. */
|
|
89
97
|
export declare function liveViewerFor(store: LiveViewerStore, sealKey: Buffer, runId: string, rest: string): Promise<LiveHandover | undefined>;
|
|
90
|
-
|
|
98
|
+
/** `page`: whose page a viewer's path ("/v/<id>") serves, the browser's (pi-browser's viewer) or a desktop's or phone's
|
|
99
|
+
* (computer-viewer.ts); each page's two files are under names of their own. */
|
|
100
|
+
export declare function serveViewerFile(req: IncomingMessage, res: ServerResponse, rest: string, page?: "browser" | "computer"): Promise<void>;
|
|
91
101
|
/** How often an open viewer's session is checked again. A reset-password run in another process and a cookie past its end
|
|
92
102
|
* are seen by no call in this one, so a viewer they end closes within this. */
|
|
93
103
|
export declare const LIVE_RECHECK_MS = 2000;
|
|
@@ -107,5 +117,7 @@ export declare class OpenViewers {
|
|
|
107
117
|
/** The viewer's WebSocket to the run's port: the request line and the handshake's own headers, the Host and Origin the
|
|
108
118
|
* run's viewer takes (its own), and nothing else of the owner's (no cookie); then both ways, unread. */
|
|
109
119
|
/** Once piping starts, the viewer's socket carries the run's WebSocket stream: nothing is ever written into it after that,
|
|
110
|
-
* an error only ends it. `onPiping` hears when that starts (the server's own failure handling then destroys, never writes).
|
|
111
|
-
|
|
120
|
+
* an error only ends it. `onPiping` hears when that starts (the server's own failure handling then destroys, never writes).
|
|
121
|
+
* A viewer on a runner on another host is dialled only when `reach` counts that host among this server's runners', with
|
|
122
|
+
* the proxy's proof; else the answer is 404 and nothing is dialled (live-reach.ts). */
|
|
123
|
+
export declare function proxyLiveUpgrade(req: IncomingMessage, socket: Duplex, head: Buffer, handover: LiveHandover, rest: string, onPiping?: () => void, reach?: LiveReach): void;
|
package/dist/browser-live.js
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
// context, a home, an export or an archive: only its sealed row and the owner's answer hold it.
|
|
17
17
|
import { request as httpRequest } from "node:http";
|
|
18
18
|
import { connect } from "node:net";
|
|
19
|
+
import { dialHost, isLiveHost, LIVE_PROOF_HEADER, liveProof } from "./live-reach.js";
|
|
19
20
|
import { sealColumn, sealedAt, unsealColumn } from "./store/seal.js";
|
|
20
21
|
/** The computer kinds a store row may name. */
|
|
21
22
|
const VIEWER_KINDS = ["browser", "desktop", "phone"];
|
|
@@ -27,7 +28,7 @@ const TOKEN = /^[A-Za-z0-9_-]{43}$/;
|
|
|
27
28
|
const TAG = /^[A-Za-z0-9._:-]{1,200}$/;
|
|
28
29
|
/** The viewer `fullscreen` URL pi-browser's live view gives (an http URL on the loopback address, /v/<id>#t=<token>) for session `tag`, as
|
|
29
30
|
* a hand-over; undefined for any other shape (a vendor's own URL never is one). */
|
|
30
|
-
export function handoverOf(fullscreen, tag) {
|
|
31
|
+
export function handoverOf(fullscreen, tag, liveHost) {
|
|
31
32
|
let url;
|
|
32
33
|
try {
|
|
33
34
|
url = new URL(fullscreen);
|
|
@@ -38,19 +39,21 @@ export function handoverOf(fullscreen, tag) {
|
|
|
38
39
|
const id = /^\/v\/([^/]+)$/.exec(url.pathname)?.[1];
|
|
39
40
|
const token = new URLSearchParams(url.hash.slice(1)).get("t") ?? "";
|
|
40
41
|
const port = Number(url.port);
|
|
41
|
-
|
|
42
|
+
// Loopback, or the runner's own live host when it is on another host than its server (live-reach.ts): no other.
|
|
43
|
+
const remote = liveHost !== undefined && url.hostname === liveHost;
|
|
44
|
+
if (url.protocol !== "http:" || (url.hostname !== LOOPBACK && !remote) || !Number.isInteger(port) || port < 1 || port > 65_535 || !id || !VIEWER_ID.test(id) || !TOKEN.test(token) || !TAG.test(tag))
|
|
42
45
|
return undefined;
|
|
43
|
-
return { port, id, token, tag };
|
|
46
|
+
return { port, id, token, tag, ...(remote ? { host: liveHost } : {}) };
|
|
44
47
|
}
|
|
45
48
|
/** The runner hands session `handover.tag`'s viewer over, under `claim`, its token sealed under `sealKey`: false when the
|
|
46
49
|
* claim is stale and nothing was written. The time is the store's. */
|
|
47
50
|
export async function putLiveViewer(store, sealKey, claim, handover) {
|
|
48
51
|
if (!TAG.test(handover.tag))
|
|
49
52
|
throw new Error("a hand-over's tag is not a session's tag");
|
|
50
|
-
const { tag, port, id, token } = handover;
|
|
53
|
+
const { tag, port, id, token, host } = handover;
|
|
51
54
|
// Every viewer this file hands over is the browser kind: pi-browser's own viewer. Other computer kinds (desktop, phone)
|
|
52
55
|
// get their own hand-over; the store's viewer table carries the kind so the kinds never collide on a shared tag.
|
|
53
|
-
return store.liveViewers.put(claim, { kind: "browser", tag, port, id, sealed: sealColumn(sealKey, sealedAt.liveViewer(claim.runId, "browser", tag), token) });
|
|
56
|
+
return store.liveViewers.put(claim, { kind: "browser", tag, ...(host !== undefined ? { host } : {}), port, id, sealed: sealColumn(sealKey, sealedAt.liveViewer(claim.runId, "browser", tag), token) });
|
|
54
57
|
}
|
|
55
58
|
/** Session `tag`'s hand-over goes, and no other's; with no tag, every one of the run's (its runner let its sessions go). A
|
|
56
59
|
* tag that is not a session's names no row. */
|
|
@@ -65,6 +68,9 @@ export async function dropLiveViewer(store, claim, tag) {
|
|
|
65
68
|
function handoverOfRow(sealKey, runId, row) {
|
|
66
69
|
if (!(typeof row.kind === "string" && VIEWER_KINDS.includes(row.kind) && Number.isInteger(row.port) && row.port > 0 && row.port < 65_536 && VIEWER_ID.test(String(row.id)) && typeof row.tag === "string" && TAG.test(row.tag) && Number.isFinite(row.at) && row.sealed instanceof Uint8Array))
|
|
67
70
|
return undefined;
|
|
71
|
+
// A host that is no host name or address names no viewer.
|
|
72
|
+
if (row.host !== undefined && !isLiveHost(row.host))
|
|
73
|
+
return undefined;
|
|
68
74
|
let token;
|
|
69
75
|
try {
|
|
70
76
|
token = unsealColumn(sealKey, sealedAt.liveViewer(runId, row.kind, row.tag), row.sealed).toString("utf8");
|
|
@@ -72,7 +78,7 @@ function handoverOfRow(sealKey, runId, row) {
|
|
|
72
78
|
catch {
|
|
73
79
|
return undefined;
|
|
74
80
|
}
|
|
75
|
-
return TOKEN.test(token) ? { kind: row.kind, port: row.port, id: row.id, token, tag: row.tag, at: row.at } : undefined;
|
|
81
|
+
return TOKEN.test(token) ? { kind: row.kind, port: row.port, id: row.id, token, tag: row.tag, at: row.at, ...(row.host !== undefined ? { host: row.host } : {}) } : undefined;
|
|
76
82
|
}
|
|
77
83
|
/** Run `runId`'s viewers, of every computer kind, as its live claim handed them over, newest first, each with its kind and
|
|
78
84
|
* its token opened with `sealKey` under that kind; a row that is not a hand-over is left out. */
|
|
@@ -92,10 +98,16 @@ export const familyReaches = (family, handover) => family === "computer" || (han
|
|
|
92
98
|
* the fragment. */
|
|
93
99
|
export const viewerLink = (runId, handover, family = "browser") => `/v2/runs/${encodeURIComponent(runId)}/${family}/live/v/${handover.id}#t=${handover.token}`;
|
|
94
100
|
/** The run's viewer answers at its port for this session: its page is there (200), not released (404). Bounded: a dead
|
|
95
|
-
* process's port answers nothing, or another listener's 404.
|
|
96
|
-
|
|
101
|
+
* process's port answers nothing, or another listener's 404. A viewer on a runner on another host (its row's host) is
|
|
102
|
+
* asked only when `reach` counts that host among this server's runners', with the proxy's proof; else it does not
|
|
103
|
+
* answer, and nothing is dialled (live-reach.ts). */
|
|
104
|
+
export function viewerAnswers(handover, reach, ms = 1_000) {
|
|
105
|
+
const host = dialHost(handover.host, reach);
|
|
106
|
+
if (host === undefined)
|
|
107
|
+
return Promise.resolve(false);
|
|
97
108
|
return new Promise((resolve) => {
|
|
98
|
-
const
|
|
109
|
+
const headers = reach ? { [LIVE_PROOF_HEADER]: liveProof(reach, handover.id) } : {};
|
|
110
|
+
const req = httpRequest({ host, port: handover.port, method: "HEAD", path: `/v/${handover.id}`, timeout: ms, headers }, (res) => {
|
|
99
111
|
res.resume();
|
|
100
112
|
resolve(res.statusCode === 200);
|
|
101
113
|
});
|
|
@@ -104,11 +116,12 @@ export function viewerAnswers(handover, ms = 1_000) {
|
|
|
104
116
|
req.end();
|
|
105
117
|
});
|
|
106
118
|
}
|
|
107
|
-
/** The newest viewer of run `runId` its runner put over the store whose port answers (`answers`, viewerAnswers),
|
|
108
|
-
*
|
|
109
|
-
|
|
119
|
+
/** The newest viewer of run `runId` its runner put over the store whose port answers (`answers`, viewerAnswers), among the
|
|
120
|
+
* kinds `family`'s address reaches (familyReaches: every kind under the computer family, a browser's alone under the
|
|
121
|
+
* browser's); undefined when none does. */
|
|
122
|
+
export async function answeringViewer(store, sealKey, runId, answers, family = "computer") {
|
|
110
123
|
for (const handover of await readLiveViewers(store, sealKey, runId))
|
|
111
|
-
if (await answers(handover))
|
|
124
|
+
if (familyReaches(family, handover) && (await answers(handover)))
|
|
112
125
|
return handover;
|
|
113
126
|
return undefined;
|
|
114
127
|
}
|
|
@@ -116,7 +129,7 @@ async function answeringViewer(store, sealKey, runId, answers) {
|
|
|
116
129
|
* (/browser/live): the newest its runner put whose port answers (`answers`, viewerAnswers), as `{ viewer }`; undefined
|
|
117
130
|
* when none does. What run-reads-over-store's runBrowserState takes as its `liveViewer` dep. */
|
|
118
131
|
export async function liveViewerLink(store, sealKey, runId, answers = viewerAnswers) {
|
|
119
|
-
const handover = await answeringViewer(store, sealKey, runId, answers);
|
|
132
|
+
const handover = await answeringViewer(store, sealKey, runId, answers, "browser");
|
|
120
133
|
return handover && { viewer: viewerLink(runId, handover, "browser") };
|
|
121
134
|
}
|
|
122
135
|
/** The same viewer for GET /computer: its link under the computer family's address (/computer/live), with its computer's
|
|
@@ -129,20 +142,20 @@ export async function computerViewerLink(store, sealKey, runId, answers = viewer
|
|
|
129
142
|
* else: with no seam no viewer is handed over, and nothing is written (never a file in the run's folder, the agent's
|
|
130
143
|
* workspace). `changed`: a session launched (its viewer put) or released (its own hand-over dropped, never another's);
|
|
131
144
|
* `reopened`: a kept session's viewer opened again after a restart; `released`: the run let its sessions go, every
|
|
132
|
-
* hand-over of it dropped. */
|
|
133
|
-
export function sessionHandovers(seam) {
|
|
145
|
+
* hand-over of it dropped. `liveHost`: the runner's live host, when it is on another host than its server. */
|
|
146
|
+
export function sessionHandovers(seam, liveHost) {
|
|
134
147
|
const put = async (handover) => seam?.put(handover);
|
|
135
148
|
const drop = async (tag) => seam?.drop(tag);
|
|
136
149
|
return {
|
|
137
150
|
changed: async (row, change) => {
|
|
138
151
|
if (change === "released")
|
|
139
152
|
return drop(row.session.tag);
|
|
140
|
-
const handover = row.liveView ? handoverOf(row.liveView.fullscreen, row.session.tag) : undefined;
|
|
153
|
+
const handover = row.liveView ? handoverOf(row.liveView.fullscreen, row.session.tag, liveHost) : undefined;
|
|
141
154
|
if (handover)
|
|
142
155
|
await put(handover);
|
|
143
156
|
},
|
|
144
157
|
reopened: async (tag, fullscreen) => {
|
|
145
|
-
const handover = fullscreen ? handoverOf(fullscreen, tag) : undefined;
|
|
158
|
+
const handover = fullscreen ? handoverOf(fullscreen, tag, liveHost) : undefined;
|
|
146
159
|
if (handover)
|
|
147
160
|
await put(handover);
|
|
148
161
|
},
|
|
@@ -153,7 +166,7 @@ export function sessionHandovers(seam) {
|
|
|
153
166
|
* pi-browser's viewer, never the run's port's answer, under this route's own CSP, framed by this server's own origin alone.
|
|
154
167
|
* The page reads the viewer's id from its path and its token from the fragment, as pi-browser's own does. */
|
|
155
168
|
export const LIVE_CSP = "default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data: blob:; connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'self'";
|
|
156
|
-
const LIVE_REST = /^\/(v\/[A-Za-z0-9_-]{22}|viewer\.js|viewer\.css)$/;
|
|
169
|
+
const LIVE_REST = /^\/(v\/[A-Za-z0-9_-]{22}|viewer\.js|viewer\.css|computer-viewer\.js|computer-viewer\.css)$/;
|
|
157
170
|
export const liveRest = (rest) => LIVE_REST.test(rest);
|
|
158
171
|
/** The viewer run `runId`'s live route serves at `rest`, read over the store: a viewer's page ("/v/<id>") by its own path
|
|
159
172
|
* id, the viewer's files while the run has one open (its newest); undefined at any other address, or with none open (the
|
|
@@ -164,9 +177,13 @@ export async function liveViewerFor(store, sealKey, runId, rest) {
|
|
|
164
177
|
const viewer = /^\/v\/([A-Za-z0-9_-]{22})$/.exec(rest)?.[1];
|
|
165
178
|
return viewer ? liveViewerById(store, sealKey, runId, viewer) : liveViewer(store, sealKey, runId);
|
|
166
179
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
180
|
+
/** `page`: whose page a viewer's path ("/v/<id>") serves, the browser's (pi-browser's viewer) or a desktop's or phone's
|
|
181
|
+
* (computer-viewer.ts); each page's two files are under names of their own. */
|
|
182
|
+
export async function serveViewerFile(req, res, rest, page = "browser") {
|
|
183
|
+
const { viewerAssets: browser } = await import("@parcha/pi-browser/live-view");
|
|
184
|
+
const { computerViewerAssets: computer } = await import("./computer-viewer.js");
|
|
185
|
+
const assets = rest.startsWith("/computer-viewer.") || (rest.startsWith("/v/") && page === "computer") ? computer : browser;
|
|
186
|
+
const [type, body] = rest.endsWith(".js") ? ["text/javascript; charset=utf-8", assets.js] : rest.endsWith(".css") ? ["text/css; charset=utf-8", assets.css] : ["text/html; charset=utf-8", assets.html];
|
|
170
187
|
res.writeHead(200, { "content-type": type, "content-length": Buffer.byteLength(body), "content-security-policy": LIVE_CSP, "referrer-policy": "no-referrer", "cache-control": "no-store", "x-content-type-options": "nosniff" });
|
|
171
188
|
res.end(req.method === "HEAD" ? undefined : body);
|
|
172
189
|
}
|
|
@@ -207,21 +224,27 @@ export class OpenViewers {
|
|
|
207
224
|
/** The viewer's WebSocket to the run's port: the request line and the handshake's own headers, the Host and Origin the
|
|
208
225
|
* run's viewer takes (its own), and nothing else of the owner's (no cookie); then both ways, unread. */
|
|
209
226
|
/** Once piping starts, the viewer's socket carries the run's WebSocket stream: nothing is ever written into it after that,
|
|
210
|
-
* an error only ends it. `onPiping` hears when that starts (the server's own failure handling then destroys, never writes).
|
|
211
|
-
|
|
227
|
+
* an error only ends it. `onPiping` hears when that starts (the server's own failure handling then destroys, never writes).
|
|
228
|
+
* A viewer on a runner on another host is dialled only when `reach` counts that host among this server's runners', with
|
|
229
|
+
* the proxy's proof; else the answer is 404 and nothing is dialled (live-reach.ts). */
|
|
230
|
+
export function proxyLiveUpgrade(req, socket, head, handover, rest, onPiping, reach) {
|
|
212
231
|
const key = String(req.headers["sec-websocket-key"] ?? "");
|
|
213
232
|
const version = String(req.headers["sec-websocket-version"] ?? "");
|
|
214
233
|
if (!/^[A-Za-z0-9+/]{22}==$/.test(key) || version !== "13")
|
|
215
234
|
return void socket.end("HTTP/1.1 400 Bad Request\r\nConnection: close\r\nContent-Length: 0\r\n\r\n");
|
|
216
|
-
const
|
|
235
|
+
const host = dialHost(handover.host, reach);
|
|
236
|
+
if (host === undefined)
|
|
237
|
+
return void socket.end("HTTP/1.1 404 Not Found\r\nConnection: close\r\nContent-Length: 0\r\n\r\n");
|
|
238
|
+
const proof = reach ? `${LIVE_PROOF_HEADER}: ${liveProof(reach, handover.id)}\r\n` : "";
|
|
239
|
+
const upstream = connect({ host, port: handover.port });
|
|
217
240
|
let piping = false;
|
|
218
241
|
const end = () => {
|
|
219
242
|
socket.destroy();
|
|
220
243
|
upstream.destroy();
|
|
221
244
|
};
|
|
222
245
|
upstream.once("connect", () => {
|
|
223
|
-
const own = `${
|
|
224
|
-
upstream.write(`GET ${rest} HTTP/1.1\r\nHost: ${own}\r\nOrigin: http://${own}\r\
|
|
246
|
+
const own = `${host}:${handover.port}`;
|
|
247
|
+
upstream.write(`GET ${rest} HTTP/1.1\r\nHost: ${own}\r\nOrigin: http://${own}\r\n${proof}Upgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Key: ${key}\r\nSec-WebSocket-Version: 13\r\n\r\n`);
|
|
225
248
|
if (head.length)
|
|
226
249
|
upstream.write(head);
|
|
227
250
|
piping = true;
|
package/dist/browser-person.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
/** How long a person's time lasts at most before it expires: an unanswered ask,
|
|
1
|
+
/** How long a person's time lasts at most before it expires: an unanswered ask, a take-over with no input, and a run that
|
|
2
|
+
* waits for its person's answer with its browser kept open. Its worth of session time is held up front. The default of
|
|
3
|
+
* the server setting PERSON_WAIT_ENV. */
|
|
2
4
|
export declare const PERSON_HOLD_MS: number;
|
|
5
|
+
/** The server setting for that window, in whole minutes (1 to 360; anything else keeps the 15-minute default): how long a
|
|
6
|
+
* run waiting for its person keeps its browser open, how long an agent's hand-over ask waits, and how long a take-over
|
|
7
|
+
* lasts with no input. One setting for all three, so they never drift apart. */
|
|
8
|
+
export declare const PERSON_WAIT_ENV = "AGENTRUN_BROWSER_PERSON_WAIT_MIN";
|
|
3
9
|
/** How long a take-over outlasts its viewer. */
|
|
4
10
|
export declare const PERSON_AWAY_MS: number;
|
|
5
11
|
/** Under `--faux` only (the tests, beside the fake browser's own FAUX_BROWSER_LOG): the two windows above, in ms, `<hold>,<away>`. */
|
|
@@ -49,6 +55,9 @@ export declare function personHands(options: {
|
|
|
49
55
|
drop(): void;
|
|
50
56
|
}>;
|
|
51
57
|
note: Note;
|
|
58
|
+
/** A wait on the person's answer ended with its browser let go (its window, the cap, its session gone): when (ms) and
|
|
59
|
+
* the timeline row's words, for the Screen tab's ended state (browser-wait-ended.ts). Never throws out. */
|
|
60
|
+
waitEnded?(at: number, why: string): void;
|
|
52
61
|
holdMs?: number;
|
|
53
62
|
pollMs?: number;
|
|
54
63
|
/** For tests: the timer functions the person's time is held again by. */
|
|
@@ -112,11 +121,13 @@ export declare function personHands(options: {
|
|
|
112
121
|
* and its release lets the browser go, booking its time to then. `pauses: false`: a refusal pauses nothing, the run
|
|
113
122
|
* parks on its question as it would with no browser. Refused in the cap's words when there is no room. `lapsed`
|
|
114
123
|
* settles, in words, at the bound, when the cap refuses a re-hold (a take-over's sharing the session), or when a
|
|
115
|
-
* session it keeps is let go (sessionEnded);
|
|
124
|
+
* session it keeps is let go (sessionEnded); confirmed() writes that lapse's row and ended state once the runner
|
|
125
|
+
* parked the run on it; drop() lets the shares go, once. */
|
|
116
126
|
wait(callId: string, tags: readonly string[], since?: number): Promise<{
|
|
117
127
|
refused: string;
|
|
118
128
|
} | {
|
|
119
129
|
lapsed: Promise<string>;
|
|
130
|
+
confirmed(): void;
|
|
120
131
|
drop(): void;
|
|
121
132
|
}>;
|
|
122
133
|
/** Session `tag` was let go (its release, whatever made it): a wait that kept it open for the person lapses. */
|
|
@@ -130,4 +141,10 @@ export declare function personWindows(env: NodeJS.ProcessEnv, faux: boolean): {
|
|
|
130
141
|
holdMs: number;
|
|
131
142
|
awayMs: number;
|
|
132
143
|
};
|
|
144
|
+
/** The person's window from the server setting PERSON_WAIT_ENV, in ms: whole minutes from 1 to 360, else the default. */
|
|
145
|
+
export declare function personWaitMs(env: NodeJS.ProcessEnv): number;
|
|
146
|
+
/** The timeline row when a run's wait for its person ends at its window and its browser is let go. */
|
|
147
|
+
export declare const releasedAfterWait: (holdMs: number) => string;
|
|
148
|
+
/** The timeline row when a browser the run kept open for its person ended before their answer (its provider ended it). */
|
|
149
|
+
export declare const BROWSER_GONE_WHILE_WAITING = "The browser session ended while the run waited for you";
|
|
133
150
|
export {};
|