@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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BROWSER_OPENERS, BROWSER_STEPS, callFailed, endsTurn, failedWith, inputPreview, labelOf, outcomeOf, refusedLabel, savedPaths } from "./labels.js";
|
|
2
|
-
import { cut, firstLine, firstSentence, json, obj, scrubUrls, str, utf8Bytes } from "./util.js";
|
|
1
|
+
import { BROWSER_OPENERS, BROWSER_STEPS, callFailed, endsTurn, failedWith, inputPreview, labelOf, outcomeOf, refusedLabel, savedPaths, saysFailure } from "./labels.js";
|
|
2
|
+
import { cut, firstLine, firstSentence, json, obj, saidSummary, scrubUrls, str, utf8Bytes } from "./util.js";
|
|
3
3
|
import { BESIDE_SUFFIX, NOTE_SUFFIX, originMatcher, TRIGGER_LABELS } from "./origin.js";
|
|
4
4
|
/** Grep's caps, so a row is the same on both sides. `thinking` cuts the first sentence of a thinking summary. */
|
|
5
5
|
export const CAPS = { summary: 500, preview: 500, text: 2000, thinking: 100 };
|
|
@@ -213,7 +213,11 @@ function createMeter() {
|
|
|
213
213
|
function push(entry) {
|
|
214
214
|
const message = entry.model?.[0];
|
|
215
215
|
const data = obj(entry.data);
|
|
216
|
-
if (entry.kind ===
|
|
216
|
+
if (entry.kind === "pi.assistant" && entry.recordedCall && message) {
|
|
217
|
+
// A call the loop's record kept (a CLI's, or one a tool of pi's nested): shown as an answer's call, never a request.
|
|
218
|
+
return "call";
|
|
219
|
+
}
|
|
220
|
+
else if (entry.kind === REQUEST_REFUSED) {
|
|
217
221
|
refused += 1;
|
|
218
222
|
}
|
|
219
223
|
else if (entry.kind === "pi.assistant" && refused > 0 && message?.stopReason === "error") {
|
|
@@ -563,12 +567,13 @@ function createProjector(options) {
|
|
|
563
567
|
// is still read from the output as it came: one whose redacted output gives no words reads failed with no detail, never
|
|
564
568
|
// ok, and never the detail as it came.
|
|
565
569
|
const worded = shown.text === view.text ? outcome : outcomeOf(tool.name, { ...view, text: shown.text });
|
|
566
|
-
// A call refused before it ran is named refused already (refusedLabel)
|
|
567
|
-
|
|
570
|
+
// A call refused before it ran is named refused already (refusedLabel), and a computer step's label says it could not
|
|
571
|
+
// (saysFailure): its row says why, never that it failed.
|
|
572
|
+
const failedSummary = refused(view) || saysFailure(tool.name) ? `${named}: ${failure(shown.text)}` : `${named} failed: ${failure(shown.text)}`;
|
|
568
573
|
return make("tool_result", conv, rowId, {
|
|
569
574
|
summary: !view.isError && pageChanged(tool.name, view) ? PAGE_CHANGED_ROW : view.isError ? failedSummary : worded ? `${named}: ${saidOf(worded.text)}` : outcome?.failed ? `${named}: failed` : `${named}: ok`, tool_name: tool.name, tool_use_id: tool.callId,
|
|
570
575
|
tool_status: failedWith(view, outcome) ? "failed" : "success", tool_result_preview: shown.text ? cut(scrubUrls(shown.text), caps.preview) : null,
|
|
571
|
-
tool_result_size_bytes: utf8Bytes(view.text), round: tool.round, parent_tool_use_id: parent,
|
|
576
|
+
tool_result_size_bytes: utf8Bytes(view.text), round: tool.round, parent_tool_use_id: parent, ...(refused(view) ? { refused: true } : {}),
|
|
572
577
|
});
|
|
573
578
|
};
|
|
574
579
|
/** The call a browser charge belongs to (BROWSER_CHARGE): the one it names, else its session's last charged call, else
|
|
@@ -669,13 +674,18 @@ function createProjector(options) {
|
|
|
669
674
|
const tool = str(data?.tool) ?? "a tool";
|
|
670
675
|
add(make("phase", conv, base, { summary: `Not metered: ${tool} has no price set, so it is outside the run's cost`, tool_name: tool, tool_use_id: str(data?.call) ?? null }));
|
|
671
676
|
}
|
|
672
|
-
else if ((metered === "answer" || metered === "continued") && message) {
|
|
677
|
+
else if ((metered === "answer" || metered === "call" || metered === "continued") && message) {
|
|
673
678
|
const round = metered === "continued" && answers.has(conv) ? answers.get(conv) : entry.id;
|
|
674
|
-
if (metered
|
|
679
|
+
if (metered !== "continued")
|
|
675
680
|
answers.set(conv, entry.id);
|
|
676
681
|
if (message.stopReason === "error") {
|
|
677
682
|
const why = redactedWhy(str(message.errorMessage) ?? "unknown error");
|
|
678
|
-
|
|
683
|
+
// One with no price of its own (a provider's refusal sends none) is a cost unknown, never $0: the provider may
|
|
684
|
+
// still bill it (run-adapters answeredUnpriced). Its row says so, as the usage row counts it "not priced".
|
|
685
|
+
const priced = Number.isFinite(obj(obj(message.usage)?.cost)?.total);
|
|
686
|
+
// The note is ours, so it stays whole: only the provider's words give way when the summary's cap (make) would cut it.
|
|
687
|
+
const [head, note] = ["Model request failed: ", priced ? "" : UNPRICED_FAILURE];
|
|
688
|
+
add(make("error", conv, base, { summary: `${head}${cut(firstLine(why), Math.max(0, caps.summary - head.length - note.length))}${note}`, text: why }));
|
|
679
689
|
}
|
|
680
690
|
else if (message.stopReason !== "aborted") {
|
|
681
691
|
const blocks = blocksOf(message);
|
|
@@ -695,7 +705,7 @@ function createProjector(options) {
|
|
|
695
705
|
// say. A message with no text block (a request the adapter bridge writes without content) shows none.
|
|
696
706
|
// An answer its turn goes on from is a text_block (provisional, below), an empty one too.
|
|
697
707
|
if (text || (final && first("text") >= 0)) {
|
|
698
|
-
const row = make(final ? "final_answer" : "text_block", conv, `${base}:${first("text")}`, { summary:
|
|
708
|
+
const row = make(final ? "final_answer" : "text_block", conv, `${base}:${first("text")}`, { summary: saidSummary(text), text });
|
|
699
709
|
add(row);
|
|
700
710
|
if (final) {
|
|
701
711
|
const earlier = provisional.get(conv);
|
|
@@ -732,7 +742,7 @@ function createProjector(options) {
|
|
|
732
742
|
const named = nameFor(name, args, before.view, before.shown);
|
|
733
743
|
use.summary = clean(named, caps.summary);
|
|
734
744
|
const fresh = resultRow(conv, before.row.id, { name, callId: id, round }, named, before.view, before.shown);
|
|
735
|
-
Object.assign(before.row, { summary: fresh.summary, tool_name: fresh.tool_name, tool_status: fresh.tool_status, seq: (use.seq ?? 0) + 0.5, ...(round === undefined ? {} : { round }) });
|
|
745
|
+
Object.assign(before.row, { summary: fresh.summary, tool_name: fresh.tool_name, tool_status: fresh.tool_status, seq: (use.seq ?? 0) + 0.5, ...(round === undefined ? {} : { round }), ...(fresh.refused ? { refused: true } : {}) });
|
|
736
746
|
rows.splice(rows.indexOf(before.row), 1);
|
|
737
747
|
rows.splice(rows.indexOf(use) + 1, 0, before.row);
|
|
738
748
|
touch(before.row);
|
|
@@ -768,7 +778,7 @@ function createProjector(options) {
|
|
|
768
778
|
if (!view.isError) {
|
|
769
779
|
const answer = str(args.answer);
|
|
770
780
|
if (name === "submit" && answer !== undefined)
|
|
771
|
-
add(make("final_answer", conv, `${base}:answer`, { summary:
|
|
781
|
+
add(make("final_answer", conv, `${base}:answer`, { summary: saidSummary(answer), text: answer }));
|
|
772
782
|
if (name === "request_sign_in") {
|
|
773
783
|
const reason = str(args.reason);
|
|
774
784
|
add(make("waiting", conv, `${base}:waiting`, { summary: `Waiting for you: ${reason ? firstLine(reason) : "sign in on the live browser"}` }));
|
|
@@ -792,10 +802,11 @@ function createProjector(options) {
|
|
|
792
802
|
systems.add(conv);
|
|
793
803
|
}
|
|
794
804
|
else if (entry.kind === "pi.reset") {
|
|
795
|
-
|
|
805
|
+
// The new context and a summary of the older one are words from the run: redacted by the host, before any cut.
|
|
806
|
+
add(make("phase", conv, base, { summary: "Context reset", text: redactText(textOf(message)) || null }));
|
|
796
807
|
}
|
|
797
808
|
else if (entry.kind === "pi.compaction") {
|
|
798
|
-
add(make("phase", conv, base, { summary: "Summarized older context", text: textOf(message) || null }));
|
|
809
|
+
add(make("phase", conv, base, { summary: "Summarized older context", text: redactText(textOf(message)) || null }));
|
|
799
810
|
}
|
|
800
811
|
else if (entry.kind === HOST_PHASE) {
|
|
801
812
|
// A step the host stamped (`at`, ms) shows at that time: written as it happened, it can sit after a message whose time
|
|
@@ -923,7 +934,7 @@ function createProjector(options) {
|
|
|
923
934
|
if (!counted || root === undefined)
|
|
924
935
|
return undefined;
|
|
925
936
|
const { usd, requests, charges, so_far_usd, unpriced, not_metered } = counted;
|
|
926
|
-
const paid =
|
|
937
|
+
const paid = toolCallWords(charges, not_metered);
|
|
927
938
|
const spent = usd !== null ? dollars(usd) : so_far_usd !== undefined && unpriced !== undefined ? `${dollars(so_far_usd)} known, ${unpriced} not priced,` : "unknown";
|
|
928
939
|
return make("usage", root, `${root}:usage`, {
|
|
929
940
|
// A run whose only request its cap refused sent none, and says so; otherwise what is known so far (costsofar/1).
|
|
@@ -948,6 +959,11 @@ function createProjector(options) {
|
|
|
948
959
|
export const COST_SO_FAR = "Cost so far";
|
|
949
960
|
export const COST_ENDED = "Cost";
|
|
950
961
|
export const costLabel = (ended) => (ended ? COST_ENDED : COST_SO_FAR);
|
|
962
|
+
/** What a failed model request's row adds when no price came back for it. */
|
|
963
|
+
const UNPRICED_FAILURE = " (its cost is unknown: the provider sent no price and may still bill it)";
|
|
964
|
+
/** The usage row's words after its model requests: its paid tool calls (`charges`) and its tool calls with no price
|
|
965
|
+
* (`notMetered`), each said only when there is one, the same on every harness (store-reads/journal.ts bookedUsage). */
|
|
966
|
+
export const toolCallWords = (charges, notMetered = 0) => `${charges ? ` and ${charges} paid tool call${charges === 1 ? "" : "s"}` : ""}${notMetered ? `; ${notMetered} tool call${notMetered === 1 ? "" : "s"} not metered` : ""}`;
|
|
951
967
|
/** `row` as an ended run's: a usage row made while it ran ("Cost so far: …") says its cost ("Cost: …"); any other row as
|
|
952
968
|
* it is. For a host that keeps rows read before the run ended. */
|
|
953
969
|
export function endedUsage(row) {
|
|
@@ -962,7 +978,7 @@ export function timelineOf(entries, options = {}) {
|
|
|
962
978
|
if (options.settled)
|
|
963
979
|
for (const [id, call] of projector.open())
|
|
964
980
|
projector.interrupt(call, id);
|
|
965
|
-
const usage = projector.usage();
|
|
981
|
+
const usage = projector.usage(options.turnCut === true);
|
|
966
982
|
return usage ? [...projector.rows(), usage] : [...projector.rows()];
|
|
967
983
|
}
|
|
968
984
|
/** The id of the call a run's turn ended waiting on a person by, or undefined: its last meaningful row is a successful tool
|
|
@@ -1016,7 +1032,7 @@ export function runMetricsWithDecisions(records, decisions) {
|
|
|
1016
1032
|
}
|
|
1017
1033
|
const message = entry.model?.[0];
|
|
1018
1034
|
const metered = meter.push(entry);
|
|
1019
|
-
if ((metered === "answer" || metered === "continued") && message && message.stopReason !== "error" && message.stopReason !== "aborted") {
|
|
1035
|
+
if ((metered === "answer" || metered === "call" || metered === "continued") && message && message.stopReason !== "error" && message.stopReason !== "aborted") {
|
|
1020
1036
|
for (const block of blocksOf(message)) {
|
|
1021
1037
|
const [id, name] = [str(block.id), str(block.name)];
|
|
1022
1038
|
if (block.type !== "toolCall" || !id || !name)
|
|
@@ -1123,7 +1139,7 @@ export function timelineReducer(options = {}) {
|
|
|
1123
1139
|
const shown = options.redactLive ? options.redactLive(raw) : fallback();
|
|
1124
1140
|
// The agent's text streams as it will settle, its URLs whole; its thinking is scrubbed, as when it settles.
|
|
1125
1141
|
const text = kind === "thinking" ? scrubUrls(shown) : shown;
|
|
1126
|
-
const summary = kind === "thinking" ? `Thinking: ${cut(firstSentence(text), thinkingCap)}` :
|
|
1142
|
+
const summary = kind === "thinking" ? `Thinking: ${cut(firstSentence(text), thinkingCap)}` : saidSummary(text);
|
|
1127
1143
|
live(kind, `${conv()}:live:${kind}`, text ? summary : undefined, { text });
|
|
1128
1144
|
}
|
|
1129
1145
|
};
|
package/dist/timeline/util.d.ts
CHANGED
|
@@ -3,6 +3,10 @@ export declare const obj: (value: unknown) => Obj | undefined;
|
|
|
3
3
|
export declare const str: (value: unknown) => string | undefined;
|
|
4
4
|
export declare const cut: (text: string, max: number) => string;
|
|
5
5
|
export declare const firstLine: (text: string) => string;
|
|
6
|
+
/** The summary of the agent's words (an answer, a text block): their first line; words that open with a fenced code block
|
|
7
|
+
* (a JSON answer's ```json … ```) the code inside the fence, up to its closing fence, each whitespace run one space, so
|
|
8
|
+
* the row previews the code itself, never the fence's label. The row's text keeps the words whole. */
|
|
9
|
+
export declare const saidSummary: (text: string) => string;
|
|
6
10
|
export declare const firstSentence: (text: string) => string;
|
|
7
11
|
export declare function utf8Bytes(text: string): number;
|
|
8
12
|
export declare function json(text: string): Obj | undefined;
|
package/dist/timeline/util.js
CHANGED
|
@@ -2,6 +2,20 @@ export const obj = (value) => typeof value === "object" && value !== null && !Ar
|
|
|
2
2
|
export const str = (value) => (typeof value === "string" ? value : undefined);
|
|
3
3
|
export const cut = (text, max) => (text.length > max ? `${text.slice(0, max - 3)}...` : text);
|
|
4
4
|
export const firstLine = (text) => text.split("\n").map((line) => line.trim()).find(Boolean) ?? "";
|
|
5
|
+
/** The summary of the agent's words (an answer, a text block): their first line; words that open with a fenced code block
|
|
6
|
+
* (a JSON answer's ```json … ```) the code inside the fence, up to its closing fence, each whitespace run one space, so
|
|
7
|
+
* the row previews the code itself, never the fence's label. The row's text keeps the words whole. */
|
|
8
|
+
export const saidSummary = (text) => {
|
|
9
|
+
// A fence's info string (its language) holds no backtick, so an inline ```code``` on one line is no fence.
|
|
10
|
+
const open = /^\s*(`{3,}|~{3,})[^\n`]*\n/.exec(text);
|
|
11
|
+
if (!open)
|
|
12
|
+
return firstLine(text);
|
|
13
|
+
const body = text.slice(open[0].length);
|
|
14
|
+
// Its closing fence (CommonMark): the same character, at least as many of it as the opening fence, alone on its line,
|
|
15
|
+
// indented at most 3 spaces (4 or a tab is code inside the fence, not its close).
|
|
16
|
+
const close = body.search(new RegExp(`^ {0,3}\\${open[1][0]}{${open[1].length},}[ \\t]*$`, "m"));
|
|
17
|
+
return (close >= 0 ? body.slice(0, close) : body).replace(/\s+/g, " ").trim() || firstLine(text);
|
|
18
|
+
};
|
|
5
19
|
export const firstSentence = (text) => {
|
|
6
20
|
const flat = text.replace(/\s+/g, " ").trim();
|
|
7
21
|
return /^.*?[.!?](?=\s|$)/.exec(flat)?.[0] ?? flat;
|
package/dist/tool-gate.d.ts
CHANGED
|
@@ -2,18 +2,18 @@ import type { Workspace } from "./workspace/workspace.js";
|
|
|
2
2
|
import { type ToolSettingsRead } from "./tool-plane.js";
|
|
3
3
|
import { type SettingFrom } from "./refusal-words.js";
|
|
4
4
|
import { type Approvals } from "./approvals.js";
|
|
5
|
+
import { mcpToolName } from "./tool-names.js";
|
|
5
6
|
/** What the gate does with a tool's calls. */
|
|
6
7
|
export declare const PERMISSIONS: readonly ["allow", "ask", "deny"];
|
|
7
8
|
export type Permission = (typeof PERMISSIONS)[number];
|
|
8
|
-
|
|
9
|
-
export declare const mcpToolName: (server: string, tool: string) => string;
|
|
10
|
-
/** Whether `name` is an MCP tool's gate name. */
|
|
11
|
-
export declare const isMcpTool: (name: string) => boolean;
|
|
9
|
+
export { mcpToolName };
|
|
12
10
|
/** The MCP servers a revision grants tools of, by their catalog names (`mcp:<server>/<tool>`, a server's wildcard too), each
|
|
13
11
|
* once: what a harness that names a session's MCP tool its own way (its facts' toolAlias: OpenCode's `<server>_<tool>`) is
|
|
14
12
|
* matched against, so its call is held to that tool's settings and never to a table tool's of the same shape. */
|
|
15
13
|
export declare const mcpServersOf: (granted: readonly string[]) => string[];
|
|
16
|
-
/** A third-party catalog tool, by its name:
|
|
14
|
+
/** A third-party catalog tool, by its name: any in MCP's namespace (`mcp:<server>/<tool>`) or monid's
|
|
15
|
+
* (`monid:<provider>/<endpoint>`), a group's wildcard too; one that does not parse too, so the default for it is a
|
|
16
|
+
* catalog tool's ask. */
|
|
17
17
|
export declare const isCatalogTool: (name: string) => boolean;
|
|
18
18
|
/** Where a run's shell is, as its default permissions read it: `computer` false for a run with no computer (its bash, where
|
|
19
19
|
* it has one, runs on the run's folder's own exec: Archil's in Mode 2); undefined where no run is in view (the server's
|
|
@@ -21,7 +21,8 @@ export declare const isCatalogTool: (name: string) => boolean;
|
|
|
21
21
|
export type ShellWhere = {
|
|
22
22
|
readonly computer?: boolean;
|
|
23
23
|
};
|
|
24
|
-
/** The owner's defaults
|
|
24
|
+
/** The owner's defaults: a built-in of this server (a row of the tool list, its own tools, a computer kind's key, a
|
|
25
|
+
* decision provider's) allows; anything else asks, so a new source never defaults to allow. On a run with no computer,
|
|
25
26
|
* the kernel's ruled rule (defaultPermissionOf): bash asks first, and the background tools, which need a computer, are
|
|
26
27
|
* refused. */
|
|
27
28
|
export declare const defaultPermission: (name: string, where?: ShellWhere) => Permission;
|
|
@@ -37,23 +38,33 @@ export declare const shellToolOf: (name: string) => string | undefined;
|
|
|
37
38
|
* unasked, so watching an approved process costs no approval per page. bash: deny still refuses them. */
|
|
38
39
|
export declare const SHELL_WATCHERS: ReadonlySet<string>;
|
|
39
40
|
/** The settings keys that may set `name`'s permission, most specific first: the tool's own name, then, for an MCP
|
|
40
|
-
* tool, its server's wildcard `mcp:<server>/*`. */
|
|
41
|
+
* tool, its server's wildcard `mcp:<server>/*`, and for a monid endpoint, its provider's `monid:<provider>/*`. */
|
|
41
42
|
export declare function permissionKeys(name: string): string[];
|
|
42
|
-
/**
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
43
|
+
/** A session's `{name -> settings key}` map (nameMapOf). */
|
|
44
|
+
export type NameMap = ReadonlyMap<string, string>;
|
|
45
|
+
/** Every name a session on `harness` (with MCP servers `mcpServers`) gives its tools, to the settings key each is held to:
|
|
46
|
+
* the shell family (bash's), table, own and decision tools, read_skill_file (`read`, unless the harness's alias makes it a
|
|
47
|
+
* configured server's tool), the kinds' tools (a shared one by its first kind), nativeTools, the browser's registrations;
|
|
48
|
+
* each also as claude-agent's `mcp__hands__<name>`. The first named wins. */
|
|
49
|
+
export declare function nameMapOf(harness: string, mcpServers?: readonly string[]): NameMap;
|
|
50
|
+
/** The settings key a call named `name` on `harness` is held to: a lookup in the session's names (`names`), then the open
|
|
51
|
+
* families no list holds (a catalog name, `mcp:<server>/<tool>` or `monid:<provider>/<endpoint>`, `mcp__<server>__<tool>`,
|
|
52
|
+
* and a harness's own `<server>_<tool>` for a server of `mcpServers` only). Undefined: nothing maps it, and the gate asks
|
|
53
|
+
* (a monid endpoint's wire name is read back by the loop, ClaimMcp.catalogOf, before the gate is asked). */
|
|
54
|
+
export declare function settingsKeyOf(harness: string, name: string, mcpServers?: readonly string[], names?: NameMap): string | undefined;
|
|
51
55
|
/** A pinned argument's scalar: `null` holds for a call that leaves the argument out (or gives null). */
|
|
52
56
|
export type PinScalar = string | number | boolean | null;
|
|
53
|
-
/** A pinned argument's
|
|
54
|
-
*
|
|
55
|
-
export type
|
|
56
|
-
|
|
57
|
+
/** A pinned object argument's keys: the argument, when given (not left out, nor null), is an object whose keys are among
|
|
58
|
+
* these 1 to MAX_PIN_CHOICES names, its values free, so a write may change those fields and no other. */
|
|
59
|
+
export type PinKeys = {
|
|
60
|
+
readonly keys: readonly string[];
|
|
61
|
+
};
|
|
62
|
+
/** A pinned argument's value: one scalar the call must carry, a list of 1 to MAX_PIN_CHOICES ("one of"), or an object
|
|
63
|
+
* argument's keys (PinKeys), kept and said in its one form (canonicalChoices). */
|
|
64
|
+
export type PinValue = PinScalar | readonly PinScalar[] | PinKeys;
|
|
65
|
+
/** Whether a pin's value is a keys pin: the one form that is an object. */
|
|
66
|
+
export declare const isPinKeys: (value: unknown) => value is PinKeys;
|
|
67
|
+
/** A setting's `pin`: an MCP tool's top-level arguments, by name, each fixed to one value, one of a list, or its keys. */
|
|
57
68
|
export type Pin = Readonly<Record<string, PinValue>>;
|
|
58
69
|
/** The most arguments one setting pins, and the most values a one-of list holds. */
|
|
59
70
|
export declare const MAX_PIN_ARGS = 8;
|
|
@@ -61,26 +72,32 @@ export declare const MAX_PIN_CHOICES = 16;
|
|
|
61
72
|
/** A layer of tool settings (the server's, PUT /v2/settings/tools, or an agent's own, definition.tool_settings) as the
|
|
62
73
|
* gate reads it: a permission by settings key, and an MCP tool's pin. */
|
|
63
74
|
export type PermissionSettings = Readonly<Record<string, {
|
|
64
|
-
permission?: Permission; /**
|
|
75
|
+
permission?: Permission; /** On an MCP server's wildcard in the server's settings: its read-only tools run with no approval (readsLift). */
|
|
76
|
+
allow_reads?: true; /** Not as written: a value not offered, read as its fail-closed stand-in (tool-plane.ts checkToolSettings). Never shown. */
|
|
65
77
|
fallback?: true;
|
|
66
78
|
pin?: Pin; /** A pin in the server's settings that does not read (tool-plane.ts checkToolSettings): every call of the tool is refused. Never shown. */
|
|
67
79
|
brokenPin?: true; /** bash's policy, in an agent's own settings only (bash-read-only.ts): what its commands may do. */
|
|
68
80
|
policy?: string;
|
|
69
81
|
} | undefined>>;
|
|
70
|
-
/** A one-of list in its one form: each value once, null first, then by its JSON text;
|
|
71
|
-
* same meaning is the same text (a revision's id) and the same words (a refusal). */
|
|
82
|
+
/** A one-of list in its one form: each value once, null first, then by its JSON text; a keys pin's keys each once,
|
|
83
|
+
* sorted; a scalar as it is. The same meaning is the same text (a revision's id) and the same words (a refusal). */
|
|
72
84
|
export declare const canonicalChoices: (value: PinValue) => PinValue;
|
|
73
85
|
/** `pin` in its one form: its arguments sorted, each one-of list in its form (canonicalChoices). */
|
|
74
86
|
export declare const canonicalPin: (pin: Pin) => Pin;
|
|
75
87
|
/** A pin in words, as the refusal says it, in its one form (canonicalPin): `channel_id = C0123`, `cc absent` for a null,
|
|
76
|
-
* `event in (absent | COMMENT)` for a list. */
|
|
88
|
+
* `event in (absent | COMMENT)` for a list, `properties keys in (hs_lead_score)` for a keys pin. */
|
|
77
89
|
export declare const pinWords: (pin: Pin) => string;
|
|
78
90
|
/** Why the call of MCP tool `name` with `args` is refused by a pin, or undefined when no pin refuses it. A pin is an
|
|
79
91
|
* addition to a setting, never a permission: each layer's pin on the tool's own key holds (the agent's and the
|
|
80
|
-
* server's both, whatever the permission), and a call must carry every pinned argument as pinned: its value,
|
|
81
|
-
* its list
|
|
82
|
-
*
|
|
83
|
-
|
|
92
|
+
* server's both, whatever the permission), and a call must carry every pinned argument as pinned: its value, one of
|
|
93
|
+
* its list, or (a keys pin) an object of its keys alone, null or the argument left out. An argument both layers pin
|
|
94
|
+
* takes what holds both; where nothing does, every call is refused. `declared`: the top-level arguments the tool's
|
|
95
|
+
* listing in the run's pin declares (its inputSchema's `properties`): a pinned tool takes only those and its pinned
|
|
96
|
+
* ones, so an alias the server takes beside a pinned argument (`to` beside `recipient_email`) is refused, with no
|
|
97
|
+
* table of aliases; undefined (a listing with no `properties` object, or none known), no argument is closed. `ran`:
|
|
98
|
+
* whether an earlier attempt of the call may have been sent (deniedText's). `mismatched`: the arguments that do not
|
|
99
|
+
* hold, for the gate's log line. */
|
|
100
|
+
export declare function pinRefusal(name: string, args: unknown, server: PermissionSettings, agent?: PermissionSettings, ran?: "no" | "unknown", declared?: ReadonlySet<string>): {
|
|
84
101
|
text: string;
|
|
85
102
|
mismatched: string[];
|
|
86
103
|
} | undefined;
|
|
@@ -93,22 +110,32 @@ export declare function pinRefusal(name: string, args: unknown, server: Permissi
|
|
|
93
110
|
* layer, nor an ask that stands in for a setting that does not read. Nor is anything RunGate.enter refuses before it
|
|
94
111
|
* decides between running and parking ever lifted (a template's pin, among them). Without never, the answer is as it
|
|
95
112
|
* always was. */
|
|
96
|
-
export declare function permissionFrom(name: string, server: PermissionSettings, agent?: PermissionSettings, approvals?: Approvals, where?: ShellWhere): {
|
|
113
|
+
export declare function permissionFrom(name: string, server: PermissionSettings, agent?: PermissionSettings, approvals?: Approvals, where?: ShellWhere, effect?: ToolEffect): {
|
|
97
114
|
permission: Permission;
|
|
98
115
|
from: SettingFrom;
|
|
99
116
|
};
|
|
117
|
+
/** What an MCP tool does, by its server's annotations (the MCP spec's hints, the server's word, never checked): "read"
|
|
118
|
+
* where readOnlyHint is true; else "destructive" only where destructiveHint is true; else "write". Not the spec's
|
|
119
|
+
* default (destructiveHint true when absent): under it every tool of a server that annotates nothing would read
|
|
120
|
+
* destructive and each approval of one would need the second confirm. A write still asks. */
|
|
121
|
+
export type ToolEffect = "read" | "write" | "destructive";
|
|
122
|
+
export declare function toolEffect(annotations: unknown): ToolEffect;
|
|
123
|
+
/** MCP tool `name`'s (`mcp:<server>/<tool>`) effect as a run's pin holds it (its annotations then, toolEffect): what the
|
|
124
|
+
* run's gate (ClaimMcp.effectOf) and a settings save's wake (settings-wake.ts) read, never a live listing. Undefined for a
|
|
125
|
+
* tool the pin does not hold. */
|
|
126
|
+
export declare function pinnedEffect(pin: Readonly<Record<string, {
|
|
127
|
+
readonly tools: readonly {
|
|
128
|
+
readonly name: string;
|
|
129
|
+
readonly annotations?: unknown;
|
|
130
|
+
}[];
|
|
131
|
+
}>>, name: string): ToolEffect | undefined;
|
|
100
132
|
/** Marks the server's settings map when its stored value does not read (tool-plane.ts loadToolSettings): every
|
|
101
133
|
* tool then takes its defaults, and a deny it may hold can't be seen, so nothing lifts an ask over it. A symbol:
|
|
102
134
|
* carried by a spread, never by JSON (it is never served) nor by Object.entries (no reader takes it for a tool). */
|
|
103
135
|
export declare const SETTINGS_UNREAD: unique symbol;
|
|
104
136
|
/** `name`'s permission in force (permissionFrom): the one rule every path reads, the gate's, the tool plane's and a
|
|
105
137
|
* workflow's call nodes'. */
|
|
106
|
-
export declare const permissionOf: (name: string, server: PermissionSettings, agent?: PermissionSettings, approvals?: Approvals) => Permission;
|
|
107
|
-
/** A call's answer as the model reads it: its text, and whether it failed. */
|
|
108
|
-
export type ToolAnswer = {
|
|
109
|
-
text: string;
|
|
110
|
-
isError: boolean;
|
|
111
|
-
};
|
|
138
|
+
export declare const permissionOf: (name: string, server: PermissionSettings, agent?: PermissionSettings, approvals?: Approvals, effect?: ToolEffect) => Permission;
|
|
112
139
|
/** An approval's price for the person who answers it: USD where the tool declares one (booked through the spend cap's
|
|
113
140
|
* paidCall), else "not metered" (an unpriced MCP call, the owner's ruling of 11-04). */
|
|
114
141
|
export type ApprovalPrice = number | "not metered";
|
|
@@ -123,12 +150,12 @@ export type PendingApproval = {
|
|
|
123
150
|
args_preview: string;
|
|
124
151
|
requested_at: string;
|
|
125
152
|
price?: ApprovalPrice;
|
|
153
|
+
/** Present, true, when the run's pin marks the tool destructive (toolEffect): an allow of it needs confirm_destructive. */
|
|
154
|
+
destructive?: true;
|
|
126
155
|
};
|
|
127
156
|
export { type DenyFrom, deniedText, denyPlace, NOT_RUN, RAN_UNKNOWN, refusedText, type SettingFrom } from "./refusal-words.js";
|
|
128
157
|
/** The refusal of an ask where no one can approve it: a server with accounts off, whose answer route takes no token. */
|
|
129
158
|
export declare const noApproverText: (tool: string, ran?: "no" | "unknown") => string;
|
|
130
|
-
/** A parked call's answer: the run pauses here. */
|
|
131
|
-
export declare const waitingText: (tool: string) => string;
|
|
132
159
|
/** The Timeline row of a call that waits for an approval. */
|
|
133
160
|
export declare const APPROVAL_ROW: "tool_approval_requested";
|
|
134
161
|
/** A call's arguments shown on its approval, at most this many bytes. */
|
|
@@ -155,17 +182,6 @@ export type ApprovalRequest = {
|
|
|
155
182
|
/** `text` cut to at most ARGS_PREVIEW_BYTES. What is shown of a call's arguments is the whole of them redacted first, then
|
|
156
183
|
* cut (runs.ts), so a cut never leaves the head of a key no redaction recognizes. */
|
|
157
184
|
export declare function previewOf(text: string): string;
|
|
158
|
-
/** `args` as JSON, at most ARGS_PREVIEW_BYTES: the request's own record of them, never shown as it is. */
|
|
159
|
-
export declare const argsPreview: (args: unknown) => string;
|
|
160
|
-
/** How the gate's resume message starts: the server knows its row by it, and redacts the row whole (runs.ts). */
|
|
161
|
-
export declare const RESUME_PREFIX = "[tool approval] ";
|
|
162
|
-
/** The one message that resumes a session once a person answered: it names the call it answers (its tool, call id and
|
|
163
|
-
* arguments), so the model tells it from a person's new input, and carries the call's result, or the refusal. */
|
|
164
|
-
/** The head of the gate's resume message: the call it answers, its arguments as shown (`shown`, redacted whole then cut,
|
|
165
|
-
* runs.ts) cut again at 300 characters, and the words that say it is not the person's. The one source of it: the resume
|
|
166
|
-
* writes it, and the Timeline strips exactly it from the row a person opens (runs.ts resumeShows). */
|
|
167
|
-
export declare function resumeHead(request: Pick<ApprovalRequest, "tool" | "call_id">, shown: string): string;
|
|
168
|
-
export declare function resumeText(request: Pick<ApprovalRequest, "tool" | "call_id">, shown: string, decision: "allow" | "deny", result: ToolAnswer): string;
|
|
169
185
|
/** The gate of the run `runId` whose folder is `where`, on its pinned revision. `serverSettings`: the server's tool
|
|
170
186
|
* settings as the runner read them from the one store at the claim (tool-plane.ts loadToolSettings), read at each call as
|
|
171
187
|
* the gate reads them. `approvers`: whether anyone can answer an ask here, the store's (server-approvers.ts, read at each
|
|
@@ -176,6 +192,9 @@ export declare function runGate(where: {
|
|
|
176
192
|
work: string;
|
|
177
193
|
computer?: boolean;
|
|
178
194
|
mcpServers?: readonly string[];
|
|
195
|
+
computerCodemode?: boolean;
|
|
196
|
+
effectOf?: (name: string) => ToolEffect | undefined;
|
|
197
|
+
argumentsOf?: ArgumentsOf;
|
|
179
198
|
}, runId: string, revision: {
|
|
180
199
|
kind: string;
|
|
181
200
|
body: {
|
|
@@ -184,6 +203,10 @@ export declare function runGate(where: {
|
|
|
184
203
|
approvals?: Approvals;
|
|
185
204
|
};
|
|
186
205
|
}, serverSettings: () => ToolSettingsRead, approvers: boolean): RunGate;
|
|
206
|
+
/** The top-level arguments the listing of the MCP tool `name` (`mcp:<server>/<tool>`) in the run's pin declares under
|
|
207
|
+
* its inputSchema's `properties`, the snapshot the run offers the model, never a live listing; undefined for a listing
|
|
208
|
+
* with no `properties` object (nothing to close a pinned call to) and for any other tool. */
|
|
209
|
+
export type ArgumentsOf = (name: string) => ReadonlySet<string> | undefined;
|
|
187
210
|
/** A run's folder as its spec names it: the run's Workspace (Mode 2: its folder on the run's disk, never a folder of this
|
|
188
211
|
* machine), or the local folder's path. The gate checks paths against it and reads nothing in it. */
|
|
189
212
|
export type RunFiles = Pick<Workspace, "read"> | string;
|
|
@@ -197,14 +220,20 @@ export declare class RunGate {
|
|
|
197
220
|
/** `readServerSettings`: the server's tool settings, read at each call; `overrides`: the pinned revision's own;
|
|
198
221
|
* `approvers`: whether anyone can answer an ask here (the owner's password session: accounts on); `approvals`: the
|
|
199
222
|
* pinned revision's (definition.approvals): "never" runs the agent unattended, an ask allowed (permissionFrom). */
|
|
223
|
+
/** `where.effectOf`: an MCP tool's effect as the run's pin marks it (ClaimMcp.effectOf), what "allow reads" reads;
|
|
224
|
+
* never a live listing, so a server can't widen a run's access mid-run. */
|
|
200
225
|
constructor(where: {
|
|
201
226
|
root: string;
|
|
202
227
|
work: string;
|
|
203
228
|
runId: string;
|
|
204
229
|
harness?: string;
|
|
205
230
|
mcpServers?: readonly string[];
|
|
206
|
-
computer?: boolean;
|
|
231
|
+
computer?: boolean; /** The run's `codemode` is pi's on a desktop or a phone (runner/adapters/pi-computer.ts), not the host's. */
|
|
232
|
+
computerCodemode?: boolean;
|
|
233
|
+
effectOf?: (name: string) => ToolEffect | undefined; /** The arguments each MCP tool's listing in the run's pin declares (ClaimMcp.argumentsOf), for a pinned tool's closure (pinRefusal). */
|
|
234
|
+
argumentsOf?: ArgumentsOf;
|
|
207
235
|
}, readServerSettings: () => ToolSettingsRead, overrides?: PermissionSettings, approvers?: boolean, approvals?: Approvals);
|
|
236
|
+
private names?;
|
|
208
237
|
/** A tool's permission now (permissionOf): the revision's own over the server's setting, read at each call, so a change
|
|
209
238
|
* reaches a live run at its next call; under approvals "never", an ask is an allow. */
|
|
210
239
|
readonly policy: (tool: string) => Permission;
|
|
@@ -221,17 +250,22 @@ export declare class RunGate {
|
|
|
221
250
|
}): Promise<"allow" | "ask" | {
|
|
222
251
|
deny: string;
|
|
223
252
|
}>;
|
|
253
|
+
private keyOf;
|
|
224
254
|
/** The name a call is asked about by, as main's request names it (enter's `tool`): its settings key, a shell tool its
|
|
225
255
|
* own name; a name nothing maps, as it came. */
|
|
226
256
|
askedAs(name: string): string;
|
|
227
257
|
/** Where the permission `policy` gives `tool` was set: the agent's own tool settings, the server's, or the default; or
|
|
228
258
|
* "unattended", an ask the agent's approvals allowed. */
|
|
229
259
|
readonly denyFrom: (tool: string) => SettingFrom;
|
|
260
|
+
/** Whether `bare` (a name without claude-agent's `mcp__hands__`) is one of the host's three, not pi's own code mode on a
|
|
261
|
+
* desktop or a phone (which is held to the kind's keys). */
|
|
262
|
+
private hostMeta;
|
|
230
263
|
private setting;
|
|
231
264
|
/** `tool`'s permission under its settings key `key`, and where it was set. */
|
|
232
265
|
private settingOf;
|
|
233
266
|
/** Why a pin refuses the call of `key` with `args` now (pinRefusal): the revision's own pins and the server's, read at
|
|
234
|
-
* each call as its permission is, so a pin set or changed reaches a live run at its next call
|
|
267
|
+
* each call as its permission is, so a pin set or changed reaches a live run at its next call; a pinned tool held to
|
|
268
|
+
* the arguments its listing in the run's pin declares (where.argumentsOf). */
|
|
235
269
|
private pinned;
|
|
236
270
|
/** Why bash's policy refuses the call `name` (held to `key`) with `args` now, or undefined: the revision's own setting
|
|
237
271
|
* (an agent's tool_settings.bash.policy), so every shell tool under every harness's name for it is held to it. A policy
|