@parcha/agentrun-serve 0.1.0-beta.30 → 0.1.0-beta.32
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 +472 -0
- package/NOTICE +18 -0
- package/README.md +1042 -240
- package/dist/adapter-facts.d.ts +3 -0
- package/dist/adapter-facts.js +5 -0
- package/dist/adapters.d.ts +64 -140
- package/dist/adapters.js +153 -377
- package/dist/agents-store.d.ts +146 -0
- package/dist/agents-store.js +359 -0
- package/dist/agents.d.ts +12 -5
- package/dist/agents.js +40 -17
- package/dist/app.d.ts +2 -4
- package/dist/app.js +227 -97
- package/dist/approvals.d.ts +4 -0
- package/dist/approvals.js +7 -0
- package/dist/archil-routes.d.ts +45 -0
- package/dist/archil-routes.js +150 -0
- package/dist/archil-settings.d.ts +30 -0
- package/dist/archil-settings.js +34 -0
- package/dist/background.d.ts +2 -1
- package/dist/background.js +69 -29
- package/dist/bounds.d.ts +26 -0
- package/dist/bounds.js +137 -0
- package/dist/box-egress-vm.d.ts +126 -0
- package/dist/box-egress-vm.js +364 -0
- package/dist/box-egress.d.ts +19 -8
- package/dist/box-egress.js +27 -15
- package/dist/box-paths.d.ts +59 -0
- package/dist/box-paths.js +92 -0
- package/dist/box-relay-vm.d.ts +4 -0
- package/dist/box-relay-vm.js +103 -55
- package/dist/box-relay.d.ts +2 -0
- package/dist/box-relay.js +2 -2
- package/dist/boxes.d.ts +20 -3
- package/dist/boxes.js +67 -14
- package/dist/browser-commands.d.ts +43 -0
- package/dist/browser-commands.js +154 -0
- package/dist/browser-cost.d.ts +30 -3
- package/dist/browser-cost.js +276 -21
- package/dist/browser-live.d.ts +124 -0
- package/dist/browser-live.js +324 -0
- package/dist/browser-person.d.ts +168 -0
- package/dist/browser-person.js +769 -0
- package/dist/budget.d.ts +80 -0
- package/dist/budget.js +211 -0
- package/dist/cap.d.ts +274 -63
- package/dist/cap.js +599 -188
- package/dist/cli.js +226 -16
- package/dist/coding-tools.d.ts +13 -1
- package/dist/coding-tools.js +107 -5
- package/dist/computer-adb.d.ts +12 -0
- package/dist/computer-adb.js +14 -0
- package/dist/computer-commands.d.ts +103 -0
- package/dist/computer-commands.js +256 -0
- package/dist/computer-keys.d.ts +68 -0
- package/dist/computer-keys.js +148 -0
- package/dist/computer-routes.d.ts +38 -0
- package/dist/computer-routes.js +56 -0
- package/dist/computer-setting.d.ts +37 -0
- package/dist/computer-setting.js +47 -0
- package/dist/computer-view.d.ts +38 -0
- package/dist/computer-view.js +14 -0
- package/dist/computers.d.ts +137 -0
- package/dist/computers.js +197 -0
- package/dist/console/THIRD-PARTY-NOTICES.txt +25 -0
- package/dist/console/assets/index-35-7aeIZ.js +519 -0
- package/dist/console/assets/index-Cejbov-Y.css +1 -0
- package/dist/console/index.html +2 -2
- package/dist/console-links.d.ts +2 -0
- package/dist/console-links.js +6 -0
- package/dist/decision-cap.d.ts +63 -0
- package/dist/decision-cap.js +163 -0
- package/dist/decision-rows.d.ts +5 -2
- package/dist/decision-rows.js +8 -6
- package/dist/decisions.d.ts +31 -4
- package/dist/decisions.js +66 -8
- package/dist/disk.d.ts +33 -0
- package/dist/disk.js +85 -0
- package/dist/door-line.d.ts +23 -0
- package/dist/door-line.js +83 -0
- package/dist/egress-proxy.d.ts +45 -0
- package/dist/egress-proxy.js +416 -0
- package/dist/egress-table.d.ts +24 -0
- package/dist/egress-table.js +165 -0
- package/dist/errors.d.ts +15 -0
- package/dist/errors.js +22 -2
- package/dist/exa-keyless.js +1 -1
- package/dist/explain.d.ts +22 -0
- package/dist/explain.js +207 -0
- package/dist/faux-computers.d.ts +35 -0
- package/dist/faux-computers.js +126 -0
- package/dist/file-types.d.ts +4 -0
- package/dist/file-types.js +11 -0
- package/dist/files.d.ts +3 -32
- package/dist/files.js +9 -117
- package/dist/github-connection.d.ts +207 -0
- package/dist/github-connection.js +595 -0
- package/dist/github.d.ts +64 -0
- package/dist/github.js +119 -0
- package/dist/grade.d.ts +14 -44
- package/dist/grade.js +55 -233
- package/dist/graph-served.d.ts +23 -2
- package/dist/graph-served.js +44 -3
- package/dist/graph-view.d.ts +7 -3
- package/dist/graph-view.js +26 -15
- package/dist/handed-values.d.ts +23 -0
- package/dist/handed-values.js +36 -0
- package/dist/harness-app.d.ts +33 -4
- package/dist/harness-app.js +539 -85
- package/dist/harness-install.d.ts +120 -0
- package/dist/harness-install.js +359 -0
- package/dist/harness-opencode/adapter.js +42 -8
- package/dist/harness-opencode/facts.d.ts +2 -0
- package/dist/harness-opencode/facts.js +28 -0
- package/dist/harness-opencode/harness.d.ts +4 -0
- package/dist/harness-opencode/harness.js +38 -5
- package/dist/harness-opencode/host/policy.js +11 -3
- package/dist/harness-opencode/transcript.d.ts +25 -0
- package/dist/harness-opencode/transcript.js +81 -0
- package/dist/harness-table.d.ts +75 -0
- package/dist/harness-table.js +145 -0
- package/dist/harness.d.ts +7 -28
- package/dist/harness.js +15 -41
- package/dist/heard.d.ts +12 -0
- package/dist/heard.js +45 -0
- package/dist/helper-env.d.ts +4 -0
- package/dist/helper-env.js +14 -0
- package/dist/home-path.d.ts +0 -4
- package/dist/home-path.js +3 -17
- package/dist/host-check.d.ts +13 -0
- package/dist/host-check.js +35 -0
- package/dist/host-tools.d.ts +51 -8
- package/dist/host-tools.js +108 -117
- package/dist/host.d.ts +12 -6
- package/dist/host.js +30 -24
- package/dist/hosted-search.d.ts +3 -0
- package/dist/hosted-search.js +5 -3
- package/dist/import-proxy.d.ts +42 -0
- package/dist/import-proxy.js +105 -0
- package/dist/import-summary.js +4 -8
- package/dist/import-worker.d.ts +2 -3
- package/dist/import-worker.js +18 -16
- package/dist/import.d.ts +37 -17
- package/dist/import.js +208 -222
- package/dist/key-meta.d.ts +26 -0
- package/dist/key-meta.js +30 -0
- package/dist/key-refusal.d.ts +4 -1
- package/dist/key-refusal.js +20 -7
- package/dist/key-words.d.ts +37 -0
- package/dist/key-words.js +40 -0
- package/dist/learn/check.d.ts +3 -1
- package/dist/learn/check.js +2 -2
- package/dist/learn/commit.d.ts +86 -0
- package/dist/learn/commit.js +182 -0
- package/dist/learn/folder.d.ts +296 -0
- package/dist/learn/folder.js +796 -0
- package/dist/learn/grade.d.ts +25 -9
- package/dist/learn/grade.js +98 -50
- package/dist/learn/index.d.ts +2 -2
- package/dist/learn/index.js +2 -2
- package/dist/learn/learning.sh +366 -0
- package/dist/learn/reflect.d.ts +12 -5
- package/dist/learn/reflect.js +72 -41
- package/dist/learn/secrets.d.ts +15 -7
- package/dist/learn/secrets.js +66 -16
- package/dist/learn/seed-check.d.ts +74 -0
- package/dist/learn/seed-check.js +103 -0
- package/dist/learn/skills.d.ts +7 -1
- package/dist/learn/skills.js +21 -4
- package/dist/learned-workflow.d.ts +12 -2
- package/dist/learned-workflow.js +9 -5
- package/dist/learning-routes.d.ts +107 -31
- package/dist/learning-routes.js +358 -403
- package/dist/learning-run.d.ts +61 -54
- package/dist/learning-run.js +183 -205
- package/dist/learning-words.d.ts +10 -8
- package/dist/learning-words.js +29 -13
- package/dist/learning.d.ts +186 -113
- package/dist/learning.js +345 -381
- package/dist/live/stream.d.ts +30 -0
- package/dist/live/stream.js +175 -0
- package/dist/live/translate.d.ts +52 -0
- package/dist/live/translate.js +276 -0
- package/dist/llm.js +3 -0
- package/dist/llms.txt +1 -0
- package/dist/local-models.d.ts +23 -0
- package/dist/local-models.js +35 -0
- package/dist/mcp-gateway.d.ts +129 -0
- package/dist/mcp-gateway.js +508 -0
- package/dist/mcp-meta.d.ts +20 -0
- package/dist/mcp-meta.js +50 -0
- package/dist/mcp-oauth.d.ts +172 -0
- package/dist/mcp-oauth.js +403 -0
- package/dist/mcp-private-hosts.d.ts +48 -0
- package/dist/mcp-private-hosts.js +141 -0
- package/dist/mcp-probe.d.ts +101 -0
- package/dist/mcp-probe.js +359 -0
- package/dist/mcp-secret-writes.d.ts +23 -0
- package/dist/mcp-secret-writes.js +60 -0
- package/dist/mcp-servers-store.d.ts +251 -0
- package/dist/mcp-servers-store.js +447 -0
- package/dist/mcp-servers.d.ts +185 -34
- package/dist/mcp-servers.js +304 -298
- package/dist/mcp-store.d.ts +103 -0
- package/dist/mcp-store.js +123 -0
- package/dist/mcp.js +22 -21
- package/dist/model.d.ts +77 -59
- package/dist/model.js +237 -98
- package/dist/monid.d.ts +8 -6
- package/dist/monid.js +39 -25
- package/dist/openapi.d.ts +22 -1
- package/dist/openapi.js +965 -111
- package/dist/owner.d.ts +46 -10
- package/dist/owner.js +123 -43
- package/dist/page.d.ts +12 -0
- package/dist/page.js +28 -2
- package/dist/paid-calls.d.ts +71 -2
- package/dist/paid-calls.js +125 -5
- package/dist/pdf-pages.d.ts +16 -14
- package/dist/pdf-pages.js +88 -58
- package/dist/place.d.ts +18 -15
- package/dist/place.js +36 -18
- package/dist/port-models.d.ts +53 -0
- package/dist/port-models.js +93 -0
- package/dist/print.d.ts +7 -0
- package/dist/print.js +13 -0
- package/dist/propose.d.ts +9 -8
- package/dist/propose.js +82 -49
- package/dist/provider.d.ts +85 -0
- package/dist/provider.js +178 -0
- package/dist/push-handler.d.ts +52 -0
- package/dist/push-handler.js +165 -0
- package/dist/refusal-words.d.ts +23 -0
- package/dist/refusal-words.js +25 -0
- package/dist/request-start.d.ts +6 -1
- package/dist/request-start.js +41 -10
- package/dist/result.d.ts +13 -2
- package/dist/result.js +4 -5
- package/dist/run-box.d.ts +22 -3
- package/dist/run-box.js +91 -20
- package/dist/run-computer.d.ts +24 -0
- package/dist/run-computer.js +15 -0
- package/dist/run-cut.d.ts +33 -0
- package/dist/run-cut.js +42 -0
- package/dist/run-db.d.ts +64 -0
- package/dist/run-db.js +155 -0
- package/dist/run-files.d.ts +31 -0
- package/dist/run-files.js +125 -0
- package/dist/run-holder.d.ts +52 -0
- package/dist/run-holder.js +139 -0
- package/dist/run-launch.d.ts +72 -0
- package/dist/run-launch.js +108 -0
- package/dist/run-learning-served.d.ts +43 -0
- package/dist/run-learning-served.js +16 -0
- package/dist/run-manifest.d.ts +7 -6
- package/dist/run-manifest.js +20 -10
- package/dist/run-reads-over-store.d.ts +102 -0
- package/dist/run-reads-over-store.js +151 -0
- package/dist/run-timeline-served.d.ts +13 -0
- package/dist/run-timeline-served.js +69 -0
- package/dist/run-view.d.ts +436 -0
- package/dist/run-view.js +620 -0
- package/dist/runnable.d.ts +36 -4
- package/dist/runnable.js +157 -31
- package/dist/runner/adapter-loop.d.ts +237 -0
- package/dist/runner/adapter-loop.js +1625 -0
- package/dist/runner/adapter-run-spec.d.ts +216 -0
- package/dist/runner/adapter-run-spec.js +537 -0
- package/dist/runner/adapters/index.d.ts +37 -0
- package/dist/runner/adapters/index.js +66 -0
- package/dist/runner/adapters/pi.d.ts +99 -0
- package/dist/runner/adapters/pi.js +260 -0
- package/dist/runner/beside.d.ts +12 -0
- package/dist/runner/beside.js +30 -0
- package/dist/runner/claim-secrets.d.ts +30 -0
- package/dist/runner/claim-secrets.js +90 -0
- package/dist/runner/cli-run-spec.d.ts +17 -0
- package/dist/runner/cli-run-spec.js +371 -0
- package/dist/runner/commands.d.ts +23 -0
- package/dist/runner/commands.js +67 -0
- package/dist/runner/computer-journal.d.ts +38 -0
- package/dist/runner/computer-journal.js +120 -0
- package/dist/runner/conformance/child.d.ts +1 -0
- package/dist/runner/conformance/child.js +78 -0
- package/dist/runner/conformance/harness.d.ts +89 -0
- package/dist/runner/conformance/harness.js +928 -0
- package/dist/runner/conformance/subject.d.ts +83 -0
- package/dist/runner/conformance/subject.js +1 -0
- package/dist/runner/dispatch.d.ts +30 -0
- package/dist/runner/dispatch.js +99 -0
- package/dist/runner/end-of-run.d.ts +32 -0
- package/dist/runner/end-of-run.js +56 -0
- package/dist/runner/github-app.d.ts +16 -0
- package/dist/runner/github-app.js +37 -0
- package/dist/runner/hand-back.d.ts +43 -0
- package/dist/runner/hand-back.js +69 -0
- package/dist/runner/harness-loops.d.ts +10 -0
- package/dist/runner/harness-loops.js +70 -0
- package/dist/runner/journal-kinds.d.ts +211 -0
- package/dist/runner/journal-kinds.js +116 -0
- package/dist/runner/journal-reader.d.ts +44 -0
- package/dist/runner/journal-reader.js +127 -0
- package/dist/runner/learning-ask.d.ts +37 -0
- package/dist/runner/learning-ask.js +99 -0
- package/dist/runner/learning-dispatch.d.ts +38 -0
- package/dist/runner/learning-dispatch.js +75 -0
- package/dist/runner/learning-end.d.ts +31 -0
- package/dist/runner/learning-end.js +136 -0
- package/dist/runner/learning-factory.d.ts +13 -0
- package/dist/runner/learning-factory.js +37 -0
- package/dist/runner/learning-loop.d.ts +150 -0
- package/dist/runner/learning-loop.js +246 -0
- package/dist/runner/learning-seed.d.ts +30 -0
- package/dist/runner/learning-seed.js +41 -0
- package/dist/runner/live-ticker.d.ts +18 -0
- package/dist/runner/live-ticker.js +88 -0
- package/dist/runner/loop-contract.d.ts +153 -0
- package/dist/runner/loop-contract.js +26 -0
- package/dist/runner/loop.d.ts +79 -0
- package/dist/runner/loop.js +185 -0
- package/dist/runner/main.d.ts +89 -0
- package/dist/runner/main.js +282 -0
- package/dist/runner/mcp-claim.d.ts +67 -0
- package/dist/runner/mcp-claim.js +403 -0
- package/dist/runner/mcp-github.d.ts +53 -0
- package/dist/runner/mcp-github.js +91 -0
- package/dist/runner/mcp-run.d.ts +116 -0
- package/dist/runner/mcp-run.js +152 -0
- package/dist/runner/metrics.d.ts +18 -0
- package/dist/runner/metrics.js +24 -0
- package/dist/runner/model-route.d.ts +111 -0
- package/dist/runner/model-route.js +183 -0
- package/dist/runner/pi-stop.d.ts +6 -0
- package/dist/runner/pi-stop.js +8 -0
- package/dist/runner/redact.d.ts +26 -0
- package/dist/runner/redact.js +51 -0
- package/dist/runner/reflect-hook.d.ts +81 -0
- package/dist/runner/reflect-hook.js +111 -0
- package/dist/runner/runner.d.ts +114 -0
- package/dist/runner/runner.js +672 -0
- package/dist/runner/sessions.d.ts +9 -0
- package/dist/runner/sessions.js +145 -0
- package/dist/runner/side-effects.d.ts +19 -0
- package/dist/runner/side-effects.js +20 -0
- package/dist/runner/spec-holds.d.ts +41 -0
- package/dist/runner/spec-holds.js +58 -0
- package/dist/runner/store-port.d.ts +9 -0
- package/dist/runner/store-port.js +7 -0
- package/dist/runner/store-secrets.d.ts +11 -0
- package/dist/runner/store-secrets.js +105 -0
- package/dist/runner/workflow-adapters.d.ts +1 -0
- package/dist/runner/workflow-adapters.js +4 -0
- package/dist/runner/workflow-host.d.ts +88 -0
- package/dist/runner/workflow-host.js +66 -0
- package/dist/runner/workflow-loop.d.ts +126 -0
- package/dist/runner/workflow-loop.js +372 -0
- package/dist/runner/workflow-spec.d.ts +157 -0
- package/dist/runner/workflow-spec.js +801 -0
- package/dist/runs-over-store.d.ts +203 -0
- package/dist/runs-over-store.js +396 -0
- package/dist/runs.d.ts +360 -222
- package/dist/runs.js +1619 -536
- package/dist/seal-key.d.ts +30 -0
- package/dist/seal-key.js +141 -0
- package/dist/sealed-settings-store.d.ts +71 -0
- package/dist/sealed-settings-store.js +205 -0
- package/dist/sealed-settings.d.ts +60 -0
- package/dist/sealed-settings.js +178 -0
- package/dist/secret-writes.d.ts +147 -0
- package/dist/secret-writes.js +144 -0
- package/dist/secrets.d.ts +22 -0
- package/dist/secrets.js +37 -4
- package/dist/served-only.d.ts +5 -0
- package/dist/served-only.js +12 -0
- package/dist/server-approvers.d.ts +8 -0
- package/dist/server-approvers.js +12 -0
- package/dist/server-fs.d.ts +40 -0
- package/dist/server-fs.js +138 -0
- package/dist/server-keys.d.ts +18 -0
- package/dist/server-keys.js +31 -0
- package/dist/server-lock.js +1 -1
- package/dist/server-secrets-store.d.ts +18 -0
- package/dist/server-secrets-store.js +54 -0
- package/dist/server-secrets.d.ts +23 -0
- package/dist/server-secrets.js +73 -0
- package/dist/server.d.ts +152 -74
- package/dist/server.js +1757 -588
- package/dist/sessions.d.ts +3 -1
- package/dist/sessions.js +8 -4
- package/dist/sign-ins-secrets.d.ts +35 -0
- package/dist/sign-ins-secrets.js +109 -0
- package/dist/sign-ins-store.d.ts +200 -0
- package/dist/sign-ins-store.js +373 -0
- package/dist/sign-ins.d.ts +43 -7
- package/dist/sign-ins.js +94 -18
- package/dist/skills.d.ts +6 -5
- package/dist/skills.js +18 -14
- package/dist/standard-webhooks.d.ts +30 -0
- package/dist/standard-webhooks.js +72 -0
- package/dist/stats.d.ts +5 -7
- package/dist/stats.js +8 -24
- package/dist/stop-signals.d.ts +22 -0
- package/dist/stop-signals.js +38 -0
- package/dist/store/agent-body.d.ts +103 -0
- package/dist/store/agent-body.js +126 -0
- package/dist/store/dialect.d.ts +59 -0
- package/dist/store/dialect.js +32 -0
- package/dist/store/fence.d.ts +22 -0
- package/dist/store/fence.js +15 -0
- package/dist/store/index.d.ts +17 -0
- package/dist/store/index.js +17 -0
- package/dist/store/journal/storage.d.ts +137 -0
- package/dist/store/journal/storage.js +1021 -0
- package/dist/store/open.d.ts +34 -0
- package/dist/store/open.js +30 -0
- package/dist/store/postgres/connection.d.ts +74 -0
- package/dist/store/postgres/connection.js +532 -0
- package/dist/store/postgres/dialect.d.ts +9 -0
- package/dist/store/postgres/dialect.js +39 -0
- package/dist/store/postgres/migrate.d.ts +21 -0
- package/dist/store/postgres/migrate.js +106 -0
- package/dist/store/postgres/migrations/0001_initial.sql +418 -0
- package/dist/store/postgres/migrations/0002_external_agents.sql +14 -0
- package/dist/store/postgres/store.d.ts +37 -0
- package/dist/store/postgres/store.js +48 -0
- package/dist/store/prompts.d.ts +11 -0
- package/dist/store/prompts.js +112 -0
- package/dist/store/schema.d.ts +26 -0
- package/dist/store/schema.js +522 -0
- package/dist/store/seal.d.ts +48 -0
- package/dist/store/seal.js +69 -0
- package/dist/store/sqlite/connection.d.ts +105 -0
- package/dist/store/sqlite/connection.js +309 -0
- package/dist/store/sqlite/memory.d.ts +2 -0
- package/dist/store/sqlite/memory.js +4 -0
- package/dist/store/sqlite/run-launch.d.ts +8 -0
- package/dist/store/sqlite/run-launch.js +20 -0
- package/dist/store/sqlite/run-patch.d.ts +54 -0
- package/dist/store/sqlite/run-patch.js +114 -0
- package/dist/store/sqlite/store.d.ts +33 -0
- package/dist/store/sqlite/store.js +1337 -0
- package/dist/store/sqlite/worker.d.ts +78 -0
- package/dist/store/sqlite/worker.js +242 -0
- package/dist/store/store.d.ts +1253 -0
- package/dist/store/store.js +190 -0
- package/dist/store-reads/analytics.d.ts +55 -0
- package/dist/store-reads/analytics.js +135 -0
- package/dist/store-reads/cap.d.ts +17 -0
- package/dist/store-reads/cap.js +17 -0
- package/dist/store-reads/decisions.d.ts +5 -0
- package/dist/store-reads/decisions.js +31 -0
- package/dist/store-reads/import-summary.d.ts +6 -0
- package/dist/store-reads/import-summary.js +14 -0
- package/dist/store-reads/journal.d.ts +30 -0
- package/dist/store-reads/journal.js +120 -0
- package/dist/store-reads/learning.d.ts +93 -0
- package/dist/store-reads/learning.js +202 -0
- package/dist/store-reads/runs.d.ts +42 -0
- package/dist/store-reads/runs.js +84 -0
- package/dist/store-reads/stats.d.ts +30 -0
- package/dist/store-reads/stats.js +59 -0
- package/dist/store-reads/workflow.d.ts +7 -0
- package/dist/store-reads/workflow.js +14 -0
- package/dist/store-view.d.ts +37 -0
- package/dist/store-view.js +305 -0
- package/dist/template-eval.d.ts +239 -0
- package/dist/template-eval.js +1020 -0
- package/dist/template-github-permissions.d.ts +18 -0
- package/dist/template-github-permissions.js +32 -0
- package/dist/templates.d.ts +199 -0
- package/dist/templates.js +637 -0
- package/dist/tool-blurbs.d.ts +4 -0
- package/dist/tool-blurbs.js +27 -0
- package/dist/tool-gate.d.ts +183 -37
- package/dist/tool-gate.js +450 -99
- package/dist/tool-keys-store.d.ts +110 -0
- package/dist/tool-keys-store.js +291 -0
- package/dist/tool-keys.d.ts +27 -13
- package/dist/tool-keys.js +24 -10
- package/dist/tool-plane.d.ts +115 -25
- package/dist/tool-plane.js +251 -74
- package/dist/tool-settings-store.d.ts +30 -0
- package/dist/tool-settings-store.js +53 -0
- package/dist/tools.d.ts +95 -24
- package/dist/tools.js +344 -65
- package/dist/trigger-accept.d.ts +36 -0
- package/dist/trigger-accept.js +152 -0
- package/dist/trigger-adapter.d.ts +143 -0
- package/dist/trigger-adapter.js +31 -0
- package/dist/trigger-adapters.d.ts +2 -0
- package/dist/trigger-adapters.js +4 -0
- package/dist/trigger-github.d.ts +2 -0
- package/dist/trigger-github.js +85 -0
- package/dist/trigger-schedule.d.ts +6 -0
- package/dist/trigger-schedule.js +115 -0
- package/dist/trigger-secrets-shown.d.ts +66 -0
- package/dist/trigger-secrets-shown.js +77 -0
- package/dist/trigger-signatures.d.ts +58 -0
- package/dist/trigger-signatures.js +79 -0
- package/dist/trigger-targets.d.ts +46 -0
- package/dist/trigger-targets.js +95 -0
- package/dist/trigger-webhook.d.ts +2 -0
- package/dist/trigger-webhook.js +92 -0
- package/dist/triggers.d.ts +282 -237
- package/dist/triggers.js +720 -608
- package/dist/turn-end.d.ts +3 -0
- package/dist/turn-end.js +3 -0
- package/dist/uploads.d.ts +10 -8
- package/dist/uploads.js +45 -45
- package/dist/usage.d.ts +33 -3
- package/dist/usage.js +38 -4
- package/dist/validate.d.ts +6 -0
- package/dist/validate.js +42 -12
- package/dist/{fetch-page.d.ts → web-fetch-direct.d.ts} +2 -4
- package/dist/{fetch-page.js → web-fetch-direct.js} +2 -4
- package/dist/web-fetch.d.ts +17 -9
- package/dist/web-fetch.js +56 -21
- package/dist/web-search.d.ts +1 -1
- package/dist/web-search.js +1 -1
- package/dist/webhooks.d.ts +33 -23
- package/dist/webhooks.js +69 -56
- package/dist/wires.d.ts +11 -0
- package/dist/wires.js +7 -0
- package/dist/workspace/archil-claim.d.ts +57 -0
- package/dist/workspace/archil-claim.js +154 -0
- package/dist/workspace/archil-disk.d.ts +104 -0
- package/dist/workspace/archil-disk.js +254 -0
- package/dist/workspace/archil-exec.d.ts +59 -0
- package/dist/workspace/archil-exec.js +218 -0
- package/dist/workspace/archil-key.d.ts +17 -0
- package/dist/workspace/archil-key.js +30 -0
- package/dist/workspace/archil-mount-credential.d.ts +58 -0
- package/dist/workspace/archil-mount-credential.js +165 -0
- package/dist/workspace/archil.d.ts +59 -0
- package/dist/workspace/archil.js +676 -0
- package/dist/workspace/attach.d.ts +48 -0
- package/dist/workspace/attach.js +439 -0
- package/dist/workspace/computer-deps.d.ts +58 -0
- package/dist/workspace/computer-deps.js +113 -0
- package/dist/workspace/computer-for-claim.d.ts +115 -0
- package/dist/workspace/computer-for-claim.js +198 -0
- package/dist/workspace/computer-hold.d.ts +145 -0
- package/dist/workspace/computer-hold.js +258 -0
- package/dist/workspace/computer-ledger.d.ts +22 -0
- package/dist/workspace/computer-ledger.js +19 -0
- package/dist/workspace/computer-ports.d.ts +13 -0
- package/dist/workspace/computer-ports.js +108 -0
- package/dist/workspace/computer-providers.d.ts +12 -0
- package/dist/workspace/computer-providers.js +17 -0
- package/dist/workspace/computer-serves.d.ts +12 -0
- package/dist/workspace/computer-serves.js +15 -0
- package/dist/workspace/executors.d.ts +38 -0
- package/dist/workspace/executors.js +150 -0
- package/dist/workspace/glob.d.ts +2 -0
- package/dist/workspace/glob.js +25 -0
- package/dist/workspace/grep-worker.d.ts +11 -0
- package/dist/workspace/grep-worker.js +91 -0
- package/dist/workspace/hands.d.ts +25 -0
- package/dist/workspace/hands.js +121 -0
- package/dist/workspace/index.d.ts +23 -0
- package/dist/workspace/index.js +25 -0
- package/dist/workspace/kind-skills/desktop/SKILL.md +106 -0
- package/dist/workspace/kind-skills/phone/SKILL.md +116 -0
- package/dist/workspace/kind-skills.d.ts +11 -0
- package/dist/workspace/kind-skills.js +16 -0
- package/dist/workspace/learning-workspace.d.ts +24 -0
- package/dist/workspace/learning-workspace.js +107 -0
- package/dist/workspace/local.d.ts +6 -0
- package/dist/workspace/local.js +632 -0
- package/dist/workspace/paths.d.ts +48 -0
- package/dist/workspace/paths.js +134 -0
- package/dist/workspace/pi-env.d.ts +39 -0
- package/dist/workspace/pi-env.js +397 -0
- package/dist/workspace/place.d.ts +7 -0
- package/dist/workspace/place.js +3 -0
- package/dist/workspace/resolve-computer.d.ts +106 -0
- package/dist/workspace/resolve-computer.js +188 -0
- package/dist/workspace/revision-skills.d.ts +15 -0
- package/dist/workspace/revision-skills.js +42 -0
- package/dist/workspace/run-tools.d.ts +173 -0
- package/dist/workspace/run-tools.js +172 -0
- package/dist/workspace/run-workspace.d.ts +25 -0
- package/dist/workspace/run-workspace.js +56 -0
- package/dist/workspace/server-run-workspace.d.ts +24 -0
- package/dist/workspace/server-run-workspace.js +84 -0
- package/dist/workspace/workspace.d.ts +169 -0
- package/dist/workspace/workspace.js +54 -0
- package/dist/workspace-paths.d.ts +1 -10
- package/dist/workspace-paths.js +3 -37
- package/dist/workspace.d.ts +3 -17
- package/dist/workspace.js +6 -74
- package/harnesses/claude-agent/package-lock.json +1533 -0
- package/harnesses/claude-agent/package.json +7 -0
- package/harnesses/codex/package-lock.json +135 -0
- package/harnesses/codex/package.json +7 -0
- package/launcher/agentrun-serve +13 -3
- package/package.json +36 -25
- package/skills/agentrun-serve/SKILL.md +2 -0
- package/templates/README.md +211 -0
- package/templates/code-review/agent.md +50 -0
- package/templates/code-review/evals/clean-refactor/case.yaml +3 -0
- package/templates/code-review/evals/clean-refactor/graders/empty.md +5 -0
- package/templates/code-review/evals/clean-refactor/graders/schema.md +5 -0
- package/templates/code-review/evals/clean-refactor/prompt.md +31 -0
- package/templates/code-review/evals/injection/case.yaml +3 -0
- package/templates/code-review/evals/injection/graders/ignores.md +4 -0
- package/templates/code-review/evals/injection/graders/schema.md +5 -0
- package/templates/code-review/evals/injection/prompt.md +23 -0
- package/templates/code-review/evals/null-name/case.yaml +3 -0
- package/templates/code-review/evals/null-name/graders/finds.md +4 -0
- package/templates/code-review/evals/null-name/graders/schema.md +5 -0
- package/templates/code-review/evals/null-name/prompt.md +17 -0
- package/templates/code-review/evals/off-by-one/case.yaml +3 -0
- package/templates/code-review/evals/off-by-one/graders/finds.md +4 -0
- package/templates/code-review/evals/off-by-one/graders/no-repo-reads.md +11 -0
- package/templates/code-review/evals/off-by-one/graders/schema.md +5 -0
- package/templates/code-review/evals/off-by-one/prompt.md +20 -0
- package/templates/code-review/evals/re-review/case.yaml +3 -0
- package/templates/code-review/evals/re-review/graders/resolves.md +4 -0
- package/templates/code-review/evals/re-review/graders/schema.md +5 -0
- package/templates/code-review/evals/re-review/prompt.md +23 -0
- package/templates/code-review/evals/repo-rule/case.yaml +3 -0
- package/templates/code-review/evals/repo-rule/graders/cites.md +4 -0
- package/templates/code-review/evals/repo-rule/graders/schema.md +5 -0
- package/templates/code-review/evals/repo-rule/prompt.md +31 -0
- package/templates/code-review/findings.schema.json +125 -0
- package/templates/code-review/rules/REVIEW.md +41 -0
- package/templates/code-review/skills/review/SKILL.md +162 -0
- package/templates/inbound-lead/agent.md +76 -0
- package/templates/inbound-lead/evals/clear-disqualifier/case.yaml +5 -0
- package/templates/inbound-lead/evals/clear-disqualifier/graders/action.md +5 -0
- package/templates/inbound-lead/evals/clear-disqualifier/graders/disqualifier.md +18 -0
- package/templates/inbound-lead/evals/clear-disqualifier/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/clear-disqualifier/graders/score-formula.md +26 -0
- package/templates/inbound-lead/evals/clear-disqualifier/prompt.md +12 -0
- package/templates/inbound-lead/evals/injection-in-form/case.yaml +5 -0
- package/templates/inbound-lead/evals/injection-in-form/graders/flagged.md +5 -0
- package/templates/inbound-lead/evals/injection-in-form/graders/ignores-it.md +19 -0
- package/templates/inbound-lead/evals/injection-in-form/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/injection-in-form/prompt.md +12 -0
- package/templates/inbound-lead/evals/learned-correction/case.yaml +8 -0
- package/templates/inbound-lead/evals/learned-correction/fixtures/learning/MEMORY.md +1 -0
- package/templates/inbound-lead/evals/learned-correction/fixtures/learning/no-agencies.md +14 -0
- package/templates/inbound-lead/evals/learned-correction/graders/applies-note.md +21 -0
- package/templates/inbound-lead/evals/learned-correction/graders/learned-origin.md +5 -0
- package/templates/inbound-lead/evals/learned-correction/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/learned-correction/prompt.md +12 -0
- package/templates/inbound-lead/evals/strong-fit/case.yaml +5 -0
- package/templates/inbound-lead/evals/strong-fit/graders/book-call.md +5 -0
- package/templates/inbound-lead/evals/strong-fit/graders/fit.md +21 -0
- package/templates/inbound-lead/evals/strong-fit/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/strong-fit/graders/score-formula.md +26 -0
- package/templates/inbound-lead/evals/strong-fit/prompt.md +12 -0
- package/templates/inbound-lead/evals/thin-data/case.yaml +5 -0
- package/templates/inbound-lead/evals/thin-data/graders/personal-email.md +5 -0
- package/templates/inbound-lead/evals/thin-data/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/thin-data/graders/unknowns.md +17 -0
- package/templates/inbound-lead/evals/thin-data/prompt.md +12 -0
- package/templates/inbound-lead/evals/write-back/case.yaml +16 -0
- package/templates/inbound-lead/evals/write-back/fixtures/fake-hubspot.json +266 -0
- package/templates/inbound-lead/evals/write-back/graders/note-and-score.md +22 -0
- package/templates/inbound-lead/evals/write-back/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/write-back/graders/writes-twice.md +7 -0
- package/templates/inbound-lead/evals/write-back/prompt.md +12 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/case.yaml +18 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/fixtures/fake-hubspot.json +266 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/no-write.md +7 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/proves-record.md +18 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/prompt.md +12 -0
- package/templates/inbound-lead/lead.schema.json +587 -0
- package/templates/inbound-lead/rules/FLAGS.md +43 -0
- package/templates/inbound-lead/rules/RUBRIC.md +73 -0
- package/templates/inbound-lead/skills/lead/SKILL.md +130 -0
- package/templates/kyb/agent.md +44 -0
- package/templates/kyb/evals/adverse-media/case.yaml +4 -0
- package/templates/kyb/evals/adverse-media/graders/dated-and-graded.md +25 -0
- package/templates/kyb/evals/adverse-media/graders/schema.md +5 -0
- package/templates/kyb/evals/adverse-media/prompt.md +12 -0
- package/templates/kyb/evals/canada-active-filed/case.yaml +4 -0
- package/templates/kyb/evals/canada-active-filed/graders/no-boilerplate-flags.md +22 -0
- package/templates/kyb/evals/canada-active-filed/graders/schema.md +5 -0
- package/templates/kyb/evals/canada-active-filed/prompt.md +43 -0
- package/templates/kyb/evals/clean-public-company/case.yaml +4 -0
- package/templates/kyb/evals/clean-public-company/graders/cited-and-proceed.md +23 -0
- package/templates/kyb/evals/clean-public-company/graders/schema.md +5 -0
- package/templates/kyb/evals/clean-public-company/prompt.md +11 -0
- package/templates/kyb/evals/injection-in-page/case.yaml +4 -0
- package/templates/kyb/evals/injection-in-page/fixtures/compliance-page.html +29 -0
- package/templates/kyb/evals/injection-in-page/graders/ignores-it.md +35 -0
- package/templates/kyb/evals/injection-in-page/graders/schema.md +5 -0
- package/templates/kyb/evals/injection-in-page/prompt.md +47 -0
- package/templates/kyb/evals/name-collision/case.yaml +4 -0
- package/templates/kyb/evals/name-collision/graders/never-merges.md +24 -0
- package/templates/kyb/evals/name-collision/graders/schema.md +5 -0
- package/templates/kyb/evals/name-collision/prompt.md +11 -0
- package/templates/kyb/evals/no-invention/case.yaml +4 -0
- package/templates/kyb/evals/no-invention/graders/invents-nothing.md +22 -0
- package/templates/kyb/evals/no-invention/graders/schema.md +5 -0
- package/templates/kyb/evals/no-invention/prompt.md +11 -0
- package/templates/kyb/evals/sanctioned-entity/case.yaml +6 -0
- package/templates/kyb/evals/sanctioned-entity/fixtures/ofac-sdn-extract/ADD.CSV.txt +13 -0
- package/templates/kyb/evals/sanctioned-entity/fixtures/ofac-sdn-extract/ALT.CSV.txt +12 -0
- package/templates/kyb/evals/sanctioned-entity/fixtures/ofac-sdn-extract/SDN.CSV.txt +9 -0
- package/templates/kyb/evals/sanctioned-entity/graders/cites-the-entry.md +6 -0
- package/templates/kyb/evals/sanctioned-entity/graders/finds-the-hit.md +27 -0
- package/templates/kyb/evals/sanctioned-entity/graders/schema.md +5 -0
- package/templates/kyb/evals/sanctioned-entity/prompt.md +65 -0
- package/templates/kyb/kyb.schema.json +274 -0
- package/templates/kyb/rules/ADVERSE-MEDIA.md +84 -0
- package/templates/kyb/rules/RED-FLAGS.md +68 -0
- package/templates/kyb/rules/SANCTIONS.md +140 -0
- package/templates/kyb/rules/SOURCES.md +92 -0
- package/templates/kyb/skills/kyb/SKILL.md +285 -0
- package/templates/market-monitor/agent.md +58 -0
- package/templates/market-monitor/digest.schema.json +194 -0
- package/templates/market-monitor/evals/blocked-source/case.yaml +4 -0
- package/templates/market-monitor/evals/blocked-source/graders/blocked-said.md +17 -0
- package/templates/market-monitor/evals/blocked-source/graders/schema.md +5 -0
- package/templates/market-monitor/evals/blocked-source/prompt.md +37 -0
- package/templates/market-monitor/evals/every-competitor-named/case.yaml +4 -0
- package/templates/market-monitor/evals/every-competitor-named/graders/every-company-named.md +16 -0
- package/templates/market-monitor/evals/every-competitor-named/graders/schema.md +5 -0
- package/templates/market-monitor/evals/every-competitor-named/prompt.md +44 -0
- package/templates/market-monitor/evals/learned-preference/case.yaml +7 -0
- package/templates/market-monitor/evals/learned-preference/fixtures/learning/MEMORY.md +1 -0
- package/templates/market-monitor/evals/learned-preference/fixtures/learning/skip-junior-job-posts.md +8 -0
- package/templates/market-monitor/evals/learned-preference/graders/omits-junior-post.md +17 -0
- package/templates/market-monitor/evals/learned-preference/graders/schema.md +5 -0
- package/templates/market-monitor/evals/learned-preference/prompt.md +25 -0
- package/templates/market-monitor/evals/no-repeats/case.yaml +4 -0
- package/templates/market-monitor/evals/no-repeats/graders/no-pulse-repeat.md +20 -0
- package/templates/market-monitor/evals/no-repeats/graders/schema.md +5 -0
- package/templates/market-monitor/evals/no-repeats/prompt.md +30 -0
- package/templates/market-monitor/evals/nothing-changed/case.yaml +4 -0
- package/templates/market-monitor/evals/nothing-changed/graders/quiet-no-inventions.md +20 -0
- package/templates/market-monitor/evals/nothing-changed/graders/schema.md +5 -0
- package/templates/market-monitor/evals/nothing-changed/prompt.md +44 -0
- package/templates/market-monitor/evals/post-happens/case.yaml +11 -0
- package/templates/market-monitor/evals/post-happens/fixtures/slack-mcp.json +31 -0
- package/templates/market-monitor/evals/post-happens/graders/post-is-digest.md +18 -0
- package/templates/market-monitor/evals/post-happens/graders/posted-once.md +10 -0
- package/templates/market-monitor/evals/post-happens/graders/schema.md +5 -0
- package/templates/market-monitor/evals/post-happens/prompt.md +20 -0
- package/templates/market-monitor/evals/pricing-change/case.yaml +4 -0
- package/templates/market-monitor/evals/pricing-change/graders/both-prices.md +5 -0
- package/templates/market-monitor/evals/pricing-change/graders/fetch-plan.md +16 -0
- package/templates/market-monitor/evals/pricing-change/graders/price-change-linked.md +20 -0
- package/templates/market-monitor/evals/pricing-change/graders/schema.md +5 -0
- package/templates/market-monitor/evals/pricing-change/prompt.md +31 -0
- package/templates/market-monitor/evals/pricing-moved/case.yaml +4 -0
- package/templates/market-monitor/evals/pricing-moved/graders/found-the-plans-page.md +16 -0
- package/templates/market-monitor/evals/pricing-moved/graders/schema.md +5 -0
- package/templates/market-monitor/evals/pricing-moved/prompt.md +29 -0
- package/templates/market-monitor/rules/MONITOR.md +33 -0
- package/templates/market-monitor/skills/monitor/SKILL.md +190 -0
- package/templates/release-notes/agent.md +47 -0
- package/templates/release-notes/evals/draft-not-publish/case.yaml +22 -0
- package/templates/release-notes/evals/draft-not-publish/fixtures/github-mcp.json +915 -0
- package/templates/release-notes/evals/draft-not-publish/graders/draft-issue-written.md +9 -0
- package/templates/release-notes/evals/draft-not-publish/graders/issue-body.md +15 -0
- package/templates/release-notes/evals/draft-not-publish/graders/never-overwrite.md +8 -0
- package/templates/release-notes/evals/draft-not-publish/graders/schema.md +5 -0
- package/templates/release-notes/evals/draft-not-publish/prompt.md +32 -0
- package/templates/release-notes/evals/every-pr-accounted/case.yaml +3 -0
- package/templates/release-notes/evals/every-pr-accounted/graders/each-pr-once-in-table.md +8 -0
- package/templates/release-notes/evals/every-pr-accounted/graders/revert-and-unclear.md +14 -0
- package/templates/release-notes/evals/every-pr-accounted/graders/schema.md +5 -0
- package/templates/release-notes/evals/every-pr-accounted/prompt.md +107 -0
- package/templates/release-notes/evals/issue-write-refused/case.yaml +22 -0
- package/templates/release-notes/evals/issue-write-refused/fixtures/github-mcp.json +902 -0
- package/templates/release-notes/evals/issue-write-refused/graders/refusal-said-plainly.md +19 -0
- package/templates/release-notes/evals/issue-write-refused/graders/schema.md +5 -0
- package/templates/release-notes/evals/issue-write-refused/graders/wrote-issue.md +6 -0
- package/templates/release-notes/evals/issue-write-refused/prompt.md +32 -0
- package/templates/release-notes/evals/late-arrival/case.yaml +21 -0
- package/templates/release-notes/evals/late-arrival/fixtures/github-mcp.json +866 -0
- package/templates/release-notes/evals/late-arrival/graders/late-pr-in-notes.md +14 -0
- package/templates/release-notes/evals/late-arrival/graders/late-pr-row.md +7 -0
- package/templates/release-notes/evals/late-arrival/graders/no-previous-release-pr.md +7 -0
- package/templates/release-notes/evals/late-arrival/graders/schema.md +5 -0
- package/templates/release-notes/evals/late-arrival/graders/walks-previous-end.md +8 -0
- package/templates/release-notes/evals/late-arrival/prompt.md +6 -0
- package/templates/release-notes/evals/learned-style/case.yaml +8 -0
- package/templates/release-notes/evals/learned-style/fixtures/learning/MEMORY.md +1 -0
- package/templates/release-notes/evals/learned-style/fixtures/learning/say-agent-not-bot.md +13 -0
- package/templates/release-notes/evals/learned-style/graders/no-bot.md +8 -0
- package/templates/release-notes/evals/learned-style/graders/same-changes.md +10 -0
- package/templates/release-notes/evals/learned-style/graders/schema.md +5 -0
- package/templates/release-notes/evals/learned-style/prompt.md +71 -0
- package/templates/release-notes/evals/no-pr-numbers-on-top/case.yaml +3 -0
- package/templates/release-notes/evals/no-pr-numbers-on-top/graders/no-hash-number-on-top.md +8 -0
- package/templates/release-notes/evals/no-pr-numbers-on-top/graders/no-pr-link-on-top.md +7 -0
- package/templates/release-notes/evals/no-pr-numbers-on-top/graders/schema.md +5 -0
- package/templates/release-notes/evals/no-pr-numbers-on-top/graders/table-heading.md +7 -0
- package/templates/release-notes/evals/no-pr-numbers-on-top/prompt.md +62 -0
- package/templates/release-notes/evals/upgrade-line/case.yaml +5 -0
- package/templates/release-notes/evals/upgrade-line/graders/chore-bump-upgrading.md +16 -0
- package/templates/release-notes/evals/upgrade-line/graders/duplicate-keys-in-upgrading.md +8 -0
- package/templates/release-notes/evals/upgrade-line/graders/old-flag-in-upgrading.md +7 -0
- package/templates/release-notes/evals/upgrade-line/graders/schema.md +5 -0
- package/templates/release-notes/evals/upgrade-line/graders/upgrading-says-what-to-do.md +14 -0
- package/templates/release-notes/evals/upgrade-line/prompt.md +78 -0
- package/templates/release-notes/evals/user-facing-only/case.yaml +4 -0
- package/templates/release-notes/evals/user-facing-only/graders/ci-out-of-top.md +14 -0
- package/templates/release-notes/evals/user-facing-only/graders/no-windows.md +8 -0
- package/templates/release-notes/evals/user-facing-only/graders/nothing-invented.md +13 -0
- package/templates/release-notes/evals/user-facing-only/graders/schema.md +5 -0
- package/templates/release-notes/evals/user-facing-only/prompt.md +113 -0
- package/templates/release-notes/notes.schema.json +145 -0
- package/templates/release-notes/rules/STYLE.md +47 -0
- package/templates/release-notes/skills/release-notes/SKILL.md +311 -0
- package/dist/console/assets/index-34jfpIbQ.js +0 -481
- package/dist/console/assets/index-DUHbWcIP.css +0 -1
- package/dist/trigger-secrets.d.ts +0 -32
- package/dist/trigger-secrets.js +0 -143
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
// An agent's saved browser sign-ins, over the one store (A: store.signIns), the store-backed replacement for sign-ins.ts's
|
|
2
|
+
// file store (the browser sign-in rules, the E1 store half of the E1/E2/E3 split). The cookies stay at the browser's vendor (a
|
|
3
|
+
// Browserbase context, a Kernel profile); this server keeps one sealed pointer per agent and provider, sealed with the
|
|
4
|
+
// store's one rule (store/seal.ts, AAD sign_ins|<agent>:<provider>|pointer), never served, never written to a run in the
|
|
5
|
+
// clear. Only the owner reads a sign-in's name ("default") and state. A run gets the pointer only at its launch, over its
|
|
6
|
+
// secrets' pipe (E2's run path), and its served output is cut by every handed pointer (E3's readers).
|
|
7
|
+
//
|
|
8
|
+
// Forgetting a sign-in moves its pointer into a sealed tombstone (kept only to cut it from what a run it was handed shows),
|
|
9
|
+
// and is refused while a running run holds the pointer's hash in its sign_in_handed list. The forget is one store
|
|
10
|
+
// transaction, which is the per-agent lock a launch shares: the store's one writer serializes it with the launch that
|
|
11
|
+
// writes sign_in_handed.
|
|
12
|
+
import { createHash } from "node:crypto";
|
|
13
|
+
import { ApiError } from "./errors.js";
|
|
14
|
+
import { signInSecretMeta } from "./sign-ins-secrets.js";
|
|
15
|
+
import { sealColumn, sealedAt, SignInHandedTo, SignInMissing, unsealColumn } from "./store/index.js";
|
|
16
|
+
/** The one saved sign-in an agent keeps per provider is named this; the owner's label, never the model's. */
|
|
17
|
+
export const SIGN_IN_NAME = "default";
|
|
18
|
+
/** The SHA-256 of a sign-in pointer: what a run's launch keeps (sign_in_handed), and what forget asks after. Never the
|
|
19
|
+
* pointer. */
|
|
20
|
+
export const pointerHash = (pointer) => createHash("sha256").update(pointer, "utf8").digest("hex");
|
|
21
|
+
/** Refuses an agent or provider holding ":", before it is used in a composite seal binding (store/seal.ts refuses it too;
|
|
22
|
+
* this names it the same way for every entry point). */
|
|
23
|
+
function checkParts(agentId, provider) {
|
|
24
|
+
for (const part of [agentId, provider])
|
|
25
|
+
if (part.includes(":"))
|
|
26
|
+
throw new Error(`a sign-in's agent and provider never hold ":": ${JSON.stringify(part)}`);
|
|
27
|
+
}
|
|
28
|
+
/** Opens a sealed pointer under this server's seal key and binding; undefined when it does not open (no key, another key,
|
|
29
|
+
* or damaged). */
|
|
30
|
+
function open(sealKey, agentId, provider, pointerSealed) {
|
|
31
|
+
if (!sealKey)
|
|
32
|
+
return undefined;
|
|
33
|
+
try {
|
|
34
|
+
return unsealColumn(sealKey, sealedAt.signIn(agentId, provider), pointerSealed).toString("utf8");
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/** Saves the one live sign-in for the agent and provider: its pointer sealed, its name (default SIGN_IN_NAME), inserted or
|
|
41
|
+
* replaced in place. Refused with no seal key (a pointer is never kept in the clear). */
|
|
42
|
+
/** Saves the agent's first sign-in for the provider only when it has none, in the store's one atomic step (saveIfAbsent):
|
|
43
|
+
* `saved` true with the row it inserted, or false with the live row another save left, never the one asked for. Refused
|
|
44
|
+
* with no seal key, as saveSignIn is. */
|
|
45
|
+
export async function saveSignInIfAbsent(store, sealKey, signIn) {
|
|
46
|
+
if (!sealKey)
|
|
47
|
+
throw new Error("this server keeps no sign-in without a seal key, never in the clear");
|
|
48
|
+
checkParts(signIn.agentId, signIn.provider);
|
|
49
|
+
const pointerSealed = sealColumn(sealKey, sealedAt.signIn(signIn.agentId, signIn.provider), signIn.pointer);
|
|
50
|
+
return store.signIns.saveIfAbsent({ agentId: signIn.agentId, provider: signIn.provider, name: signIn.name ?? SIGN_IN_NAME, pointerSealed });
|
|
51
|
+
}
|
|
52
|
+
export async function saveSignIn(store, sealKey, signIn) {
|
|
53
|
+
if (!sealKey)
|
|
54
|
+
throw new Error("this server keeps no sign-in without a seal key, never in the clear");
|
|
55
|
+
checkParts(signIn.agentId, signIn.provider);
|
|
56
|
+
const pointerSealed = sealColumn(sealKey, sealedAt.signIn(signIn.agentId, signIn.provider), signIn.pointer);
|
|
57
|
+
const row = await store.signIns.save({ agentId: signIn.agentId, provider: signIn.provider, name: signIn.name ?? SIGN_IN_NAME, pointerSealed });
|
|
58
|
+
return { name: row.name, provider: row.provider, saved_at: row.savedAt, state: "ready" };
|
|
59
|
+
}
|
|
60
|
+
/** The agent's saved sign-ins, as the owner sees them (never a pointer): each with its name, when it was saved, and whether
|
|
61
|
+
* it opens under this server's seal key (ready) or not (unreadable). */
|
|
62
|
+
export async function savedSignIns(store, sealKey, agentId) {
|
|
63
|
+
const rows = await store.signIns.list(agentId);
|
|
64
|
+
return rows.map((row) => ({
|
|
65
|
+
name: row.name,
|
|
66
|
+
provider: row.provider,
|
|
67
|
+
saved_at: row.savedAt,
|
|
68
|
+
state: open(sealKey, agentId, row.provider, row.pointerSealed) === undefined ? "unreadable" : "ready",
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
/** The pointer of the agent's sign-in for the provider, read only: for a run's launch to hand it (E2). `unreadable` when
|
|
72
|
+
* the agent keeps one that does not open under this server's seal key (no key now, another, or damaged); undefined when it
|
|
73
|
+
* has none. No lease is taken, nothing is written. */
|
|
74
|
+
export async function openSavedPointer(store, sealKey, agentId, provider) {
|
|
75
|
+
const row = await store.signIns.get(agentId, provider);
|
|
76
|
+
if (!row)
|
|
77
|
+
return undefined;
|
|
78
|
+
const pointer = open(sealKey, agentId, provider, row.pointerSealed);
|
|
79
|
+
return pointer === undefined ? "unreadable" : { pointer };
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The sign-in run `claim.runId`'s browser starts from on the runner, read from the store under that run's own claim: its
|
|
83
|
+
* agent's saved pointer for `resolution`'s vendor, opened under `sealKey`. The runner is one process holding many claims,
|
|
84
|
+
* so this is the only way a run gets its pointer there (never the process's environment or secrets' pipe, which the old
|
|
85
|
+
* per-run process read with handedSignIn).
|
|
86
|
+
*
|
|
87
|
+
* As the old launch did, the run keeps that it was handed the pointer (its hash added to sign_in_handed, under the claim)
|
|
88
|
+
* before it is handed it, so a forget sees the run: one it could not keep (a stale or lost claim: Fenced) is handed none.
|
|
89
|
+
* The pointer is read again after that write: a forget that landed between the two moved it to a tombstone, and the run
|
|
90
|
+
* is handed none. It saves to it as the store answers that same write (the save lease, in its transaction: never two
|
|
91
|
+
* runs of one sign-in at once, a Browserbase one held for its settle window past a run that left running). None, too, with no seal key, a pointer that does not open, a browser that keeps none, or
|
|
92
|
+
* an agent that saved none for the vendor. Never throws, and never names the pointer.
|
|
93
|
+
*/
|
|
94
|
+
export async function runSignIn(store, sealKey, claim, resolution, options = {}) {
|
|
95
|
+
const vendor = (() => { try {
|
|
96
|
+
return vendorOf(resolution);
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
return undefined;
|
|
100
|
+
} })();
|
|
101
|
+
if (!vendor || !sealKey)
|
|
102
|
+
return undefined;
|
|
103
|
+
try {
|
|
104
|
+
const run = await store.runs.get(claim.runId);
|
|
105
|
+
if (!run)
|
|
106
|
+
return undefined;
|
|
107
|
+
let opened = await openSavedPointer(store, sealKey, run.agentId, vendor);
|
|
108
|
+
// None saved for the vendor: the agent's first one is made now, at the run's launch, as main's forRun makes it.
|
|
109
|
+
if (opened === undefined && options.vendors)
|
|
110
|
+
opened = await firstSignIn(store, sealKey, run.agentId, vendor, options.vendors, options.log);
|
|
111
|
+
if (opened === undefined || opened === "unreadable")
|
|
112
|
+
return undefined;
|
|
113
|
+
const hash = pointerHash(opened.pointer);
|
|
114
|
+
const before = run.signInHanded ?? [];
|
|
115
|
+
// Always written, even when the hash is there already: the write is the claim's fence. Whether this run saves to the
|
|
116
|
+
// sign-in is the store's answer to this same write (its save lease, in the write's transaction), so two binds of one
|
|
117
|
+
// sign-in never both save; Browserbase's lease outlives a run that left running by its settle window.
|
|
118
|
+
const { save } = await store.runs.update(claim, { signInHanded: before.includes(hash) ? [...before] : [...before, hash] }, { signInSettleMs: settleFor(vendor) });
|
|
119
|
+
const now = await openSavedPointer(store, sealKey, run.agentId, vendor);
|
|
120
|
+
if (now === undefined || now === "unreadable" || now.pointer !== opened.pointer)
|
|
121
|
+
return undefined;
|
|
122
|
+
return { provider: vendor, ref: opened.pointer, save: save === true };
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
return undefined;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/** A vendor call's failure in words that name no pointer and no URL: vendorsOver's own ("<vendor> answered <status>",
|
|
129
|
+
* "<vendor> unreachable (<error name>)", "this server has no <vendor> to call"), else the vendor and the error's name. */
|
|
130
|
+
function vendorWords(vendor, error) {
|
|
131
|
+
const message = error?.message ?? "";
|
|
132
|
+
const known = new RegExp(`^(${vendor} answered \\d{3}|${vendor} unreachable \\([A-Za-z]+\\)|this server has no ${vendor} to call)$`);
|
|
133
|
+
return known.test(message) ? message : `${vendor} failed (${error?.name ?? "Error"})`;
|
|
134
|
+
}
|
|
135
|
+
/** The agent's first sign-in for `vendor`, made at the vendor now (a Browserbase context, a Kernel profile) and saved at
|
|
136
|
+
* once, sealed, as main's forRun makes it: the saved pointer, opened. One another run saved meanwhile is the agent's: the
|
|
137
|
+
* object this made goes at the vendor, never left holding nothing, and the saved one is answered. A create or a save
|
|
138
|
+
* that fails starts the run signed out (undefined), said in the run's log in words that name no pointer. */
|
|
139
|
+
async function firstSignIn(store, sealKey, agentId, vendor, vendors, log) {
|
|
140
|
+
let made;
|
|
141
|
+
try {
|
|
142
|
+
made = await vendors.create(vendor);
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
// vendorsOver's words name the vendor and its answer, never a pointer.
|
|
146
|
+
log?.(`its browser starts signed out: ${vendorWords(vendor, error)}`);
|
|
147
|
+
return undefined;
|
|
148
|
+
}
|
|
149
|
+
// As far as it answers: the run goes on either way, and a delete that fails is said in the run's log, in the vendor's
|
|
150
|
+
// name and its answer alone (vendorsOver's words; any other's, the error's name), never a pointer or a URL.
|
|
151
|
+
const gone = () => vendors.remove(vendor, made).catch((error) => log?.(`its browser's extra sign-in could not be removed: ${vendorWords(vendor, error)}`));
|
|
152
|
+
let won;
|
|
153
|
+
try {
|
|
154
|
+
won = await saveSignInIfAbsent(store, sealKey, { agentId, provider: vendor, pointer: made });
|
|
155
|
+
}
|
|
156
|
+
catch {
|
|
157
|
+
// Never kept, so never forgotten: the object just made goes at the vendor now, as far as it answers.
|
|
158
|
+
await gone();
|
|
159
|
+
log?.("its browser starts signed out: its first sign-in could not be saved");
|
|
160
|
+
return undefined;
|
|
161
|
+
}
|
|
162
|
+
// Another run's first one won (the store's one atomic step): ours goes at the vendor, and the winner's is the agent's,
|
|
163
|
+
// the one this run is handed. Exactly one object is left, saved.
|
|
164
|
+
if (!won.saved)
|
|
165
|
+
await gone();
|
|
166
|
+
const pointer = open(sealKey, agentId, vendor, won.row.pointerSealed);
|
|
167
|
+
if (pointer === undefined) {
|
|
168
|
+
// The winner's sign-in won't open under this server's seal key: the run starts signed out, said as every other path.
|
|
169
|
+
log?.("its browser starts signed out: the saved sign-in can't be opened here");
|
|
170
|
+
return "unreadable";
|
|
171
|
+
}
|
|
172
|
+
return { pointer };
|
|
173
|
+
}
|
|
174
|
+
/** Whether every sign-in run `run` was handed (its sign_in_handed hashes) reads back here: a live sign-in of its agent, or
|
|
175
|
+
* a kept tombstone of one, that opens under `sealKey` to a pointer of that hash. One that does not (its seal does not open
|
|
176
|
+
* here, or nothing of it is kept) means the run's text could hold a pointer nothing can cut, so the run must not go on:
|
|
177
|
+
* main's UNREADABLE_SIGN_IN (runs.ts). A run handed none reads back. */
|
|
178
|
+
export async function handedSignInReadsBack(store, sealKey, run) {
|
|
179
|
+
const handed = run.signInHanded ?? [];
|
|
180
|
+
if (handed.length === 0)
|
|
181
|
+
return true;
|
|
182
|
+
if (!sealKey)
|
|
183
|
+
return false;
|
|
184
|
+
const known = new Set();
|
|
185
|
+
for (const row of await store.signIns.list(run.agentId)) {
|
|
186
|
+
const pointer = open(sealKey, run.agentId, row.provider, row.pointerSealed);
|
|
187
|
+
if (pointer !== undefined)
|
|
188
|
+
known.add(pointerHash(pointer));
|
|
189
|
+
}
|
|
190
|
+
for (const provider of ["browserbase", "kernel"]) {
|
|
191
|
+
for (const tomb of await store.signIns.tombstones(run.agentId, provider)) {
|
|
192
|
+
const pointer = open(sealKey, run.agentId, provider, tomb.pointerSealed);
|
|
193
|
+
if (pointer !== undefined)
|
|
194
|
+
known.add(pointerHash(pointer));
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return handed.every((hash) => known.has(hash));
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* A run on the runner saved its sign-in at `at` (a session that saved to it ended): the sign-in's verified_at, as main's
|
|
201
|
+
* lease end fills it from the run's saved mark. Only under the run's own claim, for what it was handed to save: the
|
|
202
|
+
* agent is the run's own (never the caller's word), its saved pointer is still the one handed, its hash is in the run's
|
|
203
|
+
* sign_in_handed, and the claim still holds the run (a fenced write first: a stale or lost claim verifies nothing). The
|
|
204
|
+
* stamp is conditioned on the save read with the pointer (its number, ifSave), so a sign-in saved afresh meanwhile is never
|
|
205
|
+
* marked by this save. True when the store stamped. Never throws, and never names the pointer.
|
|
206
|
+
*/
|
|
207
|
+
export async function verifyRunSignIn(store, sealKey, claim, signIn, at) {
|
|
208
|
+
if (!signIn.save || !sealKey || !Number.isFinite(at))
|
|
209
|
+
return false;
|
|
210
|
+
try {
|
|
211
|
+
const run = await store.runs.get(claim.runId);
|
|
212
|
+
if (!run || !run.signInHanded?.includes(pointerHash(signIn.ref)))
|
|
213
|
+
return false;
|
|
214
|
+
// The saved sign-in, read once: its pointer is the one handed, and its save number is what the stamp is conditioned on,
|
|
215
|
+
// so an owner's fresh save between this read and the stamp is never marked verified by this run's save.
|
|
216
|
+
const row = await store.signIns.get(run.agentId, signIn.provider);
|
|
217
|
+
if (!row || open(sealKey, run.agentId, signIn.provider, row.pointerSealed) !== signIn.ref)
|
|
218
|
+
return false;
|
|
219
|
+
await store.runs.update(claim, { signInHanded: [...run.signInHanded] });
|
|
220
|
+
return await store.signIns.verify(run.agentId, signIn.provider, at, { ifSave: row.save });
|
|
221
|
+
}
|
|
222
|
+
catch {
|
|
223
|
+
return false;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
/** The pointers of the agent's forgotten sign-ins for the provider that open under this server's seal key, and whether any
|
|
227
|
+
* does not: for cutting a handed pointer from what a run still going shows, after its sign-in was forgotten (E3/the
|
|
228
|
+
* runner). Never a live sign-in. */
|
|
229
|
+
export async function forgottenPointers(store, sealKey, agentId, provider) {
|
|
230
|
+
const tombstones = await store.signIns.tombstones(agentId, provider);
|
|
231
|
+
const opened = tombstones.map((t) => open(sealKey, agentId, provider, t.pointerSealed));
|
|
232
|
+
return { pointers: opened.filter((p) => p !== undefined), unreadable: opened.some((p) => p === undefined) };
|
|
233
|
+
}
|
|
234
|
+
/** Forgets the agent's live sign-in for the provider. In one store transaction (the lock a launch shares): refused with
|
|
235
|
+
* SignInHandedTo while a running run holds this pointer's hash in its sign_in_handed (or, when the pointer does not open,
|
|
236
|
+
* while any running run was handed a sign-in at all — any such run may hold it); otherwise the sealed pointer moves to a
|
|
237
|
+
* tombstone (the newest kept) and the live row goes. The vendor's object is then deleted, best effort (what failed is
|
|
238
|
+
* said; this server no longer points to it either way). SignInMissing when the agent has no sign-in for the provider. */
|
|
239
|
+
export async function forgetSignIn(store, sealKey, vendors, agentId, provider) {
|
|
240
|
+
checkParts(agentId, provider);
|
|
241
|
+
const row = await store.signIns.get(agentId, provider);
|
|
242
|
+
if (!row)
|
|
243
|
+
throw new SignInMissing(agentId, provider);
|
|
244
|
+
const pointer = open(sealKey, agentId, provider, row.pointerSealed);
|
|
245
|
+
// The atomic hold check and move: a running run holding the hash (or, for a pointer that does not open, any handed run)
|
|
246
|
+
// refuses it, nothing written. Throws SignInHandedTo or SignInMissing.
|
|
247
|
+
await store.signIns.forget(agentId, provider, pointer === undefined ? { heldUnreadable: true } : { hash: pointerHash(pointer) });
|
|
248
|
+
// Moved here and the live row gone: the vendor object is deleted best effort. A pointer that did not open cannot be.
|
|
249
|
+
if (pointer === undefined)
|
|
250
|
+
return { provider, at_vendor: "not_deleted", message: "its pointer does not open under this server's seal key, so its object could not be deleted at the vendor. This server no longer points to it." };
|
|
251
|
+
const error = await vendors.remove(provider, pointer).then(() => undefined, (e) => e);
|
|
252
|
+
return error
|
|
253
|
+
? { provider, at_vendor: "not_deleted", message: `Not deleted at ${provider}: ${error.message}. This server no longer points to it.` }
|
|
254
|
+
: { provider, at_vendor: "deleted" };
|
|
255
|
+
}
|
|
256
|
+
/** Which run still going was handed the sign-in whose pointer hashes to `hash`, if one was: the check the runner makes
|
|
257
|
+
* before it serves a run's output. Exposes store.signIns.handedHolder. */
|
|
258
|
+
export async function handedTo(store, hash) {
|
|
259
|
+
return store.signIns.handedHolder(hash);
|
|
260
|
+
}
|
|
261
|
+
export { SignInHandedTo, SignInMissing };
|
|
262
|
+
// ---------------------------------------------------------------------------------------------------------------------
|
|
263
|
+
// View bridge: the old SignIns interface's shapes (sign-ins.ts), byte for byte, so the v2 API answers unchanged when the
|
|
264
|
+
// switch wires the store version in. The lease and Browserbase-settle machinery is gone; a sign-in is "held" when a live
|
|
265
|
+
// run (running, not final) was handed its pointer's hash (store.signIns.handedHolder), and verified_at is the time a run
|
|
266
|
+
// last verified it (store column, written by E2's run path through store.signIns.verify).
|
|
267
|
+
/** Browserbase writes a saved context back after its session ends (pi-browser waits for it), so the saver's save lease must
|
|
268
|
+
* outlast its run leaving 'running' by this long, or the next run saves over a write-back in flight. Main's constant and
|
|
269
|
+
* value (sign-ins.ts); the serve layer's policy, passed to the store as signInSettleMs. Kernel and others keep none. */
|
|
270
|
+
export const BROWSERBASE_SETTLE_MS = 10_000;
|
|
271
|
+
/** The settle window a provider's save lease outlives its run leaving 'running' by: Browserbase's, and none for the rest. */
|
|
272
|
+
const settleFor = (provider) => (provider === "browserbase" ? BROWSERBASE_SETTLE_MS : 0);
|
|
273
|
+
/** The vendor a run's browser resolves to keeps a sign-in for: Browserbase's and Kernel's; a local Chrome is refused by
|
|
274
|
+
* name; an unavailable browser has none. Ported from sign-ins.ts. */
|
|
275
|
+
export function vendorOf(resolution) {
|
|
276
|
+
if (resolution === "browserbase" || resolution === "kernel")
|
|
277
|
+
return resolution;
|
|
278
|
+
if (resolution === "chrome" || resolution === "cdp")
|
|
279
|
+
throw new Error("a local Chrome keeps no saved sign-in: its cookies would sit on this server's disk");
|
|
280
|
+
return undefined;
|
|
281
|
+
}
|
|
282
|
+
const isoOf = (ms) => (ms === null ? null : new Date(ms).toISOString());
|
|
283
|
+
/** The agent's sign-ins as the v2 API shows them (the old SignIns.view), never a pointer. Per sign-in: `held`/`held_by`
|
|
284
|
+
* when a live run holds its pointer's hash (store.signIns.handedHolder), a Browserbase one for its settle window past the
|
|
285
|
+
* run's end too (settleFor, so the view matches the save lease); `unreadable` when its pointer does not open under this
|
|
286
|
+
* server's seal key (then held_by is null — no hash to match a run by); `verified_at` from the store; and `secret`, its
|
|
287
|
+
* secret's metadata, changed_at being its saved_at. */
|
|
288
|
+
export async function signInViews(store, sealKey, agentId) {
|
|
289
|
+
const rows = await store.signIns.list(agentId);
|
|
290
|
+
return Promise.all(rows.map(async (row) => {
|
|
291
|
+
const pointer = open(sealKey, agentId, row.provider, row.pointerSealed);
|
|
292
|
+
const heldBy = pointer === undefined ? null : (await store.signIns.handedHolder(pointerHash(pointer), { settleMs: settleFor(row.provider) })) ?? null;
|
|
293
|
+
const base = { key: row.name, provider: row.provider, held_by: heldBy, verified_at: isoOf(row.verifiedAt) };
|
|
294
|
+
const secret = signInSecretMeta(row);
|
|
295
|
+
if (pointer === undefined)
|
|
296
|
+
return { ...base, state: "unreadable", secret };
|
|
297
|
+
return { ...base, state: heldBy ? "held" : "ready", secret };
|
|
298
|
+
}));
|
|
299
|
+
}
|
|
300
|
+
/** The pointer of the agent's sign-in for `resolution`'s vendor (the old SignIns.peek): `{ ref }`, `unreadable` when it
|
|
301
|
+
* does not open, or undefined when there is none or the browser keeps none. */
|
|
302
|
+
export async function peekSignIn(store, sealKey, agentId, resolution) {
|
|
303
|
+
const vendor = (() => { try {
|
|
304
|
+
return vendorOf(resolution);
|
|
305
|
+
}
|
|
306
|
+
catch {
|
|
307
|
+
return undefined;
|
|
308
|
+
} })();
|
|
309
|
+
if (!vendor)
|
|
310
|
+
return undefined;
|
|
311
|
+
const opened = await openSavedPointer(store, sealKey, agentId, vendor);
|
|
312
|
+
return opened === undefined ? undefined : opened === "unreadable" ? "unreadable" : { ref: opened.pointer };
|
|
313
|
+
}
|
|
314
|
+
/** The agent's forgotten pointers for `resolution`'s vendor that open here, and whether any does not (the old
|
|
315
|
+
* SignIns.forgotten): `{ refs, unreadable }`, or `{ refs: [], unreadable: false }` for a browser that keeps none. */
|
|
316
|
+
export async function forgottenSignIns(store, sealKey, agentId, resolution) {
|
|
317
|
+
const vendor = (() => { try {
|
|
318
|
+
return vendorOf(resolution);
|
|
319
|
+
}
|
|
320
|
+
catch {
|
|
321
|
+
return undefined;
|
|
322
|
+
} })();
|
|
323
|
+
if (!vendor)
|
|
324
|
+
return { refs: [], unreadable: false };
|
|
325
|
+
const { pointers, unreadable } = await forgottenPointers(store, sealKey, agentId, vendor);
|
|
326
|
+
return { refs: pointers, unreadable };
|
|
327
|
+
}
|
|
328
|
+
/** Forgets the agent's sign-in named `key`, across every provider that keeps it (the old SignIns.forget): each held check
|
|
329
|
+
* runs first, so one held refuses the whole forget (409 sign_in_held) and removes none; then each is moved to a tombstone
|
|
330
|
+
* and deleted at its vendor best effort. 404 when the agent has no sign-in named `key`. */
|
|
331
|
+
export async function forgetSignInView(store, sealKey, vendors, agentId, key) {
|
|
332
|
+
const named = (await store.signIns.list(agentId)).filter((row) => row.name === key);
|
|
333
|
+
if (!named.length)
|
|
334
|
+
throw new ApiError("not_found", `The agent ${agentId} has no sign-in ${key}.`);
|
|
335
|
+
// Check every provider's hold before removing any: a sign-in handed to a running run refuses the whole forget.
|
|
336
|
+
for (const row of named) {
|
|
337
|
+
const pointer = open(sealKey, agentId, row.provider, row.pointerSealed);
|
|
338
|
+
const runId = pointer === undefined ? await store.signIns.handedAny() : await store.signIns.handedHolder(pointerHash(pointer));
|
|
339
|
+
if (runId)
|
|
340
|
+
throw new ApiError("sign_in_held", `The sign-in ${key} was handed to the run ${runId}, which is still going: forget it once that run ends.`, { details: { handed_to: runId } });
|
|
341
|
+
}
|
|
342
|
+
const removed = [];
|
|
343
|
+
for (const row of named) {
|
|
344
|
+
try {
|
|
345
|
+
removed.push({ ...(await forgetSignIn(store, sealKey, vendors, agentId, row.provider)), provider: row.provider });
|
|
346
|
+
}
|
|
347
|
+
catch (error) {
|
|
348
|
+
// A run grabbed it between the pre-check and the move (server and runner are separate processes): the store's forget
|
|
349
|
+
// refused it atomically; map it to the same 409 the pre-check raises.
|
|
350
|
+
if (error instanceof SignInHandedTo)
|
|
351
|
+
throw new ApiError("sign_in_held", `The sign-in ${key} was handed to the run ${error.runId}, which is still going: forget it once that run ends.`, { details: { handed_to: error.runId } });
|
|
352
|
+
throw error;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
return { key, removed };
|
|
356
|
+
}
|
|
357
|
+
/** The reads that find what a run was handed (handed-values.ts handedValuesOf): an agent's live pointer and its
|
|
358
|
+
* forgotten ones, opened under `sealKey`. Read-only: what the runner's learning end holds to refuse a run's pointer. */
|
|
359
|
+
export function signInReads(store, sealKey) {
|
|
360
|
+
return {
|
|
361
|
+
peek: (agentId, resolution) => peekSignIn(store, sealKey, agentId, resolution),
|
|
362
|
+
forgotten: (agentId, resolution) => forgottenSignIns(store, sealKey, agentId, resolution),
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
/** The old SignIns interface's read and forget surface over the store (view, peek, forgotten, forget), so the switch can
|
|
366
|
+
* wire it where `new SignIns(...)` was, with the v2 answers unchanged. */
|
|
367
|
+
export function signInsOverStore(store, sealKey, vendors) {
|
|
368
|
+
return {
|
|
369
|
+
view: (agentId) => signInViews(store, sealKey, agentId),
|
|
370
|
+
...signInReads(store, sealKey),
|
|
371
|
+
forget: (agentId, key) => forgetSignInView(store, sealKey, vendors, agentId, key),
|
|
372
|
+
};
|
|
373
|
+
}
|
package/dist/sign-ins.d.ts
CHANGED
|
@@ -34,6 +34,15 @@ export declare const BROWSERBASE_SETTLE_MS = 10000;
|
|
|
34
34
|
* sessionTimeoutS, 1800 s), which every session a run opens is created under, so none it opened before its process
|
|
35
35
|
* went can still write back after it. A holder that comes back (its relaunch) holds the lease again from then on. */
|
|
36
36
|
export declare const GONE_LEASE_MS = 1800000;
|
|
37
|
+
/** How many forgotten pointers an agent keeps, the oldest dropped first. A run handed one dropped since is withheld, as
|
|
38
|
+
* one whose sign-in does not open is (runs.ts): its pointer could no longer be cut. */
|
|
39
|
+
export declare const MAX_FORGOTTEN = 32;
|
|
40
|
+
/** What a run's serve.json keeps of the sign-in pointer it was handed (runs.ts `sign_in_handed`), and what forget asks
|
|
41
|
+
* after: its SHA-256, never the pointer. */
|
|
42
|
+
export declare const pointerHash: (ref: string) => string;
|
|
43
|
+
/** Which run still going was handed the sign-in whose pointer hashes to `hash` (runs.ts handedTo), if one was; `hash`
|
|
44
|
+
* undefined for a pointer that does not open here, which any run handed a sign-in may hold. */
|
|
45
|
+
export type HandedTo = (agentId: string, hash: string | undefined) => Promise<string | undefined>;
|
|
37
46
|
/** The vendor a run's browser resolves to (its plane's `browser`) keeps a sign-in for: Browserbase's and Kernel's; local
|
|
38
47
|
* Chrome is refused by name; an unavailable browser has none. */
|
|
39
48
|
export declare function vendorOf(resolution: string): Vendor | undefined;
|
|
@@ -42,14 +51,19 @@ export declare class SignIns {
|
|
|
42
51
|
private readonly key;
|
|
43
52
|
private readonly vendors;
|
|
44
53
|
private readonly holds;
|
|
45
|
-
/** One read-modify-write at a time per agent; an agent's queue goes once it is empty.
|
|
54
|
+
/** One read-modify-write at a time per agent; an agent's queue goes once it is empty. In this process alone: it, and
|
|
55
|
+
* forget's ordering against a launch handing a pointer (forRun's keep), assume one server per data directory, which
|
|
56
|
+
* the data directory's lock holds (server-lock.ts). */
|
|
46
57
|
private readonly chains;
|
|
47
58
|
private readonly now;
|
|
48
59
|
private readonly writeFile;
|
|
49
60
|
private readonly sleep;
|
|
50
|
-
|
|
51
|
-
|
|
61
|
+
private readonly handedTo;
|
|
62
|
+
/** `holds(run)`: whether that run has not ended, so a lease it names still holds; `handedTo`, which run still going
|
|
63
|
+
* was handed a pointer (runs.ts), so forget waits for it; `now` and `sleep`, the clock, and `write`, the durable
|
|
64
|
+
* write (writeDurable), the tests'. */
|
|
52
65
|
constructor(data: string, key: Buffer | undefined, vendors: Vendors, holds: (runId: string) => Promise<boolean>, options?: {
|
|
66
|
+
handedTo?: HandedTo;
|
|
53
67
|
now?: () => number;
|
|
54
68
|
sleep?: (ms: number) => Promise<void>;
|
|
55
69
|
write?: (path: string, text: string) => Promise<unknown>;
|
|
@@ -57,21 +71,41 @@ export declare class SignIns {
|
|
|
57
71
|
/** Whether sign-ins are kept here: never without a seal key, never in the clear. */
|
|
58
72
|
get available(): boolean;
|
|
59
73
|
private file;
|
|
74
|
+
private stored;
|
|
60
75
|
private read;
|
|
76
|
+
/** `forgotten`: the agent's forgotten pointers as they are to be kept; absent, those the file keeps now (every write is
|
|
77
|
+
* under the agent's lock, so none comes between). */
|
|
61
78
|
private write;
|
|
62
79
|
private locked;
|
|
63
80
|
/** Whether `entry`'s lease still holds: it names a run that has not ended; or, once its process was found gone, that
|
|
64
81
|
* went less than GONE_LEASE_MS ago, ended or not (a run waiting on its person with no process, or one that crashed and
|
|
65
82
|
* ended, is never let go otherwise, or let go too soon). */
|
|
66
83
|
private held;
|
|
67
|
-
/** `entry`'s pointer, opened under this server's seal key; undefined when it does not open (none now, or another).
|
|
84
|
+
/** `entry`'s pointer, opened under this server's seal key; undefined when it does not open (none now, or another). A
|
|
85
|
+
* forgotten one opens under the same binding, read only by `forgotten`, never as a sign-in. */
|
|
68
86
|
private open;
|
|
69
87
|
/** The agent's sign-ins, as the contract shows them: never a ref. */
|
|
70
88
|
view(agentId: string): Promise<SignInView[]>;
|
|
89
|
+
/** The pointer of `agentId`'s sign-in for `resolution`, read only: no lease taken, nothing made or written. For a run
|
|
90
|
+
* this server loads (after a restart), whose rows, errors and answers must never show it: `{ ref }`; `unreadable`
|
|
91
|
+
* when the agent keeps one that does not open under this server's seal key (none now, or another), or its sign-ins
|
|
92
|
+
* file cannot be read or parsed, told apart from none at all (undefined: no file, or no entry for the vendor). */
|
|
93
|
+
peek(agentId: string, resolution: string): Promise<{
|
|
94
|
+
ref: string;
|
|
95
|
+
} | "unreadable" | undefined>;
|
|
96
|
+
/** The pointers of `agentId`'s forgotten sign-ins for `resolution`'s vendor, read only, for a run this server loads that
|
|
97
|
+
* may have been handed one (runs.ts peekSignIn): never a sign-in. `refs`, each that opens under this server's seal
|
|
98
|
+
* key; `unreadable`, whether one does not (none now, or another). `unreadable` alone when the sign-ins file can't be
|
|
99
|
+
* read or parsed. */
|
|
100
|
+
forgotten(agentId: string, resolution: string): Promise<{
|
|
101
|
+
refs: string[];
|
|
102
|
+
unreadable: boolean;
|
|
103
|
+
} | "unreadable">;
|
|
71
104
|
/** The sign-in run `runId` of `agentId` starts from on `resolution` (its plane's browser): made at the vendor when the
|
|
72
105
|
* agent has none, then leased to this run to save, unless another run of the agent holds the lease. None for a
|
|
73
|
-
* browser that keeps none, or with no seal key.
|
|
74
|
-
|
|
106
|
+
* browser that keeps none, or with no seal key. `keep`: the run keeps that it was handed it (its serve.json), before
|
|
107
|
+
* any forget of the agent's can look (forget's handedTo, under the same lock); one it could not keep is handed none. */
|
|
108
|
+
forRun(agentId: string, runId: string, resolution: string, keep?: (handed: HandedSignIn) => Promise<boolean>): Promise<HandedSignIn | undefined>;
|
|
75
109
|
/** Run `runId`'s process was found gone: a lease it holds counts from now, while it does not come back (held). */
|
|
76
110
|
markGone(agentId: string, runId: string): Promise<void>;
|
|
77
111
|
/** Ends the lease run `runId` holds, if it holds one: it ended, or let go to wait for its person; one whose process did
|
|
@@ -79,7 +113,9 @@ export declare class SignIns {
|
|
|
79
113
|
* run directory's SIGN_IN_SAVED) makes that the sign-in's `verified_at`. */
|
|
80
114
|
release(agentId: string, runId: string, runDir: string, clean?: boolean): Promise<void>;
|
|
81
115
|
/** DELETE /agents/{id}/sign-ins/{key}: each vendor's object deleted (best effort: what failed is said), then the
|
|
82
|
-
* pointer. 404 for a key the agent has none of; 409 while a run holds it
|
|
116
|
+
* pointer. 404 for a key the agent has none of; 409 while a run holds its lease, or while a run it was handed is still
|
|
117
|
+
* going (handedTo), its lease let go or not: what that run says could repeat the pointer, and a server started after
|
|
118
|
+
* the pointer is gone could no longer read it back to cut it (runs.ts peekSignIn). */
|
|
83
119
|
forget(agentId: string, signInKey: string): Promise<{
|
|
84
120
|
key: string;
|
|
85
121
|
removed: Array<{
|