@parcha/agentrun-serve 0.1.0-beta.33 → 0.1.0-beta.35
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 +368 -0
- package/README.md +341 -208
- package/dist/adapters.d.ts +3 -4
- package/dist/adapters.js +18 -15
- package/dist/agent-rows.d.ts +99 -0
- package/dist/agent-rows.js +1 -0
- package/dist/agents-store.d.ts +6 -2
- package/dist/agents-store.js +75 -25
- package/dist/agents.d.ts +9 -125
- package/dist/agents.js +15 -305
- package/dist/answer-json.d.ts +23 -0
- package/dist/answer-json.js +58 -0
- package/dist/api-only.d.ts +1 -1
- package/dist/api-only.js +2 -2
- package/dist/archil-settings.d.ts +11 -1
- package/dist/archil-settings.js +10 -0
- package/dist/bash-read-only.d.ts +35 -0
- package/dist/bash-read-only.js +778 -0
- package/dist/box-settings.d.ts +3 -23
- package/dist/box-settings.js +7 -51
- package/dist/boxes.d.ts +17 -0
- package/dist/boxes.js +27 -20
- package/dist/browser-commands.d.ts +5 -2
- package/dist/browser-commands.js +4 -4
- package/dist/browser-computer.d.ts +5 -0
- package/dist/browser-computer.js +21 -0
- package/dist/browser-cost.d.ts +9 -6
- package/dist/browser-cost.js +95 -51
- package/dist/browser-live.d.ts +7 -20
- package/dist/browser-live.js +15 -93
- package/dist/browser-person.d.ts +18 -51
- package/dist/browser-person.js +94 -277
- package/dist/budget.d.ts +0 -5
- package/dist/budget.js +0 -5
- package/dist/cap.d.ts +14 -8
- package/dist/cap.js +19 -9
- package/dist/cli.js +71 -18
- package/dist/closed-pipes.d.ts +2 -0
- package/dist/closed-pipes.js +13 -0
- package/dist/computer-commands.d.ts +2 -0
- package/dist/computer-commands.js +2 -0
- package/dist/computer-keys.d.ts +20 -10
- package/dist/computer-keys.js +36 -54
- package/dist/computer-setting.d.ts +20 -3
- package/dist/computer-setting.js +58 -10
- package/dist/computers.d.ts +35 -2
- package/dist/computers.js +72 -11
- package/dist/confine.d.ts +120 -0
- package/dist/confine.js +436 -0
- package/dist/console/assets/index-B7NKTU8E.css +1 -0
- package/dist/console/assets/index-CXZMgJE7.js +550 -0
- package/dist/console/index.html +2 -2
- package/dist/content-filter.d.ts +7 -0
- package/dist/content-filter.js +23 -0
- package/dist/decision-cap.d.ts +7 -29
- package/dist/decision-cap.js +3 -94
- package/dist/decision-rows.d.ts +1 -1
- package/dist/decision-rows.js +1 -1
- package/dist/docker-daemon.d.ts +31 -0
- package/dist/docker-daemon.js +56 -0
- package/dist/effort-guidance.js +4 -3
- package/dist/environment.d.ts +0 -3
- package/dist/environment.js +3 -5
- package/dist/errors.d.ts +1 -2
- package/dist/errors.js +9 -9
- package/dist/explain.js +3 -1
- package/dist/filed-answer.d.ts +32 -0
- package/dist/filed-answer.js +160 -0
- package/dist/files.d.ts +1 -3
- package/dist/files.js +2 -4
- package/dist/github-connection.d.ts +1 -1
- package/dist/github-connection.js +25 -7
- package/dist/github-faux.d.ts +26 -0
- package/dist/github-faux.js +76 -0
- package/dist/github.d.ts +6 -2
- package/dist/github.js +5 -3
- package/dist/graph-served.d.ts +5 -3
- package/dist/graph-served.js +14 -6
- package/dist/graph-view.d.ts +3 -5
- package/dist/graph-view.js +9 -16
- package/dist/handed-values.d.ts +9 -0
- package/dist/handed-values.js +26 -0
- package/dist/harness-install.d.ts +1 -7
- package/dist/harness-install.js +1 -18
- package/dist/harness-opencode/adapter.d.ts +7 -0
- package/dist/harness-opencode/adapter.js +23 -6
- package/dist/harness-opencode/harness.js +0 -1
- package/dist/harness-opencode/host/policy.js +2 -2
- package/dist/harness-opencode/index.d.ts +1 -1
- package/dist/harness-opencode/index.js +1 -1
- package/dist/harness-opencode/verify.d.ts +17 -0
- package/dist/harness-opencode/verify.js +30 -10
- package/dist/harness-table.js +6 -1
- package/dist/heard.js +1 -1
- package/dist/held-fd.d.ts +5 -0
- package/dist/held-fd.js +14 -0
- package/dist/host-calls.d.ts +20 -0
- package/dist/host-calls.js +12 -0
- package/dist/host-tools.d.ts +4 -21
- package/dist/host-tools.js +4 -61
- package/dist/host.d.ts +2 -4
- package/dist/host.js +2 -7
- package/dist/import-summary.d.ts +1 -5
- package/dist/import-summary.js +0 -21
- package/dist/import.d.ts +6 -6
- package/dist/import.js +14 -15
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/key-refusal.d.ts +5 -1
- package/dist/key-refusal.js +19 -4
- package/dist/learn/check.d.ts +8 -2
- package/dist/learn/check.js +85 -31
- package/dist/learn/folder.d.ts +11 -4
- package/dist/learn/folder.js +17 -19
- package/dist/learn/grade.d.ts +18 -1
- package/dist/learn/grade.js +108 -14
- package/dist/learn/index.d.ts +5 -5
- package/dist/learn/index.js +5 -5
- package/dist/learn/learning.sh +1 -14
- package/dist/learn/notes.d.ts +14 -3
- package/dist/learn/notes.js +16 -6
- package/dist/learn/reflect.d.ts +31 -2
- package/dist/learn/reflect.js +83 -6
- package/dist/learn/relevance.d.ts +24 -0
- package/dist/learn/relevance.js +91 -0
- package/dist/learn/secrets.d.ts +7 -1
- package/dist/learn/secrets.js +86 -19
- package/dist/learn/skills.d.ts +159 -18
- package/dist/learn/skills.js +644 -64
- package/dist/learned-nodes.d.ts +14 -0
- package/dist/learned-nodes.js +8 -0
- package/dist/learned-workflow.d.ts +41 -6
- package/dist/learned-workflow.js +153 -18
- package/dist/learning-routes.d.ts +49 -4
- package/dist/learning-routes.js +113 -31
- package/dist/learning-run.d.ts +16 -31
- package/dist/learning-run.js +31 -38
- package/dist/learning-words.d.ts +12 -5
- package/dist/learning-words.js +18 -9
- package/dist/learning.d.ts +91 -97
- package/dist/learning.js +176 -320
- package/dist/live/stream.js +1 -1
- package/dist/live/translate.js +12 -2
- package/dist/llm.d.ts +4 -1
- package/dist/llm.js +4 -2
- package/dist/local-models.d.ts +11 -5
- package/dist/local-models.js +13 -8
- package/dist/mcp-gateway.d.ts +17 -49
- package/dist/mcp-gateway.js +55 -136
- package/dist/mcp-oauth.d.ts +10 -14
- package/dist/mcp-oauth.js +14 -32
- package/dist/mcp-probe.d.ts +0 -7
- package/dist/mcp-probe.js +4 -10
- package/dist/mcp-servers-store.d.ts +18 -18
- package/dist/mcp-servers-store.js +12 -14
- package/dist/mcp-store.js +3 -4
- package/dist/mcp.js +4 -3
- package/dist/model.d.ts +9 -7
- package/dist/model.js +51 -27
- package/dist/monid.d.ts +0 -2
- package/dist/monid.js +3 -6
- package/dist/openapi.d.ts +8 -1
- package/dist/openapi.js +156 -58
- package/dist/page.d.ts +1 -3
- package/dist/page.js +6 -18
- package/dist/paid-calls.d.ts +21 -27
- package/dist/paid-calls.js +26 -61
- package/dist/pause.d.ts +2 -19
- package/dist/pause.js +5 -74
- package/dist/port-models.d.ts +10 -3
- package/dist/port-models.js +26 -6
- package/dist/propose.d.ts +2 -0
- package/dist/propose.js +80 -45
- package/dist/push-handler.d.ts +1 -1
- package/dist/reflect-range.d.ts +25 -0
- package/dist/reflect-range.js +30 -0
- package/dist/refusal-words.d.ts +5 -1
- package/dist/refusal-words.js +5 -1
- package/dist/rows.d.ts +1 -1
- package/dist/run-cut.d.ts +0 -6
- package/dist/run-cut.js +0 -6
- package/dist/run-db.d.ts +2 -11
- package/dist/run-db.js +2 -37
- package/dist/run-launch.d.ts +21 -2
- package/dist/run-launch.js +14 -5
- package/dist/run-learning-served.d.ts +21 -4
- package/dist/run-learning-served.js +23 -13
- package/dist/run-reads-over-store.d.ts +5 -3
- package/dist/run-reads-over-store.js +25 -14
- package/dist/run-secrets.d.ts +1 -1
- package/dist/run-timeline-served.d.ts +5 -1
- package/dist/run-timeline-served.js +27 -6
- package/dist/run-view.d.ts +37 -22
- package/dist/run-view.js +85 -38
- package/dist/runnable.d.ts +21 -10
- package/dist/runnable.js +35 -12
- package/dist/runner/adapter-loop.d.ts +36 -5
- package/dist/runner/adapter-loop.js +663 -69
- package/dist/runner/adapter-run-spec.d.ts +42 -8
- package/dist/runner/adapter-run-spec.js +186 -52
- package/dist/runner/adapters/index.js +11 -1
- package/dist/runner/adapters/pi.d.ts +40 -2
- package/dist/runner/adapters/pi.js +110 -27
- package/dist/runner/beside.d.ts +38 -3
- package/dist/runner/beside.js +54 -5
- package/dist/runner/claim-secrets.d.ts +16 -1
- package/dist/runner/claim-secrets.js +62 -14
- package/dist/runner/cli-run-spec.d.ts +5 -0
- package/dist/runner/cli-run-spec.js +159 -41
- package/dist/runner/commands.js +1 -1
- package/dist/runner/computer-journal.d.ts +15 -2
- package/dist/runner/computer-journal.js +41 -5
- package/dist/runner/conformance/harness.d.ts +1 -0
- package/dist/runner/conformance/harness.js +123 -13
- package/dist/runner/conformance/subject.d.ts +4 -1
- package/dist/runner/dispatch.d.ts +8 -1
- package/dist/runner/dispatch.js +81 -7
- package/dist/runner/end-of-run.d.ts +8 -2
- package/dist/runner/end-of-run.js +10 -4
- package/dist/runner/github-app.d.ts +7 -2
- package/dist/runner/github-app.js +47 -16
- package/dist/runner/harness-loops.d.ts +15 -2
- package/dist/runner/harness-loops.js +38 -2
- package/dist/runner/journal-kinds.d.ts +60 -6
- package/dist/runner/journal-kinds.js +43 -5
- package/dist/runner/journal-reader.d.ts +1 -1
- package/dist/runner/journal-reader.js +2 -2
- package/dist/runner/learning-ask.d.ts +4 -0
- package/dist/runner/learning-ask.js +15 -1
- package/dist/runner/learning-end.d.ts +18 -3
- package/dist/runner/learning-end.js +194 -20
- package/dist/runner/learning-loop.d.ts +7 -0
- package/dist/runner/learning-loop.js +36 -8
- package/dist/runner/learning-seed.d.ts +6 -0
- package/dist/runner/learning-seed.js +6 -0
- package/dist/runner/loop-contract.d.ts +4 -0
- package/dist/runner/main.d.ts +61 -9
- package/dist/runner/main.js +144 -20
- package/dist/runner/mcp-claim.d.ts +3 -0
- package/dist/runner/mcp-claim.js +7 -3
- package/dist/runner/mcp-github.d.ts +11 -2
- package/dist/runner/mcp-github.js +55 -4
- package/dist/runner/mcp-run.d.ts +2 -0
- package/dist/runner/mcp-run.js +16 -5
- package/dist/runner/memory-claim.d.ts +9 -0
- package/dist/runner/memory-claim.js +25 -0
- package/dist/runner/metrics.d.ts +46 -1
- package/dist/runner/metrics.js +156 -1
- package/dist/runner/model-route.d.ts +16 -0
- package/dist/runner/model-route.js +134 -10
- package/dist/runner/reflect-hook.d.ts +12 -1
- package/dist/runner/reflect-hook.js +33 -3
- package/dist/runner/runner.d.ts +20 -0
- package/dist/runner/runner.js +146 -18
- package/dist/runner/spec-holds.d.ts +7 -2
- package/dist/runner/spec-holds.js +4 -3
- package/dist/runner/store-port.d.ts +1 -1
- package/dist/runner/store-secrets.d.ts +3 -3
- package/dist/runner/store-secrets.js +8 -12
- package/dist/runner/text-tools.d.ts +44 -0
- package/dist/runner/text-tools.js +237 -0
- package/dist/runner/workflow-host.d.ts +7 -2
- package/dist/runner/workflow-host.js +3 -1
- package/dist/runner/workflow-loop.d.ts +10 -1
- package/dist/runner/workflow-loop.js +14 -6
- package/dist/runner/workflow-spec.d.ts +21 -0
- package/dist/runner/workflow-spec.js +217 -93
- package/dist/runs-over-store.d.ts +14 -3
- package/dist/runs-over-store.js +100 -23
- package/dist/seal-key.d.ts +0 -2
- package/dist/seal-key.js +5 -45
- package/dist/sealed-settings-store.d.ts +19 -4
- package/dist/sealed-settings-store.js +9 -9
- package/dist/sealing.d.ts +4 -0
- package/dist/sealing.js +20 -0
- package/dist/secret-cut.d.ts +1 -1
- package/dist/secret-cut.js +1 -1
- package/dist/secret-name.d.ts +9 -0
- package/dist/secret-name.js +15 -0
- package/dist/secret-writes.d.ts +0 -1
- package/dist/secret-writes.js +0 -1
- package/dist/server-fs.d.ts +4 -0
- package/dist/server-fs.js +8 -2
- package/dist/server-lock.d.ts +0 -24
- package/dist/server-lock.js +5 -85
- package/dist/server-secrets-store.d.ts +4 -4
- package/dist/server-secrets-store.js +9 -31
- package/dist/server-secrets.d.ts +4 -9
- package/dist/server-secrets.js +12 -36
- package/dist/server.d.ts +37 -56
- package/dist/server.js +322 -134
- package/dist/sign-ins-store.d.ts +34 -36
- package/dist/sign-ins-store.js +27 -38
- package/dist/sign-ins.d.ts +2 -119
- package/dist/sign-ins.js +5 -311
- package/dist/standard-webhooks.d.ts +1 -1
- package/dist/standard-webhooks.js +1 -1
- package/dist/stats.d.ts +3 -2
- package/dist/stats.js +1 -1
- package/dist/stop-signals.d.ts +4 -2
- package/dist/stop-signals.js +5 -3
- package/dist/store/agent-body.d.ts +12 -2
- package/dist/store/agent-body.js +22 -4
- package/dist/store/deadline.d.ts +18 -0
- package/dist/store/deadline.js +45 -0
- package/dist/store/index.d.ts +2 -2
- package/dist/store/index.js +2 -2
- package/dist/store/open.d.ts +6 -3
- package/dist/store/open.js +2 -2
- package/dist/store/postgres/connection.d.ts +22 -2
- package/dist/store/postgres/connection.js +211 -41
- package/dist/store/postgres/migrate.d.ts +4 -0
- package/dist/store/postgres/migrate.js +9 -2
- package/dist/store/postgres/migrations/0003_commands_one_answer.check.sql +19 -0
- package/dist/store/postgres/migrations/0003_commands_one_answer.sql +13 -0
- package/dist/store/postgres/store.d.ts +9 -2
- package/dist/store/postgres/store.js +9 -0
- package/dist/store/schema.js +1 -1
- package/dist/store/seal.js +2 -2
- package/dist/store/sqlite/connection.js +14 -5
- package/dist/store/sqlite/run-patch.d.ts +3 -0
- package/dist/store/sqlite/run-patch.js +3 -0
- package/dist/store/sqlite/store.js +41 -12
- package/dist/store/store.d.ts +35 -6
- package/dist/store/store.js +12 -2
- package/dist/store-reads/cap.d.ts +1 -1
- package/dist/store-reads/cap.js +22 -4
- package/dist/store-reads/journal.d.ts +9 -6
- package/dist/store-reads/journal.js +129 -18
- package/dist/store-reads/learning.d.ts +82 -8
- package/dist/store-reads/learning.js +184 -11
- package/dist/store-reads/workflow.d.ts +1 -1
- package/dist/store-reads/workflow.js +1 -1
- package/dist/store-view.d.ts +19 -1
- package/dist/store-view.js +95 -27
- package/dist/template-eval.d.ts +60 -4
- package/dist/template-eval.js +120 -54
- package/dist/templates.d.ts +33 -14
- package/dist/templates.js +82 -46
- package/dist/timeline/group.d.ts +33 -0
- package/dist/timeline/group.js +77 -0
- package/dist/timeline/index.d.ts +7 -0
- package/dist/timeline/index.js +7 -0
- package/dist/timeline/labels.d.ts +79 -0
- package/dist/timeline/labels.js +150 -0
- package/dist/timeline/origin.d.ts +56 -0
- package/dist/timeline/origin.js +92 -0
- package/dist/timeline/render-text.d.ts +11 -0
- package/dist/timeline/render-text.js +62 -0
- package/dist/timeline/timeline.d.ts +282 -0
- package/dist/timeline/timeline.js +1308 -0
- package/dist/timeline/util.d.ts +17 -0
- package/dist/timeline/util.js +49 -0
- package/dist/tool-budget.d.ts +18 -0
- package/dist/tool-budget.js +50 -0
- package/dist/tool-gate.d.ts +47 -218
- package/dist/tool-gate.js +87 -545
- package/dist/tool-keys-store.d.ts +11 -12
- package/dist/tool-keys-store.js +24 -31
- package/dist/tool-keys.d.ts +5 -101
- package/dist/tool-keys.js +8 -267
- package/dist/tool-plane.d.ts +23 -52
- package/dist/tool-plane.js +23 -81
- package/dist/tool-settings-store.d.ts +1 -2
- package/dist/tool-settings-store.js +5 -8
- package/dist/tools.d.ts +67 -25
- package/dist/tools.js +170 -119
- package/dist/trigger-adapter.d.ts +2 -2
- package/dist/trigger-targets.d.ts +13 -1
- package/dist/trigger-targets.js +31 -1
- package/dist/triggers.d.ts +2 -2
- package/dist/triggers.js +3 -3
- package/dist/turn-end.d.ts +1 -1
- package/dist/turn-end.js +1 -1
- package/dist/turns.d.ts +0 -6
- package/dist/turns.js +0 -19
- package/dist/uploads.d.ts +28 -5
- package/dist/uploads.js +83 -10
- package/dist/usage.d.ts +1 -49
- package/dist/usage.js +3 -84
- package/dist/validate.d.ts +4 -0
- package/dist/validate.js +33 -14
- package/dist/webhooks.d.ts +102 -76
- package/dist/webhooks.js +266 -233
- package/dist/workflow-run.d.ts +114 -0
- package/dist/workflow-run.js +144 -0
- package/dist/workspace/archil-claim.d.ts +2 -2
- package/dist/workspace/archil-claim.js +4 -3
- package/dist/workspace/archil-disk.d.ts +10 -1
- package/dist/workspace/archil-disk.js +4 -0
- package/dist/workspace/archil-exec.d.ts +12 -2
- package/dist/workspace/archil-exec.js +16 -0
- package/dist/workspace/archil.d.ts +2 -2
- package/dist/workspace/archil.js +25 -5
- package/dist/workspace/attach.js +2 -0
- package/dist/workspace/beneath.d.ts +19 -0
- package/dist/workspace/beneath.js +106 -0
- package/dist/workspace/computer-deps.d.ts +26 -9
- package/dist/workspace/computer-deps.js +144 -43
- package/dist/workspace/computer-for-claim.d.ts +17 -14
- package/dist/workspace/computer-for-claim.js +99 -26
- package/dist/workspace/computer-hold.d.ts +6 -1
- package/dist/workspace/computer-hold.js +6 -1
- package/dist/workspace/computer-janitor.d.ts +47 -0
- package/dist/workspace/computer-janitor.js +182 -0
- package/dist/workspace/computer-ledger.d.ts +1 -8
- package/dist/workspace/computer-ledger.js +0 -3
- package/dist/workspace/computer-providers.d.ts +5 -3
- package/dist/workspace/computer-providers.js +11 -9
- package/dist/workspace/grep-worker.d.ts +5 -0
- package/dist/workspace/grep-worker.js +9 -6
- package/dist/workspace/hands.d.ts +5 -2
- package/dist/workspace/hands.js +4 -3
- package/dist/workspace/index.d.ts +6 -5
- package/dist/workspace/index.js +4 -4
- package/dist/workspace/local.d.ts +14 -2
- package/dist/workspace/local.js +170 -43
- package/dist/workspace/paths.js +3 -2
- package/dist/workspace/pi-env.d.ts +4 -0
- package/dist/workspace/pi-env.js +3 -2
- package/dist/workspace/resolve-computer.d.ts +55 -10
- package/dist/workspace/resolve-computer.js +66 -14
- package/dist/workspace/run-tools.d.ts +15 -31
- package/dist/workspace/run-tools.js +19 -30
- package/dist/workspace/workspace.d.ts +5 -0
- package/dist/workspace-paths.d.ts +0 -17
- package/dist/workspace-paths.js +1 -41
- package/dist/workspace.d.ts +0 -17
- package/dist/workspace.js +4 -110
- package/package.json +14 -14
- package/skills/agentrun-serve/SKILL.md +1 -1
- package/templates/README.md +11 -5
- package/templates/code-review/evals/mentions-defused/case.yaml +15 -0
- package/templates/code-review/evals/mentions-defused/fixtures/github-mcp.json +254 -0
- package/templates/code-review/evals/mentions-defused/graders/no-pings.md +16 -0
- package/templates/code-review/evals/mentions-defused/graders/posted-a-review.md +5 -0
- package/templates/code-review/evals/mentions-defused/graders/schema.md +5 -0
- package/templates/code-review/evals/mentions-defused/prompt.md +10 -0
- package/templates/kyb/evals/clean-public-company/graders/no-opensanctions.md +5 -0
- package/templates/kyb/evals/opensanctions-on/case.yaml +5 -0
- package/templates/kyb/evals/opensanctions-on/graders/licence-and-evidence.md +18 -0
- package/templates/kyb/evals/opensanctions-on/graders/schema.md +5 -0
- package/templates/kyb/evals/opensanctions-on/prompt.md +11 -0
- package/templates/market-monitor/agent.md +2 -2
- package/templates/market-monitor/skills/monitor/SKILL.md +6 -4
- package/templates/release-notes/agent.md +11 -0
- package/dist/bound-files.d.ts +0 -4
- package/dist/bound-files.js +0 -164
- package/dist/coding-tools.d.ts +0 -47
- package/dist/coding-tools.js +0 -189
- package/dist/computer-adb.d.ts +0 -12
- package/dist/computer-adb.js +0 -14
- package/dist/console/assets/index-Dn0ngwG9.js +0 -535
- package/dist/console/assets/index-DvW6Aled.css +0 -1
- package/dist/grade.d.ts +0 -63
- package/dist/grade.js +0 -150
- package/dist/mcp-servers.d.ts +0 -269
- package/dist/mcp-servers.js +0 -456
- package/dist/packs.d.ts +0 -71
- package/dist/packs.js +0 -180
- package/dist/sealed-settings.d.ts +0 -60
- package/dist/sealed-settings.js +0 -171
- package/dist/sessions.d.ts +0 -6
- package/dist/sessions.js +0 -109
- package/dist/workspace/computer-serves.d.ts +0 -12
- package/dist/workspace/computer-serves.js +0 -15
|
@@ -4,7 +4,7 @@ import type { HostTool, Wire } from "@parcha/agentrun-kernel";
|
|
|
4
4
|
import type { Approvals } from "../approvals.js";
|
|
5
5
|
import type { installSettled } from "../harness-install.js";
|
|
6
6
|
import type { LiveHandover, LiveViewerStore } from "../browser-live.js";
|
|
7
|
-
import type
|
|
7
|
+
import { type PinnedModel, type Tier } from "../model.js";
|
|
8
8
|
import { type RunLaunch } from "../run-launch.js";
|
|
9
9
|
import type { Store } from "../store/store.js";
|
|
10
10
|
import { type Permission, type RunFiles, type SettingFrom } from "../tool-gate.js";
|
|
@@ -13,12 +13,14 @@ import { type ToolHost } from "../tools.js";
|
|
|
13
13
|
import { type HostToolCtx } from "../host-tools.js";
|
|
14
14
|
import { type LearnedWorkflow } from "../learning.js";
|
|
15
15
|
import { type ToolResults } from "../workspace/run-tools.js";
|
|
16
|
+
import { type ClaimMcp } from "./mcp-run.js";
|
|
16
17
|
import { type AdapterRun, type AdapterRunSpec, hostLifecycle } from "./adapter-loop.js";
|
|
17
18
|
import { type Claim, type Journal } from "./loop-contract.js";
|
|
18
19
|
import type { ModelRoute } from "./model-route.js";
|
|
19
20
|
import { type ArchilClaimOptions } from "../workspace/archil-claim.js";
|
|
20
21
|
import { type claimComputer, type ComputerDeps } from "../workspace/computer-deps.js";
|
|
21
22
|
import type { RunComputer } from "../workspace/run-tools.js";
|
|
23
|
+
import type { ShellPlace } from "../workspace/resolve-computer.js";
|
|
22
24
|
import type { Workspace } from "../workspace/workspace.js";
|
|
23
25
|
import { type HeldRedact } from "./redact.js";
|
|
24
26
|
/** What a claim gives the shared computerForClaim: the run, its epoch, its revision, its place and any computer choice. */
|
|
@@ -52,10 +54,10 @@ export declare const PI_WIRES: readonly Wire[];
|
|
|
52
54
|
/** Whether the runner offers the browser at all: on pi's native route (PiAdapterOptions.extensions), where pi-browser's
|
|
53
55
|
* durable extension runs in the claim's Harness, its tools pi's own tool tasks (their memo, task and conversations). */
|
|
54
56
|
export declare const BROWSER_ON_RUNNER = true;
|
|
55
|
-
/** Whether the runner installs the browser for a run whose revision grants `granted`,
|
|
56
|
-
* (
|
|
57
|
-
* held on this process's own spend. */
|
|
58
|
-
export declare const browserListed: (host: Pick<ToolHost, "ledger">, granted: readonly string[]) => boolean;
|
|
57
|
+
/** Whether the runner installs the browser for a run whose revision grants `granted`, or whose computer is a browser
|
|
58
|
+
* (host.browserComputer), fail closed: only on the native route (BROWSER_ON_RUNNER), and only with the run's ledger
|
|
59
|
+
* booking on its ToolHost (host.ledger.paid), so no browser call is held on this process's own spend. */
|
|
60
|
+
export declare const browserListed: (host: Pick<ToolHost, "ledger" | "browserComputer">, granted: readonly string[]) => boolean;
|
|
59
61
|
/** What the runner hands the spec builder, beside the claim and the loop's own Harness (the AdapterRun): the store (its
|
|
60
62
|
* agent and run reads, and the live-viewer seam the browser tool writes through), the data directory a Mode 1 run folder
|
|
61
63
|
* sits in, the model route, and the key the live-viewer tokens are sealed under. One per runner, not per claim. */
|
|
@@ -75,6 +77,8 @@ export interface AdapterSpecDeps {
|
|
|
75
77
|
readonly routeOf: (model: string | PinnedModel | undefined, env: NodeJS.ProcessEnv, tier?: Tier, wires?: readonly Wire[], upstream?: typeof fetch, redact?: (text: string) => string) => Promise<ModelRoute>;
|
|
76
78
|
/** The run's log line (what its Workspace and computer have to say that is not a run failure). */
|
|
77
79
|
readonly log?: (message: string) => void;
|
|
80
|
+
/** For tests: a learning run's grade bound, as a signal (learning-dispatch.ts gradeBound). Default: GRADE_TIMEOUT_MS. */
|
|
81
|
+
readonly gradeBound?: () => AbortSignal;
|
|
78
82
|
/** The one shared claim-time computer (computer-for-claim.ts), for both the pi and the CLI spec: none for a runner place.
|
|
79
83
|
* The runner gives it; a test gives its own. */
|
|
80
84
|
readonly computerForClaim: ComputerForClaim;
|
|
@@ -122,8 +126,8 @@ export declare function modelAskOf(pinned: {
|
|
|
122
126
|
* The run's gate before a call's intent, as the adapter loop asks it: the revision's tool settings and approvals over the
|
|
123
127
|
* server's, from the one store (loadToolSettings), through RunGate (decide: deny with its words, a pin, allow, ask). The
|
|
124
128
|
* adapter loop handles the ask/park/answer on the journal itself, so only the answer is read here, never RunGate's own
|
|
125
|
-
* file-based approval flow. `root`: the run's
|
|
126
|
-
*
|
|
129
|
+
* file-based approval flow. `root`: the run's folder, the run's Workspace (Mode 2: its folder on the run's disk, never a
|
|
130
|
+
* folder of this machine) or the local folder's path, for the gate's path checks; nothing in it is read.
|
|
127
131
|
*
|
|
128
132
|
* The server's settings are read again at each call, from the store (a row of the local store: no cache, no signal from
|
|
129
133
|
* the server, which may be another process), so a permission set while the run goes reaches its next call ("applies at the
|
|
@@ -139,6 +143,11 @@ export type RunPermissions = {
|
|
|
139
143
|
readonly policy: (tool: string) => Permission;
|
|
140
144
|
readonly denyFrom: (tool: string) => SettingFrom;
|
|
141
145
|
readonly refresh: () => Promise<void>;
|
|
146
|
+
/** The gate's whole decision of one call with its arguments (RunGate.decide: its deny, its argument pins, its ask or a
|
|
147
|
+
* refusal where no one can approve), as the run's own call of the tool gets it: a learned workflow's MCP node's. */
|
|
148
|
+
readonly decide: (tool: string, args: unknown) => Promise<"allow" | "ask" | {
|
|
149
|
+
deny: string;
|
|
150
|
+
}>;
|
|
142
151
|
};
|
|
143
152
|
export declare function adapterRunGate(store: Pick<Store, "settings">, claim: Pick<Claim, "runId">, revision: {
|
|
144
153
|
kind: string;
|
|
@@ -146,9 +155,11 @@ export declare function adapterRunGate(store: Pick<Store, "settings">, claim: Pi
|
|
|
146
155
|
toolSettings?: unknown;
|
|
147
156
|
harness?: string;
|
|
148
157
|
approvals?: Approvals;
|
|
158
|
+
maxToolCalls?: number;
|
|
149
159
|
};
|
|
150
|
-
}, root: RunFiles): Promise<NonNullable<AdapterRunSpec["gate"]> & {
|
|
160
|
+
}, root: RunFiles, shell?: ShellPlace): Promise<NonNullable<AdapterRunSpec["gate"]> & {
|
|
151
161
|
readonly permissions: RunPermissions;
|
|
162
|
+
readonly learn: (flows: readonly LearnedWorkflow[]) => void;
|
|
152
163
|
}>;
|
|
153
164
|
/** The server's tool settings from the store now; a read that throws is unread (no value of it said). A workflow's call
|
|
154
165
|
* and model nodes read theirs through it too (workflow-spec.ts callPolicyOf), so both gates fail closed alike. */
|
|
@@ -165,6 +176,22 @@ export declare function hostToolCtxOf(run: AdapterRun, context: Context, results
|
|
|
165
176
|
* a workflow it may run (`workflows`: the claim's seed lay chose them, runner/learning-seed.ts). A revision never names
|
|
166
177
|
* the tool among its own: the run has it beside them, so the harness is told of it as of theirs. */
|
|
167
178
|
export declare const learnsWorkflows: (kind: string, workflows: readonly LearnedWorkflow[]) => boolean;
|
|
179
|
+
/** A tier a learned workflow's node names, as the run has it: its model's id, or why it could not be reached. */
|
|
180
|
+
export type LearnedTier = {
|
|
181
|
+
readonly model: string;
|
|
182
|
+
} | {
|
|
183
|
+
readonly why: string;
|
|
184
|
+
};
|
|
185
|
+
/** The tiers other than the default that `workflows`' model nodes and `llm` calls name (model.ts nodeTiers, llmTiers),
|
|
186
|
+
* in TIERS order. A workflow that does not parse names none: its call refuses it. */
|
|
187
|
+
export declare function learnedTiers(workflows: readonly LearnedWorkflow[]): Tier[];
|
|
188
|
+
/** The route of each tier `workflows` name (learnedTiers) that `env` names a model of its own for (tierModelOf:
|
|
189
|
+
* AGENT_MODEL_FAST, AGENT_MODEL_STRONG), through `routeOf` (the run's one route, as its own model's): the model a node
|
|
190
|
+
* of that tier runs on, priced at its own price. A tier with no model of its own is left out (its nodes run on the
|
|
191
|
+
* run's model); one whose route is refused is `why`, so its nodes fail in those words and never run on another model. */
|
|
192
|
+
export declare function learnedTierRoutes(workflows: readonly LearnedWorkflow[], env: NodeJS.ProcessEnv, routeOf: (tier: Tier) => Promise<ModelRoute>): Promise<Map<Tier, ModelRoute | {
|
|
193
|
+
why: string;
|
|
194
|
+
}>>;
|
|
168
195
|
/** The run's learned_workflow tool as a HostTool, listed when the run has it (learnsWorkflows: an agentic revision whose
|
|
169
196
|
* agent learned workflows, by learning.ts chooseWorkflows as main's start chooses them, so the tool set the model sees
|
|
170
197
|
* matches main). `granted`, the revision's own tools, are the ones its workflows' call nodes may call. Every run's session — pi's and every CLI harness's — has a model
|
|
@@ -183,6 +210,13 @@ export declare function learnedWorkflowHostTool(opts: {
|
|
|
183
210
|
/** The run's gate's permissions (adapterRunGate): each call node's tool is held to them, as main holds it. */
|
|
184
211
|
readonly permissions: RunPermissions;
|
|
185
212
|
readonly ctx: HostToolCtx;
|
|
213
|
+
/** The run's models of other tiers (pi's: learnedTierRoutes), by tier: a node of one runs on that model, through the
|
|
214
|
+
* session's port of the tier (AdapterSession.port's `tier`); one with `why` fails in those words. A tier not here runs
|
|
215
|
+
* on the session's model. */
|
|
216
|
+
readonly tiers?: ReadonlyMap<string, LearnedTier>;
|
|
217
|
+
/** The claim's MCP (mcp-run.ts mcpForClaim), when its revision grants an MCP tool: its call nodes may name its tools by
|
|
218
|
+
* catalog name, each run through the run's own MCP as the loop wraps it. */
|
|
219
|
+
readonly mcp?: Pick<ClaimMcp, "tools" | "catalogOf">;
|
|
186
220
|
}): Promise<HostTool | undefined>;
|
|
187
221
|
/** The run's non-hand tools as HostTool[], bound through the ToolHost seam and wrapped as the hands are (host-tools.ts
|
|
188
222
|
* hostToolOf): web_fetch, web_search and monid, each by its catalog name under the adapter loop's one gate (`spec.gate`;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { BACKGROUND_CONTEXT } from "@earendil-works/chord/context";
|
|
2
2
|
import { defineExtension, ROOT_CONVERSATION_ID } from "@earendil-works/pi-durable";
|
|
3
3
|
import { checkRaise, followUpOf, parkOf } from "@parcha/agentrun-kernel/kernel/cap";
|
|
4
|
+
import { inspectWorkflow } from "@parcha/agentrun-dsl";
|
|
4
5
|
import { dropLiveViewer, putLiveViewer } from "../browser-live.js";
|
|
6
|
+
import { llmTiers, nodeTiers, thinkingLevel, TIERS, tierModelOf, workflowNodes } from "../model.js";
|
|
5
7
|
import { firstMessage } from "../run-manifest.js";
|
|
6
|
-
import { learningStartOf } from "../run-launch.js";
|
|
8
|
+
import { learningStartOf, seedFailed } from "../run-launch.js";
|
|
7
9
|
import { isObject } from "../validate.js";
|
|
8
|
-
import { runGate } from "../tool-gate.js";
|
|
10
|
+
import { deniedText, noApproverText, runGate } from "../tool-gate.js";
|
|
9
11
|
import { loadToolSettings, recheckPlane, TOOL_PLANE_ENV } from "../tool-plane.js";
|
|
10
12
|
import { readApprovers } from "../server-approvers.js";
|
|
11
13
|
import { ASK_TOOL, askPerson, toolOf } from "../tools.js";
|
|
@@ -15,22 +17,21 @@ import { WEB_SEARCH_TOOL } from "../web-search.js";
|
|
|
15
17
|
import { environmentLine } from "../environment.js";
|
|
16
18
|
import { effortGuidance } from "../effort-guidance.js";
|
|
17
19
|
import { laidLearned, learningFolderOf, secretsShown } from "../learning.js";
|
|
18
|
-
import { layLearningSeed } from "./learning-seed.js";
|
|
20
|
+
import { laidOf, layLearningSeed } from "./learning-seed.js";
|
|
19
21
|
import { learningWorkspace } from "../learn/folder.js";
|
|
20
22
|
import { learningEndOfRun } from "./learning-end.js";
|
|
21
|
-
import { LEARNED_WORKFLOW_TOOL, learnedWorkflowTool } from "../learned-workflow.js";
|
|
22
|
-
import { PORT_PROVIDER } from "../port-models.js";
|
|
23
|
+
import { learnedAskFits, learnedAskShown, LEARNED_WORKFLOW_TOOL, learnedMcpTools, learnedWorkflowTool } from "../learned-workflow.js";
|
|
24
|
+
import { PORT_PROVIDER, tieredModels, tierProvider } from "../port-models.js";
|
|
23
25
|
import { promptOf, readsFiles } from "../skills.js";
|
|
24
26
|
import { openRunWorkspace } from "../workspace/run-workspace.js";
|
|
25
27
|
import { layOwnSkills } from "../workspace/revision-skills.js";
|
|
26
28
|
import { COMPUTER_ROOT, runFolder } from "../workspace/paths.js";
|
|
27
29
|
import { runTools, withKindTools } from "../workspace/run-tools.js";
|
|
28
|
-
import {
|
|
30
|
+
import { copyRunFiles } from "../uploads.js";
|
|
29
31
|
import { handedSignInReadsBack, signInReads } from "../sign-ins-store.js";
|
|
30
32
|
import { UNREADABLE_SIGN_IN } from "../run-view.js";
|
|
31
|
-
import { claimSecrets, withModelKeys } from "./claim-secrets.js";
|
|
33
|
+
import { claimSecrets, learnedDecisionKeys, tierModelKeys, withModelKeys } from "./claim-secrets.js";
|
|
32
34
|
import { mcpForClaim } from "./mcp-run.js";
|
|
33
|
-
import { join } from "node:path";
|
|
34
35
|
import { hostLifecycle } from "./adapter-loop.js";
|
|
35
36
|
import { piAdapter } from "./adapters/pi.js";
|
|
36
37
|
import { entriesOf } from "./loop.js";
|
|
@@ -43,6 +44,7 @@ import { imageWaitWords } from "../workspace/computer-deps.js";
|
|
|
43
44
|
import { heldRedactor, holdClaimed, runnerSecrets, secretRedactor } from "./redact.js";
|
|
44
45
|
import { githubAppAccess } from "./github-app.js";
|
|
45
46
|
import { holdStored, storeSecrets } from "./store-secrets.js";
|
|
47
|
+
import { bashPolicyOf } from "../bash-read-only.js";
|
|
46
48
|
/** The wires pi speaks on the runner: main's pi's (provider.ts), Anthropic's Messages and OpenAI's Responses. */
|
|
47
49
|
export const PI_WIRES = Object.freeze(["anthropic-messages", "openai-responses"]);
|
|
48
50
|
/** The browser's catalog name (tools.ts TOOLS.browser). */
|
|
@@ -50,10 +52,10 @@ const BROWSER_TOOL = "browser";
|
|
|
50
52
|
/** Whether the runner offers the browser at all: on pi's native route (PiAdapterOptions.extensions), where pi-browser's
|
|
51
53
|
* durable extension runs in the claim's Harness, its tools pi's own tool tasks (their memo, task and conversations). */
|
|
52
54
|
export const BROWSER_ON_RUNNER = true;
|
|
53
|
-
/** Whether the runner installs the browser for a run whose revision grants `granted`,
|
|
54
|
-
* (
|
|
55
|
-
* held on this process's own spend. */
|
|
56
|
-
export const browserListed = (host, granted) => BROWSER_ON_RUNNER && host.ledger?.paid !== undefined && granted.includes(BROWSER_TOOL);
|
|
55
|
+
/** Whether the runner installs the browser for a run whose revision grants `granted`, or whose computer is a browser
|
|
56
|
+
* (host.browserComputer), fail closed: only on the native route (BROWSER_ON_RUNNER), and only with the run's ledger
|
|
57
|
+
* booking on its ToolHost (host.ledger.paid), so no browser call is held on this process's own spend. */
|
|
58
|
+
export const browserListed = (host, granted) => BROWSER_ON_RUNNER && host.ledger?.paid !== undefined && (granted.includes(BROWSER_TOOL) || host.browserComputer !== undefined);
|
|
57
59
|
/** A model as the cap prices it, from the route's catalog cost: its price WITH TIERS (the money rule — a request past a
|
|
58
60
|
* model's tier is held and booked at the tier, as main's calculateCost does). `api` is the proxy's shape, for the
|
|
59
61
|
* overhead its provider adds; the output ceiling is the route's when it carries one, else none. */
|
|
@@ -78,20 +80,61 @@ export function capModelOf(route) {
|
|
|
78
80
|
export function modelAskOf(pinned, ref) {
|
|
79
81
|
return pinned ? { pinned, ...(ref ? { ref } : {}) } : ref;
|
|
80
82
|
}
|
|
81
|
-
export async function adapterRunGate(store, claim, revision, root) {
|
|
83
|
+
export async function adapterRunGate(store, claim, revision, root, shell) {
|
|
82
84
|
let current = await storeSettings(store);
|
|
83
85
|
const approvers = await readApprovers(store.settings);
|
|
84
86
|
// A Workspace's paths are in the run's folder: its folder named as a computer names it, for the gate's path checks.
|
|
85
87
|
const folder = typeof root === "string" ? root : COMPUTER_ROOT;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
+
// Where the run's shell is (run-tools.ts shell): with no computer, a tool no setting names takes the kernel's ruled
|
|
89
|
+
// default (tool-gate.ts defaultPermission): bash asks first, the background tools are refused.
|
|
90
|
+
const gate = runGate({ root: folder, work: folder, ...(shell === undefined ? {} : { computer: shell === "computer" }) }, claim.runId, revision, () => current, approvers);
|
|
91
|
+
// The run's learned workflows, once its spec has read them (learn): a learned_workflow call is asked about its MCP nodes.
|
|
92
|
+
let learned = [];
|
|
93
|
+
const decide = async (call, options = {}) => {
|
|
88
94
|
current = await storeSettings(store);
|
|
89
|
-
|
|
95
|
+
const decision = await gate.decide(call.tool, call.args, options);
|
|
96
|
+
// A learned workflow's MCP nodes are the run's own MCP calls, held to the same settings, decided for the whole call
|
|
97
|
+
// before any node runs, never mid-run: one set to deny refuses the call in the gate's words, nothing sent; one set to
|
|
98
|
+
// ask asks for the call, up front, on the run's one card (a running workflow can't park mid-call: it is never run
|
|
99
|
+
// again after a crash), and the person's allow lets that call's MCP nodes run, and only that call's.
|
|
100
|
+
// Checked whether the learned_workflow call is itself allowed or asked: a workflow that can't run is never put to a
|
|
101
|
+
// person.
|
|
102
|
+
if (call.tool !== LEARNED_WORKFLOW_TOOL || typeof decision === "object")
|
|
103
|
+
return decision;
|
|
104
|
+
const tools = await mcpOf(call.args);
|
|
105
|
+
const refused = (why) => ({ deny: `The learned workflow ${String(call.args.name)} was not run: ${why}` });
|
|
106
|
+
const denied = tools.find((tool) => gate.policy(tool) === "deny");
|
|
107
|
+
if (denied)
|
|
108
|
+
return refused(deniedText(denied, undefined, gate.denyFrom(denied)));
|
|
109
|
+
const asks = tools.filter((tool) => gate.policy(tool) === "ask");
|
|
110
|
+
// An ask no one can answer (the server's accounts off) is refused at once in the gate's words, never parked.
|
|
111
|
+
if (asks.length && !approvers)
|
|
112
|
+
return refused(noApproverText(asks[0], "no"));
|
|
113
|
+
// A card that could not name every MCP tool the person would approve (past its preview's bound) is never shown: the
|
|
114
|
+
// call is refused, so no allow covers a tool its approver did not see.
|
|
115
|
+
if (asks.length && !learnedAskFits(asks))
|
|
116
|
+
return refused(`its approval card can't name all ${asks.length} MCP tools it would call that are set to ask: set some of them to allow or deny for this agent.`);
|
|
117
|
+
return asks.length ? "ask" : decision;
|
|
118
|
+
};
|
|
119
|
+
/** The MCP tools the learned workflow a learned_workflow call names can call; none for another call or workflow. */
|
|
120
|
+
const mcpOf = async (args) => {
|
|
121
|
+
const flow = learned.find((one) => one.name === args?.name);
|
|
122
|
+
return flow ? learnedMcpTools(flow.workflow) : [];
|
|
90
123
|
};
|
|
91
124
|
// An ask is named as main's pending approval is (RunGate.askedAs: its settings key), beside the decision, which is
|
|
92
125
|
// unchanged. The permissions are the learned workflow's (main's toolGate.policy and denyFrom), over the same settings.
|
|
93
|
-
const permissions = { policy: (tool) => gate.policy(tool), denyFrom: (tool) => gate.denyFrom(tool), refresh: async () => { current = await storeSettings(store); } };
|
|
94
|
-
|
|
126
|
+
const permissions = { policy: (tool) => gate.policy(tool), denyFrom: (tool) => gate.denyFrom(tool), refresh: async () => { current = await storeSettings(store); }, decide: (tool, args) => gate.decide(tool, args) };
|
|
127
|
+
// What a learned_workflow call's card shows beside its own input: every MCP tool set to ask that the workflow can call,
|
|
128
|
+
// and that their arguments are decided while it runs, so the person sees what they approve.
|
|
129
|
+
const askedFor = async (tool, args) => {
|
|
130
|
+
if (tool !== LEARNED_WORKFLOW_TOOL)
|
|
131
|
+
return undefined;
|
|
132
|
+
const asks = (await mcpOf(args)).filter((one) => gate.policy(one) === "ask");
|
|
133
|
+
return asks.length ? learnedAskShown(asks) : undefined;
|
|
134
|
+
};
|
|
135
|
+
// The revision's tool-call budget (tool-budget.ts), which the adapter loop holds each conversation's calls to.
|
|
136
|
+
const toolCalls = revision.body.maxToolCalls;
|
|
137
|
+
return Object.assign(decide, { askedAs: (tool) => gate.askedAs(tool), askedFor, permissions, learn: (flows) => void (learned = flows), ...(toolCalls === undefined ? {} : { toolCalls }) });
|
|
95
138
|
}
|
|
96
139
|
/** The server's tool settings from the store now; a read that throws is unread (no value of it said). A workflow's call
|
|
97
140
|
* and model nodes read theirs through it too (workflow-spec.ts callPolicyOf), so both gates fail closed alike. */
|
|
@@ -152,21 +195,15 @@ async function adapterSpec(launch, run, deps, claim, holds) {
|
|
|
152
195
|
? await openRunWorkspace({ mode: 1, agentId: runRow.agentId, runId: claim.runId, data: deps.data, log })
|
|
153
196
|
: await openRunWorkspace({ mode: 2, agentId: runRow.agentId, runId: claim.runId, archil, log });
|
|
154
197
|
holds.hold({ ws });
|
|
155
|
-
// The run's uploaded files, copied into its work/inputs/ before the first turn,
|
|
156
|
-
//
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
const copied = await ws.workspace.list(INPUTS_DIR).then(() => true, () => false);
|
|
160
|
-
if (!copied) {
|
|
161
|
-
const uploads = new Uploads(join(deps.data, UPLOADS_DIR));
|
|
162
|
-
await uploads.copyInto(ws.workspace, await uploads.readyFiles(launch.files));
|
|
163
|
-
}
|
|
164
|
-
}
|
|
198
|
+
// The run's uploaded files, copied into its work/inputs/ before the first turn, from what its start held for it, once
|
|
199
|
+
// per run (uploads.ts copyRunFiles); a copy that fails ends the run failed, saying why.
|
|
200
|
+
if (launch.files?.length)
|
|
201
|
+
await copyRunFiles(deps.data, claim.runId, ws.workspace, launch.files);
|
|
165
202
|
// The run's MCP for this claim (mcp-run.ts mcpForClaim): its pin made at the first claim or read as written, its
|
|
166
203
|
// credentials opened under the server's seal key into this claim's memory, one gateway for the claim. First, before
|
|
167
204
|
// anything the spec would have to let go: a refusal (a pin that cannot be made, a pinned meta tool) ends the run in its
|
|
168
205
|
// words before the session opens. The seal key is the runner's own (deps.sealKey), not re-read from the environment.
|
|
169
|
-
const mcp = await mcpForClaim({ claim, store: deps.store, sealKey: deps.sealKey, grants: granted, harness: run.harness, work: () => ws.workspace, launchInput: launch.input, githubAppAccess: (store, key, input) => githubAppAccess(store, key, input, deps.githubApi ? { api: deps.githubApi } : {}), ...(deps.githubMcpOrigin ? { githubMcpOrigin: deps.githubMcpOrigin } : {}) });
|
|
206
|
+
const mcp = await mcpForClaim({ claim, store: deps.store, sealKey: deps.sealKey, grants: granted, harness: run.harness, work: () => ws.workspace, launchInput: launch.input, githubAppAccess: (store, key, input) => githubAppAccess(store, key, input, { ...(deps.githubApi ? { api: deps.githubApi } : {}), fromGitHub: launch.inputOrigin?.kind === "trigger" && launch.inputOrigin.source === "github", hold: (values) => cut.hold(values) }), ...(deps.githubMcpOrigin ? { githubMcpOrigin: deps.githubMcpOrigin } : {}) });
|
|
170
207
|
// The claim's MCP goes to the loop, which lets it go; a build that throws lets it go itself.
|
|
171
208
|
holds.hold({ passed: mcp });
|
|
172
209
|
// The run's computer, from the one shared claim-time function (the CLI spec takes the same): none for a runner place, a
|
|
@@ -181,7 +218,9 @@ async function adapterSpec(launch, run, deps, claim, holds) {
|
|
|
181
218
|
// A desktop's or a phone's hold (the person's take-over) wraps its ports: a call made while the person holds it waits,
|
|
182
219
|
// and the agent's hand-over (computer_request_handoff) asks the person through it.
|
|
183
220
|
holds.hold({ computer });
|
|
184
|
-
|
|
221
|
+
// Under the agent's bash policy, its shell's environment is the policy's too (bash-read-only.ts policyEnv).
|
|
222
|
+
const bashPolicy = bashPolicyOf(body.toolSettings);
|
|
223
|
+
const tools = await runTools(ws.workspace, computer.computer, { mode, context, ...(computer.hold ? { hold: computer.hold } : {}), ...(bashPolicy === undefined ? {} : { bashPolicy }) });
|
|
185
224
|
holds.hold({ tools });
|
|
186
225
|
// The run's model route: its model through routeOf (NEVER re-resolved — the launch's model, pinned at start), the catalog
|
|
187
226
|
// price with tiers for the cap, and the proxy's price (pi-ai calculateCost, tiered).
|
|
@@ -196,7 +235,11 @@ async function adapterSpec(launch, run, deps, claim, holds) {
|
|
|
196
235
|
holdClaimed(cut, toolEnv);
|
|
197
236
|
// The route reads its model's key from the runner's environment, else the one the claim opened from the store: a key
|
|
198
237
|
// saved in Settings → Model keys runs the next run with no restart (withModelKeys).
|
|
199
|
-
const
|
|
238
|
+
const modelEnv = withModelKeys(deps.env, toolEnv);
|
|
239
|
+
const route = await deps.routeOf(modelAskOf(launch.model, body.model), modelEnv, "default", PI_WIRES, undefined, cut);
|
|
240
|
+
// The run's models of other tiers, for its learned workflows' nodes of a tier (learnedTierRoutes, filled once the seed's
|
|
241
|
+
// lay chose the workflows, below): read when the session opens (pi.ts options.tiers), each on a proxy of its own.
|
|
242
|
+
const tierRoutes = new Map();
|
|
200
243
|
// The run's pi-native extensions, in the root agent through the pi adapter (PiAdapterOptions.extensions), which installs
|
|
201
244
|
// them in the claim's registry and offers each tool once:
|
|
202
245
|
// - ask_person is pi's own tool (tools.ts): a run granted it carries its native extension, so pi runs it as its own tool
|
|
@@ -216,23 +259,31 @@ async function adapterSpec(launch, run, deps, claim, holds) {
|
|
|
216
259
|
...(route.like ? { like: route.like } : {}),
|
|
217
260
|
...(route.price ? { price: route.price } : {}),
|
|
218
261
|
...(route.fetch ? { fetch: route.fetch } : {}),
|
|
262
|
+
tiers: tierRoutes,
|
|
219
263
|
});
|
|
220
264
|
// The gate before a call's intent: the run's revision's tool settings through runGate (approvals "never" turns the one
|
|
221
265
|
// ask it leaves into an allow). The adapter loop asks `gate` and handles the ask/park/answer on the journal itself, so
|
|
222
266
|
// only the permission is read here, never runGate's own file-based approval flow.
|
|
223
267
|
const root = runFolder(deps.data, runRow.agentId, claim.runId);
|
|
224
|
-
// The gate
|
|
225
|
-
//
|
|
226
|
-
const gate = await adapterRunGate(deps.store, claim, revision, ws.workspace);
|
|
268
|
+
// The gate names the run's folder by its Workspace (Mode 2: its folder on the run's disk, never this machine's folder at
|
|
269
|
+
// the same path), for its path checks; it reads nothing in it.
|
|
270
|
+
const gate = await adapterRunGate(deps.store, claim, revision, ws.workspace, tools.shell);
|
|
227
271
|
// The run's one cap, as the loop's runCap reads it (adapter-loop.ts RunCapConfig): the launch's cap figure (undefined
|
|
228
272
|
// uncapped — every paid request still books through the one cap), the run's model priced WITH tiers, strict where the
|
|
229
273
|
// launch says. The loop builds the kernel runCap from these over the run's own sessions (its model requests, its paid
|
|
230
274
|
// tool calls and its decisions all on one rule and one booking), so the spec carries no beforeRequest of its own.
|
|
231
275
|
const capUsd = launch.maxCostUsd;
|
|
232
276
|
const capModel = capModelOf(route);
|
|
277
|
+
// And each tier's model (tierRoutes, filled below), by the route its request names (its tier's proxy, ModelRequest.route),
|
|
278
|
+
// priced as that route books it: one id the run's model and a tier share is priced apart, never at the other's price.
|
|
233
279
|
const runCap = {
|
|
234
280
|
capUsd: () => launch.maxCostUsd,
|
|
235
|
-
modelOf: (id) =>
|
|
281
|
+
modelOf: (id, by) => {
|
|
282
|
+
if (by === undefined)
|
|
283
|
+
return id === route.model ? capModel : undefined;
|
|
284
|
+
const tierRoute = tierRoutes.get(by);
|
|
285
|
+
return tierRoute && tierRoute.model === id ? capModelOf(tierRoute) : undefined;
|
|
286
|
+
},
|
|
236
287
|
...(launch.capMode === "strict" ? { mode: "strict" } : {}),
|
|
237
288
|
};
|
|
238
289
|
// The run's cap figure and what a refusal does to it (parkOf, with the kernel's raise rule): present only when the run
|
|
@@ -263,47 +314,82 @@ async function adapterSpec(launch, run, deps, claim, holds) {
|
|
|
263
314
|
// A learning run's seed, read once from its learning folder where the run's place keeps it: its notes in .learning/
|
|
264
315
|
// and its learned skills beside the revision's own (runner/learning-seed.ts), cut of the server's secrets, the learned
|
|
265
316
|
// skills then in the skill list the prompt names, its learned workflows the ones its learned_workflow tool runs. Laid
|
|
266
|
-
// before the run's tools are bound. A learning fault
|
|
267
|
-
const seedLaid = start
|
|
317
|
+
// before the run's tools are bound. A learning fault, or a seed that failed (seedFailed), lays nothing.
|
|
318
|
+
const seedLaid = start && !seedFailed(start)
|
|
268
319
|
? await layLearningSeed({
|
|
269
320
|
work: ws.workspace,
|
|
270
321
|
seed: start.seed,
|
|
271
322
|
folder: () => (archil === undefined ? learningFolderOf(deps.data, runRow.agentId) : learningWorkspace({ mode: "archil", agentId: runRow.agentId, archil })),
|
|
272
323
|
own: Object.keys(revisionRow.skills ?? {}),
|
|
273
|
-
shown: async () => secretsShown(runnerSecrets(deps.env, await storeSecrets(deps.store, deps.sealKey, deps.data))),
|
|
324
|
+
shown: async () => secretsShown(runnerSecrets(deps.env, await storeSecrets(deps.store, deps.sealKey, deps.data)), { local: true }),
|
|
274
325
|
log,
|
|
275
326
|
})
|
|
276
327
|
: undefined;
|
|
328
|
+
// The decision keys its learned workflows' typed questions need (claim-secrets.ts learnedDecisionKeys), read once the lay
|
|
329
|
+
// chose them, scoped as the revision's own: each provider the run's gate does not deny, held by the run's one redactor,
|
|
330
|
+
// onto the tools' environment alone. The model's route was built on the revision's keys above, so a decision key never
|
|
331
|
+
// becomes its model's.
|
|
332
|
+
const workflows = seedLaid?.workflows ?? [];
|
|
333
|
+
// A tier a learned workflow's node names and the host has a model of: none can't be reached is left as `why`, and its
|
|
334
|
+
// node fails in those words (learnedWorkflowHostTool), never on another model.
|
|
335
|
+
const tierUnreachable = new Map();
|
|
336
|
+
if (learnsWorkflows(revision.kind, workflows)) {
|
|
337
|
+
// The keys those tiers' models need (tierModelKeys: a key saved in Settings too, which claimSecrets opened only for the
|
|
338
|
+
// run's own model), held by the run's one redactor, on the tiers' route env alone (withModelKeys, never enumerable),
|
|
339
|
+
// never on the tools' (toolEnv).
|
|
340
|
+
const tierKeys = await tierModelKeys({ store: deps.store, sealKey: deps.sealKey, env: deps.env }, learnedTiers(workflows));
|
|
341
|
+
holdClaimed(cut, tierKeys);
|
|
342
|
+
const tierEnv = withModelKeys(deps.env, { ...toolEnv, ...tierKeys });
|
|
343
|
+
for (const [tier, routed] of await learnedTierRoutes(workflows, tierEnv, (tier) => deps.routeOf(undefined, tierEnv, tier, PI_WIRES, undefined, cut))) {
|
|
344
|
+
if ("why" in routed)
|
|
345
|
+
tierUnreachable.set(tier, routed.why);
|
|
346
|
+
else
|
|
347
|
+
tierRoutes.set(tier, routed);
|
|
348
|
+
}
|
|
349
|
+
const learnedKeys = await learnedDecisionKeys({ store: deps.store, sealKey: deps.sealKey, env: deps.env }, workflows, (provider) => gate.permissions.policy(provider) !== "deny");
|
|
350
|
+
holdClaimed(cut, learnedKeys);
|
|
351
|
+
Object.assign(toolEnv, learnedKeys);
|
|
352
|
+
}
|
|
277
353
|
// The tool host's install lifecycle: what a binding registers to run in each conversation's creating commit, once the
|
|
278
354
|
// Harness is open before the session, and at the run's end (the browser tool's reconcile and release hang off these). The
|
|
279
355
|
// adapter loop runs them from the spec's `lifecycle` (adapter-loop.ts hostLifecycle).
|
|
280
356
|
const life = hostLifecycle();
|
|
281
357
|
// The ToolHost the non-hand tools (browser, web, MCP, decisions, monid) bind through (buildToolHost, the one the CLI
|
|
282
358
|
// spec builds too), on the claim's keys and the run's one ledger and redactor.
|
|
283
|
-
|
|
359
|
+
// An agent whose computer is a browser the claim started gets the browser tool on that one session (tools.ts).
|
|
360
|
+
const claimBrowser = computer.computer?.kind === "browser" ? computer.computer.browser : undefined;
|
|
361
|
+
const host = { ...buildToolHost({ root, workspace: ws.workspace, claim, env: toolEnv, run, store: deps.store, sealKey: deps.sealKey, life, redact: cut }), ...(claimBrowser ? { browserComputer: claimBrowser } : {}) };
|
|
284
362
|
// The run's tools. The hands (read/write/edit/bash and the background tools) are the kernel registry's over the run's
|
|
285
363
|
// Workspace and computer (runTools.hostTools); the gate is the adapter loop's own (spec.gate), so they run as asked.
|
|
286
364
|
const results = new Map();
|
|
287
|
-
const handTools = tools.hostTools(withKindTools(granted, tools),
|
|
365
|
+
const handTools = tools.hostTools(withKindTools(granted, tools), results);
|
|
288
366
|
// The non-hand tools run on the claim's keys (host.env), so a vendor's error may echo one: each answer, and a throw's
|
|
289
367
|
// words, pass the run's one redactor before the harness, the model or the record has them.
|
|
290
|
-
const
|
|
368
|
+
const tiers = new Map([...[...tierRoutes].map(([tier, { model }]) => [tier, { model }]), ...[...tierUnreachable].map(([tier, why]) => [tier, { why }])]);
|
|
369
|
+
// The gate asks a learned_workflow call about its workflow's MCP nodes (adapterRunGate).
|
|
370
|
+
gate.learn(workflows);
|
|
371
|
+
const nonHandTools = (await bindNonHandTools(host, revision.kind, granted, run, context, results, root, launch.plane, workflows, native, gate.permissions, tiers, mcp)).map((tool) => answersCut(tool, cut));
|
|
291
372
|
const sessionTools = [...handTools, ...nonHandTools];
|
|
292
373
|
// The run's system prompt, as main's per-run process builds it (app.ts): the environment line first (environment.ts, as
|
|
293
374
|
// pi installs it before every other section), then the revision's instructions with what the agent learned laid in
|
|
294
375
|
// (learning.ts laidLearned, from the launch's learning start — the # Learned section decided once at launch, so the runner
|
|
295
|
-
// reads no learning folder
|
|
296
|
-
//
|
|
297
|
-
|
|
376
|
+
// reads no learning folder), its own skills through skills.ts promptOf, then the effort guidance (the launch's effort,
|
|
377
|
+
// never this process's environment). The one path for every harness.
|
|
378
|
+
// A start whose seed failed tells the run nothing: it is never asked what to keep (learning-end.ts drops it).
|
|
379
|
+
const laid = start && !seedFailed(start) ? laidLearned(body.instructions ?? "", start.section) : (body.instructions ?? "");
|
|
298
380
|
const instructions = await promptOf(laid, [...Object.keys(body.skills ?? {}), ...(seedLaid?.skills ?? [])], ws.workspace, { onDemand: readsFiles(granted) });
|
|
299
381
|
const guidance = effortGuidance(launch.effort);
|
|
300
382
|
const system = [environmentLine(), instructions, guidance].filter((line) => Boolean(line));
|
|
383
|
+
// The level pi thinks at: the launch's effort (the run's own, else its revision's, else the host's), every level pi's
|
|
384
|
+
// agent takes; none, pi's default.
|
|
385
|
+
const thinking = thinkingLevel(launch.effort);
|
|
301
386
|
const session = {
|
|
302
387
|
key: `run:${claim.runId}`,
|
|
303
388
|
label: runRow.agentId,
|
|
304
389
|
system,
|
|
305
390
|
tools: sessionTools,
|
|
306
391
|
context: "fresh",
|
|
392
|
+
...(thinking ? { thinking: thinking } : {}),
|
|
307
393
|
};
|
|
308
394
|
// The person's first message: the start body's content, with the run's file manifest beside it (run-manifest.ts), read
|
|
309
395
|
// through the run's Workspace (Mode 2: its inputs/ on the disk, never a folder of this machine).
|
|
@@ -343,6 +429,7 @@ async function adapterSpec(launch, run, deps, claim, holds) {
|
|
|
343
429
|
...(mcp ? { mcp } : {}),
|
|
344
430
|
// The run's end-of-run step, when it learns (the spec's, which the loop prefers over its deps': adapter-loop.ts stepOf).
|
|
345
431
|
...(endOfRun ? { endOfRun } : {}),
|
|
432
|
+
...(start ? { learningLaid: laidOf(seedLaid) } : {}),
|
|
346
433
|
// The tool host's install lifecycle (its bindings' onConversation/beforeResume/beforeRelease), run by the adapter loop.
|
|
347
434
|
lifecycle: life,
|
|
348
435
|
agentId: runRow.agentId,
|
|
@@ -390,6 +477,42 @@ export function hostToolCtxOf(run, context, results, root) {
|
|
|
390
477
|
* a workflow it may run (`workflows`: the claim's seed lay chose them, runner/learning-seed.ts). A revision never names
|
|
391
478
|
* the tool among its own: the run has it beside them, so the harness is told of it as of theirs. */
|
|
392
479
|
export const learnsWorkflows = (kind, workflows) => kind === "agentic" && workflows.length > 0;
|
|
480
|
+
/** The tiers other than the default that `workflows`' model nodes and `llm` calls name (model.ts nodeTiers, llmTiers),
|
|
481
|
+
* in TIERS order. A workflow that does not parse names none: its call refuses it. */
|
|
482
|
+
export function learnedTiers(workflows) {
|
|
483
|
+
const named = new Set();
|
|
484
|
+
for (const flow of workflows) {
|
|
485
|
+
let doc;
|
|
486
|
+
try {
|
|
487
|
+
doc = JSON.parse(flow.workflow);
|
|
488
|
+
const nodes = workflowNodes(doc, inspectWorkflow(doc));
|
|
489
|
+
for (const tier of llmTiers(nodes, nodeTiers(nodes)))
|
|
490
|
+
named.add(tier);
|
|
491
|
+
}
|
|
492
|
+
catch {
|
|
493
|
+
continue;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
return TIERS.filter((tier) => tier !== "default" && named.has(tier));
|
|
497
|
+
}
|
|
498
|
+
/** The route of each tier `workflows` name (learnedTiers) that `env` names a model of its own for (tierModelOf:
|
|
499
|
+
* AGENT_MODEL_FAST, AGENT_MODEL_STRONG), through `routeOf` (the run's one route, as its own model's): the model a node
|
|
500
|
+
* of that tier runs on, priced at its own price. A tier with no model of its own is left out (its nodes run on the
|
|
501
|
+
* run's model); one whose route is refused is `why`, so its nodes fail in those words and never run on another model. */
|
|
502
|
+
export async function learnedTierRoutes(workflows, env, routeOf) {
|
|
503
|
+
const routes = new Map();
|
|
504
|
+
for (const tier of learnedTiers(workflows)) {
|
|
505
|
+
if (tierModelOf(env, tier) === undefined)
|
|
506
|
+
continue;
|
|
507
|
+
try {
|
|
508
|
+
routes.set(tier, await routeOf(tier));
|
|
509
|
+
}
|
|
510
|
+
catch (error) {
|
|
511
|
+
routes.set(tier, { why: String(error?.message ?? error).slice(0, 300) });
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
return routes;
|
|
515
|
+
}
|
|
393
516
|
/** The run's learned_workflow tool as a HostTool, listed when the run has it (learnsWorkflows: an agentic revision whose
|
|
394
517
|
* agent learned workflows, by learning.ts chooseWorkflows as main's start chooses them, so the tool set the model sees
|
|
395
518
|
* matches main). `granted`, the revision's own tools, are the ones its workflows' call nodes may call. Every run's session — pi's and every CLI harness's — has a model
|
|
@@ -400,8 +523,21 @@ export async function learnedWorkflowHostTool(opts) {
|
|
|
400
523
|
if (!learnsWorkflows(opts.kind, opts.workflows))
|
|
401
524
|
return undefined;
|
|
402
525
|
const flows = opts.workflows;
|
|
403
|
-
const
|
|
404
|
-
const
|
|
526
|
+
const tiers = opts.tiers ?? new Map();
|
|
527
|
+
const mcpTools = (opts.mcp?.tools ?? []).map((one) => opts.mcp.catalogOf(one.name)).filter((name) => typeof name === "string");
|
|
528
|
+
const byProvider = new Map([[PORT_PROVIDER, await opts.run.ledger.models(LEARNED_WORKFLOW_TOOL)]]);
|
|
529
|
+
for (const [tier, model] of tiers)
|
|
530
|
+
if ("model" in model)
|
|
531
|
+
byProvider.set(tierProvider(tier), await opts.run.ledger.models(LEARNED_WORKFLOW_TOOL, tier));
|
|
532
|
+
const modelOf = (tier) => {
|
|
533
|
+
const model = tier === undefined ? undefined : tiers.get(tier);
|
|
534
|
+
if (model === undefined)
|
|
535
|
+
return { provider: PORT_PROVIDER, modelId: "session" };
|
|
536
|
+
if ("why" in model)
|
|
537
|
+
throw new Error(`the run's ${tier} model could not be reached: ${model.why}`);
|
|
538
|
+
return { provider: tierProvider(tier), modelId: model.model };
|
|
539
|
+
};
|
|
540
|
+
const tool = learnedWorkflowTool({ workflows: flows, granted: opts.granted, ...(opts.plane ? { plane: opts.plane } : {}), env: opts.env, work: opts.work, models: tieredModels(byProvider), modelOf, policy: opts.permissions.policy, denyFrom: opts.permissions.denyFrom, refresh: opts.permissions.refresh, decide: opts.permissions.decide, mcpTools });
|
|
405
541
|
return hostToolOf(LEARNED_WORKFLOW_TOOL, tool, opts.ctx) ?? undefined;
|
|
406
542
|
}
|
|
407
543
|
/** The run's non-hand tools as HostTool[], bound through the ToolHost seam and wrapped as the hands are (host-tools.ts
|
|
@@ -451,11 +587,10 @@ export function answersCut(tool, cut) {
|
|
|
451
587
|
export function buildToolHost(opts) {
|
|
452
588
|
const { root, claim, run, life } = opts;
|
|
453
589
|
return {
|
|
454
|
-
// The run's directory and its per-claim environment
|
|
455
|
-
//
|
|
590
|
+
// The run's directory and its per-claim environment: the hands come from runTools, so the non-hand tools get the run's
|
|
591
|
+
// environment only.
|
|
456
592
|
where: { root, work: root, ref: { id: claim.runId } },
|
|
457
593
|
env: opts.env,
|
|
458
|
-
coding: { tools: [], extension: { name: "coding", tools: [] } },
|
|
459
594
|
install: (extension) => run.registry.install(extension),
|
|
460
595
|
onConversation: life.register.onConversation,
|
|
461
596
|
beforeResume: life.register.beforeResume,
|
|
@@ -463,7 +598,6 @@ export function buildToolHost(opts) {
|
|
|
463
598
|
personWait: life.register.personWait,
|
|
464
599
|
// The run row's summary staged on a commit of the run's (a hand-over's wait, its claim held: run.needs_input).
|
|
465
600
|
...(run.rowSummaryOn ? { rowSummaryOn: run.rowSummaryOn } : {}),
|
|
466
|
-
handoverInJournal: true,
|
|
467
601
|
store: opts.store,
|
|
468
602
|
claim,
|
|
469
603
|
sealKey: opts.sealKey,
|
|
@@ -500,7 +634,7 @@ export async function webHostTools(host, granted, ctx) {
|
|
|
500
634
|
}
|
|
501
635
|
return tools;
|
|
502
636
|
}
|
|
503
|
-
async function bindNonHandTools(host, kind, granted, run, context, results, root, plane, workflows, native, permissions) {
|
|
637
|
+
async function bindNonHandTools(host, kind, granted, run, context, results, root, plane, workflows, native, permissions, tiers, mcp) {
|
|
504
638
|
// Fail closed (browserListed): the browser binds only on the native route (BROWSER_ON_RUNNER) and with the claim's
|
|
505
639
|
// one-ledger booking on its ToolHost (host.ledger.paid); otherwise its extension is not installed. learned_workflow
|
|
506
640
|
// binds below with no web tool, so a learned run with no web tool still lists it.
|
|
@@ -513,7 +647,7 @@ async function bindNonHandTools(host, kind, granted, run, context, results, root
|
|
|
513
647
|
// the session's tools the harness is told of: its model nodes run on the session's proxied models (run.ledger.models),
|
|
514
648
|
// each a request on the run's one route labelled learned_workflow. The agent's scoped keys (host.env) are its call
|
|
515
649
|
// nodes'.
|
|
516
|
-
const learned = await learnedWorkflowHostTool({ run, kind, granted, plane, env: host.env, work: root, workflows, permissions, ctx });
|
|
650
|
+
const learned = await learnedWorkflowHostTool({ run, kind, granted, plane, env: host.env, work: root, workflows, permissions, ctx, tiers, ...(mcp ? { mcp } : {}) });
|
|
517
651
|
if (learned)
|
|
518
652
|
tools.push(learned);
|
|
519
653
|
// The browser (tl-browser), on pi's native route: tools.ts's own binding on this run's ToolHost (its store, claim and seal
|
|
@@ -19,6 +19,10 @@ export const RUNNER_HARNESSES = {
|
|
|
19
19
|
record: "loop",
|
|
20
20
|
adapter: async (launch, extra = {}) => {
|
|
21
21
|
const claude = (await import(CLAUDE_PACKAGE));
|
|
22
|
+
// The CLI the adapter checks, checked first off the event loop: a pass is kept, and the adapter's own check answers
|
|
23
|
+
// from it; a failure is the adapter's to report (warm).
|
|
24
|
+
if (!extra.standIn)
|
|
25
|
+
await claude.verifyClaudeAgentCliAsync(extra.cliPath ?? claude.claudeAgentExecutable());
|
|
22
26
|
return claude.claudeAgentAdapter({
|
|
23
27
|
model: launch.model,
|
|
24
28
|
provider: { origin: launch.provider.origin, credential: launch.provider.credential, ...(launch.provider.headers ? { headers: launch.provider.headers } : {}) },
|
|
@@ -33,6 +37,9 @@ export const RUNNER_HARNESSES = {
|
|
|
33
37
|
record: "loop",
|
|
34
38
|
adapter: async (launch, extra = {}) => {
|
|
35
39
|
const codex = (await import(CODEX_PACKAGE));
|
|
40
|
+
// Its binary checked first off the event loop, as claude-agent's CLI is (warm): a failure is the adapter's to report.
|
|
41
|
+
if (!extra.standIn)
|
|
42
|
+
await codex.verifyCodexAsync(extra.binary).catch(() => undefined);
|
|
36
43
|
// Codex's provider is its origin and credential, as serve gives it today (adapters.ts, codexOf): no headers.
|
|
37
44
|
return codex.codexAdapter({
|
|
38
45
|
model: launch.model,
|
|
@@ -48,7 +55,10 @@ export const RUNNER_HARNESSES = {
|
|
|
48
55
|
record: "loop",
|
|
49
56
|
adapter: async (launch, extra = {}) => {
|
|
50
57
|
// OpenCode's adapter is serve's own (its pinned binary is checked when the adapter is made); loaded when first asked.
|
|
51
|
-
const { openCodeAdapter } = await import("../../harness-opencode/index.js");
|
|
58
|
+
const { openCodeAdapter, verifyOpenCodeAsync } = await import("../../harness-opencode/index.js");
|
|
59
|
+
// Its binary checked first off the event loop, as codex's is (warm): a failure is the adapter's to report.
|
|
60
|
+
if (!extra.standIn)
|
|
61
|
+
await verifyOpenCodeAsync().catch(() => undefined);
|
|
52
62
|
return openCodeAdapter({
|
|
53
63
|
model: launch.model,
|
|
54
64
|
provider: { origin: launch.provider.origin, credential: launch.provider.credential },
|