@parcha/agentrun-serve 0.1.0-beta.36 → 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 +452 -0
- package/README.md +311 -142
- 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/attach-conformance-cli.d.ts +1 -0
- package/dist/attach-conformance-cli.js +18 -0
- package/dist/attach-conformance.d.ts +25 -0
- package/dist/attach-conformance.js +343 -0
- package/dist/browser-cost.d.ts +1 -1
- package/dist/browser-cost.js +52 -93
- package/dist/browser-live.d.ts +20 -8
- package/dist/browser-live.js +50 -27
- package/dist/cap.d.ts +0 -407
- package/dist/cap.js +4 -1028
- package/dist/catalog.d.ts +1 -12
- package/dist/catalog.js +4 -34
- package/dist/cli.js +13 -4
- package/dist/composio-preset.d.ts +53 -0
- package/dist/composio-preset.js +221 -0
- package/dist/computer-attach.d.ts +125 -0
- package/dist/computer-attach.js +330 -0
- package/dist/computer-calls.d.ts +60 -0
- package/dist/computer-calls.js +209 -0
- package/dist/computer-channel.d.ts +57 -0
- package/dist/computer-channel.js +115 -0
- package/dist/computer-commands.d.ts +1 -1
- package/dist/computer-held-routes.d.ts +35 -0
- package/dist/computer-held-routes.js +106 -0
- package/dist/computer-held.d.ts +48 -0
- package/dist/computer-held.js +87 -0
- package/dist/computer-keys.d.ts +21 -1
- package/dist/computer-keys.js +53 -11
- package/dist/computer-live.d.ts +165 -0
- package/dist/computer-live.js +655 -0
- package/dist/computer-setting.d.ts +15 -2
- package/dist/computer-setting.js +20 -4
- package/dist/computer-view.d.ts +14 -0
- package/dist/computer-view.js +51 -3
- package/dist/computer-viewer.d.ts +6 -0
- package/dist/computer-viewer.js +311 -0
- package/dist/computers.d.ts +37 -8
- package/dist/computers.js +62 -14
- 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.d.ts +9 -20
- package/dist/faux-computers.js +56 -26
- package/dist/github-connection.d.ts +10 -2
- package/dist/github-connection.js +65 -2
- package/dist/github-faux.js +1 -1
- package/dist/graph-view.d.ts +1 -1
- 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/harness.d.ts +1 -0
- package/dist/harness.js +35 -1
- package/dist/host-tools.d.ts +2 -6
- package/dist/host-tools.js +7 -10
- package/dist/hosted-search.d.ts +5 -6
- package/dist/hosted-search.js +2 -28
- package/dist/import-sources.d.ts +10 -0
- package/dist/import-sources.js +44 -2
- package/dist/import.d.ts +3 -3
- package/dist/import.js +37 -6
- package/dist/key-words.d.ts +3 -2
- package/dist/key-words.js +4 -2
- package/dist/learn/check.d.ts +10 -2
- package/dist/learn/check.js +13 -5
- package/dist/learn/commit.d.ts +14 -2
- package/dist/learn/commit.js +23 -9
- package/dist/learn/compile.d.ts +243 -0
- package/dist/learn/compile.js +471 -0
- package/dist/learn/folder.d.ts +6 -0
- package/dist/learn/folder.js +4 -1
- package/dist/learn/general.d.ts +69 -0
- package/dist/learn/general.js +75 -0
- package/dist/learn/grade.d.ts +5 -1
- package/dist/learn/grade.js +29 -7
- 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 +9 -20
- package/dist/learn/reflect.js +18 -125
- package/dist/learn/replay-calls.d.ts +63 -0
- package/dist/learn/replay-calls.js +158 -0
- package/dist/learn/skills.d.ts +50 -14
- package/dist/learn/skills.js +183 -47
- 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 +43 -3
- package/dist/learned-workflow.js +170 -28
- package/dist/learning-batch.d.ts +283 -0
- package/dist/learning-batch.js +574 -0
- package/dist/learning-cost.d.ts +18 -6
- package/dist/learning-cost.js +15 -7
- package/dist/learning-evals.d.ts +33 -0
- package/dist/learning-evals.js +98 -0
- package/dist/learning-routes.d.ts +37 -2
- package/dist/learning-routes.js +52 -8
- package/dist/learning-words.d.ts +13 -0
- package/dist/learning-words.js +13 -0
- package/dist/learning.d.ts +55 -17
- package/dist/learning.js +91 -48
- package/dist/live/stream.js +6 -3
- package/dist/live/translate.d.ts +4 -3
- package/dist/live/translate.js +8 -4
- package/dist/live-reach.d.ts +37 -0
- package/dist/live-reach.js +62 -0
- package/dist/llm.js +0 -3
- package/dist/mcp-gateway.d.ts +21 -20
- package/dist/mcp-gateway.js +76 -55
- package/dist/mcp-oauth.d.ts +62 -7
- package/dist/mcp-oauth.js +134 -19
- package/dist/mcp-pin-first.d.ts +37 -0
- package/dist/mcp-pin-first.js +107 -0
- package/dist/mcp-private-hosts.d.ts +4 -4
- package/dist/mcp-private-hosts.js +20 -12
- package/dist/mcp-probe.d.ts +27 -11
- package/dist/mcp-probe.js +60 -42
- package/dist/mcp-secret-writes.js +4 -0
- package/dist/mcp-servers-store.d.ts +115 -25
- package/dist/mcp-servers-store.js +241 -43
- package/dist/mcp-sources.d.ts +39 -0
- package/dist/mcp-sources.js +74 -0
- package/dist/mcp-store.d.ts +21 -4
- package/dist/mcp-store.js +33 -8
- 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 +26 -0
- package/dist/model-form.js +80 -0
- package/dist/model.d.ts +13 -0
- package/dist/model.js +69 -25
- package/dist/monid.d.ts +51 -25
- package/dist/monid.js +226 -140
- package/dist/openapi.js +694 -59
- package/dist/page.d.ts +18 -0
- package/dist/page.js +48 -20
- package/dist/paid-calls.d.ts +26 -29
- package/dist/paid-calls.js +46 -102
- package/dist/place-offers.d.ts +2 -3
- package/dist/place-offers.js +3 -7
- package/dist/place.js +1 -2
- package/dist/print.d.ts +15 -1
- package/dist/print.js +14 -3
- package/dist/propose.d.ts +10 -1
- package/dist/propose.js +30 -10
- package/dist/provider.js +12 -4
- package/dist/reflect-range.d.ts +8 -1
- package/dist/reflect-range.js +3 -2
- package/dist/rows.d.ts +5 -3
- package/dist/rows.js +15 -4
- package/dist/run-launch.d.ts +27 -2
- package/dist/run-launch.js +15 -4
- 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-reads-over-store.d.ts +1 -1
- package/dist/run-repo.d.ts +20 -0
- package/dist/run-repo.js +63 -0
- package/dist/run-secrets.js +2 -3
- package/dist/run-timeline-served.d.ts +1 -1
- package/dist/run-timeline-served.js +5 -2
- package/dist/run-view.d.ts +19 -8
- package/dist/run-view.js +62 -26
- package/dist/runnable.d.ts +0 -3
- package/dist/runnable.js +37 -29
- package/dist/runner/adapter-loop.d.ts +47 -17
- package/dist/runner/adapter-loop.js +1427 -303
- package/dist/runner/adapter-run-spec.d.ts +23 -9
- package/dist/runner/adapter-run-spec.js +162 -56
- package/dist/runner/adapters/pi-computer.d.ts +9 -0
- package/dist/runner/adapters/pi-computer.js +51 -0
- package/dist/runner/adapters/pi.d.ts +25 -11
- package/dist/runner/adapters/pi.js +168 -45
- package/dist/runner/beside.d.ts +7 -3
- package/dist/runner/beside.js +21 -11
- package/dist/runner/claim-secrets.d.ts +4 -0
- package/dist/runner/claim-secrets.js +6 -1
- package/dist/runner/cli-run-spec.d.ts +20 -3
- package/dist/runner/cli-run-spec.js +174 -64
- package/dist/runner/commands.d.ts +3 -1
- package/dist/runner/commands.js +28 -3
- package/dist/runner/computer-channel.d.ts +34 -0
- package/dist/runner/computer-channel.js +62 -0
- package/dist/runner/conformance/harness.d.ts +3 -0
- package/dist/runner/conformance/harness.js +224 -17
- package/dist/runner/conformance/subject.d.ts +12 -5
- package/dist/runner/dispatch.js +3 -0
- package/dist/runner/end-of-run.d.ts +23 -12
- package/dist/runner/end-of-run.js +41 -16
- package/dist/runner/feedback-round.d.ts +52 -0
- package/dist/runner/feedback-round.js +79 -0
- package/dist/runner/github-app.d.ts +2 -1
- package/dist/runner/github-app.js +4 -2
- package/dist/runner/harness-loops.js +15 -1
- package/dist/runner/held-run.d.ts +65 -0
- package/dist/runner/held-run.js +158 -0
- package/dist/runner/journal-kinds.d.ts +44 -7
- package/dist/runner/journal-kinds.js +29 -0
- package/dist/runner/journal-reader.d.ts +5 -4
- package/dist/runner/journal-reader.js +12 -10
- package/dist/runner/learning-ask.d.ts +7 -1
- package/dist/runner/learning-ask.js +21 -6
- package/dist/runner/learning-dispatch.d.ts +22 -0
- package/dist/runner/learning-dispatch.js +77 -10
- package/dist/runner/learning-end.d.ts +69 -13
- package/dist/runner/learning-end.js +340 -87
- package/dist/runner/learning-factory.d.ts +1 -1
- package/dist/runner/learning-factory.js +11 -5
- package/dist/runner/learning-loop.d.ts +86 -8
- package/dist/runner/learning-loop.js +178 -23
- package/dist/runner/learning-seed.d.ts +11 -0
- package/dist/runner/learning-seed.js +27 -0
- package/dist/runner/live-ticker.js +1 -0
- package/dist/runner/loop-contract.d.ts +26 -3
- package/dist/runner/loop.d.ts +21 -2
- package/dist/runner/loop.js +23 -2
- package/dist/runner/main.d.ts +13 -1
- package/dist/runner/main.js +27 -5
- package/dist/runner/mcp-claim.d.ts +15 -8
- package/dist/runner/mcp-claim.js +176 -71
- package/dist/runner/mcp-github.js +1 -1
- package/dist/runner/mcp-run.d.ts +21 -57
- package/dist/runner/mcp-run.js +25 -85
- package/dist/runner/meta-tools.d.ts +37 -0
- package/dist/runner/meta-tools.js +268 -0
- package/dist/runner/metrics.d.ts +11 -2
- package/dist/runner/metrics.js +26 -5
- 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/pr-checkout.d.ts +1 -0
- package/dist/runner/pr-checkout.js +1 -1
- package/dist/runner/promotion.d.ts +80 -0
- package/dist/runner/promotion.js +562 -0
- package/dist/runner/reflect-hook.d.ts +46 -13
- package/dist/runner/reflect-hook.js +149 -48
- package/dist/runner/runner.d.ts +26 -0
- package/dist/runner/runner.js +208 -17
- package/dist/runner/scratch-sweep.d.ts +13 -0
- package/dist/runner/scratch-sweep.js +62 -0
- package/dist/runner/sessions.d.ts +9 -4
- 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/store-port.d.ts +4 -2
- package/dist/runner/store-secrets.js +4 -3
- package/dist/runner/subagent.d.ts +0 -3
- package/dist/runner/subagent.js +10 -13
- package/dist/runner/workflow-first.d.ts +216 -0
- package/dist/runner/workflow-first.js +303 -0
- package/dist/runner/workflow-host.d.ts +6 -1
- package/dist/runner/workflow-host.js +1 -1
- package/dist/runner/workflow-loop.d.ts +1 -1
- package/dist/runner/workflow-loop.js +17 -10
- package/dist/runner/workflow-spec.d.ts +15 -2
- package/dist/runner/workflow-spec.js +63 -23
- package/dist/runs-over-store.d.ts +17 -3
- package/dist/runs-over-store.js +59 -20
- package/dist/seal-key.js +3 -3
- package/dist/sealed-settings-store.d.ts +5 -2
- package/dist/sealed-settings-store.js +10 -4
- package/dist/secret-writes.d.ts +5 -4
- package/dist/secret-writes.js +5 -4
- package/dist/server-secrets-store.d.ts +4 -3
- package/dist/server-secrets-store.js +15 -9
- package/dist/server-secrets.js +3 -2
- package/dist/server.d.ts +119 -18
- package/dist/server.js +841 -202
- package/dist/settings-wake.d.ts +23 -0
- package/dist/settings-wake.js +65 -0
- package/dist/standard-webhooks.d.ts +4 -1
- package/dist/standard-webhooks.js +8 -4
- package/dist/store/agent-body.d.ts +14 -3
- package/dist/store/agent-body.js +14 -10
- package/dist/store/command-wake.d.ts +13 -0
- package/dist/store/command-wake.js +37 -0
- package/dist/store/dialect.d.ts +6 -0
- package/dist/store/dialect.js +5 -0
- package/dist/store/index.d.ts +1 -1
- package/dist/store/journal/storage.d.ts +3 -2
- package/dist/store/journal/storage.js +13 -5
- package/dist/store/postgres/connection.js +3 -1
- package/dist/store/postgres/dialect.js +4 -0
- package/dist/store/postgres/migrations/0005_learning_rounds.sql +14 -0
- package/dist/store/postgres/migrations/0006_run_changes_channel_attempts.sql +57 -0
- package/dist/store/postgres/migrations/0007_viewer_host.sql +11 -0
- package/dist/store/postgres/migrations/0008_paired_computers.sql +30 -0
- package/dist/store/postgres/migrations/0009_commands_answer.sql +10 -0
- 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 +10 -1
- package/dist/store/schema.js +104 -15
- 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 +7 -5
- package/dist/store/sqlite/run-patch.js +45 -18
- package/dist/store/sqlite/store.js +331 -72
- package/dist/store/store.d.ts +312 -21
- package/dist/store/store.js +12 -1
- package/dist/store-reads/cap.d.ts +1 -1
- package/dist/store-reads/cap.js +8 -1
- package/dist/store-reads/decisions.d.ts +2 -2
- package/dist/store-reads/decisions.js +1 -1
- package/dist/store-reads/import-summary.d.ts +1 -1
- package/dist/store-reads/journal.d.ts +30 -5
- package/dist/store-reads/journal.js +128 -56
- package/dist/store-reads/learning.d.ts +114 -12
- package/dist/store-reads/learning.js +238 -48
- package/dist/store-reads/loop.d.ts +61 -0
- package/dist/store-reads/loop.js +111 -0
- package/dist/store-reads/runs.d.ts +1 -1
- package/dist/store-reads/workflow.d.ts +1 -1
- package/dist/store-view.d.ts +6 -0
- package/dist/store-view.js +59 -26
- package/dist/template-eval.d.ts +18 -9
- package/dist/template-eval.js +95 -68
- package/dist/template-github-permissions.d.ts +24 -10
- package/dist/template-github-permissions.js +36 -15
- 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 +22 -1
- package/dist/timeline/timeline.js +34 -18
- package/dist/timeline/util.d.ts +4 -0
- package/dist/timeline/util.js +14 -0
- package/dist/tool-gate.d.ts +84 -50
- package/dist/tool-gate.js +179 -101
- 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 +33 -27
- package/dist/tool-plane.js +72 -39
- package/dist/tools.d.ts +32 -7
- package/dist/tools.js +37 -24
- package/dist/trigger-adapter.d.ts +4 -0
- package/dist/trigger-secrets-shown.d.ts +2 -2
- package/dist/trigger-secrets-shown.js +1 -1
- package/dist/trigger-signatures.d.ts +25 -6
- package/dist/trigger-signatures.js +41 -7
- package/dist/trigger-targets.d.ts +2 -0
- package/dist/trigger-targets.js +1 -0
- package/dist/trigger-webhook.js +5 -2
- package/dist/triggers.d.ts +7 -3
- package/dist/triggers.js +35 -5
- package/dist/turns.js +16 -1
- package/dist/validate.d.ts +15 -7
- package/dist/validate.js +102 -45
- package/dist/web-fetch.d.ts +2 -8
- package/dist/web-fetch.js +2 -22
- package/dist/web-search.d.ts +10 -5
- package/dist/web-search.js +7 -6
- package/dist/webhooks.d.ts +145 -102
- package/dist/webhooks.js +559 -322
- package/dist/workflow/decisions.d.ts +1 -1
- package/dist/workflow/node-runner.d.ts +2 -1
- package/dist/workflow/node.d.ts +2 -1
- package/dist/workflow/node.js +3 -1
- package/dist/workflow/pi-versions.d.ts +23 -0
- package/dist/workflow/pi-versions.js +57 -0
- package/dist/workflow/record-tool.d.ts +2 -1
- package/dist/workflow/store.d.ts +1 -1
- package/dist/workflow/task.js +3 -2
- package/dist/workflow-run.d.ts +1 -1
- package/dist/workspace/attached-computers.d.ts +41 -0
- package/dist/workspace/attached-computers.js +114 -0
- package/dist/workspace/computer-deps.d.ts +19 -9
- package/dist/workspace/computer-deps.js +24 -9
- package/dist/workspace/computer-for-claim.d.ts +23 -8
- package/dist/workspace/computer-for-claim.js +92 -33
- package/dist/workspace/computer-hold.d.ts +11 -27
- package/dist/workspace/computer-hold.js +41 -55
- package/dist/workspace/computer-ledger.d.ts +3 -1
- package/dist/workspace/computer-ledger.js +4 -0
- package/dist/workspace/computer-mcp.d.ts +25 -0
- package/dist/workspace/computer-mcp.js +41 -0
- package/dist/workspace/computer-ports.d.ts +4 -13
- package/dist/workspace/computer-ports.js +4 -107
- package/dist/workspace/computer-script.d.ts +53 -0
- package/dist/workspace/computer-script.js +172 -0
- package/dist/workspace/executors.d.ts +1 -1
- package/dist/workspace/index.d.ts +4 -2
- package/dist/workspace/index.js +3 -1
- package/dist/workspace/kind-skills/desktop/SKILL.md +132 -84
- package/dist/workspace/kind-skills/phone/SKILL.md +104 -85
- package/dist/workspace/local.js +2 -2
- package/dist/workspace/resolve-computer.d.ts +24 -1
- package/dist/workspace/resolve-computer.js +40 -16
- package/dist/workspace/run-tools.d.ts +56 -21
- package/dist/workspace/run-tools.js +55 -34
- package/dist/wrap-up.d.ts +21 -0
- package/dist/wrap-up.js +21 -0
- package/launcher/agentrun-serve +4 -2
- package/package.json +19 -16
- 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-BI4Byidu.js +0 -550
- package/dist/console/assets/index-C19gUF2n.css +0 -1
- package/dist/run-db.d.ts +0 -53
- package/dist/run-db.js +0 -116
- package/dist/tool-blurbs.d.ts +0 -4
- package/dist/tool-blurbs.js +0 -28
- package/dist/tool-budget.d.ts +0 -26
- package/dist/tool-budget.js +0 -56
- package/dist/workflow/readers.d.ts +0 -36
- package/dist/workflow/readers.js +0 -145
- package/dist/workflow/wal.d.ts +0 -11
- package/dist/workflow/wal.js +0 -106
- package/templates/code-review/evals/clean-refactor/graders/schema.md +0 -5
- package/templates/code-review/evals/injection/graders/schema.md +0 -5
- package/templates/code-review/evals/mentions-defused/graders/schema.md +0 -5
- package/templates/code-review/evals/never-flag/graders/schema.md +0 -5
- package/templates/code-review/evals/null-name/graders/schema.md +0 -5
- package/templates/code-review/evals/off-by-one/graders/schema.md +0 -5
- package/templates/code-review/evals/re-review/graders/schema.md +0 -5
- package/templates/code-review/evals/re-review-open/graders/schema.md +0 -5
- package/templates/code-review/evals/repo-rule/graders/schema.md +0 -5
- package/templates/code-review/evals/two-defects/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/clear-disqualifier/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/injection-in-form/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/learned-correction/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/strong-fit/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/thin-data/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/write-back/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/write-back/graders/writes-twice.md +0 -7
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/proves-record.md +0 -18
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/schema.md +0 -5
- package/templates/kyb/evals/adverse-media/graders/schema.md +0 -5
- package/templates/kyb/evals/canada-active-filed/graders/schema.md +0 -5
- package/templates/kyb/evals/clean-public-company/graders/schema.md +0 -5
- package/templates/kyb/evals/injection-in-page/graders/schema.md +0 -5
- package/templates/kyb/evals/name-collision/graders/schema.md +0 -5
- package/templates/kyb/evals/no-invention/graders/schema.md +0 -5
- package/templates/kyb/evals/opensanctions-on/graders/schema.md +0 -5
- package/templates/kyb/evals/sanctioned-entity/graders/schema.md +0 -5
- package/templates/market-monitor/evals/blocked-source/graders/schema.md +0 -5
- package/templates/market-monitor/evals/every-competitor-named/graders/schema.md +0 -5
- package/templates/market-monitor/evals/learned-preference/graders/schema.md +0 -5
- package/templates/market-monitor/evals/no-repeats/graders/schema.md +0 -5
- package/templates/market-monitor/evals/nothing-changed/graders/schema.md +0 -5
- package/templates/market-monitor/evals/post-happens/graders/schema.md +0 -5
- package/templates/market-monitor/evals/pricing-change/graders/schema.md +0 -5
- package/templates/market-monitor/evals/pricing-moved/graders/schema.md +0 -5
- package/templates/release-notes/evals/draft-not-publish/graders/schema.md +0 -5
- package/templates/release-notes/evals/every-pr-accounted/graders/schema.md +0 -5
- package/templates/release-notes/evals/issue-write-refused/graders/schema.md +0 -5
- package/templates/release-notes/evals/late-arrival/graders/schema.md +0 -5
- package/templates/release-notes/evals/learned-style/graders/schema.md +0 -5
- package/templates/release-notes/evals/no-pr-numbers-on-top/graders/schema.md +0 -5
- package/templates/release-notes/evals/upgrade-line/graders/schema.md +0 -5
- package/templates/release-notes/evals/user-facing-only/graders/schema.md +0 -5
package/dist/agent-rows.d.ts
CHANGED
|
@@ -41,8 +41,8 @@ export type AgenticBody = {
|
|
|
41
41
|
approvals?: "never";
|
|
42
42
|
maxCostUsd?: number;
|
|
43
43
|
capMode?: string;
|
|
44
|
+
inputSchema?: Record<string, unknown>;
|
|
44
45
|
outputSchema?: Record<string, unknown>;
|
|
45
|
-
maxToolCalls?: number;
|
|
46
46
|
checkout?: "pull_request";
|
|
47
47
|
};
|
|
48
48
|
export type WorkflowBody = {
|
package/dist/agents-store.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AgentRow, type NewRevision, type RevisionPlace, type RevisionRow, type Store } from "./store/index.js";
|
|
1
|
+
import { type AgentRow, type NewRevision, type RevisionPlace, type RevisionRow, type Store, type TemplatePackage } from "./store/index.js";
|
|
2
2
|
import { type DefinitionBody, type Json } from "./validate.js";
|
|
3
3
|
/** A UUIDv7: time-ordered, so a listing by (created_at, id) is stable, and unique per revision and per minted agent. Two
|
|
4
4
|
* minted in one millisecond keep their order: the 12 bits after the time count them up (RFC 9562's monotonic counter),
|
|
@@ -16,6 +16,8 @@ export type AgentEntry = {
|
|
|
16
16
|
version: number;
|
|
17
17
|
revisions: number;
|
|
18
18
|
sizes: Map<string, number>;
|
|
19
|
+
/** The template package it was applied from, as its first revision keeps it; absent or null for one made otherwise. */
|
|
20
|
+
template?: TemplatePackage | null;
|
|
19
21
|
};
|
|
20
22
|
/** Refuses a write to an externally owned agent: one that mirrors an agent in another system (its `externalRef` set) is
|
|
21
23
|
* read-only here — its source is the truth, which writes a new version by running it. Edits, set-current and archive are
|
|
@@ -36,6 +38,15 @@ export declare const externalKey: ({ source, kind, id }: ExternalRef) => string;
|
|
|
36
38
|
export declare function externalOf(agent: AgentRow, revision: RevisionRow | null): (ExternalRef & {
|
|
37
39
|
version: string | null;
|
|
38
40
|
}) | null;
|
|
41
|
+
/** What a save's check stamps on the revision it let through: its MCP pin (the granted MCP tools as their servers listed
|
|
42
|
+
* them at this save), when it grants any. */
|
|
43
|
+
export type SaveStamp = {
|
|
44
|
+
readonly mcpPin?: unknown;
|
|
45
|
+
};
|
|
46
|
+
/** A save's check (server.ts saveable): it sees the revision before anything is written, may refuse it, and answers what
|
|
47
|
+
* to stamp on it. `on`: the revision this save is built on (an edit's: the agent's current one as this try read it, so a
|
|
48
|
+
* retry on a newer one sees that one; null for a new agent), whose MCP pin a server that can't be listed keeps. */
|
|
49
|
+
export type SaveCheck = (revision: NewRevision, on: RevisionRow | null) => Promise<SaveStamp | void>;
|
|
39
50
|
/** The agent `id` as an entry, or null when there is no such agent: its row, its current revision (by the agent row's
|
|
40
51
|
* current_revision), that revision's number (newest is the count), and the skill sizes. */
|
|
41
52
|
export declare function getAgent(store: AgentsStore, id: string): Promise<AgentEntry | null>;
|
|
@@ -47,11 +58,12 @@ export declare function listAgents(store: AgentsStore, options?: {
|
|
|
47
58
|
* here is 409 agent_exists. `check` sees the revision before anything is written and may refuse it (a workflow's own
|
|
48
59
|
* check). `fresh`: the place and tools a new agent that names none is saved with (an agentic definition alone). */
|
|
49
60
|
export declare function createAgent(store: AgentsStore, { definition, skills, note }: DefinitionBody, options?: {
|
|
50
|
-
check?:
|
|
61
|
+
check?: SaveCheck;
|
|
51
62
|
fresh?: {
|
|
52
63
|
place: RevisionPlace;
|
|
53
64
|
tools: readonly string[];
|
|
54
65
|
};
|
|
66
|
+
template?: TemplatePackage;
|
|
55
67
|
}): Promise<AgentEntry>;
|
|
56
68
|
/** NewRevision from a definition and its skill files, with its note kept (note is not part of the body or its dedup). A
|
|
57
69
|
* body the validator refuses is mapped to an input refusal here (never thrown raw). Nothing is written: POST /runs makes
|
|
@@ -70,7 +82,7 @@ export declare function makeRevision(definition: Json, files: Record<string, str
|
|
|
70
82
|
* revision it does not follow. `contract`: an edit that always makes a new revision, even one equal to the current. */
|
|
71
83
|
export declare function commitAgent(store: AgentsStore, read: AgentEntry, { definition, skills, note }: DefinitionBody, { ifCurrent, check, contract }?: {
|
|
72
84
|
ifCurrent?: string | null;
|
|
73
|
-
check?:
|
|
85
|
+
check?: SaveCheck;
|
|
74
86
|
contract?: boolean;
|
|
75
87
|
}): Promise<AgentEntry>;
|
|
76
88
|
/** Makes `revisionId`, one of the agent's own, its current one (POST /agents/{id}/current). */
|
|
@@ -112,9 +124,18 @@ export declare function agentView(entry: AgentEntry, origin: string, extra?: {
|
|
|
112
124
|
} | undefined;
|
|
113
125
|
definition: Json | null;
|
|
114
126
|
kind: string | null;
|
|
127
|
+
mcp_pin: Record<string, {
|
|
128
|
+
tools: Record<string, unknown>[];
|
|
129
|
+
prices?: Record<string, number>;
|
|
130
|
+
}> | null;
|
|
115
131
|
revision: string | null;
|
|
116
132
|
revisions: number;
|
|
117
133
|
source: null;
|
|
134
|
+
template: {
|
|
135
|
+
id: string;
|
|
136
|
+
version: string;
|
|
137
|
+
sha: string | null;
|
|
138
|
+
} | null;
|
|
118
139
|
skills: {
|
|
119
140
|
path: string;
|
|
120
141
|
sha256: string;
|
|
@@ -149,4 +170,15 @@ export declare function revisionView(agent: AgentRow, row: RevisionRow & {
|
|
|
149
170
|
note: string | null;
|
|
150
171
|
created_at: string;
|
|
151
172
|
definition: Json;
|
|
173
|
+
mcp_pin: Record<string, {
|
|
174
|
+
tools: Record<string, unknown>[];
|
|
175
|
+
prices?: Record<string, number>;
|
|
176
|
+
}> | null;
|
|
152
177
|
};
|
|
178
|
+
/** A revision's MCP pin as the API shows it: per server, the granted tools as the server listed them when the revision was
|
|
179
|
+
* saved (name, title, description, input schema, annotations) and the prices its owner set for them; null when it grants
|
|
180
|
+
* no MCP tool. Never the server's URL, whose path or query may be a secret. */
|
|
181
|
+
export declare function pinView(pin: unknown): Record<string, {
|
|
182
|
+
tools: Record<string, unknown>[];
|
|
183
|
+
prices?: Record<string, number>;
|
|
184
|
+
}> | null;
|
package/dist/agents-store.js
CHANGED
|
@@ -113,10 +113,9 @@ function revisionInputOf(definition, files) {
|
|
|
113
113
|
...(isObject(definition.model_tiers) ? { modelTiers: definition.model_tiers } : {}),
|
|
114
114
|
...(typeof definition.thinking === "string" ? { thinking: definition.thinking } : {}),
|
|
115
115
|
...(definition.approvals === "ask" || definition.approvals === "never" ? { approvals: definition.approvals } : {}),
|
|
116
|
+
...(isObject(definition.input_schema) ? { inputSchema: definition.input_schema } : {}),
|
|
116
117
|
...(isObject(definition.output_schema) ? { outputSchema: definition.output_schema } : {}),
|
|
117
118
|
...(definition.checkout === "pull_request" ? { checkout: "pull_request" } : {}),
|
|
118
|
-
// The tool-call budget (tool-budget.ts): 0 keeps none.
|
|
119
|
-
...(typeof definition.max_tool_calls === "number" && definition.max_tool_calls > 0 ? { maxToolCalls: definition.max_tool_calls } : {}),
|
|
120
119
|
...common,
|
|
121
120
|
...learning,
|
|
122
121
|
...capped,
|
|
@@ -141,10 +140,14 @@ function checkPast(definition, current) {
|
|
|
141
140
|
}
|
|
142
141
|
}
|
|
143
142
|
/** Whether committing `next` would leave the agent's current revision unchanged: the same kind and body (skills are in the
|
|
144
|
-
* body as their SHA-256, so equal files are an equal body — and equal pins an equal body, keys sorted by the validator)
|
|
143
|
+
* body as their SHA-256, so equal files are an equal body — and equal pins an equal body, keys sorted by the validator),
|
|
144
|
+
* and the same MCP pin: a save after a server changed a granted tool is a new revision, pinned anew (that is how a person
|
|
145
|
+
* takes a server's changed tools). */
|
|
145
146
|
function sameRevision(current, next) {
|
|
146
|
-
return current.kind === next.kind && canonical(current.body) === canonical(next.body);
|
|
147
|
+
return current.kind === next.kind && canonical(current.body) === canonical(next.body) && canonical(current.mcpPin ?? null) === canonical(next.mcpPin ?? null);
|
|
147
148
|
}
|
|
149
|
+
/** `revision` with what its check stamped. */
|
|
150
|
+
const stamped = (revision, stamp) => (stamp?.mcpPin === undefined ? revision : { ...revision, mcpPin: stamp.mcpPin });
|
|
148
151
|
/** The byte size of each of the revision's skill files, by the SHA-256 the body keeps (from the texts on its row). */
|
|
149
152
|
function sizesOf(revision) {
|
|
150
153
|
const sizes = new Map();
|
|
@@ -168,7 +171,7 @@ export async function getAgent(store, id) {
|
|
|
168
171
|
const revisions = await store.agents.revisions(id); // oldest first (created_at, id)
|
|
169
172
|
const at = agent.currentRevision === null ? -1 : revisions.findIndex((r) => r.id === agent.currentRevision);
|
|
170
173
|
const revision = at < 0 ? null : revisions[at];
|
|
171
|
-
return { agent, revision, version: at < 0 ? 0 : at + 1, revisions: revisions.length, sizes: sizesOf(revision) };
|
|
174
|
+
return { agent, revision, version: at < 0 ? 0 : at + 1, revisions: revisions.length, sizes: sizesOf(revision), template: revisions[0]?.package ?? null };
|
|
172
175
|
}
|
|
173
176
|
/** Every agent here, newest first (its creation, then its id). Archived agents are left out by default. */
|
|
174
177
|
export async function listAgents(store, options = {}) {
|
|
@@ -187,12 +190,14 @@ export async function createAgent(store, { definition, skills = {}, note }, opti
|
|
|
187
190
|
if (given !== undefined && (await store.agents.get(given)))
|
|
188
191
|
throw new ApiError("agent_exists", `an agent ${given} exists here`);
|
|
189
192
|
// Stamped on the revision now, never resolved at run time: an agent saved with no place keeps running on the runner.
|
|
190
|
-
const
|
|
193
|
+
const placed = options.fresh && definition.place === undefined && definition.computer === undefined && !isObject(definition.workflow)
|
|
191
194
|
? { place: options.fresh.place, ...(definition.tools === undefined ? { tools: [...options.fresh.tools] } : {}) }
|
|
192
195
|
: {};
|
|
193
|
-
|
|
196
|
+
// A template's agent keeps the package it was applied from on its first revision (store `revisions.package`).
|
|
197
|
+
const made = makeRevision({ ...definition, ...placed }, skills, note);
|
|
198
|
+
const packaged = options.template ? { ...made, package: options.template } : made;
|
|
194
199
|
checkVersion(definition, 1);
|
|
195
|
-
await options.check?.(
|
|
200
|
+
const revision = stamped(packaged, await options.check?.(packaged, null));
|
|
196
201
|
const id = given ?? uuidv7();
|
|
197
202
|
const name = definition.name;
|
|
198
203
|
try {
|
|
@@ -251,8 +256,8 @@ export async function commitAgent(store, read, { definition, skills, note }, { i
|
|
|
251
256
|
for (let tries = 1;; tries++) {
|
|
252
257
|
if (tries > 1)
|
|
253
258
|
entry = held((await getAgent(store, agent.id)) ?? entry);
|
|
254
|
-
const
|
|
255
|
-
await check?.(revision);
|
|
259
|
+
const edit = editOn(entry, definition, skills, note);
|
|
260
|
+
const revision = stamped(edit, await check?.(edit, entry.revision));
|
|
256
261
|
const base = entry.revision?.id ?? null;
|
|
257
262
|
const now = held((await getAgent(store, agent.id)) ?? entry);
|
|
258
263
|
if ((now.revision?.id ?? null) === base) {
|
|
@@ -299,10 +304,10 @@ function editOn(entry, definition, skills, note) {
|
|
|
299
304
|
// No approvals here: an edit that leaves them out asks (openapi.ts DefinitionInput.approvals),
|
|
300
305
|
// so no edit makes an agent unattended by saying nothing. The console's edit sends back the approvals it read.
|
|
301
306
|
...(definition.max_cost_usd === undefined && currentBody.maxCostUsd !== undefined ? { max_cost_usd: currentBody.maxCostUsd } : {}),
|
|
302
|
-
// A tool-call budget is a limit too: an edit of an agentic revision that leaves it out keeps it.
|
|
303
|
-
...(definition.max_tool_calls === undefined && current.kind === "agentic" && !isObject(definition.workflow) && currentBody.maxToolCalls !== undefined ? { max_tool_calls: currentBody.maxToolCalls } : {}),
|
|
304
307
|
...(definition.cap_mode === undefined && currentBody.capMode !== undefined ? { cap_mode: currentBody.capMode } : {}),
|
|
305
|
-
//
|
|
308
|
+
// Its input's and its structured answer's schemas are the agent's contract with its callers: an edit that leaves
|
|
309
|
+
// one out keeps it.
|
|
310
|
+
...(definition.input_schema === undefined && current.kind === "agentic" && !isObject(definition.workflow) && currentBody.inputSchema !== undefined ? { input_schema: currentBody.inputSchema } : {}),
|
|
306
311
|
...(definition.output_schema === undefined && current.kind === "agentic" && !isObject(definition.workflow) && currentBody.outputSchema !== undefined ? { output_schema: currentBody.outputSchema } : {}),
|
|
307
312
|
// So is the checkout its runs start in (none clears it).
|
|
308
313
|
...(definition.checkout === undefined && current.kind === "agentic" && !isObject(definition.workflow) && currentBody.checkout !== undefined ? { checkout: currentBody.checkout } : {}),
|
|
@@ -349,7 +354,7 @@ export function definitionOf(agent, revision, version) {
|
|
|
349
354
|
...(body.capMode !== undefined ? { cap_mode: body.capMode } : {}),
|
|
350
355
|
};
|
|
351
356
|
const kindBody = revision.kind === "agentic"
|
|
352
|
-
? { instructions: body.instructions, ...(body.model ? { model: body.model } : {}), ...(body.modelTiers ? { model_tiers: body.modelTiers } : {}), ...(body.thinking ? { thinking: body.thinking } : {}), ...(body.learning !== undefined ? { learning: body.learning } : {}), ...(body.
|
|
357
|
+
? { instructions: body.instructions, ...(body.model ? { model: body.model } : {}), ...(body.modelTiers ? { model_tiers: body.modelTiers } : {}), ...(body.thinking ? { thinking: body.thinking } : {}), ...(body.learning !== undefined ? { learning: body.learning } : {}), ...(body.inputSchema !== undefined ? { input_schema: body.inputSchema } : {}), ...(body.outputSchema !== undefined ? { output_schema: body.outputSchema } : {}), ...(body.checkout !== undefined ? { checkout: body.checkout } : {}), ...common }
|
|
353
358
|
: { workflow: body.workflow, ...common };
|
|
354
359
|
return {
|
|
355
360
|
id: agent.id,
|
|
@@ -381,9 +386,13 @@ export function agentView(entry, origin, extra = {}) {
|
|
|
381
386
|
...(external ? { external } : {}),
|
|
382
387
|
definition: revision ? definitionOf(agent, revision, entry.version) : null,
|
|
383
388
|
kind: revision?.kind ?? null,
|
|
389
|
+
mcp_pin: pinView(revision?.mcpPin),
|
|
384
390
|
revision: revision?.id ?? null,
|
|
385
391
|
revisions: entry.revisions,
|
|
386
392
|
source: null,
|
|
393
|
+
// The template package it was applied from (its first revision keeps it): the package's id, version and the commit an
|
|
394
|
+
// imported one was read at (null for a bundled one). Null for an agent made otherwise.
|
|
395
|
+
template: entry.template ? { id: entry.template.id, version: entry.template.version, sha: entry.template.sha ?? null } : null,
|
|
387
396
|
skills: Object.entries(body.skills ?? {}).map(([path, sha]) => ({ path, sha256: sha, size_bytes: entry.sizes.get(sha) ?? null })),
|
|
388
397
|
sign_ins: extra.signIns ?? [],
|
|
389
398
|
runs: extra.runs ?? { count: 0, live: 0 },
|
|
@@ -410,5 +419,21 @@ export function revisionView(agent, row) {
|
|
|
410
419
|
note: row.note ?? null,
|
|
411
420
|
created_at: new Date(row.createdAt).toISOString(),
|
|
412
421
|
definition: definitionOf(agent, row, row.version),
|
|
422
|
+
mcp_pin: pinView(row.mcpPin),
|
|
413
423
|
};
|
|
414
424
|
}
|
|
425
|
+
/** A revision's MCP pin as the API shows it: per server, the granted tools as the server listed them when the revision was
|
|
426
|
+
* saved (name, title, description, input schema, annotations) and the prices its owner set for them; null when it grants
|
|
427
|
+
* no MCP tool. Never the server's URL, whose path or query may be a secret. */
|
|
428
|
+
export function pinView(pin) {
|
|
429
|
+
if (!isObject(pin))
|
|
430
|
+
return null;
|
|
431
|
+
const out = {};
|
|
432
|
+
for (const [server, pinned] of Object.entries(pin)) {
|
|
433
|
+
out[server] = {
|
|
434
|
+
tools: (pinned.tools ?? []).map((tool) => ({ name: tool.name, ...(tool.title ? { title: tool.title } : {}), ...(tool.description ? { description: tool.description } : {}), input_schema: tool.inputSchema ?? {}, ...(tool.annotations ? { annotations: tool.annotations } : {}) })),
|
|
435
|
+
...(pinned.prices && Object.keys(pinned.prices).length ? { prices: { ...pinned.prices } } : {}),
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
return out;
|
|
439
|
+
}
|
package/dist/answer-json.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Compile } from "typebox/schema";
|
|
1
2
|
/** The text of the last fenced `json` block in `text` (```json or a longer fence, ~~~ too), or undefined. */
|
|
2
3
|
export declare function lastJsonBlock(text: string): string | undefined;
|
|
3
4
|
/** The answer's last fenced json block, parsed, or why there is none. */
|
|
@@ -8,12 +9,30 @@ export declare function answerJson(answer: string): {
|
|
|
8
9
|
};
|
|
9
10
|
/** A JSON Schema's checker: each problem of a value against it, by path, none for a value that meets it. */
|
|
10
11
|
export type SchemaCheck = (value: unknown) => string[];
|
|
11
|
-
|
|
12
|
+
type Validator = ReturnType<typeof Compile>;
|
|
13
|
+
/** `schema` compiled to its checker (and the compiled validator, for a caller that reads each error's keyword and path),
|
|
14
|
+
* or why it does not compile. The one wrapper of the compiler: the most recent 256 schemas are kept compiled. `misses`:
|
|
15
|
+
* the same problems as `check`, each with the JSON Pointer of the value it is about apart from its words. */
|
|
12
16
|
export declare function schemaCheck(schema: unknown): {
|
|
13
17
|
check: SchemaCheck;
|
|
18
|
+
misses: (value: unknown) => {
|
|
19
|
+
path: string;
|
|
20
|
+
words: string;
|
|
21
|
+
}[];
|
|
22
|
+
validator: Validator;
|
|
14
23
|
} | {
|
|
15
24
|
why: string;
|
|
16
25
|
};
|
|
26
|
+
/** The section every harness's system prompt ends its instructions with when the agent has an output schema
|
|
27
|
+
* (definition.output_schema): the schema itself, so the model is told the shape it answers in, never left to find a file.
|
|
28
|
+
* Undefined for an agent with none (or a schema that is not an object, which a save refuses). */
|
|
29
|
+
export declare function outputContract(schema: unknown): string | undefined;
|
|
30
|
+
/** The one retry turn's message (the server's, never the person's): sent once, in the same session, when a run would end
|
|
31
|
+
* with an answer whose last json block misses its output schema. `why` is outputMiss's. */
|
|
32
|
+
export declare const outputRetryWords: (why: string) => string;
|
|
33
|
+
/** Why `answer` misses `schema`, in the retry's words (structuredAnswer's why, less MISSES), or undefined when it meets
|
|
34
|
+
* it. Undefined too when the schema does not compile (a save refuses one): asking the model again cannot mend a schema. */
|
|
35
|
+
export declare function outputMiss(answer: string, schema: unknown): string | undefined;
|
|
17
36
|
/** A final answer's structured part against an agent's output schema: the value of its last fenced json block when it
|
|
18
37
|
* meets the schema, else why not (no block, not JSON, the first problems against the schema). */
|
|
19
38
|
export declare function structuredAnswer(answer: string, schema: unknown): {
|
|
@@ -21,3 +40,17 @@ export declare function structuredAnswer(answer: string, schema: unknown): {
|
|
|
21
40
|
} | {
|
|
22
41
|
why: string;
|
|
23
42
|
};
|
|
43
|
+
/** A learned workflow's answer (`output`, as its tool hands it back: learned-workflow.ts learnedOutput) as a run serves it
|
|
44
|
+
* to an agent with output schema `schema`: the one function serving, a replay and the grade path read it through, so
|
|
45
|
+
* each sees the answer as the run presents it. No schema: the output as it is. With one: an output whose fenced json
|
|
46
|
+
* block already meets it, as it is; else its value shaped to the schema (the output as JSON when it parses, else its
|
|
47
|
+
* text; a value that is no object fills the schema's one field, oneFieldOf: a one-field workflow's bare "5462" is
|
|
48
|
+
* `{"mcc": "5462"}`, never the number; an object output is only itself), the first shape that meets the schema, fenced as the answer's one json block;
|
|
49
|
+
* `value` is what structuredAnswer reads back from `text`. None meets it: why, and the job goes back to the agent. */
|
|
50
|
+
export declare function answerAsServed(output: string, schema: unknown): {
|
|
51
|
+
text: string;
|
|
52
|
+
value: unknown;
|
|
53
|
+
} | {
|
|
54
|
+
why: string;
|
|
55
|
+
};
|
|
56
|
+
export {};
|
package/dist/answer-json.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// An answer's structured part: the last fenced `json` block of a final answer, parsed, and checked against an agent's
|
|
2
2
|
// output schema (definition.output_schema). The one reader of it: a completed agentic run's result.output (store-view.ts)
|
|
3
|
-
// and a template eval's
|
|
3
|
+
// and a template eval's target graders (template-eval.ts) read an answer's JSON alike. The runner tells the
|
|
4
|
+
// model the schema (outputContract, in every harness's system prompt) and asks once more on a miss (outputRetryWords,
|
|
5
|
+
// runner/adapter-loop.ts).
|
|
4
6
|
import { Compile } from "typebox/schema";
|
|
5
7
|
const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6
8
|
/** The text of the last fenced `json` block in `text` (```json or a longer fence, ~~~ too), or undefined. */
|
|
@@ -32,17 +34,51 @@ export function answerJson(answer) {
|
|
|
32
34
|
return { why: `the answer's last json block is not JSON: ${error.message}` };
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
|
-
/**
|
|
37
|
+
/** Compiled schemas by their JSON: an agent's runs check against the same few schemas over and over. */
|
|
38
|
+
const compiledSchemas = new Map();
|
|
39
|
+
/** `schema` compiled to its checker (and the compiled validator, for a caller that reads each error's keyword and path),
|
|
40
|
+
* or why it does not compile. The one wrapper of the compiler: the most recent 256 schemas are kept compiled. `misses`:
|
|
41
|
+
* the same problems as `check`, each with the JSON Pointer of the value it is about apart from its words. */
|
|
36
42
|
export function schemaCheck(schema) {
|
|
37
43
|
if (!isObject(schema))
|
|
38
44
|
return { why: "it is not a JSON object" };
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
const key = JSON.stringify(schema);
|
|
46
|
+
let validator = compiledSchemas.get(key);
|
|
47
|
+
if (!validator) {
|
|
48
|
+
try {
|
|
49
|
+
validator = Compile(schema);
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
return { why: `it does not compile as a JSON Schema: ${error.message}` };
|
|
53
|
+
}
|
|
54
|
+
if (compiledSchemas.size >= 256)
|
|
55
|
+
compiledSchemas.delete(compiledSchemas.keys().next().value);
|
|
56
|
+
compiledSchemas.set(key, validator);
|
|
45
57
|
}
|
|
58
|
+
const compiled = validator;
|
|
59
|
+
const misses = (value) => compiled.Errors(value)[1].map((e) => ({ path: e.instancePath, words: `${e.instancePath || "/"} ${e.message}` }));
|
|
60
|
+
return { validator: compiled, misses, check: (value) => misses(value).map((miss) => miss.words) };
|
|
61
|
+
}
|
|
62
|
+
/** The section every harness's system prompt ends its instructions with when the agent has an output schema
|
|
63
|
+
* (definition.output_schema): the schema itself, so the model is told the shape it answers in, never left to find a file.
|
|
64
|
+
* Undefined for an agent with none (or a schema that is not an object, which a save refuses). */
|
|
65
|
+
export function outputContract(schema) {
|
|
66
|
+
if (!isObject(schema))
|
|
67
|
+
return undefined;
|
|
68
|
+
return `End your final answer with exactly one \`\`\`json block that matches this JSON Schema:\n\n\`\`\`json\n${JSON.stringify(schema, null, 2)}\n\`\`\``;
|
|
69
|
+
}
|
|
70
|
+
/** The one retry turn's message (the server's, never the person's): sent once, in the same session, when a run would end
|
|
71
|
+
* with an answer whose last json block misses its output schema. `why` is outputMiss's. */
|
|
72
|
+
export const outputRetryWords = (why) => `Your final JSON did not match the output schema: ${why}. Reply again, ending with the corrected json block.`;
|
|
73
|
+
/** How structuredAnswer starts the why of a json block the schema refuses; the retry's own sentence already says it. */
|
|
74
|
+
const MISSES = "the answer's json does not meet the output schema: ";
|
|
75
|
+
/** Why `answer` misses `schema`, in the retry's words (structuredAnswer's why, less MISSES), or undefined when it meets
|
|
76
|
+
* it. Undefined too when the schema does not compile (a save refuses one): asking the model again cannot mend a schema. */
|
|
77
|
+
export function outputMiss(answer, schema) {
|
|
78
|
+
if ("why" in schemaCheck(schema))
|
|
79
|
+
return undefined;
|
|
80
|
+
const read = structuredAnswer(answer, schema);
|
|
81
|
+
return "why" in read ? read.why.replace(MISSES, "") : undefined;
|
|
46
82
|
}
|
|
47
83
|
/** A final answer's structured part against an agent's output schema: the value of its last fenced json block when it
|
|
48
84
|
* meets the schema, else why not (no block, not JSON, the first problems against the schema). */
|
|
@@ -54,5 +90,51 @@ export function structuredAnswer(answer, schema) {
|
|
|
54
90
|
if ("why" in json)
|
|
55
91
|
return json;
|
|
56
92
|
const problems = compiled.check(json.value);
|
|
57
|
-
return problems.length ? { why:
|
|
93
|
+
return problems.length ? { why: `${MISSES}${problems.slice(0, 3).join("; ")}` } : { value: json.value };
|
|
94
|
+
}
|
|
95
|
+
/** A JSON object schema's one field a bare value fills: its only property, else its only required one; undefined for
|
|
96
|
+
* any other schema. */
|
|
97
|
+
function oneFieldOf(schema) {
|
|
98
|
+
if (!isObject(schema))
|
|
99
|
+
return undefined;
|
|
100
|
+
const properties = isObject(schema.properties) ? Object.keys(schema.properties) : [];
|
|
101
|
+
if (properties.length === 1)
|
|
102
|
+
return properties[0];
|
|
103
|
+
const required = Array.isArray(schema.required) ? schema.required.filter((key) => typeof key === "string") : [];
|
|
104
|
+
return required.length === 1 ? required[0] : undefined;
|
|
105
|
+
}
|
|
106
|
+
/** A learned workflow's answer (`output`, as its tool hands it back: learned-workflow.ts learnedOutput) as a run serves it
|
|
107
|
+
* to an agent with output schema `schema`: the one function serving, a replay and the grade path read it through, so
|
|
108
|
+
* each sees the answer as the run presents it. No schema: the output as it is. With one: an output whose fenced json
|
|
109
|
+
* block already meets it, as it is; else its value shaped to the schema (the output as JSON when it parses, else its
|
|
110
|
+
* text; a value that is no object fills the schema's one field, oneFieldOf: a one-field workflow's bare "5462" is
|
|
111
|
+
* `{"mcc": "5462"}`, never the number; an object output is only itself), the first shape that meets the schema, fenced as the answer's one json block;
|
|
112
|
+
* `value` is what structuredAnswer reads back from `text`. None meets it: why, and the job goes back to the agent. */
|
|
113
|
+
export function answerAsServed(output, schema) {
|
|
114
|
+
if (schema === undefined)
|
|
115
|
+
return { text: output, value: output };
|
|
116
|
+
const compiled = schemaCheck(schema);
|
|
117
|
+
if ("why" in compiled)
|
|
118
|
+
return { why: `the agent's output schema ${compiled.why}` };
|
|
119
|
+
const written = structuredAnswer(output, schema);
|
|
120
|
+
if ("value" in written)
|
|
121
|
+
return { text: output, value: written.value };
|
|
122
|
+
const field = oneFieldOf(schema);
|
|
123
|
+
const values = [];
|
|
124
|
+
try {
|
|
125
|
+
values.push(JSON.parse(output));
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
// Not JSON: its text alone.
|
|
129
|
+
}
|
|
130
|
+
// An object output is its own shape: one that fails the schema goes back to the agent, never as its own text in a field.
|
|
131
|
+
if (!isObject(values[0]))
|
|
132
|
+
values.push(output);
|
|
133
|
+
const shapes = values.flatMap((value) => (isObject(value) || field === undefined ? [value] : [value, { [field]: value }]));
|
|
134
|
+
const meets = shapes.find((shape) => !compiled.check(shape).length);
|
|
135
|
+
if (meets !== undefined)
|
|
136
|
+
return { text: `\`\`\`json\n${JSON.stringify(meets, null, 2)}\n\`\`\``, value: meets };
|
|
137
|
+
// Said against the object shape (the one-field object a bare value fills), else the first.
|
|
138
|
+
const problems = compiled.check(shapes.find(isObject) ?? shapes[0]);
|
|
139
|
+
return { why: `its answer does not meet the agent's output schema: ${problems.slice(0, 3).join("; ")}` };
|
|
58
140
|
}
|
package/dist/api-only.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Route } from "./server.js";
|
|
|
2
2
|
/** The variable that turns the profile on. */
|
|
3
3
|
export declare const API_ONLY_ENV = "AGENTRUN_API_ONLY";
|
|
4
4
|
/** The routes (server.ts ROUTES, by name) an API-only server serves: a run's launch, read, list, timeline, messages,
|
|
5
|
-
* stop, cancel
|
|
5
|
+
* stop, cancel, cap raise and grade; its files and the uploads a launch names; an agent's Archil disk, read and removed (the
|
|
6
6
|
* agent layer of a run's disk, archil-routes.ts); capabilities, health and usage. */
|
|
7
7
|
export declare const API_ONLY_ROUTES: ReadonlySet<string>;
|
|
8
8
|
/** Whether `env` turns the profile on: `1` or `true` on; unset, empty, `0` or `false` off. Any other value is refused in
|
package/dist/api-only.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/** The variable that turns the profile on. */
|
|
2
2
|
export const API_ONLY_ENV = "AGENTRUN_API_ONLY";
|
|
3
3
|
/** The routes (server.ts ROUTES, by name) an API-only server serves: a run's launch, read, list, timeline, messages,
|
|
4
|
-
* stop, cancel
|
|
4
|
+
* stop, cancel, cap raise and grade; its files and the uploads a launch names; an agent's Archil disk, read and removed (the
|
|
5
5
|
* agent layer of a run's disk, archil-routes.ts); capabilities, health and usage. */
|
|
6
6
|
export const API_ONLY_ROUTES = new Set([
|
|
7
7
|
"createRun", "createInlineRun",
|
|
8
8
|
"getAgentArchil", "deleteAgentArchil",
|
|
9
9
|
"getRun", "listRuns", "listAllRuns", "getTimeline",
|
|
10
|
-
"sendMessage", "stopRun", "cancelRun", "raiseRunCap",
|
|
10
|
+
"sendMessage", "stopRun", "cancelRun", "raiseRunCap", "gradeRun",
|
|
11
11
|
"listRunFiles", "readRunFile",
|
|
12
12
|
"createFile", "listFiles", "getFile", "uploadFile", "deleteFile",
|
|
13
13
|
"getCapabilities", "getHealth", "getUsage",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// The attach binding's conformance cases (attach-conformance.ts) as a command, for a person checking a real driver:
|
|
2
|
+
//
|
|
3
|
+
// node dist/attach-conformance-cli.js [--port 7392] [--listen 127.0.0.1]
|
|
4
|
+
//
|
|
5
|
+
// prints the server address and a pairing code to type into the driver, runs every case once it has paired, prints PASS
|
|
6
|
+
// or FAIL for each, and exits 0 when all passed.
|
|
7
|
+
import { parseArgs } from "node:util";
|
|
8
|
+
import { runAttachConformance } from "./attach-conformance.js";
|
|
9
|
+
const { values } = parseArgs({ options: { port: { type: "string", default: "7392" }, listen: { type: "string", default: "127.0.0.1" } } });
|
|
10
|
+
const results = await runAttachConformance({
|
|
11
|
+
port: Number(values.port),
|
|
12
|
+
host: values.listen,
|
|
13
|
+
pair: () => console.log("Waiting for the driver to pair..."),
|
|
14
|
+
say: (line) => console.log(line),
|
|
15
|
+
});
|
|
16
|
+
const failed = results.filter((result) => !result.ok).length;
|
|
17
|
+
console.log(failed === 0 ? `All ${results.length} cases passed.` : `${failed} of ${results.length} cases failed.`);
|
|
18
|
+
process.exitCode = failed === 0 ? 0 : 1;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** The most of a pairing request's body this server keeps (a code and a hello): a larger one is refused 413. */
|
|
2
|
+
export declare const PAIR_BODY_MAX: number;
|
|
3
|
+
/** The cases, in the order they run: each later one needs the driver attached, and revoke ends it. */
|
|
4
|
+
export declare const ATTACH_CASES: readonly ["pair", "wrong-or-used-code", "ping", "quiet", "redial-after-close", "redial-after-drop", "binary-frame", "oversize-frame", "same-token", "revoke"];
|
|
5
|
+
export type AttachCase = (typeof ATTACH_CASES)[number];
|
|
6
|
+
export type CaseResult = {
|
|
7
|
+
readonly name: AttachCase;
|
|
8
|
+
readonly ok: boolean;
|
|
9
|
+
readonly detail: string;
|
|
10
|
+
};
|
|
11
|
+
export interface ConformanceOptions {
|
|
12
|
+
/** The port to listen on (0: any free one) and the address (127.0.0.1 by default). */
|
|
13
|
+
readonly port?: number;
|
|
14
|
+
readonly host?: string;
|
|
15
|
+
/** Every wait as a share of the protocol's (1, the default, for a real driver): heartbeat, idle and redial limits. */
|
|
16
|
+
readonly scale?: number;
|
|
17
|
+
/** How long the driver has to pair with the code (10 minutes, the code's life, by default). */
|
|
18
|
+
readonly pairMs?: number;
|
|
19
|
+
/** Told the server's address and the code: a person types them into the driver, or a test pairs its fake. */
|
|
20
|
+
readonly pair: (address: string, code: string) => void | Promise<void>;
|
|
21
|
+
/** Each line of progress. */
|
|
22
|
+
readonly say?: (line: string) => void;
|
|
23
|
+
}
|
|
24
|
+
/** Runs every case against the driver that pairs with the printed code; answers each case's result. */
|
|
25
|
+
export declare function runAttachConformance(options: ConformanceOptions): Promise<CaseResult[]>;
|