@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
package/dist/host.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// What one host can hold, and whether it can work now. Runs are admitted by memory: each run is a process of its own,
|
|
2
|
-
// and each reserves what a run of its harness takes (
|
|
3
|
-
// server's own (SERVER_MIB). Health reads the
|
|
2
|
+
// and each reserves what a run of its harness takes (its entry's runMib, harness-table.ts) out of the memory the host has less the
|
|
3
|
+
// server's own (SERVER_MIB). Health reads the server's store and the free disk under the data directory. A start here opens
|
|
4
4
|
// a browser only where there is one to open.
|
|
5
5
|
import { statfs } from "node:fs/promises";
|
|
6
6
|
import { totalmem } from "node:os";
|
|
7
|
-
import { openStoreReader } from "@parcha/pi-durable-agent";
|
|
8
7
|
import { REQUEST_BUSY_MS, whenFree } from "./agents.js";
|
|
9
|
-
import { DEFAULT_HARNESS, HARNESSES
|
|
8
|
+
import { DEFAULT_HARNESS, HARNESSES } from "./harness.js";
|
|
9
|
+
import { builtinHarness } from "./harness-table.js";
|
|
10
10
|
const MiB = 2 ** 20;
|
|
11
|
-
/** Memory the server keeps for itself, before any run, in MiB. Measured with
|
|
11
|
+
/** Memory the server keeps for itself, before any run, in MiB. Measured with the runs' (harness-table.ts): the server's anon
|
|
12
12
|
* 3 s after its start, 32 starts at limits of 512M to 2048M, was 58 to 81 MB, with no peak at the start over that;
|
|
13
13
|
* reserved for the high end, 81, plus 47 (+58%), since what it holds grows with the agents and runs it keeps. That is
|
|
14
14
|
* with the pinned binaries' sha256 checked a chunk at a time: a start that reads the codex binary (294 MB) and the
|
|
@@ -25,12 +25,13 @@ export function hostMemory() {
|
|
|
25
25
|
/** The memory runs may hold on a host of `memory` bytes, in MiB: all of it less the server's own. */
|
|
26
26
|
export const runsMemoryMib = (memory) => Math.floor(memory / MiB) - SERVER_MIB;
|
|
27
27
|
/** What a run of `harness` reserves, in MiB. A harness outside the table (no saved revision names one) reserves the most. */
|
|
28
|
-
export const runMibOf = (harness) =>
|
|
29
|
-
/** How many runs of `harness` alone fit on a host of `memory` bytes.
|
|
30
|
-
* runs were admitted by memory: a server too small for even that still runs
|
|
28
|
+
export const runMibOf = (harness) => builtinHarness(harness)?.runMib ?? Math.max(...HARNESSES.map((id) => builtinHarness(id).runMib));
|
|
29
|
+
/** How many runs of `harness` alone fit on a host of `memory` bytes. One whose entry says one always fits (pi, the
|
|
30
|
+
* default) always has one place, as before runs were admitted by memory: a server too small for even that still runs
|
|
31
|
+
* one at a time. */
|
|
31
32
|
export function runsThatFit(harness, memory) {
|
|
32
33
|
const fit = Math.max(0, Math.floor(runsMemoryMib(memory) / runMibOf(harness)));
|
|
33
|
-
return harness
|
|
34
|
+
return builtinHarness(harness)?.oneAlwaysFits ? Math.max(1, fit) : fit;
|
|
34
35
|
}
|
|
35
36
|
/** The default cap on how many runs at once: as many pi runs, the smallest, as fit. */
|
|
36
37
|
export const defaultMaxRuns = (memory) => runsThatFit(DEFAULT_HARNESS, memory);
|
|
@@ -59,27 +60,32 @@ export function maxRunsOf(env, given) {
|
|
|
59
60
|
throw new Error(`max runs is a positive integer (--max-runs, AGENTRUN_MAX_RUNS), not ${given ?? env.AGENTRUN_MAX_RUNS}`);
|
|
60
61
|
return value;
|
|
61
62
|
}
|
|
62
|
-
/**
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
/** How long health waits for the store's one read before it reads as failing (ms). */
|
|
64
|
+
export const HEALTH_STORE_MS = 2_000;
|
|
65
|
+
/** Whether the server's store (`store`, the one it opened: SQLite in the data directory, or Postgres when
|
|
66
|
+
* AGENTRUN_STORE_URL names one) answers one read within HEALTH_STORE_MS, and the data directory's disk has
|
|
67
|
+
* `minFreeBytes` free; a disk it cannot measure fails. Says no path and no number. `fsStat` is node's statfs unless a
|
|
68
|
+
* test gives another. */
|
|
69
|
+
export async function healthOf(store, data, minFreeBytes, fsStat = statfs) {
|
|
70
|
+
let answered = "ok";
|
|
71
|
+
let timer;
|
|
66
72
|
try {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
reader.close();
|
|
74
|
-
}
|
|
75
|
-
}, REQUEST_BUSY_MS);
|
|
73
|
+
// One indexed read of an id no agent has: the store's own connection, never a second open of a file.
|
|
74
|
+
const read = whenFree(() => store.agents.get("health-check"), REQUEST_BUSY_MS);
|
|
75
|
+
read.catch(() => undefined);
|
|
76
|
+
await Promise.race([read, new Promise((_, reject) => {
|
|
77
|
+
timer = setTimeout(() => reject(new Error("the store did not answer")), HEALTH_STORE_MS);
|
|
78
|
+
})]);
|
|
76
79
|
}
|
|
77
80
|
catch {
|
|
78
|
-
|
|
81
|
+
answered = "does_not_open";
|
|
82
|
+
}
|
|
83
|
+
finally {
|
|
84
|
+
clearTimeout(timer);
|
|
79
85
|
}
|
|
80
86
|
const free = await fsStat(data).then((fs) => fs.bavail * fs.bsize, () => undefined);
|
|
81
87
|
const disk = free === undefined ? "cannot_check" : free >= minFreeBytes ? "ok" : "below_floor";
|
|
82
|
-
return { status:
|
|
88
|
+
return { status: answered === "ok" && disk === "ok" ? "ok" : "failing", checks: { store: answered, disk } };
|
|
83
89
|
}
|
|
84
90
|
/** Whether `--open` opens a browser here: not in CI, and on Linux or FreeBSD only with a display. */
|
|
85
91
|
export const canOpen = (env, platform = process.platform) => !env.CI && (!["linux", "freebsd"].includes(platform) || Boolean(env.DISPLAY || env.WAYLAND_DISPLAY));
|
package/dist/hosted-search.d.ts
CHANGED
|
@@ -10,8 +10,11 @@ export declare const ANTHROPIC_SEARCH_TOOL: Readonly<{
|
|
|
10
10
|
name: "web_search";
|
|
11
11
|
max_uses: 5;
|
|
12
12
|
}>;
|
|
13
|
+
/** OpenAI's hosted search, as Codex's own live search asks for it: one shape whether the run's models send it or a CLI
|
|
14
|
+
* harness's session proxy does, which admits that shape alone (run-adapters-codex's policy, LIVE_SEARCH). */
|
|
13
15
|
export declare const OPENAI_SEARCH_TOOL: Readonly<{
|
|
14
16
|
type: "web_search";
|
|
17
|
+
external_web_access: true;
|
|
15
18
|
}>;
|
|
16
19
|
/** OpenAI's hosted search has no per-tool limit: the Responses API's `max_tool_calls` caps the built-in tool calls of the
|
|
17
20
|
* request at the HOSTED_MAX_USES its fee is reserved for, as Anthropic's tool's `max_uses` does. */
|
package/dist/hosted-search.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { clip, TITLE_CAP } from "./fetch-
|
|
1
|
+
import { clip, TITLE_CAP } from "./web-fetch-direct.js";
|
|
2
2
|
import { sideRequests } from "./cap.js";
|
|
3
3
|
import { ANSWER_MAX, snippetOf } from "./web-search.js";
|
|
4
4
|
export const HOSTED_MAX_USES = 5;
|
|
@@ -7,7 +7,9 @@ export const SEARCH_INPUT_TOKENS = 25_000;
|
|
|
7
7
|
/** What the request may read into its input beyond its context, for the run's cap: each of its searches' results. */
|
|
8
8
|
export const HOSTED_SEARCH_ALLOWANCE_TOKENS = HOSTED_MAX_USES * SEARCH_INPUT_TOKENS;
|
|
9
9
|
export const ANTHROPIC_SEARCH_TOOL = Object.freeze({ type: "web_search_20250305", name: "web_search", max_uses: HOSTED_MAX_USES });
|
|
10
|
-
|
|
10
|
+
/** OpenAI's hosted search, as Codex's own live search asks for it: one shape whether the run's models send it or a CLI
|
|
11
|
+
* harness's session proxy does, which admits that shape alone (run-adapters-codex's policy, LIVE_SEARCH). */
|
|
12
|
+
export const OPENAI_SEARCH_TOOL = Object.freeze({ type: "web_search", external_web_access: true });
|
|
11
13
|
/** OpenAI's hosted search has no per-tool limit: the Responses API's `max_tool_calls` caps the built-in tool calls of the
|
|
12
14
|
* request at the HOSTED_MAX_USES its fee is reserved for, as Anthropic's tool's `max_uses` does. */
|
|
13
15
|
export const OPENAI_SEARCH_LIMIT = Object.freeze({ max_tool_calls: HOSTED_MAX_USES });
|
|
@@ -94,7 +96,7 @@ export async function hostedSearch(query, n, ref, signal, models = runModels) {
|
|
|
94
96
|
const provider = ref && slash > 0 ? ref.slice(0, slash) : undefined;
|
|
95
97
|
const id = ref && slash > 0 ? ref.slice(slash + 1) : undefined;
|
|
96
98
|
// The name as written, else Anthropic's own id for it (dots as dashes, as claude-agent prepares a dotted name:
|
|
97
|
-
//
|
|
99
|
+
// provider.ts anthropicModelId), the one the run's models hold.
|
|
98
100
|
const model = models && provider && id ? (models.getModel(provider, id) ?? (provider === "anthropic" ? models.getModel(provider, id.replaceAll(".", "-")) : undefined)) : undefined;
|
|
99
101
|
if (!models || !model)
|
|
100
102
|
return { error: `web_search has no model to search on in this run${ref ? ` (${ref})` : ""}` };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { MessagePort } from "node:worker_threads";
|
|
2
|
+
import { type JournalReads, type Store } from "./store/index.js";
|
|
3
|
+
/** A call from the worker to the server's store: the method by its path (e.g. ["agents","create"], ["flush"], or
|
|
4
|
+
* ["journal","scanEntries"] with the run id first), its arguments, and `req` to match the reply. */
|
|
5
|
+
export type StoreCall = {
|
|
6
|
+
req: number;
|
|
7
|
+
path: readonly string[];
|
|
8
|
+
args: readonly unknown[];
|
|
9
|
+
};
|
|
10
|
+
/** The server's reply to a `StoreCall`: `ok` with the method's result, or `err` with the thrown error's name and words. */
|
|
11
|
+
export type StoreReply = {
|
|
12
|
+
res: number;
|
|
13
|
+
ok: unknown;
|
|
14
|
+
} | {
|
|
15
|
+
res: number;
|
|
16
|
+
err: {
|
|
17
|
+
name: string;
|
|
18
|
+
message: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
/** The slice of the store the import reaches over the port: the import's own reads and writes (ImportStore), the sealed rows
|
|
22
|
+
* and settings the saved-key cut reads (ToolKeysStore), and the trigger settings the server-secret list reads. The real
|
|
23
|
+
* Store satisfies it, so the server serves calls straight to its open store; the worker's proxy is built to satisfy it too. */
|
|
24
|
+
export interface ProxiedStore {
|
|
25
|
+
readonly agents: Pick<Store["agents"], "get" | "create" | "addRevision" | "setCurrent" | "revisions">;
|
|
26
|
+
readonly runs: Pick<Store["runs"], "list">;
|
|
27
|
+
readonly importRun: Store["importRun"];
|
|
28
|
+
readJournal(runId: string): JournalReads;
|
|
29
|
+
readonly triggerSettings: Pick<Store["triggerSettings"], "get" | "put" | "removeScope">;
|
|
30
|
+
readonly sealedKeys: Pick<Store["sealedKeys"], "all" | "put" | "remove">;
|
|
31
|
+
readonly settings: Pick<Store["settings"], "get" | "put">;
|
|
32
|
+
flush(): Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
/** The worker's view of the server's open store, over `port`. Each method posts one `StoreCall` and awaits its `StoreReply`.
|
|
35
|
+
* The port is kept referenced only while a call is in flight, so it never keeps the worker's thread alive once the import
|
|
36
|
+
* is done (as the store it replaces never did), and does keep it alive while it waits for the server. */
|
|
37
|
+
export declare function importStoreProxy(port: MessagePort): ProxiedStore;
|
|
38
|
+
/** Answers one `StoreCall` against the server's open `store`: a journal scan opens the run's read-only journal and supplies
|
|
39
|
+
* the server's own Context; every other call walks the path to the method and applies the arguments. The result is `ok`;
|
|
40
|
+
* a throw is `err` with its name and words, so the two store classes revive as themselves on the worker. The server posts
|
|
41
|
+
* the returned reply back to the worker. */
|
|
42
|
+
export declare function answerStoreCall(store: ProxiedStore, context: unknown, call: StoreCall): Promise<StoreReply>;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { StoreBusy, StoreConstraint } from "./store/index.js";
|
|
2
|
+
/** The journal methods the import's dedup reader calls (journal-reader.ts): each a page scan whose last argument is the
|
|
3
|
+
* Context, which is not structured-cloneable and is dropped — the server supplies its own. */
|
|
4
|
+
const JOURNAL_SCANS = ["scanConversations", "scanEntries", "scanTasks", "scanSubmissions"];
|
|
5
|
+
/** An error reply revived on the worker side: the two classes the import tells apart as themselves, any other as an Error
|
|
6
|
+
* that keeps the name the server sent. */
|
|
7
|
+
function reviveError(err) {
|
|
8
|
+
if (err.name === "StoreConstraint")
|
|
9
|
+
return new StoreConstraint(err.message);
|
|
10
|
+
if (err.name === "StoreBusy")
|
|
11
|
+
return new StoreBusy(err.message);
|
|
12
|
+
const error = new Error(err.message);
|
|
13
|
+
error.name = err.name;
|
|
14
|
+
return error;
|
|
15
|
+
}
|
|
16
|
+
/** The worker's view of the server's open store, over `port`. Each method posts one `StoreCall` and awaits its `StoreReply`.
|
|
17
|
+
* The port is kept referenced only while a call is in flight, so it never keeps the worker's thread alive once the import
|
|
18
|
+
* is done (as the store it replaces never did), and does keep it alive while it waits for the server. */
|
|
19
|
+
export function importStoreProxy(port) {
|
|
20
|
+
let nextReq = 0;
|
|
21
|
+
const pending = new Map();
|
|
22
|
+
port.on("message", (message) => {
|
|
23
|
+
// Only this proxy's replies; the worker's own "stop" and anything else is left to its other listeners.
|
|
24
|
+
if (typeof message !== "object" || message === null || !("res" in message))
|
|
25
|
+
return;
|
|
26
|
+
const reply = message;
|
|
27
|
+
const waiting = pending.get(reply.res);
|
|
28
|
+
if (!waiting)
|
|
29
|
+
return;
|
|
30
|
+
pending.delete(reply.res);
|
|
31
|
+
if (pending.size === 0)
|
|
32
|
+
port.unref();
|
|
33
|
+
if ("err" in reply)
|
|
34
|
+
waiting.reject(reviveError(reply.err));
|
|
35
|
+
else
|
|
36
|
+
waiting.resolve(reply.ok);
|
|
37
|
+
});
|
|
38
|
+
const call = (path, ...args) => new Promise((resolve, reject) => {
|
|
39
|
+
const req = nextReq++;
|
|
40
|
+
pending.set(req, { resolve, reject });
|
|
41
|
+
if (pending.size === 1)
|
|
42
|
+
port.ref();
|
|
43
|
+
port.postMessage({ req, path, args });
|
|
44
|
+
});
|
|
45
|
+
const method = (...path) => (...args) => call(path, ...args);
|
|
46
|
+
// The journal stub: only the four scans the dedup reader uses, each RPC'd with the run id first and the Context dropped.
|
|
47
|
+
const journalStub = (runId) => Object.fromEntries(JOURNAL_SCANS.map((name) => [name, (query, limit, cursor) => call(["journal", name], runId, query, limit, cursor)]));
|
|
48
|
+
return {
|
|
49
|
+
agents: {
|
|
50
|
+
get: method("agents", "get"),
|
|
51
|
+
create: method("agents", "create"),
|
|
52
|
+
addRevision: method("agents", "addRevision"),
|
|
53
|
+
setCurrent: method("agents", "setCurrent"),
|
|
54
|
+
revisions: method("agents", "revisions"),
|
|
55
|
+
},
|
|
56
|
+
runs: { list: method("runs", "list") },
|
|
57
|
+
importRun: method("importRun"),
|
|
58
|
+
readJournal: journalStub,
|
|
59
|
+
triggerSettings: {
|
|
60
|
+
get: method("triggerSettings", "get"),
|
|
61
|
+
put: method("triggerSettings", "put"),
|
|
62
|
+
removeScope: method("triggerSettings", "removeScope"),
|
|
63
|
+
},
|
|
64
|
+
sealedKeys: {
|
|
65
|
+
all: method("sealedKeys", "all"),
|
|
66
|
+
put: method("sealedKeys", "put"),
|
|
67
|
+
remove: method("sealedKeys", "remove"),
|
|
68
|
+
},
|
|
69
|
+
settings: {
|
|
70
|
+
get: method("settings", "get"),
|
|
71
|
+
put: method("settings", "put"),
|
|
72
|
+
},
|
|
73
|
+
flush: method("flush"),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/** Answers one `StoreCall` against the server's open `store`: a journal scan opens the run's read-only journal and supplies
|
|
77
|
+
* the server's own Context; every other call walks the path to the method and applies the arguments. The result is `ok`;
|
|
78
|
+
* a throw is `err` with its name and words, so the two store classes revive as themselves on the worker. The server posts
|
|
79
|
+
* the returned reply back to the worker. */
|
|
80
|
+
export async function answerStoreCall(store, context, call) {
|
|
81
|
+
try {
|
|
82
|
+
const ok = call.path[0] === "journal"
|
|
83
|
+
? await journalCall(store, context, call.path[1], call.args)
|
|
84
|
+
: await storeCall(store, call.path, call.args);
|
|
85
|
+
return { res: call.req, ok };
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
const e = error;
|
|
89
|
+
return { res: call.req, err: { name: typeof e?.name === "string" ? e.name : "Error", message: typeof e?.message === "string" ? e.message : String(error) } };
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/** A journal scan: the run id is the first argument, the Context the worker dropped is the server's own, added last. */
|
|
93
|
+
function journalCall(store, context, name, args) {
|
|
94
|
+
const [runId, ...rest] = args;
|
|
95
|
+
const journal = store.readJournal(runId);
|
|
96
|
+
return journal[name](...rest, context);
|
|
97
|
+
}
|
|
98
|
+
/** Walks `path` to its method on the store and applies `args` (e.g. ["agents","create"] -> store.agents.create(...args)). */
|
|
99
|
+
function storeCall(store, path, args) {
|
|
100
|
+
let owner = store;
|
|
101
|
+
for (let i = 0; i < path.length - 1; i++)
|
|
102
|
+
owner = owner[path[i]];
|
|
103
|
+
const fn = owner[path[path.length - 1]];
|
|
104
|
+
return fn.apply(owner, args);
|
|
105
|
+
}
|
package/dist/import-summary.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// used, from every session found, those imported before included. A number with no data behind it reads unknown.
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
4
|
import { SOURCES } from "./import-sources.js";
|
|
5
|
+
import { readRunDbSync } from "./run-db.js";
|
|
5
6
|
const NAMES = { "claude-code": "Claude Code", codex: "Codex", pi: "pi" };
|
|
6
7
|
/** Requests by local hour of the day, from their times (ms). */
|
|
7
8
|
export function hoursOf(times) {
|
|
@@ -21,15 +22,10 @@ export async function foundIn(store, runId) {
|
|
|
21
22
|
const file = store.runStorePath(runId);
|
|
22
23
|
let hours;
|
|
23
24
|
if (existsSync(file)) {
|
|
24
|
-
|
|
25
|
-
const db = new DatabaseSync(file, { readOnly: true });
|
|
26
|
-
try {
|
|
25
|
+
hours = readRunDbSync(file, false, (db) => {
|
|
27
26
|
const rows = db.prepare("SELECT json_extract(record, '$.model[0].timestamp') AS at FROM entries WHERE json_extract(record, '$.kind') = 'pi.assistant'").all();
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
finally {
|
|
31
|
-
db.close();
|
|
32
|
-
}
|
|
27
|
+
return hoursOf(rows.map((row) => Number(row.at)));
|
|
28
|
+
});
|
|
33
29
|
}
|
|
34
30
|
return { source: run.importedFrom.source, agent: run.agent, ...(metrics ? { metrics } : {}), ...(hours ? { hours } : {}) };
|
|
35
31
|
}
|
package/dist/import-worker.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import "./quiet-sqlite-warning.js";
|
|
2
|
-
/** `secrets`: the server's own,
|
|
3
|
-
*
|
|
2
|
+
/** `secrets`: the server's own, cut out of everything the import writes and never put in an environment; the seal key
|
|
3
|
+
* among them, so the worker opens the saved tool keys the import cuts too (read over the port from the server's store). */
|
|
4
4
|
export type ImportTask = {
|
|
5
5
|
task: "plan" | "import";
|
|
6
6
|
data: string;
|
|
7
7
|
home: string;
|
|
8
8
|
temp?: string;
|
|
9
9
|
secrets?: Record<string, string>;
|
|
10
|
-
stored?: Record<string, string>;
|
|
11
10
|
};
|
|
12
11
|
/** `took`: what this start's import took (stopped too: what it took before it stopped), its agents by id, so the server
|
|
13
12
|
* adds it to what earlier starts took. */
|
package/dist/import-worker.js
CHANGED
|
@@ -5,19 +5,21 @@
|
|
|
5
5
|
// Before anything loads node:sqlite, as in the server's own thread: its ExperimentalWarning is not the server's to print.
|
|
6
6
|
import "./quiet-sqlite-warning.js";
|
|
7
7
|
import { parentPort, workerData } from "node:worker_threads";
|
|
8
|
-
import { openStore } from "@parcha/pi-durable-agent";
|
|
9
8
|
import { ownSecrets, planImport, runImport } from "./import.js";
|
|
10
|
-
|
|
9
|
+
import { importStoreProxy } from "./import-proxy.js";
|
|
10
|
+
import { toolKeysOverStore } from "./tool-keys-store.js";
|
|
11
|
+
const { task, data, home, temp, secrets = {} } = workerData;
|
|
11
12
|
const stop = new AbortController();
|
|
12
13
|
parentPort.on("message", (message) => void (message === "stop" && stop.abort()));
|
|
13
|
-
// The port does not keep the thread alive: the task does
|
|
14
|
+
// The port does not keep the thread alive on its own: the task does (the proxy references it only while it waits for the
|
|
15
|
+
// server), and the thread ends with the task.
|
|
14
16
|
parentPort.unref();
|
|
15
17
|
// The values to cut: this thread's environment (the server's, which holds none of its secrets) with the server's secrets as
|
|
16
18
|
// properties that do not enumerate, as secrets.ts's withSecrets gives them: read by name, left out of a spread or a spawn.
|
|
17
19
|
const env = { ...process.env };
|
|
18
20
|
for (const [name, value] of Object.entries(secrets))
|
|
19
21
|
Object.defineProperty(env, name, { value, enumerable: false });
|
|
20
|
-
const options = { home, ...(temp ? { temp } : {}), env,
|
|
22
|
+
const options = { home, ...(temp ? { temp } : {}), env, signal: stop.signal };
|
|
21
23
|
const answer = async () => {
|
|
22
24
|
if (task === "plan") {
|
|
23
25
|
// A count keeps no transcript: no key scan (a whole history read through secretlint at every start).
|
|
@@ -25,17 +27,17 @@ const answer = async () => {
|
|
|
25
27
|
// Sessions as the import takes them: a session written in several files (a resumed thread) is one run.
|
|
26
28
|
return stop.signal.aborted ? { stopped: true } : { projects: plan.projects.length, sessions: plan.projects.reduce((n, p) => n + new Set(p.sessions.map((s) => `${s.source}:${s.id}`)).size, 0) };
|
|
27
29
|
}
|
|
28
|
-
//
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
30
|
+
// No store of its own: the worker reaches the server's one open store over the port. The server holds the exclusive owner
|
|
31
|
+
// lock, so a second opener here would be refused; every read and write the import needs crosses the port instead.
|
|
32
|
+
const store = importStoreProxy(parentPort);
|
|
33
|
+
// The keys saved on the Tool keys page, read from the store (sealed rows) and opened with the seal key the worker holds:
|
|
34
|
+
// cut out of everything the import writes, as the CLI's import cuts them.
|
|
35
|
+
const keys = toolKeysOverStore(store, env, () => { });
|
|
36
|
+
await keys.load();
|
|
37
|
+
// The secrets this server made and keeps, read from the store as the import starts: cut by their values too.
|
|
38
|
+
const taking = { ...options, stored: keys.values(), own: await ownSecrets(store, data, env) };
|
|
39
|
+
const report = await runImport(store, await planImport(taking, store), taking);
|
|
40
|
+
const took = { agents: report.agents.filter((a) => a.runs > 0).map((a) => a.id), runs: report.agents.reduce((n, a) => n + a.runs, 0), skipped: report.skipped.length };
|
|
41
|
+
return stop.signal.aborted ? { took, stopped: true } : { took };
|
|
40
42
|
};
|
|
41
43
|
parentPort.postMessage(await answer());
|
package/dist/import.d.ts
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type StorageWrite } from "@earendil-works/pi-durable";
|
|
2
|
+
import { type EntryLike } from "@parcha/pi-durable-agent/timeline";
|
|
2
3
|
import { type Session, type Source } from "./import-sources.js";
|
|
3
4
|
import { type Found } from "./import-summary.js";
|
|
5
|
+
import { type Store } from "./store/index.js";
|
|
6
|
+
/** What `runImport`, `planImport` and the CLI reach of the server's open store: the agents it reads and writes, the runs it
|
|
7
|
+
* lists, the one `importRun` write and the journal reads its dedup needs. A narrow view, so the setup worker can serve it
|
|
8
|
+
* across a port without the rest of the store. */
|
|
9
|
+
export type ImportStore = {
|
|
10
|
+
agents: Pick<Store["agents"], "get" | "create" | "addRevision" | "setCurrent" | "revisions">;
|
|
11
|
+
runs: Pick<Store["runs"], "list">;
|
|
12
|
+
importRun: Store["importRun"];
|
|
13
|
+
readJournal: Store["readJournal"];
|
|
14
|
+
};
|
|
4
15
|
/** In the data directory while an import the owner asked for at setup has not ended: the server's next start goes on with it. */
|
|
5
16
|
export declare const IMPORT_ASKED = ".import-at-setup";
|
|
6
17
|
/** A session file written to this recently may still be running: it is left for a later import. */
|
|
@@ -83,8 +94,6 @@ export type ImportReport = {
|
|
|
83
94
|
created: boolean;
|
|
84
95
|
runs: number;
|
|
85
96
|
already: number;
|
|
86
|
-
/** Imports an earlier one left without their transcript, finished now. */
|
|
87
|
-
finished: number;
|
|
88
97
|
}[];
|
|
89
98
|
skipped: Skipped[];
|
|
90
99
|
already: number;
|
|
@@ -96,7 +105,7 @@ export declare const agentIdOf: (cwd: string) => string;
|
|
|
96
105
|
/** What an import would take: the sessions under `home`, by project, with what it leaves out and why. Keeps no turns
|
|
97
106
|
* (with `measure`, only until each session is measured), and reads no file `store`'s imports already read whole and
|
|
98
107
|
* that has not changed since. */
|
|
99
|
-
export declare function planImport({ home, sources, all, deleted, now, temp: tempDir, measure, env, stored, own, signal, keys: scan, onKeys }: ImportOptions, store?:
|
|
108
|
+
export declare function planImport({ home, sources, all, deleted, now, temp: tempDir, measure, env, stored, own, signal, keys: scan, onKeys }: ImportOptions, store?: ImportStore): Promise<Plan>;
|
|
100
109
|
/** The subagents tied to no session: each one's tokens and tool calls, for a summary's totals, each response once. */
|
|
101
110
|
export declare function untiedFound(plan: Plan): Promise<Found[]>;
|
|
102
111
|
/** The sessions `files` write, as the import takes them: one per source and session id, however many files write it
|
|
@@ -112,17 +121,28 @@ export declare function projectFiles(cwd: string, skipped: Skipped[]): Promise<{
|
|
|
112
121
|
instructions: Record<string, string>;
|
|
113
122
|
skills: Record<string, string>;
|
|
114
123
|
}>;
|
|
115
|
-
/** The
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
/** The
|
|
124
|
-
*
|
|
125
|
-
|
|
124
|
+
/** The run's transcript as pi-durable write batches for Store.importRun: the root conversation, then one entry per turn,
|
|
125
|
+
* its subagents' requests after them (subagentMarks), each string with the environment's key values cut out. Built
|
|
126
|
+
* directly (as the runner builds its own writes), so no run database is opened; the ids are a run's own, from the root.
|
|
127
|
+
* Returns the batches and the same entries the old per-run store read back, for the run's metrics and estimate. */
|
|
128
|
+
export declare function transcriptOf(session: Session, cut: (value: unknown) => unknown, children?: readonly Session[]): {
|
|
129
|
+
batches: StorageWrite[][];
|
|
130
|
+
entries: EntryLike[];
|
|
131
|
+
};
|
|
132
|
+
/** The secrets this server made and keeps, by value: its API token and its sign-in sessions' secret (still files beside the
|
|
133
|
+
* store), its webhook's signing secret (`whsec_...`; webhooks.ts) and every value a trigger source keeps sealed, which the
|
|
134
|
+
* switch keeps as store rows (server-secrets-store.ts), opened with the seal key of `env`, so left out when that key is not
|
|
135
|
+
* there; each signing secret's key in every spelling too. One pasted into a session is this server's own, so an import cuts
|
|
136
|
+
* it wherever it is, as it cuts the environment's keys. Not among them: a key-shaped value this server did not make (a
|
|
137
|
+
* `whsec_` from elsewhere). The per-run door token is gone (the runner cutover deleted it). A webhook secret that does not
|
|
138
|
+
* open is said to `say`: the import goes on, and does not cut it. */
|
|
139
|
+
export declare function ownSecrets(store: {
|
|
140
|
+
triggerSettings: Pick<Store["triggerSettings"], "get" | "put" | "removeScope">;
|
|
141
|
+
flush(): Promise<void>;
|
|
142
|
+
}, data: string, env: NodeJS.ProcessEnv, say?: (fields: Record<string, string>) => void): Promise<string[]>;
|
|
143
|
+
/** The plan, into `store`: the agents it does not hold, and the runs it does not. Each run is written whole in one atomic
|
|
144
|
+
* `importRun` (its row, its launch and its transcript's journal), so a stop between two runs leaves no partial run. */
|
|
145
|
+
export declare function runImport(store: ImportStore, plan: Plan, options: ImportOptions): Promise<ImportReport>;
|
|
126
146
|
/** What an import left out, by why: one group per kind, the most first (a project's files last), each counted in words
|
|
127
147
|
* ("84 sessions from folders that no longer exist"): a session by its id where the file was read, so one of two files
|
|
128
148
|
* counts once, else each file. */
|
|
@@ -133,9 +153,9 @@ export declare function leftOutOf(skipped: readonly Pick<Skipped, "kind" | "what
|
|
|
133
153
|
}[];
|
|
134
154
|
/** The plan as a person reads it: one line per project, its sessions counted as the import takes them, then (`verbose`)
|
|
135
155
|
* each file left out and why. */
|
|
136
|
-
export declare function describePlan(plan: Plan, store?:
|
|
156
|
+
export declare function describePlan(plan: Plan, store?: ImportStore, { verbose }?: {
|
|
137
157
|
verbose?: boolean;
|
|
138
|
-
}): string[]
|
|
158
|
+
}): Promise<string[]>;
|
|
139
159
|
/** `agentrun-serve import ARGS`: its exit code. */
|
|
140
160
|
export declare function importCommand(args: string[], usage: string, { home, temp, env, out, }?: {
|
|
141
161
|
home?: string;
|