@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
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { DecisionProvider, GuardStepParams, GuardVerdict, StepGuard, WorkflowDeps } from "@parcha/agentrun-dsl";
|
|
2
|
+
import type { GuardRow } from "../learned-nodes.js";
|
|
3
|
+
/** The Jev model a guard asks, pinned (https://docs.typesafe.ai/models, read 2026-11-13: jev-1.14.0 is current, and
|
|
4
|
+
* jev-latest points to it), by route: TypeSafe's own name, or OpenRouter's. A new Jev is a new pin and a new fit. */
|
|
5
|
+
export declare const JEV_GUARD_MODEL: {
|
|
6
|
+
readonly typesafe: "jev-1.14.0";
|
|
7
|
+
readonly openrouter: "typesafe/jev-1.14";
|
|
8
|
+
};
|
|
9
|
+
/** The question a jev guard asks when its guard names none. */
|
|
10
|
+
export declare const DEFAULT_GUARD_QUESTION = "Is this output correct for this input, as the step's task asks?";
|
|
11
|
+
/** The most of a step's task, its input and its output a guard's request holds, each in UTF-16 units of its JSON: a
|
|
12
|
+
* longer one goes as its first part, cut as the generality pre-check cuts its state (learn/general.ts cutForJev,
|
|
13
|
+
* GENERAL_STATE_CAPS), well within one Jev request's 32k tokens a question. */
|
|
14
|
+
export declare const GUARD_STATE_CAPS: Readonly<{
|
|
15
|
+
task: 8000;
|
|
16
|
+
input: 8000;
|
|
17
|
+
output: 8000;
|
|
18
|
+
}>;
|
|
19
|
+
/** One guard check, as the run keeps it (learned-nodes.ts GuardRow). */
|
|
20
|
+
export type { GuardRow };
|
|
21
|
+
/** One Jev request as a guard sends it: the step it guards (its label, its execution path, its item in a map), the
|
|
22
|
+
* state and its questions; answered with their answers. */
|
|
23
|
+
export type GuardJev = (request: {
|
|
24
|
+
label: string;
|
|
25
|
+
executionPath: string;
|
|
26
|
+
item?: {
|
|
27
|
+
index: number;
|
|
28
|
+
};
|
|
29
|
+
state: unknown;
|
|
30
|
+
questions: Record<string, unknown>;
|
|
31
|
+
signal?: AbortSignal;
|
|
32
|
+
}) => Promise<{
|
|
33
|
+
answers: Record<string, {
|
|
34
|
+
type: string;
|
|
35
|
+
noul?: number;
|
|
36
|
+
}>;
|
|
37
|
+
}>;
|
|
38
|
+
/** p from a guard's signals: through its fit when it has one, else the one signal, or the lower of the two for both;
|
|
39
|
+
* null when a signal it reads is missing. */
|
|
40
|
+
export declare function guardP(guard: Pick<StepGuard, "signal" | "fit">, signals: {
|
|
41
|
+
self: number | null;
|
|
42
|
+
jev: number | null;
|
|
43
|
+
}): number | null;
|
|
44
|
+
/** The one Jev request a guard sends, for every node kind: the step's label, what it was asked to do (its task: its
|
|
45
|
+
* instructions, its questions or schema; GuardStepParams.task), what it saw and what it wrote, each bounded
|
|
46
|
+
* (GUARD_STATE_CAPS); one yes/no question, the guard's own or DEFAULT_GUARD_QUESTION. */
|
|
47
|
+
export declare function guardRequestOf(params: Pick<GuardStepParams, "label" | "guard" | "task" | "input" | "output">): {
|
|
48
|
+
state: Record<string, unknown>;
|
|
49
|
+
questions: Record<string, unknown>;
|
|
50
|
+
};
|
|
51
|
+
/** A guard's Jev as a decision of the run: `judge` (the learned workflow's own, learned-workflow.ts learnedJudge: held to
|
|
52
|
+
* the run's gate on the provider jev, admitted on its one cap, settled at what it charged) asked of Jev, on the pinned
|
|
53
|
+
* model of `jev`'s route (its key's: TypeSafe's own, or OpenRouter's), under the step's label and execution path with
|
|
54
|
+
* `#guard`, so its receipt is its own. */
|
|
55
|
+
export declare function guardJevOn(judge: NonNullable<WorkflowDeps["runJudge"]>, jev: Pick<DecisionProvider, "needs">): GuardJev;
|
|
56
|
+
/** The DSL's guardStep for one learned_workflow call: Jev asked (`jev`; none: no Jev signal) only for a guard that reads
|
|
57
|
+
* it; p by guardP, NaN (no p, so the step hands back) when a signal it reads is missing. */
|
|
58
|
+
export declare function stepGuard(jev: GuardJev | undefined): (params: GuardStepParams) => Promise<GuardVerdict>;
|
|
59
|
+
/** A guard.evaluated event's detail as the run's row of it (GuardRow), under the step's label. */
|
|
60
|
+
export declare function rowOf(label: string, detail: unknown): GuardRow | undefined;
|
|
61
|
+
/** A guard row in words, for the hand-back: what it read and where p fell against its threshold. */
|
|
62
|
+
export declare function guardLine(row: GuardRow): string;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { JEV_OPENROUTER_KEY_ENV } from "../decisions.js";
|
|
2
|
+
import { cutForJev } from "../learn/general.js";
|
|
3
|
+
/** The Jev model a guard asks, pinned (https://docs.typesafe.ai/models, read 2026-11-13: jev-1.14.0 is current, and
|
|
4
|
+
* jev-latest points to it), by route: TypeSafe's own name, or OpenRouter's. A new Jev is a new pin and a new fit. */
|
|
5
|
+
export const JEV_GUARD_MODEL = { typesafe: "jev-1.14.0", openrouter: "typesafe/jev-1.14" };
|
|
6
|
+
/** The question a jev guard asks when its guard names none. */
|
|
7
|
+
export const DEFAULT_GUARD_QUESTION = "Is this output correct for this input, as the step's task asks?";
|
|
8
|
+
/** The most of a step's task, its input and its output a guard's request holds, each in UTF-16 units of its JSON: a
|
|
9
|
+
* longer one goes as its first part, cut as the generality pre-check cuts its state (learn/general.ts cutForJev,
|
|
10
|
+
* GENERAL_STATE_CAPS), well within one Jev request's 32k tokens a question. */
|
|
11
|
+
export const GUARD_STATE_CAPS = Object.freeze({ task: 8_000, input: 8_000, output: 8_000 });
|
|
12
|
+
/** What the guard's yes and no mean to Jev. */
|
|
13
|
+
const GUARD_CRITERIA = { true: "the output does what the task asks and is right for this input", false: "the output is wrong, incomplete, not what the task asks, or not supported by the input" };
|
|
14
|
+
/** The question id a guard's request asks under. */
|
|
15
|
+
const GUARD_QUESTION_ID = "right";
|
|
16
|
+
const sigmoid = (z) => 1 / (1 + Math.exp(-z));
|
|
17
|
+
/** p from a guard's signals: through its fit when it has one, else the one signal, or the lower of the two for both;
|
|
18
|
+
* null when a signal it reads is missing. */
|
|
19
|
+
export function guardP(guard, signals) {
|
|
20
|
+
const x = guard.signal === "self" ? [signals.self] : guard.signal === "jev" ? [signals.jev] : [signals.self, signals.jev];
|
|
21
|
+
if (x.some((value) => value === null || !Number.isFinite(value)))
|
|
22
|
+
return null;
|
|
23
|
+
const read = x;
|
|
24
|
+
const fit = guard.fit;
|
|
25
|
+
if (fit && Array.isArray(fit.w) && fit.w.length === read.length)
|
|
26
|
+
return sigmoid(fit.b + fit.w.reduce((sum, w, i) => sum + w * read[i], 0));
|
|
27
|
+
return Math.min(...read);
|
|
28
|
+
}
|
|
29
|
+
/** A part of what a guard sends: whole while its JSON fits `max`, else that JSON cut (cutForJev). */
|
|
30
|
+
function part(value, max) {
|
|
31
|
+
const text = JSON.stringify(value ?? null);
|
|
32
|
+
return text.length <= max ? value ?? null : cutForJev(text, max);
|
|
33
|
+
}
|
|
34
|
+
/** The one Jev request a guard sends, for every node kind: the step's label, what it was asked to do (its task: its
|
|
35
|
+
* instructions, its questions or schema; GuardStepParams.task), what it saw and what it wrote, each bounded
|
|
36
|
+
* (GUARD_STATE_CAPS); one yes/no question, the guard's own or DEFAULT_GUARD_QUESTION. */
|
|
37
|
+
export function guardRequestOf(params) {
|
|
38
|
+
return {
|
|
39
|
+
state: { step: params.label, task: part(params.task, GUARD_STATE_CAPS.task), input: part(params.input, GUARD_STATE_CAPS.input), output: part(params.output, GUARD_STATE_CAPS.output) },
|
|
40
|
+
questions: { [GUARD_QUESTION_ID]: { type: "noul", instructions: params.guard.question?.trim() || DEFAULT_GUARD_QUESTION, criteria: GUARD_CRITERIA } },
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/** A guard's Jev as a decision of the run: `judge` (the learned workflow's own, learned-workflow.ts learnedJudge: held to
|
|
44
|
+
* the run's gate on the provider jev, admitted on its one cap, settled at what it charged) asked of Jev, on the pinned
|
|
45
|
+
* model of `jev`'s route (its key's: TypeSafe's own, or OpenRouter's), under the step's label and execution path with
|
|
46
|
+
* `#guard`, so its receipt is its own. */
|
|
47
|
+
export function guardJevOn(judge, jev) {
|
|
48
|
+
const model = jev.needs.includes(JEV_OPENROUTER_KEY_ENV) ? JEV_GUARD_MODEL.openrouter : JEV_GUARD_MODEL.typesafe;
|
|
49
|
+
return async (request) => (await judge({ label: `${request.label} guard`, kind: "judge", provider: "jev", model, state: request.state, questions: request.questions, executionPath: `${request.executionPath}#guard`, ...(request.item ? { item: request.item } : {}), ...(request.signal ? { signal: request.signal } : {}) }));
|
|
50
|
+
}
|
|
51
|
+
/** The DSL's guardStep for one learned_workflow call: Jev asked (`jev`; none: no Jev signal) only for a guard that reads
|
|
52
|
+
* it; p by guardP, NaN (no p, so the step hands back) when a signal it reads is missing. */
|
|
53
|
+
export function stepGuard(jev) {
|
|
54
|
+
return async (params) => {
|
|
55
|
+
const { guard } = params;
|
|
56
|
+
let read = null;
|
|
57
|
+
if (guard.signal !== "self" && jev) {
|
|
58
|
+
try {
|
|
59
|
+
const answered = await jev({ label: params.label, executionPath: params.executionPath, ...(params.item ? { item: params.item } : {}), ...guardRequestOf(params), ...(params.signal ? { signal: params.signal } : {}) });
|
|
60
|
+
const noul = answered.answers?.[GUARD_QUESTION_ID]?.noul;
|
|
61
|
+
read = typeof noul === "number" && Number.isFinite(noul) ? noul : null;
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
// A stop is the call's stop; any other failure (a refusal of the gate or the cap, Jev's own) leaves no Jev
|
|
65
|
+
// signal, so the step hands back.
|
|
66
|
+
if (params.signal?.aborted)
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const p = guardP(guard, { self: params.self, jev: read });
|
|
71
|
+
return { p: p ?? Number.NaN, jev: read };
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/** A guard.evaluated event's detail as the run's row of it (GuardRow), under the step's label. */
|
|
75
|
+
export function rowOf(label, detail) {
|
|
76
|
+
const d = (detail ?? {});
|
|
77
|
+
if (d.signal !== "self" && d.signal !== "jev" && d.signal !== "both")
|
|
78
|
+
return undefined;
|
|
79
|
+
if (typeof d.threshold !== "number")
|
|
80
|
+
return undefined;
|
|
81
|
+
const num = (value) => (typeof value === "number" && Number.isFinite(value) ? value : undefined);
|
|
82
|
+
const self = num(d.self);
|
|
83
|
+
const jev = num(d.jev);
|
|
84
|
+
return { node: label, signal: d.signal, ...(self === undefined ? {} : { self }), ...(jev === undefined ? {} : { jev }), p: num(d.p) ?? null, threshold: d.threshold, escalated: d.escalated === true };
|
|
85
|
+
}
|
|
86
|
+
/** A guard row in words, for the hand-back: what it read and where p fell against its threshold. */
|
|
87
|
+
export function guardLine(row) {
|
|
88
|
+
if (row.signal === "escalate")
|
|
89
|
+
return `escalate "${row.node}" ${row.p === 0 ? "fired" : "did not fire"}; recorded, not obeyed (a replay)`;
|
|
90
|
+
const said = (n) => (typeof n === "number" ? n.toFixed(2) : "none");
|
|
91
|
+
const read = [row.self !== undefined || row.signal !== "jev" ? `its own confidence ${said(row.self)}` : "", row.signal !== "self" ? `Jev ${said(row.jev)}` : ""].filter(Boolean).join(", ");
|
|
92
|
+
return `guard on "${row.node}" (${row.signal}): p ${said(row.p)} against threshold ${row.threshold} (${read}); ${row.escalated ? "handed back" : "passed"}`;
|
|
93
|
+
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// (redact.ts HeldRedact): the runner's write-time cut (the secrets decision's rule three: no journal entry or row a run
|
|
3
3
|
// writes carries a secret value) holds its environment's secrets and all of these, not only the keys a claim hands its
|
|
4
4
|
// run (claim-secrets.ts). A run's text may quote a server secret it was never handed: a person pastes it, a provider
|
|
5
|
-
// echoes it back. One read of the store across all its planes (store.sealedSecrets): tool, model, computer and Archil keys
|
|
6
|
-
// (sealed_keys); MCP credentials, their headers' values and OAuth tokens and client secret (mcp_servers), and a sign-in in
|
|
5
|
+
// echoes it back. One read of the store across all its planes (store.sealedSecrets): tool, model, computer and Archil keys,
|
|
6
|
+
// the email account's password alone (its row holds the account whole), and the ChatGPT sign-in's access and refresh tokens each alone, renewed by whichever process holds the store (sealed_keys); MCP credentials, their headers' values and OAuth tokens and client secret (mcp_servers), and a sign-in in
|
|
7
7
|
// flight (mcp_oauth_pending); each trigger source's settings, a webhook trigger's signing secret and the GitHub App's key
|
|
8
8
|
// and webhook secret among them, and the outbound webhook's signing secret, each it held before too (trigger_settings),
|
|
9
9
|
// but a field its source marks public; browser sign-in pointers, live and forgotten; live viewer tokens; a launch's sealed
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
// owner's API token and the sign-in session secret). Each value in every spelling the server's list has
|
|
12
12
|
// (standard-webhooks.ts secretForms), a PEM key whole and line by line. A value that does not open under the runner's key
|
|
13
13
|
// is left out: the store never holds one in the clear, and nothing of this runner can be handed it.
|
|
14
|
+
import { CHATGPT_PLAN_ROW } from "../chatgpt-plan.js";
|
|
15
|
+
import { accountRowSecrets, EMAIL_ACCOUNT_ROW } from "../email/account.js";
|
|
14
16
|
import { unseal } from "../sealing.js";
|
|
15
17
|
import { besideTheStore, ServerSecrets } from "../server-secrets.js";
|
|
16
18
|
import { TRIGGER_ADAPTERS } from "../trigger-adapters.js";
|
|
@@ -67,6 +69,17 @@ function launchSecrets(text) {
|
|
|
67
69
|
out.push(...jsonSecrets(JSON.stringify(entry)));
|
|
68
70
|
return out;
|
|
69
71
|
}
|
|
72
|
+
/** The ChatGPT sign-in's sealed row (chatgpt-plan.ts): its access and refresh tokens, each alone, as a renewal in any
|
|
73
|
+
* process that holds the store writes them; the row's JSON whole beside them. */
|
|
74
|
+
function planSecrets(text) {
|
|
75
|
+
try {
|
|
76
|
+
const credential = JSON.parse(text)?.credential;
|
|
77
|
+
return [text, ...[credential?.access, credential?.refresh].filter((token) => typeof token === "string")];
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
return [text];
|
|
81
|
+
}
|
|
82
|
+
}
|
|
70
83
|
/** A PEM key whole, and each of its base64 lines (the short last one too), as the server lists one (sealed-settings-store.ts). */
|
|
71
84
|
const pemForms = (value) => [value, ...value.split(/\r?\n/).map((line) => line.trim()).filter((line) => line && !line.startsWith("-----"))];
|
|
72
85
|
/** What of one opened sealed value is a secret to hold, by its plane: `listed` with the server list's floor and spellings,
|
|
@@ -84,6 +97,8 @@ function secretsOf(row, plain, adapters) {
|
|
|
84
97
|
return { listed: jsonSecrets(plain), whole: [] };
|
|
85
98
|
case "run_launch":
|
|
86
99
|
return { listed: plain.trimStart().startsWith("{") ? launchSecrets(plain) : [plain], whole: [] };
|
|
100
|
+
case "sealed_keys":
|
|
101
|
+
return { listed: row.where.name === CHATGPT_PLAN_ROW ? planSecrets(plain) : row.where.name === EMAIL_ACCOUNT_ROW ? accountRowSecrets(plain) : [plain], whole: [] };
|
|
87
102
|
default:
|
|
88
103
|
return { listed: [plain], whole: [] };
|
|
89
104
|
}
|
|
@@ -25,9 +25,6 @@ export type SubagentOptions = {
|
|
|
25
25
|
readonly tier: (tier: SubagentTier) => TierModel;
|
|
26
26
|
/** Words before a child's own instructions (the environment line), when the host has any. */
|
|
27
27
|
readonly preamble?: string;
|
|
28
|
-
/** The agent's tool-call budget (definition.max_tool_calls, tool-budget.ts), per conversation: a call's own narrows it
|
|
29
|
-
* for its child, never widens it. */
|
|
30
|
-
readonly toolCalls?: number;
|
|
31
28
|
};
|
|
32
29
|
/** `text` within the host's bound on a tool result (HOST_RESULT_MAX_CHARS), saying where it was cut. */
|
|
33
30
|
export declare function boundedAnswer(text: string): string;
|
package/dist/runner/subagent.js
CHANGED
|
@@ -5,7 +5,6 @@ import { durableWait } from "../workflow/pi-versions.js";
|
|
|
5
5
|
import { HOST_TOOL_OUTPUT } from "./adapters/pi.js";
|
|
6
6
|
import { cutAtLimit } from "./loop-contract.js";
|
|
7
7
|
import { PI_STOP } from "./pi-stop.js";
|
|
8
|
-
import { budgetOf, ConversationToolBudget } from "../tool-budget.js";
|
|
9
8
|
export const SUBAGENT_TOOL = "subagent";
|
|
10
9
|
/** The tiers a call may name for its child (its definition's model_tiers, else this server's tier); a call that names
|
|
11
10
|
* none runs its child on the agent's own model. */
|
|
@@ -99,7 +98,6 @@ export function subagentTool(options) {
|
|
|
99
98
|
prompt: { type: "string", minLength: 1, description: "The subagent's whole task, self-contained: it sees nothing else." },
|
|
100
99
|
tools: { type: "array", items: { type: "string" }, uniqueItems: true, description: "The tools it may use, each one of your own tools by name. Absent or empty: none." },
|
|
101
100
|
model: { enum: [...SUBAGENT_TIERS], description: "The model tier it runs on, one of this agent's own tiers. Absent: your own model." },
|
|
102
|
-
max_tool_calls: { type: "integer", minimum: 1, description: "The most tool calls it may make. It narrows your own budget for it, never widens it. Absent: your budget." },
|
|
103
101
|
effort: { enum: [...SUBAGENT_EFFORTS], description: "How hard it thinks: low, medium or high. Absent: as you do." },
|
|
104
102
|
},
|
|
105
103
|
required: ["prompt"],
|
|
@@ -119,20 +117,18 @@ export function subagentTool(options) {
|
|
|
119
117
|
const model = args.model === undefined ? undefined : options.tier(args.model);
|
|
120
118
|
if (model && "why" in model)
|
|
121
119
|
return fail(`subagent: the ${args.model} tier has no model here: ${model.why} Nothing ran.`);
|
|
122
|
-
if (args.max_tool_calls !== undefined && !(Number.isSafeInteger(args.max_tool_calls) && args.max_tool_calls > 0))
|
|
123
|
-
return fail("subagent: max_tool_calls is a whole number above 0. Nothing ran.");
|
|
124
120
|
if (args.effort !== undefined && !SUBAGENT_EFFORTS.includes(args.effort))
|
|
125
121
|
return fail(`subagent: effort is one of ${SUBAGENT_EFFORTS.join(", ")}. Nothing ran.`);
|
|
126
|
-
// The child's own budget: the call's, held under the agent's (never wider); absent, the agent's holds it as it holds
|
|
127
|
-
// every conversation of the run.
|
|
128
|
-
const toolCalls = args.max_tool_calls === undefined ? undefined : budgetOf(options.toolCalls, args.max_tool_calls);
|
|
129
122
|
const chosen = chosenTools(args.tools ?? [], options);
|
|
130
123
|
if ("refused" in chosen)
|
|
131
124
|
return fail(chosen.refused);
|
|
132
125
|
// The registrations the parent's agent enables, by session name: exactly the ones the call named are the child's.
|
|
126
|
+
// Past the deferral threshold the parent's catalog tools are deferred (offered through tools_search, never listed):
|
|
127
|
+
// they are its agent's `deferred`, not its `tools`, and a child that is given one is offered it outright, having
|
|
128
|
+
// no tools_search of its own (modelTools below names every tool it has, deferred ones too).
|
|
133
129
|
const names = new Set(chosen.names);
|
|
134
130
|
const parent = await api.agent(context);
|
|
135
|
-
const tools = parent.tools.filter((registration) => names.has(registration.name));
|
|
131
|
+
const tools = [...parent.tools, ...parent.deferred.filter((one) => !parent.tools.some((listed) => listed.name === one.name))].filter((registration) => names.has(registration.name));
|
|
136
132
|
const missing = [...names].filter((name) => !tools.some((registration) => registration.name === name));
|
|
137
133
|
if (missing.length)
|
|
138
134
|
return fail(`subagent: ${missing.join(", ")} ${missing.length === 1 ? "is" : "are"} not bound in this run, so no subagent may have ${missing.length === 1 ? "it" : "them"}. Nothing ran.`);
|
|
@@ -151,15 +147,14 @@ export function subagentTool(options) {
|
|
|
151
147
|
// The call's effort, else the agent's own level (a task-owned conversation copies its owner's agent).
|
|
152
148
|
...(args.effort ? { thinkingLevel: args.effort } : {}),
|
|
153
149
|
tools: tools,
|
|
154
|
-
|
|
150
|
+
// Exactly its tools offered, a deferred one too.
|
|
151
|
+
modelTools: tools,
|
|
155
152
|
instructions: [options.preamble, SUBAGENT_INSTRUCTIONS].filter(Boolean).join("\n\n"),
|
|
156
153
|
});
|
|
157
|
-
if (toolCalls !== undefined)
|
|
158
|
-
Object.assign(await tx.doc(ConversationToolBudget, created.id), { toolCalls });
|
|
159
154
|
return created.id;
|
|
160
155
|
}, context);
|
|
161
156
|
// The call's details name its child: the run's timeline nests the child's rows under this call.
|
|
162
|
-
const details = { conversationId: Number(child), ...(args.model ? { model: args.model } : {}), tools: chosen.catalog, ...(
|
|
157
|
+
const details = { conversationId: Number(child), ...(args.model ? { model: args.model } : {}), tools: chosen.catalog, ...(args.effort ? { effort: args.effort } : {}) };
|
|
163
158
|
await api.details(details, context);
|
|
164
159
|
const handle = await api.conversation(child, context);
|
|
165
160
|
if (!handle)
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { type LearnedWorkflow } from "../learning.js";
|
|
2
|
+
import type { RunLaunch } from "../run-launch.js";
|
|
3
|
+
import { COST_WINDOW, type RunPath } from "../learning-cost.js";
|
|
4
|
+
export { COST_WINDOW };
|
|
5
|
+
import { type GuardRow } from "../learned-nodes.js";
|
|
6
|
+
import type { Skipped } from "../learn/replay-calls.js";
|
|
7
|
+
/** The root entry a run served workflow-first keeps, once the workflow's call ended: which workflow, at which learned
|
|
8
|
+
* revision, under which call, and how it ended. A later claim that finds it never runs the workflow again. */
|
|
9
|
+
export declare const WORKFLOW_FIRST = "agentrun.workflow_first";
|
|
10
|
+
/** The one call id a run's workflow-first call goes under: replay never, a crash's call is ended interrupted. */
|
|
11
|
+
export declare const WORKFLOW_FIRST_CALL = "workflow-first";
|
|
12
|
+
/** What the adapter loop serves first (AdapterRunSpec.workflowFirst): the workflow by name, the run's input as the
|
|
13
|
+
* workflow takes it (the launch's input object, whole), and the learned revision it came from (the seed's sha). */
|
|
14
|
+
export interface WorkflowFirst {
|
|
15
|
+
readonly name: string;
|
|
16
|
+
/** The workflow's digest (workflowDigest): which revision of it served, kept on the run's record (metrics.workflow_digest). */
|
|
17
|
+
readonly digest: string;
|
|
18
|
+
/** The promotion of that digest that serves it (its record's since, learn/promote.ts PromotionRecord.since), kept on
|
|
19
|
+
* the run's record (metrics.workflow_promotion): its serving checks count the run's grade for that promotion alone.
|
|
20
|
+
* Absent: one with no since, or none (no promotion gate). */
|
|
21
|
+
readonly promotion?: number;
|
|
22
|
+
readonly input: Readonly<Record<string, unknown>>;
|
|
23
|
+
readonly revision: string | null;
|
|
24
|
+
/** A replay run's (RunLaunch.replay): the workflow runs alone, a hand-back ends the run with no agent turn. */
|
|
25
|
+
readonly replay?: true;
|
|
26
|
+
/** The agent's output schema, when it has one: the workflow's answer is served shaped to it (answer-json.ts
|
|
27
|
+
* answerAsServed), else the job goes back to the agent. */
|
|
28
|
+
readonly outputSchema?: unknown;
|
|
29
|
+
}
|
|
30
|
+
/** What WORKFLOW_FIRST keeps: the step's end (its call, and whether it answered or handed back), or why the workflow did
|
|
31
|
+
* not run first (`needs_revision`: the money rule's two numbers, over its last `runs` served runs). */
|
|
32
|
+
export type WorkflowFirstData = {
|
|
33
|
+
readonly workflow: string;
|
|
34
|
+
readonly digest: string;
|
|
35
|
+
readonly promotion?: number;
|
|
36
|
+
readonly revision: string | null;
|
|
37
|
+
readonly call: string;
|
|
38
|
+
readonly outcome: "answered" | "handed_back";
|
|
39
|
+
} | ({
|
|
40
|
+
readonly workflow: string;
|
|
41
|
+
readonly digest: string;
|
|
42
|
+
readonly revision: string | null;
|
|
43
|
+
readonly outcome: "needs_revision";
|
|
44
|
+
} & Omit<Revise, "workflow" | "digest">);
|
|
45
|
+
/** A workflow the money rule stopped from running first: its digest, and its all-in cost a run over its last `runs`
|
|
46
|
+
* served runs against the agent's by-hand cost a run, each rounded to 1e-6. */
|
|
47
|
+
export interface Revise {
|
|
48
|
+
readonly workflow: string;
|
|
49
|
+
readonly digest: string;
|
|
50
|
+
readonly served_usd: number;
|
|
51
|
+
readonly by_hand_usd: number;
|
|
52
|
+
readonly runs: number;
|
|
53
|
+
}
|
|
54
|
+
/** How many of the agent's newest runs the money rule reads (store-reads/learning.ts pastRunsOverStore). */
|
|
55
|
+
export declare const PAST_RUNS = 500;
|
|
56
|
+
/** One of the agent's runs as the money rule reads it: its record's path fields, its all-in cost (allInOf: its booked
|
|
57
|
+
* cost and every learning round booked for it; null when any part is unknown), when it started. */
|
|
58
|
+
export type PastRun = {
|
|
59
|
+
readonly metrics: unknown;
|
|
60
|
+
readonly allInUsd: number | null;
|
|
61
|
+
readonly startedAt: number;
|
|
62
|
+
};
|
|
63
|
+
/** A mean over `runs` runs, rounded to 1e-6. */
|
|
64
|
+
type Mean = {
|
|
65
|
+
readonly runs: number;
|
|
66
|
+
readonly mean_usd: number;
|
|
67
|
+
};
|
|
68
|
+
/** The money rule's two sides for workflow `name` at `digest`, over the agent's runs (`past`, any order), each read at
|
|
69
|
+
* its all-in cost: `served`, the mean of its newest COST_WINDOW runs served first at that digest (path workflow or
|
|
70
|
+
* handed_back) whose all-in is known; `by_hand`, the mean of the agent's `agent` runs whose all-in is known, or, with
|
|
71
|
+
* none, of its runs before the workflow's first run (any digest), null when there are none either; `unknown_runs`, the
|
|
72
|
+
* runs either side would have read that it left out for an unknown all-in (the cost page's rule: left out and counted). */
|
|
73
|
+
export declare function costLineOf(past: readonly PastRun[], name: string, digest: string): {
|
|
74
|
+
served: Mean | {
|
|
75
|
+
runs: 0;
|
|
76
|
+
mean_usd: null;
|
|
77
|
+
};
|
|
78
|
+
by_hand: Mean | null;
|
|
79
|
+
unknown_runs: number;
|
|
80
|
+
};
|
|
81
|
+
/** Whether a cost line is over the money rule's line: COST_WINDOW served runs or more at the digest, a by-hand cost to
|
|
82
|
+
* hold them to, and their mean at or over it. */
|
|
83
|
+
export declare const overLine: (line: ReturnType<typeof costLineOf>) => boolean;
|
|
84
|
+
/** Each learned workflow that has served one of the agent's runs (`past`) first, at the digest its newest served run
|
|
85
|
+
* ran, with the money rule's two sides there, the runs they left out for an unknown all-in, and where it stands:
|
|
86
|
+
* `serving`, or `needs_revision` once over the line (overLine). What the agent's cost per run shows its owner. */
|
|
87
|
+
export declare function workflowCostsOf(past: readonly PastRun[]): {
|
|
88
|
+
workflow: string;
|
|
89
|
+
digest: string;
|
|
90
|
+
state: "serving" | "needs_revision";
|
|
91
|
+
served: Mean | null;
|
|
92
|
+
by_hand: Mean | null;
|
|
93
|
+
unknown_cost_runs: number;
|
|
94
|
+
}[];
|
|
95
|
+
/** What workflowFirstOf chose: the workflow the run serves first, or the one the money rule stopped (the run asks for its
|
|
96
|
+
* revision), or neither. */
|
|
97
|
+
export interface FirstChoice {
|
|
98
|
+
readonly serve?: WorkflowFirst;
|
|
99
|
+
readonly revise?: WorkflowRevise;
|
|
100
|
+
/** The champion that serves (or that the money rule stopped) in place of the laid revision of the same name, which
|
|
101
|
+
* is not promoted yet or was held (runner/promotion.ts): the text the run's learned_workflow tool runs (laidFor). */
|
|
102
|
+
readonly champion?: LearnedWorkflow;
|
|
103
|
+
}
|
|
104
|
+
/** The learned workflows a run's tool runs once its first choice is made: the laid ones, a champion (FirstChoice) in
|
|
105
|
+
* place of its laid revision. */
|
|
106
|
+
export declare const laidFor: (laid: readonly LearnedWorkflow[], choice: FirstChoice) => LearnedWorkflow[];
|
|
107
|
+
/** What serves a run in place of its laid workflow: the workflow (the laid one itself, or its champion's text), and the
|
|
108
|
+
* promotion it serves under (WorkflowFirst.promotion). */
|
|
109
|
+
export type Serving = {
|
|
110
|
+
readonly workflow: LearnedWorkflow;
|
|
111
|
+
readonly promotion?: number;
|
|
112
|
+
};
|
|
113
|
+
/** The promotion a run's first choice asks (runner/promotion.ts promotionGate): what serves in place of the laid one at
|
|
114
|
+
* `digest` (it, its champion, or none); `champion`, its champion alone, for a laid one that does not take the run's
|
|
115
|
+
* input (nothing replays). */
|
|
116
|
+
export type Promoted = ((workflow: LearnedWorkflow, digest: string) => Promise<Serving | undefined>) & {
|
|
117
|
+
readonly champion?: (workflow: LearnedWorkflow, digest: string) => Promise<Serving | undefined>;
|
|
118
|
+
};
|
|
119
|
+
/** A workflow the money rule stopped, with the learned revision the run was laid from: what the run's WORKFLOW_FIRST
|
|
120
|
+
* entry keeps (outcome needs_revision). */
|
|
121
|
+
/** `outputSchema`: the agent's, as WorkflowFirst carries it, so a claim that recovers this run's handback (the rule
|
|
122
|
+
* stopping the workflow only after it ran) rebuilds it in the words it was first given. */
|
|
123
|
+
export type WorkflowRevise = Revise & {
|
|
124
|
+
readonly revision: string | null;
|
|
125
|
+
readonly outputSchema?: unknown;
|
|
126
|
+
};
|
|
127
|
+
/** A workflow's input schema, resolved as the DSL resolves a schema reference, or undefined when it names none. */
|
|
128
|
+
declare function inputSchemaOf(text: string, resolve: (doc: {
|
|
129
|
+
schemas: Record<string, Record<string, unknown>>;
|
|
130
|
+
}, schema: Record<string, unknown>) => Record<string, unknown>): Record<string, unknown> | undefined;
|
|
131
|
+
/** Whether `workflow` takes `input` as it is: a schema with a required field, which the input passes at its top level. */
|
|
132
|
+
export declare function fits(workflow: LearnedWorkflow, input: unknown, resolve: Parameters<typeof inputSchemaOf>[1]): boolean;
|
|
133
|
+
/** A learned workflow's digest: the first 16 hex of its text's sha256. A new revision of it is a new digest. */
|
|
134
|
+
export declare const workflowDigest: (workflow: Pick<LearnedWorkflow, "workflow">) => string;
|
|
135
|
+
/** The workflow a run serves first (`serve`), or the one the money rule stopped (`revise`), or neither: the run is
|
|
136
|
+
* agentic, its claim laid learned workflows (`workflows`: the active ones the seed lay chose, so learning is neither off
|
|
137
|
+
* nor notes-only), its launch does not force the agent path, and exactly one of them fits its input; then its promotion
|
|
138
|
+
* (`promoted`, runner/promotion.ts: a new digest serves only once its replay on the agent's graded inputs clears the bar,
|
|
139
|
+
* learn/promote.ts, its champion serving meanwhile when it fits the input too, `champion`; none leaves the run to the
|
|
140
|
+
* agent), then costLineOf over the agent's runs (`past`, store-reads/learning.ts pastRunsOverStore) at the digest that
|
|
141
|
+
* serves. When none of them fits, the revisions allowed to serve in their place are asked (`promoted.champion`: a
|
|
142
|
+
* champion whose revision on the folder changed its input, a new required field say): exactly one champion that fits
|
|
143
|
+
* serves. `outputSchema`: the agent's, when it has one: the workflow's answer is served shaped to it (answer-json.ts
|
|
144
|
+
* answerAsServed), on a replay too, so a replay scores the answer a run would serve. `log`: one line when the launch
|
|
145
|
+
* forces the agent, more than one fits, there is no by-hand cost to hold the workflow to, or the rule stops it. A replay
|
|
146
|
+
* run (launch.replay) serves the workflow it replays, by name, alone: no promotion, no money rule; none when its claim
|
|
147
|
+
* laid no workflow by that name at that digest (runner/promotion.ts replayClaimed then refuses the claim: the run ends
|
|
148
|
+
* failed, never on the agent's path). */
|
|
149
|
+
export declare function workflowFirstOf(kind: string, workflows: readonly LearnedWorkflow[], launch: RunLaunch, log?: (line: string) => void, past?: () => Promise<readonly PastRun[]>, promoted?: Promoted, outputSchema?: unknown): Promise<FirstChoice>;
|
|
150
|
+
/** What a run's workflow-first step did, from its root entries (the WORKFLOW_FIRST entry): the workflow, its digest, the
|
|
151
|
+
* promotion it served under (WorkflowFirst.promotion), and whether it answered or handed back; undefined when it served
|
|
152
|
+
* none. The run's path is the run-end classifier's (store-reads/learning.ts runPathOverStore), which reads this first. */
|
|
153
|
+
export declare function servedOf(entries: readonly {
|
|
154
|
+
readonly kind: string;
|
|
155
|
+
readonly data?: unknown;
|
|
156
|
+
}[]): {
|
|
157
|
+
outcome: "answered" | "handed_back";
|
|
158
|
+
workflow: string;
|
|
159
|
+
digest?: string;
|
|
160
|
+
promotion?: number;
|
|
161
|
+
} | undefined;
|
|
162
|
+
/** Why a run's learned workflow did not run first, from its root entries: the money rule's WORKFLOW_FIRST entry
|
|
163
|
+
* (outcome needs_revision) with its two numbers; undefined when there is none. */
|
|
164
|
+
export declare function reviseOf(entries: readonly {
|
|
165
|
+
readonly kind: string;
|
|
166
|
+
readonly data?: unknown;
|
|
167
|
+
}[]): Revise | undefined;
|
|
168
|
+
/** The run-record fields a learning run's metrics carry, from the run-end classifier's `classified` path
|
|
169
|
+
* (runPathOverStore): the path it took, the learned revision it ran on, the learned workflow it ran (served first, or
|
|
170
|
+
* called by its agent) and, for one served first, its digest and the promotion it served under (`workflow_promotion`,
|
|
171
|
+
* which its grade keeps); and from its root `entries`, each step guard's check of its learned workflows' calls
|
|
172
|
+
* (`guards`, learned-nodes.ts guardsOf), when one ran. learning-cost reads path and workflow from here. None for a run
|
|
173
|
+
* that does not learn. */
|
|
174
|
+
export declare function pathMetrics(launch: RunLaunch, classified: {
|
|
175
|
+
path: RunPath;
|
|
176
|
+
workflow: string | null;
|
|
177
|
+
digest?: string;
|
|
178
|
+
promotion?: number;
|
|
179
|
+
} | undefined, entries?: readonly {
|
|
180
|
+
readonly kind: string;
|
|
181
|
+
readonly data?: unknown;
|
|
182
|
+
}[]): {
|
|
183
|
+
path?: RunPath;
|
|
184
|
+
learned_revision?: string;
|
|
185
|
+
workflow?: string;
|
|
186
|
+
workflow_digest?: string;
|
|
187
|
+
workflow_promotion?: number;
|
|
188
|
+
guards?: GuardRow[];
|
|
189
|
+
replay?: ReplayMetrics;
|
|
190
|
+
};
|
|
191
|
+
/** A replay run's record (metrics.replay): the graded run it replayed and how its workflow ended there. */
|
|
192
|
+
export type ReplayMetrics = {
|
|
193
|
+
readonly of: string;
|
|
194
|
+
readonly outcome: ReplayOutcome;
|
|
195
|
+
readonly skipped?: Skipped;
|
|
196
|
+
};
|
|
197
|
+
/** How a replay run's workflow ended on its input: `skipped_write`, stopped at a write the graded run's recording does not
|
|
198
|
+
* have (learn/replay-calls.ts SKIPPED_WRITE), never run. */
|
|
199
|
+
export type ReplayOutcome = "answered" | "handed_back" | "failed" | "skipped_write";
|
|
200
|
+
/** What run `entries` (its root's) say its learned workflow answered alone: the workflow and its answer (the model's
|
|
201
|
+
* message written just before the WORKFLOW_FIRST entry, in its commit); undefined for a run it did not answer. A follow-up that opens such a
|
|
202
|
+
* run again is the agent's first turn: its session never saw the job or the answer (servedAnswerText). */
|
|
203
|
+
export declare function servedAnswerOf(entries: readonly {
|
|
204
|
+
readonly kind: string;
|
|
205
|
+
readonly data?: unknown;
|
|
206
|
+
}[]): {
|
|
207
|
+
workflow: string;
|
|
208
|
+
answer: string;
|
|
209
|
+
} | undefined;
|
|
210
|
+
/** Whether a run its learned workflow answered alone still ends on that answer (the run's path is who wrote its final
|
|
211
|
+
* answer): its newest answer row outside the end-of-run turns (`rows`, runTimeline's, LEARNING_LABEL's left out) is
|
|
212
|
+
* none, or says what the workflow `answer`ed, as it produced it or as the agent was shown it (`shown`) (promote.ts sameAnswer: trimmed text, or JSON of the same value, a
|
|
213
|
+
* fenced block in prose included). A
|
|
214
|
+
* follow-up the agent answered with a new or changed answer did not end on the workflow: `handed_back`. A feedback
|
|
215
|
+
* round (a grade's label, adapter-loop.ts) asks the agent no turn of the job's, so its run stays the workflow's. */
|
|
216
|
+
export declare function servedAnswerStands(answer: string, rows: readonly {
|
|
217
|
+
readonly kind: string;
|
|
218
|
+
readonly agent_label?: string | null;
|
|
219
|
+
readonly text?: string | null;
|
|
220
|
+
}[], shown?: string): boolean;
|
|
221
|
+
/** Said to the agent between the job and a follow-up's message, on a run its learned workflow answered alone: which
|
|
222
|
+
* workflow answered and what, so the follow-up (a reviewer's word on that answer) reads against it. */
|
|
223
|
+
export declare function servedAnswerText(name: string, answer: string): string;
|
|
224
|
+
/** The agent's first input on a handback: the hand-back first (which workflow, and its own words for why, the trace the
|
|
225
|
+
* call answered), then the job as it was launched. The loop cuts it of every secret the runner holds before it is sent. */
|
|
226
|
+
export declare function handbackText(name: string, trace: string, job: string): string;
|