@parcha/agentrun-serve 0.1.0-beta.37 → 0.1.0-beta.39
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 +700 -0
- package/README.md +441 -177
- package/dist/adapters.d.ts +4 -1
- package/dist/adapters.js +4 -2
- package/dist/agent-rows.d.ts +1 -3
- package/dist/agents-store.d.ts +35 -3
- package/dist/agents-store.js +48 -23
- 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/bash-read-only.js +2 -1
- package/dist/browser-cost.js +52 -93
- package/dist/cap-short.d.ts +12 -0
- package/dist/cap-short.js +60 -0
- package/dist/cap.d.ts +3 -400
- package/dist/cap.js +6 -942
- package/dist/catalog.d.ts +0 -5
- package/dist/catalog.js +2 -6
- package/dist/chatgpt-plan.d.ts +163 -0
- package/dist/chatgpt-plan.js +549 -0
- package/dist/cli.js +26 -6
- package/dist/composio-preset.d.ts +25 -0
- package/dist/composio-preset.js +51 -8
- package/dist/composio-triggers.d.ts +113 -0
- package/dist/composio-triggers.js +411 -0
- package/dist/computer-calls.d.ts +36 -24
- package/dist/computer-calls.js +110 -27
- package/dist/computer-commands.d.ts +2 -0
- package/dist/computer-commands.js +7 -3
- package/dist/computer-live.d.ts +12 -2
- package/dist/computer-live.js +21 -5
- package/dist/computer-routes.d.ts +2 -2
- package/dist/computer-routes.js +2 -2
- package/dist/computer-setting.d.ts +15 -2
- package/dist/computer-setting.js +20 -4
- package/dist/computer-view.d.ts +18 -2
- package/dist/computer-view.js +21 -6
- package/dist/computer-viewer.js +40 -13
- package/dist/computers.d.ts +8 -2
- package/dist/computers.js +18 -8
- package/dist/console/assets/index-BNhZs-jp.css +1 -0
- package/dist/console/assets/index-BQv5aOGB.js +700 -0
- package/dist/console/index.html +2 -2
- package/dist/console-links.d.ts +2 -0
- package/dist/console-links.js +6 -3
- package/dist/decision-cap.d.ts +2 -5
- package/dist/decision-cap.js +3 -6
- package/dist/decision-rows.js +11 -11
- package/dist/decisions.js +4 -0
- package/dist/email/account.d.ts +84 -0
- package/dist/email/account.js +159 -0
- package/dist/email/answer.d.ts +10 -0
- package/dist/email/answer.js +182 -0
- package/dist/email/email-faux.d.ts +95 -0
- package/dist/email/email-faux.js +849 -0
- package/dist/email/labels.d.ts +1 -0
- package/dist/email/labels.js +84 -0
- package/dist/email/mail.d.ts +186 -0
- package/dist/email/mail.js +380 -0
- package/dist/email/names.d.ts +20 -0
- package/dist/email/names.js +40 -0
- package/dist/email/routes.d.ts +9 -0
- package/dist/email/routes.js +50 -0
- package/dist/email/tools.d.ts +20 -0
- package/dist/email/tools.js +517 -0
- package/dist/environment.d.ts +17 -2
- package/dist/environment.js +36 -8
- package/dist/errors.d.ts +6 -0
- package/dist/errors.js +12 -0
- package/dist/eval-mailbox.d.ts +103 -0
- package/dist/eval-mailbox.js +236 -0
- package/dist/faux-computers.js +4 -2
- package/dist/graph-view.d.ts +9 -2
- package/dist/graph-view.js +6 -2
- package/dist/harness-install.d.ts +28 -2
- package/dist/harness-install.js +147 -59
- package/dist/harness-opencode/adapter.js +2 -22
- package/dist/harness-opencode/facts.js +5 -4
- package/dist/harness-opencode/host/policy.d.ts +4 -5
- package/dist/harness-opencode/host/policy.js +14 -33
- package/dist/harness-opencode/index.d.ts +1 -1
- package/dist/harness-opencode/index.js +1 -1
- package/dist/harness-opencode/versions.d.ts +6 -0
- package/dist/harness-opencode/versions.js +6 -0
- package/dist/harness-table.d.ts +0 -2
- package/dist/harness-table.js +8 -7
- package/dist/harness.d.ts +12 -0
- package/dist/harness.js +15 -3
- package/dist/host-tools.d.ts +1 -5
- package/dist/host-tools.js +7 -10
- package/dist/hosted-search.d.ts +3 -3
- package/dist/hosted-search.js +51 -32
- package/dist/import-sources.d.ts +1 -1
- package/dist/import-sources.js +3 -3
- package/dist/import.d.ts +21 -0
- package/dist/import.js +186 -1
- package/dist/key-check.d.ts +0 -2
- package/dist/key-check.js +3 -4
- package/dist/key-refusal.d.ts +8 -2
- package/dist/key-refusal.js +16 -13
- package/dist/key-words.d.ts +3 -2
- package/dist/key-words.js +4 -2
- package/dist/learn/check.d.ts +24 -4
- package/dist/learn/check.js +340 -7
- package/dist/learn/commit.d.ts +10 -0
- package/dist/learn/commit.js +18 -4
- package/dist/learn/compile.d.ts +250 -0
- package/dist/learn/compile.js +507 -0
- package/dist/learn/general.d.ts +3 -0
- package/dist/learn/general.js +4 -2
- package/dist/learn/grade.d.ts +5 -1
- package/dist/learn/grade.js +11 -7
- package/dist/learn/notes.d.ts +8 -0
- package/dist/learn/notes.js +18 -0
- package/dist/learn/promote.d.ts +308 -0
- package/dist/learn/promote.js +321 -0
- package/dist/learn/refit.d.ts +48 -0
- package/dist/learn/refit.js +264 -0
- package/dist/learn/reflect.d.ts +5 -25
- package/dist/learn/reflect.js +14 -131
- package/dist/learn/replay-calls.d.ts +63 -0
- package/dist/learn/replay-calls.js +158 -0
- package/dist/learn/skills.d.ts +19 -16
- package/dist/learn/skills.js +157 -53
- package/dist/learn/workflow-nodes.d.ts +15 -0
- package/dist/learn/workflow-nodes.js +44 -0
- package/dist/learned-nodes.d.ts +58 -2
- package/dist/learned-nodes.js +68 -5
- package/dist/learned-workflow.d.ts +58 -32
- package/dist/learned-workflow.js +215 -77
- package/dist/learning-batch.d.ts +2 -2
- package/dist/learning-batch.js +4 -4
- package/dist/learning-cost.d.ts +41 -11
- package/dist/learning-cost.js +31 -13
- package/dist/learning-routes.d.ts +12 -2
- package/dist/learning-routes.js +34 -6
- package/dist/learning-words.d.ts +8 -1
- package/dist/learning-words.js +11 -1
- package/dist/learning.d.ts +26 -1
- package/dist/learning.js +7 -4
- package/dist/link-check.d.ts +27 -0
- package/dist/link-check.js +164 -0
- package/dist/llm.js +0 -3
- package/dist/local-models.d.ts +33 -2
- package/dist/local-models.js +43 -5
- package/dist/mcp-gateway.d.ts +12 -20
- package/dist/mcp-gateway.js +16 -44
- package/dist/mcp-oauth.d.ts +5 -0
- package/dist/mcp-oauth.js +1 -1
- package/dist/mcp-pin-first.d.ts +37 -0
- package/dist/mcp-pin-first.js +113 -0
- package/dist/mcp-probe.d.ts +8 -9
- package/dist/mcp-probe.js +16 -33
- package/dist/mcp-secret-writes.js +3 -0
- package/dist/mcp-servers-store.d.ts +102 -26
- package/dist/mcp-servers-store.js +151 -25
- package/dist/mcp-sources.d.ts +39 -0
- package/dist/mcp-sources.js +74 -0
- package/dist/mcp-store.d.ts +11 -0
- package/dist/mcp-store.js +16 -2
- 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 +11 -0
- package/dist/model-form.js +17 -1
- package/dist/model.d.ts +39 -6
- package/dist/model.js +171 -32
- package/dist/monid.d.ts +50 -29
- package/dist/monid.js +234 -143
- package/dist/native/binding.d.ts +13 -0
- package/dist/native/binding.js +57 -0
- package/dist/native/cli.d.ts +2 -0
- package/dist/native/cli.js +48 -0
- package/dist/native/connection.d.ts +8 -0
- package/dist/native/connection.js +94 -0
- package/dist/native/context.d.ts +6 -0
- package/dist/native/context.js +22 -0
- package/dist/native/discovery.d.ts +27 -0
- package/dist/native/discovery.js +404 -0
- package/dist/native/environment.d.ts +4 -0
- package/dist/native/environment.js +18 -0
- package/dist/native/history.d.ts +20 -0
- package/dist/native/history.js +147 -0
- package/dist/native/instructions.d.ts +21 -0
- package/dist/native/instructions.js +173 -0
- package/dist/native/remote-worker-bridge.d.ts +3 -0
- package/dist/native/remote-worker-bridge.js +278 -0
- package/dist/native/remote.d.ts +187 -0
- package/dist/native/remote.js +492 -0
- package/dist/native/runtime.d.ts +17 -0
- package/dist/native/runtime.js +316 -0
- package/dist/native/runtimes.d.ts +66 -0
- package/dist/native/runtimes.js +41 -0
- package/dist/native/schema.d.ts +46 -0
- package/dist/native/schema.js +41 -0
- package/dist/native/types.d.ts +87 -0
- package/dist/native/types.js +1 -0
- package/dist/observation/http.d.ts +4 -0
- package/dist/observation/http.js +140 -0
- package/dist/observation/observer.d.ts +301 -0
- package/dist/observation/observer.js +919 -0
- package/dist/observation/schema.d.ts +52 -0
- package/dist/observation/schema.js +154 -0
- package/dist/openapi.d.ts +1 -0
- package/dist/openapi.js +705 -126
- package/dist/paid-calls.d.ts +34 -32
- package/dist/paid-calls.js +52 -104
- package/dist/place-offers.d.ts +4 -8
- package/dist/place-offers.js +4 -9
- package/dist/port-models.d.ts +7 -2
- package/dist/port-models.js +5 -2
- package/dist/print.d.ts +4 -2
- package/dist/print.js +4 -3
- package/dist/propose.d.ts +8 -3
- package/dist/propose.js +28 -7
- package/dist/provider.d.ts +5 -1
- package/dist/provider.js +17 -2
- package/dist/push-handler.d.ts +3 -2
- package/dist/push-handler.js +20 -6
- package/dist/reflect-range.js +2 -1
- package/dist/refusal-words.d.ts +11 -0
- package/dist/refusal-words.js +13 -2
- package/dist/rows.d.ts +5 -3
- package/dist/rows.js +15 -4
- package/dist/run-launch.d.ts +23 -1
- package/dist/run-launch.js +17 -4
- package/dist/run-learning-served.d.ts +84 -0
- package/dist/run-manifest.d.ts +8 -0
- package/dist/run-manifest.js +33 -1
- package/dist/run-reads-over-store.d.ts +3 -3
- package/dist/run-reads-over-store.js +13 -10
- package/dist/run-secrets.js +2 -3
- package/dist/run-timeline-served.d.ts +3 -2
- package/dist/run-timeline-served.js +12 -10
- package/dist/run-view.d.ts +59 -41
- package/dist/run-view.js +128 -64
- package/dist/runnable.d.ts +13 -8
- package/dist/runnable.js +77 -60
- package/dist/runner/adapter-loop.d.ts +60 -15
- package/dist/runner/adapter-loop.js +1406 -464
- package/dist/runner/adapter-run-spec.d.ts +45 -14
- package/dist/runner/adapter-run-spec.js +200 -116
- package/dist/runner/adapters/pi.d.ts +40 -7
- package/dist/runner/adapters/pi.js +149 -38
- package/dist/runner/beside.d.ts +3 -1
- package/dist/runner/beside.js +24 -8
- package/dist/runner/claim-secrets.d.ts +3 -1
- package/dist/runner/claim-secrets.js +28 -4
- package/dist/runner/cli-run-spec.d.ts +30 -0
- package/dist/runner/cli-run-spec.js +150 -66
- package/dist/runner/computer-channel.d.ts +5 -2
- package/dist/runner/computer-channel.js +5 -3
- package/dist/runner/computer-journal.d.ts +6 -0
- package/dist/runner/computer-journal.js +8 -10
- package/dist/runner/conformance/harness.d.ts +3 -0
- package/dist/runner/conformance/harness.js +149 -5
- package/dist/runner/conformance/subject.d.ts +11 -4
- package/dist/runner/end-of-run.d.ts +8 -5
- package/dist/runner/end-of-run.js +11 -6
- package/dist/runner/feedback-round.d.ts +79 -0
- package/dist/runner/feedback-round.js +127 -0
- package/dist/runner/harness-loops.js +17 -0
- package/dist/runner/journal-kinds.d.ts +55 -13
- package/dist/runner/journal-kinds.js +19 -0
- package/dist/runner/learning-dispatch.d.ts +3 -2
- package/dist/runner/learning-dispatch.js +6 -6
- package/dist/runner/learning-end.d.ts +58 -19
- package/dist/runner/learning-end.js +316 -115
- package/dist/runner/learning-factory.d.ts +3 -0
- package/dist/runner/learning-factory.js +8 -2
- package/dist/runner/learning-loop.d.ts +21 -1
- package/dist/runner/learning-loop.js +24 -6
- package/dist/runner/learning-seed.d.ts +4 -0
- package/dist/runner/learning-seed.js +14 -0
- package/dist/runner/loop-contract.d.ts +19 -3
- package/dist/runner/loop.d.ts +34 -1
- package/dist/runner/loop.js +55 -1
- package/dist/runner/main.d.ts +6 -1
- package/dist/runner/main.js +26 -4
- package/dist/runner/mcp-claim.d.ts +5 -1
- package/dist/runner/mcp-claim.js +66 -50
- package/dist/runner/mcp-run.d.ts +20 -53
- package/dist/runner/mcp-run.js +22 -88
- package/dist/runner/meta-tools.d.ts +44 -0
- package/dist/runner/meta-tools.js +344 -0
- package/dist/runner/metrics.d.ts +80 -21
- package/dist/runner/metrics.js +128 -42
- package/dist/runner/model-route.d.ts +12 -3
- package/dist/runner/model-route.js +149 -19
- package/dist/runner/monid-run.d.ts +18 -0
- package/dist/runner/monid-run.js +170 -0
- package/dist/runner/native-loop.d.ts +11 -0
- package/dist/runner/native-loop.js +438 -0
- package/dist/runner/promotion.d.ts +146 -0
- package/dist/runner/promotion.js +803 -0
- package/dist/runner/redact.js +3 -0
- package/dist/runner/reflect-hook.d.ts +36 -21
- package/dist/runner/reflect-hook.js +147 -49
- package/dist/runner/runner.d.ts +7 -1
- package/dist/runner/runner.js +34 -8
- package/dist/runner/sdk-loop.d.ts +7 -0
- package/dist/runner/sdk-loop.js +470 -0
- package/dist/runner/sessions.d.ts +8 -3
- package/dist/runner/sessions.js +5 -1
- package/dist/runner/spec-holds.d.ts +16 -2
- package/dist/runner/spec-holds.js +42 -14
- package/dist/runner/step-guard.d.ts +62 -0
- package/dist/runner/step-guard.js +93 -0
- package/dist/runner/store-secrets.js +17 -2
- package/dist/runner/subagent.d.ts +0 -3
- package/dist/runner/subagent.js +7 -12
- package/dist/runner/workflow-first.d.ts +226 -0
- package/dist/runner/workflow-first.js +293 -0
- package/dist/runner/workflow-loop.d.ts +1 -1
- package/dist/runner/workflow-loop.js +32 -19
- package/dist/runner/workflow-spec.d.ts +5 -1
- package/dist/runner/workflow-spec.js +63 -48
- package/dist/runs-over-store.d.ts +41 -4
- package/dist/runs-over-store.js +64 -22
- package/dist/sdk/runs.d.ts +115 -0
- package/dist/sdk/runs.js +422 -0
- package/dist/sdk/schema.d.ts +175 -0
- package/dist/sdk/schema.js +138 -0
- package/dist/sdk/workflows.d.ts +22 -0
- package/dist/sdk/workflows.js +39 -0
- package/dist/secrets.d.ts +2 -0
- package/dist/secrets.js +19 -1
- package/dist/server.d.ts +108 -20
- package/dist/server.js +874 -157
- package/dist/settings-wake.d.ts +8 -6
- package/dist/settings-wake.js +13 -7
- package/dist/skill-route.d.ts +3 -0
- package/dist/skill-route.js +16 -0
- package/dist/skills/agentrun-serve/SKILL.md +368 -0
- package/dist/stats.d.ts +10 -10
- package/dist/store/agent-body.d.ts +22 -7
- package/dist/store/agent-body.js +23 -14
- package/dist/store/command-wake.d.ts +3 -2
- package/dist/store/command-wake.js +4 -4
- package/dist/store/index.d.ts +1 -1
- package/dist/store/native-command-owner.d.ts +10 -0
- package/dist/store/native-command-owner.js +47 -0
- package/dist/store/postgres/connection.js +3 -1
- 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/postgres/migrations/0012_revision_monid_pin.sql +4 -0
- package/dist/store/postgres/migrations/0013_native_command_owner.sql +6 -0
- package/dist/store/postgres/migrations/0014_run_cost_upper_bound.sql +6 -0
- package/dist/store/postgres/store.js +3 -0
- package/dist/store/schema.d.ts +16 -0
- package/dist/store/schema.js +47 -8
- 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 +8 -1
- package/dist/store/sqlite/run-patch.js +33 -10
- package/dist/store/sqlite/store.js +184 -28
- package/dist/store/store.d.ts +98 -21
- package/dist/store-reads/analytics.d.ts +7 -7
- package/dist/store-reads/analytics.js +23 -5
- package/dist/store-reads/cap.js +8 -6
- package/dist/store-reads/journal.d.ts +30 -1
- package/dist/store-reads/journal.js +141 -83
- package/dist/store-reads/learning.d.ts +179 -13
- package/dist/store-reads/learning.js +230 -68
- package/dist/store-reads/loop.d.ts +61 -0
- package/dist/store-reads/loop.js +111 -0
- package/dist/store-reads/runs.d.ts +5 -0
- package/dist/store-reads/runs.js +3 -2
- package/dist/store-view.d.ts +3 -2
- package/dist/store-view.js +109 -37
- package/dist/template-eval.d.ts +87 -16
- package/dist/template-eval.js +605 -120
- package/dist/template-github-permissions.d.ts +2 -2
- package/dist/template-github-permissions.js +2 -1
- 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 +274 -52
- package/dist/templates.js +670 -201
- package/dist/text-urls.d.ts +38 -0
- package/dist/text-urls.js +170 -0
- package/dist/timeline/computer.d.ts +48 -0
- package/dist/timeline/computer.js +169 -0
- package/dist/timeline/index.d.ts +7 -5
- package/dist/timeline/index.js +7 -5
- package/dist/timeline/labels.d.ts +11 -4
- package/dist/timeline/labels.js +122 -8
- package/dist/timeline/origin.d.ts +20 -6
- package/dist/timeline/origin.js +13 -6
- package/dist/timeline/render-text.js +1 -1
- package/dist/timeline/timeline.d.ts +76 -20
- package/dist/timeline/timeline.js +184 -39
- package/dist/timeline/util.d.ts +5 -0
- package/dist/timeline/util.js +44 -8
- package/dist/timeline/web-calls.d.ts +17 -0
- package/dist/timeline/web-calls.js +106 -0
- package/dist/tool-gate.d.ts +103 -76
- package/dist/tool-gate.js +200 -127
- package/dist/tool-keys.d.ts +4 -1
- package/dist/tool-keys.js +8 -3
- package/dist/tool-list.d.ts +29 -0
- package/dist/tool-list.js +50 -0
- package/dist/tool-names.d.ts +76 -0
- package/dist/tool-names.js +101 -0
- package/dist/tool-plane.d.ts +34 -28
- package/dist/tool-plane.js +72 -37
- package/dist/tools.d.ts +59 -15
- package/dist/tools.js +46 -42
- package/dist/trigger-adapter.d.ts +85 -5
- package/dist/trigger-adapter.js +6 -0
- package/dist/trigger-adapters.js +3 -1
- package/dist/trigger-composio.d.ts +10 -0
- package/dist/trigger-composio.js +122 -0
- package/dist/trigger-email.d.ts +4 -0
- package/dist/trigger-email.js +228 -0
- package/dist/trigger-signatures.d.ts +6 -10
- package/dist/trigger-signatures.js +16 -16
- package/dist/trigger-targets.d.ts +1 -1
- package/dist/trigger-targets.js +4 -3
- package/dist/trigger-webhook.js +6 -4
- package/dist/triggers.d.ts +94 -9
- package/dist/triggers.js +263 -62
- package/dist/uploads.d.ts +9 -0
- package/dist/uploads.js +27 -0
- package/dist/validate.d.ts +15 -7
- package/dist/validate.js +91 -50
- package/dist/web-fake.d.ts +56 -0
- package/dist/web-fake.js +102 -0
- package/dist/web-fetch-direct.d.ts +3 -0
- package/dist/web-fetch-direct.js +4 -1
- package/dist/web-fetch.d.ts +6 -8
- package/dist/web-fetch.js +10 -53
- package/dist/web-search.d.ts +51 -2
- package/dist/web-search.js +116 -18
- package/dist/webhooks.d.ts +2 -1
- package/dist/webhooks.js +5 -1
- package/dist/workflow/node-runner.js +10 -2
- package/dist/workspace/archil-claim.d.ts +3 -0
- package/dist/workspace/archil-claim.js +9 -2
- package/dist/workspace/computer-deps.d.ts +25 -9
- package/dist/workspace/computer-deps.js +82 -38
- package/dist/workspace/computer-for-claim.d.ts +60 -4
- package/dist/workspace/computer-for-claim.js +203 -45
- package/dist/workspace/computer-hold.js +7 -1
- package/dist/workspace/computer-janitor.d.ts +10 -3
- package/dist/workspace/computer-janitor.js +96 -29
- package/dist/workspace/computer-kept.d.ts +82 -0
- package/dist/workspace/computer-kept.js +147 -0
- package/dist/workspace/computer-mcp.js +4 -3
- package/dist/workspace/computer-ports.d.ts +23 -3
- package/dist/workspace/computer-ports.js +115 -5
- package/dist/workspace/index.d.ts +2 -3
- package/dist/workspace/index.js +1 -2
- package/dist/workspace/kind-skills/desktop/SKILL.md +31 -11
- package/dist/workspace/kind-skills/phone/SKILL.md +29 -14
- package/dist/workspace/local.js +2 -2
- package/dist/workspace/resolve-computer.d.ts +33 -1
- package/dist/workspace/resolve-computer.js +37 -16
- package/dist/workspace/revision-skills.d.ts +6 -2
- package/dist/workspace/revision-skills.js +12 -5
- package/dist/workspace/run-end-computers.d.ts +30 -0
- package/dist/workspace/run-end-computers.js +137 -0
- package/dist/workspace/run-tools.d.ts +40 -23
- package/dist/workspace/run-tools.js +46 -19
- package/dist/wrap-up.d.ts +35 -0
- package/dist/wrap-up.js +48 -0
- package/launcher/agentrun-serve +4 -2
- package/package.json +13 -9
- package/skills/agentrun-serve/SKILL.md +248 -10
- package/templates/README.md +220 -60
- package/templates/TOOLS.md +168 -0
- package/templates/code-review/agent.md +46 -16
- 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 +3 -3
- 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/off-by-one/graders/no-repo-reads.md +2 -1
- 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/pasted-by-reference/case.yaml +5 -0
- package/templates/code-review/evals/pasted-by-reference/graders/by-reference.md +15 -0
- package/templates/code-review/evals/pasted-by-reference/graders/head-sha.md +6 -0
- package/templates/code-review/evals/pasted-by-reference/prompt.md +31 -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 +5 -4
- package/templates/code-review/skills/review/REVIEWER.md +5 -4
- package/templates/code-review/skills/review/SKILL.md +11 -6
- 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 +5 -4
- 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 +5 -4
- 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-Cn6JX1uH.js +0 -563
- package/dist/console/assets/index-DRN62V5v.css +0 -1
- package/dist/host-calls.d.ts +0 -20
- package/dist/host-calls.js +0 -12
- package/dist/runner/adapters/pi-computer.d.ts +0 -7
- package/dist/runner/adapters/pi-computer.js +0 -43
- package/dist/tool-blurbs.d.ts +0 -4
- package/dist/tool-blurbs.js +0 -28
- package/dist/tool-budget.d.ts +0 -38
- package/dist/tool-budget.js +0 -62
- package/dist/workspace/computer-script.d.ts +0 -37
- package/dist/workspace/computer-script.js +0 -138
- 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
|
@@ -7,6 +7,9 @@ export interface LearningFactoryDeps extends Pick<LearningLoopDeps, "ask" | "now
|
|
|
7
7
|
readonly store: Pick<Store, "runs" | "agents" | "learning">;
|
|
8
8
|
/** The server's data directory: where each agent's learning folder is. */
|
|
9
9
|
readonly data: string;
|
|
10
|
+
/** Optional immutable source-run policy snapshot (native jobs). This is quoted as task policy data by gradePrompt,
|
|
11
|
+
* never installed as the grader's own native instructions. */
|
|
12
|
+
readonly sourceInstructions?: (runId: string) => Promise<string>;
|
|
10
13
|
/** Where the folder's script says what it did (learningWorkspace's log). */
|
|
11
14
|
readonly log?: (line: string) => void;
|
|
12
15
|
}
|
|
@@ -28,9 +28,15 @@ export function learningLoopFactory(deps) {
|
|
|
28
28
|
const source = await store.runs.get(runId);
|
|
29
29
|
if (!source)
|
|
30
30
|
return undefined;
|
|
31
|
-
const instructions = objectOf((await store.agents.revision(source.revisionId))?.body).instructions;
|
|
32
31
|
const round = Number.isSafeInteger(input.round) && input.round > 1 ? { round: input.round } : {};
|
|
33
|
-
|
|
32
|
+
let instructions;
|
|
33
|
+
try {
|
|
34
|
+
instructions = deps.sourceInstructions ? await deps.sourceInstructions(runId) : objectOf((await store.agents.revision(source.revisionId))?.body).instructions;
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
return { runId, ...round, agentId: source.agentId, policyError: error instanceof Error ? error.message : String(error) };
|
|
38
|
+
}
|
|
39
|
+
return { runId, ...round, agentId: source.agentId, ...(typeof instructions === "string" ? { instructions } : {}), ...(deps.sourceInstructions ? { nativeInstructions: true } : {}) };
|
|
34
40
|
},
|
|
35
41
|
proposal: (runId, round) => store.learning.proposal(runId, round),
|
|
36
42
|
ask: deps.ask,
|
|
@@ -29,6 +29,15 @@ export interface KeptProposal {
|
|
|
29
29
|
}[];
|
|
30
30
|
/** The commit of the learning folder's main the run started from (its pin's seed). */
|
|
31
31
|
readonly seed?: string;
|
|
32
|
+
/** A file whose conflict base is not the seed, by its path (learning.ts Proposal): a revised workflow's, the commit of
|
|
33
|
+
* main its compile ask read it at. */
|
|
34
|
+
readonly bases?: Readonly<Record<string, string>>;
|
|
35
|
+
/** The draft the run's compile turn wrote (learn/compile.ts), by its name, and the notes it does the work of: marked
|
|
36
|
+
* `compiled_into` when the draft merges. */
|
|
37
|
+
readonly compiled?: {
|
|
38
|
+
readonly workflow: string;
|
|
39
|
+
readonly from_notes: readonly string[];
|
|
40
|
+
};
|
|
32
41
|
}
|
|
33
42
|
/** Main as the grader reads it: every active note's index line, the text of each note the proposal supersedes, and the
|
|
34
43
|
* blob each of those was read at (a merge on a main where one moved is a conflict). */
|
|
@@ -88,6 +97,9 @@ export interface MergeChange {
|
|
|
88
97
|
readonly graded: Readonly<Record<string, string>>;
|
|
89
98
|
/** The run's seed: a skill's or a draft's file not on main as it was on it is a conflict, never written over. */
|
|
90
99
|
readonly seed?: string;
|
|
100
|
+
/** A file checked against another commit than the seed, by its path: a revised workflow's, the commit its compile ask
|
|
101
|
+
* read it at. */
|
|
102
|
+
readonly bases?: Readonly<Record<string, string>>;
|
|
91
103
|
/** New notes written over main's note of the same name, each superseding it by name (takenOnMain). */
|
|
92
104
|
readonly replace?: readonly string[];
|
|
93
105
|
/** Each skill re-filed as a note, retired on main in the same write (its SKILL.md, and the note that replaces it). */
|
|
@@ -95,6 +107,11 @@ export interface MergeChange {
|
|
|
95
107
|
readonly skill: string;
|
|
96
108
|
readonly note: string;
|
|
97
109
|
}[];
|
|
110
|
+
/** A compiled draft this merge writes, and the notes it marks `compiled_into` (learn/commit.ts). */
|
|
111
|
+
readonly compiled?: {
|
|
112
|
+
readonly workflow: string;
|
|
113
|
+
readonly notes: readonly string[];
|
|
114
|
+
};
|
|
98
115
|
}
|
|
99
116
|
export type LearningCommitResult = {
|
|
100
117
|
readonly ok: true;
|
|
@@ -130,6 +147,8 @@ export interface LearningLoopDeps {
|
|
|
130
147
|
readonly round?: number;
|
|
131
148
|
readonly agentId: string;
|
|
132
149
|
readonly instructions?: string;
|
|
150
|
+
readonly policyError?: string;
|
|
151
|
+
readonly nativeInstructions?: true;
|
|
133
152
|
} | undefined>;
|
|
134
153
|
/** Its kept proposal of that round (store.learning.proposal). */
|
|
135
154
|
proposal(runId: string, round: number): Promise<LearningProposal | undefined>;
|
|
@@ -245,7 +264,8 @@ export declare function keptOf(proposal: KeptProposal, verdict: Verdict): KeptPr
|
|
|
245
264
|
/** The merge of `merging` (what the verdict kept), the one rule learningCommit's merge is made by: each note with
|
|
246
265
|
* the origin its item gives (`you` for the user's own words, else the run's) and held for its owner's OK when its item
|
|
247
266
|
* is pending; a skill's SKILL.md or a draft's README.md held when its item is (a draft's workflow.json is held by its
|
|
248
|
-
* README); and the seed the source run started from, so a skill's or draft's file changed on main since is a conflict
|
|
267
|
+
* README); and the seed the source run started from, so a skill's or draft's file changed on main since is a conflict
|
|
268
|
+
* (a revised workflow's file: changed since the commit its compile ask read it at, `bases`). */
|
|
249
269
|
export declare function mergeChangeOf(runId: string, merging: KeptProposal, verdict: Verdict, graded: Readonly<Record<string, string>>, round?: number): MergeChange;
|
|
250
270
|
/** What a merge of `merging` learned, as the server's grade named it on the run (learning-run.ts grade): the notes it
|
|
251
271
|
* added that runs read, with what each supersedes; the ones waiting for their owner's OK; its skills and workflow
|
|
@@ -156,7 +156,8 @@ const itemsByFile = (verdict) => {
|
|
|
156
156
|
/** The merge of `merging` (what the verdict kept), the one rule learningCommit's merge is made by: each note with
|
|
157
157
|
* the origin its item gives (`you` for the user's own words, else the run's) and held for its owner's OK when its item
|
|
158
158
|
* is pending; a skill's SKILL.md or a draft's README.md held when its item is (a draft's workflow.json is held by its
|
|
159
|
-
* README); and the seed the source run started from, so a skill's or draft's file changed on main since is a conflict
|
|
159
|
+
* README); and the seed the source run started from, so a skill's or draft's file changed on main since is a conflict
|
|
160
|
+
* (a revised workflow's file: changed since the commit its compile ask read it at, `bases`). */
|
|
160
161
|
export function mergeChangeOf(runId, merging, verdict, graded, round = 1) {
|
|
161
162
|
const judged = itemsByFile(verdict);
|
|
162
163
|
const notes = merging.notes.map(({ file, text }) => ({ path: file, text: mergedNote(text, { origin: judged.get(file)?.origin ?? "run" }) }));
|
|
@@ -168,9 +169,11 @@ export function mergeChangeOf(runId, merging, verdict, graded, round = 1) {
|
|
|
168
169
|
// Each skill re-filed as a note is retired on main in the same write (learn/commit.ts mergeOf): a kept one, and one
|
|
169
170
|
// main already holds the same rule of as a note (dropped unsaid), so no old skill stays served beside its note.
|
|
170
171
|
const retire = verdict.items.flatMap((item) => (item.note && (item.keep || item.why === SAME_NOTE) && learnedPlace(item.file)?.kind === "skill" ? [{ skill: item.file, note: item.note.file, rule: ruleOfText(item.note.file, item.note.text) }] : []));
|
|
172
|
+
// The compiled draft, when the verdict keeps it: the notes it does the work of are marked as it merges.
|
|
173
|
+
const compiled = merging.compiled && files.some(({ path }) => path === `workflows/${merging.compiled.workflow}/workflow.json`) && merging.compiled.from_notes.length ? { workflow: merging.compiled.workflow, notes: [...merging.compiled.from_notes] } : undefined;
|
|
171
174
|
return {
|
|
172
175
|
kind: "merge", runId, ...(round > 1 ? { round } : {}), reason: verdict.reason || "The grader kept every new note.", files: [...notes, ...files],
|
|
173
|
-
...(held.length ? { held } : {}), graded, ...(merging.seed ? { seed: merging.seed } : {}), ...(retire.length ? { retire } : {}),
|
|
176
|
+
...(held.length ? { held } : {}), graded, ...(merging.seed ? { seed: merging.seed } : {}), ...(merging.bases && Object.keys(merging.bases).length ? { bases: { ...merging.bases } } : {}), ...(retire.length ? { retire } : {}), ...(compiled ? { compiled } : {}),
|
|
174
177
|
};
|
|
175
178
|
}
|
|
176
179
|
/** What a merge of `merging` learned, as the server's grade named it on the run (learning-run.ts grade): the notes it
|
|
@@ -305,6 +308,10 @@ export function createLearningLoop(learning) {
|
|
|
305
308
|
await append(KINDS.learningDropped, { source: "", reason: "no_source", detail: said.stopped(STOPPED.notChecked) }, "failed");
|
|
306
309
|
return { state: "failed", error: { code: "learning_no_source", message: "the learning run names no run that learned" } };
|
|
307
310
|
}
|
|
311
|
+
if (source.policyError) {
|
|
312
|
+
await append(KINDS.learningDropped, { source: source.runId, reason: "checker", detail: source.policyError }, "ended");
|
|
313
|
+
return { state: "ended" };
|
|
314
|
+
}
|
|
308
315
|
const round = source.round ?? 1;
|
|
309
316
|
const kept = await learning.proposal(source.runId, round);
|
|
310
317
|
if (!kept) {
|
|
@@ -448,10 +455,21 @@ export function createLearningLoop(learning) {
|
|
|
448
455
|
return { state: "ended" };
|
|
449
456
|
}
|
|
450
457
|
const items = gradedItems(grading, (proposal.files ?? []));
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
458
|
+
let prompt;
|
|
459
|
+
try {
|
|
460
|
+
prompt = gradePrompt({
|
|
461
|
+
run: source.runId, ...(source.instructions ? { instructions: source.instructions } : {}), active: main.active, superseded, proposed: grading,
|
|
462
|
+
...(source.nativeInstructions ? { nativeInstructions: true } : {}),
|
|
463
|
+
...(proposal.files?.length ? { files: proposal.files } : {}), ...(proposal.dryRuns ? { dryRuns: proposal.dryRuns } : {}), ...(proposal.drafted?.length ? { drafted: proposal.drafted } : {}), ...(proposal.asked ? { asked: proposal.asked } : {}), ...(proposal.triggered ? { triggered: proposal.triggered } : {}), ...(proposal.held ? { held: proposal.held } : {}),
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
catch (error) {
|
|
467
|
+
// A full native policy can fill the remaining prompt budget. Refuse the whole proposal visibly;
|
|
468
|
+
// no grader was called and no standing instruction or proposal is silently omitted.
|
|
469
|
+
// Keep what the generality pre-check already spent.
|
|
470
|
+
await append(KINDS.learningDropped, { source: source.runId, reason: "checker", detail: error instanceof Error ? error.message : "The grading evidence exceeds the supported prompt budget.", usd: spent(), tokens, ...(unchecked !== undefined ? { unchecked } : {}) }, "ended");
|
|
471
|
+
return { state: "ended" };
|
|
472
|
+
}
|
|
455
473
|
/** The asks of this attempt that answered: the records holding more requests than these is an earlier attempt's. */
|
|
456
474
|
let answered = 0;
|
|
457
475
|
// Once an ask read the grade's records (`booked`), its dollars are theirs: an earlier attempt's requests counted too.
|
|
@@ -43,3 +43,7 @@ export declare const laidOf: (laid: LaidSeed | undefined) => {
|
|
|
43
43
|
/** Lays the run's learning seed (see the file's head). Undefined when the seed could not be read: nothing was laid.
|
|
44
44
|
* Never throws. */
|
|
45
45
|
export declare function layLearningSeed(lay: LearningSeedLay): Promise<LaidSeed | undefined>;
|
|
46
|
+
/** The learned workflows the folder held active at `commit`, as a claim's lay hands them to the learned_workflow tool
|
|
47
|
+
* (chooseWorkflows: within the budget, none holding a secret): what a champion serves from while a newer revision of it
|
|
48
|
+
* is on main (runner/promotion.ts). Throws when the folder cannot answer or the commit is gone. */
|
|
49
|
+
export declare function workflowsAt(read: Pick<LearningSeedLay, "folder" | "shown">, commit: string): Promise<LearnedWorkflow[]>;
|
|
@@ -58,3 +58,17 @@ export async function layLearningSeed(lay) {
|
|
|
58
58
|
return { seed, skills: [], workflows: [] };
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
+
/** The learned workflows the folder held active at `commit`, as a claim's lay hands them to the learned_workflow tool
|
|
62
|
+
* (chooseWorkflows: within the budget, none holding a secret): what a champion serves from while a newer revision of it
|
|
63
|
+
* is on main (runner/promotion.ts). Throws when the folder cannot answer or the commit is gone. */
|
|
64
|
+
export async function workflowsAt(read, commit) {
|
|
65
|
+
const folder = read.folder();
|
|
66
|
+
let seed;
|
|
67
|
+
try {
|
|
68
|
+
seed = await seedFrom(commit, readerOf(folder.workspace));
|
|
69
|
+
}
|
|
70
|
+
finally {
|
|
71
|
+
await folder.end().catch(() => undefined);
|
|
72
|
+
}
|
|
73
|
+
return chooseWorkflows(seed, await read.shown()).flows;
|
|
74
|
+
}
|
|
@@ -4,9 +4,12 @@ export type { AlsoRow, Claim, Command, Journal };
|
|
|
4
4
|
/** Why a run ends failed when the answer it would end on was cut at the model's output limit (stopReason "length"): the
|
|
5
5
|
* answer is unfinished, so the run never reads ended. `tokens`: what the cut answer used, when its harness says. */
|
|
6
6
|
export declare const cutAtLimit: (tokens?: number) => string;
|
|
7
|
+
/** What the step keeps with its end-of-run turn as the turn is first asked (EndOfRunTurn ask's `keep`): written with the
|
|
8
|
+
* turn's prompt, durable before the turn's first request leaves. */
|
|
9
|
+
export type EndOfRunKept = Readonly<Record<string, string | number | boolean | null>>;
|
|
7
10
|
/** How an end-of-run turn the loop asked ended: its answer's text, its deadline passed (the turn is aborted), or it
|
|
8
|
-
* failed. */
|
|
9
|
-
export type EndOfRunAnswer = {
|
|
11
|
+
* failed. `kept`: what the turn's first ask kept (its `keep`), an earlier claim's when that claim asked it first. */
|
|
12
|
+
export type EndOfRunAnswer = ({
|
|
10
13
|
readonly ended: true;
|
|
11
14
|
readonly answer: string;
|
|
12
15
|
} | {
|
|
@@ -16,6 +19,8 @@ export type EndOfRunAnswer = {
|
|
|
16
19
|
readonly code: string;
|
|
17
20
|
readonly message: string;
|
|
18
21
|
};
|
|
22
|
+
}) & {
|
|
23
|
+
readonly kept?: EndOfRunKept;
|
|
19
24
|
};
|
|
20
25
|
/**
|
|
21
26
|
* The end-of-run step (the learning lane's end-of-run turn): asked once, after the job's last turn ended and before the
|
|
@@ -36,13 +41,24 @@ export type EndOfRunTurn = (input: {
|
|
|
36
41
|
readonly cut?: "stopped" | "stopped-looking" | "faulted";
|
|
37
42
|
/** `again`: the turn asked once more in the same session (its first answer out of format), as its own request.
|
|
38
43
|
* `round`: which end of the run this is (1, its first, when absent): an end after a follow-up opened the run again is
|
|
39
|
-
* a later round, asked of the model anew under a request of its own.
|
|
44
|
+
* a later round, asked of the model anew under a request of its own. `step`: a turn of its own after the look-back,
|
|
45
|
+
* in the same session (the compile turn's attempts, `compile-<n>`, learn/compile.ts), each its own request, answered
|
|
46
|
+
* from its submission on a later claim as the turn is. `keep`: what the step keeps with the turn as it
|
|
47
|
+
* is first asked (the run's spend and time as it starts), written with its prompt before its first request leaves; a
|
|
48
|
+
* turn an earlier claim asked answers with that claim's (`kept`), never this one's, so a restart mid-turn never moves
|
|
49
|
+
* what the earlier attempt spent into the job's. A loop that keeps no record of its own (pi's) keeps none. */
|
|
40
50
|
ask(prompt: string, opts: {
|
|
41
51
|
readonly origin: "reflect";
|
|
42
52
|
readonly deadlineMs: number;
|
|
43
53
|
readonly again?: true;
|
|
44
54
|
readonly round?: number;
|
|
55
|
+
readonly step?: string;
|
|
56
|
+
readonly keep?: EndOfRunKept;
|
|
45
57
|
}): Promise<EndOfRunAnswer>;
|
|
58
|
+
/** What round `round`'s turn kept as it was first asked (its ask's `keep`), when it was asked already: a look-back an
|
|
59
|
+
* earlier claim (or this one) started, readable before `ask`, so a step that skips or is cut never asks, and still
|
|
60
|
+
* closes that look-back with its first ask's figures. Undefined when none asked it, or the loop keeps no record (pi's). */
|
|
61
|
+
keptOf?(round: number): EndOfRunKept | undefined;
|
|
46
62
|
readonly signal: AbortSignal;
|
|
47
63
|
}) => Promise<{
|
|
48
64
|
readonly also: readonly AlsoRow[];
|
package/dist/runner/loop.d.ts
CHANGED
|
@@ -15,8 +15,37 @@ export declare const quiet: KernelHooks;
|
|
|
15
15
|
export declare const CLOSE_MS = 2000;
|
|
16
16
|
/** How long a person's stop waits for the turn to settle, by default. */
|
|
17
17
|
export declare const STOP_SETTLE_MS = 30000;
|
|
18
|
-
/**
|
|
18
|
+
/** How long a park waits, by default, for the calls already running beside the parked one to end before it seals: as long
|
|
19
|
+
* as a stop gives a turn to settle, the loop's one bound for calls already under way. Past it, what still runs is cut. */
|
|
20
|
+
export declare const PARK_SIBLINGS_MS = 30000;
|
|
21
|
+
/** The most a cut run's end-of-run step (a store read) may take before the end is written without it. */
|
|
19
22
|
export declare const CUT_STEP_MS = 2000;
|
|
23
|
+
/** The most the end's patch (the run's cost and metrics, read from its journal and the store) may take before the end is
|
|
24
|
+
* written without them. Those reads queue behind every other run's on a busy store (eight runs ending at once took over
|
|
25
|
+
* 2 s), and an end written without them leaves the run's cost and path unknown for good: so it waits as long as a
|
|
26
|
+
* stalled store, never a busy one, would hold it. Past it, the end says both are unknown (END_PATCH_UNKNOWN). */
|
|
27
|
+
export declare const END_PATCH_MS = 30000;
|
|
28
|
+
/** What an end whose patch was late or failed writes: its cost and metrics unknown (null), never left as an earlier end
|
|
29
|
+
* of the run stored them, never read as a run that cost $0 by the agent's own path. */
|
|
30
|
+
export declare const END_PATCH_UNKNOWN: {
|
|
31
|
+
readonly costUsd: null;
|
|
32
|
+
readonly metrics: null;
|
|
33
|
+
};
|
|
34
|
+
/** How many times an end reads its cost before it is written unknown, and the pause between reads: all within the end's
|
|
35
|
+
* bound (END_PATCH_MS), so a store that refused one read never leaves the cost null. The stored cost is every reader's
|
|
36
|
+
* answer for an ended run (the list, the view, usage, learning), so a null there stays only when no read could be made. */
|
|
37
|
+
export declare const END_COST_TRIES = 3;
|
|
38
|
+
export declare const END_COST_PAUSE_MS = 100;
|
|
39
|
+
/** `read`'s answer, read again after a failure (END_COST_TRIES in all, END_COST_PAUSE_MS apart), each failure said by
|
|
40
|
+
* `failed` (its error, how many reads failed, whether it was the last): "late" once `late` resolves first, "failed" when
|
|
41
|
+
* every read failed. */
|
|
42
|
+
export declare function readAgain<T>(read: () => Promise<T>, late: Promise<"late">, failed: (error: unknown, tries: number, last: boolean) => void): Promise<T | "late" | "failed">;
|
|
43
|
+
/** How long a booking whose write has begun (its request answered, its runner.turn on its way to the store) is waited
|
|
44
|
+
* for, by an answer's cost and by a park's or an end's release, before either goes on without it. A busy store queues
|
|
45
|
+
* that write behind every other run's; an end written ahead of it has no booking for the last request and reads the
|
|
46
|
+
* run's cost unknown for good, so it waits as long as the end's own patch would (END_PATCH_MS). A request still
|
|
47
|
+
* streaming is waited for CLOSE_MS only, as before: past it, it reads at its hold. */
|
|
48
|
+
export declare const BOOKING_WRITE_MS = 30000;
|
|
20
49
|
/** Where a commit's batches hold what an expectation waits for: the batch's index and the matched record's id. */
|
|
21
50
|
type Matched = {
|
|
22
51
|
readonly index: number;
|
|
@@ -75,6 +104,10 @@ export declare function heldStateOf(value: unknown): HeldState | undefined;
|
|
|
75
104
|
* (stopReason "length"): unfinished, so never ended. A cut answer the run went on from (a later turn answered after it)
|
|
76
105
|
* is not its last, and changes nothing. */
|
|
77
106
|
export declare function cutLast(entries: readonly EntryRecord[]): string | undefined;
|
|
107
|
+
/** The text of the answer the run would end on (cutLast's newest model answer: the root's last pi.assistant, its text
|
|
108
|
+
* blocks joined as the Timeline joins them, or a CLI record's last model message), "" when it said none: what the output
|
|
109
|
+
* contract's retry checks against the agent's output schema (adapter-loop.ts). */
|
|
110
|
+
export declare function lastAnswerText(entries: readonly EntryRecord[]): string;
|
|
78
111
|
/** A tool result pi wrote for a call it cut off at its restart limit, as its message, if any. */
|
|
79
112
|
export declare function restartLimited(entries: readonly EntryRecord[]): string | undefined;
|
|
80
113
|
/** The root conversation's entries, oldest first. */
|
package/dist/runner/loop.js
CHANGED
|
@@ -17,8 +17,50 @@ export const quiet = { beforeIntent: async () => { }, beforeResult: async () =>
|
|
|
17
17
|
export const CLOSE_MS = 2_000;
|
|
18
18
|
/** How long a person's stop waits for the turn to settle, by default. */
|
|
19
19
|
export const STOP_SETTLE_MS = 30_000;
|
|
20
|
-
/**
|
|
20
|
+
/** How long a park waits, by default, for the calls already running beside the parked one to end before it seals: as long
|
|
21
|
+
* as a stop gives a turn to settle, the loop's one bound for calls already under way. Past it, what still runs is cut. */
|
|
22
|
+
export const PARK_SIBLINGS_MS = 30_000;
|
|
23
|
+
/** The most a cut run's end-of-run step (a store read) may take before the end is written without it. */
|
|
21
24
|
export const CUT_STEP_MS = 2_000;
|
|
25
|
+
/** The most the end's patch (the run's cost and metrics, read from its journal and the store) may take before the end is
|
|
26
|
+
* written without them. Those reads queue behind every other run's on a busy store (eight runs ending at once took over
|
|
27
|
+
* 2 s), and an end written without them leaves the run's cost and path unknown for good: so it waits as long as a
|
|
28
|
+
* stalled store, never a busy one, would hold it. Past it, the end says both are unknown (END_PATCH_UNKNOWN). */
|
|
29
|
+
export const END_PATCH_MS = 30_000;
|
|
30
|
+
/** What an end whose patch was late or failed writes: its cost and metrics unknown (null), never left as an earlier end
|
|
31
|
+
* of the run stored them, never read as a run that cost $0 by the agent's own path. */
|
|
32
|
+
export const END_PATCH_UNKNOWN = { costUsd: null, metrics: null };
|
|
33
|
+
/** How many times an end reads its cost before it is written unknown, and the pause between reads: all within the end's
|
|
34
|
+
* bound (END_PATCH_MS), so a store that refused one read never leaves the cost null. The stored cost is every reader's
|
|
35
|
+
* answer for an ended run (the list, the view, usage, learning), so a null there stays only when no read could be made. */
|
|
36
|
+
export const END_COST_TRIES = 3;
|
|
37
|
+
export const END_COST_PAUSE_MS = 100;
|
|
38
|
+
/** `read`'s answer, read again after a failure (END_COST_TRIES in all, END_COST_PAUSE_MS apart), each failure said by
|
|
39
|
+
* `failed` (its error, how many reads failed, whether it was the last): "late" once `late` resolves first, "failed" when
|
|
40
|
+
* every read failed. */
|
|
41
|
+
export async function readAgain(read, late, failed) {
|
|
42
|
+
for (let tries = 1;; tries += 1) {
|
|
43
|
+
try {
|
|
44
|
+
return await Promise.race([read(), late]);
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
failed(error, tries, tries >= END_COST_TRIES);
|
|
48
|
+
if (tries >= END_COST_TRIES)
|
|
49
|
+
return "failed";
|
|
50
|
+
let timer;
|
|
51
|
+
const paused = await Promise.race([new Promise((resolve) => (timer = setTimeout(() => resolve("again"), END_COST_PAUSE_MS))), late]);
|
|
52
|
+
clearTimeout(timer);
|
|
53
|
+
if (paused === "late")
|
|
54
|
+
return "late";
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/** How long a booking whose write has begun (its request answered, its runner.turn on its way to the store) is waited
|
|
59
|
+
* for, by an answer's cost and by a park's or an end's release, before either goes on without it. A busy store queues
|
|
60
|
+
* that write behind every other run's; an end written ahead of it has no booking for the last request and reads the
|
|
61
|
+
* run's cost unknown for good, so it waits as long as the end's own patch would (END_PATCH_MS). A request still
|
|
62
|
+
* streaming is waited for CLOSE_MS only, as before: past it, it reads at its hold. */
|
|
63
|
+
export const BOOKING_WRITE_MS = END_PATCH_MS;
|
|
22
64
|
/**
|
|
23
65
|
* The run's journal with the loop's staging matched to commits. stage() replaces what was staged, so the loop never
|
|
24
66
|
* calls it directly: `expect(match, expected)` stages `expected` on the first commit whose batches `match`, merged with
|
|
@@ -156,6 +198,18 @@ export function cutLast(entries) {
|
|
|
156
198
|
const message = last?.model?.[0];
|
|
157
199
|
return message?.stopReason === PI_STOP.length ? cutAtLimit(message.usage?.output) : undefined;
|
|
158
200
|
}
|
|
201
|
+
/** The text of the answer the run would end on (cutLast's newest model answer: the root's last pi.assistant, its text
|
|
202
|
+
* blocks joined as the Timeline joins them, or a CLI record's last model message), "" when it said none: what the output
|
|
203
|
+
* contract's retry checks against the agent's output schema (adapter-loop.ts). */
|
|
204
|
+
export function lastAnswerText(entries) {
|
|
205
|
+
const last = [...entries].reverse().find((entry) => entry.kind === "pi.assistant" || (entry.kind === KINDS.message && entry.data?.role === "model"));
|
|
206
|
+
if (last?.kind === KINDS.message)
|
|
207
|
+
return String(last.data.text ?? "");
|
|
208
|
+
const content = last?.model?.[0]?.content;
|
|
209
|
+
if (typeof content === "string")
|
|
210
|
+
return content;
|
|
211
|
+
return Array.isArray(content) ? content.filter((block) => block?.type === "text" && typeof block.text === "string").map((block) => block.text).join("\n") : "";
|
|
212
|
+
}
|
|
159
213
|
/** A tool result pi wrote for a call it cut off at its restart limit, as its message, if any. */
|
|
160
214
|
export function restartLimited(entries) {
|
|
161
215
|
for (const entry of entries) {
|
package/dist/runner/main.d.ts
CHANGED
|
@@ -118,7 +118,8 @@ export declare const RUNNER_DRAIN_TIMEOUT = "6s";
|
|
|
118
118
|
export declare const RUNNER_DRAIN_ENV = "AGENTRUN_DRAIN_TIMEOUT";
|
|
119
119
|
/** What a runner process holds, from its arguments and `env`: --loops, else the server's --max-runs default
|
|
120
120
|
* (AGENTRUN_MAX_RUNS, else as many pi runs as this host's memory holds; maxRunsOf); --drain-timeout, else
|
|
121
|
-
* AGENTRUN_DRAIN_TIMEOUT, else RUNNER_DRAIN_TIMEOUT. A bad AGENTRUN_MAX_RUNS
|
|
121
|
+
* AGENTRUN_DRAIN_TIMEOUT, else RUNNER_DRAIN_TIMEOUT. A bad AGENTRUN_MAX_RUNS, AGENTRUN_DRAIN_TIMEOUT or
|
|
122
|
+
* AGENTRUN_FREE_MODEL_REQUESTS is RunnerRefused. */
|
|
122
123
|
export declare function runnerHolds(args: {
|
|
123
124
|
loops?: number;
|
|
124
125
|
drainMs?: number;
|
|
@@ -149,6 +150,10 @@ export declare function runUntilSignalled(process: RunnerProcess, signals?: read
|
|
|
149
150
|
* next epoch, and the fence refuses the dead loop's late writes. The line is written to stderr synchronously
|
|
150
151
|
* (writeSync), so a pipe's slow reader still gets the whole stack before the exit. Exported for its test. */
|
|
151
152
|
export declare function lastResort(name: string, write?: (line: string) => void, exit?: (code: number) => void): (reason: unknown) => void;
|
|
153
|
+
/** The line of a runner's trouble, in its name: a claim it lost, and an error (a renew or a stop that failed), which
|
|
154
|
+
* goes to stderr. Undefined for any other event. The runner beside a server says them the same way (beside.ts), so a
|
|
155
|
+
* lapse of every claim at once shows its cause. */
|
|
156
|
+
export declare function troubleLine(name: string, event: RunnerEvent): string | undefined;
|
|
152
157
|
/** `agentrun-serve runner ...`: the exit code. 2: bad arguments; 3: a store schema this runner does not know (or none
|
|
153
158
|
* set up yet); 1: anything else; 0: closed on a signal, or --check found a fresh heartbeat. AGENTRUN_RUNNER_NAME names
|
|
154
159
|
* it when --name does not. */
|
package/dist/runner/main.js
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
import { mkdirSync, statSync, utimesSync, writeFileSync, writeSync } from "node:fs";
|
|
14
14
|
import { join, resolve } from "node:path";
|
|
15
15
|
import { PROVIDERS } from "@parcha/agentrun-computer";
|
|
16
|
+
import { freeModelRequestsOf } from "@parcha/agentrun-kernel/kernel/cap";
|
|
16
17
|
import { ArchilSettingsEnvInvalid, archilSettingsFromEnv } from "../archil-settings.js";
|
|
17
18
|
import { dockerPathsForRuns } from "../box-paths.js";
|
|
18
19
|
import { hostCommandRefusals } from "../computers.js";
|
|
@@ -33,6 +34,7 @@ import { envValue } from "../key-meta.js";
|
|
|
33
34
|
import { fauxComputers } from "../faux-computers.js";
|
|
34
35
|
import { computerDepsFrom } from "../workspace/computer-deps.js";
|
|
35
36
|
import { startJanitor } from "../workspace/computer-janitor.js";
|
|
37
|
+
import { runEndComputers } from "../workspace/run-end-computers.js";
|
|
36
38
|
import { createDispatchLoop } from "./dispatch.js";
|
|
37
39
|
import { resolveRunnerLoop } from "./harness-loops.js";
|
|
38
40
|
import { routeOf } from "./model-route.js";
|
|
@@ -197,6 +199,8 @@ export async function startRunnerProcess(options) {
|
|
|
197
199
|
janitor = startJanitor({ store, computers: parts.computers, env: parts.env, log: warn });
|
|
198
200
|
// Before it claims: the scratch folders of runs that ended after their runner died (scratch-sweep.ts), said as warnings.
|
|
199
201
|
await sweepEndedScratch(store, options.dataDir, { log: warn });
|
|
202
|
+
// A run's end lets go of what its earlier claims' computers left, with the same computers (run-end-computers.ts).
|
|
203
|
+
const runEnded = typeof parts !== "function" ? runEndComputers({ store, computers: parts.computers, log: warn }) : undefined;
|
|
200
204
|
runner = startRunner({
|
|
201
205
|
store,
|
|
202
206
|
createLoop,
|
|
@@ -205,6 +209,7 @@ export async function startRunnerProcess(options) {
|
|
|
205
209
|
...(options.drainMs ? { drainMs: options.drainMs } : {}),
|
|
206
210
|
memory,
|
|
207
211
|
...(options.onEvent ? { onEvent: options.onEvent } : {}),
|
|
212
|
+
...(runEnded ? { runEnded } : {}),
|
|
208
213
|
onBeat: heartbeat(options.dataDir, name, options.now ?? Date.now),
|
|
209
214
|
});
|
|
210
215
|
}
|
|
@@ -248,7 +253,8 @@ export const RUNNER_DRAIN_TIMEOUT = "6s";
|
|
|
248
253
|
export const RUNNER_DRAIN_ENV = "AGENTRUN_DRAIN_TIMEOUT";
|
|
249
254
|
/** What a runner process holds, from its arguments and `env`: --loops, else the server's --max-runs default
|
|
250
255
|
* (AGENTRUN_MAX_RUNS, else as many pi runs as this host's memory holds; maxRunsOf); --drain-timeout, else
|
|
251
|
-
* AGENTRUN_DRAIN_TIMEOUT, else RUNNER_DRAIN_TIMEOUT. A bad AGENTRUN_MAX_RUNS
|
|
256
|
+
* AGENTRUN_DRAIN_TIMEOUT, else RUNNER_DRAIN_TIMEOUT. A bad AGENTRUN_MAX_RUNS, AGENTRUN_DRAIN_TIMEOUT or
|
|
257
|
+
* AGENTRUN_FREE_MODEL_REQUESTS is RunnerRefused. */
|
|
252
258
|
export function runnerHolds(args, env) {
|
|
253
259
|
let loops = args.loops;
|
|
254
260
|
if (loops === undefined) {
|
|
@@ -266,6 +272,14 @@ export function runnerHolds(args, env) {
|
|
|
266
272
|
if (drainMs === undefined)
|
|
267
273
|
throw new RunnerRefused(`${RUNNER_DRAIN_ENV} is a duration such as 6s, 500ms or 1m, not ${JSON.stringify(given)}`);
|
|
268
274
|
}
|
|
275
|
+
// The limit on each run's requests on free models (AGENTRUN_FREE_MODEL_REQUESTS), read again at each claim: a bad one refuses
|
|
276
|
+
// the runner here, never a run at its claim.
|
|
277
|
+
try {
|
|
278
|
+
freeModelRequestsOf(env);
|
|
279
|
+
}
|
|
280
|
+
catch (error) {
|
|
281
|
+
throw new RunnerRefused(error.message);
|
|
282
|
+
}
|
|
269
283
|
return { loops, drainMs };
|
|
270
284
|
}
|
|
271
285
|
/** The runner process's arguments: `--data D [--loops N] [--drain-timeout D] [--name N] [--faux M]`, or `--check --data D
|
|
@@ -351,10 +365,18 @@ function said(name, event) {
|
|
|
351
365
|
return `Runner ${name} claimed ${event.claim.runId} (epoch ${event.claim.epoch})`;
|
|
352
366
|
if (event.type === "released")
|
|
353
367
|
return `Runner ${name} released ${event.runId} (${event.end})`;
|
|
354
|
-
if (event.type === "claim-lost")
|
|
355
|
-
return `Runner ${name} lost its claim on ${event.runId} (${event.why})`;
|
|
356
368
|
if (event.type === "started" || event.type === "ended")
|
|
357
369
|
return runLine(event);
|
|
370
|
+
return troubleLine(name, event);
|
|
371
|
+
}
|
|
372
|
+
/** The line of a runner's trouble, in its name: a claim it lost, and an error (a renew or a stop that failed), which
|
|
373
|
+
* goes to stderr. Undefined for any other event. The runner beside a server says them the same way (beside.ts), so a
|
|
374
|
+
* lapse of every claim at once shows its cause. */
|
|
375
|
+
export function troubleLine(name, event) {
|
|
376
|
+
if (event.type === "claim-lost")
|
|
377
|
+
return `Runner ${name} lost its claim on ${event.runId} (${event.why})`;
|
|
378
|
+
if (event.type === "error")
|
|
379
|
+
return `Runner ${name}: ${event.step}${event.runId ? ` ${event.runId}` : ""}: ${event.message}`;
|
|
358
380
|
return undefined;
|
|
359
381
|
}
|
|
360
382
|
/** `agentrun-serve runner ...`: the exit code. 2: bad arguments; 3: a store schema this runner does not know (or none
|
|
@@ -434,7 +456,7 @@ export async function runnerMain(argv, given = process.env, hooks = {}) {
|
|
|
434
456
|
janitor: true,
|
|
435
457
|
onEvent: (event) => {
|
|
436
458
|
if (event.type === "error")
|
|
437
|
-
return void console.error(
|
|
459
|
+
return void console.error(troubleLine(runnerOf, event));
|
|
438
460
|
const line = said(runnerOf, event);
|
|
439
461
|
if (line)
|
|
440
462
|
console.log(line);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type OAuthNetwork } from "../mcp-oauth.js";
|
|
2
2
|
import { type McpCredentials, type McpPin } from "../mcp-gateway.js";
|
|
3
|
+
import { type PinListing } from "../mcp-pin-first.js";
|
|
3
4
|
import { type GithubAppAccess, type GithubTimer } from "./mcp-github.js";
|
|
4
5
|
import { ClaimRefused } from "./loop-contract.js";
|
|
5
6
|
import { type Claim, type Store } from "../store/index.js";
|
|
@@ -10,10 +11,13 @@ export declare class McpClaimRefused extends ClaimRefused {
|
|
|
10
11
|
export interface McpClaimOptions {
|
|
11
12
|
/** `settings`: the private-network OAuth hosts the owner allows (privateOAuthHosts), read at each refresh. `where`:
|
|
12
13
|
* the store's identity, which a wait on another claim's refresh lease is keyed by. */
|
|
13
|
-
store: Pick<Store, "mcp" | "runs" | "settings" | "where">;
|
|
14
|
+
store: Pick<Store, "mcp" | "runs" | "settings" | "where" | "agents">;
|
|
14
15
|
claim: Pick<Claim, "runId" | "epoch">;
|
|
15
16
|
/** The run's granted tools, by catalog name (`mcp:<server>/<tool>` among them). */
|
|
16
17
|
grants: readonly string[];
|
|
18
|
+
/** A server's listing as a save lists it (mcp-pin-first.ts registryListing): how a claim of a run whose revision has no
|
|
19
|
+
* pin pins it. None: such a claim is refused in words. */
|
|
20
|
+
pinListing?: (server: string, stop?: AbortSignal) => Promise<PinListing>;
|
|
17
21
|
/** The runner's seal key (the server's): a runner never starts without one (seal-key.ts bootSealKey). */
|
|
18
22
|
sealKey: Buffer;
|
|
19
23
|
/** The claim's signal: aborted when the claim is lost or the runner stops. */
|