@parcha/agentrun-serve 0.1.0-beta.37 → 0.1.0-beta.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +282 -0
- package/README.md +155 -92
- package/dist/agent-rows.d.ts +1 -1
- package/dist/agents-store.d.ts +35 -3
- package/dist/agents-store.js +39 -14
- package/dist/answer-json.d.ts +34 -1
- package/dist/answer-json.js +91 -9
- package/dist/api-only.d.ts +1 -1
- package/dist/api-only.js +2 -2
- package/dist/browser-cost.js +52 -93
- package/dist/cap.d.ts +0 -390
- package/dist/cap.js +4 -937
- package/dist/catalog.js +1 -1
- package/dist/composio-preset.d.ts +17 -0
- package/dist/composio-preset.js +43 -1
- package/dist/computer-calls.d.ts +36 -24
- package/dist/computer-calls.js +110 -27
- package/dist/computer-live.d.ts +5 -0
- package/dist/computer-live.js +12 -0
- package/dist/computer-setting.d.ts +15 -2
- package/dist/computer-setting.js +20 -4
- package/dist/computer-view.d.ts +3 -2
- package/dist/computer-view.js +5 -4
- package/dist/computer-viewer.js +26 -12
- package/dist/computers.d.ts +4 -1
- package/dist/computers.js +12 -6
- package/dist/console/assets/index-CjqQirbo.css +1 -0
- package/dist/console/assets/index-b6-XY5A9.js +576 -0
- package/dist/console/index.html +2 -2
- package/dist/console-links.d.ts +2 -0
- package/dist/console-links.js +3 -0
- package/dist/decisions.js +4 -0
- package/dist/faux-computers.js +4 -2
- package/dist/harness-opencode/adapter.js +7 -3
- package/dist/harness-opencode/facts.js +0 -2
- package/dist/harness-opencode/host/policy.d.ts +2 -5
- package/dist/harness-opencode/host/policy.js +8 -32
- package/dist/harness-table.d.ts +0 -2
- package/dist/harness-table.js +0 -2
- package/dist/host-tools.d.ts +1 -5
- package/dist/host-tools.js +7 -10
- package/dist/hosted-search.d.ts +0 -2
- package/dist/hosted-search.js +0 -21
- package/dist/key-words.d.ts +3 -2
- package/dist/key-words.js +4 -2
- package/dist/learn/check.d.ts +6 -1
- package/dist/learn/check.js +12 -4
- package/dist/learn/commit.d.ts +10 -0
- package/dist/learn/commit.js +18 -4
- package/dist/learn/compile.d.ts +243 -0
- package/dist/learn/compile.js +471 -0
- package/dist/learn/general.d.ts +3 -0
- package/dist/learn/general.js +4 -2
- package/dist/learn/grade.d.ts +1 -1
- package/dist/learn/grade.js +7 -6
- package/dist/learn/notes.d.ts +8 -0
- package/dist/learn/notes.js +18 -0
- package/dist/learn/promote.d.ts +253 -0
- package/dist/learn/promote.js +428 -0
- package/dist/learn/refit.d.ts +39 -0
- package/dist/learn/refit.js +236 -0
- package/dist/learn/reflect.d.ts +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 +17 -9
- package/dist/learn/skills.js +132 -42
- package/dist/learn/workflow-nodes.d.ts +15 -0
- package/dist/learn/workflow-nodes.js +44 -0
- package/dist/learned-nodes.d.ts +50 -2
- package/dist/learned-nodes.js +41 -2
- package/dist/learned-workflow.d.ts +19 -3
- package/dist/learned-workflow.js +105 -26
- package/dist/learning-batch.d.ts +2 -2
- package/dist/learning-batch.js +1 -1
- package/dist/learning-cost.d.ts +18 -6
- package/dist/learning-cost.js +15 -7
- package/dist/learning-routes.d.ts +14 -2
- package/dist/learning-routes.js +14 -3
- package/dist/learning-words.d.ts +7 -0
- package/dist/learning-words.js +7 -0
- package/dist/learning.d.ts +31 -6
- package/dist/learning.js +7 -4
- package/dist/llm.js +0 -3
- 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 +107 -0
- package/dist/mcp-probe.d.ts +8 -9
- package/dist/mcp-probe.js +16 -33
- package/dist/mcp-servers-store.d.ts +89 -22
- package/dist/mcp-servers-store.js +131 -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.d.ts +13 -0
- package/dist/model.js +46 -15
- package/dist/monid.d.ts +51 -25
- package/dist/monid.js +226 -140
- package/dist/openapi.js +336 -66
- package/dist/paid-calls.d.ts +26 -29
- package/dist/paid-calls.js +46 -102
- package/dist/propose.d.ts +7 -1
- package/dist/propose.js +18 -6
- package/dist/provider.js +9 -2
- package/dist/reflect-range.js +2 -1
- package/dist/rows.d.ts +5 -3
- package/dist/rows.js +15 -4
- package/dist/run-launch.d.ts +13 -0
- package/dist/run-launch.js +6 -0
- package/dist/run-learning-served.d.ts +13 -2
- package/dist/run-manifest.d.ts +5 -0
- package/dist/run-manifest.js +20 -0
- package/dist/run-secrets.js +2 -3
- package/dist/run-timeline-served.js +5 -2
- package/dist/run-view.d.ts +17 -6
- package/dist/run-view.js +51 -22
- package/dist/runnable.d.ts +0 -3
- package/dist/runnable.js +37 -29
- package/dist/runner/adapter-loop.d.ts +24 -10
- package/dist/runner/adapter-loop.js +852 -314
- package/dist/runner/adapter-run-spec.d.ts +12 -6
- package/dist/runner/adapter-run-spec.js +97 -46
- package/dist/runner/adapters/pi-computer.d.ts +3 -1
- package/dist/runner/adapters/pi-computer.js +13 -5
- package/dist/runner/adapters/pi.d.ts +16 -7
- package/dist/runner/adapters/pi.js +94 -33
- package/dist/runner/cli-run-spec.js +67 -27
- package/dist/runner/computer-channel.js +2 -1
- package/dist/runner/conformance/harness.d.ts +3 -0
- package/dist/runner/conformance/harness.js +145 -4
- package/dist/runner/conformance/subject.d.ts +11 -4
- package/dist/runner/end-of-run.d.ts +6 -5
- package/dist/runner/end-of-run.js +9 -6
- package/dist/runner/feedback-round.d.ts +52 -0
- package/dist/runner/feedback-round.js +79 -0
- package/dist/runner/journal-kinds.d.ts +24 -6
- package/dist/runner/journal-kinds.js +15 -0
- package/dist/runner/learning-end.d.ts +54 -19
- package/dist/runner/learning-end.js +272 -99
- package/dist/runner/learning-loop.d.ts +19 -1
- package/dist/runner/learning-loop.js +5 -2
- 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 +16 -1
- package/dist/runner/loop.js +21 -1
- package/dist/runner/mcp-claim.d.ts +5 -1
- package/dist/runner/mcp-claim.js +66 -50
- package/dist/runner/mcp-run.d.ts +16 -52
- package/dist/runner/mcp-run.js +12 -84
- package/dist/runner/meta-tools.d.ts +37 -0
- package/dist/runner/meta-tools.js +268 -0
- package/dist/runner/metrics.js +14 -3
- package/dist/runner/model-route.js +12 -3
- package/dist/runner/monid-run.d.ts +16 -0
- package/dist/runner/monid-run.js +96 -0
- package/dist/runner/promotion.d.ts +80 -0
- package/dist/runner/promotion.js +562 -0
- package/dist/runner/reflect-hook.d.ts +36 -21
- package/dist/runner/reflect-hook.js +138 -49
- package/dist/runner/runner.js +26 -4
- package/dist/runner/sessions.d.ts +8 -3
- package/dist/runner/sessions.js +5 -1
- package/dist/runner/step-guard.d.ts +62 -0
- package/dist/runner/step-guard.js +93 -0
- package/dist/runner/subagent.d.ts +0 -3
- package/dist/runner/subagent.js +7 -12
- package/dist/runner/workflow-first.d.ts +216 -0
- package/dist/runner/workflow-first.js +303 -0
- package/dist/runner/workflow-loop.js +17 -10
- package/dist/runner/workflow-spec.d.ts +1 -0
- package/dist/runner/workflow-spec.js +7 -3
- package/dist/runs-over-store.d.ts +11 -2
- package/dist/runs-over-store.js +21 -11
- package/dist/server.d.ts +88 -16
- package/dist/server.js +380 -87
- package/dist/settings-wake.d.ts +8 -6
- package/dist/settings-wake.js +13 -7
- package/dist/store/agent-body.d.ts +14 -3
- package/dist/store/agent-body.js +14 -10
- package/dist/store/command-wake.d.ts +3 -2
- package/dist/store/command-wake.js +4 -4
- 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/schema.d.ts +9 -0
- package/dist/store/schema.js +28 -8
- package/dist/store/sqlite/connection.d.ts +2 -2
- package/dist/store/sqlite/connection.js +2 -2
- package/dist/store/sqlite/run-patch.js +19 -7
- package/dist/store/sqlite/store.js +59 -18
- package/dist/store/store.d.ts +46 -14
- package/dist/store-reads/journal.d.ts +25 -1
- package/dist/store-reads/journal.js +63 -49
- package/dist/store-reads/learning.d.ts +101 -15
- package/dist/store-reads/learning.js +195 -61
- package/dist/store-reads/loop.d.ts +61 -0
- package/dist/store-reads/loop.js +111 -0
- package/dist/store-view.d.ts +3 -2
- package/dist/store-view.js +35 -17
- package/dist/template-eval.d.ts +18 -9
- package/dist/template-eval.js +91 -66
- 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 +218 -46
- package/dist/templates.js +493 -181
- package/dist/timeline/computer.d.ts +48 -0
- package/dist/timeline/computer.js +169 -0
- package/dist/timeline/index.d.ts +4 -3
- package/dist/timeline/index.js +4 -3
- package/dist/timeline/labels.d.ts +6 -2
- package/dist/timeline/labels.js +93 -2
- package/dist/timeline/origin.d.ts +19 -5
- package/dist/timeline/origin.js +11 -4
- package/dist/timeline/timeline.d.ts +11 -17
- package/dist/timeline/timeline.js +24 -9
- package/dist/tool-gate.d.ts +73 -46
- package/dist/tool-gate.js +133 -66
- package/dist/tool-keys.d.ts +4 -1
- package/dist/tool-keys.js +8 -3
- package/dist/tool-list.d.ts +26 -0
- package/dist/tool-list.js +43 -0
- package/dist/tool-names.d.ts +71 -0
- package/dist/tool-names.js +99 -0
- package/dist/tool-plane.d.ts +29 -27
- package/dist/tool-plane.js +65 -37
- package/dist/tools.d.ts +22 -6
- package/dist/tools.js +24 -20
- package/dist/validate.d.ts +15 -7
- package/dist/validate.js +91 -44
- package/dist/web-fetch.d.ts +1 -7
- package/dist/web-fetch.js +2 -22
- package/dist/workspace/computer-deps.d.ts +3 -0
- package/dist/workspace/computer-deps.js +5 -2
- package/dist/workspace/computer-for-claim.d.ts +6 -0
- package/dist/workspace/computer-for-claim.js +32 -14
- package/dist/workspace/computer-hold.js +7 -1
- package/dist/workspace/computer-script.d.ts +23 -7
- package/dist/workspace/computer-script.js +48 -14
- package/dist/workspace/index.d.ts +2 -2
- package/dist/workspace/index.js +1 -1
- package/dist/workspace/kind-skills/desktop/SKILL.md +13 -0
- package/dist/workspace/kind-skills/phone/SKILL.md +4 -0
- package/dist/workspace/local.js +2 -2
- package/dist/workspace/resolve-computer.d.ts +21 -1
- package/dist/workspace/resolve-computer.js +32 -14
- package/dist/workspace/run-tools.d.ts +28 -10
- package/dist/workspace/run-tools.js +39 -11
- package/dist/{tool-budget.d.ts → wrap-up.d.ts} +1 -18
- package/dist/wrap-up.js +21 -0
- package/launcher/agentrun-serve +4 -2
- package/package.json +9 -9
- package/templates/README.md +111 -45
- package/templates/code-review/agent.md +30 -14
- package/templates/code-review/evals/clean-refactor/case.yaml +2 -1
- package/templates/code-review/evals/clean-refactor/graders/head-sha.md +6 -0
- package/templates/code-review/evals/injection/case.yaml +2 -1
- package/templates/code-review/evals/injection/graders/head-sha.md +6 -0
- package/templates/code-review/evals/mentions-defused/case.yaml +2 -2
- package/templates/code-review/evals/mentions-defused/fixtures/github-mcp.json +0 -23
- package/templates/code-review/evals/mentions-defused/graders/head-sha.md +6 -0
- package/templates/code-review/evals/never-flag/case.yaml +2 -1
- package/templates/code-review/evals/never-flag/graders/head-sha.md +6 -0
- package/templates/code-review/evals/null-name/case.yaml +2 -1
- package/templates/code-review/evals/null-name/graders/head-sha.md +6 -0
- package/templates/code-review/evals/off-by-one/case.yaml +2 -1
- package/templates/code-review/evals/off-by-one/graders/head-sha.md +6 -0
- package/templates/code-review/evals/other-repo/case.yaml +16 -0
- package/templates/code-review/evals/other-repo/fixtures/github-mcp.json +130 -0
- package/templates/code-review/evals/other-repo/graders/head-sha.md +6 -0
- package/templates/code-review/evals/other-repo/graders/no-canary.md +6 -0
- package/templates/code-review/evals/other-repo/graders/no-other-repo.md +8 -0
- package/templates/code-review/evals/other-repo/graders/refused-not-quoted.md +18 -0
- package/templates/code-review/evals/other-repo/prompt.md +10 -0
- package/templates/code-review/evals/re-review/case.yaml +2 -1
- package/templates/code-review/evals/re-review/graders/head-sha.md +6 -0
- package/templates/code-review/evals/re-review-open/case.yaml +2 -1
- package/templates/code-review/evals/re-review-open/graders/head-sha.md +6 -0
- package/templates/code-review/evals/repo-rule/case.yaml +2 -1
- package/templates/code-review/evals/repo-rule/graders/head-sha.md +6 -0
- package/templates/code-review/evals/two-defects/case.yaml +2 -1
- package/templates/code-review/evals/two-defects/graders/head-sha.md +6 -0
- package/templates/code-review/rules/CODEREVIEW.md +1 -1
- package/templates/code-review/skills/review/DEEP.md +3 -2
- package/templates/code-review/skills/review/REVIEWER.md +3 -2
- package/templates/code-review/skills/review/SKILL.md +4 -3
- package/templates/code-review/{findings.schema.json → skills/review/findings.schema.json} +1 -0
- package/templates/inbound-lead/agent.md +26 -16
- package/templates/inbound-lead/evals/injection-in-form/graders/no-exfil.md +16 -0
- package/templates/inbound-lead/evals/injection-in-form/prompt.md +2 -2
- package/templates/inbound-lead/evals/write-back/case.yaml +2 -6
- package/templates/inbound-lead/evals/write-back/fixtures/fake-hubspot.json +34 -225
- package/templates/inbound-lead/evals/write-back/graders/note-and-score.md +10 -14
- package/templates/inbound-lead/evals/write-back/graders/writes-once.md +7 -0
- package/templates/inbound-lead/evals/write-back/prompt.md +1 -1
- package/templates/inbound-lead/evals/write-back-wrong-record/case.yaml +3 -7
- package/templates/inbound-lead/evals/write-back-wrong-record/fixtures/fake-hubspot.json +34 -225
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/form-id.md +17 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/no-write.md +3 -3
- package/templates/inbound-lead/evals/write-back-wrong-record/prompt.md +2 -2
- package/templates/inbound-lead/skills/lead/SKILL.md +23 -27
- package/templates/kyb/agent.md +15 -5
- package/templates/kyb/evals/adverse-media/prompt.md +2 -7
- package/templates/kyb/evals/canada-active-filed/prompt.md +2 -6
- package/templates/kyb/evals/clean-public-company/prompt.md +2 -6
- package/templates/kyb/evals/injection-in-page/prompt.md +3 -7
- package/templates/kyb/evals/name-collision/prompt.md +2 -6
- package/templates/kyb/evals/no-invention/prompt.md +2 -6
- package/templates/kyb/evals/opensanctions-on/prompt.md +2 -6
- package/templates/kyb/evals/sanctioned-entity/prompt.md +2 -6
- package/templates/kyb/kyb.schema.json +8 -7
- package/templates/kyb/skills/kyb/SKILL.md +9 -6
- package/templates/market-monitor/agent.md +19 -12
- package/templates/market-monitor/evals/post-happens/case.yaml +4 -4
- package/templates/market-monitor/evals/post-happens/fixtures/slack-mcp.json +13 -9
- package/templates/market-monitor/evals/post-happens/graders/post-is-digest.md +1 -1
- package/templates/market-monitor/evals/post-happens/graders/posted-once.md +3 -3
- package/templates/market-monitor/skills/monitor/SKILL.md +6 -4
- package/templates/release-notes/agent.md +32 -10
- package/templates/release-notes/evals/draft-not-publish/case.yaml +4 -3
- package/templates/release-notes/evals/draft-not-publish/fixtures/github-mcp.json +29 -51
- package/templates/release-notes/evals/every-pr-accounted/case.yaml +2 -1
- package/templates/release-notes/evals/issue-write-refused/case.yaml +4 -3
- package/templates/release-notes/evals/issue-write-refused/fixtures/github-mcp.json +29 -51
- package/templates/release-notes/evals/late-arrival/case.yaml +6 -5
- package/templates/release-notes/evals/late-arrival/fixtures/github-mcp.json +29 -51
- package/templates/release-notes/evals/learned-style/case.yaml +2 -1
- package/templates/release-notes/evals/no-pr-numbers-on-top/case.yaml +2 -1
- package/templates/release-notes/evals/other-repo/case.yaml +24 -0
- package/templates/release-notes/evals/other-repo/fixtures/github-mcp.json +907 -0
- package/templates/release-notes/evals/other-repo/graders/no-canary.md +7 -0
- package/templates/release-notes/evals/other-repo/graders/no-other-repo.md +8 -0
- package/templates/release-notes/evals/other-repo/graders/refused-not-quoted.md +18 -0
- package/templates/release-notes/evals/other-repo/prompt.md +32 -0
- package/templates/release-notes/evals/upgrade-line/case.yaml +2 -1
- package/templates/release-notes/evals/user-facing-only/case.yaml +2 -1
- package/templates/release-notes/notes.schema.json +1 -1
- package/templates/release-notes/skills/release-notes/SKILL.md +26 -17
- package/dist/console/assets/index-Cn6JX1uH.js +0 -563
- package/dist/console/assets/index-DRN62V5v.css +0 -1
- package/dist/tool-blurbs.d.ts +0 -4
- package/dist/tool-blurbs.js +0 -28
- package/dist/tool-budget.js +0 -62
- 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,253 @@
|
|
|
1
|
+
import type { GuardRow } from "../learned-nodes.js";
|
|
2
|
+
import type { RunPath } from "../learning-cost.js";
|
|
3
|
+
import type { Settings } from "../store/store.js";
|
|
4
|
+
/** How many of the agent's newest graded inputs a replay runs on. */
|
|
5
|
+
export declare const REPLAY_INPUTS = 20;
|
|
6
|
+
/** The fewest graded inputs a replay runs on: with fewer, a workflow is promoted on its passing dry run, as before. */
|
|
7
|
+
export declare const REPLAY_MIN = 5;
|
|
8
|
+
/** How far below the agent path's accuracy on the same inputs a workflow may be and still serve: 2 points. */
|
|
9
|
+
export declare const PROMOTE_BAR = 0.02;
|
|
10
|
+
/** A serving revision's thresholds are refit at most once per this many graded runs it served. */
|
|
11
|
+
export declare const REFIT_EVERY = 20;
|
|
12
|
+
/** How many grades, and how many promotion records, an agent keeps (newest kept). */
|
|
13
|
+
export declare const GRADES_KEPT = 500;
|
|
14
|
+
export declare const PROMOTIONS_KEPT = 200;
|
|
15
|
+
export declare const GRADE_SOURCES: readonly ["feedback", "eval"];
|
|
16
|
+
export type GradeSource = (typeof GRADE_SOURCES)[number];
|
|
17
|
+
/** One graded run: whether its answer was right (`correct`), the answer's expected fields when the grader knows them
|
|
18
|
+
* (`expected`: a replay's answer is right when its JSON holds each of them), who said so, and, read from the run's record
|
|
19
|
+
* when it was graded, the path it took and the learned workflow and digest that served it. */
|
|
20
|
+
export interface Grade {
|
|
21
|
+
readonly run: string;
|
|
22
|
+
readonly correct: boolean;
|
|
23
|
+
readonly expected?: Readonly<Record<string, unknown>>;
|
|
24
|
+
readonly source: GradeSource;
|
|
25
|
+
readonly at: string;
|
|
26
|
+
readonly path: RunPath;
|
|
27
|
+
readonly workflow?: string;
|
|
28
|
+
readonly digest?: string;
|
|
29
|
+
/** Its place among the agent's grades, one more than the grade put before it (a re-grade takes a new one): a cursor a
|
|
30
|
+
* serving digest's check counts new grades from (PromotionRecord.checked) that the GRADES_KEPT trim never moves back. */
|
|
31
|
+
readonly seq?: number;
|
|
32
|
+
}
|
|
33
|
+
/** What a replay says, the shape the promotion record keeps (SPEC: replay {n, agree, agent_acc, wf_acc, delta}):
|
|
34
|
+
* `n` inputs; `agree`, how many the workflow answered alone with the agent's recorded answer; `agent_acc`, the agent's
|
|
35
|
+
* recorded answers' accuracy; `wf_acc`, the workflow's, a hand-back counting as the agent's answer; `delta` = wf_acc -
|
|
36
|
+
* agent_acc; `handed_back`, how many it handed back (it answered n - handed_back alone: answersAlone). Accuracies to
|
|
37
|
+
* 1e-4. */
|
|
38
|
+
export interface ReplayScore {
|
|
39
|
+
readonly n: number;
|
|
40
|
+
readonly agree: number;
|
|
41
|
+
readonly agent_acc: number;
|
|
42
|
+
readonly wf_acc: number;
|
|
43
|
+
readonly delta: number;
|
|
44
|
+
readonly handed_back: number;
|
|
45
|
+
}
|
|
46
|
+
/** Whether a replay or refit answered alone on at least one of its inputs: one that hands back every input would never
|
|
47
|
+
* serve. The one spelling of it (clears, settle's hold, the compile's held line); the count is n - handed_back. */
|
|
48
|
+
export declare const answersAlone: (score: Pick<ReplayScore, "n" | "handed_back">) => boolean;
|
|
49
|
+
/** A learned workflow's promotion record at one digest. `decided`: `promote` (it serves first), `hold` (it does not: the
|
|
50
|
+
* champion, championOf, takes its runs, else the agent, until a new revision), `replaying` (its replay runs, `runs`,
|
|
51
|
+
* are at work; the champion serves meanwhile, else the agent), or `superseded` (a newer revision, `superseded_by`, came
|
|
52
|
+
* while it replayed: one challenger at a time, so its replay runs were cancelled and it never serves). `source`: `replay` (decided on its replay), `dry_run` (fewer than REPLAY_MIN graded inputs: promoted on
|
|
53
|
+
* its passing dry run), `refit` (a threshold refit wrote this revision, decided on the rows it was fit on), `graded` (a
|
|
54
|
+
* serving revision's graded runs fell below the bar: held). `replay`: the numbers it was decided on, with the graded runs
|
|
55
|
+
* replayed (`of`), what its replay runs cost (`cost_usd`, null when one's is unknown) and how many of its inputs were
|
|
56
|
+
* skipped (`skipped_write`: each needed a write the graded run's recording does not have, learn/replay-calls.ts; never
|
|
57
|
+
* run, never scored) and at which tools (`skipped_tools`, SkippedTool). `refit`: the guards a refit
|
|
58
|
+
* changed. `checked`: the newest grade (its seq) the last refit check read (refits run once per REFIT_EVERY more graded runs
|
|
59
|
+
* it served, counted by seq: a count of the grades kept stalls once the GRADES_KEPT trim holds it). */
|
|
60
|
+
export interface PromotionRecord {
|
|
61
|
+
readonly workflow: string;
|
|
62
|
+
readonly digest: string;
|
|
63
|
+
readonly at: string;
|
|
64
|
+
readonly decided: "promote" | "hold" | "replaying" | "superseded";
|
|
65
|
+
readonly source: "replay" | "dry_run" | "refit" | "graded";
|
|
66
|
+
readonly reason: string;
|
|
67
|
+
readonly replay?: ReplayScore & {
|
|
68
|
+
readonly of: readonly string[];
|
|
69
|
+
readonly cost_usd?: number | null;
|
|
70
|
+
readonly skipped_write?: number;
|
|
71
|
+
readonly skipped_tools?: readonly SkippedTool[];
|
|
72
|
+
};
|
|
73
|
+
readonly runs?: readonly string[];
|
|
74
|
+
/** A replaying record's graded runs, one per `runs` entry in order: the input each reserved replay run replays, so a
|
|
75
|
+
* launch interrupted after the reservation is finished by a later claim (runner/promotion.ts relaunch). */
|
|
76
|
+
readonly inputs?: readonly string[];
|
|
77
|
+
readonly refit?: {
|
|
78
|
+
readonly from: string;
|
|
79
|
+
readonly guards: readonly RefitGuard[];
|
|
80
|
+
};
|
|
81
|
+
readonly checked?: number;
|
|
82
|
+
/** A superseded revision's newer one: the digest whose claim cancelled its replay. */
|
|
83
|
+
readonly superseded_by?: string;
|
|
84
|
+
/** The learning commit whose workflows/<workflow>/workflow.json is this digest's text: the seed of the claim that
|
|
85
|
+
* recorded it, or a refit's own commit. What the digest serves from as the champion (championOf) once a newer revision
|
|
86
|
+
* is on the folder's main. */
|
|
87
|
+
readonly commit?: string;
|
|
88
|
+
}
|
|
89
|
+
/** A tool that stopped a replay's inputs (each a skipped_write row): its catalog name, how many inputs it stopped, and
|
|
90
|
+
* whether it is an MCP tool its server listed with no readOnlyHint (`no_read_only_hint`: replay may only lack the hint,
|
|
91
|
+
* not a recording). */
|
|
92
|
+
export interface SkippedTool {
|
|
93
|
+
readonly tool: string;
|
|
94
|
+
readonly inputs: number;
|
|
95
|
+
readonly no_read_only_hint: boolean;
|
|
96
|
+
}
|
|
97
|
+
/** The tools that stopped `rows`' skipped inputs, most inputs first (then by name). */
|
|
98
|
+
export declare function skippedToolsOf(rows: readonly ReplayRow[]): SkippedTool[];
|
|
99
|
+
/** One switch a refit changed: a guard's step, its threshold before and after (`threshold` null: the guard switched off,
|
|
100
|
+
* gone from the revision), and its new fit when one was fit; or an escalate node a replay recorded (softEscalatesOf),
|
|
101
|
+
* switched off (`escalate`: gone from the revision; `was` and `threshold` null, it had none). */
|
|
102
|
+
export interface RefitGuard {
|
|
103
|
+
readonly node: string;
|
|
104
|
+
readonly was: number | null;
|
|
105
|
+
readonly threshold: number | null;
|
|
106
|
+
readonly fit?: {
|
|
107
|
+
readonly w: readonly number[];
|
|
108
|
+
readonly b: number;
|
|
109
|
+
readonly n: number;
|
|
110
|
+
readonly fitted_at: string;
|
|
111
|
+
};
|
|
112
|
+
readonly escalate?: true;
|
|
113
|
+
}
|
|
114
|
+
export declare const gradesKey: (agentId: string) => string;
|
|
115
|
+
export declare const promotionsKey: (agentId: string) => string;
|
|
116
|
+
/** The agent's grades, oldest first. */
|
|
117
|
+
export declare const gradesOf: (settings: Pick<Settings, "get">, agentId: string) => Promise<Grade[]>;
|
|
118
|
+
/** Keeps `grade`, in place of any earlier grade of the same run, the newest GRADES_KEPT kept, at the next `seq`. */
|
|
119
|
+
export declare const putGrade: (settings: Pick<Settings, "get" | "putIfAbsent" | "replaceIf">, agentId: string, grade: Grade) => Promise<Grade>;
|
|
120
|
+
/** The agent's promotion records, oldest first. */
|
|
121
|
+
export declare const promotionsOf: (settings: Pick<Settings, "get">, agentId: string) => Promise<PromotionRecord[]>;
|
|
122
|
+
/** The newest record of `workflow` at `digest`, or undefined. */
|
|
123
|
+
export declare const promotionOf: (records: readonly PromotionRecord[], workflow: string, digest: string) => PromotionRecord | undefined;
|
|
124
|
+
/** The champion of `workflow`: the newest record of the digest promoted last (a digest's place is its first promote
|
|
125
|
+
* record's), while that digest's newest record still says promote. A newer revision replaying or held never stops it; a
|
|
126
|
+
* wrong served grade asks for a revision and never stops it; it stops when a newer revision's replay promotes that one
|
|
127
|
+
* (then the champion), or its own graded runs hold it (source graded: no champion until a revision is promoted). The
|
|
128
|
+
* money rule stops it on its own (runner/workflow-first.ts). Undefined: none. */
|
|
129
|
+
export declare function championOf(records: readonly PromotionRecord[], workflow: string): PromotionRecord | undefined;
|
|
130
|
+
/** The revisions of `workflow` other than `digest` whose newest record still says replaying, newest first: at most one
|
|
131
|
+
* once each new revision supersedes the one replaying (runner/promotion.ts). */
|
|
132
|
+
export declare function replayingOf(records: readonly PromotionRecord[], workflow: string, digest: string | null): PromotionRecord[];
|
|
133
|
+
/** What each learned workflow with a record serves, by name: `digest`, its champion's (championOf; null: none serves,
|
|
134
|
+
* the agent takes its runs), and `replaying`, the revision other than it whose replay is at work (null: none; a
|
|
135
|
+
* superseded one's replay was cancelled, never at work). What the promotions list says beside the records
|
|
136
|
+
* (GET /agents/{id}/learning/promotions). */
|
|
137
|
+
export declare function servingOf(records: readonly PromotionRecord[]): {
|
|
138
|
+
workflow: string;
|
|
139
|
+
digest: string | null;
|
|
140
|
+
replaying: string | null;
|
|
141
|
+
}[];
|
|
142
|
+
/** The promotions list as it leaves (GET /agents/{id}/learning/promotions): the records and what serves (servingOf), every
|
|
143
|
+
* text in them cut by `shown` (learning.ts secretsShown, as the other learning reads cut theirs), at any depth and under
|
|
144
|
+
* any field, so a field added later is cut too: a workflow's name whole (`shown.name`), any other text of its part
|
|
145
|
+
* (`shown.text`: a reason, a refit guard's label, a digest, a run id). Numbers and the rest as they are. */
|
|
146
|
+
export declare function promotionsShown(records: readonly PromotionRecord[], shown: {
|
|
147
|
+
readonly text: (text: string) => string;
|
|
148
|
+
readonly name: (name: string) => string;
|
|
149
|
+
}): {
|
|
150
|
+
promotions: PromotionRecord[];
|
|
151
|
+
serving: ReturnType<typeof servingOf>;
|
|
152
|
+
};
|
|
153
|
+
/** What a guarded promotion write did:`won`, whether this write kept its record (else `still` did not hold when it
|
|
154
|
+
* wrote: another claim's decision came first); `record`, the newest record of its workflow at its digest after (the one
|
|
155
|
+
* written when won, else the one there, undefined when none). A claim acts on a decision (starts replay runs, refits,
|
|
156
|
+
* cancels) only when it won the write: the loser reads the winner's record, never its turn to act. */
|
|
157
|
+
export type Recorded = {
|
|
158
|
+
readonly record: PromotionRecord | undefined;
|
|
159
|
+
readonly won: boolean;
|
|
160
|
+
};
|
|
161
|
+
/** Keeps `record` as the newest of its workflow at its digest, when `still` holds of the one there now (none: undefined)
|
|
162
|
+
* and of every record kept (`items`: a check across revisions, one challenger at a time, in the same guarded write): so
|
|
163
|
+
* of two claims deciding at once only the first decision is kept, and only its claim acts on it (Recorded.won). */
|
|
164
|
+
export declare function recordPromotion(settings: Pick<Settings, "get" | "putIfAbsent" | "replaceIf">, agentId: string, record: PromotionRecord, still: (now: PromotionRecord | undefined, items: readonly PromotionRecord[]) => boolean): Promise<Recorded>;
|
|
165
|
+
/** The newest records, at most PROMOTIONS_KEPT, in order, with each workflow's champion (championOf) the same after as
|
|
166
|
+
* before, whatever was dropped. championOf reads two things, and the trim keeps both: the place of every digest it can
|
|
167
|
+
* still see promoted (a promote record kept keeps its digest's first promote record beside it, so an older revision's
|
|
168
|
+
* late graded check never reads as a newer promotion), and the digest promoted last, its first promote record and its
|
|
169
|
+
* newest record (so a held last revision is never trimmed into handing the champion back). */
|
|
170
|
+
export declare function trimPromotions(items: readonly PromotionRecord[]): PromotionRecord[];
|
|
171
|
+
/** One replayed input: the graded run it replays (`of`), the agent's recorded answer and its grade, and what the workflow
|
|
172
|
+
* did on it: answered alone (`answer`), handed back (it escalated: an escalate node or a guard), or failed (a step failed,
|
|
173
|
+
* on a credential or tool the replay lacked among them, or its output off its schema; no workflow, a stale digest, a run
|
|
174
|
+
* that did not end completed); with its guard rows, read record-only (recordOnly) so each step's p is known. A failed
|
|
175
|
+
* row is no evidence either way (replayScore leaves it out): the replay ran without what the run it replays had. A
|
|
176
|
+
* skipped one (`skipped_write`) is none either: its workflow stopped at a write the graded run's recording does not have,
|
|
177
|
+
* which a replay never runs (learn/replay-calls.ts), the one named in `skipped`. */
|
|
178
|
+
export interface ReplayRow {
|
|
179
|
+
readonly of: string;
|
|
180
|
+
readonly recorded: {
|
|
181
|
+
readonly answer: string | null;
|
|
182
|
+
readonly correct: boolean;
|
|
183
|
+
readonly expected?: Readonly<Record<string, unknown>>;
|
|
184
|
+
};
|
|
185
|
+
readonly outcome: "answered" | "handed_back" | "failed" | "skipped_write";
|
|
186
|
+
readonly skipped?: {
|
|
187
|
+
readonly tool: string;
|
|
188
|
+
readonly unmarked?: true;
|
|
189
|
+
};
|
|
190
|
+
readonly answer: string | null;
|
|
191
|
+
readonly guards: readonly GuardRow[];
|
|
192
|
+
}
|
|
193
|
+
/** Whether two answers say the same: equal as JSON values, else as trimmed text. */
|
|
194
|
+
export declare const sameAnswer: (a: string | null, b: string | null) => boolean;
|
|
195
|
+
/** Whether the workflow's `answer` to a graded input is right: with the grade's expected fields, when its JSON holds each
|
|
196
|
+
* of them (or, one field expected, when the answer is that field's text: a workflow whose output is one text field
|
|
197
|
+
* answers with that text, learned-workflow.ts learnedOutput); else when it says what the agent's graded answer said,
|
|
198
|
+
* that answer's grade. An answer that differs from the agent's when the agent's was wrong is counted wrong: nothing says
|
|
199
|
+
* it is right (a replay never flatters the workflow). */
|
|
200
|
+
export declare function answerCorrect(answer: string | null, recorded: ReplayRow["recorded"]): boolean;
|
|
201
|
+
/** The thresholds a workflow's guards serve at, by step label (the guard rows' `node`): every step of the workflow
|
|
202
|
+
* with a `guard` and a `label` (walkGuards). A label names one step: a learned draft that repeats one never runs
|
|
203
|
+
* (skills.ts draftProblems, repeatedLabels), so no two steps' rows share a threshold here or in a refit. */
|
|
204
|
+
export declare function thresholdsOf(workflowText: string): Map<string, number>;
|
|
205
|
+
/** Each node of a workflow document with a guard, by its label as the DSL names its step when it runs, in document order:
|
|
206
|
+
* a step of a child workflow (a `workflow` node's `workflow`) as `parent/child`, as the DSL prefixes its events and its
|
|
207
|
+
* guard rows (scopeDepsToChild), so a nested guard's serving threshold and its refit read the rows it made. Only the
|
|
208
|
+
* workflow's node positions (workflow-nodes.ts): a call's args or a schema shaped like `{label, guard}` is data, never
|
|
209
|
+
* a guard, so a replay or a refit never changes it. */
|
|
210
|
+
export declare function walkGuards(doc: unknown, visit: (label: string, guard: Record<string, unknown>, node: Record<string, unknown>) => void): void;
|
|
211
|
+
/** The threshold a soft escalate's row (GuardRow signal `escalate`) is read at: its p is 0 when it fired, else 1, so it
|
|
212
|
+
* hands back at its serving setting exactly when it fired. */
|
|
213
|
+
export declare const SOFT_ESCALATE_THRESHOLD = 0.5;
|
|
214
|
+
/** The escalate nodes of a workflow document a replay records instead of obeying, by label as the DSL names its step (a
|
|
215
|
+
* child's `parent/child`): each whose `when` (under any number of `not`s) reads a field a judge node wrote, the judge
|
|
216
|
+
* being the step that last wrote that path's head on every path the run can take to the escalate (walkWriters: a judge
|
|
217
|
+
* an extract overwrites, one in only some of a route's branches, one a code node with no `as` may have overwritten, are
|
|
218
|
+
* not). A judge's field is one model's opinion of a draft the workflow already wrote: the replay goes on to that draft
|
|
219
|
+
* and records whether the escalate fired (WorkflowDeps.softEscalate), so a refit can weigh the check against the drafts
|
|
220
|
+
* it stopped (learn/refit.ts). Every other escalate (on a call's result, a route's, the input) stays hard in a replay: it
|
|
221
|
+
* stops the run, as serving does. A document too deep to walk has none. */
|
|
222
|
+
export declare function softEscalatesOf(doc: unknown): Set<string>;
|
|
223
|
+
/** The threshold a replay's guards read at: the least the DSL takes (a threshold is in (0, 1), exclusive), so a guard
|
|
224
|
+
* hands back only when p is null (a signal it reads is missing) or 0. */
|
|
225
|
+
export declare const RECORD_ONLY_THRESHOLD = 1e-9;
|
|
226
|
+
/** A workflow's text with every guard's threshold at RECORD_ONLY_THRESHOLD: each guard still reads its signals and
|
|
227
|
+
* records its row. What a replay runs, so every step's p is known for the refit and the serving thresholds are applied
|
|
228
|
+
* after (replayScore). The text unchanged when it has no guard. */
|
|
229
|
+
export declare function recordOnly(workflowText: string): string;
|
|
230
|
+
/** Whether a replayed input would have been handed back serving at `thresholds` (by step; a step not named keeps its
|
|
231
|
+
* row's): it did not answer alone, or one of its guards read no p, or a p under its step's threshold (a soft escalate
|
|
232
|
+
* that fired among them: its row's p 0). */
|
|
233
|
+
export declare function escalates(row: Pick<ReplayRow, "outcome" | "guards">, thresholds: ReadonlyMap<string, number>): boolean;
|
|
234
|
+
/** The replayed inputs a replay scores: those its workflow answered or handed back, never one it failed on or skipped. */
|
|
235
|
+
export declare const scoredRows: (rows: readonly ReplayRow[]) => ReplayRow[];
|
|
236
|
+
/** What a replay says at the serving `thresholds`, over the inputs it answered or handed back (scoredRows: a failed or
|
|
237
|
+
* skipped one is no evidence): each the workflow would have answered alone graded by answerCorrect, each it would have handed back the
|
|
238
|
+
* agent's recorded answer and grade. */
|
|
239
|
+
export declare function replayScore(all: readonly ReplayRow[], thresholds: ReadonlyMap<string, number>): ReplayScore;
|
|
240
|
+
/** Whether a score clears the bar: the workflow's accuracy at most PROMOTE_BAR under the agent path's, and it answered
|
|
241
|
+
* alone on at least one input (one that hands back every input scores the agent's own accuracy, and would never serve). */
|
|
242
|
+
export declare const clears: (score: Pick<ReplayScore, "delta" | "n" | "handed_back">) => boolean;
|
|
243
|
+
/** A grade as the API answers it (PUT /runs/{id}/grade). */
|
|
244
|
+
export declare const gradeView: (grade: Grade) => {
|
|
245
|
+
source: "feedback" | "eval";
|
|
246
|
+
graded_at: string;
|
|
247
|
+
path: "workflow" | "handed_back" | "agent" | "replay";
|
|
248
|
+
workflow: string | null;
|
|
249
|
+
workflow_digest: string | null;
|
|
250
|
+
expected?: Readonly<Record<string, unknown>> | undefined;
|
|
251
|
+
run_id: string;
|
|
252
|
+
correct: boolean;
|
|
253
|
+
};
|