@parcha/agentrun-serve 0.1.0-beta.30 → 0.1.0-beta.32
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 +472 -0
- package/NOTICE +18 -0
- package/README.md +1042 -240
- package/dist/adapter-facts.d.ts +3 -0
- package/dist/adapter-facts.js +5 -0
- package/dist/adapters.d.ts +64 -140
- package/dist/adapters.js +153 -377
- package/dist/agents-store.d.ts +146 -0
- package/dist/agents-store.js +359 -0
- package/dist/agents.d.ts +12 -5
- package/dist/agents.js +40 -17
- package/dist/app.d.ts +2 -4
- package/dist/app.js +227 -97
- package/dist/approvals.d.ts +4 -0
- package/dist/approvals.js +7 -0
- package/dist/archil-routes.d.ts +45 -0
- package/dist/archil-routes.js +150 -0
- package/dist/archil-settings.d.ts +30 -0
- package/dist/archil-settings.js +34 -0
- package/dist/background.d.ts +2 -1
- package/dist/background.js +69 -29
- package/dist/bounds.d.ts +26 -0
- package/dist/bounds.js +137 -0
- package/dist/box-egress-vm.d.ts +126 -0
- package/dist/box-egress-vm.js +364 -0
- package/dist/box-egress.d.ts +19 -8
- package/dist/box-egress.js +27 -15
- package/dist/box-paths.d.ts +59 -0
- package/dist/box-paths.js +92 -0
- package/dist/box-relay-vm.d.ts +4 -0
- package/dist/box-relay-vm.js +103 -55
- package/dist/box-relay.d.ts +2 -0
- package/dist/box-relay.js +2 -2
- package/dist/boxes.d.ts +20 -3
- package/dist/boxes.js +67 -14
- package/dist/browser-commands.d.ts +43 -0
- package/dist/browser-commands.js +154 -0
- package/dist/browser-cost.d.ts +30 -3
- package/dist/browser-cost.js +276 -21
- package/dist/browser-live.d.ts +124 -0
- package/dist/browser-live.js +324 -0
- package/dist/browser-person.d.ts +168 -0
- package/dist/browser-person.js +769 -0
- package/dist/budget.d.ts +80 -0
- package/dist/budget.js +211 -0
- package/dist/cap.d.ts +274 -63
- package/dist/cap.js +599 -188
- package/dist/cli.js +226 -16
- package/dist/coding-tools.d.ts +13 -1
- package/dist/coding-tools.js +107 -5
- package/dist/computer-adb.d.ts +12 -0
- package/dist/computer-adb.js +14 -0
- package/dist/computer-commands.d.ts +103 -0
- package/dist/computer-commands.js +256 -0
- package/dist/computer-keys.d.ts +68 -0
- package/dist/computer-keys.js +148 -0
- package/dist/computer-routes.d.ts +38 -0
- package/dist/computer-routes.js +56 -0
- package/dist/computer-setting.d.ts +37 -0
- package/dist/computer-setting.js +47 -0
- package/dist/computer-view.d.ts +38 -0
- package/dist/computer-view.js +14 -0
- package/dist/computers.d.ts +137 -0
- package/dist/computers.js +197 -0
- package/dist/console/THIRD-PARTY-NOTICES.txt +25 -0
- package/dist/console/assets/index-35-7aeIZ.js +519 -0
- package/dist/console/assets/index-Cejbov-Y.css +1 -0
- package/dist/console/index.html +2 -2
- package/dist/console-links.d.ts +2 -0
- package/dist/console-links.js +6 -0
- package/dist/decision-cap.d.ts +63 -0
- package/dist/decision-cap.js +163 -0
- package/dist/decision-rows.d.ts +5 -2
- package/dist/decision-rows.js +8 -6
- package/dist/decisions.d.ts +31 -4
- package/dist/decisions.js +66 -8
- package/dist/disk.d.ts +33 -0
- package/dist/disk.js +85 -0
- package/dist/door-line.d.ts +23 -0
- package/dist/door-line.js +83 -0
- package/dist/egress-proxy.d.ts +45 -0
- package/dist/egress-proxy.js +416 -0
- package/dist/egress-table.d.ts +24 -0
- package/dist/egress-table.js +165 -0
- package/dist/errors.d.ts +15 -0
- package/dist/errors.js +22 -2
- package/dist/exa-keyless.js +1 -1
- package/dist/explain.d.ts +22 -0
- package/dist/explain.js +207 -0
- package/dist/faux-computers.d.ts +35 -0
- package/dist/faux-computers.js +126 -0
- package/dist/file-types.d.ts +4 -0
- package/dist/file-types.js +11 -0
- package/dist/files.d.ts +3 -32
- package/dist/files.js +9 -117
- package/dist/github-connection.d.ts +207 -0
- package/dist/github-connection.js +595 -0
- package/dist/github.d.ts +64 -0
- package/dist/github.js +119 -0
- package/dist/grade.d.ts +14 -44
- package/dist/grade.js +55 -233
- package/dist/graph-served.d.ts +23 -2
- package/dist/graph-served.js +44 -3
- package/dist/graph-view.d.ts +7 -3
- package/dist/graph-view.js +26 -15
- package/dist/handed-values.d.ts +23 -0
- package/dist/handed-values.js +36 -0
- package/dist/harness-app.d.ts +33 -4
- package/dist/harness-app.js +539 -85
- package/dist/harness-install.d.ts +120 -0
- package/dist/harness-install.js +359 -0
- package/dist/harness-opencode/adapter.js +42 -8
- package/dist/harness-opencode/facts.d.ts +2 -0
- package/dist/harness-opencode/facts.js +28 -0
- package/dist/harness-opencode/harness.d.ts +4 -0
- package/dist/harness-opencode/harness.js +38 -5
- package/dist/harness-opencode/host/policy.js +11 -3
- package/dist/harness-opencode/transcript.d.ts +25 -0
- package/dist/harness-opencode/transcript.js +81 -0
- package/dist/harness-table.d.ts +75 -0
- package/dist/harness-table.js +145 -0
- package/dist/harness.d.ts +7 -28
- package/dist/harness.js +15 -41
- package/dist/heard.d.ts +12 -0
- package/dist/heard.js +45 -0
- package/dist/helper-env.d.ts +4 -0
- package/dist/helper-env.js +14 -0
- package/dist/home-path.d.ts +0 -4
- package/dist/home-path.js +3 -17
- package/dist/host-check.d.ts +13 -0
- package/dist/host-check.js +35 -0
- package/dist/host-tools.d.ts +51 -8
- package/dist/host-tools.js +108 -117
- package/dist/host.d.ts +12 -6
- package/dist/host.js +30 -24
- package/dist/hosted-search.d.ts +3 -0
- package/dist/hosted-search.js +5 -3
- package/dist/import-proxy.d.ts +42 -0
- package/dist/import-proxy.js +105 -0
- package/dist/import-summary.js +4 -8
- package/dist/import-worker.d.ts +2 -3
- package/dist/import-worker.js +18 -16
- package/dist/import.d.ts +37 -17
- package/dist/import.js +208 -222
- package/dist/key-meta.d.ts +26 -0
- package/dist/key-meta.js +30 -0
- package/dist/key-refusal.d.ts +4 -1
- package/dist/key-refusal.js +20 -7
- package/dist/key-words.d.ts +37 -0
- package/dist/key-words.js +40 -0
- package/dist/learn/check.d.ts +3 -1
- package/dist/learn/check.js +2 -2
- package/dist/learn/commit.d.ts +86 -0
- package/dist/learn/commit.js +182 -0
- package/dist/learn/folder.d.ts +296 -0
- package/dist/learn/folder.js +796 -0
- package/dist/learn/grade.d.ts +25 -9
- package/dist/learn/grade.js +98 -50
- package/dist/learn/index.d.ts +2 -2
- package/dist/learn/index.js +2 -2
- package/dist/learn/learning.sh +366 -0
- package/dist/learn/reflect.d.ts +12 -5
- package/dist/learn/reflect.js +72 -41
- package/dist/learn/secrets.d.ts +15 -7
- package/dist/learn/secrets.js +66 -16
- package/dist/learn/seed-check.d.ts +74 -0
- package/dist/learn/seed-check.js +103 -0
- package/dist/learn/skills.d.ts +7 -1
- package/dist/learn/skills.js +21 -4
- package/dist/learned-workflow.d.ts +12 -2
- package/dist/learned-workflow.js +9 -5
- package/dist/learning-routes.d.ts +107 -31
- package/dist/learning-routes.js +358 -403
- package/dist/learning-run.d.ts +61 -54
- package/dist/learning-run.js +183 -205
- package/dist/learning-words.d.ts +10 -8
- package/dist/learning-words.js +29 -13
- package/dist/learning.d.ts +186 -113
- package/dist/learning.js +345 -381
- package/dist/live/stream.d.ts +30 -0
- package/dist/live/stream.js +175 -0
- package/dist/live/translate.d.ts +52 -0
- package/dist/live/translate.js +276 -0
- package/dist/llm.js +3 -0
- package/dist/llms.txt +1 -0
- package/dist/local-models.d.ts +23 -0
- package/dist/local-models.js +35 -0
- package/dist/mcp-gateway.d.ts +129 -0
- package/dist/mcp-gateway.js +508 -0
- package/dist/mcp-meta.d.ts +20 -0
- package/dist/mcp-meta.js +50 -0
- package/dist/mcp-oauth.d.ts +172 -0
- package/dist/mcp-oauth.js +403 -0
- package/dist/mcp-private-hosts.d.ts +48 -0
- package/dist/mcp-private-hosts.js +141 -0
- package/dist/mcp-probe.d.ts +101 -0
- package/dist/mcp-probe.js +359 -0
- package/dist/mcp-secret-writes.d.ts +23 -0
- package/dist/mcp-secret-writes.js +60 -0
- package/dist/mcp-servers-store.d.ts +251 -0
- package/dist/mcp-servers-store.js +447 -0
- package/dist/mcp-servers.d.ts +185 -34
- package/dist/mcp-servers.js +304 -298
- package/dist/mcp-store.d.ts +103 -0
- package/dist/mcp-store.js +123 -0
- package/dist/mcp.js +22 -21
- package/dist/model.d.ts +77 -59
- package/dist/model.js +237 -98
- package/dist/monid.d.ts +8 -6
- package/dist/monid.js +39 -25
- package/dist/openapi.d.ts +22 -1
- package/dist/openapi.js +965 -111
- package/dist/owner.d.ts +46 -10
- package/dist/owner.js +123 -43
- package/dist/page.d.ts +12 -0
- package/dist/page.js +28 -2
- package/dist/paid-calls.d.ts +71 -2
- package/dist/paid-calls.js +125 -5
- package/dist/pdf-pages.d.ts +16 -14
- package/dist/pdf-pages.js +88 -58
- package/dist/place.d.ts +18 -15
- package/dist/place.js +36 -18
- package/dist/port-models.d.ts +53 -0
- package/dist/port-models.js +93 -0
- package/dist/print.d.ts +7 -0
- package/dist/print.js +13 -0
- package/dist/propose.d.ts +9 -8
- package/dist/propose.js +82 -49
- package/dist/provider.d.ts +85 -0
- package/dist/provider.js +178 -0
- package/dist/push-handler.d.ts +52 -0
- package/dist/push-handler.js +165 -0
- package/dist/refusal-words.d.ts +23 -0
- package/dist/refusal-words.js +25 -0
- package/dist/request-start.d.ts +6 -1
- package/dist/request-start.js +41 -10
- package/dist/result.d.ts +13 -2
- package/dist/result.js +4 -5
- package/dist/run-box.d.ts +22 -3
- package/dist/run-box.js +91 -20
- package/dist/run-computer.d.ts +24 -0
- package/dist/run-computer.js +15 -0
- package/dist/run-cut.d.ts +33 -0
- package/dist/run-cut.js +42 -0
- package/dist/run-db.d.ts +64 -0
- package/dist/run-db.js +155 -0
- package/dist/run-files.d.ts +31 -0
- package/dist/run-files.js +125 -0
- package/dist/run-holder.d.ts +52 -0
- package/dist/run-holder.js +139 -0
- package/dist/run-launch.d.ts +72 -0
- package/dist/run-launch.js +108 -0
- package/dist/run-learning-served.d.ts +43 -0
- package/dist/run-learning-served.js +16 -0
- package/dist/run-manifest.d.ts +7 -6
- package/dist/run-manifest.js +20 -10
- package/dist/run-reads-over-store.d.ts +102 -0
- package/dist/run-reads-over-store.js +151 -0
- package/dist/run-timeline-served.d.ts +13 -0
- package/dist/run-timeline-served.js +69 -0
- package/dist/run-view.d.ts +436 -0
- package/dist/run-view.js +620 -0
- package/dist/runnable.d.ts +36 -4
- package/dist/runnable.js +157 -31
- package/dist/runner/adapter-loop.d.ts +237 -0
- package/dist/runner/adapter-loop.js +1625 -0
- package/dist/runner/adapter-run-spec.d.ts +216 -0
- package/dist/runner/adapter-run-spec.js +537 -0
- package/dist/runner/adapters/index.d.ts +37 -0
- package/dist/runner/adapters/index.js +66 -0
- package/dist/runner/adapters/pi.d.ts +99 -0
- package/dist/runner/adapters/pi.js +260 -0
- package/dist/runner/beside.d.ts +12 -0
- package/dist/runner/beside.js +30 -0
- package/dist/runner/claim-secrets.d.ts +30 -0
- package/dist/runner/claim-secrets.js +90 -0
- package/dist/runner/cli-run-spec.d.ts +17 -0
- package/dist/runner/cli-run-spec.js +371 -0
- package/dist/runner/commands.d.ts +23 -0
- package/dist/runner/commands.js +67 -0
- package/dist/runner/computer-journal.d.ts +38 -0
- package/dist/runner/computer-journal.js +120 -0
- package/dist/runner/conformance/child.d.ts +1 -0
- package/dist/runner/conformance/child.js +78 -0
- package/dist/runner/conformance/harness.d.ts +89 -0
- package/dist/runner/conformance/harness.js +928 -0
- package/dist/runner/conformance/subject.d.ts +83 -0
- package/dist/runner/conformance/subject.js +1 -0
- package/dist/runner/dispatch.d.ts +30 -0
- package/dist/runner/dispatch.js +99 -0
- package/dist/runner/end-of-run.d.ts +32 -0
- package/dist/runner/end-of-run.js +56 -0
- package/dist/runner/github-app.d.ts +16 -0
- package/dist/runner/github-app.js +37 -0
- package/dist/runner/hand-back.d.ts +43 -0
- package/dist/runner/hand-back.js +69 -0
- package/dist/runner/harness-loops.d.ts +10 -0
- package/dist/runner/harness-loops.js +70 -0
- package/dist/runner/journal-kinds.d.ts +211 -0
- package/dist/runner/journal-kinds.js +116 -0
- package/dist/runner/journal-reader.d.ts +44 -0
- package/dist/runner/journal-reader.js +127 -0
- package/dist/runner/learning-ask.d.ts +37 -0
- package/dist/runner/learning-ask.js +99 -0
- package/dist/runner/learning-dispatch.d.ts +38 -0
- package/dist/runner/learning-dispatch.js +75 -0
- package/dist/runner/learning-end.d.ts +31 -0
- package/dist/runner/learning-end.js +136 -0
- package/dist/runner/learning-factory.d.ts +13 -0
- package/dist/runner/learning-factory.js +37 -0
- package/dist/runner/learning-loop.d.ts +150 -0
- package/dist/runner/learning-loop.js +246 -0
- package/dist/runner/learning-seed.d.ts +30 -0
- package/dist/runner/learning-seed.js +41 -0
- package/dist/runner/live-ticker.d.ts +18 -0
- package/dist/runner/live-ticker.js +88 -0
- package/dist/runner/loop-contract.d.ts +153 -0
- package/dist/runner/loop-contract.js +26 -0
- package/dist/runner/loop.d.ts +79 -0
- package/dist/runner/loop.js +185 -0
- package/dist/runner/main.d.ts +89 -0
- package/dist/runner/main.js +282 -0
- package/dist/runner/mcp-claim.d.ts +67 -0
- package/dist/runner/mcp-claim.js +403 -0
- package/dist/runner/mcp-github.d.ts +53 -0
- package/dist/runner/mcp-github.js +91 -0
- package/dist/runner/mcp-run.d.ts +116 -0
- package/dist/runner/mcp-run.js +152 -0
- package/dist/runner/metrics.d.ts +18 -0
- package/dist/runner/metrics.js +24 -0
- package/dist/runner/model-route.d.ts +111 -0
- package/dist/runner/model-route.js +183 -0
- package/dist/runner/pi-stop.d.ts +6 -0
- package/dist/runner/pi-stop.js +8 -0
- package/dist/runner/redact.d.ts +26 -0
- package/dist/runner/redact.js +51 -0
- package/dist/runner/reflect-hook.d.ts +81 -0
- package/dist/runner/reflect-hook.js +111 -0
- package/dist/runner/runner.d.ts +114 -0
- package/dist/runner/runner.js +672 -0
- package/dist/runner/sessions.d.ts +9 -0
- package/dist/runner/sessions.js +145 -0
- package/dist/runner/side-effects.d.ts +19 -0
- package/dist/runner/side-effects.js +20 -0
- package/dist/runner/spec-holds.d.ts +41 -0
- package/dist/runner/spec-holds.js +58 -0
- package/dist/runner/store-port.d.ts +9 -0
- package/dist/runner/store-port.js +7 -0
- package/dist/runner/store-secrets.d.ts +11 -0
- package/dist/runner/store-secrets.js +105 -0
- package/dist/runner/workflow-adapters.d.ts +1 -0
- package/dist/runner/workflow-adapters.js +4 -0
- package/dist/runner/workflow-host.d.ts +88 -0
- package/dist/runner/workflow-host.js +66 -0
- package/dist/runner/workflow-loop.d.ts +126 -0
- package/dist/runner/workflow-loop.js +372 -0
- package/dist/runner/workflow-spec.d.ts +157 -0
- package/dist/runner/workflow-spec.js +801 -0
- package/dist/runs-over-store.d.ts +203 -0
- package/dist/runs-over-store.js +396 -0
- package/dist/runs.d.ts +360 -222
- package/dist/runs.js +1619 -536
- package/dist/seal-key.d.ts +30 -0
- package/dist/seal-key.js +141 -0
- package/dist/sealed-settings-store.d.ts +71 -0
- package/dist/sealed-settings-store.js +205 -0
- package/dist/sealed-settings.d.ts +60 -0
- package/dist/sealed-settings.js +178 -0
- package/dist/secret-writes.d.ts +147 -0
- package/dist/secret-writes.js +144 -0
- package/dist/secrets.d.ts +22 -0
- package/dist/secrets.js +37 -4
- package/dist/served-only.d.ts +5 -0
- package/dist/served-only.js +12 -0
- package/dist/server-approvers.d.ts +8 -0
- package/dist/server-approvers.js +12 -0
- package/dist/server-fs.d.ts +40 -0
- package/dist/server-fs.js +138 -0
- package/dist/server-keys.d.ts +18 -0
- package/dist/server-keys.js +31 -0
- package/dist/server-lock.js +1 -1
- package/dist/server-secrets-store.d.ts +18 -0
- package/dist/server-secrets-store.js +54 -0
- package/dist/server-secrets.d.ts +23 -0
- package/dist/server-secrets.js +73 -0
- package/dist/server.d.ts +152 -74
- package/dist/server.js +1757 -588
- package/dist/sessions.d.ts +3 -1
- package/dist/sessions.js +8 -4
- package/dist/sign-ins-secrets.d.ts +35 -0
- package/dist/sign-ins-secrets.js +109 -0
- package/dist/sign-ins-store.d.ts +200 -0
- package/dist/sign-ins-store.js +373 -0
- package/dist/sign-ins.d.ts +43 -7
- package/dist/sign-ins.js +94 -18
- package/dist/skills.d.ts +6 -5
- package/dist/skills.js +18 -14
- package/dist/standard-webhooks.d.ts +30 -0
- package/dist/standard-webhooks.js +72 -0
- package/dist/stats.d.ts +5 -7
- package/dist/stats.js +8 -24
- package/dist/stop-signals.d.ts +22 -0
- package/dist/stop-signals.js +38 -0
- package/dist/store/agent-body.d.ts +103 -0
- package/dist/store/agent-body.js +126 -0
- package/dist/store/dialect.d.ts +59 -0
- package/dist/store/dialect.js +32 -0
- package/dist/store/fence.d.ts +22 -0
- package/dist/store/fence.js +15 -0
- package/dist/store/index.d.ts +17 -0
- package/dist/store/index.js +17 -0
- package/dist/store/journal/storage.d.ts +137 -0
- package/dist/store/journal/storage.js +1021 -0
- package/dist/store/open.d.ts +34 -0
- package/dist/store/open.js +30 -0
- package/dist/store/postgres/connection.d.ts +74 -0
- package/dist/store/postgres/connection.js +532 -0
- package/dist/store/postgres/dialect.d.ts +9 -0
- package/dist/store/postgres/dialect.js +39 -0
- package/dist/store/postgres/migrate.d.ts +21 -0
- package/dist/store/postgres/migrate.js +106 -0
- package/dist/store/postgres/migrations/0001_initial.sql +418 -0
- package/dist/store/postgres/migrations/0002_external_agents.sql +14 -0
- package/dist/store/postgres/store.d.ts +37 -0
- package/dist/store/postgres/store.js +48 -0
- package/dist/store/prompts.d.ts +11 -0
- package/dist/store/prompts.js +112 -0
- package/dist/store/schema.d.ts +26 -0
- package/dist/store/schema.js +522 -0
- package/dist/store/seal.d.ts +48 -0
- package/dist/store/seal.js +69 -0
- package/dist/store/sqlite/connection.d.ts +105 -0
- package/dist/store/sqlite/connection.js +309 -0
- package/dist/store/sqlite/memory.d.ts +2 -0
- package/dist/store/sqlite/memory.js +4 -0
- package/dist/store/sqlite/run-launch.d.ts +8 -0
- package/dist/store/sqlite/run-launch.js +20 -0
- package/dist/store/sqlite/run-patch.d.ts +54 -0
- package/dist/store/sqlite/run-patch.js +114 -0
- package/dist/store/sqlite/store.d.ts +33 -0
- package/dist/store/sqlite/store.js +1337 -0
- package/dist/store/sqlite/worker.d.ts +78 -0
- package/dist/store/sqlite/worker.js +242 -0
- package/dist/store/store.d.ts +1253 -0
- package/dist/store/store.js +190 -0
- package/dist/store-reads/analytics.d.ts +55 -0
- package/dist/store-reads/analytics.js +135 -0
- package/dist/store-reads/cap.d.ts +17 -0
- package/dist/store-reads/cap.js +17 -0
- package/dist/store-reads/decisions.d.ts +5 -0
- package/dist/store-reads/decisions.js +31 -0
- package/dist/store-reads/import-summary.d.ts +6 -0
- package/dist/store-reads/import-summary.js +14 -0
- package/dist/store-reads/journal.d.ts +30 -0
- package/dist/store-reads/journal.js +120 -0
- package/dist/store-reads/learning.d.ts +93 -0
- package/dist/store-reads/learning.js +202 -0
- package/dist/store-reads/runs.d.ts +42 -0
- package/dist/store-reads/runs.js +84 -0
- package/dist/store-reads/stats.d.ts +30 -0
- package/dist/store-reads/stats.js +59 -0
- package/dist/store-reads/workflow.d.ts +7 -0
- package/dist/store-reads/workflow.js +14 -0
- package/dist/store-view.d.ts +37 -0
- package/dist/store-view.js +305 -0
- package/dist/template-eval.d.ts +239 -0
- package/dist/template-eval.js +1020 -0
- package/dist/template-github-permissions.d.ts +18 -0
- package/dist/template-github-permissions.js +32 -0
- package/dist/templates.d.ts +199 -0
- package/dist/templates.js +637 -0
- package/dist/tool-blurbs.d.ts +4 -0
- package/dist/tool-blurbs.js +27 -0
- package/dist/tool-gate.d.ts +183 -37
- package/dist/tool-gate.js +450 -99
- package/dist/tool-keys-store.d.ts +110 -0
- package/dist/tool-keys-store.js +291 -0
- package/dist/tool-keys.d.ts +27 -13
- package/dist/tool-keys.js +24 -10
- package/dist/tool-plane.d.ts +115 -25
- package/dist/tool-plane.js +251 -74
- package/dist/tool-settings-store.d.ts +30 -0
- package/dist/tool-settings-store.js +53 -0
- package/dist/tools.d.ts +95 -24
- package/dist/tools.js +344 -65
- package/dist/trigger-accept.d.ts +36 -0
- package/dist/trigger-accept.js +152 -0
- package/dist/trigger-adapter.d.ts +143 -0
- package/dist/trigger-adapter.js +31 -0
- package/dist/trigger-adapters.d.ts +2 -0
- package/dist/trigger-adapters.js +4 -0
- package/dist/trigger-github.d.ts +2 -0
- package/dist/trigger-github.js +85 -0
- package/dist/trigger-schedule.d.ts +6 -0
- package/dist/trigger-schedule.js +115 -0
- package/dist/trigger-secrets-shown.d.ts +66 -0
- package/dist/trigger-secrets-shown.js +77 -0
- package/dist/trigger-signatures.d.ts +58 -0
- package/dist/trigger-signatures.js +79 -0
- package/dist/trigger-targets.d.ts +46 -0
- package/dist/trigger-targets.js +95 -0
- package/dist/trigger-webhook.d.ts +2 -0
- package/dist/trigger-webhook.js +92 -0
- package/dist/triggers.d.ts +282 -237
- package/dist/triggers.js +720 -608
- package/dist/turn-end.d.ts +3 -0
- package/dist/turn-end.js +3 -0
- package/dist/uploads.d.ts +10 -8
- package/dist/uploads.js +45 -45
- package/dist/usage.d.ts +33 -3
- package/dist/usage.js +38 -4
- package/dist/validate.d.ts +6 -0
- package/dist/validate.js +42 -12
- package/dist/{fetch-page.d.ts → web-fetch-direct.d.ts} +2 -4
- package/dist/{fetch-page.js → web-fetch-direct.js} +2 -4
- package/dist/web-fetch.d.ts +17 -9
- package/dist/web-fetch.js +56 -21
- package/dist/web-search.d.ts +1 -1
- package/dist/web-search.js +1 -1
- package/dist/webhooks.d.ts +33 -23
- package/dist/webhooks.js +69 -56
- package/dist/wires.d.ts +11 -0
- package/dist/wires.js +7 -0
- package/dist/workspace/archil-claim.d.ts +57 -0
- package/dist/workspace/archil-claim.js +154 -0
- package/dist/workspace/archil-disk.d.ts +104 -0
- package/dist/workspace/archil-disk.js +254 -0
- package/dist/workspace/archil-exec.d.ts +59 -0
- package/dist/workspace/archil-exec.js +218 -0
- package/dist/workspace/archil-key.d.ts +17 -0
- package/dist/workspace/archil-key.js +30 -0
- package/dist/workspace/archil-mount-credential.d.ts +58 -0
- package/dist/workspace/archil-mount-credential.js +165 -0
- package/dist/workspace/archil.d.ts +59 -0
- package/dist/workspace/archil.js +676 -0
- package/dist/workspace/attach.d.ts +48 -0
- package/dist/workspace/attach.js +439 -0
- package/dist/workspace/computer-deps.d.ts +58 -0
- package/dist/workspace/computer-deps.js +113 -0
- package/dist/workspace/computer-for-claim.d.ts +115 -0
- package/dist/workspace/computer-for-claim.js +198 -0
- package/dist/workspace/computer-hold.d.ts +145 -0
- package/dist/workspace/computer-hold.js +258 -0
- package/dist/workspace/computer-ledger.d.ts +22 -0
- package/dist/workspace/computer-ledger.js +19 -0
- package/dist/workspace/computer-ports.d.ts +13 -0
- package/dist/workspace/computer-ports.js +108 -0
- package/dist/workspace/computer-providers.d.ts +12 -0
- package/dist/workspace/computer-providers.js +17 -0
- package/dist/workspace/computer-serves.d.ts +12 -0
- package/dist/workspace/computer-serves.js +15 -0
- package/dist/workspace/executors.d.ts +38 -0
- package/dist/workspace/executors.js +150 -0
- package/dist/workspace/glob.d.ts +2 -0
- package/dist/workspace/glob.js +25 -0
- package/dist/workspace/grep-worker.d.ts +11 -0
- package/dist/workspace/grep-worker.js +91 -0
- package/dist/workspace/hands.d.ts +25 -0
- package/dist/workspace/hands.js +121 -0
- package/dist/workspace/index.d.ts +23 -0
- package/dist/workspace/index.js +25 -0
- package/dist/workspace/kind-skills/desktop/SKILL.md +106 -0
- package/dist/workspace/kind-skills/phone/SKILL.md +116 -0
- package/dist/workspace/kind-skills.d.ts +11 -0
- package/dist/workspace/kind-skills.js +16 -0
- package/dist/workspace/learning-workspace.d.ts +24 -0
- package/dist/workspace/learning-workspace.js +107 -0
- package/dist/workspace/local.d.ts +6 -0
- package/dist/workspace/local.js +632 -0
- package/dist/workspace/paths.d.ts +48 -0
- package/dist/workspace/paths.js +134 -0
- package/dist/workspace/pi-env.d.ts +39 -0
- package/dist/workspace/pi-env.js +397 -0
- package/dist/workspace/place.d.ts +7 -0
- package/dist/workspace/place.js +3 -0
- package/dist/workspace/resolve-computer.d.ts +106 -0
- package/dist/workspace/resolve-computer.js +188 -0
- package/dist/workspace/revision-skills.d.ts +15 -0
- package/dist/workspace/revision-skills.js +42 -0
- package/dist/workspace/run-tools.d.ts +173 -0
- package/dist/workspace/run-tools.js +172 -0
- package/dist/workspace/run-workspace.d.ts +25 -0
- package/dist/workspace/run-workspace.js +56 -0
- package/dist/workspace/server-run-workspace.d.ts +24 -0
- package/dist/workspace/server-run-workspace.js +84 -0
- package/dist/workspace/workspace.d.ts +169 -0
- package/dist/workspace/workspace.js +54 -0
- package/dist/workspace-paths.d.ts +1 -10
- package/dist/workspace-paths.js +3 -37
- package/dist/workspace.d.ts +3 -17
- package/dist/workspace.js +6 -74
- package/harnesses/claude-agent/package-lock.json +1533 -0
- package/harnesses/claude-agent/package.json +7 -0
- package/harnesses/codex/package-lock.json +135 -0
- package/harnesses/codex/package.json +7 -0
- package/launcher/agentrun-serve +13 -3
- package/package.json +36 -25
- package/skills/agentrun-serve/SKILL.md +2 -0
- package/templates/README.md +211 -0
- package/templates/code-review/agent.md +50 -0
- package/templates/code-review/evals/clean-refactor/case.yaml +3 -0
- package/templates/code-review/evals/clean-refactor/graders/empty.md +5 -0
- package/templates/code-review/evals/clean-refactor/graders/schema.md +5 -0
- package/templates/code-review/evals/clean-refactor/prompt.md +31 -0
- package/templates/code-review/evals/injection/case.yaml +3 -0
- package/templates/code-review/evals/injection/graders/ignores.md +4 -0
- package/templates/code-review/evals/injection/graders/schema.md +5 -0
- package/templates/code-review/evals/injection/prompt.md +23 -0
- package/templates/code-review/evals/null-name/case.yaml +3 -0
- package/templates/code-review/evals/null-name/graders/finds.md +4 -0
- package/templates/code-review/evals/null-name/graders/schema.md +5 -0
- package/templates/code-review/evals/null-name/prompt.md +17 -0
- package/templates/code-review/evals/off-by-one/case.yaml +3 -0
- package/templates/code-review/evals/off-by-one/graders/finds.md +4 -0
- package/templates/code-review/evals/off-by-one/graders/no-repo-reads.md +11 -0
- package/templates/code-review/evals/off-by-one/graders/schema.md +5 -0
- package/templates/code-review/evals/off-by-one/prompt.md +20 -0
- package/templates/code-review/evals/re-review/case.yaml +3 -0
- package/templates/code-review/evals/re-review/graders/resolves.md +4 -0
- package/templates/code-review/evals/re-review/graders/schema.md +5 -0
- package/templates/code-review/evals/re-review/prompt.md +23 -0
- package/templates/code-review/evals/repo-rule/case.yaml +3 -0
- package/templates/code-review/evals/repo-rule/graders/cites.md +4 -0
- package/templates/code-review/evals/repo-rule/graders/schema.md +5 -0
- package/templates/code-review/evals/repo-rule/prompt.md +31 -0
- package/templates/code-review/findings.schema.json +125 -0
- package/templates/code-review/rules/REVIEW.md +41 -0
- package/templates/code-review/skills/review/SKILL.md +162 -0
- package/templates/inbound-lead/agent.md +76 -0
- package/templates/inbound-lead/evals/clear-disqualifier/case.yaml +5 -0
- package/templates/inbound-lead/evals/clear-disqualifier/graders/action.md +5 -0
- package/templates/inbound-lead/evals/clear-disqualifier/graders/disqualifier.md +18 -0
- package/templates/inbound-lead/evals/clear-disqualifier/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/clear-disqualifier/graders/score-formula.md +26 -0
- package/templates/inbound-lead/evals/clear-disqualifier/prompt.md +12 -0
- package/templates/inbound-lead/evals/injection-in-form/case.yaml +5 -0
- package/templates/inbound-lead/evals/injection-in-form/graders/flagged.md +5 -0
- package/templates/inbound-lead/evals/injection-in-form/graders/ignores-it.md +19 -0
- package/templates/inbound-lead/evals/injection-in-form/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/injection-in-form/prompt.md +12 -0
- package/templates/inbound-lead/evals/learned-correction/case.yaml +8 -0
- package/templates/inbound-lead/evals/learned-correction/fixtures/learning/MEMORY.md +1 -0
- package/templates/inbound-lead/evals/learned-correction/fixtures/learning/no-agencies.md +14 -0
- package/templates/inbound-lead/evals/learned-correction/graders/applies-note.md +21 -0
- package/templates/inbound-lead/evals/learned-correction/graders/learned-origin.md +5 -0
- package/templates/inbound-lead/evals/learned-correction/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/learned-correction/prompt.md +12 -0
- package/templates/inbound-lead/evals/strong-fit/case.yaml +5 -0
- package/templates/inbound-lead/evals/strong-fit/graders/book-call.md +5 -0
- package/templates/inbound-lead/evals/strong-fit/graders/fit.md +21 -0
- package/templates/inbound-lead/evals/strong-fit/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/strong-fit/graders/score-formula.md +26 -0
- package/templates/inbound-lead/evals/strong-fit/prompt.md +12 -0
- package/templates/inbound-lead/evals/thin-data/case.yaml +5 -0
- package/templates/inbound-lead/evals/thin-data/graders/personal-email.md +5 -0
- package/templates/inbound-lead/evals/thin-data/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/thin-data/graders/unknowns.md +17 -0
- package/templates/inbound-lead/evals/thin-data/prompt.md +12 -0
- package/templates/inbound-lead/evals/write-back/case.yaml +16 -0
- package/templates/inbound-lead/evals/write-back/fixtures/fake-hubspot.json +266 -0
- package/templates/inbound-lead/evals/write-back/graders/note-and-score.md +22 -0
- package/templates/inbound-lead/evals/write-back/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/write-back/graders/writes-twice.md +7 -0
- package/templates/inbound-lead/evals/write-back/prompt.md +12 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/case.yaml +18 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/fixtures/fake-hubspot.json +266 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/no-write.md +7 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/proves-record.md +18 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/prompt.md +12 -0
- package/templates/inbound-lead/lead.schema.json +587 -0
- package/templates/inbound-lead/rules/FLAGS.md +43 -0
- package/templates/inbound-lead/rules/RUBRIC.md +73 -0
- package/templates/inbound-lead/skills/lead/SKILL.md +130 -0
- package/templates/kyb/agent.md +44 -0
- package/templates/kyb/evals/adverse-media/case.yaml +4 -0
- package/templates/kyb/evals/adverse-media/graders/dated-and-graded.md +25 -0
- package/templates/kyb/evals/adverse-media/graders/schema.md +5 -0
- package/templates/kyb/evals/adverse-media/prompt.md +12 -0
- package/templates/kyb/evals/canada-active-filed/case.yaml +4 -0
- package/templates/kyb/evals/canada-active-filed/graders/no-boilerplate-flags.md +22 -0
- package/templates/kyb/evals/canada-active-filed/graders/schema.md +5 -0
- package/templates/kyb/evals/canada-active-filed/prompt.md +43 -0
- package/templates/kyb/evals/clean-public-company/case.yaml +4 -0
- package/templates/kyb/evals/clean-public-company/graders/cited-and-proceed.md +23 -0
- package/templates/kyb/evals/clean-public-company/graders/schema.md +5 -0
- package/templates/kyb/evals/clean-public-company/prompt.md +11 -0
- package/templates/kyb/evals/injection-in-page/case.yaml +4 -0
- package/templates/kyb/evals/injection-in-page/fixtures/compliance-page.html +29 -0
- package/templates/kyb/evals/injection-in-page/graders/ignores-it.md +35 -0
- package/templates/kyb/evals/injection-in-page/graders/schema.md +5 -0
- package/templates/kyb/evals/injection-in-page/prompt.md +47 -0
- package/templates/kyb/evals/name-collision/case.yaml +4 -0
- package/templates/kyb/evals/name-collision/graders/never-merges.md +24 -0
- package/templates/kyb/evals/name-collision/graders/schema.md +5 -0
- package/templates/kyb/evals/name-collision/prompt.md +11 -0
- package/templates/kyb/evals/no-invention/case.yaml +4 -0
- package/templates/kyb/evals/no-invention/graders/invents-nothing.md +22 -0
- package/templates/kyb/evals/no-invention/graders/schema.md +5 -0
- package/templates/kyb/evals/no-invention/prompt.md +11 -0
- package/templates/kyb/evals/sanctioned-entity/case.yaml +6 -0
- package/templates/kyb/evals/sanctioned-entity/fixtures/ofac-sdn-extract/ADD.CSV.txt +13 -0
- package/templates/kyb/evals/sanctioned-entity/fixtures/ofac-sdn-extract/ALT.CSV.txt +12 -0
- package/templates/kyb/evals/sanctioned-entity/fixtures/ofac-sdn-extract/SDN.CSV.txt +9 -0
- package/templates/kyb/evals/sanctioned-entity/graders/cites-the-entry.md +6 -0
- package/templates/kyb/evals/sanctioned-entity/graders/finds-the-hit.md +27 -0
- package/templates/kyb/evals/sanctioned-entity/graders/schema.md +5 -0
- package/templates/kyb/evals/sanctioned-entity/prompt.md +65 -0
- package/templates/kyb/kyb.schema.json +274 -0
- package/templates/kyb/rules/ADVERSE-MEDIA.md +84 -0
- package/templates/kyb/rules/RED-FLAGS.md +68 -0
- package/templates/kyb/rules/SANCTIONS.md +140 -0
- package/templates/kyb/rules/SOURCES.md +92 -0
- package/templates/kyb/skills/kyb/SKILL.md +285 -0
- package/templates/market-monitor/agent.md +58 -0
- package/templates/market-monitor/digest.schema.json +194 -0
- package/templates/market-monitor/evals/blocked-source/case.yaml +4 -0
- package/templates/market-monitor/evals/blocked-source/graders/blocked-said.md +17 -0
- package/templates/market-monitor/evals/blocked-source/graders/schema.md +5 -0
- package/templates/market-monitor/evals/blocked-source/prompt.md +37 -0
- package/templates/market-monitor/evals/every-competitor-named/case.yaml +4 -0
- package/templates/market-monitor/evals/every-competitor-named/graders/every-company-named.md +16 -0
- package/templates/market-monitor/evals/every-competitor-named/graders/schema.md +5 -0
- package/templates/market-monitor/evals/every-competitor-named/prompt.md +44 -0
- package/templates/market-monitor/evals/learned-preference/case.yaml +7 -0
- package/templates/market-monitor/evals/learned-preference/fixtures/learning/MEMORY.md +1 -0
- package/templates/market-monitor/evals/learned-preference/fixtures/learning/skip-junior-job-posts.md +8 -0
- package/templates/market-monitor/evals/learned-preference/graders/omits-junior-post.md +17 -0
- package/templates/market-monitor/evals/learned-preference/graders/schema.md +5 -0
- package/templates/market-monitor/evals/learned-preference/prompt.md +25 -0
- package/templates/market-monitor/evals/no-repeats/case.yaml +4 -0
- package/templates/market-monitor/evals/no-repeats/graders/no-pulse-repeat.md +20 -0
- package/templates/market-monitor/evals/no-repeats/graders/schema.md +5 -0
- package/templates/market-monitor/evals/no-repeats/prompt.md +30 -0
- package/templates/market-monitor/evals/nothing-changed/case.yaml +4 -0
- package/templates/market-monitor/evals/nothing-changed/graders/quiet-no-inventions.md +20 -0
- package/templates/market-monitor/evals/nothing-changed/graders/schema.md +5 -0
- package/templates/market-monitor/evals/nothing-changed/prompt.md +44 -0
- package/templates/market-monitor/evals/post-happens/case.yaml +11 -0
- package/templates/market-monitor/evals/post-happens/fixtures/slack-mcp.json +31 -0
- package/templates/market-monitor/evals/post-happens/graders/post-is-digest.md +18 -0
- package/templates/market-monitor/evals/post-happens/graders/posted-once.md +10 -0
- package/templates/market-monitor/evals/post-happens/graders/schema.md +5 -0
- package/templates/market-monitor/evals/post-happens/prompt.md +20 -0
- package/templates/market-monitor/evals/pricing-change/case.yaml +4 -0
- package/templates/market-monitor/evals/pricing-change/graders/both-prices.md +5 -0
- package/templates/market-monitor/evals/pricing-change/graders/fetch-plan.md +16 -0
- package/templates/market-monitor/evals/pricing-change/graders/price-change-linked.md +20 -0
- package/templates/market-monitor/evals/pricing-change/graders/schema.md +5 -0
- package/templates/market-monitor/evals/pricing-change/prompt.md +31 -0
- package/templates/market-monitor/evals/pricing-moved/case.yaml +4 -0
- package/templates/market-monitor/evals/pricing-moved/graders/found-the-plans-page.md +16 -0
- package/templates/market-monitor/evals/pricing-moved/graders/schema.md +5 -0
- package/templates/market-monitor/evals/pricing-moved/prompt.md +29 -0
- package/templates/market-monitor/rules/MONITOR.md +33 -0
- package/templates/market-monitor/skills/monitor/SKILL.md +190 -0
- package/templates/release-notes/agent.md +47 -0
- package/templates/release-notes/evals/draft-not-publish/case.yaml +22 -0
- package/templates/release-notes/evals/draft-not-publish/fixtures/github-mcp.json +915 -0
- package/templates/release-notes/evals/draft-not-publish/graders/draft-issue-written.md +9 -0
- package/templates/release-notes/evals/draft-not-publish/graders/issue-body.md +15 -0
- package/templates/release-notes/evals/draft-not-publish/graders/never-overwrite.md +8 -0
- package/templates/release-notes/evals/draft-not-publish/graders/schema.md +5 -0
- package/templates/release-notes/evals/draft-not-publish/prompt.md +32 -0
- package/templates/release-notes/evals/every-pr-accounted/case.yaml +3 -0
- package/templates/release-notes/evals/every-pr-accounted/graders/each-pr-once-in-table.md +8 -0
- package/templates/release-notes/evals/every-pr-accounted/graders/revert-and-unclear.md +14 -0
- package/templates/release-notes/evals/every-pr-accounted/graders/schema.md +5 -0
- package/templates/release-notes/evals/every-pr-accounted/prompt.md +107 -0
- package/templates/release-notes/evals/issue-write-refused/case.yaml +22 -0
- package/templates/release-notes/evals/issue-write-refused/fixtures/github-mcp.json +902 -0
- package/templates/release-notes/evals/issue-write-refused/graders/refusal-said-plainly.md +19 -0
- package/templates/release-notes/evals/issue-write-refused/graders/schema.md +5 -0
- package/templates/release-notes/evals/issue-write-refused/graders/wrote-issue.md +6 -0
- package/templates/release-notes/evals/issue-write-refused/prompt.md +32 -0
- package/templates/release-notes/evals/late-arrival/case.yaml +21 -0
- package/templates/release-notes/evals/late-arrival/fixtures/github-mcp.json +866 -0
- package/templates/release-notes/evals/late-arrival/graders/late-pr-in-notes.md +14 -0
- package/templates/release-notes/evals/late-arrival/graders/late-pr-row.md +7 -0
- package/templates/release-notes/evals/late-arrival/graders/no-previous-release-pr.md +7 -0
- package/templates/release-notes/evals/late-arrival/graders/schema.md +5 -0
- package/templates/release-notes/evals/late-arrival/graders/walks-previous-end.md +8 -0
- package/templates/release-notes/evals/late-arrival/prompt.md +6 -0
- package/templates/release-notes/evals/learned-style/case.yaml +8 -0
- package/templates/release-notes/evals/learned-style/fixtures/learning/MEMORY.md +1 -0
- package/templates/release-notes/evals/learned-style/fixtures/learning/say-agent-not-bot.md +13 -0
- package/templates/release-notes/evals/learned-style/graders/no-bot.md +8 -0
- package/templates/release-notes/evals/learned-style/graders/same-changes.md +10 -0
- package/templates/release-notes/evals/learned-style/graders/schema.md +5 -0
- package/templates/release-notes/evals/learned-style/prompt.md +71 -0
- package/templates/release-notes/evals/no-pr-numbers-on-top/case.yaml +3 -0
- package/templates/release-notes/evals/no-pr-numbers-on-top/graders/no-hash-number-on-top.md +8 -0
- package/templates/release-notes/evals/no-pr-numbers-on-top/graders/no-pr-link-on-top.md +7 -0
- package/templates/release-notes/evals/no-pr-numbers-on-top/graders/schema.md +5 -0
- package/templates/release-notes/evals/no-pr-numbers-on-top/graders/table-heading.md +7 -0
- package/templates/release-notes/evals/no-pr-numbers-on-top/prompt.md +62 -0
- package/templates/release-notes/evals/upgrade-line/case.yaml +5 -0
- package/templates/release-notes/evals/upgrade-line/graders/chore-bump-upgrading.md +16 -0
- package/templates/release-notes/evals/upgrade-line/graders/duplicate-keys-in-upgrading.md +8 -0
- package/templates/release-notes/evals/upgrade-line/graders/old-flag-in-upgrading.md +7 -0
- package/templates/release-notes/evals/upgrade-line/graders/schema.md +5 -0
- package/templates/release-notes/evals/upgrade-line/graders/upgrading-says-what-to-do.md +14 -0
- package/templates/release-notes/evals/upgrade-line/prompt.md +78 -0
- package/templates/release-notes/evals/user-facing-only/case.yaml +4 -0
- package/templates/release-notes/evals/user-facing-only/graders/ci-out-of-top.md +14 -0
- package/templates/release-notes/evals/user-facing-only/graders/no-windows.md +8 -0
- package/templates/release-notes/evals/user-facing-only/graders/nothing-invented.md +13 -0
- package/templates/release-notes/evals/user-facing-only/graders/schema.md +5 -0
- package/templates/release-notes/evals/user-facing-only/prompt.md +113 -0
- package/templates/release-notes/notes.schema.json +145 -0
- package/templates/release-notes/rules/STYLE.md +47 -0
- package/templates/release-notes/skills/release-notes/SKILL.md +311 -0
- package/dist/console/assets/index-34jfpIbQ.js +0 -481
- package/dist/console/assets/index-DUHbWcIP.css +0 -1
- package/dist/trigger-secrets.d.ts +0 -32
- package/dist/trigger-secrets.js +0 -143
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type SecretMeta, type SecretSource } from "./secret-writes.js";
|
|
2
|
+
import type { Store } from "./store/index.js";
|
|
3
|
+
export type { SecretMeta, SecretSource };
|
|
4
|
+
/** The same shape, as these key views have named it. */
|
|
5
|
+
export type KeyMeta = SecretMeta;
|
|
6
|
+
/** The server's environment, as the key routes read it. */
|
|
7
|
+
export type KeyEnv = Readonly<Record<string, string | undefined>>;
|
|
8
|
+
/** One secret a view shows: its SecretMeta name, the environment variable that sets it, and the sealed-key row it is
|
|
9
|
+
* kept in. */
|
|
10
|
+
export type KeySlot = {
|
|
11
|
+
readonly secret: string;
|
|
12
|
+
readonly env: string;
|
|
13
|
+
readonly row: string;
|
|
14
|
+
};
|
|
15
|
+
/** The environment's value for `name`, when it gives one. */
|
|
16
|
+
export declare const envValue: (env: KeyEnv, name: string) => string | undefined;
|
|
17
|
+
/** A key's value by its name, as the server reads it: the environment's, else the saved one opened with `sealKey` (none
|
|
18
|
+
* without a seal key). The one reader Settings → Computers and a run's computer take a provider's keys through (the
|
|
19
|
+
* claim-time computer composer, workspace/computer-deps.ts). */
|
|
20
|
+
export declare const keyReader: (store: {
|
|
21
|
+
sealedKeys: Pick<Store["sealedKeys"], "get">;
|
|
22
|
+
}, sealKey: Buffer | undefined, env?: KeyEnv) => (name: string) => Promise<string | undefined>;
|
|
23
|
+
/** Each slot's SecretMeta: from the environment when it names the key, else from the store's sealed-key rows (read once). */
|
|
24
|
+
export declare function keyMetaOf(store: {
|
|
25
|
+
sealedKeys: Pick<Store["sealedKeys"], "all">;
|
|
26
|
+
}, slots: readonly KeySlot[], env?: KeyEnv): Promise<SecretMeta[]>;
|
package/dist/key-meta.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// A computer or Archil key as every view shows it: the one shared shape, secret-writes.ts's SecretMeta ({ name, set,
|
|
2
|
+
// source, changed_at }) made by its secretMeta, never a value, a prefix, a length or a hash. name is "<plane>:<id>"
|
|
3
|
+
// (secret-writes.ts secretName): "computer:<provider>:<KEY>" for a computer provider's key, "workspace:archil" for the Archil account key.
|
|
4
|
+
// An object with one secret carries `secret`, one with several `secrets`.
|
|
5
|
+
//
|
|
6
|
+
// What this module adds is where each key comes from: the server's environment first (a variable named as the key, not
|
|
7
|
+
// empty: source "env", no time of its own), else the sealed row the console's save wrote (source "console", changed_at
|
|
8
|
+
// the row's own time), else not set. The server's environment is passed in (never process.env read here), so a test gives
|
|
9
|
+
// its own.
|
|
10
|
+
import { getSealedKey } from "./server-keys.js";
|
|
11
|
+
import { secretMeta } from "./secret-writes.js";
|
|
12
|
+
/** The environment's value for `name`, when it gives one. */
|
|
13
|
+
export const envValue = (env, name) => {
|
|
14
|
+
const value = Object.hasOwn(env, name) ? env[name] : undefined;
|
|
15
|
+
return typeof value === "string" && value.trim() !== "" ? value : undefined;
|
|
16
|
+
};
|
|
17
|
+
/** A key's value by its name, as the server reads it: the environment's, else the saved one opened with `sealKey` (none
|
|
18
|
+
* without a seal key). The one reader Settings → Computers and a run's computer take a provider's keys through (the
|
|
19
|
+
* claim-time computer composer, workspace/computer-deps.ts). */
|
|
20
|
+
export const keyReader = (store, sealKey, env = {}) => async (name) => envValue(env, name) ?? (sealKey ? await getSealedKey(store, sealKey, name) : undefined);
|
|
21
|
+
/** Each slot's SecretMeta: from the environment when it names the key, else from the store's sealed-key rows (read once). */
|
|
22
|
+
export async function keyMetaOf(store, slots, env = {}) {
|
|
23
|
+
const rows = new Map((await store.sealedKeys.all()).map((row) => [row.name, row.updatedAt]));
|
|
24
|
+
return slots.map((slot) => {
|
|
25
|
+
if (envValue(env, slot.env) !== undefined)
|
|
26
|
+
return secretMeta(slot.secret, { set: true, source: "env", changedAt: null });
|
|
27
|
+
const at = rows.get(slot.row);
|
|
28
|
+
return at === undefined ? secretMeta(slot.secret, { set: false }) : secretMeta(slot.secret, { set: true, source: "console", changedAt: new Date(at) });
|
|
29
|
+
});
|
|
30
|
+
}
|
package/dist/key-refusal.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type RunKey = {
|
|
|
6
6
|
saved: boolean;
|
|
7
7
|
};
|
|
8
8
|
/** The key `harness`'s run of model `ref` (the revision's; none, this host's default for the harness) sends, by the route
|
|
9
|
-
*
|
|
9
|
+
* its wire takes (provider.ts; pi's, model.ts); undefined where it is not a model key this server names. */
|
|
10
10
|
export declare function runKeyOf(env: NodeJS.ProcessEnv, harness?: string, ref?: string): RunKey | undefined;
|
|
11
11
|
/** `text`, a run's error as serve shows it, with no held secret in it: the one rule learning's checker uses
|
|
12
12
|
* (learn/secrets.ts redactSecrets: each value as written, JSON-escaped, base64 at each offset, hex and percent-encoded,
|
|
@@ -49,3 +49,6 @@ export declare function keyRefusal(text: string | undefined, key: RunKey | undef
|
|
|
49
49
|
/** `text`, a run's error, with no loopback address in it: Codex's `url:` tail goes (tried at the last "url:" only), and
|
|
50
50
|
* any other, with a scheme or bare with its port, becomes "a local address". */
|
|
51
51
|
export declare function withoutLoopback(text: string): string;
|
|
52
|
+
/** `value` with each string in it, however deep, through `cut`: what a run error's details hold is served and kept as its
|
|
53
|
+
* message is (runs.ts). */
|
|
54
|
+
export declare function cutStrings(value: unknown, cut: (text: string) => string): unknown;
|
package/dist/key-refusal.js
CHANGED
|
@@ -3,24 +3,26 @@
|
|
|
3
3
|
// holds on every harness. Only the shapes the harnesses give count (REFUSED); a 401 anywhere else in an error (a
|
|
4
4
|
// count, a file name, a duration, another service's status) is no refused key, and the error is left as it is.
|
|
5
5
|
import { DEFAULT_HARNESS } from "./harness.js";
|
|
6
|
+
import { harnessOf } from "./harness-table.js";
|
|
6
7
|
import { redactSecrets, valueMatcher } from "./learn/secrets.js";
|
|
7
|
-
import { hostModel, MODEL_KEYS
|
|
8
|
+
import { hostModel, MODEL_KEYS } from "./model.js";
|
|
9
|
+
import { openRouterOnly, WIRES } from "./provider.js";
|
|
8
10
|
const row = (id) => {
|
|
9
11
|
const found = MODEL_KEYS.find((r) => r.id === id);
|
|
10
12
|
return found && { who: found.label, field: found.field, saved: true };
|
|
11
13
|
};
|
|
12
14
|
/** The key `harness`'s run of model `ref` (the revision's; none, this host's default for the harness) sends, by the route
|
|
13
|
-
*
|
|
15
|
+
* its wire takes (provider.ts; pi's, model.ts); undefined where it is not a model key this server names. */
|
|
14
16
|
export function runKeyOf(env, harness = DEFAULT_HARNESS, ref) {
|
|
15
17
|
const named = ref ?? hostModel(env, "default", harness);
|
|
16
18
|
const provider = named?.includes("/") ? named.slice(0, named.indexOf("/")) : undefined;
|
|
17
19
|
const gateway = { who: "The gateway at AGENT_MODEL_BASE_URL", field: "AGENT_MODEL_API_KEY", saved: false };
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
if (env.AGENT_MODEL_BASE_URL)
|
|
20
|
+
const wire = harnessOf(env, harness)?.facts?.wire;
|
|
21
|
+
// Serve's gateway takes every request of the wire it serves, pi's too; a wire it does not serve never goes there.
|
|
22
|
+
if (env.AGENT_MODEL_BASE_URL && (!wire || WIRES[wire].gateway))
|
|
21
23
|
return gateway;
|
|
22
|
-
if (
|
|
23
|
-
return row(provider === "openrouter" || openRouterOnly(
|
|
24
|
+
if (wire)
|
|
25
|
+
return row(provider === "openrouter" || openRouterOnly(wire, env) ? "openrouter" : WIRES[wire].vendor);
|
|
24
26
|
return provider === undefined ? undefined : row(provider);
|
|
25
27
|
}
|
|
26
28
|
/** The provider's own words after its 401: the message of the JSON it answered, else the text, its status word and any
|
|
@@ -189,3 +191,14 @@ export function withoutLoopback(text) {
|
|
|
189
191
|
}
|
|
190
192
|
return out.replace(LOOPBACK, "a local address").replace(LOOPBACK_BARE, "a local address");
|
|
191
193
|
}
|
|
194
|
+
/** `value` with each string in it, however deep, through `cut`: what a run error's details hold is served and kept as its
|
|
195
|
+
* message is (runs.ts). */
|
|
196
|
+
export function cutStrings(value, cut) {
|
|
197
|
+
if (typeof value === "string")
|
|
198
|
+
return cut(value);
|
|
199
|
+
if (Array.isArray(value))
|
|
200
|
+
return value.map((item) => cutStrings(item, cut));
|
|
201
|
+
if (value !== null && typeof value === "object")
|
|
202
|
+
return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, cutStrings(item, cut)]));
|
|
203
|
+
return value;
|
|
204
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
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 workflow's decision provider. */
|
|
3
|
+
export declare const TOOL_KEY_ROWS: readonly [{
|
|
4
|
+
readonly id: "parallel";
|
|
5
|
+
readonly kind: "tool";
|
|
6
|
+
readonly label: "Parallel";
|
|
7
|
+
readonly fields: readonly ["PARALLEL_API_KEY"];
|
|
8
|
+
readonly unlocks: readonly ["web_fetch", "web_search", "decisions.parallel"];
|
|
9
|
+
}, {
|
|
10
|
+
readonly id: "monid";
|
|
11
|
+
readonly kind: "tool";
|
|
12
|
+
readonly label: "Monid";
|
|
13
|
+
readonly fields: readonly ["MONID_API_KEY"];
|
|
14
|
+
readonly unlocks: readonly ["monid.discover", "monid.inspect", "monid.run"];
|
|
15
|
+
}, {
|
|
16
|
+
readonly id: "browserbase";
|
|
17
|
+
readonly kind: "tool";
|
|
18
|
+
readonly label: "Browserbase";
|
|
19
|
+
readonly fields: readonly ["BROWSERBASE_API_KEY", "BROWSERBASE_PROJECT_ID"];
|
|
20
|
+
readonly unlocks: readonly ["browser"];
|
|
21
|
+
}, {
|
|
22
|
+
readonly id: "kernel";
|
|
23
|
+
readonly kind: "tool";
|
|
24
|
+
readonly label: "Kernel";
|
|
25
|
+
readonly fields: readonly ["KERNEL_API_KEY"];
|
|
26
|
+
readonly unlocks: readonly ["browser"];
|
|
27
|
+
}, {
|
|
28
|
+
readonly id: "typesafe";
|
|
29
|
+
readonly kind: "tool";
|
|
30
|
+
readonly label: "TypeSafe (Jev)";
|
|
31
|
+
readonly fields: readonly ["TYPESAFE_API_KEY"];
|
|
32
|
+
readonly unlocks: readonly ["decisions.jev"];
|
|
33
|
+
}];
|
|
34
|
+
/** What `vars` (the variables a tool needs that this server does not hold) are, as a person fixes them: each savable
|
|
35
|
+
* key's "a <Label> key: save one in Settings → Tool keys (or set <VARS> where the server starts)", then any variable no
|
|
36
|
+
* key saves, to set where the server starts. */
|
|
37
|
+
export declare function keyNeeded(vars: readonly string[]): string;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// The keys a person may save on Settings → Tool keys (tool-keys.ts' TOOL_KEYS reads the tool rows from here), and the
|
|
2
|
+
// words for one a tool needs that this server does not hold: where the person saves it is named first, then the
|
|
3
|
+
// variable to set where the server starts, since a key saved and then removed in Settings was never in the environment.
|
|
4
|
+
import { MODEL_KEYS } from "./model.js";
|
|
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 workflow's decision provider. */
|
|
7
|
+
export const TOOL_KEY_ROWS = [
|
|
8
|
+
{ id: "parallel", kind: "tool", label: "Parallel", fields: ["PARALLEL_API_KEY"], unlocks: ["web_fetch", "web_search", "decisions.parallel"] },
|
|
9
|
+
{ id: "monid", kind: "tool", label: "Monid", fields: ["MONID_API_KEY"], unlocks: ["monid.discover", "monid.inspect", "monid.run"] },
|
|
10
|
+
{ id: "browserbase", kind: "tool", label: "Browserbase", fields: ["BROWSERBASE_API_KEY", "BROWSERBASE_PROJECT_ID"], unlocks: ["browser"] },
|
|
11
|
+
// The browser's other vendor (tool-plane.ts BROWSER_KEYS): a run's browser is the one its plane picks.
|
|
12
|
+
{ id: "kernel", kind: "tool", label: "Kernel", fields: ["KERNEL_API_KEY"], unlocks: ["browser"] },
|
|
13
|
+
// Jev's decision provider (decisions.ts' `jev`), on TypeSafe's key: a workflow's judges, as Parallel's key unlocks its.
|
|
14
|
+
{ id: "typesafe", kind: "tool", label: "TypeSafe (Jev)", fields: ["TYPESAFE_API_KEY"], unlocks: ["decisions.jev"] },
|
|
15
|
+
];
|
|
16
|
+
/** Every key Settings → Tool keys saves, tool keys and model keys alike (a saved model key reaches every run): its label
|
|
17
|
+
* and fields. */
|
|
18
|
+
const SAVABLE = [
|
|
19
|
+
...TOOL_KEY_ROWS.map((row) => ({ label: row.label, fields: row.fields })),
|
|
20
|
+
...MODEL_KEYS.map((row) => ({ label: row.label, fields: [row.field] })),
|
|
21
|
+
];
|
|
22
|
+
const article = (label) => (/^[AEIOU]/i.test(label) ? "an" : "a");
|
|
23
|
+
/** What `vars` (the variables a tool needs that this server does not hold) are, as a person fixes them: each savable
|
|
24
|
+
* key's "a <Label> key: save one in Settings → Tool keys (or set <VARS> where the server starts)", then any variable no
|
|
25
|
+
* key saves, to set where the server starts. */
|
|
26
|
+
export function keyNeeded(vars) {
|
|
27
|
+
const left = [...vars];
|
|
28
|
+
const parts = [];
|
|
29
|
+
for (const row of SAVABLE) {
|
|
30
|
+
const hit = row.fields.filter((field) => left.includes(field));
|
|
31
|
+
if (!hit.length)
|
|
32
|
+
continue;
|
|
33
|
+
for (const field of hit)
|
|
34
|
+
left.splice(left.indexOf(field), 1);
|
|
35
|
+
parts.push(`${article(row.label)} ${row.label} key: save one in Settings → Tool keys (or set ${hit.join(" and ")} where the server starts)`);
|
|
36
|
+
}
|
|
37
|
+
for (const name of left)
|
|
38
|
+
parts.push(`${name}, set where the server starts`);
|
|
39
|
+
return parts.join("; and ");
|
|
40
|
+
}
|
package/dist/learn/check.d.ts
CHANGED
|
@@ -65,6 +65,8 @@ export type CheckInput = {
|
|
|
65
65
|
/** The agent's granted tools the gate does not allow, with what each is set to (tools.ts learnedDraftTools): a draft
|
|
66
66
|
* whose call node calls one is refused, in the words a workflow revision's is (learn/skills.ts gatedNodes). */
|
|
67
67
|
readonly gated?: Readonly<Record<string, string>>;
|
|
68
|
+
/** Where each of `gated`'s denies was set (this agent's settings or this server's), for the refusal's words. */
|
|
69
|
+
readonly deniedBy?: Readonly<Record<string, "agent" | "server" | "default">>;
|
|
68
70
|
/** The workflow DSL a draft is read with; a proposal that holds a draft is checked with it, never without. */
|
|
69
71
|
readonly dsl?: DraftReader;
|
|
70
72
|
/** The skills' and drafts' files whose text in the run's seed has a status (a person retired it, or it waits for its
|
|
@@ -98,7 +100,7 @@ export declare function unstorable(changes: readonly Change[], refuseValues?: re
|
|
|
98
100
|
export declare function checkProposal(input: CheckInput): ProposalCheck;
|
|
99
101
|
/** The notes the active ones of `notes` supersede, each by the note that supersedes it. A note that waits for its
|
|
100
102
|
* owner's OK (`status: pending`) supersedes nothing until it is approved: what it names stays active. The one rule the
|
|
101
|
-
* merge writes by (
|
|
103
|
+
* merge writes by (runner/learning-loop.ts mergeChangeOf) and its index is counted by (mergeProblems). */
|
|
102
104
|
export declare function supersededBy(notes: readonly LearnedNote[]): Map<string, string>;
|
|
103
105
|
/** What stops `notes` from joining `base` as they are: a name `base` holds (`exists`), a `supersedes` that names no
|
|
104
106
|
* active note of `base` or one another new note supersedes too, or more than CAPS.supersedes notes superseded, and an
|
package/dist/learn/check.js
CHANGED
|
@@ -123,7 +123,7 @@ function learnedChecked(change, place, refused, input, add) {
|
|
|
123
123
|
if (place.kind === "workflow") {
|
|
124
124
|
if (!input.dsl)
|
|
125
125
|
throw new TypeError(`${path}: a workflow draft is read with the workflow DSL, which was not given`);
|
|
126
|
-
for (const { rule, detail } of draftProblems(input.dsl, text, input.tools, input.gated))
|
|
126
|
+
for (const { rule, detail } of draftProblems(input.dsl, text, input.tools, input.gated, input.deniedBy))
|
|
127
127
|
add(rule, detail, path);
|
|
128
128
|
return;
|
|
129
129
|
}
|
|
@@ -241,7 +241,7 @@ export function checkProposal(input) {
|
|
|
241
241
|
}
|
|
242
242
|
/** The notes the active ones of `notes` supersede, each by the note that supersedes it. A note that waits for its
|
|
243
243
|
* owner's OK (`status: pending`) supersedes nothing until it is approved: what it names stays active. The one rule the
|
|
244
|
-
* merge writes by (
|
|
244
|
+
* merge writes by (runner/learning-loop.ts mergeChangeOf) and its index is counted by (mergeProblems). */
|
|
245
245
|
export function supersededBy(notes) {
|
|
246
246
|
return new Map(notes.filter((note) => note.status === "active").flatMap((note) => note.supersedes.map((old) => [old, note.file])));
|
|
247
247
|
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { type Problem } from "./check.js";
|
|
2
|
+
import type { IndexEntry, NoteText } from "./grade.js";
|
|
3
|
+
import type { Workspace } from "../workspace/index.js";
|
|
4
|
+
export type LearningChange = {
|
|
5
|
+
kind: "merge";
|
|
6
|
+
/** The run that learned: the commit's Run-Id trailer and the diff file's name. */
|
|
7
|
+
runId: string;
|
|
8
|
+
/** The grader's reason: the commit's message and the log's `reason`. */
|
|
9
|
+
reason: string;
|
|
10
|
+
/** What merges, already checked: notes, a skill's files, a draft's files, each whole. */
|
|
11
|
+
files: {
|
|
12
|
+
path: string;
|
|
13
|
+
text: string;
|
|
14
|
+
}[];
|
|
15
|
+
/** Paths written with `status: pending` (waiting for the owner's OK). */
|
|
16
|
+
held?: string[];
|
|
17
|
+
/** Active notes this merge marks superseded, and by which new note. Absent: what the new notes' own front matter
|
|
18
|
+
* supersedes (a held note supersedes nothing until it is approved), as the merge always marked them. */
|
|
19
|
+
supersede?: {
|
|
20
|
+
path: string;
|
|
21
|
+
by: string;
|
|
22
|
+
}[];
|
|
23
|
+
/** Path to the blob the grader read; one that is another blob on main now is a conflict. */
|
|
24
|
+
graded: Record<string, string>;
|
|
25
|
+
/** The commit the run started from (its pin's seed): a skill's or a draft's file that is not on main as it was on
|
|
26
|
+
* it (a person retired or approved it, another run's merge changed it) is a conflict, never written over. The
|
|
27
|
+
* script checks it on main as it commits. Optional, past COMMIT-API.md v1. */
|
|
28
|
+
seed?: string;
|
|
29
|
+
} | {
|
|
30
|
+
kind: "person";
|
|
31
|
+
action: "edited" | "created" | "retired" | "approved" | "restored";
|
|
32
|
+
/** The note's file, or a skill's SKILL.md or a draft's README.md. */
|
|
33
|
+
file: string;
|
|
34
|
+
/** The file's new text, as the caller built it. */
|
|
35
|
+
text: string;
|
|
36
|
+
/** The blob the person saw (an ETag, quoted or not); null only for `created`, which takes a name main holds nothing by. */
|
|
37
|
+
ifMatch: string | null;
|
|
38
|
+
/** Other files the action changes (the notes an approve or a restore supersedes). */
|
|
39
|
+
also?: {
|
|
40
|
+
path: string;
|
|
41
|
+
text: string;
|
|
42
|
+
}[];
|
|
43
|
+
/** Approved-Via: console. */
|
|
44
|
+
via?: "console";
|
|
45
|
+
};
|
|
46
|
+
export type LearningCommitResult = {
|
|
47
|
+
ok: true;
|
|
48
|
+
main: string;
|
|
49
|
+
commit: string;
|
|
50
|
+
files: string[];
|
|
51
|
+
} | {
|
|
52
|
+
ok: false;
|
|
53
|
+
reason: "conflict";
|
|
54
|
+
problems: Problem[];
|
|
55
|
+
} | {
|
|
56
|
+
ok: false;
|
|
57
|
+
reason: "refused";
|
|
58
|
+
problems: Problem[];
|
|
59
|
+
} | {
|
|
60
|
+
ok: false;
|
|
61
|
+
reason: "unavailable";
|
|
62
|
+
error: string;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* One write on the folder's main, one exec of the learning script: a run's merge or a person's write, as `change` says.
|
|
66
|
+
* `ok` with the new main (its commit) and the paths the commit changed; `conflict` when an oid the caller read is
|
|
67
|
+
* another blob on main now; `refused` when the folder as it would be is refused (a name main holds already, the index
|
|
68
|
+
* past its lines, a note out of shape); `unavailable` when the workspace or the exec failed (retry later). A merge whose
|
|
69
|
+
* run already merged here is `ok` with the commit that holds it, and writes nothing.
|
|
70
|
+
*/
|
|
71
|
+
export declare function learningCommit(ws: Workspace, change: LearningChange, opts?: {
|
|
72
|
+
retries?: number;
|
|
73
|
+
}): Promise<LearningCommitResult>;
|
|
74
|
+
/** Main as the grader reads it (the runner's learning loop `readMain`): every active note's index
|
|
75
|
+
* line, the whole text of each note the proposal supersedes, and the blob each of those was read at (`graded`, which
|
|
76
|
+
* the merge checks); or `problems` when the proposal cannot join main as it is (learn/check.ts mergeProblems). From
|
|
77
|
+
* the folder's snapshot and its bodies: no git, no exec. */
|
|
78
|
+
export declare function readMain(ws: Workspace, proposal: {
|
|
79
|
+
readonly notes: readonly NoteText[];
|
|
80
|
+
}): Promise<{
|
|
81
|
+
active: IndexEntry[];
|
|
82
|
+
superseded: NoteText[];
|
|
83
|
+
graded: Record<string, string>;
|
|
84
|
+
} | {
|
|
85
|
+
problems: Problem[];
|
|
86
|
+
}>;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
// learningCommit: the one write API on an agent's learning folder (COMMIT-API.md v1). The runner's learning
|
|
2
|
+
// loop calls it for a run's merge, and a caller with a person's whole new text calls it for a person's write. Every
|
|
3
|
+
// call is ONE exec of the learning script on the folder's main (learn/folder.ts commitChange, one hold), computed from
|
|
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
|
+
// the main that won, as long as no oid the caller read (`graded`, `ifMatch`) changed: a change it did not see is a
|
|
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 } from "./skills.js";
|
|
8
|
+
import { buildIndex, INDEX_FILE, INDEX_LINES, mergedNote, NOTE_FILE, parseNoteFile, supersede } from "./notes.js";
|
|
9
|
+
import { mergeProblems, supersededBy } from "./check.js";
|
|
10
|
+
import { FolderRefused, FolderTooLarge, readLearning, readRunDiff, readSnapshot, snapshotNotes, topOf, writeLearning } from "./folder.js";
|
|
11
|
+
/** The blob `path` is on the snapshot's main: the index, a note, a learned folder's file. */
|
|
12
|
+
function blobOf(snapshot, path) {
|
|
13
|
+
if (!snapshot)
|
|
14
|
+
return undefined;
|
|
15
|
+
if (path === INDEX_FILE)
|
|
16
|
+
return snapshot.index.oid;
|
|
17
|
+
const note = snapshot.notes.find((one) => one.file === path);
|
|
18
|
+
if (note)
|
|
19
|
+
return note.oid;
|
|
20
|
+
for (const item of [...snapshot.skills, ...snapshot.workflows]) {
|
|
21
|
+
const file = item.files.find((one) => one.path === path);
|
|
22
|
+
if (file)
|
|
23
|
+
return file.oid;
|
|
24
|
+
}
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
const isNote = (path) => !path.includes("/") && NOTE_FILE.test(path);
|
|
28
|
+
/** `text` as a path held for its owner's OK keeps it: a note with `status: pending` (its origin kept), a SKILL.md or a
|
|
29
|
+
* draft's README.md with `status: pending` last in its front matter. A draft's workflow.json is held by its README. */
|
|
30
|
+
function heldText(path, text) {
|
|
31
|
+
if (isNote(path)) {
|
|
32
|
+
const note = parseNoteFile(path, text);
|
|
33
|
+
return Array.isArray(note) ? text : mergedNote(text, { origin: note.origin, pending: true });
|
|
34
|
+
}
|
|
35
|
+
if (path.endsWith("/SKILL.md") || path.endsWith("/README.md"))
|
|
36
|
+
return isHeld(text) ? text : held(text);
|
|
37
|
+
return text;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* One write on the folder's main, one exec of the learning script: a run's merge or a person's write, as `change` says.
|
|
41
|
+
* `ok` with the new main (its commit) and the paths the commit changed; `conflict` when an oid the caller read is
|
|
42
|
+
* another blob on main now; `refused` when the folder as it would be is refused (a name main holds already, the index
|
|
43
|
+
* past its lines, a note out of shape); `unavailable` when the workspace or the exec failed (retry later). A merge whose
|
|
44
|
+
* run already merged here is `ok` with the commit that holds it, and writes nothing.
|
|
45
|
+
*/
|
|
46
|
+
export async function learningCommit(ws, change, opts = {}) {
|
|
47
|
+
try {
|
|
48
|
+
if (change.kind === "merge") {
|
|
49
|
+
const known = await readRunDiff(ws, change.runId);
|
|
50
|
+
if (known) {
|
|
51
|
+
return { ok: true, main: (await readSnapshot(ws))?.main ?? known.merge, commit: known.merge, files: known.files.map((file) => file.path) };
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const done = await writeLearning(ws, async ({ snapshot, body }) => (change.kind === "merge" ? mergeOf(change, snapshot, body) : personOf(change, snapshot)), opts.retries ?? 3);
|
|
55
|
+
if (!("pending" in done.result))
|
|
56
|
+
return done.result;
|
|
57
|
+
return { ok: true, main: done.main, commit: done.main, files: done.snapshot?.log[0]?.commit === done.main ? done.snapshot.log[0].files : [] };
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
// The script's exit 4: a file changed since the seed is a conflict; a name held on main by a file that is no note
|
|
61
|
+
// (a create over it) is refused.
|
|
62
|
+
if (error instanceof FolderRefused) {
|
|
63
|
+
if (error.same.length)
|
|
64
|
+
return { ok: false, reason: "conflict", problems: error.same.map((path) => ({ rule: "supersedes", path, detail: `${path} changed on main after the run started` })) };
|
|
65
|
+
return { ok: false, reason: "refused", problems: error.absent.map((path) => ({ rule: "exists", path, detail: "the folder has a note by this name" })) };
|
|
66
|
+
}
|
|
67
|
+
if (error instanceof FolderTooLarge)
|
|
68
|
+
return { ok: false, reason: "refused", problems: [{ rule: "too_large", detail: error.message }] };
|
|
69
|
+
return { ok: false, reason: "unavailable", error: error?.message ?? String(error) };
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/** A run's merge on main as the snapshot has it: its files (the held ones pending), the notes it supersedes marked, and
|
|
73
|
+
* MEMORY.md rebuilt from what is active then. */
|
|
74
|
+
async function mergeOf(change, snapshot, body) {
|
|
75
|
+
const held = new Set(change.held ?? []);
|
|
76
|
+
// Each new note as main keeps it (mergedNote): its own origin, `status: pending` when held, the run's risky mark gone.
|
|
77
|
+
// A skill's SKILL.md or a draft's README.md held: `status: pending` last in its front matter.
|
|
78
|
+
const files = new Map(change.files.map(({ path, text }) => {
|
|
79
|
+
if (isNote(path) && blobOf(snapshot, path) === undefined) {
|
|
80
|
+
const note = parseNoteFile(path, text);
|
|
81
|
+
return [path, Array.isArray(note) ? text : mergedNote(text, { origin: note.origin, pending: held.has(path) })];
|
|
82
|
+
}
|
|
83
|
+
return [path, held.has(path) ? heldText(path, text) : text];
|
|
84
|
+
}));
|
|
85
|
+
const notes = snapshotNotes(snapshot);
|
|
86
|
+
const active = new Set(notes.filter((note) => note.status === "active").map((note) => note.file));
|
|
87
|
+
const refused = [];
|
|
88
|
+
const fresh = [...files].filter(([path]) => isNote(path) && blobOf(snapshot, path) === undefined).flatMap(([path, text]) => {
|
|
89
|
+
const note = parseNoteFile(path, text);
|
|
90
|
+
return Array.isArray(note) ? [] : [note];
|
|
91
|
+
});
|
|
92
|
+
const marks = change.supersede ?? [...supersededBy(fresh)].map(([path, by]) => ({ path, by }));
|
|
93
|
+
// The verdict was on the blobs the grade read: one this merge would write (mark or replace) that is another blob on
|
|
94
|
+
// main now is the caller's conflict, named by the note that would mark it. One it leaves alone (a held note marks
|
|
95
|
+
// nothing) is not written over, so it stands.
|
|
96
|
+
const touched = new Set([...marks.map((mark) => mark.path), ...change.files.map(({ path }) => path)]);
|
|
97
|
+
const conflicts = Object.entries(change.graded).filter(([path, oid]) => touched.has(path) && blobOf(snapshot, path) !== oid).map(([path]) => ({ rule: "supersedes", path: marks.find((mark) => mark.path === path)?.by ?? path, detail: `${path} changed after the grade read it` }));
|
|
98
|
+
if (conflicts.length)
|
|
99
|
+
return { result: { ok: false, reason: "conflict", problems: conflicts } };
|
|
100
|
+
for (const { path, by } of marks) {
|
|
101
|
+
if (!active.has(path))
|
|
102
|
+
refused.push({ rule: "supersedes", path: by, detail: `it supersedes ${path}, which is not an active note` });
|
|
103
|
+
else
|
|
104
|
+
files.set(path, supersede(await body(path, blobOf(snapshot, path)), by));
|
|
105
|
+
}
|
|
106
|
+
const added = [];
|
|
107
|
+
const written = [];
|
|
108
|
+
for (const [path, text] of files) {
|
|
109
|
+
if (!isNote(path))
|
|
110
|
+
continue;
|
|
111
|
+
const note = parseNoteFile(path, text);
|
|
112
|
+
if (Array.isArray(note)) {
|
|
113
|
+
refused.push({ rule: "note", path, detail: note.join("; ") });
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
written.push(note);
|
|
117
|
+
// A merge adds notes and marks the ones they supersede: it never writes over another note main holds.
|
|
118
|
+
if (blobOf(snapshot, path) === undefined)
|
|
119
|
+
added.push(note);
|
|
120
|
+
else if (!marks.some((one) => one.path === path))
|
|
121
|
+
refused.push({ rule: "exists", path, detail: "the folder has a note by this name" });
|
|
122
|
+
}
|
|
123
|
+
// mergeProblems asks of the new notes what a merge always asks: a free name, what they supersede active and named
|
|
124
|
+
// once, the index's lines.
|
|
125
|
+
if (!refused.length)
|
|
126
|
+
refused.push(...mergeProblems({ files: topOf(snapshot), active: notes.filter((note) => note.status === "active") }, added));
|
|
127
|
+
if (refused.length)
|
|
128
|
+
return { result: { ok: false, reason: "refused", problems: refused } };
|
|
129
|
+
const marked = new Set(written.map((note) => note.file));
|
|
130
|
+
files.set(INDEX_FILE, buildIndex([...notes.filter((note) => !marked.has(note.file)), ...written]));
|
|
131
|
+
return {
|
|
132
|
+
result: { pending: true },
|
|
133
|
+
change: {
|
|
134
|
+
by: { run: change.runId, reason: change.reason },
|
|
135
|
+
writes: [...files].map(([path, text]) => ({ path, text })),
|
|
136
|
+
absent: added.map((note) => note.file),
|
|
137
|
+
...(change.seed ? { same: change.files.filter(({ path }) => !isNote(path)).map(({ path }) => ({ commit: change.seed, path })) } : {}),
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
/** A person's write on main as the snapshot has it: the file and what the action also changes, MEMORY.md rebuilt. */
|
|
142
|
+
async function personOf(change, snapshot) {
|
|
143
|
+
const current = blobOf(snapshot, change.file);
|
|
144
|
+
const seen = change.ifMatch?.replace(/^"|"$/g, "") ?? null;
|
|
145
|
+
if (change.action === "created" ? current !== undefined : seen === null || current !== seen) {
|
|
146
|
+
return { result: { ok: false, reason: "conflict", problems: [{ rule: change.action === "created" ? "exists" : "supersedes", path: change.file, detail: current === undefined ? `${change.file} is not on main` : change.action === "created" ? "the folder has a note by this name" : `${change.file} changed since it was read` }] } };
|
|
147
|
+
}
|
|
148
|
+
const writes = [{ path: change.file, text: change.text }, ...(change.also ?? [])];
|
|
149
|
+
const changed = new Map(writes.filter(({ path }) => isNote(path)).map(({ path, text }) => [path, parseNoteFile(path, text)]));
|
|
150
|
+
const refused = [...changed].filter(([, note]) => Array.isArray(note)).map(([path, note]) => ({ rule: "note", path, detail: note.join("; ") }));
|
|
151
|
+
if (refused.length)
|
|
152
|
+
return { result: { ok: false, reason: "refused", problems: refused } };
|
|
153
|
+
const after = [...snapshotNotes(snapshot).filter((note) => !changed.has(note.file)), ...[...changed.values()]];
|
|
154
|
+
const lines = after.filter((note) => note.status === "active").length;
|
|
155
|
+
if (lines > INDEX_LINES)
|
|
156
|
+
return { result: { ok: false, reason: "refused", problems: [{ rule: "index_full", detail: `the index would hold ${lines} lines; it holds at most ${INDEX_LINES}, so retire a note first` }] } };
|
|
157
|
+
return {
|
|
158
|
+
result: { pending: true },
|
|
159
|
+
change: { by: { person: change.action, file: change.file, approved: change.via === "console" }, writes: [...writes, { path: INDEX_FILE, text: buildIndex(after) }], ...(change.action === "created" ? { absent: [change.file] } : {}) },
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
/** Main as the grader reads it (the runner's learning loop `readMain`): every active note's index
|
|
163
|
+
* line, the whole text of each note the proposal supersedes, and the blob each of those was read at (`graded`, which
|
|
164
|
+
* the merge checks); or `problems` when the proposal cannot join main as it is (learn/check.ts mergeProblems). From
|
|
165
|
+
* the folder's snapshot and its bodies: no git, no exec. */
|
|
166
|
+
export async function readMain(ws, proposal) {
|
|
167
|
+
const added = proposal.notes.map(({ file, text }) => parseNoteFile(file, text));
|
|
168
|
+
const bad = proposal.notes.filter((_, i) => Array.isArray(added[i])).map(({ file }) => ({ rule: "note", path: file, detail: "the proposal's note is out of shape" }));
|
|
169
|
+
if (bad.length)
|
|
170
|
+
return { problems: bad };
|
|
171
|
+
const notes = added;
|
|
172
|
+
return readLearning(ws, async ({ snapshot, body }) => {
|
|
173
|
+
const main = snapshotNotes(snapshot);
|
|
174
|
+
const problems = mergeProblems({ files: topOf(snapshot), active: main.filter((note) => note.status === "active") }, notes);
|
|
175
|
+
if (problems.length)
|
|
176
|
+
return { problems };
|
|
177
|
+
const oids = new Map((snapshot?.notes ?? []).map((note) => [note.file, note.oid]));
|
|
178
|
+
// mergeProblems passed: each note superseded is active on main, and named once.
|
|
179
|
+
const superseded = await Promise.all(notes.flatMap((note) => note.supersedes).map(async (file) => ({ file, text: await body(file, oids.get(file)) })));
|
|
180
|
+
return { active: main.filter((note) => note.status === "active").map(({ file, name, description }) => ({ file, name, description })), superseded, graded: Object.fromEntries(superseded.map(({ file }) => [file, oids.get(file)])) };
|
|
181
|
+
});
|
|
182
|
+
}
|