@parcha/agentrun-serve 0.1.0-beta.37 → 0.1.0-beta.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +282 -0
- package/README.md +155 -92
- package/dist/agent-rows.d.ts +1 -1
- package/dist/agents-store.d.ts +35 -3
- package/dist/agents-store.js +39 -14
- package/dist/answer-json.d.ts +34 -1
- package/dist/answer-json.js +91 -9
- package/dist/api-only.d.ts +1 -1
- package/dist/api-only.js +2 -2
- package/dist/browser-cost.js +52 -93
- package/dist/cap.d.ts +0 -390
- package/dist/cap.js +4 -937
- package/dist/catalog.js +1 -1
- package/dist/composio-preset.d.ts +17 -0
- package/dist/composio-preset.js +43 -1
- package/dist/computer-calls.d.ts +36 -24
- package/dist/computer-calls.js +110 -27
- package/dist/computer-live.d.ts +5 -0
- package/dist/computer-live.js +12 -0
- package/dist/computer-setting.d.ts +15 -2
- package/dist/computer-setting.js +20 -4
- package/dist/computer-view.d.ts +3 -2
- package/dist/computer-view.js +5 -4
- package/dist/computer-viewer.js +26 -12
- package/dist/computers.d.ts +4 -1
- package/dist/computers.js +12 -6
- package/dist/console/assets/index-CjqQirbo.css +1 -0
- package/dist/console/assets/index-b6-XY5A9.js +576 -0
- package/dist/console/index.html +2 -2
- package/dist/console-links.d.ts +2 -0
- package/dist/console-links.js +3 -0
- package/dist/decisions.js +4 -0
- package/dist/faux-computers.js +4 -2
- package/dist/harness-opencode/adapter.js +7 -3
- package/dist/harness-opencode/facts.js +0 -2
- package/dist/harness-opencode/host/policy.d.ts +2 -5
- package/dist/harness-opencode/host/policy.js +8 -32
- package/dist/harness-table.d.ts +0 -2
- package/dist/harness-table.js +0 -2
- package/dist/host-tools.d.ts +1 -5
- package/dist/host-tools.js +7 -10
- package/dist/hosted-search.d.ts +0 -2
- package/dist/hosted-search.js +0 -21
- package/dist/key-words.d.ts +3 -2
- package/dist/key-words.js +4 -2
- package/dist/learn/check.d.ts +6 -1
- package/dist/learn/check.js +12 -4
- package/dist/learn/commit.d.ts +10 -0
- package/dist/learn/commit.js +18 -4
- package/dist/learn/compile.d.ts +243 -0
- package/dist/learn/compile.js +471 -0
- package/dist/learn/general.d.ts +3 -0
- package/dist/learn/general.js +4 -2
- package/dist/learn/grade.d.ts +1 -1
- package/dist/learn/grade.js +7 -6
- package/dist/learn/notes.d.ts +8 -0
- package/dist/learn/notes.js +18 -0
- package/dist/learn/promote.d.ts +253 -0
- package/dist/learn/promote.js +428 -0
- package/dist/learn/refit.d.ts +39 -0
- package/dist/learn/refit.js +236 -0
- package/dist/learn/reflect.d.ts +5 -25
- package/dist/learn/reflect.js +14 -131
- package/dist/learn/replay-calls.d.ts +63 -0
- package/dist/learn/replay-calls.js +158 -0
- package/dist/learn/skills.d.ts +17 -9
- package/dist/learn/skills.js +132 -42
- package/dist/learn/workflow-nodes.d.ts +15 -0
- package/dist/learn/workflow-nodes.js +44 -0
- package/dist/learned-nodes.d.ts +50 -2
- package/dist/learned-nodes.js +41 -2
- package/dist/learned-workflow.d.ts +19 -3
- package/dist/learned-workflow.js +105 -26
- package/dist/learning-batch.d.ts +2 -2
- package/dist/learning-batch.js +1 -1
- package/dist/learning-cost.d.ts +18 -6
- package/dist/learning-cost.js +15 -7
- package/dist/learning-routes.d.ts +14 -2
- package/dist/learning-routes.js +14 -3
- package/dist/learning-words.d.ts +7 -0
- package/dist/learning-words.js +7 -0
- package/dist/learning.d.ts +31 -6
- package/dist/learning.js +7 -4
- package/dist/llm.js +0 -3
- package/dist/mcp-gateway.d.ts +12 -20
- package/dist/mcp-gateway.js +16 -44
- package/dist/mcp-oauth.d.ts +5 -0
- package/dist/mcp-oauth.js +1 -1
- package/dist/mcp-pin-first.d.ts +37 -0
- package/dist/mcp-pin-first.js +107 -0
- package/dist/mcp-probe.d.ts +8 -9
- package/dist/mcp-probe.js +16 -33
- package/dist/mcp-servers-store.d.ts +89 -22
- package/dist/mcp-servers-store.js +131 -25
- package/dist/mcp-sources.d.ts +39 -0
- package/dist/mcp-sources.js +74 -0
- package/dist/mcp-store.d.ts +11 -0
- package/dist/mcp-store.js +16 -2
- package/dist/mcp-wire.d.ts +22 -0
- package/dist/mcp-wire.js +36 -0
- package/dist/mcp.js +3 -3
- package/dist/meta-tool-names.d.ts +1 -0
- package/dist/meta-tool-names.js +3 -0
- package/dist/model.d.ts +13 -0
- package/dist/model.js +46 -15
- package/dist/monid.d.ts +51 -25
- package/dist/monid.js +226 -140
- package/dist/openapi.js +336 -66
- package/dist/paid-calls.d.ts +26 -29
- package/dist/paid-calls.js +46 -102
- package/dist/propose.d.ts +7 -1
- package/dist/propose.js +18 -6
- package/dist/provider.js +9 -2
- package/dist/reflect-range.js +2 -1
- package/dist/rows.d.ts +5 -3
- package/dist/rows.js +15 -4
- package/dist/run-launch.d.ts +13 -0
- package/dist/run-launch.js +6 -0
- package/dist/run-learning-served.d.ts +13 -2
- package/dist/run-manifest.d.ts +5 -0
- package/dist/run-manifest.js +20 -0
- package/dist/run-secrets.js +2 -3
- package/dist/run-timeline-served.js +5 -2
- package/dist/run-view.d.ts +17 -6
- package/dist/run-view.js +51 -22
- package/dist/runnable.d.ts +0 -3
- package/dist/runnable.js +37 -29
- package/dist/runner/adapter-loop.d.ts +24 -10
- package/dist/runner/adapter-loop.js +852 -314
- package/dist/runner/adapter-run-spec.d.ts +12 -6
- package/dist/runner/adapter-run-spec.js +97 -46
- package/dist/runner/adapters/pi-computer.d.ts +3 -1
- package/dist/runner/adapters/pi-computer.js +13 -5
- package/dist/runner/adapters/pi.d.ts +16 -7
- package/dist/runner/adapters/pi.js +94 -33
- package/dist/runner/cli-run-spec.js +67 -27
- package/dist/runner/computer-channel.js +2 -1
- package/dist/runner/conformance/harness.d.ts +3 -0
- package/dist/runner/conformance/harness.js +145 -4
- package/dist/runner/conformance/subject.d.ts +11 -4
- package/dist/runner/end-of-run.d.ts +6 -5
- package/dist/runner/end-of-run.js +9 -6
- package/dist/runner/feedback-round.d.ts +52 -0
- package/dist/runner/feedback-round.js +79 -0
- package/dist/runner/journal-kinds.d.ts +24 -6
- package/dist/runner/journal-kinds.js +15 -0
- package/dist/runner/learning-end.d.ts +54 -19
- package/dist/runner/learning-end.js +272 -99
- package/dist/runner/learning-loop.d.ts +19 -1
- package/dist/runner/learning-loop.js +5 -2
- package/dist/runner/learning-seed.d.ts +4 -0
- package/dist/runner/learning-seed.js +14 -0
- package/dist/runner/loop-contract.d.ts +19 -3
- package/dist/runner/loop.d.ts +16 -1
- package/dist/runner/loop.js +21 -1
- package/dist/runner/mcp-claim.d.ts +5 -1
- package/dist/runner/mcp-claim.js +66 -50
- package/dist/runner/mcp-run.d.ts +16 -52
- package/dist/runner/mcp-run.js +12 -84
- package/dist/runner/meta-tools.d.ts +37 -0
- package/dist/runner/meta-tools.js +268 -0
- package/dist/runner/metrics.js +14 -3
- package/dist/runner/model-route.js +12 -3
- package/dist/runner/monid-run.d.ts +16 -0
- package/dist/runner/monid-run.js +96 -0
- package/dist/runner/promotion.d.ts +80 -0
- package/dist/runner/promotion.js +562 -0
- package/dist/runner/reflect-hook.d.ts +36 -21
- package/dist/runner/reflect-hook.js +138 -49
- package/dist/runner/runner.js +26 -4
- package/dist/runner/sessions.d.ts +8 -3
- package/dist/runner/sessions.js +5 -1
- package/dist/runner/step-guard.d.ts +62 -0
- package/dist/runner/step-guard.js +93 -0
- package/dist/runner/subagent.d.ts +0 -3
- package/dist/runner/subagent.js +7 -12
- package/dist/runner/workflow-first.d.ts +216 -0
- package/dist/runner/workflow-first.js +303 -0
- package/dist/runner/workflow-loop.js +17 -10
- package/dist/runner/workflow-spec.d.ts +1 -0
- package/dist/runner/workflow-spec.js +7 -3
- package/dist/runs-over-store.d.ts +11 -2
- package/dist/runs-over-store.js +21 -11
- package/dist/server.d.ts +88 -16
- package/dist/server.js +380 -87
- package/dist/settings-wake.d.ts +8 -6
- package/dist/settings-wake.js +13 -7
- package/dist/store/agent-body.d.ts +14 -3
- package/dist/store/agent-body.js +14 -10
- package/dist/store/command-wake.d.ts +3 -2
- package/dist/store/command-wake.js +4 -4
- package/dist/store/postgres/connection.js +3 -1
- package/dist/store/postgres/migrations/0010_imported_templates.sql +18 -0
- package/dist/store/postgres/migrations/0011_revision_mcp_pin.sql +13 -0
- package/dist/store/schema.d.ts +9 -0
- package/dist/store/schema.js +28 -8
- package/dist/store/sqlite/connection.d.ts +2 -2
- package/dist/store/sqlite/connection.js +2 -2
- package/dist/store/sqlite/run-patch.js +19 -7
- package/dist/store/sqlite/store.js +59 -18
- package/dist/store/store.d.ts +46 -14
- package/dist/store-reads/journal.d.ts +25 -1
- package/dist/store-reads/journal.js +63 -49
- package/dist/store-reads/learning.d.ts +101 -15
- package/dist/store-reads/learning.js +195 -61
- package/dist/store-reads/loop.d.ts +61 -0
- package/dist/store-reads/loop.js +111 -0
- package/dist/store-view.d.ts +3 -2
- package/dist/store-view.js +35 -17
- package/dist/template-eval.d.ts +18 -9
- package/dist/template-eval.js +91 -66
- package/dist/template-github-permissions.d.ts +2 -2
- package/dist/template-github-permissions.js +2 -1
- package/dist/template-import.d.ts +31 -0
- package/dist/template-import.js +121 -0
- package/dist/template-source.d.ts +51 -0
- package/dist/template-source.js +371 -0
- package/dist/templates.d.ts +218 -46
- package/dist/templates.js +493 -181
- package/dist/timeline/computer.d.ts +48 -0
- package/dist/timeline/computer.js +169 -0
- package/dist/timeline/index.d.ts +4 -3
- package/dist/timeline/index.js +4 -3
- package/dist/timeline/labels.d.ts +6 -2
- package/dist/timeline/labels.js +93 -2
- package/dist/timeline/origin.d.ts +19 -5
- package/dist/timeline/origin.js +11 -4
- package/dist/timeline/timeline.d.ts +11 -17
- package/dist/timeline/timeline.js +24 -9
- package/dist/tool-gate.d.ts +73 -46
- package/dist/tool-gate.js +133 -66
- package/dist/tool-keys.d.ts +4 -1
- package/dist/tool-keys.js +8 -3
- package/dist/tool-list.d.ts +26 -0
- package/dist/tool-list.js +43 -0
- package/dist/tool-names.d.ts +71 -0
- package/dist/tool-names.js +99 -0
- package/dist/tool-plane.d.ts +29 -27
- package/dist/tool-plane.js +65 -37
- package/dist/tools.d.ts +22 -6
- package/dist/tools.js +24 -20
- package/dist/validate.d.ts +15 -7
- package/dist/validate.js +91 -44
- package/dist/web-fetch.d.ts +1 -7
- package/dist/web-fetch.js +2 -22
- package/dist/workspace/computer-deps.d.ts +3 -0
- package/dist/workspace/computer-deps.js +5 -2
- package/dist/workspace/computer-for-claim.d.ts +6 -0
- package/dist/workspace/computer-for-claim.js +32 -14
- package/dist/workspace/computer-hold.js +7 -1
- package/dist/workspace/computer-script.d.ts +23 -7
- package/dist/workspace/computer-script.js +48 -14
- package/dist/workspace/index.d.ts +2 -2
- package/dist/workspace/index.js +1 -1
- package/dist/workspace/kind-skills/desktop/SKILL.md +13 -0
- package/dist/workspace/kind-skills/phone/SKILL.md +4 -0
- package/dist/workspace/local.js +2 -2
- package/dist/workspace/resolve-computer.d.ts +21 -1
- package/dist/workspace/resolve-computer.js +32 -14
- package/dist/workspace/run-tools.d.ts +28 -10
- package/dist/workspace/run-tools.js +39 -11
- package/dist/{tool-budget.d.ts → wrap-up.d.ts} +1 -18
- package/dist/wrap-up.js +21 -0
- package/launcher/agentrun-serve +4 -2
- package/package.json +9 -9
- package/templates/README.md +111 -45
- package/templates/code-review/agent.md +30 -14
- package/templates/code-review/evals/clean-refactor/case.yaml +2 -1
- package/templates/code-review/evals/clean-refactor/graders/head-sha.md +6 -0
- package/templates/code-review/evals/injection/case.yaml +2 -1
- package/templates/code-review/evals/injection/graders/head-sha.md +6 -0
- package/templates/code-review/evals/mentions-defused/case.yaml +2 -2
- package/templates/code-review/evals/mentions-defused/fixtures/github-mcp.json +0 -23
- package/templates/code-review/evals/mentions-defused/graders/head-sha.md +6 -0
- package/templates/code-review/evals/never-flag/case.yaml +2 -1
- package/templates/code-review/evals/never-flag/graders/head-sha.md +6 -0
- package/templates/code-review/evals/null-name/case.yaml +2 -1
- package/templates/code-review/evals/null-name/graders/head-sha.md +6 -0
- package/templates/code-review/evals/off-by-one/case.yaml +2 -1
- package/templates/code-review/evals/off-by-one/graders/head-sha.md +6 -0
- package/templates/code-review/evals/other-repo/case.yaml +16 -0
- package/templates/code-review/evals/other-repo/fixtures/github-mcp.json +130 -0
- package/templates/code-review/evals/other-repo/graders/head-sha.md +6 -0
- package/templates/code-review/evals/other-repo/graders/no-canary.md +6 -0
- package/templates/code-review/evals/other-repo/graders/no-other-repo.md +8 -0
- package/templates/code-review/evals/other-repo/graders/refused-not-quoted.md +18 -0
- package/templates/code-review/evals/other-repo/prompt.md +10 -0
- package/templates/code-review/evals/re-review/case.yaml +2 -1
- package/templates/code-review/evals/re-review/graders/head-sha.md +6 -0
- package/templates/code-review/evals/re-review-open/case.yaml +2 -1
- package/templates/code-review/evals/re-review-open/graders/head-sha.md +6 -0
- package/templates/code-review/evals/repo-rule/case.yaml +2 -1
- package/templates/code-review/evals/repo-rule/graders/head-sha.md +6 -0
- package/templates/code-review/evals/two-defects/case.yaml +2 -1
- package/templates/code-review/evals/two-defects/graders/head-sha.md +6 -0
- package/templates/code-review/rules/CODEREVIEW.md +1 -1
- package/templates/code-review/skills/review/DEEP.md +3 -2
- package/templates/code-review/skills/review/REVIEWER.md +3 -2
- package/templates/code-review/skills/review/SKILL.md +4 -3
- package/templates/code-review/{findings.schema.json → skills/review/findings.schema.json} +1 -0
- package/templates/inbound-lead/agent.md +26 -16
- package/templates/inbound-lead/evals/injection-in-form/graders/no-exfil.md +16 -0
- package/templates/inbound-lead/evals/injection-in-form/prompt.md +2 -2
- package/templates/inbound-lead/evals/write-back/case.yaml +2 -6
- package/templates/inbound-lead/evals/write-back/fixtures/fake-hubspot.json +34 -225
- package/templates/inbound-lead/evals/write-back/graders/note-and-score.md +10 -14
- package/templates/inbound-lead/evals/write-back/graders/writes-once.md +7 -0
- package/templates/inbound-lead/evals/write-back/prompt.md +1 -1
- package/templates/inbound-lead/evals/write-back-wrong-record/case.yaml +3 -7
- package/templates/inbound-lead/evals/write-back-wrong-record/fixtures/fake-hubspot.json +34 -225
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/form-id.md +17 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/no-write.md +3 -3
- package/templates/inbound-lead/evals/write-back-wrong-record/prompt.md +2 -2
- package/templates/inbound-lead/skills/lead/SKILL.md +23 -27
- package/templates/kyb/agent.md +15 -5
- package/templates/kyb/evals/adverse-media/prompt.md +2 -7
- package/templates/kyb/evals/canada-active-filed/prompt.md +2 -6
- package/templates/kyb/evals/clean-public-company/prompt.md +2 -6
- package/templates/kyb/evals/injection-in-page/prompt.md +3 -7
- package/templates/kyb/evals/name-collision/prompt.md +2 -6
- package/templates/kyb/evals/no-invention/prompt.md +2 -6
- package/templates/kyb/evals/opensanctions-on/prompt.md +2 -6
- package/templates/kyb/evals/sanctioned-entity/prompt.md +2 -6
- package/templates/kyb/kyb.schema.json +8 -7
- package/templates/kyb/skills/kyb/SKILL.md +9 -6
- package/templates/market-monitor/agent.md +19 -12
- package/templates/market-monitor/evals/post-happens/case.yaml +4 -4
- package/templates/market-monitor/evals/post-happens/fixtures/slack-mcp.json +13 -9
- package/templates/market-monitor/evals/post-happens/graders/post-is-digest.md +1 -1
- package/templates/market-monitor/evals/post-happens/graders/posted-once.md +3 -3
- package/templates/market-monitor/skills/monitor/SKILL.md +6 -4
- package/templates/release-notes/agent.md +32 -10
- package/templates/release-notes/evals/draft-not-publish/case.yaml +4 -3
- package/templates/release-notes/evals/draft-not-publish/fixtures/github-mcp.json +29 -51
- package/templates/release-notes/evals/every-pr-accounted/case.yaml +2 -1
- package/templates/release-notes/evals/issue-write-refused/case.yaml +4 -3
- package/templates/release-notes/evals/issue-write-refused/fixtures/github-mcp.json +29 -51
- package/templates/release-notes/evals/late-arrival/case.yaml +6 -5
- package/templates/release-notes/evals/late-arrival/fixtures/github-mcp.json +29 -51
- package/templates/release-notes/evals/learned-style/case.yaml +2 -1
- package/templates/release-notes/evals/no-pr-numbers-on-top/case.yaml +2 -1
- package/templates/release-notes/evals/other-repo/case.yaml +24 -0
- package/templates/release-notes/evals/other-repo/fixtures/github-mcp.json +907 -0
- package/templates/release-notes/evals/other-repo/graders/no-canary.md +7 -0
- package/templates/release-notes/evals/other-repo/graders/no-other-repo.md +8 -0
- package/templates/release-notes/evals/other-repo/graders/refused-not-quoted.md +18 -0
- package/templates/release-notes/evals/other-repo/prompt.md +32 -0
- package/templates/release-notes/evals/upgrade-line/case.yaml +2 -1
- package/templates/release-notes/evals/user-facing-only/case.yaml +2 -1
- package/templates/release-notes/notes.schema.json +1 -1
- package/templates/release-notes/skills/release-notes/SKILL.md +26 -17
- package/dist/console/assets/index-Cn6JX1uH.js +0 -563
- package/dist/console/assets/index-DRN62V5v.css +0 -1
- package/dist/tool-blurbs.d.ts +0 -4
- package/dist/tool-blurbs.js +0 -28
- package/dist/tool-budget.js +0 -62
- package/templates/code-review/evals/clean-refactor/graders/schema.md +0 -5
- package/templates/code-review/evals/injection/graders/schema.md +0 -5
- package/templates/code-review/evals/mentions-defused/graders/schema.md +0 -5
- package/templates/code-review/evals/never-flag/graders/schema.md +0 -5
- package/templates/code-review/evals/null-name/graders/schema.md +0 -5
- package/templates/code-review/evals/off-by-one/graders/schema.md +0 -5
- package/templates/code-review/evals/re-review/graders/schema.md +0 -5
- package/templates/code-review/evals/re-review-open/graders/schema.md +0 -5
- package/templates/code-review/evals/repo-rule/graders/schema.md +0 -5
- package/templates/code-review/evals/two-defects/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/clear-disqualifier/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/injection-in-form/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/learned-correction/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/strong-fit/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/thin-data/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/write-back/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/write-back/graders/writes-twice.md +0 -7
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/proves-record.md +0 -18
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/schema.md +0 -5
- package/templates/kyb/evals/adverse-media/graders/schema.md +0 -5
- package/templates/kyb/evals/canada-active-filed/graders/schema.md +0 -5
- package/templates/kyb/evals/clean-public-company/graders/schema.md +0 -5
- package/templates/kyb/evals/injection-in-page/graders/schema.md +0 -5
- package/templates/kyb/evals/name-collision/graders/schema.md +0 -5
- package/templates/kyb/evals/no-invention/graders/schema.md +0 -5
- package/templates/kyb/evals/opensanctions-on/graders/schema.md +0 -5
- package/templates/kyb/evals/sanctioned-entity/graders/schema.md +0 -5
- package/templates/market-monitor/evals/blocked-source/graders/schema.md +0 -5
- package/templates/market-monitor/evals/every-competitor-named/graders/schema.md +0 -5
- package/templates/market-monitor/evals/learned-preference/graders/schema.md +0 -5
- package/templates/market-monitor/evals/no-repeats/graders/schema.md +0 -5
- package/templates/market-monitor/evals/nothing-changed/graders/schema.md +0 -5
- package/templates/market-monitor/evals/post-happens/graders/schema.md +0 -5
- package/templates/market-monitor/evals/pricing-change/graders/schema.md +0 -5
- package/templates/market-monitor/evals/pricing-moved/graders/schema.md +0 -5
- package/templates/release-notes/evals/draft-not-publish/graders/schema.md +0 -5
- package/templates/release-notes/evals/every-pr-accounted/graders/schema.md +0 -5
- package/templates/release-notes/evals/issue-write-refused/graders/schema.md +0 -5
- package/templates/release-notes/evals/late-arrival/graders/schema.md +0 -5
- package/templates/release-notes/evals/learned-style/graders/schema.md +0 -5
- package/templates/release-notes/evals/no-pr-numbers-on-top/graders/schema.md +0 -5
- package/templates/release-notes/evals/upgrade-line/graders/schema.md +0 -5
- package/templates/release-notes/evals/user-facing-only/graders/schema.md +0 -5
package/dist/console/index.html
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
<meta name="color-scheme" content="light dark" />
|
|
7
7
|
<title>AgentRun</title>
|
|
8
8
|
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' fill='%23ff8000'/%3E%3Cpath d='M12 9l11 7-11 7z' fill='%23000'/%3E%3C/svg%3E" />
|
|
9
|
-
<script type="module" crossorigin src="./assets/index-
|
|
10
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
9
|
+
<script type="module" crossorigin src="./assets/index-b6-XY5A9.js"></script>
|
|
10
|
+
<link rel="stylesheet" crossorigin href="./assets/index-CjqQirbo.css">
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|
|
13
13
|
<div id="root"></div>
|
package/dist/console-links.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export declare const runLink: (origin: string, runId: string) => string;
|
|
2
2
|
export declare const agentLink: (origin: string, agentId: string) => string;
|
|
3
|
+
export declare const templateLink: (origin: string, id: string) => string;
|
|
4
|
+
export declare const templateInstallLink: (origin: string, source: string) => string;
|
package/dist/console-links.js
CHANGED
|
@@ -4,3 +4,6 @@ export const runLink = (origin, runId) => `${origin}/#/runs/${encodeURIComponent
|
|
|
4
4
|
// `#/agents/new` is the console's new-agent form, so an agent whose id is "new" gets its Runs tab, as the console's own
|
|
5
5
|
// agentHash gives it (apps/console AgentPage.tsx).
|
|
6
6
|
export const agentLink = (origin, agentId) => `${origin}/#/agents/${encodeURIComponent(agentId)}${agentId === "new" ? "/runs" : ""}`;
|
|
7
|
+
// A template package's apply page; for a package not stored (a dry run), the install page, which shows it whole first.
|
|
8
|
+
export const templateLink = (origin, id) => `${origin}/#/templates/${encodeURIComponent(id)}`;
|
|
9
|
+
export const templateInstallLink = (origin, source) => `${origin}/#/templates/install?src=${encodeURIComponent(source)}`;
|
package/dist/decisions.js
CHANGED
|
@@ -145,6 +145,10 @@ export function providersNamed(nodes) {
|
|
|
145
145
|
}
|
|
146
146
|
if (node.verify)
|
|
147
147
|
ids.add(DEFAULT_DECISION_PROVIDER);
|
|
148
|
+
// A step guard that reads Jev (runner/step-guard.ts) asks Jev, whatever provider its node names.
|
|
149
|
+
const signal = node.guard?.signal;
|
|
150
|
+
if (signal === "jev" || signal === "both")
|
|
151
|
+
ids.add("jev");
|
|
148
152
|
}
|
|
149
153
|
return [...ids];
|
|
150
154
|
}
|
package/dist/faux-computers.js
CHANGED
|
@@ -80,8 +80,8 @@ const FRAME_MS = 1_000;
|
|
|
80
80
|
/** --faux's computers: the server's Settings → Computers and start check read them, and its runner's claim launches them. */
|
|
81
81
|
export function fauxComputers() {
|
|
82
82
|
let started = 0;
|
|
83
|
-
/** A faux desktop for a run: screen.shot gives a grey screen, input.actions does
|
|
84
|
-
* watch gives the same grey frame, the next a second after each ack, and takes every input (performing none) until it
|
|
83
|
+
/** A faux desktop for a run: ping answers, as every computer's does; screen.shot gives a grey screen, input.actions does
|
|
84
|
+
* each action and performs none, and its watch gives the same grey frame, the next a second after each ack, and takes every input (performing none) until it
|
|
85
85
|
* is closed or the desktop is released, which ends it gone. */
|
|
86
86
|
function fauxDesktop() {
|
|
87
87
|
const id = `faux-desktop-${++started}`;
|
|
@@ -91,6 +91,8 @@ export function fauxComputers() {
|
|
|
91
91
|
const call = async (method, params) => {
|
|
92
92
|
if (method === "hello")
|
|
93
93
|
return { ok: true, value: hello };
|
|
94
|
+
if (method === "ping")
|
|
95
|
+
return { ok: true, value: {} };
|
|
94
96
|
if (method === "screen.shot")
|
|
95
97
|
return { ok: true, value: { id: `${id}-shot`, data: png.toString("base64"), eof: true, size: png.length, width: WIDTH, height: HEIGHT } };
|
|
96
98
|
if (method === "input.actions")
|
|
@@ -34,13 +34,18 @@ function kernelTool(tool) {
|
|
|
34
34
|
description: tool.description,
|
|
35
35
|
inputSchema: tool.inputSchema,
|
|
36
36
|
replay: tool.replay,
|
|
37
|
+
...(tool.nests ? { nests: true } : {}),
|
|
38
|
+
...(tool.deferred ? { deferred: true } : {}),
|
|
37
39
|
async execute(input, io) {
|
|
38
40
|
// The effect's step is `tool:<the model's call id>#<attempt>`: the host sees the model's call id.
|
|
39
41
|
const callId = (io.stepId ?? "").replace(/^tool:/, "").replace(/#\d+$/, "");
|
|
40
|
-
|
|
42
|
+
// A tool that nests calls (tools_call, codemode) gets the session's tools as its nested calls, through the bridge.
|
|
43
|
+
const result = await tool.call(input, { callId, signal: io.signal, ...(io.nested ? { nested: io.nested } : {}) });
|
|
41
44
|
if (result.isError)
|
|
42
45
|
throw new Error(result.text);
|
|
43
|
-
|
|
46
|
+
// Its value, recorded with the outcome: a script's nested call is answered it (meta-tools.ts).
|
|
47
|
+
const structured = result.structured !== undefined ? { structured: result.structured } : {};
|
|
48
|
+
return result.images?.length ? { text: result.text, images: result.images, ...structured } : result.structured === undefined ? result.text : { text: result.text, ...structured };
|
|
44
49
|
},
|
|
45
50
|
};
|
|
46
51
|
}
|
|
@@ -105,7 +110,6 @@ export function openCodeAdapter(options) {
|
|
|
105
110
|
};
|
|
106
111
|
return {
|
|
107
112
|
id: "opencode",
|
|
108
|
-
capabilities: () => ({}),
|
|
109
113
|
check(spec) {
|
|
110
114
|
const problems = [];
|
|
111
115
|
if (spec.context === "fork")
|
|
@@ -13,8 +13,6 @@ export const facts = Object.freeze({
|
|
|
13
13
|
// One run's memory, measured with the server's (host.ts): OpenCode's server beside the run's process.
|
|
14
14
|
runMib: 704,
|
|
15
15
|
// OpenAI's reasoning efforts stop at xhigh.
|
|
16
|
-
// Its MCP client is not bound to the session's remote MCP servers yet.
|
|
17
|
-
mcp: false,
|
|
18
16
|
thinking: Object.freeze(["low", "medium", "high", "xhigh"]),
|
|
19
17
|
// OpenCode's model requests carry no provider-hosted tool: no search of its own.
|
|
20
18
|
ownModel: false,
|
|
@@ -37,12 +37,9 @@ export interface OpenCodePolicyOptions {
|
|
|
37
37
|
*/
|
|
38
38
|
export declare function filtered(text: string, lineStarts?: readonly string[]): boolean;
|
|
39
39
|
/** The usage of the response an answer ends with: its `response.completed` (or `response.incomplete`) event, each `data:`
|
|
40
|
-
* line parsed on its own, or a whole JSON body's; for a line the proxy's 64 KiB window cut, the last `"usage":{` object
|
|
41
|
-
* in the text. Undefined, an unknown cost, when there is none. */
|
|
40
|
+
* line parsed on its own, or a whole JSON body's; for a line the proxy's 64 KiB window cut, the last `"usage": {` object
|
|
41
|
+
* in the text, whatever its spacing (the kernel's `lastObjectOf`). Undefined, an unknown cost, when there is none. */
|
|
42
42
|
export declare function usageOf(text: string): ProxyUsage | undefined;
|
|
43
|
-
/** The input tokens the provider bills for `body` that it does not carry (codex's figure: the same Responses API). A file
|
|
44
|
-
* input has no stated bound, so a body with one cannot be measured. */
|
|
45
|
-
export declare function responsesServerInputOverhead(body: Record<string, unknown>): number;
|
|
46
43
|
/** The tokens a request keeps for its answer when a spend cap limits its output. */
|
|
47
44
|
export declare const ANSWER_TOKENS_LEAST = 1024;
|
|
48
45
|
/** What a reasoning request at each effort is allowed for its reasoning beside its answer, when its output is limited:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { lastObjectOf, OPENAI_INPUT_COUNTER, ProxyRefusal, responsesInputOverhead } from "@parcha/agentrun-kernel/host";
|
|
2
2
|
/** The prefix OpenCode gives the adapter's MCP tools: the server is `hands`. */
|
|
3
3
|
export const TOOL_PREFIX = "hands_";
|
|
4
4
|
export const OPENCODE_RESPONSES_ROUTES = Object.freeze([
|
|
@@ -168,8 +168,8 @@ function startOfResponse(data) {
|
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
/** The usage of the response an answer ends with: its `response.completed` (or `response.incomplete`) event, each `data:`
|
|
171
|
-
* line parsed on its own, or a whole JSON body's; for a line the proxy's 64 KiB window cut, the last `"usage":{` object
|
|
172
|
-
* in the text. Undefined, an unknown cost, when there is none. */
|
|
171
|
+
* line parsed on its own, or a whole JSON body's; for a line the proxy's 64 KiB window cut, the last `"usage": {` object
|
|
172
|
+
* in the text, whatever its spacing (the kernel's `lastObjectOf`). Undefined, an unknown cost, when there is none. */
|
|
173
173
|
export function usageOf(text) {
|
|
174
174
|
let found;
|
|
175
175
|
let ended = false;
|
|
@@ -202,34 +202,7 @@ export function usageOf(text) {
|
|
|
202
202
|
}
|
|
203
203
|
catch { }
|
|
204
204
|
}
|
|
205
|
-
|
|
206
|
-
const at = text.lastIndexOf(mark);
|
|
207
|
-
if (at < 0)
|
|
208
|
-
return undefined;
|
|
209
|
-
const json = objectAt(text, at + mark.length - 1);
|
|
210
|
-
if (json === undefined)
|
|
211
|
-
return undefined;
|
|
212
|
-
try {
|
|
213
|
-
return usageFrom(JSON.parse(json));
|
|
214
|
-
}
|
|
215
|
-
catch {
|
|
216
|
-
return undefined;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
/** The items of `type` in `value`, at any depth. */
|
|
220
|
-
function itemsIn(value, type) {
|
|
221
|
-
if (Array.isArray(value))
|
|
222
|
-
return value.reduce((n, item) => n + itemsIn(item, type), 0);
|
|
223
|
-
if (!isPlain(value))
|
|
224
|
-
return 0;
|
|
225
|
-
return (value.type === type ? 1 : 0) + Object.values(value).reduce((n, item) => n + itemsIn(item, type), 0);
|
|
226
|
-
}
|
|
227
|
-
/** The input tokens the provider bills for `body` that it does not carry (codex's figure: the same Responses API). A file
|
|
228
|
-
* input has no stated bound, so a body with one cannot be measured. */
|
|
229
|
-
export function responsesServerInputOverhead(body) {
|
|
230
|
-
if (itemsIn(body.input, "input_file") > 0)
|
|
231
|
-
throw new Error("a file input's billed size has no stated bound");
|
|
232
|
-
return providerInputOverhead("openai-responses", { tools: Array.isArray(body.tools) && body.tools.length > 0, images: responsesImagesIn(body.input), ...(typeof body.model === "string" ? { model: body.model } : {}) });
|
|
205
|
+
return usageFrom(lastObjectOf(text, "usage"));
|
|
233
206
|
}
|
|
234
207
|
/** An event that is not whole by this many characters is not read. */
|
|
235
208
|
const EVENT_CAP = 4 * 1024 * 1024;
|
|
@@ -418,7 +391,10 @@ export function openCodePolicy(options) {
|
|
|
418
391
|
outputAsked: responsesOutputAsked,
|
|
419
392
|
outputLeast: responsesOutputLeast,
|
|
420
393
|
limitOutput: limitResponsesOutput,
|
|
421
|
-
|
|
394
|
+
// Its bytes less the escapes in the text it carries (codex's figure: the same Responses API), and on a route straight
|
|
395
|
+
// to OpenAI, OpenAI's own count when that is lower.
|
|
396
|
+
serverInputOverhead: responsesInputOverhead,
|
|
397
|
+
countInput: OPENAI_INPUT_COUNTER,
|
|
422
398
|
// A stop counts the content it streamed, not the wire, and the part of its reasoning budget that did not stream.
|
|
423
399
|
reasoningHidden: (body) => responsesReasoningHidden(body, maxOutputTokens),
|
|
424
400
|
reasoningBytesOf: responsesReasoningBytes,
|
package/dist/harness-table.d.ts
CHANGED
|
@@ -24,8 +24,6 @@ export interface HarnessEntry {
|
|
|
24
24
|
readonly steer: boolean;
|
|
25
25
|
/** What one of its runs reserves in memory while its process lives, in MiB (host.ts). */
|
|
26
26
|
readonly runMib: number;
|
|
27
|
-
/** Whether it binds a run's remote MCP servers. */
|
|
28
|
-
readonly mcp: boolean;
|
|
29
27
|
/** A server too small for even one of its runs still runs one at a time (pi's, as before runs were admitted by memory). */
|
|
30
28
|
readonly oneAlwaysFits: boolean;
|
|
31
29
|
/** Its adapter's facts; none for pi, which runs in the run's own process on its own models. */
|
package/dist/harness-table.js
CHANGED
|
@@ -42,7 +42,6 @@ const PI = Object.freeze({
|
|
|
42
42
|
id: DEFAULT_HARNESS,
|
|
43
43
|
steer: true,
|
|
44
44
|
runMib: 128,
|
|
45
|
-
mcp: true,
|
|
46
45
|
oneAlwaysFits: true,
|
|
47
46
|
runs: () => true,
|
|
48
47
|
onWire: () => false,
|
|
@@ -61,7 +60,6 @@ function adapterEntry(facts, make, extra = {}) {
|
|
|
61
60
|
id,
|
|
62
61
|
steer: facts.steer,
|
|
63
62
|
runMib: facts.runMib,
|
|
64
|
-
mcp: facts.mcp,
|
|
65
63
|
oneAlwaysFits: false,
|
|
66
64
|
facts,
|
|
67
65
|
...(installs ? { installs } : {}),
|
package/dist/host-tools.d.ts
CHANGED
|
@@ -2,10 +2,6 @@ import type { Context } from "@earendil-works/chord/context";
|
|
|
2
2
|
import { type ToolExecutionApi, type ToolRegistration } from "@earendil-works/pi-durable";
|
|
3
3
|
import type { HostTool } from "@parcha/agentrun-kernel";
|
|
4
4
|
export { workspaceRelative } from "./workspace-paths.js";
|
|
5
|
-
/** Each tool a harness other than pi runs here, by catalog name, and whether a call a crash cut off may run again.
|
|
6
|
-
* `learned_workflow` (learned-workflow.ts LEARNED_WORKFLOW_TOOL, named here as a string so the modules do not import
|
|
7
|
-
* each other) is never run again. */
|
|
8
|
-
export declare const REPLAY: Record<string, "safe" | "never">;
|
|
9
5
|
export { cutUtf8, MAX_BYTES, MAX_LINES } from "./workspace/executors.js";
|
|
10
6
|
/** One call's result, kept by its call id for the run's timeline (an adapter's tool_end carries none). */
|
|
11
7
|
export type ToolResults = Map<string, {
|
|
@@ -51,5 +47,5 @@ export interface HostToolCtx {
|
|
|
51
47
|
/** One pi ToolRegistration `tool` (named `name` by its catalog name) as the kernel's HostTool an adapter session takes:
|
|
52
48
|
* the paid-call seam, then the tool on the run's environment and harness, its answer the text a
|
|
53
49
|
* model reads (the output or the failure, a write's or an error's path named relative to the run's folder). Undefined when
|
|
54
|
-
* `name` is not one a host runs (
|
|
50
|
+
* `name` is not one a host runs (tool-list.ts `replay`). */
|
|
55
51
|
export declare function hostToolOf(name: string, tool: ToolRegistration, ctx: HostToolCtx): HostTool | undefined;
|
package/dist/host-tools.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { withAbortSignal } from "@earendil-works/chord/context";
|
|
2
2
|
import { createModels } from "@earendil-works/pi-ai/models";
|
|
3
3
|
import { ROOT_CONVERSATION_ID } from "@earendil-works/pi-durable";
|
|
4
|
-
import {
|
|
5
|
-
import { WEB_SEARCH_TOOL } from "./web-search.js";
|
|
4
|
+
import { replayOf } from "./tool-list.js";
|
|
6
5
|
import { realOf, workspaceRelative } from "./workspace-paths.js";
|
|
7
6
|
import { bounded, imagesOf, textOf } from "./workspace/executors.js";
|
|
8
7
|
export { workspaceRelative } from "./workspace-paths.js";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* each other) is never run again. */
|
|
12
|
-
export const REPLAY = { read: "safe", write: "never", edit: "never", bash: "never", [WEB_FETCH_TOOL]: "safe", [WEB_SEARCH_TOOL]: "safe", "monid.discover": "safe", "monid.inspect": "safe", "monid.run": "never", bash_background: "never", bash_output: "safe", bash_input: "never", bash_signal: "never", bash_list: "safe", learned_workflow: "never" };
|
|
8
|
+
// Each tool a harness other than pi runs here, by catalog name, and whether a call a crash cut off may run again, is its
|
|
9
|
+
// row's `replay` (tool-list.ts). `learned_workflow` (learned-workflow.ts LEARNED_WORKFLOW_TOOL) is never run again.
|
|
13
10
|
// pi's limits on a tool's output, and how a call's output is held within them, are the executors' (workspace/executors.ts).
|
|
14
11
|
export { cutUtf8, MAX_BYTES, MAX_LINES } from "./workspace/executors.js";
|
|
15
12
|
/** The members of pi's ToolExecutionApi a host tool's api gives. They are typed against pi's own type (`HostApi`), so a
|
|
@@ -38,9 +35,9 @@ const SAYS_PATH = new Set(["write", "edit"]);
|
|
|
38
35
|
/** One pi ToolRegistration `tool` (named `name` by its catalog name) as the kernel's HostTool an adapter session takes:
|
|
39
36
|
* the paid-call seam, then the tool on the run's environment and harness, its answer the text a
|
|
40
37
|
* model reads (the output or the failure, a write's or an error's path named relative to the run's folder). Undefined when
|
|
41
|
-
* `name` is not one a host runs (
|
|
38
|
+
* `name` is not one a host runs (tool-list.ts `replay`). */
|
|
42
39
|
export function hostToolOf(name, tool, ctx) {
|
|
43
|
-
const replay =
|
|
40
|
+
const replay = replayOf(name);
|
|
44
41
|
if (!replay)
|
|
45
42
|
return undefined;
|
|
46
43
|
return {
|
|
@@ -59,7 +56,7 @@ export function hostToolOf(name, tool, ctx) {
|
|
|
59
56
|
const out = bounded(tool.outputLimits);
|
|
60
57
|
const notes = [];
|
|
61
58
|
const env = await ctx.env();
|
|
62
|
-
// The call's id and the run's store, as pi's: a paid call marks and books its charge there
|
|
59
|
+
// The call's id and the run's store, as pi's: a paid call marks and books its charge there.
|
|
63
60
|
const api = hostApi({
|
|
64
61
|
env, callId,
|
|
65
62
|
commit: ctx.commit,
|
|
@@ -71,7 +68,7 @@ export function hostToolOf(name, tool, ctx) {
|
|
|
71
68
|
snapshot: ctx.snapshot, waitForTask: ctx.waitForTask,
|
|
72
69
|
});
|
|
73
70
|
// A tool that throws (bash on a non-zero exit or a timeout) still answers with its output, as pi's harness does;
|
|
74
|
-
//
|
|
71
|
+
// one that answers a failure as an error result is kept as it is.
|
|
75
72
|
const result = await tool.execute(args, api, withAbortSignal(signal, ctx.context)).catch((error) => ({ failed: error.message, isError: true }));
|
|
76
73
|
// pi names a result's blocks `output`; its bash answers its exit as a result's diagnostic.
|
|
77
74
|
const given = result;
|
package/dist/hosted-search.d.ts
CHANGED
|
@@ -21,8 +21,6 @@ export declare const OPENAI_SEARCH_TOOL: Readonly<{
|
|
|
21
21
|
export declare const OPENAI_SEARCH_LIMIT: Readonly<{
|
|
22
22
|
max_tool_calls: 5;
|
|
23
23
|
}>;
|
|
24
|
-
/** $10 per 1,000 searches (Anthropic) or calls (OpenAI). */
|
|
25
|
-
export declare const SEARCH_USD = 0.01;
|
|
26
24
|
/** What a hosted search asks: the run's models a search request goes through (on the runner, the session's port: its
|
|
27
25
|
* proxy, policy, key, price and cap), handed to each search by its run, never kept per process. */
|
|
28
26
|
export type SearchModels = Pick<Models, "getModel" | "completeSimple">;
|
package/dist/hosted-search.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { clip, TITLE_CAP } from "./web-fetch-direct.js";
|
|
2
|
-
import { sideRequests } from "./cap.js";
|
|
3
2
|
import { ANSWER_MAX, snippetOf } from "./web-search.js";
|
|
4
3
|
export const HOSTED_MAX_USES = 5;
|
|
5
4
|
/** One search's results billed as input: about 25,000 tokens, a working estimate. */
|
|
@@ -13,11 +12,6 @@ export const OPENAI_SEARCH_TOOL = Object.freeze({ type: "web_search", external_w
|
|
|
13
12
|
/** OpenAI's hosted search has no per-tool limit: the Responses API's `max_tool_calls` caps the built-in tool calls of the
|
|
14
13
|
* request at the HOSTED_MAX_USES its fee is reserved for, as Anthropic's tool's `max_uses` does. */
|
|
15
14
|
export const OPENAI_SEARCH_LIMIT = Object.freeze({ max_tool_calls: HOSTED_MAX_USES });
|
|
16
|
-
/** $10 per 1,000 searches (Anthropic) or calls (OpenAI). */
|
|
17
|
-
export const SEARCH_USD = 0.01;
|
|
18
|
-
/** OpenAI's models that bill each call's search content as a fixed block of 8,000 input tokens apart from the response's
|
|
19
|
-
* usage: the block is added to the fee at the model's input price. */
|
|
20
|
-
const BLOCK_BILLED = /^gpt-(?:4o|4\.1)-mini(?:-|$)/;
|
|
21
15
|
const ANSWER_TOKENS = 2_048;
|
|
22
16
|
/** As Exa's and Parallel's searches stop. */
|
|
23
17
|
const TIMEOUT_MS = 60_000;
|
|
@@ -32,13 +26,9 @@ function reader(anthropic) {
|
|
|
32
26
|
const hit = hits.get(url) ?? {};
|
|
33
27
|
hits.set(url, { ...found, ...Object.fromEntries(Object.entries(hit).filter(([, value]) => value)) });
|
|
34
28
|
};
|
|
35
|
-
let reported;
|
|
36
|
-
let calls = 0;
|
|
37
29
|
let failed;
|
|
38
30
|
const anthropicEvent = (event) => {
|
|
39
31
|
const block = event.content_block;
|
|
40
|
-
if (event.type === "content_block_start" && block?.type === "server_tool_use" && block.name === "web_search")
|
|
41
|
-
calls += 1;
|
|
42
32
|
if (event.type === "content_block_start" && block?.type === "web_search_tool_result") {
|
|
43
33
|
if (!Array.isArray(block.content))
|
|
44
34
|
failed = text(block.content?.error_code) ?? "the search failed";
|
|
@@ -49,14 +39,10 @@ function reader(anthropic) {
|
|
|
49
39
|
const citation = event.delta?.type === "citations_delta" ? event.delta.citation : undefined;
|
|
50
40
|
if (citation)
|
|
51
41
|
add(citation.url, { title: text(citation.title), snippet: text(citation.cited_text) });
|
|
52
|
-
const used = event.usage?.server_tool_use?.web_search_requests;
|
|
53
|
-
if (event.type === "message_delta" && typeof used === "number")
|
|
54
|
-
reported = used;
|
|
55
42
|
};
|
|
56
43
|
const openaiEvent = (event) => {
|
|
57
44
|
const item = event.item;
|
|
58
45
|
if (event.type === "response.output_item.done" && item?.type === "web_search_call") {
|
|
59
|
-
calls += 1;
|
|
60
46
|
for (const source of list(item.action?.sources))
|
|
61
47
|
add(source.url, {});
|
|
62
48
|
}
|
|
@@ -72,14 +58,9 @@ function reader(anthropic) {
|
|
|
72
58
|
}
|
|
73
59
|
}
|
|
74
60
|
}
|
|
75
|
-
const used = (event.response?.tool_usage?.web_search)?.num_requests;
|
|
76
|
-
if ((event.type === "response.completed" || event.type === "response.incomplete") && typeof used === "number")
|
|
77
|
-
reported = used;
|
|
78
61
|
};
|
|
79
62
|
return {
|
|
80
63
|
event: (event) => (anthropic ? anthropicEvent : openaiEvent)((event ?? {})),
|
|
81
|
-
/** The searches the provider reported, else the search calls its answer held. */
|
|
82
|
-
searches: () => reported ?? calls,
|
|
83
64
|
failed: () => (hits.size ? undefined : failed),
|
|
84
65
|
hits: () => [...hits].map(([url, hit]) => ({ url, title: clip(hit.title ?? "", TITLE_CAP), snippet: snippetOf(hit.snippet ?? ""), ...(hit.published ? { published: hit.published } : {}) })),
|
|
85
66
|
};
|
|
@@ -100,8 +81,6 @@ export async function hostedSearch(query, n, ref, signal, models) {
|
|
|
100
81
|
return { error: `web_search: ${ref} has no hosted web search here` };
|
|
101
82
|
const read = reader(anthropic);
|
|
102
83
|
const context = { messages: [{ role: "user", content: [{ type: "text", text: `Search the web for: ${query}\n\nAnswer briefly from what the search finds, and name each source by its URL.` }], timestamp: Date.now() }] };
|
|
103
|
-
const block = BLOCK_BILLED.test(model.id) ? (8_000 * (model.cost?.input ?? 0)) / 1e6 : 0;
|
|
104
|
-
sideRequests.set(context, { label: "web_search", extraInputTokens: HOSTED_SEARCH_ALLOWANCE_TOKENS, maxFeeUsd: HOSTED_MAX_USES * (SEARCH_USD + block), feeUsd: () => read.searches() * (SEARCH_USD + block) });
|
|
105
84
|
let answer;
|
|
106
85
|
try {
|
|
107
86
|
answer = await models.completeSimple(model, context, {
|
package/dist/key-words.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** Each tool key a person may save, fixed here: its fields (BROWSERBASE_PROJECT_ID is no secret, and is kept the same
|
|
2
|
-
* way), and what it may unlock: tools by name, and `decisions.<id>`, a
|
|
2
|
+
* way), and what it may unlock: tools by name, `<source>:*` every tool of a catalog source, and `decisions.<id>`, a
|
|
3
|
+
* workflow's decision provider. */
|
|
3
4
|
export declare const TOOL_KEY_ROWS: readonly [{
|
|
4
5
|
readonly id: "parallel";
|
|
5
6
|
readonly kind: "tool";
|
|
@@ -11,7 +12,7 @@ export declare const TOOL_KEY_ROWS: readonly [{
|
|
|
11
12
|
readonly kind: "tool";
|
|
12
13
|
readonly label: "Monid";
|
|
13
14
|
readonly fields: readonly ["MONID_API_KEY"];
|
|
14
|
-
readonly unlocks: readonly ["monid
|
|
15
|
+
readonly unlocks: readonly ["monid:*"];
|
|
15
16
|
}, {
|
|
16
17
|
readonly id: "browserbase";
|
|
17
18
|
readonly kind: "tool";
|
package/dist/key-words.js
CHANGED
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
// variable to set where the server starts, since a key saved and then removed in Settings was never in the environment.
|
|
4
4
|
import { MODEL_KEYS } from "./model.js";
|
|
5
5
|
/** Each tool key a person may save, fixed here: its fields (BROWSERBASE_PROJECT_ID is no secret, and is kept the same
|
|
6
|
-
* way), and what it may unlock: tools by name, and `decisions.<id>`, a
|
|
6
|
+
* way), and what it may unlock: tools by name, `<source>:*` every tool of a catalog source, and `decisions.<id>`, a
|
|
7
|
+
* workflow's decision provider. */
|
|
7
8
|
export const TOOL_KEY_ROWS = [
|
|
8
9
|
{ id: "parallel", kind: "tool", label: "Parallel", fields: ["PARALLEL_API_KEY"], unlocks: ["web_fetch", "web_search", "decisions.parallel"] },
|
|
9
|
-
|
|
10
|
+
// Every monid endpoint (`monid:<provider>/<endpoint>`, a provider's wildcard too): `<source>:*` unlocks a source's tools.
|
|
11
|
+
{ id: "monid", kind: "tool", label: "Monid", fields: ["MONID_API_KEY"], unlocks: ["monid:*"] },
|
|
10
12
|
{ id: "browserbase", kind: "tool", label: "Browserbase", fields: ["BROWSERBASE_API_KEY", "BROWSERBASE_PROJECT_ID"], unlocks: ["browser"] },
|
|
11
13
|
// The browser's other vendor (tool-plane.ts BROWSER_KEYS): a run's browser is the one its plane picks.
|
|
12
14
|
{ id: "kernel", kind: "tool", label: "Kernel", fields: ["KERNEL_API_KEY"], unlocks: ["browser"] },
|
package/dist/learn/check.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { type LearnedNote } from "./notes.js";
|
|
2
2
|
import { type DraftAsk, type DraftDecisions, type DraftDryRun, type DraftReader } from "./skills.js";
|
|
3
|
+
/** A note's bytes as the note cap counts them: all of `text` but the `compiled_into` line the host adds when a learned
|
|
4
|
+
* workflow is compiled from it (notes.ts compiledLineBytes). A note at the cap stays one once marked: it retires,
|
|
5
|
+
* restores, and a later note supersedes it through the grader, each checked against `note`. A run never sets the line
|
|
6
|
+
* (checkProposal refuses it), so a run's note is counted whole. */
|
|
7
|
+
export declare const noteBytes: (text: string) => number;
|
|
3
8
|
/** Byte caps (UTF-8) and counts. Over a cap is refused, never cut. */
|
|
4
9
|
export declare const CAPS: Readonly<{
|
|
5
|
-
/** One note's file. */
|
|
10
|
+
/** One note's file, as noteBytes counts it: the host's `compiled_into` line on top. */
|
|
6
11
|
note: 4096;
|
|
7
12
|
/** One note a run proposes: the note cap less HOST_LINES, so a run's note stays within `note` once the host merges
|
|
8
13
|
* it, and a person can still retire it and a later run supersede it, each read and checked against `note`. */
|
package/dist/learn/check.js
CHANGED
|
@@ -4,15 +4,20 @@
|
|
|
4
4
|
// here with its bytes; nothing the checker refuses is ever written to git. Every problem it reports is printable: its
|
|
5
5
|
// path and detail are cut of the host's secrets and of text shaped like one, and a field over PRINT_MAX is redacted whole.
|
|
6
6
|
import { hiddenCharacter } from "./invisible.js";
|
|
7
|
-
import { INDEX_FILE, INDEX_LINES, NOTE_FILE, parseNoteFile, ruleOf } from "./notes.js";
|
|
7
|
+
import { compiledLineBytes, INDEX_FILE, INDEX_LINES, NOTE_FILE, parseNoteFile, ruleOf } from "./notes.js";
|
|
8
8
|
import { learnedSecretShapes, redactLearned, valueMatcher } from "./secrets.js";
|
|
9
9
|
import { draftProblems, decodedStrings, DECODED_DEPTH, DRY_RUN_FAILED, frontKeys, frontValues, LEARNED_KEYS, learnedName, learnedPlace, setsStatus, skillProblems, WORKFLOWS_DIR } from "./skills.js";
|
|
10
10
|
/** The most the host adds to a run's note as it merges it: `origin: you` and `status: pending`, a front matter line
|
|
11
11
|
* each (notes.ts mergedNote). */
|
|
12
12
|
const HOST_LINES = Buffer.byteLength("origin: you\nstatus: pending\n");
|
|
13
|
+
/** A note's bytes as the note cap counts them: all of `text` but the `compiled_into` line the host adds when a learned
|
|
14
|
+
* workflow is compiled from it (notes.ts compiledLineBytes). A note at the cap stays one once marked: it retires,
|
|
15
|
+
* restores, and a later note supersedes it through the grader, each checked against `note`. A run never sets the line
|
|
16
|
+
* (checkProposal refuses it), so a run's note is counted whole. */
|
|
17
|
+
export const noteBytes = (text) => Buffer.byteLength(text) - compiledLineBytes(text);
|
|
13
18
|
/** Byte caps (UTF-8) and counts. Over a cap is refused, never cut. */
|
|
14
19
|
export const CAPS = Object.freeze({
|
|
15
|
-
/** One note's file. */
|
|
20
|
+
/** One note's file, as noteBytes counts it: the host's `compiled_into` line on top. */
|
|
16
21
|
note: 4096,
|
|
17
22
|
/** One note a run proposes: the note cap less HOST_LINES, so a run's note stays within `note` once the host merges
|
|
18
23
|
* it, and a person can still retire it and a later run supersede it, each read and checked against `note`. */
|
|
@@ -68,6 +73,9 @@ function nameChecked(path, refused, add, outside = "only a .md file at the folde
|
|
|
68
73
|
* values, its front matter in shape. The note when it is. */
|
|
69
74
|
function textChecked(path, size, bytes, refused, add, run = false) {
|
|
70
75
|
const cap = run ? CAPS.runNote : CAPS.note;
|
|
76
|
+
// A person's note (or one main holds) is counted without the host's compiled_into line; a run's whole (it may not set it).
|
|
77
|
+
if (!run && bytes)
|
|
78
|
+
size -= compiledLineBytes(Buffer.from(bytes).toString("utf8"));
|
|
71
79
|
if (size > cap)
|
|
72
80
|
return void add("too_large", `${size} bytes; the cap is ${cap}${run ? " for a run's note" : ""}`, path);
|
|
73
81
|
const text = textOf(path, bytes, refused, add);
|
|
@@ -262,8 +270,8 @@ export function checkProposal(input) {
|
|
|
262
270
|
const note = textChecked(path, change.size ?? change.bytes?.length ?? 0, change.bytes, refused, add, true);
|
|
263
271
|
if (!note)
|
|
264
272
|
return;
|
|
265
|
-
if (["status", "superseded_by", "retired_from", "origin"].some((key) => note.keys.includes(key)))
|
|
266
|
-
return add("status", "a run never sets status, superseded_by, retired_from or
|
|
273
|
+
if (["status", "superseded_by", "retired_from", "origin", "compiled_into"].some((key) => note.keys.includes(key)))
|
|
274
|
+
return add("status", "a run never sets status, superseded_by, retired_from, origin or compiled_into: the host does, when it merges the note, a later one supersedes it, a learned workflow is compiled from it or a person retires it", path);
|
|
267
275
|
candidates.push(note);
|
|
268
276
|
};
|
|
269
277
|
for (const change of changes)
|
package/dist/learn/commit.d.ts
CHANGED
|
@@ -28,6 +28,10 @@ export type LearningChange = {
|
|
|
28
28
|
* it (a person retired or approved it, another run's merge changed it) is a conflict, never written over. The
|
|
29
29
|
* script checks it on main as it commits. Optional, past COMMIT-API.md v1. */
|
|
30
30
|
seed?: string;
|
|
31
|
+
/** A file checked against another commit than `seed`, by its path: a workflow the run's compile turn revised from
|
|
32
|
+
* main's text, against the commit it read that text at (a change to it before that read is what the revision was
|
|
33
|
+
* written over; one after it is a conflict). */
|
|
34
|
+
bases?: Readonly<Record<string, string>>;
|
|
31
35
|
/** New notes written over the note main holds by the same name: each one the run's note supersedes by its own
|
|
32
36
|
* name (the learning loop's takenOnMain), its blob on main in `graded`, so a change since is a conflict. Any
|
|
33
37
|
* other new note main holds a note by when the merge commits is left out alone (`left`, `taken`). */
|
|
@@ -41,6 +45,12 @@ export type LearningChange = {
|
|
|
41
45
|
note: string;
|
|
42
46
|
rule: string;
|
|
43
47
|
}[];
|
|
48
|
+
/** A learned workflow this merge writes, compiled from notes (learn/compile.ts): each of `notes` that is active on
|
|
49
|
+
* main as it commits gets `compiled_into: <workflow>` in the same write (notes.ts compiledInto), and stays served. */
|
|
50
|
+
compiled?: {
|
|
51
|
+
workflow: string;
|
|
52
|
+
notes: string[];
|
|
53
|
+
};
|
|
44
54
|
} | {
|
|
45
55
|
kind: "person";
|
|
46
56
|
action: "edited" | "created" | "retired" | "approved" | "restored";
|
package/dist/learn/commit.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
// the folder's snapshot and the bodies it names. A main that moved under it (the script's exit 3) is computed again on
|
|
5
5
|
// the main that won, as long as no oid the caller read (`graded`, `ifMatch`) changed: a change it did not see is a
|
|
6
6
|
// conflict, never written over. A folder with no main yet is made in the same call (the script's init first).
|
|
7
|
-
import { isHeld, held, retiredLearned } from "./skills.js";
|
|
8
|
-
import { buildIndex, INDEX_FILE, INDEX_LINES, mergedNote, NOTE_FILE, parseNoteFile, ruleOf, supersede } from "./notes.js";
|
|
7
|
+
import { isHeld, held, retiredLearned, WORKFLOWS_DIR } from "./skills.js";
|
|
8
|
+
import { buildIndex, compiledInto, INDEX_FILE, INDEX_LINES, mergedNote, NOTE_FILE, parseNoteFile, ruleOf, supersede } from "./notes.js";
|
|
9
9
|
import { mergeProblems, supersededBy } from "./check.js";
|
|
10
10
|
import { FolderRefused, FolderTooLarge, readLearning, readRunDiff, readSnapshot, runDiffKey, snapshotNotes, textsAt, topOf, writeLearning } from "./folder.js";
|
|
11
11
|
/** The blob `path` is on the snapshot's main: the index, a note, a learned folder's file. */
|
|
@@ -156,6 +156,17 @@ async function mergeOf(change, snapshot, body) {
|
|
|
156
156
|
else
|
|
157
157
|
files.set(path, supersede(await body(path, blobOf(snapshot, path)), by));
|
|
158
158
|
}
|
|
159
|
+
// The notes the merge's compiled workflow does the work of, marked: an active one this merge writes nothing else to
|
|
160
|
+
// (a note it supersedes is no longer one to serve), its text on main as it is now. One gone or not active is left alone.
|
|
161
|
+
const compiledMarks = new Set();
|
|
162
|
+
if (change.compiled && files.has(`${WORKFLOWS_DIR}/${change.compiled.workflow}/workflow.json`)) {
|
|
163
|
+
for (const path of change.compiled.notes) {
|
|
164
|
+
if (!active.has(path) || files.has(path))
|
|
165
|
+
continue;
|
|
166
|
+
files.set(path, compiledInto(await body(path, blobOf(snapshot, path)), change.compiled.workflow));
|
|
167
|
+
compiledMarks.add(path);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
159
170
|
const added = [];
|
|
160
171
|
const written = [];
|
|
161
172
|
for (const [path, text] of files) {
|
|
@@ -170,7 +181,7 @@ async function mergeOf(change, snapshot, body) {
|
|
|
170
181
|
// A merge adds notes and marks the ones they supersede: it never writes over another note main holds.
|
|
171
182
|
if (blobOf(snapshot, path) === undefined)
|
|
172
183
|
added.push(note);
|
|
173
|
-
else if (!marks.some((one) => one.path === path) && !replaced.has(path))
|
|
184
|
+
else if (!marks.some((one) => one.path === path) && !replaced.has(path) && !compiledMarks.has(path))
|
|
174
185
|
refused.push({ rule: "exists", path, detail: "the folder has a note by this name" });
|
|
175
186
|
}
|
|
176
187
|
// mergeProblems asks of the new notes what a merge always asks: a free name, what they supersede active and named
|
|
@@ -187,7 +198,10 @@ async function mergeOf(change, snapshot, body) {
|
|
|
187
198
|
by: { run: change.runId, reason: change.reason, ...(change.round !== undefined && change.round > 1 ? { round: change.round } : {}) },
|
|
188
199
|
writes: [...files].map(([path, text]) => ({ path, text })),
|
|
189
200
|
absent: added.map((note) => note.file),
|
|
190
|
-
...(change.seed ? { same: [...change.files.filter(({ path }) => !isNote(path)).map(({ path }) => path), ...retiring].
|
|
201
|
+
...(change.seed || change.bases ? { same: [...change.files.filter(({ path }) => !isNote(path)).map(({ path }) => path), ...retiring].flatMap((path) => {
|
|
202
|
+
const commit = change.bases?.[path] ?? change.seed;
|
|
203
|
+
return commit ? [{ commit, path }] : [];
|
|
204
|
+
}) } : {}),
|
|
191
205
|
},
|
|
192
206
|
};
|
|
193
207
|
}
|