@parcha/agentrun-serve 0.1.0-beta.36 → 0.1.0-beta.38
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 +452 -0
- package/README.md +311 -142
- package/dist/agent-rows.d.ts +1 -1
- package/dist/agents-store.d.ts +35 -3
- package/dist/agents-store.js +39 -14
- package/dist/answer-json.d.ts +34 -1
- package/dist/answer-json.js +91 -9
- package/dist/api-only.d.ts +1 -1
- package/dist/api-only.js +2 -2
- 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/browser-cost.d.ts +1 -1
- package/dist/browser-cost.js +52 -93
- package/dist/browser-live.d.ts +20 -8
- package/dist/browser-live.js +50 -27
- package/dist/cap.d.ts +0 -407
- package/dist/cap.js +4 -1028
- package/dist/catalog.d.ts +1 -12
- package/dist/catalog.js +4 -34
- package/dist/cli.js +13 -4
- package/dist/composio-preset.d.ts +53 -0
- package/dist/composio-preset.js +221 -0
- package/dist/computer-attach.d.ts +125 -0
- package/dist/computer-attach.js +330 -0
- package/dist/computer-calls.d.ts +60 -0
- package/dist/computer-calls.js +209 -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 +165 -0
- package/dist/computer-live.js +655 -0
- package/dist/computer-setting.d.ts +15 -2
- package/dist/computer-setting.js +20 -4
- package/dist/computer-view.d.ts +14 -0
- package/dist/computer-view.js +51 -3
- package/dist/computer-viewer.d.ts +6 -0
- package/dist/computer-viewer.js +311 -0
- package/dist/computers.d.ts +37 -8
- package/dist/computers.js +62 -14
- package/dist/console/assets/index-CjqQirbo.css +1 -0
- package/dist/console/assets/index-b6-XY5A9.js +576 -0
- package/dist/console/index.html +2 -2
- package/dist/console-links.d.ts +2 -0
- package/dist/console-links.js +3 -0
- package/dist/decisions.js +4 -0
- package/dist/faux-computers.d.ts +9 -20
- package/dist/faux-computers.js +56 -26
- package/dist/github-connection.d.ts +10 -2
- package/dist/github-connection.js +65 -2
- package/dist/github-faux.js +1 -1
- package/dist/graph-view.d.ts +1 -1
- package/dist/harness-opencode/adapter.js +7 -3
- package/dist/harness-opencode/facts.js +0 -2
- package/dist/harness-opencode/host/policy.d.ts +2 -5
- package/dist/harness-opencode/host/policy.js +8 -32
- package/dist/harness-table.d.ts +0 -2
- package/dist/harness-table.js +0 -2
- package/dist/harness.d.ts +1 -0
- package/dist/harness.js +35 -1
- package/dist/host-tools.d.ts +2 -6
- package/dist/host-tools.js +7 -10
- package/dist/hosted-search.d.ts +5 -6
- package/dist/hosted-search.js +2 -28
- 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/key-words.d.ts +3 -2
- package/dist/key-words.js +4 -2
- package/dist/learn/check.d.ts +10 -2
- package/dist/learn/check.js +13 -5
- package/dist/learn/commit.d.ts +14 -2
- package/dist/learn/commit.js +23 -9
- package/dist/learn/compile.d.ts +243 -0
- package/dist/learn/compile.js +471 -0
- package/dist/learn/folder.d.ts +6 -0
- package/dist/learn/folder.js +4 -1
- package/dist/learn/general.d.ts +69 -0
- package/dist/learn/general.js +75 -0
- package/dist/learn/grade.d.ts +5 -1
- package/dist/learn/grade.js +29 -7
- package/dist/learn/notes.d.ts +8 -0
- package/dist/learn/notes.js +18 -0
- package/dist/learn/promote.d.ts +253 -0
- package/dist/learn/promote.js +428 -0
- package/dist/learn/refit.d.ts +39 -0
- package/dist/learn/refit.js +236 -0
- package/dist/learn/reflect.d.ts +9 -20
- package/dist/learn/reflect.js +18 -125
- package/dist/learn/replay-calls.d.ts +63 -0
- package/dist/learn/replay-calls.js +158 -0
- package/dist/learn/skills.d.ts +50 -14
- package/dist/learn/skills.js +183 -47
- package/dist/learn/workflow-nodes.d.ts +15 -0
- package/dist/learn/workflow-nodes.js +44 -0
- package/dist/learned-nodes.d.ts +50 -2
- package/dist/learned-nodes.js +41 -2
- package/dist/learned-workflow.d.ts +43 -3
- package/dist/learned-workflow.js +170 -28
- package/dist/learning-batch.d.ts +283 -0
- package/dist/learning-batch.js +574 -0
- package/dist/learning-cost.d.ts +18 -6
- package/dist/learning-cost.js +15 -7
- package/dist/learning-evals.d.ts +33 -0
- package/dist/learning-evals.js +98 -0
- package/dist/learning-routes.d.ts +37 -2
- package/dist/learning-routes.js +52 -8
- package/dist/learning-words.d.ts +13 -0
- package/dist/learning-words.js +13 -0
- package/dist/learning.d.ts +55 -17
- package/dist/learning.js +91 -48
- 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/llm.js +0 -3
- package/dist/mcp-gateway.d.ts +21 -20
- package/dist/mcp-gateway.js +76 -55
- package/dist/mcp-oauth.d.ts +62 -7
- package/dist/mcp-oauth.js +134 -19
- package/dist/mcp-pin-first.d.ts +37 -0
- package/dist/mcp-pin-first.js +107 -0
- package/dist/mcp-private-hosts.d.ts +4 -4
- package/dist/mcp-private-hosts.js +20 -12
- package/dist/mcp-probe.d.ts +27 -11
- package/dist/mcp-probe.js +60 -42
- package/dist/mcp-secret-writes.js +4 -0
- package/dist/mcp-servers-store.d.ts +115 -25
- package/dist/mcp-servers-store.js +241 -43
- package/dist/mcp-sources.d.ts +39 -0
- package/dist/mcp-sources.js +74 -0
- package/dist/mcp-store.d.ts +21 -4
- package/dist/mcp-store.js +33 -8
- package/dist/mcp-wire.d.ts +22 -0
- package/dist/mcp-wire.js +36 -0
- package/dist/mcp.js +3 -3
- package/dist/meta-tool-names.d.ts +1 -0
- package/dist/meta-tool-names.js +3 -0
- package/dist/model-form.d.ts +26 -0
- package/dist/model-form.js +80 -0
- package/dist/model.d.ts +13 -0
- package/dist/model.js +69 -25
- package/dist/monid.d.ts +51 -25
- package/dist/monid.js +226 -140
- package/dist/openapi.js +694 -59
- package/dist/page.d.ts +18 -0
- package/dist/page.js +48 -20
- package/dist/paid-calls.d.ts +26 -29
- package/dist/paid-calls.js +46 -102
- package/dist/place-offers.d.ts +2 -3
- package/dist/place-offers.js +3 -7
- package/dist/place.js +1 -2
- package/dist/print.d.ts +15 -1
- package/dist/print.js +14 -3
- package/dist/propose.d.ts +10 -1
- package/dist/propose.js +30 -10
- package/dist/provider.js +12 -4
- package/dist/reflect-range.d.ts +8 -1
- package/dist/reflect-range.js +3 -2
- package/dist/rows.d.ts +5 -3
- package/dist/rows.js +15 -4
- package/dist/run-launch.d.ts +27 -2
- package/dist/run-launch.js +15 -4
- package/dist/run-learning-served.d.ts +13 -2
- package/dist/run-manifest.d.ts +5 -0
- package/dist/run-manifest.js +20 -0
- 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 +2 -3
- package/dist/run-timeline-served.d.ts +1 -1
- package/dist/run-timeline-served.js +5 -2
- package/dist/run-view.d.ts +19 -8
- package/dist/run-view.js +62 -26
- package/dist/runnable.d.ts +0 -3
- package/dist/runnable.js +37 -29
- package/dist/runner/adapter-loop.d.ts +47 -17
- package/dist/runner/adapter-loop.js +1427 -303
- package/dist/runner/adapter-run-spec.d.ts +23 -9
- package/dist/runner/adapter-run-spec.js +162 -56
- package/dist/runner/adapters/pi-computer.d.ts +9 -0
- package/dist/runner/adapters/pi-computer.js +51 -0
- package/dist/runner/adapters/pi.d.ts +25 -11
- package/dist/runner/adapters/pi.js +168 -45
- package/dist/runner/beside.d.ts +7 -3
- package/dist/runner/beside.js +21 -11
- 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 +20 -3
- package/dist/runner/cli-run-spec.js +174 -64
- package/dist/runner/commands.d.ts +3 -1
- package/dist/runner/commands.js +28 -3
- package/dist/runner/computer-channel.d.ts +34 -0
- package/dist/runner/computer-channel.js +62 -0
- package/dist/runner/conformance/harness.d.ts +3 -0
- package/dist/runner/conformance/harness.js +224 -17
- package/dist/runner/conformance/subject.d.ts +12 -5
- package/dist/runner/dispatch.js +3 -0
- package/dist/runner/end-of-run.d.ts +23 -12
- package/dist/runner/end-of-run.js +41 -16
- package/dist/runner/feedback-round.d.ts +52 -0
- package/dist/runner/feedback-round.js +79 -0
- package/dist/runner/github-app.d.ts +2 -1
- package/dist/runner/github-app.js +4 -2
- package/dist/runner/harness-loops.js +15 -1
- package/dist/runner/held-run.d.ts +65 -0
- package/dist/runner/held-run.js +158 -0
- package/dist/runner/journal-kinds.d.ts +44 -7
- package/dist/runner/journal-kinds.js +29 -0
- 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 +69 -13
- package/dist/runner/learning-end.js +340 -87
- package/dist/runner/learning-factory.d.ts +1 -1
- package/dist/runner/learning-factory.js +11 -5
- package/dist/runner/learning-loop.d.ts +86 -8
- package/dist/runner/learning-loop.js +178 -23
- package/dist/runner/learning-seed.d.ts +11 -0
- package/dist/runner/learning-seed.js +27 -0
- package/dist/runner/live-ticker.js +1 -0
- package/dist/runner/loop-contract.d.ts +26 -3
- package/dist/runner/loop.d.ts +21 -2
- package/dist/runner/loop.js +23 -2
- package/dist/runner/main.d.ts +13 -1
- package/dist/runner/main.js +27 -5
- package/dist/runner/mcp-claim.d.ts +15 -8
- package/dist/runner/mcp-claim.js +176 -71
- package/dist/runner/mcp-github.js +1 -1
- package/dist/runner/mcp-run.d.ts +21 -57
- package/dist/runner/mcp-run.js +25 -85
- package/dist/runner/meta-tools.d.ts +37 -0
- package/dist/runner/meta-tools.js +268 -0
- package/dist/runner/metrics.d.ts +11 -2
- package/dist/runner/metrics.js +26 -5
- package/dist/runner/model-route.js +12 -3
- package/dist/runner/monid-run.d.ts +16 -0
- package/dist/runner/monid-run.js +96 -0
- package/dist/runner/pr-checkout.d.ts +1 -0
- package/dist/runner/pr-checkout.js +1 -1
- package/dist/runner/promotion.d.ts +80 -0
- package/dist/runner/promotion.js +562 -0
- package/dist/runner/reflect-hook.d.ts +46 -13
- package/dist/runner/reflect-hook.js +149 -48
- package/dist/runner/runner.d.ts +26 -0
- package/dist/runner/runner.js +208 -17
- package/dist/runner/scratch-sweep.d.ts +13 -0
- package/dist/runner/scratch-sweep.js +62 -0
- package/dist/runner/sessions.d.ts +9 -4
- package/dist/runner/sessions.js +5 -1
- package/dist/runner/step-guard.d.ts +62 -0
- package/dist/runner/step-guard.js +93 -0
- package/dist/runner/store-port.d.ts +4 -2
- package/dist/runner/store-secrets.js +4 -3
- package/dist/runner/subagent.d.ts +0 -3
- package/dist/runner/subagent.js +10 -13
- package/dist/runner/workflow-first.d.ts +216 -0
- package/dist/runner/workflow-first.js +303 -0
- package/dist/runner/workflow-host.d.ts +6 -1
- package/dist/runner/workflow-host.js +1 -1
- package/dist/runner/workflow-loop.d.ts +1 -1
- package/dist/runner/workflow-loop.js +17 -10
- package/dist/runner/workflow-spec.d.ts +15 -2
- package/dist/runner/workflow-spec.js +63 -23
- package/dist/runs-over-store.d.ts +17 -3
- package/dist/runs-over-store.js +59 -20
- 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/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 +119 -18
- package/dist/server.js +841 -202
- package/dist/settings-wake.d.ts +23 -0
- package/dist/settings-wake.js +65 -0
- package/dist/standard-webhooks.d.ts +4 -1
- package/dist/standard-webhooks.js +8 -4
- package/dist/store/agent-body.d.ts +14 -3
- package/dist/store/agent-body.js +14 -10
- package/dist/store/command-wake.d.ts +13 -0
- package/dist/store/command-wake.js +37 -0
- package/dist/store/dialect.d.ts +6 -0
- package/dist/store/dialect.js +5 -0
- package/dist/store/index.d.ts +1 -1
- package/dist/store/journal/storage.d.ts +3 -2
- package/dist/store/journal/storage.js +13 -5
- package/dist/store/postgres/connection.js +3 -1
- package/dist/store/postgres/dialect.js +4 -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/postgres/migrations/0010_imported_templates.sql +18 -0
- package/dist/store/postgres/migrations/0011_revision_mcp_pin.sql +13 -0
- package/dist/store/schema.d.ts +10 -1
- package/dist/store/schema.js +104 -15
- package/dist/store/sqlite/connection.d.ts +2 -2
- package/dist/store/sqlite/connection.js +2 -2
- package/dist/store/sqlite/run-patch.d.ts +7 -5
- package/dist/store/sqlite/run-patch.js +45 -18
- package/dist/store/sqlite/store.js +331 -72
- package/dist/store/store.d.ts +312 -21
- package/dist/store/store.js +12 -1
- package/dist/store-reads/cap.d.ts +1 -1
- package/dist/store-reads/cap.js +8 -1
- package/dist/store-reads/decisions.d.ts +2 -2
- package/dist/store-reads/decisions.js +1 -1
- package/dist/store-reads/import-summary.d.ts +1 -1
- package/dist/store-reads/journal.d.ts +30 -5
- package/dist/store-reads/journal.js +128 -56
- package/dist/store-reads/learning.d.ts +114 -12
- package/dist/store-reads/learning.js +238 -48
- package/dist/store-reads/loop.d.ts +61 -0
- package/dist/store-reads/loop.js +111 -0
- package/dist/store-reads/runs.d.ts +1 -1
- package/dist/store-reads/workflow.d.ts +1 -1
- package/dist/store-view.d.ts +6 -0
- package/dist/store-view.js +59 -26
- package/dist/template-eval.d.ts +18 -9
- package/dist/template-eval.js +95 -68
- package/dist/template-github-permissions.d.ts +24 -10
- package/dist/template-github-permissions.js +36 -15
- package/dist/template-import.d.ts +31 -0
- package/dist/template-import.js +121 -0
- package/dist/template-source.d.ts +51 -0
- package/dist/template-source.js +371 -0
- package/dist/templates.d.ts +218 -46
- package/dist/templates.js +493 -181
- package/dist/timeline/computer.d.ts +48 -0
- package/dist/timeline/computer.js +169 -0
- package/dist/timeline/index.d.ts +4 -3
- package/dist/timeline/index.js +4 -3
- package/dist/timeline/labels.d.ts +6 -2
- package/dist/timeline/labels.js +93 -2
- package/dist/timeline/origin.d.ts +19 -5
- package/dist/timeline/origin.js +11 -4
- package/dist/timeline/timeline.d.ts +22 -1
- package/dist/timeline/timeline.js +34 -18
- package/dist/timeline/util.d.ts +4 -0
- package/dist/timeline/util.js +14 -0
- package/dist/tool-gate.d.ts +84 -50
- package/dist/tool-gate.js +179 -101
- package/dist/tool-keys.d.ts +4 -1
- package/dist/tool-keys.js +8 -3
- package/dist/tool-list.d.ts +26 -0
- package/dist/tool-list.js +43 -0
- package/dist/tool-names.d.ts +71 -0
- package/dist/tool-names.js +99 -0
- package/dist/tool-plane.d.ts +33 -27
- package/dist/tool-plane.js +72 -39
- package/dist/tools.d.ts +32 -7
- package/dist/tools.js +37 -24
- 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 +25 -6
- package/dist/trigger-signatures.js +41 -7
- 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 +7 -3
- package/dist/triggers.js +35 -5
- package/dist/turns.js +16 -1
- package/dist/validate.d.ts +15 -7
- package/dist/validate.js +102 -45
- package/dist/web-fetch.d.ts +2 -8
- package/dist/web-fetch.js +2 -22
- package/dist/web-search.d.ts +10 -5
- package/dist/web-search.js +7 -6
- package/dist/webhooks.d.ts +145 -102
- package/dist/webhooks.js +559 -322
- package/dist/workflow/decisions.d.ts +1 -1
- package/dist/workflow/node-runner.d.ts +2 -1
- package/dist/workflow/node.d.ts +2 -1
- package/dist/workflow/node.js +3 -1
- package/dist/workflow/pi-versions.d.ts +23 -0
- package/dist/workflow/pi-versions.js +57 -0
- package/dist/workflow/record-tool.d.ts +2 -1
- package/dist/workflow/store.d.ts +1 -1
- package/dist/workflow/task.js +3 -2
- package/dist/workflow-run.d.ts +1 -1
- package/dist/workspace/attached-computers.d.ts +41 -0
- package/dist/workspace/attached-computers.js +114 -0
- package/dist/workspace/computer-deps.d.ts +19 -9
- package/dist/workspace/computer-deps.js +24 -9
- package/dist/workspace/computer-for-claim.d.ts +23 -8
- package/dist/workspace/computer-for-claim.js +92 -33
- package/dist/workspace/computer-hold.d.ts +11 -27
- package/dist/workspace/computer-hold.js +41 -55
- package/dist/workspace/computer-ledger.d.ts +3 -1
- package/dist/workspace/computer-ledger.js +4 -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 +53 -0
- package/dist/workspace/computer-script.js +172 -0
- package/dist/workspace/executors.d.ts +1 -1
- package/dist/workspace/index.d.ts +4 -2
- package/dist/workspace/index.js +3 -1
- package/dist/workspace/kind-skills/desktop/SKILL.md +132 -84
- package/dist/workspace/kind-skills/phone/SKILL.md +104 -85
- package/dist/workspace/local.js +2 -2
- package/dist/workspace/resolve-computer.d.ts +24 -1
- package/dist/workspace/resolve-computer.js +40 -16
- package/dist/workspace/run-tools.d.ts +56 -21
- package/dist/workspace/run-tools.js +55 -34
- package/dist/wrap-up.d.ts +21 -0
- package/dist/wrap-up.js +21 -0
- package/launcher/agentrun-serve +4 -2
- package/package.json +19 -16
- package/templates/README.md +111 -45
- package/templates/code-review/agent.md +30 -14
- package/templates/code-review/evals/clean-refactor/case.yaml +2 -1
- package/templates/code-review/evals/clean-refactor/graders/head-sha.md +6 -0
- package/templates/code-review/evals/injection/case.yaml +2 -1
- package/templates/code-review/evals/injection/graders/head-sha.md +6 -0
- package/templates/code-review/evals/mentions-defused/case.yaml +2 -2
- package/templates/code-review/evals/mentions-defused/fixtures/github-mcp.json +0 -23
- package/templates/code-review/evals/mentions-defused/graders/head-sha.md +6 -0
- package/templates/code-review/evals/never-flag/case.yaml +2 -1
- package/templates/code-review/evals/never-flag/graders/head-sha.md +6 -0
- package/templates/code-review/evals/null-name/case.yaml +2 -1
- package/templates/code-review/evals/null-name/graders/head-sha.md +6 -0
- package/templates/code-review/evals/off-by-one/case.yaml +2 -1
- package/templates/code-review/evals/off-by-one/graders/head-sha.md +6 -0
- package/templates/code-review/evals/other-repo/case.yaml +16 -0
- package/templates/code-review/evals/other-repo/fixtures/github-mcp.json +130 -0
- package/templates/code-review/evals/other-repo/graders/head-sha.md +6 -0
- package/templates/code-review/evals/other-repo/graders/no-canary.md +6 -0
- package/templates/code-review/evals/other-repo/graders/no-other-repo.md +8 -0
- package/templates/code-review/evals/other-repo/graders/refused-not-quoted.md +18 -0
- package/templates/code-review/evals/other-repo/prompt.md +10 -0
- package/templates/code-review/evals/re-review/case.yaml +2 -1
- package/templates/code-review/evals/re-review/graders/head-sha.md +6 -0
- package/templates/code-review/evals/re-review-open/case.yaml +2 -1
- package/templates/code-review/evals/re-review-open/graders/head-sha.md +6 -0
- package/templates/code-review/evals/repo-rule/case.yaml +2 -1
- package/templates/code-review/evals/repo-rule/graders/head-sha.md +6 -0
- package/templates/code-review/evals/two-defects/case.yaml +2 -1
- package/templates/code-review/evals/two-defects/graders/head-sha.md +6 -0
- package/templates/code-review/rules/CODEREVIEW.md +1 -1
- package/templates/code-review/skills/review/DEEP.md +3 -2
- package/templates/code-review/skills/review/REVIEWER.md +3 -2
- package/templates/code-review/skills/review/SKILL.md +4 -3
- package/templates/code-review/{findings.schema.json → skills/review/findings.schema.json} +1 -0
- package/templates/inbound-lead/agent.md +26 -16
- package/templates/inbound-lead/evals/injection-in-form/graders/no-exfil.md +16 -0
- package/templates/inbound-lead/evals/injection-in-form/prompt.md +2 -2
- package/templates/inbound-lead/evals/write-back/case.yaml +2 -6
- package/templates/inbound-lead/evals/write-back/fixtures/fake-hubspot.json +34 -225
- package/templates/inbound-lead/evals/write-back/graders/note-and-score.md +10 -14
- package/templates/inbound-lead/evals/write-back/graders/writes-once.md +7 -0
- package/templates/inbound-lead/evals/write-back/prompt.md +1 -1
- package/templates/inbound-lead/evals/write-back-wrong-record/case.yaml +3 -7
- package/templates/inbound-lead/evals/write-back-wrong-record/fixtures/fake-hubspot.json +34 -225
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/form-id.md +17 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/no-write.md +3 -3
- package/templates/inbound-lead/evals/write-back-wrong-record/prompt.md +2 -2
- package/templates/inbound-lead/skills/lead/SKILL.md +23 -27
- package/templates/kyb/agent.md +15 -5
- package/templates/kyb/evals/adverse-media/prompt.md +2 -7
- package/templates/kyb/evals/canada-active-filed/prompt.md +2 -6
- package/templates/kyb/evals/clean-public-company/prompt.md +2 -6
- package/templates/kyb/evals/injection-in-page/prompt.md +3 -7
- package/templates/kyb/evals/name-collision/prompt.md +2 -6
- package/templates/kyb/evals/no-invention/prompt.md +2 -6
- package/templates/kyb/evals/opensanctions-on/prompt.md +2 -6
- package/templates/kyb/evals/sanctioned-entity/prompt.md +2 -6
- package/templates/kyb/kyb.schema.json +8 -7
- package/templates/kyb/skills/kyb/SKILL.md +9 -6
- package/templates/market-monitor/agent.md +19 -12
- package/templates/market-monitor/evals/post-happens/case.yaml +4 -4
- package/templates/market-monitor/evals/post-happens/fixtures/slack-mcp.json +13 -9
- package/templates/market-monitor/evals/post-happens/graders/post-is-digest.md +1 -1
- package/templates/market-monitor/evals/post-happens/graders/posted-once.md +3 -3
- package/templates/market-monitor/skills/monitor/SKILL.md +6 -4
- package/templates/release-notes/agent.md +32 -10
- package/templates/release-notes/evals/draft-not-publish/case.yaml +4 -3
- package/templates/release-notes/evals/draft-not-publish/fixtures/github-mcp.json +29 -51
- package/templates/release-notes/evals/every-pr-accounted/case.yaml +2 -1
- package/templates/release-notes/evals/issue-write-refused/case.yaml +4 -3
- package/templates/release-notes/evals/issue-write-refused/fixtures/github-mcp.json +29 -51
- package/templates/release-notes/evals/late-arrival/case.yaml +6 -5
- package/templates/release-notes/evals/late-arrival/fixtures/github-mcp.json +29 -51
- package/templates/release-notes/evals/learned-style/case.yaml +2 -1
- package/templates/release-notes/evals/no-pr-numbers-on-top/case.yaml +2 -1
- package/templates/release-notes/evals/other-repo/case.yaml +24 -0
- package/templates/release-notes/evals/other-repo/fixtures/github-mcp.json +907 -0
- package/templates/release-notes/evals/other-repo/graders/no-canary.md +7 -0
- package/templates/release-notes/evals/other-repo/graders/no-other-repo.md +8 -0
- package/templates/release-notes/evals/other-repo/graders/refused-not-quoted.md +18 -0
- package/templates/release-notes/evals/other-repo/prompt.md +32 -0
- package/templates/release-notes/evals/upgrade-line/case.yaml +2 -1
- package/templates/release-notes/evals/user-facing-only/case.yaml +2 -1
- package/templates/release-notes/notes.schema.json +1 -1
- package/templates/release-notes/skills/release-notes/SKILL.md +26 -17
- package/dist/console/assets/index-BI4Byidu.js +0 -550
- package/dist/console/assets/index-C19gUF2n.css +0 -1
- package/dist/run-db.d.ts +0 -53
- package/dist/run-db.js +0 -116
- package/dist/tool-blurbs.d.ts +0 -4
- package/dist/tool-blurbs.js +0 -28
- package/dist/tool-budget.d.ts +0 -26
- package/dist/tool-budget.js +0 -56
- package/dist/workflow/readers.d.ts +0 -36
- package/dist/workflow/readers.js +0 -145
- package/dist/workflow/wal.d.ts +0 -11
- package/dist/workflow/wal.js +0 -106
- package/templates/code-review/evals/clean-refactor/graders/schema.md +0 -5
- package/templates/code-review/evals/injection/graders/schema.md +0 -5
- package/templates/code-review/evals/mentions-defused/graders/schema.md +0 -5
- package/templates/code-review/evals/never-flag/graders/schema.md +0 -5
- package/templates/code-review/evals/null-name/graders/schema.md +0 -5
- package/templates/code-review/evals/off-by-one/graders/schema.md +0 -5
- package/templates/code-review/evals/re-review/graders/schema.md +0 -5
- package/templates/code-review/evals/re-review-open/graders/schema.md +0 -5
- package/templates/code-review/evals/repo-rule/graders/schema.md +0 -5
- package/templates/code-review/evals/two-defects/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/clear-disqualifier/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/injection-in-form/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/learned-correction/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/strong-fit/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/thin-data/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/write-back/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/write-back/graders/writes-twice.md +0 -7
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/proves-record.md +0 -18
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/schema.md +0 -5
- package/templates/kyb/evals/adverse-media/graders/schema.md +0 -5
- package/templates/kyb/evals/canada-active-filed/graders/schema.md +0 -5
- package/templates/kyb/evals/clean-public-company/graders/schema.md +0 -5
- package/templates/kyb/evals/injection-in-page/graders/schema.md +0 -5
- package/templates/kyb/evals/name-collision/graders/schema.md +0 -5
- package/templates/kyb/evals/no-invention/graders/schema.md +0 -5
- package/templates/kyb/evals/opensanctions-on/graders/schema.md +0 -5
- package/templates/kyb/evals/sanctioned-entity/graders/schema.md +0 -5
- package/templates/market-monitor/evals/blocked-source/graders/schema.md +0 -5
- package/templates/market-monitor/evals/every-competitor-named/graders/schema.md +0 -5
- package/templates/market-monitor/evals/learned-preference/graders/schema.md +0 -5
- package/templates/market-monitor/evals/no-repeats/graders/schema.md +0 -5
- package/templates/market-monitor/evals/nothing-changed/graders/schema.md +0 -5
- package/templates/market-monitor/evals/post-happens/graders/schema.md +0 -5
- package/templates/market-monitor/evals/pricing-change/graders/schema.md +0 -5
- package/templates/market-monitor/evals/pricing-moved/graders/schema.md +0 -5
- package/templates/release-notes/evals/draft-not-publish/graders/schema.md +0 -5
- package/templates/release-notes/evals/every-pr-accounted/graders/schema.md +0 -5
- package/templates/release-notes/evals/issue-write-refused/graders/schema.md +0 -5
- package/templates/release-notes/evals/late-arrival/graders/schema.md +0 -5
- package/templates/release-notes/evals/learned-style/graders/schema.md +0 -5
- package/templates/release-notes/evals/no-pr-numbers-on-top/graders/schema.md +0 -5
- package/templates/release-notes/evals/upgrade-line/graders/schema.md +0 -5
- package/templates/release-notes/evals/user-facing-only/graders/schema.md +0 -5
package/dist/console/index.html
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
<meta name="color-scheme" content="light dark" />
|
|
7
7
|
<title>AgentRun</title>
|
|
8
8
|
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' fill='%23ff8000'/%3E%3Cpath d='M12 9l11 7-11 7z' fill='%23000'/%3E%3C/svg%3E" />
|
|
9
|
-
<script type="module" crossorigin src="./assets/index-
|
|
10
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
9
|
+
<script type="module" crossorigin src="./assets/index-b6-XY5A9.js"></script>
|
|
10
|
+
<link rel="stylesheet" crossorigin href="./assets/index-CjqQirbo.css">
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|
|
13
13
|
<div id="root"></div>
|
package/dist/console-links.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export declare const runLink: (origin: string, runId: string) => string;
|
|
2
2
|
export declare const agentLink: (origin: string, agentId: string) => string;
|
|
3
|
+
export declare const templateLink: (origin: string, id: string) => string;
|
|
4
|
+
export declare const templateInstallLink: (origin: string, source: string) => string;
|
package/dist/console-links.js
CHANGED
|
@@ -4,3 +4,6 @@ export const runLink = (origin, runId) => `${origin}/#/runs/${encodeURIComponent
|
|
|
4
4
|
// `#/agents/new` is the console's new-agent form, so an agent whose id is "new" gets its Runs tab, as the console's own
|
|
5
5
|
// agentHash gives it (apps/console AgentPage.tsx).
|
|
6
6
|
export const agentLink = (origin, agentId) => `${origin}/#/agents/${encodeURIComponent(agentId)}${agentId === "new" ? "/runs" : ""}`;
|
|
7
|
+
// A template package's apply page; for a package not stored (a dry run), the install page, which shows it whole first.
|
|
8
|
+
export const templateLink = (origin, id) => `${origin}/#/templates/${encodeURIComponent(id)}`;
|
|
9
|
+
export const templateInstallLink = (origin, source) => `${origin}/#/templates/install?src=${encodeURIComponent(source)}`;
|
package/dist/decisions.js
CHANGED
|
@@ -145,6 +145,10 @@ export function providersNamed(nodes) {
|
|
|
145
145
|
}
|
|
146
146
|
if (node.verify)
|
|
147
147
|
ids.add(DEFAULT_DECISION_PROVIDER);
|
|
148
|
+
// A step guard that reads Jev (runner/step-guard.ts) asks Jev, whatever provider its node names.
|
|
149
|
+
const signal = node.guard?.signal;
|
|
150
|
+
if (signal === "jev" || signal === "both")
|
|
151
|
+
ids.add("jev");
|
|
148
152
|
}
|
|
149
153
|
return [...ids];
|
|
150
154
|
}
|
package/dist/faux-computers.d.ts
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import type { KeyTable, ProviderFactories } from "./computer-keys.js";
|
|
2
2
|
import type { KindRegistry, ProviderEntry } from "./computers.js";
|
|
3
|
+
import type { WatchOf } from "./workspace/computer-for-claim.js";
|
|
3
4
|
import type { ComputerSettingKind, LaunchedComputer } from "./workspace/resolve-computer.js";
|
|
4
|
-
/** A started faux desktop: the claim's LaunchedComputer, with
|
|
5
|
+
/** A started faux desktop: the claim's LaunchedComputer, with its provider's watch of its screen (ComputerProvider.watch
|
|
6
|
+
* bound to it), which feeds the run's proxied live view (computer-live.ts) as a real desktop's does. */
|
|
5
7
|
export type FauxDesktop = LaunchedComputer & {
|
|
6
|
-
|
|
7
|
-
readonly viewOnly: boolean;
|
|
8
|
-
}): Promise<{
|
|
9
|
-
readonly url: string;
|
|
10
|
-
}>;
|
|
8
|
+
readonly watch: WatchOf;
|
|
11
9
|
};
|
|
12
|
-
/**
|
|
13
|
-
export declare const FAUX_VIEW_PATH = "/faux/desktops";
|
|
14
|
-
/** What serve takes in place of the computer package under --faux. */
|
|
10
|
+
/** What serve and its runner take in place of the computer package under --faux. */
|
|
15
11
|
export interface FauxComputers {
|
|
16
12
|
readonly kinds: KindRegistry;
|
|
17
13
|
readonly factories: ProviderFactories;
|
|
@@ -21,15 +17,8 @@ export interface FauxComputers {
|
|
|
21
17
|
readonly kind: ComputerSettingKind;
|
|
22
18
|
readonly keys: Readonly<Record<string, string>>;
|
|
23
19
|
}): Promise<FauxDesktop>;
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
viewPage(pathname: string): string | undefined;
|
|
20
|
+
/** Whether a provider id is one of these (the claim's launch takes it): any other is the package's. */
|
|
21
|
+
owns(provider: string): boolean;
|
|
27
22
|
}
|
|
28
|
-
/**
|
|
29
|
-
|
|
30
|
-
* serve itself answers (viewPage), with no other listener. The server answers FAUX_VIEW_PATH with viewPage only under
|
|
31
|
-
* --faux.
|
|
32
|
-
*/
|
|
33
|
-
export declare function fauxComputers({ viewerBase }: {
|
|
34
|
-
readonly viewerBase: string;
|
|
35
|
-
}): FauxComputers;
|
|
23
|
+
/** --faux's computers: the server's Settings → Computers and start check read them, and its runner's claim launches them. */
|
|
24
|
+
export declare function fauxComputers(): FauxComputers;
|
package/dist/faux-computers.js
CHANGED
|
@@ -7,16 +7,16 @@
|
|
|
7
7
|
// no computer.
|
|
8
8
|
// - faux-broken: a sandbox with no key, whose test always fails: it is never reached. It starts no computer.
|
|
9
9
|
// - faux-desktop: a desktop with no key. Its run computer answers screen.shot (a plain grey screen) and input.actions
|
|
10
|
-
// (each action done, none performed). Its
|
|
11
|
-
//
|
|
10
|
+
// (each action done, none performed). Its watch gives the run's live view grey frames and takes its input, so a --faux
|
|
11
|
+
// run's desktop is watched and taken over through the same proxied viewer a real one's is; the release ends it.
|
|
12
12
|
import { crc32, deflateSync } from "node:zlib";
|
|
13
13
|
// The computer package's setting kinds and servingRefusals, as its kinds.ts gives them (the swap to its exports
|
|
14
14
|
// replaces these two with the package's own).
|
|
15
15
|
const SETTING_KINDS = {
|
|
16
16
|
none: { machineKinds: [], required: [], optional: [] },
|
|
17
17
|
sandbox: { machineKinds: ["linux"], required: ["exec", "files", "processes"], optional: [] },
|
|
18
|
-
desktop: { machineKinds: ["desktop"], required: ["screen", "input.pointer", "input.keys"], optional: ["exec", "files", "processes", "apps", "stream"] },
|
|
19
|
-
phone: { machineKinds: ["android", "ios"], required: ["screen", "input.touch", "apps"], optional: ["input.keys", "apps.install", "
|
|
18
|
+
desktop: { machineKinds: ["desktop"], required: ["screen", "input.pointer", "input.keys"], optional: ["exec", "files", "processes", "apps", "ui", "stream"] },
|
|
19
|
+
phone: { machineKinds: ["android", "ios"], required: ["screen", "input.touch", "apps"], optional: ["input.keys", "apps.install", "ui", "stream"] },
|
|
20
20
|
browser: { machineKinds: ["browser"], required: ["cdp"], optional: ["stream", "downloads"] },
|
|
21
21
|
};
|
|
22
22
|
const KIND_NAMES = Object.keys(SETTING_KINDS);
|
|
@@ -75,39 +75,75 @@ function greyPng(width, height) {
|
|
|
75
75
|
}
|
|
76
76
|
const WIDTH = 1280;
|
|
77
77
|
const HEIGHT = 800;
|
|
78
|
-
/**
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
|
|
82
|
-
* serve itself answers (viewPage), with no other listener. The server answers FAUX_VIEW_PATH with viewPage only under
|
|
83
|
-
* --faux.
|
|
84
|
-
*/
|
|
85
|
-
export function fauxComputers({ viewerBase }) {
|
|
86
|
-
const live = new Set();
|
|
78
|
+
/** How long a faux desktop's watch waits after a frame's ack before it gives the next. */
|
|
79
|
+
const FRAME_MS = 1_000;
|
|
80
|
+
/** --faux's computers: the server's Settings → Computers and start check read them, and its runner's claim launches them. */
|
|
81
|
+
export function fauxComputers() {
|
|
87
82
|
let started = 0;
|
|
88
|
-
/** A faux desktop for a run: screen.shot gives a grey screen, input.actions does
|
|
89
|
-
*
|
|
83
|
+
/** A faux desktop for a run: ping answers, as every computer's does; screen.shot gives a grey screen, input.actions does
|
|
84
|
+
* each action and performs none, and its watch gives the same grey frame, the next a second after each ack, and takes every input (performing none) until it
|
|
85
|
+
* is closed or the desktop is released, which ends it gone. */
|
|
90
86
|
function fauxDesktop() {
|
|
91
87
|
const id = `faux-desktop-${++started}`;
|
|
92
88
|
const png = greyPng(WIDTH, HEIGHT);
|
|
93
|
-
|
|
94
|
-
const hello = { protocol: "0.2", version: "faux", os: "linux", kind: "desktop", arch: "amd64", groups: [...DESKTOP_GROUPS] };
|
|
89
|
+
const watches = new Set();
|
|
90
|
+
const hello = { protocol: "0.2", version: "faux", os: "linux", kind: "desktop", arch: "amd64", groups: [...DESKTOP_GROUPS], screen: { width: WIDTH, height: HEIGHT, scale: 1 } };
|
|
95
91
|
const call = async (method, params) => {
|
|
96
92
|
if (method === "hello")
|
|
97
93
|
return { ok: true, value: hello };
|
|
94
|
+
if (method === "ping")
|
|
95
|
+
return { ok: true, value: {} };
|
|
98
96
|
if (method === "screen.shot")
|
|
99
97
|
return { ok: true, value: { id: `${id}-shot`, data: png.toString("base64"), eof: true, size: png.length, width: WIDTH, height: HEIGHT } };
|
|
100
98
|
if (method === "input.actions")
|
|
101
99
|
return { ok: true, value: { done: Array.isArray(params.actions) ? params.actions.length : 0 } };
|
|
102
100
|
return { ok: false, error: { code: "unsupported", message: `the faux desktop has no ${method}` } };
|
|
103
101
|
};
|
|
102
|
+
const watch = async (handlers, options) => {
|
|
103
|
+
let open = true;
|
|
104
|
+
let seq = 0;
|
|
105
|
+
let timer;
|
|
106
|
+
const stop = () => {
|
|
107
|
+
open = false;
|
|
108
|
+
clearTimeout(timer);
|
|
109
|
+
watches.delete(gone);
|
|
110
|
+
options.signal?.removeEventListener("abort", stop);
|
|
111
|
+
};
|
|
112
|
+
const gone = () => {
|
|
113
|
+
if (!open)
|
|
114
|
+
return;
|
|
115
|
+
stop();
|
|
116
|
+
handlers.ended({ code: "gone", message: `the faux desktop ${id} was released` });
|
|
117
|
+
};
|
|
118
|
+
const give = () => {
|
|
119
|
+
if (!open)
|
|
120
|
+
return;
|
|
121
|
+
handlers.frame({ seq: ++seq, format: "png", bytes: png, width: WIDTH, height: HEIGHT, frameWidth: WIDTH, frameHeight: HEIGHT }, () => {
|
|
122
|
+
if (open)
|
|
123
|
+
(timer = setTimeout(give, FRAME_MS)).unref();
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
if (options.signal?.aborted)
|
|
127
|
+
return { ok: false, error: { code: "aborted", message: "the watch was cancelled before it began" } };
|
|
128
|
+
options.signal?.addEventListener("abort", stop, { once: true });
|
|
129
|
+
watches.add(gone);
|
|
130
|
+
setImmediate(give);
|
|
131
|
+
const screen = {
|
|
132
|
+
input: async (actions) => (open ? { ok: true, value: { done: actions.length } } : { ok: false, error: { code: "gone", message: `the faux desktop ${id}'s watch is closed` } }),
|
|
133
|
+
close: async () => stop(),
|
|
134
|
+
};
|
|
135
|
+
return { ok: true, value: screen };
|
|
136
|
+
};
|
|
104
137
|
return {
|
|
105
138
|
id,
|
|
106
139
|
groups: [...DESKTOP_GROUPS],
|
|
107
140
|
hello,
|
|
108
141
|
client: { call },
|
|
109
|
-
|
|
110
|
-
release: async () =>
|
|
142
|
+
watch,
|
|
143
|
+
release: async () => {
|
|
144
|
+
for (const end of [...watches])
|
|
145
|
+
end();
|
|
146
|
+
},
|
|
111
147
|
};
|
|
112
148
|
}
|
|
113
149
|
return {
|
|
@@ -119,12 +155,6 @@ export function fauxComputers({ viewerBase }) {
|
|
|
119
155
|
return fauxDesktop();
|
|
120
156
|
throw new Error(`${entryOf.label} starts no computer: under --faux, only Faux desktop does (set this agent's computer to desktop on Faux desktop, or none)`);
|
|
121
157
|
},
|
|
122
|
-
|
|
123
|
-
const match = new RegExp(`^${FAUX_VIEW_PATH}/(faux-desktop-\\d+)/(view|drive)$`).exec(pathname);
|
|
124
|
-
if (!match || !live.has(match[1]))
|
|
125
|
-
return undefined;
|
|
126
|
-
const driving = match[2] === "drive";
|
|
127
|
-
return `<!doctype html><meta charset="utf-8"><title>Faux desktop ${match[1]}</title><body style="background:#c0c0c0;font:16px sans-serif"><p>Faux desktop ${match[1]}: ${driving ? "driving (taken over)" : "watching (view only)"}</p></body>`;
|
|
128
|
-
},
|
|
158
|
+
owns: (provider) => PROVIDERS.some((one) => one.id === provider),
|
|
129
159
|
};
|
|
130
160
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ApiError } from "./errors.js";
|
|
2
2
|
import { githubTargetOf } from "./github.js";
|
|
3
3
|
import type { SealedSettingsOverStore } from "./sealed-settings-store.js";
|
|
4
|
+
import type { Held } from "./template-github-permissions.js";
|
|
4
5
|
import { type Json } from "./validate.js";
|
|
5
6
|
/** What every GitHub App Connect GitHub makes asks of the repositories it is installed on (its manifest's
|
|
6
|
-
* default_permissions): the least its templates need.
|
|
7
|
-
*
|
|
7
|
+
* default_permissions): the least its templates need. Applying a template warns from each installation's real permissions
|
|
8
|
+
* (installationPermissions, template-github-permissions.ts), never from this. */
|
|
8
9
|
export declare const APP_PERMISSIONS: {
|
|
9
10
|
readonly pull_requests: "write";
|
|
10
11
|
readonly contents: "read";
|
|
@@ -194,6 +195,13 @@ export declare class GitHubConnect {
|
|
|
194
195
|
} | {
|
|
195
196
|
unusable: string;
|
|
196
197
|
} | Unanswered>;
|
|
198
|
+
/** What each installation of the App holds now, as GitHub says (GET /app/installations/{id} with the App's JWT: its
|
|
199
|
+
* `permissions` map, `admin` read as `write`, which it includes). Never a guess: no App, no installation, GitHub out of
|
|
200
|
+
* reach, an answer that is not a 200 or has no map, or a level it does not know is `unreadable`, with why. */
|
|
201
|
+
installationPermissions(signal?: AbortSignal, limits?: {
|
|
202
|
+
parallel?: number;
|
|
203
|
+
withinMs?: number;
|
|
204
|
+
}): Promise<Held>;
|
|
197
205
|
/** The first repository installation `id` covers, if any: asked with a metadata-read token that never leaves this
|
|
198
206
|
* server (only GitHub's API sees it), revoked at once, whatever the answer. A read GitHub did not answer (a 429, a
|
|
199
207
|
* 5xx, nothing) is UNANSWERED, never "none". */
|
|
@@ -13,8 +13,8 @@ import { isObject } from "./validate.js";
|
|
|
13
13
|
registerSecretWrite("connectGitHub", () => true);
|
|
14
14
|
registerSecretWrite("disconnectGitHub", () => true);
|
|
15
15
|
/** What every GitHub App Connect GitHub makes asks of the repositories it is installed on (its manifest's
|
|
16
|
-
* default_permissions): the least its templates need.
|
|
17
|
-
*
|
|
16
|
+
* default_permissions): the least its templates need. Applying a template warns from each installation's real permissions
|
|
17
|
+
* (installationPermissions, template-github-permissions.ts), never from this. */
|
|
18
18
|
export const APP_PERMISSIONS = { pull_requests: "write", contents: "read", metadata: "read", issues: "read" };
|
|
19
19
|
/** How long a Connect's state is good for, and the most kept at once. */
|
|
20
20
|
export const STATE_MS = 60 * 60 * 1000;
|
|
@@ -34,6 +34,9 @@ const consoleAt = (base, page) => `${base ?? ""}${page}`;
|
|
|
34
34
|
/** A GitHub login (a user or an organization), as GitHub allows one. */
|
|
35
35
|
const LOGIN = /^[A-Za-z0-9](?:[A-Za-z0-9]|-(?=[A-Za-z0-9])){0,38}$/;
|
|
36
36
|
const SCOPE = GITHUB_SCOPE;
|
|
37
|
+
/** Apply's warning reads the installations' permissions this many at a time, all within one limit (installationPermissions). */
|
|
38
|
+
const PERMISSIONS_PARALLEL = 4;
|
|
39
|
+
const PERMISSIONS_WITHIN_MS = 4_000;
|
|
37
40
|
/** The installations a sealed `installations` field holds; none for one that does not read. */
|
|
38
41
|
export function installationsIn(text) {
|
|
39
42
|
try {
|
|
@@ -572,6 +575,66 @@ export class GitHubConnect {
|
|
|
572
575
|
return { unusable: `GitHub did not give a token: ${error.message}.` };
|
|
573
576
|
}
|
|
574
577
|
}
|
|
578
|
+
/** What each installation of the App holds now, as GitHub says (GET /app/installations/{id} with the App's JWT: its
|
|
579
|
+
* `permissions` map, `admin` read as `write`, which it includes). Never a guess: no App, no installation, GitHub out of
|
|
580
|
+
* reach, an answer that is not a 200 or has no map, or a level it does not know is `unreadable`, with why. */
|
|
581
|
+
async installationPermissions(signal, limits = {}) {
|
|
582
|
+
const credentials = this.connection.credentials();
|
|
583
|
+
const view = this.connection.view();
|
|
584
|
+
if (!credentials || !view)
|
|
585
|
+
return { unreadable: "this server has no GitHub App" };
|
|
586
|
+
if (!view.installations.length)
|
|
587
|
+
return { unreadable: "the GitHub App is not installed on any account yet" };
|
|
588
|
+
// Bounded: a few reads at a time and one time limit for them all, so a slow GitHub or many accounts never hold the
|
|
589
|
+
// caller (Apply) past it. A read the limit cut off is `unread`, said so, never passed.
|
|
590
|
+
const withinMs = limits.withinMs ?? PERMISSIONS_WITHIN_MS;
|
|
591
|
+
const deadline = AbortSignal.timeout(withinMs);
|
|
592
|
+
const both = signal ? AbortSignal.any([signal, deadline]) : deadline;
|
|
593
|
+
const read = async (installation) => {
|
|
594
|
+
if (deadline.aborted)
|
|
595
|
+
return { why: `no answer within ${withinMs / 1000} s` };
|
|
596
|
+
let answer;
|
|
597
|
+
try {
|
|
598
|
+
const jwt = appJwt(credentials.appId, credentials.pem, this.options.now?.() ?? Date.now());
|
|
599
|
+
answer = await githubCall(this.options.api, `/app/installations/${installation.id}`, { jwt, signal: both });
|
|
600
|
+
}
|
|
601
|
+
catch (error) {
|
|
602
|
+
return { why: deadline.aborted ? `no answer within ${withinMs / 1000} s` : error.message };
|
|
603
|
+
}
|
|
604
|
+
const map = isObject(answer.json) ? answer.json.permissions : undefined;
|
|
605
|
+
if (answer.status !== 200 || !isObject(map))
|
|
606
|
+
return { why: `GitHub gave no permissions for the installation on ${installation.account} (HTTP ${answer.status})` };
|
|
607
|
+
const permissions = {};
|
|
608
|
+
for (const [name, level] of Object.entries(map)) {
|
|
609
|
+
if (level !== "read" && level !== "write" && level !== "admin")
|
|
610
|
+
return { why: `GitHub gave a level this server does not know for ${name} on ${installation.account}` };
|
|
611
|
+
permissions[name] = level === "read" ? "read" : "write";
|
|
612
|
+
}
|
|
613
|
+
return { permissions };
|
|
614
|
+
};
|
|
615
|
+
const results = new Array(view.installations.length);
|
|
616
|
+
let next = 0;
|
|
617
|
+
const worker = async () => {
|
|
618
|
+
while (next < view.installations.length) {
|
|
619
|
+
const at = next++;
|
|
620
|
+
results[at] = await read(view.installations[at]);
|
|
621
|
+
}
|
|
622
|
+
};
|
|
623
|
+
await Promise.all(Array.from({ length: Math.min(limits.parallel ?? PERMISSIONS_PARALLEL, view.installations.length) }, worker));
|
|
624
|
+
const installations = [];
|
|
625
|
+
const unread = [];
|
|
626
|
+
view.installations.forEach((installation, at) => {
|
|
627
|
+
const result = results[at];
|
|
628
|
+
if ("permissions" in result)
|
|
629
|
+
installations.push({ account: installation.account, permissions: result.permissions });
|
|
630
|
+
else
|
|
631
|
+
unread.push({ account: installation.account, why: result.why });
|
|
632
|
+
});
|
|
633
|
+
// Nothing read at all: the check could not be made, with the first reason.
|
|
634
|
+
if (!installations.length)
|
|
635
|
+
return { unreadable: unread[0].why };
|
|
636
|
+
return unread.length ? { installations, unread } : { installations };
|
|
637
|
+
}
|
|
575
638
|
/** The first repository installation `id` covers, if any: asked with a metadata-read token that never leaves this
|
|
576
639
|
* server (only GitHub's API sees it), revoked at once, whatever the answer. A read GitHub did not answer (a 429, a
|
|
577
640
|
* 5xx, nothing) is UNANSWERED, never "none". */
|
package/dist/github-faux.js
CHANGED
|
@@ -16,7 +16,7 @@ const TOKEN_MS = 60 * 60_000;
|
|
|
16
16
|
export async function startFauxGitHub() {
|
|
17
17
|
const { privateKey } = generateKeyPairSync("rsa", { modulusLength: 2048, privateKeyEncoding: { type: "pkcs1", format: "pem" }, publicKeyEncoding: { type: "spki", format: "pem" } });
|
|
18
18
|
const app = { id: FAUX_GITHUB.appId, slug: FAUX_GITHUB.slug, clientId: `Iv1.faux${randomBytes(6).toString("hex")}`, pem: privateKey, webhookSecret: randomBytes(24).toString("hex"), settingsUrl: `https://github.com/organizations/${FAUX_GITHUB.account}/settings/apps/${FAUX_GITHUB.slug}` };
|
|
19
|
-
const installation = { id: FAUX_GITHUB.installation, account: { login: FAUX_GITHUB.account, type: "Organization" }, app_id: Number(FAUX_GITHUB.appId), suspended_at: null };
|
|
19
|
+
const installation = { id: FAUX_GITHUB.installation, account: { login: FAUX_GITHUB.account, type: "Organization" }, app_id: Number(FAUX_GITHUB.appId), suspended_at: null, permissions: { metadata: "read", contents: "read", pull_requests: "write", issues: "read" } };
|
|
20
20
|
/** Each token minted, by its value: the repositories it was narrowed to (by name), or every one the installation covers. */
|
|
21
21
|
const tokens = new Map();
|
|
22
22
|
const covered = (names) => FAUX_GITHUB.repositories.filter((full) => !names || names.includes(full.split("/")[1]));
|
package/dist/graph-view.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 { Store } from "./store/store.js";
|
|
3
3
|
export type GraphNodeStatus = "pending" | "working" | "done" | "failed" | "stopped" | "escalated" | "not_run" | "needs_review";
|
|
4
4
|
type Item = {
|
|
@@ -34,13 +34,18 @@ function kernelTool(tool) {
|
|
|
34
34
|
description: tool.description,
|
|
35
35
|
inputSchema: tool.inputSchema,
|
|
36
36
|
replay: tool.replay,
|
|
37
|
+
...(tool.nests ? { nests: true } : {}),
|
|
38
|
+
...(tool.deferred ? { deferred: true } : {}),
|
|
37
39
|
async execute(input, io) {
|
|
38
40
|
// The effect's step is `tool:<the model's call id>#<attempt>`: the host sees the model's call id.
|
|
39
41
|
const callId = (io.stepId ?? "").replace(/^tool:/, "").replace(/#\d+$/, "");
|
|
40
|
-
|
|
42
|
+
// A tool that nests calls (tools_call, codemode) gets the session's tools as its nested calls, through the bridge.
|
|
43
|
+
const result = await tool.call(input, { callId, signal: io.signal, ...(io.nested ? { nested: io.nested } : {}) });
|
|
41
44
|
if (result.isError)
|
|
42
45
|
throw new Error(result.text);
|
|
43
|
-
|
|
46
|
+
// Its value, recorded with the outcome: a script's nested call is answered it (meta-tools.ts).
|
|
47
|
+
const structured = result.structured !== undefined ? { structured: result.structured } : {};
|
|
48
|
+
return result.images?.length ? { text: result.text, images: result.images, ...structured } : result.structured === undefined ? result.text : { text: result.text, ...structured };
|
|
44
49
|
},
|
|
45
50
|
};
|
|
46
51
|
}
|
|
@@ -105,7 +110,6 @@ export function openCodeAdapter(options) {
|
|
|
105
110
|
};
|
|
106
111
|
return {
|
|
107
112
|
id: "opencode",
|
|
108
|
-
capabilities: () => ({}),
|
|
109
113
|
check(spec) {
|
|
110
114
|
const problems = [];
|
|
111
115
|
if (spec.context === "fork")
|
|
@@ -13,8 +13,6 @@ export const facts = Object.freeze({
|
|
|
13
13
|
// One run's memory, measured with the server's (host.ts): OpenCode's server beside the run's process.
|
|
14
14
|
runMib: 704,
|
|
15
15
|
// OpenAI's reasoning efforts stop at xhigh.
|
|
16
|
-
// Its MCP client is not bound to the session's remote MCP servers yet.
|
|
17
|
-
mcp: false,
|
|
18
16
|
thinking: Object.freeze(["low", "medium", "high", "xhigh"]),
|
|
19
17
|
// OpenCode's model requests carry no provider-hosted tool: no search of its own.
|
|
20
18
|
ownModel: false,
|
|
@@ -37,12 +37,9 @@ export interface OpenCodePolicyOptions {
|
|
|
37
37
|
*/
|
|
38
38
|
export declare function filtered(text: string, lineStarts?: readonly string[]): boolean;
|
|
39
39
|
/** The usage of the response an answer ends with: its `response.completed` (or `response.incomplete`) event, each `data:`
|
|
40
|
-
* line parsed on its own, or a whole JSON body's; for a line the proxy's 64 KiB window cut, the last `"usage":{` object
|
|
41
|
-
* in the text. Undefined, an unknown cost, when there is none. */
|
|
40
|
+
* line parsed on its own, or a whole JSON body's; for a line the proxy's 64 KiB window cut, the last `"usage": {` object
|
|
41
|
+
* in the text, whatever its spacing (the kernel's `lastObjectOf`). Undefined, an unknown cost, when there is none. */
|
|
42
42
|
export declare function usageOf(text: string): ProxyUsage | undefined;
|
|
43
|
-
/** The input tokens the provider bills for `body` that it does not carry (codex's figure: the same Responses API). A file
|
|
44
|
-
* input has no stated bound, so a body with one cannot be measured. */
|
|
45
|
-
export declare function responsesServerInputOverhead(body: Record<string, unknown>): number;
|
|
46
43
|
/** The tokens a request keeps for its answer when a spend cap limits its output. */
|
|
47
44
|
export declare const ANSWER_TOKENS_LEAST = 1024;
|
|
48
45
|
/** What a reasoning request at each effort is allowed for its reasoning beside its answer, when its output is limited:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { lastObjectOf, OPENAI_INPUT_COUNTER, ProxyRefusal, responsesInputOverhead } from "@parcha/agentrun-kernel/host";
|
|
2
2
|
/** The prefix OpenCode gives the adapter's MCP tools: the server is `hands`. */
|
|
3
3
|
export const TOOL_PREFIX = "hands_";
|
|
4
4
|
export const OPENCODE_RESPONSES_ROUTES = Object.freeze([
|
|
@@ -168,8 +168,8 @@ function startOfResponse(data) {
|
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
/** The usage of the response an answer ends with: its `response.completed` (or `response.incomplete`) event, each `data:`
|
|
171
|
-
* line parsed on its own, or a whole JSON body's; for a line the proxy's 64 KiB window cut, the last `"usage":{` object
|
|
172
|
-
* in the text. Undefined, an unknown cost, when there is none. */
|
|
171
|
+
* line parsed on its own, or a whole JSON body's; for a line the proxy's 64 KiB window cut, the last `"usage": {` object
|
|
172
|
+
* in the text, whatever its spacing (the kernel's `lastObjectOf`). Undefined, an unknown cost, when there is none. */
|
|
173
173
|
export function usageOf(text) {
|
|
174
174
|
let found;
|
|
175
175
|
let ended = false;
|
|
@@ -202,34 +202,7 @@ export function usageOf(text) {
|
|
|
202
202
|
}
|
|
203
203
|
catch { }
|
|
204
204
|
}
|
|
205
|
-
|
|
206
|
-
const at = text.lastIndexOf(mark);
|
|
207
|
-
if (at < 0)
|
|
208
|
-
return undefined;
|
|
209
|
-
const json = objectAt(text, at + mark.length - 1);
|
|
210
|
-
if (json === undefined)
|
|
211
|
-
return undefined;
|
|
212
|
-
try {
|
|
213
|
-
return usageFrom(JSON.parse(json));
|
|
214
|
-
}
|
|
215
|
-
catch {
|
|
216
|
-
return undefined;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
/** The items of `type` in `value`, at any depth. */
|
|
220
|
-
function itemsIn(value, type) {
|
|
221
|
-
if (Array.isArray(value))
|
|
222
|
-
return value.reduce((n, item) => n + itemsIn(item, type), 0);
|
|
223
|
-
if (!isPlain(value))
|
|
224
|
-
return 0;
|
|
225
|
-
return (value.type === type ? 1 : 0) + Object.values(value).reduce((n, item) => n + itemsIn(item, type), 0);
|
|
226
|
-
}
|
|
227
|
-
/** The input tokens the provider bills for `body` that it does not carry (codex's figure: the same Responses API). A file
|
|
228
|
-
* input has no stated bound, so a body with one cannot be measured. */
|
|
229
|
-
export function responsesServerInputOverhead(body) {
|
|
230
|
-
if (itemsIn(body.input, "input_file") > 0)
|
|
231
|
-
throw new Error("a file input's billed size has no stated bound");
|
|
232
|
-
return providerInputOverhead("openai-responses", { tools: Array.isArray(body.tools) && body.tools.length > 0, images: responsesImagesIn(body.input), ...(typeof body.model === "string" ? { model: body.model } : {}) });
|
|
205
|
+
return usageFrom(lastObjectOf(text, "usage"));
|
|
233
206
|
}
|
|
234
207
|
/** An event that is not whole by this many characters is not read. */
|
|
235
208
|
const EVENT_CAP = 4 * 1024 * 1024;
|
|
@@ -418,7 +391,10 @@ export function openCodePolicy(options) {
|
|
|
418
391
|
outputAsked: responsesOutputAsked,
|
|
419
392
|
outputLeast: responsesOutputLeast,
|
|
420
393
|
limitOutput: limitResponsesOutput,
|
|
421
|
-
|
|
394
|
+
// Its bytes less the escapes in the text it carries (codex's figure: the same Responses API), and on a route straight
|
|
395
|
+
// to OpenAI, OpenAI's own count when that is lower.
|
|
396
|
+
serverInputOverhead: responsesInputOverhead,
|
|
397
|
+
countInput: OPENAI_INPUT_COUNTER,
|
|
422
398
|
// A stop counts the content it streamed, not the wire, and the part of its reasoning budget that did not stream.
|
|
423
399
|
reasoningHidden: (body) => responsesReasoningHidden(body, maxOutputTokens),
|
|
424
400
|
reasoningBytesOf: responsesReasoningBytes,
|
package/dist/harness-table.d.ts
CHANGED
|
@@ -24,8 +24,6 @@ export interface HarnessEntry {
|
|
|
24
24
|
readonly steer: boolean;
|
|
25
25
|
/** What one of its runs reserves in memory while its process lives, in MiB (host.ts). */
|
|
26
26
|
readonly runMib: number;
|
|
27
|
-
/** Whether it binds a run's remote MCP servers. */
|
|
28
|
-
readonly mcp: boolean;
|
|
29
27
|
/** A server too small for even one of its runs still runs one at a time (pi's, as before runs were admitted by memory). */
|
|
30
28
|
readonly oneAlwaysFits: boolean;
|
|
31
29
|
/** Its adapter's facts; none for pi, which runs in the run's own process on its own models. */
|
package/dist/harness-table.js
CHANGED
|
@@ -42,7 +42,6 @@ const PI = Object.freeze({
|
|
|
42
42
|
id: DEFAULT_HARNESS,
|
|
43
43
|
steer: true,
|
|
44
44
|
runMib: 128,
|
|
45
|
-
mcp: true,
|
|
46
45
|
oneAlwaysFits: true,
|
|
47
46
|
runs: () => true,
|
|
48
47
|
onWire: () => false,
|
|
@@ -61,7 +60,6 @@ function adapterEntry(facts, make, extra = {}) {
|
|
|
61
60
|
id,
|
|
62
61
|
steer: facts.steer,
|
|
63
62
|
runMib: facts.runMib,
|
|
64
|
-
mcp: facts.mcp,
|
|
65
63
|
oneAlwaysFits: false,
|
|
66
64
|
facts,
|
|
67
65
|
...(installs ? { installs } : {}),
|
package/dist/harness.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export type HarnessOffer = {
|
|
|
23
23
|
* the memory a run of it reserves (`run_memory_mib`). */
|
|
24
24
|
export type HarnessCapability = HarnessOffer & {
|
|
25
25
|
default_model: string | null;
|
|
26
|
+
models: string[];
|
|
26
27
|
run_memory_mib: number;
|
|
27
28
|
};
|
|
28
29
|
/** What this server offers of each harness, checked once per environment: each one's entry in the harness table says
|
package/dist/harness.js
CHANGED
|
@@ -53,9 +53,43 @@ export function harnessOffers(env) {
|
|
|
53
53
|
// Each harness's model when a definition names none, as a save and a run resolve it (runnable.ts): none for a
|
|
54
54
|
// harness that does not run here, or that no model here would run on.
|
|
55
55
|
const { harnessModel } = await import("./runnable.js");
|
|
56
|
+
const { pickerCandidates } = await import("./model-form.js");
|
|
56
57
|
return Promise.all(base.map(async (offer) => {
|
|
57
58
|
const resolved = offer.available ? await harnessModel(env, offer.id, undefined, true) : undefined;
|
|
58
|
-
|
|
59
|
+
// The models a person may pick for it (model-form.ts), each in the form it takes: those its entry's own choice
|
|
60
|
+
// takes (the catalog it runs on knows the id, a key may still be missing: a save warns of that, never refuses),
|
|
61
|
+
// so the picker never offers one a save would refuse. None for a harness that does not run here.
|
|
62
|
+
const entry = harnessOf(env, offer.id);
|
|
63
|
+
const models = [];
|
|
64
|
+
if (offer.available) {
|
|
65
|
+
// Each choice passes what a save and a run ask, by construction: the save's own shape check (MODEL_REF), the
|
|
66
|
+
// harness's own choice of it, and, on an adapter's wire, providerFor, the function a run starts with. A model
|
|
67
|
+
// the wire cannot take (a vendor it does not run, an endpoint a key may not go to) is not offered; one that
|
|
68
|
+
// lacks only a key is (a save warns of that, never refuses).
|
|
69
|
+
const { MODEL_REF } = await import("./validate.js");
|
|
70
|
+
const { providerFor, HarnessUnavailable } = await import("./provider.js");
|
|
71
|
+
const { ADAPTER_FACTS } = await import("./adapter-facts.js");
|
|
72
|
+
const { FAUX_ENV } = await import("./model.js");
|
|
73
|
+
const facts = ADAPTER_FACTS.find((f) => f.id === offer.id);
|
|
74
|
+
for (const id of pickerCandidates(env, offer.id)) {
|
|
75
|
+
if (!MODEL_REF.test(id))
|
|
76
|
+
continue;
|
|
77
|
+
const chosen = await entry.model(env, id, true);
|
|
78
|
+
if (!chosen || !("model" in chosen || chosen.needs === "key"))
|
|
79
|
+
continue;
|
|
80
|
+
if (facts && "model" in chosen && !env[FAUX_ENV]) {
|
|
81
|
+
try {
|
|
82
|
+
providerFor(facts.wire, env, chosen.model, offer.id);
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
if (!(error instanceof HarnessUnavailable && error.keys?.length))
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
models.push(id);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return { ...offer, default_model: resolved && "model" in resolved ? `${resolved.model.provider}/${resolved.model.modelId}` : null, models, run_memory_mib: entry.runMib };
|
|
59
93
|
}));
|
|
60
94
|
})();
|
|
61
95
|
offered.set(env, offers);
|
package/dist/host-tools.d.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import type { Context } from "@earendil-works/chord";
|
|
1
|
+
import type { Context } from "@earendil-works/chord/context";
|
|
2
2
|
import { type ToolExecutionApi, type ToolRegistration } from "@earendil-works/pi-durable";
|
|
3
3
|
import type { HostTool } from "@parcha/agentrun-kernel";
|
|
4
4
|
export { workspaceRelative } from "./workspace-paths.js";
|
|
5
|
-
/** Each tool a harness other than pi runs here, by catalog name, and whether a call a crash cut off may run again.
|
|
6
|
-
* `learned_workflow` (learned-workflow.ts LEARNED_WORKFLOW_TOOL, named here as a string so the modules do not import
|
|
7
|
-
* each other) is never run again. */
|
|
8
|
-
export declare const REPLAY: Record<string, "safe" | "never">;
|
|
9
5
|
export { cutUtf8, MAX_BYTES, MAX_LINES } from "./workspace/executors.js";
|
|
10
6
|
/** One call's result, kept by its call id for the run's timeline (an adapter's tool_end carries none). */
|
|
11
7
|
export type ToolResults = Map<string, {
|
|
@@ -51,5 +47,5 @@ export interface HostToolCtx {
|
|
|
51
47
|
/** One pi ToolRegistration `tool` (named `name` by its catalog name) as the kernel's HostTool an adapter session takes:
|
|
52
48
|
* the paid-call seam, then the tool on the run's environment and harness, its answer the text a
|
|
53
49
|
* model reads (the output or the failure, a write's or an error's path named relative to the run's folder). Undefined when
|
|
54
|
-
* `name` is not one a host runs (
|
|
50
|
+
* `name` is not one a host runs (tool-list.ts `replay`). */
|
|
55
51
|
export declare function hostToolOf(name: string, tool: ToolRegistration, ctx: HostToolCtx): HostTool | undefined;
|
package/dist/host-tools.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { withAbortSignal } from "@earendil-works/chord/context";
|
|
2
2
|
import { createModels } from "@earendil-works/pi-ai/models";
|
|
3
3
|
import { ROOT_CONVERSATION_ID } from "@earendil-works/pi-durable";
|
|
4
|
-
import {
|
|
5
|
-
import { WEB_SEARCH_TOOL } from "./web-search.js";
|
|
4
|
+
import { replayOf } from "./tool-list.js";
|
|
6
5
|
import { realOf, workspaceRelative } from "./workspace-paths.js";
|
|
7
6
|
import { bounded, imagesOf, textOf } from "./workspace/executors.js";
|
|
8
7
|
export { workspaceRelative } from "./workspace-paths.js";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* each other) is never run again. */
|
|
12
|
-
export const REPLAY = { read: "safe", write: "never", edit: "never", bash: "never", [WEB_FETCH_TOOL]: "safe", [WEB_SEARCH_TOOL]: "safe", "monid.discover": "safe", "monid.inspect": "safe", "monid.run": "never", bash_background: "never", bash_output: "safe", bash_input: "never", bash_signal: "never", bash_list: "safe", learned_workflow: "never" };
|
|
8
|
+
// Each tool a harness other than pi runs here, by catalog name, and whether a call a crash cut off may run again, is its
|
|
9
|
+
// row's `replay` (tool-list.ts). `learned_workflow` (learned-workflow.ts LEARNED_WORKFLOW_TOOL) is never run again.
|
|
13
10
|
// pi's limits on a tool's output, and how a call's output is held within them, are the executors' (workspace/executors.ts).
|
|
14
11
|
export { cutUtf8, MAX_BYTES, MAX_LINES } from "./workspace/executors.js";
|
|
15
12
|
/** The members of pi's ToolExecutionApi a host tool's api gives. They are typed against pi's own type (`HostApi`), so a
|
|
@@ -38,9 +35,9 @@ const SAYS_PATH = new Set(["write", "edit"]);
|
|
|
38
35
|
/** One pi ToolRegistration `tool` (named `name` by its catalog name) as the kernel's HostTool an adapter session takes:
|
|
39
36
|
* the paid-call seam, then the tool on the run's environment and harness, its answer the text a
|
|
40
37
|
* model reads (the output or the failure, a write's or an error's path named relative to the run's folder). Undefined when
|
|
41
|
-
* `name` is not one a host runs (
|
|
38
|
+
* `name` is not one a host runs (tool-list.ts `replay`). */
|
|
42
39
|
export function hostToolOf(name, tool, ctx) {
|
|
43
|
-
const replay =
|
|
40
|
+
const replay = replayOf(name);
|
|
44
41
|
if (!replay)
|
|
45
42
|
return undefined;
|
|
46
43
|
return {
|
|
@@ -59,7 +56,7 @@ export function hostToolOf(name, tool, ctx) {
|
|
|
59
56
|
const out = bounded(tool.outputLimits);
|
|
60
57
|
const notes = [];
|
|
61
58
|
const env = await ctx.env();
|
|
62
|
-
// The call's id and the run's store, as pi's: a paid call marks and books its charge there
|
|
59
|
+
// The call's id and the run's store, as pi's: a paid call marks and books its charge there.
|
|
63
60
|
const api = hostApi({
|
|
64
61
|
env, callId,
|
|
65
62
|
commit: ctx.commit,
|
|
@@ -71,7 +68,7 @@ export function hostToolOf(name, tool, ctx) {
|
|
|
71
68
|
snapshot: ctx.snapshot, waitForTask: ctx.waitForTask,
|
|
72
69
|
});
|
|
73
70
|
// A tool that throws (bash on a non-zero exit or a timeout) still answers with its output, as pi's harness does;
|
|
74
|
-
//
|
|
71
|
+
// one that answers a failure as an error result is kept as it is.
|
|
75
72
|
const result = await tool.execute(args, api, withAbortSignal(signal, ctx.context)).catch((error) => ({ failed: error.message, isError: true }));
|
|
76
73
|
// pi names a result's blocks `output`; its bash answers its exit as a result's diagnostic.
|
|
77
74
|
const given = result;
|