@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
package/dist/propose.js
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
// Learning, after a run: the notes its end-of-run turn answered with, and a skill or a workflow draft beside them, are read
|
|
2
|
+
// by the host (learn/reflect.ts parseReflection), checked against the commit the run started from (learn/check.ts
|
|
3
|
+
// checkProposal), and kept as its proposal (`learning-proposal.json`, in the directory the caller gives), or dropped. The
|
|
4
|
+
// answer is what the runner's end-of-run turn read from the run's store (runner/learning-end.ts), never the run's work;
|
|
5
|
+
// and no file the run wrote is read at all, in `.learning/` or anywhere. The seed is
|
|
6
|
+
// read from the agent's learning folder through its Workspace, as the reflect hook's check reads it (learn/seed-check.ts):
|
|
7
|
+
// the snapshot and its bodies when main is the seed (no exec), else one read-only exec of the learning script at that
|
|
8
|
+
// commit. Nothing is written to git here, and nothing is written at all before the checks pass: what they refuse (a
|
|
9
|
+
// note holding a secret among them) is never kept anywhere.
|
|
1
10
|
import { join } from "node:path";
|
|
2
11
|
import { checkProposal, draftDryRun, draftFiles, NOTE_BLOCK, unstorable, parseReflection, redactSecrets, shortMessage, SKILL_BLOCK, SKILLS_DIR, WORKFLOW_BLOCK, WORKFLOWS_DIR } from "./learn/index.js";
|
|
3
12
|
import { folderAt, readLearning, readSnapshot } from "./learn/folder.js";
|
|
@@ -73,7 +82,8 @@ async function seedAt(lw, seed, wanted) {
|
|
|
73
82
|
* seed holds is no change, and `MEMORY.md` is the host's (the checker ignores it). A skill is laid at
|
|
74
83
|
* `skills/<name>/SKILL.md`; a draft at `workflows/<name>/workflow.json`, with the README.md the host writes from the
|
|
75
84
|
* description its block gives. `outcome`, how the run's job ended (only a completed run adds or changes a skill);
|
|
76
|
-
* `tools`, those a draft may name (tools.ts learnedWorkflowTools); `refuse`: this host's secrets
|
|
85
|
+
* `tools`, those a draft may name (tools.ts learnedWorkflowTools); `refuse`: this host's secrets; `outputSchema`: the
|
|
86
|
+
* agent's, which a draft's dry run holds its answer to (learn/skills.ts draftDryRun). */
|
|
77
87
|
export const proposeRun = async (input) => {
|
|
78
88
|
const parsed = parseReflection(input.turn.answer);
|
|
79
89
|
// Each skill and draft as the folder would hold it, keyed by its block (kind and name) so the changes keep the
|
|
@@ -100,7 +110,17 @@ export const proposeRun = async (input) => {
|
|
|
100
110
|
const { snapshot, texts } = await seedAt(input.folder, input.seed, (seedSnapshot) => (parsed.ok ? [...parsed.notes.map(({ file }) => file), ...given.flat().map(({ file }) => file), ...draftSkills, ...activeOf(seedSnapshot)] : []));
|
|
101
111
|
if (!parsed.ok)
|
|
102
112
|
return parsed.reason === "empty" ? { state: "dropped", reason: "empty" } : { state: "dropped", reason: "unparsed", detail: parsed.detail };
|
|
103
|
-
const { base: seedBase, kept } = baseOf(snapshot);
|
|
113
|
+
const { base: seedBase, kept: seedKept } = baseOf(snapshot);
|
|
114
|
+
// A workflow the compile turn revised from main's text (`revised`) is checked against the commit it read that text at,
|
|
115
|
+
// not the seed: a change made to it on main before that read is what the revision was written over, and only one after
|
|
116
|
+
// it is a conflict (its files' `bases` in the proposal, which the merge checks main against). Every other item keeps
|
|
117
|
+
// the seed.
|
|
118
|
+
const revisedDir = input.revised && input.revised.base !== input.seed ? `${WORKFLOWS_DIR}/${input.revised.workflow}/` : undefined;
|
|
119
|
+
const isRevised = (path) => revisedDir !== undefined && path.startsWith(revisedDir);
|
|
120
|
+
const revisedAt = revisedDir ? await seedAt(input.folder, input.revised.base, () => given.flat().map(({ file }) => file).filter(isRevised)) : undefined;
|
|
121
|
+
const revisedBase = revisedAt ? baseOf(revisedAt.snapshot) : undefined;
|
|
122
|
+
const textAt = (file) => (revisedAt && isRevised(file) ? revisedAt.texts.get(file) : texts.get(file));
|
|
123
|
+
const kept = revisedBase ? [...seedKept.filter((file) => !isRevised(file)), ...revisedBase.kept.filter(isRevised)] : seedKept;
|
|
104
124
|
// A later round's notes are checked against the main the earlier rounds merged into (`notesSeed`: a note round 1 added
|
|
105
125
|
// is a supersedes target and a duplicate rule), while a skill's or a draft's files keep `seed` as their conflict base:
|
|
106
126
|
// the run was laid from it, so a file changed on main since is a conflict, never written over.
|
|
@@ -113,9 +133,9 @@ export const proposeRun = async (input) => {
|
|
|
113
133
|
}));
|
|
114
134
|
const learnedPath = (path) => path.startsWith(`${SKILLS_DIR}/`) || path.startsWith(`${WORKFLOWS_DIR}/`);
|
|
115
135
|
const notedBase = baseOf(noted.snapshot).base;
|
|
116
|
-
const base = { files: [...[...notedBase.files].filter((path) => !learnedPath(path)), ...[...seedBase.files].filter(learnedPath)], active: notedBase.active, rules };
|
|
136
|
+
const base = { files: [...[...notedBase.files].filter((path) => !learnedPath(path)), ...[...seedBase.files].filter((path) => learnedPath(path) && !isRevised(path)), ...[...(revisedBase?.base.files ?? [])].filter(isRevised)], active: notedBase.active, rules };
|
|
117
137
|
const held = new Set(base.files);
|
|
118
|
-
const files = given.filter((group) => group.some(({ file, text }) =>
|
|
138
|
+
const files = given.filter((group) => group.some(({ file, text }) => textAt(file) !== text)).flat();
|
|
119
139
|
const changeOf = ({ file, text }) => ({ path: file, status: held.has(file) ? "modified" : "added", mode: "100644", bytes: Buffer.from(text) });
|
|
120
140
|
// Each changed item in the order the answer gave its block, whatever its kind: a count cap names the items past it in
|
|
121
141
|
// that order (learn/check.ts), so a skill the answer led with is never the one past the changed-path cap.
|
|
@@ -139,7 +159,7 @@ export const proposeRun = async (input) => {
|
|
|
139
159
|
return { state: "dropped", reason: "checker", problems: leaky };
|
|
140
160
|
// A skill or a draft whose seed text has a status is a person's call (retired, or waiting for their OK): never changed.
|
|
141
161
|
const dryRuns = {};
|
|
142
|
-
const check = (some) => checkProposal({ base, changes: some, refuseValues: input.refuse, ...(input.workflows === false ? { workflows: false } : {}), ...(kept.length ? { kept } : {}), ...(input.outcome === undefined ? {} : { outcome: input.outcome }), ...(input.tools ? { tools: input.tools } : {}), ...(input.gated ? { gated: input.gated } : {}), ...(input.deniedBy ? { deniedBy: input.deniedBy } : {}), ...(input.
|
|
162
|
+
const check = (some) => checkProposal({ workflowAdapters: input.workflowAdapters, base, changes: some, refuseValues: input.refuse, ...(input.workflows === false ? { workflows: false } : {}), ...(kept.length ? { kept } : {}), ...(input.outcome === undefined ? {} : { outcome: input.outcome }), ...(input.tools ? { tools: input.tools } : {}), ...(input.gated ? { gated: input.gated } : {}), ...(input.deniedBy ? { deniedBy: input.deniedBy } : {}), ...(input.decisions ? { decisions: input.decisions } : {}), ...(dsl ? { dsl, dryRuns } : {}) });
|
|
143
163
|
// The static checks first, every one (validateWorkflow with executeCode: false, draftProblems' refusal of code nodes,
|
|
144
164
|
// caps, secrets): a draft they refuse is never dry-run, nor is any when they refuse the answer whole. Then each draft
|
|
145
165
|
// left is dry-run on its example, else on a synthesized input (learn/skills.ts draftDryRun): every model and tool
|
|
@@ -151,7 +171,7 @@ export const proposeRun = async (input) => {
|
|
|
151
171
|
if (!whole)
|
|
152
172
|
for (const { file, text } of files)
|
|
153
173
|
if (file.endsWith("/workflow.json") && !refused.has(itemOf(file)))
|
|
154
|
-
dryRuns[file] = await draftDryRun(dsl, text, examples.get(file));
|
|
174
|
+
dryRuns[file] = await draftDryRun(dsl, text, examples.get(file), input.outputSchema);
|
|
155
175
|
}
|
|
156
176
|
// A verdict per item from the checks too: the items a problem names are left out (a draft's two files together),
|
|
157
177
|
// and the rest is checked again, until it passes; a problem that names no item, or one that refuses the whole (WHOLE),
|
|
@@ -196,7 +216,8 @@ export const proposeRun = async (input) => {
|
|
|
196
216
|
// reads it there): the format the draft's answer keeps (#2412). Cut of the host's secrets, as what was said is.
|
|
197
217
|
const proposing = new Set(passing.map(({ file }) => file));
|
|
198
218
|
const drafted = passing.filter(({ file }) => file.endsWith("/workflow.json")).map(({ file }) => skillOf(file)).filter((file) => !proposing.has(file) && texts.has(file)).map((file) => ({ file, text: redactSecrets(texts.get(file), input.refuse, Number.POSITIVE_INFINITY) }));
|
|
199
|
-
const
|
|
219
|
+
const bases = Object.fromEntries(passing.filter(({ file }) => isRevised(file)).map(({ file }) => [file, input.revised.base]));
|
|
220
|
+
const proposal = { seed: input.seed, ...(Object.keys(bases).length ? { bases } : {}), notes: checked.notes.map(({ file, text }) => ({ file, text })), ...(passing.length ? { files: passing } : {}), ...(Object.keys(ran).length ? { dryRuns: ran } : {}), ...(drafted.length ? { drafted } : {}), asked, ...(triggered.length ? { triggered } : {}) };
|
|
200
221
|
await writeDurable(join(input.runDir, PROPOSAL), `${JSON.stringify(proposal)}\n`);
|
|
201
222
|
const count = (suffix) => passing.filter(({ file }) => file.endsWith(suffix)).length;
|
|
202
223
|
return { state: "proposed", notes: proposal.notes.length, skills: count("/SKILL.md"), workflows: count("/workflow.json"), ...(left.length ? { left } : {}) };
|
package/dist/provider.d.ts
CHANGED
|
@@ -51,12 +51,16 @@ export declare function anthropicModelId(model: ModelRef): string;
|
|
|
51
51
|
* path), its key, read per request, how the endpoint takes it, the model id sent, and the catalog entry that prices it.
|
|
52
52
|
* `who`: the harness, for a refusal's words. Throws a HarnessUnavailable where the run cannot go: a model of another
|
|
53
53
|
* vendor, a key that is not set (its `keys` name the ones that would fix it), or an endpoint a key may not go to. */
|
|
54
|
+
/** `billing: "plan"`: a ChatGPT plan's route (chatgpt-plan.ts), billed to the plan, never priced here; its credential is
|
|
55
|
+
* the plan's token, asked at each request, and `refused` tells the plan OpenAI answered 401 to one it sent. */
|
|
54
56
|
export type Provider = {
|
|
55
57
|
origin: string;
|
|
56
|
-
credential: () => string
|
|
58
|
+
credential: () => string | Promise<string>;
|
|
57
59
|
auth: "bearer" | "x-api-key";
|
|
58
60
|
modelId: string;
|
|
59
61
|
priceModel: ModelRef;
|
|
62
|
+
billing?: "plan";
|
|
63
|
+
refused?: (credential: string) => Promise<void>;
|
|
60
64
|
};
|
|
61
65
|
export declare function providerFor(wire: Wire, env: NodeJS.ProcessEnv, model: ModelRef, who: string): Provider;
|
|
62
66
|
/** The catalog entry a run on `wire` of `model` is capped and priced by: providerFor's, or the model's own (normalized)
|
package/dist/provider.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { chooseModel, FAUX_ENV, hostModel } from "./model.js";
|
|
1
|
+
import { chooseModel, FAUX_ENV, hostModel, MODEL_PROVIDER } from "./model.js";
|
|
2
2
|
import { WIRES } from "./wires.js";
|
|
3
3
|
import { modelFormWhy } from "./model-form.js";
|
|
4
|
+
import { EXPIRED, PLAN_ORIGIN, PLAN_PROVIDER, planOf, SIGNED_OUT } from "./chatgpt-plan.js";
|
|
4
5
|
// Each wire's own settings live in a leaf module (wires.ts), which the harness table reads as it loads.
|
|
5
6
|
export { WIRES };
|
|
6
7
|
/** Why this server cannot run a harness here, in words a person can act on; `fix`, when installing is the fix; `keys`,
|
|
@@ -91,9 +92,16 @@ function openRouterKey(env, who, named) {
|
|
|
91
92
|
throw new HarnessUnavailable(`${who} runs ${named} through OpenRouter, which needs OPENROUTER_API_KEY.`, undefined, ["OPENROUTER_API_KEY"]);
|
|
92
93
|
return () => env.OPENROUTER_API_KEY ?? "";
|
|
93
94
|
}
|
|
95
|
+
/** Serve's gateway (AGENT_MODEL_BASE_URL) on either wire: its base, its key (AGENT_MODEL_API_KEY, or none) as a bearer
|
|
96
|
+
* token, the model id as model.ts chose it, priced as runModels prices it. */
|
|
97
|
+
const gatewayProvider = (env, model) => ({ origin: gatewayBase("AGENT_MODEL_BASE_URL", env.AGENT_MODEL_BASE_URL), credential: () => env.AGENT_MODEL_API_KEY || "none", auth: "bearer", modelId: model.modelId, priceModel: model });
|
|
94
98
|
export function providerFor(wire, env, model, who) {
|
|
95
99
|
const named = `${model.provider}/${model.modelId}`;
|
|
96
100
|
if (wire === "anthropic-messages") {
|
|
101
|
+
// A model of serve's gateway that the gateway takes on Messages (a Claude model, model.ts gatewayWire): the gateway's
|
|
102
|
+
// own route, as on Responses. No harness of this wire chooses one (claude-agent's model is never the gateway's).
|
|
103
|
+
if (model.provider === MODEL_PROVIDER && env.AGENT_MODEL_BASE_URL)
|
|
104
|
+
return gatewayProvider(env, model);
|
|
97
105
|
if (model.provider === "openrouter" && model.modelId.startsWith("anthropic/")) {
|
|
98
106
|
const own = anthropicModelId({ provider: "anthropic", modelId: model.modelId.slice("anthropic/".length) });
|
|
99
107
|
return { origin: OPENROUTER_BASE, credential: openRouterKey(env, who, named), auth: "bearer", modelId: own, priceModel: { provider: "openrouter", modelId: `anthropic/${openRouterName(own)}` } };
|
|
@@ -110,8 +118,15 @@ export function providerFor(wire, env, model, who) {
|
|
|
110
118
|
throw env.ANTHROPIC_BASE_URL ? new HarnessUnavailable(`${who} needs ANTHROPIC_API_KEY.`, undefined, ["ANTHROPIC_API_KEY"]) : new HarnessUnavailable(`${who} needs ANTHROPIC_API_KEY or OPENROUTER_API_KEY.`, undefined, ["ANTHROPIC_API_KEY", "OPENROUTER_API_KEY"]);
|
|
111
119
|
return { origin, credential: () => env.ANTHROPIC_API_KEY ?? "", auth: "x-api-key", modelId: own, priceModel: { provider: "anthropic", modelId: own } };
|
|
112
120
|
}
|
|
121
|
+
// A ChatGPT plan's model: OpenAI's Responses API on the plan's token, whatever else is set.
|
|
122
|
+
if (model.provider === PLAN_PROVIDER) {
|
|
123
|
+
const plan = planOf(env);
|
|
124
|
+
if (plan?.state !== "signed_in")
|
|
125
|
+
throw new HarnessUnavailable(plan?.state === "expired" ? EXPIRED : SIGNED_OUT);
|
|
126
|
+
return { origin: PLAN_ORIGIN, credential: () => plan.token(), auth: "bearer", modelId: model.modelId, priceModel: model, billing: "plan", refused: (sent) => plan.refused(sent) };
|
|
127
|
+
}
|
|
113
128
|
if (env.AGENT_MODEL_BASE_URL)
|
|
114
|
-
return
|
|
129
|
+
return gatewayProvider(env, model);
|
|
115
130
|
if (model.provider === "openrouter" && model.modelId.startsWith("openai/"))
|
|
116
131
|
return { origin: OPENROUTER_BASE, credential: openRouterKey(env, who, named), auth: "bearer", modelId: model.modelId, priceModel: model };
|
|
117
132
|
if (model.provider !== "openai")
|
package/dist/push-handler.d.ts
CHANGED
|
@@ -48,5 +48,6 @@ export type PushAnswer = {
|
|
|
48
48
|
body: unknown;
|
|
49
49
|
headers?: Record<string, string>;
|
|
50
50
|
};
|
|
51
|
-
/** The request to /v2/hooks/{segment}
|
|
52
|
-
|
|
51
|
+
/** The request to /v2/hooks/{segment}, or /v2/hooks/{segment}/{sub} for a source that keeps its key per scope
|
|
52
|
+
* (Push.scoped): its answer, or the one 401 (thrown). */
|
|
53
|
+
export declare function receivePush(deps: PushDeps, req: IncomingMessage, segment: string, sub?: string): Promise<PushAnswer>;
|
package/dist/push-handler.js
CHANGED
|
@@ -49,21 +49,31 @@ export function readCapped(req, max, ms = HOOK_BODY_MS) {
|
|
|
49
49
|
}
|
|
50
50
|
/** The one answer to every refused request. */
|
|
51
51
|
const REFUSED = "this route needs a request signed by the webhook trigger's secret";
|
|
52
|
-
/**
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
/** A scope a source's own path names (/v2/hooks/{source}/{scope}): an id this server made. */
|
|
53
|
+
const SCOPE = /^[A-Za-z0-9_-]{1,64}$/;
|
|
54
|
+
/** The request to /v2/hooks/{segment}, or /v2/hooks/{segment}/{sub} for a source that keeps its key per scope
|
|
55
|
+
* (Push.scoped): its answer, or the one 401 (thrown). */
|
|
56
|
+
export async function receivePush(deps, req, segment, sub) {
|
|
57
|
+
const route = `/v2/hooks/${segment}${sub === undefined ? "" : `/${sub}`}`;
|
|
55
58
|
const refuse = (reason) => (deps.refused(route, reason), new ApiError("unauthenticated", REFUSED));
|
|
56
59
|
let name;
|
|
60
|
+
let scoped;
|
|
57
61
|
try {
|
|
58
62
|
name = decodeURIComponent(segment);
|
|
63
|
+
scoped = sub === undefined ? undefined : decodeURIComponent(sub);
|
|
59
64
|
}
|
|
60
65
|
catch {
|
|
61
66
|
throw refuse("malformed_path");
|
|
62
67
|
}
|
|
68
|
+
if (scoped !== undefined && !SCOPE.test(scoped))
|
|
69
|
+
throw refuse("malformed_path");
|
|
63
70
|
// A source's own path (its settings are the server's), else a trigger's, checked by that trigger's own source (its
|
|
64
71
|
// settings are a trigger's). A path that names no such trigger is checked as the first such source's, against the
|
|
65
72
|
// decoy: the same work and the same 401, so no id is learned by asking.
|
|
66
73
|
const own = deps.adapters.find((a) => a.id === name && a.push && a.settings?.scope === "server");
|
|
74
|
+
// Only a source that keeps its key per scope has paths under its own: any other path with a second segment names no hook.
|
|
75
|
+
if (scoped !== undefined && !own?.push?.scoped)
|
|
76
|
+
throw refuse("no_hook");
|
|
67
77
|
const named = own || !ID.test(name) ? undefined : await deps.hooked(name);
|
|
68
78
|
const trigger = named && deps.adapters.find((a) => a.id === named.kind && a.push && a.settings?.scope === "trigger");
|
|
69
79
|
const adapter = own ?? trigger ?? deps.adapters.find((a) => a.push && a.settings?.scope === "trigger");
|
|
@@ -77,12 +87,14 @@ export async function receivePush(deps, req, segment) {
|
|
|
77
87
|
const body = await readCapped(req, push.maxBodyBytes, deps.bodyMs);
|
|
78
88
|
const source = trigger ? named : undefined;
|
|
79
89
|
const pathTrigger = source ? name : undefined;
|
|
80
|
-
|
|
90
|
+
// A source that keeps its key per scope is checked with its path's scope's (none on its bare path: the decoy's 401).
|
|
91
|
+
const ownScope = own ? (push.scoped ? scoped : "server") : undefined;
|
|
92
|
+
const key = own ? ownScope && deps.setting(adapter.id, ownScope, push.key) : pathTrigger && deps.setting(adapter.id, pathTrigger, push.key);
|
|
81
93
|
// Checked against the clock now the body has arrived: a timestamp at the tolerance's edge never passes by a slow body.
|
|
82
94
|
const refusal = push.verify(key ?? DECOY, req.headers, body, Date.now(), key ? source : undefined);
|
|
83
95
|
if (!key || refusal)
|
|
84
96
|
throw refuse(key ? refusal : own ? "no_key" : "no_webhook_trigger");
|
|
85
|
-
const scope = own ?
|
|
97
|
+
const scope = own ? ownScope : pathTrigger;
|
|
86
98
|
const ctx = {
|
|
87
99
|
setting: (field) => deps.setting(adapter.id, scope, field),
|
|
88
100
|
notice: async (event, doc) => deps.notice?.(adapter.id, event, doc),
|
|
@@ -91,7 +103,9 @@ export async function receivePush(deps, req, segment) {
|
|
|
91
103
|
const handshake = await push.handshake?.(req.headers, body, ctx);
|
|
92
104
|
if (handshake)
|
|
93
105
|
return handshake;
|
|
94
|
-
const
|
|
106
|
+
const parsed = push.parse(req.headers, body, source);
|
|
107
|
+
// A scoped source's events happened in its path's scope: its takes matches each trigger's to it.
|
|
108
|
+
const events = Array.isArray(parsed) && own && push.scoped ? parsed.map((event) => ({ ...event, scope })) : parsed;
|
|
95
109
|
// Verified, and not an event its trigger takes: answered, so the sender does not send it again, and said once.
|
|
96
110
|
if (!Array.isArray(events)) {
|
|
97
111
|
deps.say({ condition: "hook_ignored", source: adapter.id, route, ...(pathTrigger ? { trigger: pathTrigger } : {}), reason: events.ignored, ...(events.event ? { event: events.event } : {}) });
|
package/dist/reflect-range.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LEARNING_LABEL } from "./learning.js";
|
|
2
2
|
import { said } from "./learning-words.js";
|
|
3
3
|
import { askedForDryRun } from "./learn/reflect.js";
|
|
4
|
+
import { askedForCompile } from "./learn/compile.js";
|
|
4
5
|
/** The run asked its end-of-run turn and has not ended since. */
|
|
5
6
|
export const reflecting = (run) => run.meta.reflect !== undefined && run.meta.reflect.until === undefined;
|
|
6
7
|
/** A row's store entry, from its id (`<conversation>:<entry>[:...]`); NaN for a row no entry made (a live one, usage). */
|
|
@@ -25,6 +26,6 @@ export function labelled(reflect, rows) {
|
|
|
25
26
|
...row, agent_label: LEARNING_LABEL,
|
|
26
27
|
...(row.kind === "final_answer" ? { kind: "text_block" } : {}),
|
|
27
28
|
// The turn asked again for a draft whose dry run failed says so; every other message of the turn is its ask.
|
|
28
|
-
...(row.kind === "user_message" ? (
|
|
29
|
+
...(row.kind === "user_message" ? ((words) => ({ summary: words, text: words }))(askedForDryRun(row.text) ? said.askedDryRun : askedForCompile(row.text) === "again" ? said.askedCompileAgain : askedForCompile(row.text) ? said.askedCompile : said.asked) : {}),
|
|
29
30
|
}));
|
|
30
31
|
}
|
package/dist/refusal-words.d.ts
CHANGED
|
@@ -7,6 +7,17 @@ export declare const RAN_UNKNOWN = "It had started before the deny, and whether
|
|
|
7
7
|
export declare const STOPPED_WHILE_WAITING = "Not run: the run was stopped while it waited";
|
|
8
8
|
/** A call that waited when its run ended (completed or failed) without anyone stopping it: never sent. */
|
|
9
9
|
export declare const ENDED_WHILE_WAITING = "Not run: the run ended while it waited";
|
|
10
|
+
/** How a refusal of a setting's deny, or of an ask no one can approve, opens (deniedText, noApproverText). */
|
|
11
|
+
export declare const DENIED_OPENING = "Permission denied: ";
|
|
12
|
+
/** How a person's deny opens (refusedText). */
|
|
13
|
+
export declare const USER_DENIED_OPENING = "The user denied this ";
|
|
14
|
+
/** What a read-only bash policy's refusal says after the tool's name (bash-read-only.ts readOnlyText). */
|
|
15
|
+
export declare const READ_ONLY_REFUSED = " is read-only for this agent, so this call was refused: ";
|
|
16
|
+
/** What a refusal of a tool no call of which can pass says after its name (a bash policy or a pin that does not read). */
|
|
17
|
+
export declare const CANT_BE_CALLED = " can't be called: ";
|
|
18
|
+
/** The words a refused call's answer opens with (or, past the tool's name, says first): what a script that reads its
|
|
19
|
+
* calls' answers as text (Codex's code mode) checks for, as the desktop and phone kind skills name them. */
|
|
20
|
+
export declare const REFUSAL_OPENINGS: readonly string[];
|
|
10
21
|
/** Where a permission was set (permissionFrom's `from`): the agent's own tool settings, the server's, or the default; or
|
|
11
22
|
* "unattended": an ask the agent's approvals "never" allowed. */
|
|
12
23
|
export type SettingFrom = "agent" | "server" | "default" | "unattended";
|
package/dist/refusal-words.js
CHANGED
|
@@ -9,6 +9,17 @@ export const RAN_UNKNOWN = "It had started before the deny, and whether it took
|
|
|
9
9
|
export const STOPPED_WHILE_WAITING = "Not run: the run was stopped while it waited";
|
|
10
10
|
/** A call that waited when its run ended (completed or failed) without anyone stopping it: never sent. */
|
|
11
11
|
export const ENDED_WHILE_WAITING = "Not run: the run ended while it waited";
|
|
12
|
+
/** How a refusal of a setting's deny, or of an ask no one can approve, opens (deniedText, noApproverText). */
|
|
13
|
+
export const DENIED_OPENING = "Permission denied: ";
|
|
14
|
+
/** How a person's deny opens (refusedText). */
|
|
15
|
+
export const USER_DENIED_OPENING = "The user denied this ";
|
|
16
|
+
/** What a read-only bash policy's refusal says after the tool's name (bash-read-only.ts readOnlyText). */
|
|
17
|
+
export const READ_ONLY_REFUSED = " is read-only for this agent, so this call was refused: ";
|
|
18
|
+
/** What a refusal of a tool no call of which can pass says after its name (a bash policy or a pin that does not read). */
|
|
19
|
+
export const CANT_BE_CALLED = " can't be called: ";
|
|
20
|
+
/** The words a refused call's answer opens with (or, past the tool's name, says first): what a script that reads its
|
|
21
|
+
* calls' answers as text (Codex's code mode) checks for, as the desktop and phone kind skills name them. */
|
|
22
|
+
export const REFUSAL_OPENINGS = [DENIED_OPENING, USER_DENIED_OPENING, READ_ONLY_REFUSED, CANT_BE_CALLED];
|
|
12
23
|
/** Where a deny was set, in words: the place a person changes it. */
|
|
13
24
|
export const denyPlace = (from = "server") => (from === "agent" ? "for this agent" : from === "default" ? "by default" : "on this server");
|
|
14
25
|
/** The refusal of a call whose tool is set to deny; of one held to another tool's setting (`heldTo`, a shell tool's
|
|
@@ -17,7 +28,7 @@ export const deniedText = (tool, heldTo, from = "server", ran = "no") => {
|
|
|
17
28
|
// `ran`: "unknown" for a call an earlier attempt of which may have been sent (an approved call cut mid-flight, or a
|
|
18
29
|
// replay-safe call run again after a crash): the words never claim it wasn't.
|
|
19
30
|
const what = ran === "no" ? NOT_RUN : RAN_UNKNOWN;
|
|
20
|
-
return heldTo && heldTo !== tool ?
|
|
31
|
+
return heldTo && heldTo !== tool ? `${DENIED_OPENING}${tool} follows ${heldTo}'s setting, which is deny ${denyPlace(from)}. ${what} Don't retry it.` : `${DENIED_OPENING}${tool} is set to deny ${denyPlace(from)}. ${what} Don't retry it.`;
|
|
21
32
|
};
|
|
22
33
|
/** A workflow model node's tool set to ask: a model node cannot wait for a person's approval (the gate parks no workflow
|
|
23
34
|
* call), so the call is refused unrun and the model reads why (tool-gate.ts RunGate, on main and on the runner). */
|
|
@@ -26,4 +37,4 @@ export const modelNodeAskText = (tool, ran = "no") => `This ${tool} call needs a
|
|
|
26
37
|
* (main's per-run process and the runner's workflow spec, the same words). */
|
|
27
38
|
export const callNodeAskText = (tool) => `This ${tool} call needs a person's approval, which a workflow's call node cannot wait for; it was not run.`;
|
|
28
39
|
/** A call a person denied, with their reason when they gave one. */
|
|
29
|
-
export const refusedText = (tool, note, ran = "no") =>
|
|
40
|
+
export const refusedText = (tool, note, ran = "no") => `${USER_DENIED_OPENING}${tool} call. ${ran === "no" ? NOT_RUN : RAN_UNKNOWN}${note ? ` Reason: ${note}` : ""}`;
|
package/dist/rows.d.ts
CHANGED
|
@@ -30,9 +30,11 @@ export declare class RowLog {
|
|
|
30
30
|
private readonly waiters;
|
|
31
31
|
constructor(clock: ChangeClock);
|
|
32
32
|
private next;
|
|
33
|
-
/** Make the served rows equal `rows
|
|
34
|
-
* and ids no longer there are dropped, except those `keep` says stay (a row a committed entry made: the
|
|
35
|
-
* grows).
|
|
33
|
+
/** Make the served rows equal `rows`, in their order: new ids are added after every row served so far, changed ones
|
|
34
|
+
* keep their seq, and ids no longer there are dropped, except those `keep` says stay (a row a committed entry made: the
|
|
35
|
+
* timeline only grows). A row that now comes after a row served later than it moves after it (a new seq, as a change),
|
|
36
|
+
* so this log reads as a fresh one synced from the same rows: the learning row, which the view adds after every row of
|
|
37
|
+
* the run, moves after a feedback round's rows or a follow-up's. Returns whether anything changed. */
|
|
36
38
|
sync(rows: readonly TimelineEvent[], keep?: (id: string) => boolean): boolean;
|
|
37
39
|
/** The run's status and state, as one more change when they move. */
|
|
38
40
|
setState(value: string): boolean;
|
package/dist/rows.js
CHANGED
|
@@ -31,18 +31,27 @@ export class RowLog {
|
|
|
31
31
|
next() {
|
|
32
32
|
return this.clock.next();
|
|
33
33
|
}
|
|
34
|
-
/** Make the served rows equal `rows
|
|
35
|
-
* and ids no longer there are dropped, except those `keep` says stay (a row a committed entry made: the
|
|
36
|
-
* grows).
|
|
34
|
+
/** Make the served rows equal `rows`, in their order: new ids are added after every row served so far, changed ones
|
|
35
|
+
* keep their seq, and ids no longer there are dropped, except those `keep` says stay (a row a committed entry made: the
|
|
36
|
+
* timeline only grows). A row that now comes after a row served later than it moves after it (a new seq, as a change),
|
|
37
|
+
* so this log reads as a fresh one synced from the same rows: the learning row, which the view adds after every row of
|
|
38
|
+
* the run, moves after a feedback round's rows or a follow-up's. Returns whether anything changed. */
|
|
37
39
|
sync(rows, keep) {
|
|
38
40
|
let changed = false;
|
|
39
41
|
const present = new Set();
|
|
42
|
+
// The latest seq of the rows so far, the usage row's left out (it goes last below).
|
|
43
|
+
let latest = -1;
|
|
40
44
|
for (const row of rows) {
|
|
41
45
|
present.add(row.id);
|
|
42
46
|
const text = SEQ_FREE(row);
|
|
43
47
|
const slot = this.slots.get(row.id);
|
|
44
48
|
if (slot && !slot.dropped) {
|
|
45
|
-
|
|
49
|
+
const behind = row.kind !== "usage" && slot.seq < latest;
|
|
50
|
+
if (behind)
|
|
51
|
+
slot.seq = this.seq++;
|
|
52
|
+
if (row.kind !== "usage")
|
|
53
|
+
latest = Math.max(latest, slot.seq);
|
|
54
|
+
if (slot.text === text && !behind)
|
|
46
55
|
continue;
|
|
47
56
|
slot.text = text;
|
|
48
57
|
slot.row = { ...row, id: slot.id, seq: slot.seq };
|
|
@@ -56,6 +65,8 @@ export class RowLog {
|
|
|
56
65
|
if (slot)
|
|
57
66
|
this.slots.set(`${row.id}\0${slot.change}`, slot);
|
|
58
67
|
const seq = this.seq++;
|
|
68
|
+
if (row.kind !== "usage")
|
|
69
|
+
latest = seq;
|
|
59
70
|
this.slots.set(row.id, { id, source: row.id, seq, row: { ...row, id, seq }, change: this.next(), dropped: false, text });
|
|
60
71
|
changed = true;
|
|
61
72
|
}
|
package/dist/run-launch.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { SdkWorkflowTool, SdkWorkflowAdapter } from "./sdk/workflows.js";
|
|
2
|
+
import type { NativeBinding } from "./native/types.js";
|
|
1
3
|
import { type MessageOrigin } from "./timeline/index.js";
|
|
2
4
|
import type { Plane } from "./tool-plane.js";
|
|
3
5
|
import type { RunTrigger } from "./triggers.js";
|
|
@@ -10,6 +12,14 @@ import type { Place } from "./workspace/place.js";
|
|
|
10
12
|
* names (a learning run's `{ runId }`). `model`, `plane`, `approvers`, `documents` and `boxAllow` are the per-run choices
|
|
11
13
|
* the old path recomputed; here they are pinned at start, and optional (a built-in run may name none). */
|
|
12
14
|
export interface RunLaunch {
|
|
15
|
+
readonly sdk?: {
|
|
16
|
+
runtime: "claude-agent-sdk" | "codex-sdk";
|
|
17
|
+
instructions: string;
|
|
18
|
+
model?: string;
|
|
19
|
+
workflow_tools?: SdkWorkflowTool[];
|
|
20
|
+
workflow_adapters?: SdkWorkflowAdapter[];
|
|
21
|
+
};
|
|
22
|
+
readonly native?: NativeBinding;
|
|
13
23
|
/** The start request's body, as the person or trigger gave it, or an object a built-in run names. */
|
|
14
24
|
readonly input: unknown;
|
|
15
25
|
readonly title: string;
|
|
@@ -26,7 +36,6 @@ export interface RunLaunch {
|
|
|
26
36
|
};
|
|
27
37
|
readonly effort?: string;
|
|
28
38
|
readonly maxCostUsd?: number;
|
|
29
|
-
readonly capMode?: string;
|
|
30
39
|
/** The tool plane as the server resolved it at start (tool-plane.ts). */
|
|
31
40
|
readonly plane?: Plane;
|
|
32
41
|
/** Whether a person can answer a tool call's approval for this run. */
|
|
@@ -72,6 +81,13 @@ export interface RunLaunch {
|
|
|
72
81
|
readonly seedFailed?: SeedFailed;
|
|
73
82
|
readonly use?: true;
|
|
74
83
|
};
|
|
84
|
+
/** `false`: the run never starts on a learned workflow, even one that fits its input (RunCreate `workflow_first`,
|
|
85
|
+
* runner/workflow-first.ts); its agent takes it from its first turn. Absent: a fitting one serves first. */
|
|
86
|
+
readonly workflowFirst?: false;
|
|
87
|
+
/** A replay run (runner/promotion.ts): learned workflow `workflow` at `digest`, run alone on graded run `of`'s input to
|
|
88
|
+
* decide whether that revision serves first (learn/promote.ts). Its guards read record-only (learn/promote.ts recordOnly), a hand-back ends it
|
|
89
|
+
* with no agent turn, and it asks nothing at its end. Absent: a run of its own. */
|
|
90
|
+
readonly replay?: Replay;
|
|
75
91
|
/** The trigger and firing that started the run, or none for a person's run. */
|
|
76
92
|
readonly trigger?: RunTrigger;
|
|
77
93
|
/** Who the first message is from, when not the person: kept only through the fail-safe below. */
|
|
@@ -89,6 +105,12 @@ export interface RunLaunch {
|
|
|
89
105
|
readonly minutes: number;
|
|
90
106
|
};
|
|
91
107
|
}
|
|
108
|
+
/** What a replay run replays: the graded run, and the learned workflow at the digest it decides. */
|
|
109
|
+
export interface Replay {
|
|
110
|
+
readonly of: string;
|
|
111
|
+
readonly workflow: string;
|
|
112
|
+
readonly digest: string;
|
|
113
|
+
}
|
|
92
114
|
/** The disk a launch record names, and whose it is. */
|
|
93
115
|
export interface LaunchDisk {
|
|
94
116
|
readonly diskId: string;
|
package/dist/run-launch.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { nativeOf } from "./native/binding.js";
|
|
1
2
|
// A run's launch record: the one JSON body the server writes when it starts a run (start = INSERT run, design 2.1), and
|
|
2
3
|
// the runner reads at its claim to build the run's spec. It replaces the per-run `serve.json` the old per-run process read
|
|
3
4
|
// (app.ts meta.input, place, effort, cap): no process, no door, no marker file, one body written once. What a person sees
|
|
@@ -10,9 +11,15 @@ import { originOf } from "./timeline/index.js";
|
|
|
10
11
|
import { isObject } from "./validate.js";
|
|
11
12
|
/** The disk a launch body names, as read back, or undefined. */
|
|
12
13
|
const readDisk = (value) => isObject(value) && typeof value.disk_id === "string" && (value.kind === "launch" || value.kind === "agent") ? { diskId: value.disk_id, kind: value.kind } : undefined;
|
|
13
|
-
/** The
|
|
14
|
+
/** The replay a launch body names, as read back, or undefined. */
|
|
15
|
+
const readReplay = (value) => isObject(value) && typeof value.of === "string" && typeof value.workflow === "string" && typeof value.digest === "string" ? { of: value.of, workflow: value.workflow, digest: value.digest } : undefined;
|
|
16
|
+
/** The trigger a launch body names, as read back: `{ id, firing_key }` and its firing's `attrs` (each a string) when it
|
|
17
|
+
* kept them, or null (triggerOf of the old serve.json). */
|
|
14
18
|
function readTrigger(value) {
|
|
15
|
-
|
|
19
|
+
if (!(isObject(value) && typeof value.id === "string" && typeof value.firing_key === "string"))
|
|
20
|
+
return null;
|
|
21
|
+
const attrs = isObject(value.attrs) ? Object.fromEntries(Object.entries(value.attrs).filter((entry) => typeof entry[1] === "string")) : {};
|
|
22
|
+
return { id: value.id, firing_key: value.firing_key, ...(Object.keys(attrs).length ? { attrs } : {}) };
|
|
16
23
|
}
|
|
17
24
|
/** Where a run runs, as read back from a launch body, or undefined when it names none. */
|
|
18
25
|
function readPlace(value) {
|
|
@@ -45,6 +52,8 @@ export function keepInputOrigin(stored, trigger) {
|
|
|
45
52
|
export function launchBody(launch) {
|
|
46
53
|
return {
|
|
47
54
|
input: launch.input,
|
|
55
|
+
...(launch.sdk ? { sdk: launch.sdk } : {}),
|
|
56
|
+
...(launch.native ? { native: launch.native } : {}),
|
|
48
57
|
title: launch.title,
|
|
49
58
|
...(launch.repo !== undefined ? { repo: launch.repo } : {}),
|
|
50
59
|
place: launch.place,
|
|
@@ -52,7 +61,6 @@ export function launchBody(launch) {
|
|
|
52
61
|
...(launch.model ? { model: launch.model } : {}),
|
|
53
62
|
...(launch.effort !== undefined ? { effort: launch.effort } : {}),
|
|
54
63
|
...(launch.maxCostUsd !== undefined ? { max_cost_usd: launch.maxCostUsd } : {}),
|
|
55
|
-
...(launch.capMode !== undefined ? { cap_mode: launch.capMode } : {}),
|
|
56
64
|
...(launch.plane ? { plane: launch.plane } : {}),
|
|
57
65
|
...(launch.approvers !== undefined ? { approvers: launch.approvers } : {}),
|
|
58
66
|
...(launch.documents !== undefined ? { documents: launch.documents } : {}),
|
|
@@ -60,6 +68,8 @@ export function launchBody(launch) {
|
|
|
60
68
|
...(launch.boxAllowSet ? { box_allow_set: true } : {}),
|
|
61
69
|
...(launch.files?.length ? { files: launch.files } : {}),
|
|
62
70
|
...(launch.learning ? { learning: { given: launch.learning.given.map((note) => ({ file: note.file, name: note.name })), seed: launch.learning.seed, section: launch.learning.section, ...(launch.learning.seedNotes !== undefined ? { seedNotes: launch.learning.seedNotes } : {}), ...(launch.learning.notesLeftOut?.length ? { notesLeftOut: [...launch.learning.notesLeftOut] } : {}), ...(launch.learning.skills?.length ? { skills: [...launch.learning.skills] } : {}), ...(launch.learning.notesOnly ? { notesOnly: true } : {}), ...(launch.learning.workflows?.length ? { workflows: [...launch.learning.workflows] } : {}), ...(launch.learning.gradeModel ? { gradeModel: launch.learning.gradeModel } : {}), ...(launch.learning.seedFailed ? { seedFailed: launch.learning.seedFailed } : {}), ...(launch.learning.use ? { use: true } : {}) } } : {}),
|
|
71
|
+
...(launch.workflowFirst === false ? { workflow_first: false } : {}),
|
|
72
|
+
...(launch.replay ? { replay: { of: launch.replay.of, workflow: launch.replay.workflow, digest: launch.replay.digest } } : {}),
|
|
63
73
|
...(launch.trigger ? { trigger: launch.trigger } : {}),
|
|
64
74
|
...(launch.inputOrigin ? { input_origin: launch.inputOrigin } : {}),
|
|
65
75
|
...(launch.followUp ? { follow_up: true } : {}),
|
|
@@ -96,6 +106,8 @@ export function readLaunchBody(stored) {
|
|
|
96
106
|
const archilDisk = readDisk(stored.archil_disk);
|
|
97
107
|
return {
|
|
98
108
|
input: stored.input,
|
|
109
|
+
...(isObject(stored.sdk) && (stored.sdk.runtime === "claude-agent-sdk" || stored.sdk.runtime === "codex-sdk") && typeof stored.sdk.instructions === "string" ? { sdk: stored.sdk } : {}),
|
|
110
|
+
...(nativeOf(stored) ? { native: nativeOf(stored) } : {}),
|
|
99
111
|
title: typeof stored.title === "string" ? stored.title : "",
|
|
100
112
|
...(typeof stored.repo === "string" ? { repo: stored.repo } : {}),
|
|
101
113
|
place,
|
|
@@ -103,7 +115,6 @@ export function readLaunchBody(stored) {
|
|
|
103
115
|
...(model ? { model } : {}),
|
|
104
116
|
...(typeof stored.effort === "string" ? { effort: stored.effort } : {}),
|
|
105
117
|
...(typeof stored.max_cost_usd === "number" ? { maxCostUsd: stored.max_cost_usd } : {}),
|
|
106
|
-
...(typeof stored.cap_mode === "string" ? { capMode: stored.cap_mode } : {}),
|
|
107
118
|
...(isObject(stored.plane) ? { plane: stored.plane } : {}),
|
|
108
119
|
...(typeof stored.approvers === "boolean" ? { approvers: stored.approvers } : {}),
|
|
109
120
|
...(typeof stored.documents === "string" ? { documents: stored.documents } : {}),
|
|
@@ -111,6 +122,8 @@ export function readLaunchBody(stored) {
|
|
|
111
122
|
...(stored.box_allow_set === true ? { boxAllowSet: true } : {}),
|
|
112
123
|
...(Array.isArray(stored.files) && stored.files.every((id) => typeof id === "string") ? { files: stored.files } : {}),
|
|
113
124
|
...(stored.learning !== undefined ? { learning: readLearning(stored.learning) ?? { given: [], seed: null, section: "" } } : {}),
|
|
125
|
+
...(stored.workflow_first === false ? { workflowFirst: false } : {}),
|
|
126
|
+
...(readReplay(stored.replay) ? { replay: readReplay(stored.replay) } : {}),
|
|
114
127
|
...(trigger ? { trigger } : {}),
|
|
115
128
|
...(inputOrigin ? { inputOrigin } : {}),
|
|
116
129
|
...(stored.follow_up === true ? { followUp: true } : {}),
|
|
@@ -30,6 +30,90 @@ export declare function servedRunLearning(deps: {
|
|
|
30
30
|
path?: string | undefined;
|
|
31
31
|
rule: import("./learn/check.js").Rule;
|
|
32
32
|
}[];
|
|
33
|
+
compiled: {
|
|
34
|
+
workflow: string;
|
|
35
|
+
from_notes: string[];
|
|
36
|
+
attempts: {
|
|
37
|
+
ok: boolean;
|
|
38
|
+
errors: string[];
|
|
39
|
+
}[];
|
|
40
|
+
digest: string | null;
|
|
41
|
+
promoted: boolean | null;
|
|
42
|
+
} | null;
|
|
43
|
+
draft_errors: string[];
|
|
44
|
+
cost_usd: {
|
|
45
|
+
grade: number | null;
|
|
46
|
+
};
|
|
47
|
+
tokens: {
|
|
48
|
+
grade: import("./learning.js").Tokens | null;
|
|
49
|
+
};
|
|
50
|
+
used: {
|
|
51
|
+
skills: {
|
|
52
|
+
name: string;
|
|
53
|
+
read: boolean;
|
|
54
|
+
}[];
|
|
55
|
+
workflows: {
|
|
56
|
+
name: string;
|
|
57
|
+
calls: number;
|
|
58
|
+
failed: number;
|
|
59
|
+
}[];
|
|
60
|
+
};
|
|
61
|
+
given?: import("./learning.js").NoteUsed[];
|
|
62
|
+
read?: import("./learning.js").NoteUsed[];
|
|
63
|
+
learned?: import("./learning.js").NoteLearned[];
|
|
64
|
+
skills?: import("./learning.js").LearnedFile[];
|
|
65
|
+
workflows?: import("./learning.js").LearnedFile[];
|
|
66
|
+
run: string;
|
|
67
|
+
state: "dropped" | "proposed" | "merged" | "seeded" | "reflecting";
|
|
68
|
+
reason: "cancelled" | "use" | "empty" | "unparsed" | "seed_failed" | "no_budget" | "unknown_cost" | "crashed" | "reflect_timeout" | "reflect_failed" | "propose_failed" | "checker" | "grader" | "grade_failed" | null;
|
|
69
|
+
detail: string | null;
|
|
70
|
+
at: string;
|
|
71
|
+
} | {
|
|
72
|
+
graded: {
|
|
73
|
+
workflow: string | null;
|
|
74
|
+
feedback_status: "running" | "ended" | "not_run" | null;
|
|
75
|
+
source: "feedback" | "eval";
|
|
76
|
+
graded_at: string;
|
|
77
|
+
path: "agent" | "workflow" | "handed_back" | "replay";
|
|
78
|
+
workflow_digest: string | null;
|
|
79
|
+
feedback: "revise" | "look_back" | null;
|
|
80
|
+
run_id: string;
|
|
81
|
+
correct: boolean;
|
|
82
|
+
};
|
|
83
|
+
seed: string | null;
|
|
84
|
+
merged: string | null;
|
|
85
|
+
pending: {
|
|
86
|
+
file: string;
|
|
87
|
+
name: string;
|
|
88
|
+
}[];
|
|
89
|
+
verdict: {
|
|
90
|
+
merge: boolean;
|
|
91
|
+
reason: string;
|
|
92
|
+
items: {
|
|
93
|
+
why: string;
|
|
94
|
+
question?: string | undefined;
|
|
95
|
+
origin?: "run" | "you" | undefined;
|
|
96
|
+
pending?: boolean | undefined;
|
|
97
|
+
file: string;
|
|
98
|
+
keep: boolean;
|
|
99
|
+
}[];
|
|
100
|
+
} | null;
|
|
101
|
+
problems: {
|
|
102
|
+
detail: string;
|
|
103
|
+
path?: string | undefined;
|
|
104
|
+
rule: import("./learn/check.js").Rule;
|
|
105
|
+
}[];
|
|
106
|
+
compiled: {
|
|
107
|
+
workflow: string;
|
|
108
|
+
from_notes: string[];
|
|
109
|
+
attempts: {
|
|
110
|
+
ok: boolean;
|
|
111
|
+
errors: string[];
|
|
112
|
+
}[];
|
|
113
|
+
digest: string | null;
|
|
114
|
+
promoted: boolean | null;
|
|
115
|
+
} | null;
|
|
116
|
+
draft_errors: string[];
|
|
33
117
|
cost_usd: {
|
|
34
118
|
grade: number | null;
|
|
35
119
|
};
|
package/dist/run-manifest.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { type Workspace } from "./workspace/index.js";
|
|
2
|
+
/** The run's opening message as its inputs/message.md holds it: the start's `content` when it is a string, as sent; ""
|
|
3
|
+
* (no file) for any other input. */
|
|
4
|
+
export declare function messageText(input: unknown): string;
|
|
2
5
|
/** The most files the line names; the rest are counted. */
|
|
3
6
|
export declare const MANIFEST_ENTRIES = 20;
|
|
4
7
|
/** The most the first message may take, as the JSON string the run's door is sent: a door takes a body of
|
|
@@ -22,6 +25,11 @@ export declare function filesLine(label: string, files: readonly ManifestFile[],
|
|
|
22
25
|
* entered; a dot-name left out. None when there is no inputs/ or a folder of it cannot be read. The run's start still
|
|
23
26
|
* hands its folder's path. */
|
|
24
27
|
export declare function inputFiles(given: Workspace | string): Promise<ManifestFile[]>;
|
|
28
|
+
/** The text a run's input is sent to its model as, on every harness: its `content`, then, after a blank line, its other
|
|
29
|
+
* fields (an agent's typed input, definition.input_schema) as one fenced json block under the line `Input:`, so the
|
|
30
|
+
* model reads each field by its name and its value as given, never as prose a value could break out of. The fence is
|
|
31
|
+
* longer than any run of backticks in the JSON, so no value ends the block. No other field: the content alone. */
|
|
32
|
+
export declare function inputMessage(input: unknown): string;
|
|
25
33
|
/** The run's first message: `content`, then, after a blank line, the files given to it, when it has any: as many named
|
|
26
34
|
* as keep the message within `budget` (FIRST_MESSAGE_BYTES), else only how many, else no line at all, so the line never
|
|
27
35
|
* turns a message the run took into one its door refuses. */
|