@parcha/agentrun-serve 0.1.0-beta.35 → 0.1.0-beta.37
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 +298 -0
- package/README.md +417 -219
- package/dist/adapters.d.ts +12 -2
- package/dist/adapters.js +27 -2
- package/dist/agent-rows.d.ts +2 -1
- package/dist/agents-store.d.ts +2 -0
- package/dist/agents-store.js +9 -4
- package/dist/api-only.d.ts +2 -1
- package/dist/api-only.js +3 -1
- package/dist/archil-routes.d.ts +40 -7
- package/dist/archil-routes.js +167 -54
- package/dist/archil-settings.d.ts +79 -7
- package/dist/archil-settings.js +140 -14
- package/dist/attach-conformance-cli.d.ts +1 -0
- package/dist/attach-conformance-cli.js +18 -0
- package/dist/attach-conformance.d.ts +25 -0
- package/dist/attach-conformance.js +343 -0
- package/dist/attach-images.d.ts +15 -0
- package/dist/attach-images.js +59 -0
- package/dist/background.d.ts +0 -6
- package/dist/background.js +0 -28
- package/dist/box-image.d.ts +1 -97
- package/dist/box-image.js +4 -284
- package/dist/box-paths.d.ts +2 -7
- package/dist/box-paths.js +7 -13
- package/dist/box-settings.d.ts +0 -11
- package/dist/box-settings.js +4 -29
- package/dist/browser-commands.js +1 -1
- package/dist/browser-computer.d.ts +47 -3
- package/dist/browser-computer.js +286 -18
- package/dist/browser-cost.d.ts +1 -1
- package/dist/browser-live.d.ts +20 -8
- package/dist/browser-live.js +50 -27
- package/dist/browser-person.d.ts +19 -2
- package/dist/browser-person.js +55 -6
- package/dist/browser-wait-ended.d.ts +23 -0
- package/dist/browser-wait-ended.js +42 -0
- package/dist/cap.d.ts +12 -57
- package/dist/cap.js +20 -160
- package/dist/catalog.d.ts +1 -12
- package/dist/catalog.js +3 -33
- package/dist/cli.js +17 -26
- package/dist/composio-preset.d.ts +36 -0
- package/dist/composio-preset.js +179 -0
- package/dist/computer-attach.d.ts +125 -0
- package/dist/computer-attach.js +330 -0
- package/dist/computer-calls.d.ts +48 -0
- package/dist/computer-calls.js +126 -0
- package/dist/computer-channel.d.ts +57 -0
- package/dist/computer-channel.js +115 -0
- package/dist/computer-commands.d.ts +1 -1
- package/dist/computer-held-routes.d.ts +35 -0
- package/dist/computer-held-routes.js +106 -0
- package/dist/computer-held.d.ts +48 -0
- package/dist/computer-held.js +87 -0
- package/dist/computer-keys.d.ts +21 -1
- package/dist/computer-keys.js +53 -11
- package/dist/computer-live.d.ts +160 -0
- package/dist/computer-live.js +643 -0
- package/dist/computer-routes.d.ts +1 -4
- package/dist/computer-routes.js +3 -5
- package/dist/computer-setting.d.ts +2 -0
- package/dist/computer-setting.js +38 -1
- package/dist/computer-view.d.ts +24 -2
- package/dist/computer-view.js +51 -3
- package/dist/computer-viewer.d.ts +6 -0
- package/dist/computer-viewer.js +297 -0
- package/dist/computers.d.ts +79 -12
- package/dist/computers.js +147 -28
- package/dist/console/assets/index-Cn6JX1uH.js +563 -0
- package/dist/console/assets/index-DRN62V5v.css +1 -0
- package/dist/console/index.html +2 -2
- package/dist/docker-daemon.d.ts +2 -2
- package/dist/docker-daemon.js +2 -2
- package/dist/errors.js +5 -5
- package/dist/faux-computers.d.ts +9 -20
- package/dist/faux-computers.js +56 -24
- package/dist/files.d.ts +1 -9
- package/dist/files.js +1 -9
- package/dist/github-connection.d.ts +10 -2
- package/dist/github-connection.js +65 -2
- package/dist/github-faux.js +1 -1
- package/dist/github.d.ts +22 -2
- package/dist/github.js +42 -8
- package/dist/gpu-words.d.ts +14 -0
- package/dist/gpu-words.js +21 -0
- package/dist/graph-view.d.ts +3 -1
- package/dist/graph-view.js +25 -1
- package/dist/handed-values.d.ts +1 -1
- package/dist/handed-values.js +1 -1
- package/dist/harness-install.d.ts +60 -3
- package/dist/harness-install.js +322 -34
- package/dist/harness.d.ts +1 -0
- package/dist/harness.js +36 -2
- package/dist/host-tools.d.ts +9 -10
- package/dist/host-tools.js +7 -7
- package/dist/hosted-search.d.ts +5 -4
- package/dist/hosted-search.js +2 -7
- package/dist/import-sources.d.ts +10 -0
- package/dist/import-sources.js +44 -2
- package/dist/import.d.ts +3 -3
- package/dist/import.js +37 -6
- package/dist/index.d.ts +1 -3
- package/dist/index.js +1 -2
- package/dist/key-refusal.d.ts +1 -1
- package/dist/key-refusal.js +2 -2
- package/dist/learn/check.d.ts +11 -2
- package/dist/learn/check.js +124 -6
- package/dist/learn/commit.d.ts +43 -7
- package/dist/learn/commit.js +166 -22
- package/dist/learn/folder.d.ts +11 -0
- package/dist/learn/folder.js +37 -1
- package/dist/learn/general.d.ts +66 -0
- package/dist/learn/general.js +73 -0
- package/dist/learn/grade.d.ts +22 -1
- package/dist/learn/grade.js +107 -16
- package/dist/learn/index.d.ts +1 -1
- package/dist/learn/index.js +1 -1
- package/dist/learn/learning.sh +12 -1
- package/dist/learn/notes.d.ts +3 -0
- package/dist/learn/notes.js +3 -0
- package/dist/learn/reflect.d.ts +14 -2
- package/dist/learn/reflect.js +54 -30
- package/dist/learn/skills.d.ts +37 -5
- package/dist/learn/skills.js +60 -7
- package/dist/learned-nodes.d.ts +6 -2
- package/dist/learned-workflow.d.ts +43 -9
- package/dist/learned-workflow.js +128 -37
- package/dist/learning-batch.d.ts +283 -0
- package/dist/learning-batch.js +574 -0
- package/dist/learning-cost.d.ts +79 -0
- package/dist/learning-cost.js +69 -0
- package/dist/learning-evals.d.ts +33 -0
- package/dist/learning-evals.js +98 -0
- package/dist/learning-routes.d.ts +32 -4
- package/dist/learning-routes.js +48 -12
- package/dist/learning-words.d.ts +9 -0
- package/dist/learning-words.js +12 -2
- package/dist/learning.d.ts +39 -19
- package/dist/learning.js +88 -46
- package/dist/live/stream.js +6 -3
- package/dist/live/translate.d.ts +4 -3
- package/dist/live/translate.js +8 -4
- package/dist/live-reach.d.ts +37 -0
- package/dist/live-reach.js +62 -0
- package/dist/mcp-gateway.d.ts +9 -0
- package/dist/mcp-gateway.js +60 -11
- package/dist/mcp-oauth.d.ts +57 -7
- package/dist/mcp-oauth.js +133 -18
- package/dist/mcp-private-hosts.d.ts +4 -4
- package/dist/mcp-private-hosts.js +20 -12
- package/dist/mcp-probe.d.ts +27 -3
- package/dist/mcp-probe.js +106 -29
- package/dist/mcp-secret-writes.js +8 -0
- package/dist/mcp-servers-store.d.ts +38 -15
- package/dist/mcp-servers-store.js +120 -23
- package/dist/mcp-store.d.ts +10 -4
- package/dist/mcp-store.js +17 -6
- package/dist/model-form.d.ts +26 -0
- package/dist/model-form.js +80 -0
- package/dist/model.d.ts +5 -5
- package/dist/model.js +29 -16
- package/dist/openapi.d.ts +2 -0
- package/dist/openapi.js +586 -64
- package/dist/owner.d.ts +0 -1
- package/dist/owner.js +0 -2
- package/dist/page.d.ts +18 -0
- package/dist/page.js +48 -20
- package/dist/paid-calls.d.ts +1 -1
- package/dist/paid-calls.js +1 -1
- package/dist/place-offers.d.ts +96 -0
- package/dist/place-offers.js +202 -0
- package/dist/place.d.ts +9 -13
- package/dist/place.js +21 -32
- package/dist/port-models.d.ts +2 -1
- package/dist/port-models.js +5 -3
- package/dist/print.d.ts +16 -9
- package/dist/print.js +15 -17
- package/dist/propose.d.ts +4 -0
- package/dist/propose.js +34 -11
- package/dist/provider.js +3 -2
- package/dist/reflect-range.d.ts +8 -1
- package/dist/reflect-range.js +1 -1
- package/dist/run-cut.d.ts +5 -0
- package/dist/run-cut.js +19 -0
- package/dist/run-launch.d.ts +28 -3
- package/dist/run-launch.js +14 -4
- package/dist/run-learning-served.d.ts +2 -2
- package/dist/run-manifest.d.ts +2 -2
- package/dist/run-manifest.js +2 -2
- package/dist/run-reads-over-store.d.ts +1 -1
- package/dist/run-repo.d.ts +20 -0
- package/dist/run-repo.js +63 -0
- package/dist/run-secrets.js +3 -3
- package/dist/run-timeline-served.d.ts +1 -1
- package/dist/run-timeline-served.js +56 -44
- package/dist/run-view.d.ts +8 -5
- package/dist/run-view.js +18 -10
- package/dist/runnable.d.ts +2 -2
- package/dist/runnable.js +6 -2
- package/dist/runner/adapter-loop.d.ts +39 -8
- package/dist/runner/adapter-loop.js +770 -83
- package/dist/runner/adapter-run-spec.d.ts +36 -7
- package/dist/runner/adapter-run-spec.js +171 -37
- package/dist/runner/adapters/pi-computer.d.ts +7 -0
- package/dist/runner/adapters/pi-computer.js +43 -0
- package/dist/runner/adapters/pi.d.ts +20 -7
- package/dist/runner/adapters/pi.js +111 -26
- package/dist/runner/beside.d.ts +7 -3
- package/dist/runner/beside.js +26 -12
- package/dist/runner/claim-secrets.d.ts +4 -0
- package/dist/runner/claim-secrets.js +6 -1
- package/dist/runner/cli-run-spec.d.ts +27 -3
- package/dist/runner/cli-run-spec.js +198 -74
- package/dist/runner/commands.d.ts +8 -2
- package/dist/runner/commands.js +31 -6
- package/dist/runner/computer-channel.d.ts +34 -0
- package/dist/runner/computer-channel.js +61 -0
- package/dist/runner/conformance/harness.d.ts +0 -1
- package/dist/runner/conformance/harness.js +87 -18
- package/dist/runner/conformance/subject.d.ts +1 -1
- package/dist/runner/dispatch.js +3 -0
- package/dist/runner/end-of-run.d.ts +22 -12
- package/dist/runner/end-of-run.js +38 -16
- package/dist/runner/github-app.d.ts +2 -1
- package/dist/runner/github-app.js +6 -4
- package/dist/runner/harness-loops.js +16 -2
- package/dist/runner/held-run.d.ts +65 -0
- package/dist/runner/held-run.js +158 -0
- package/dist/runner/journal-kinds.d.ts +35 -6
- package/dist/runner/journal-kinds.js +20 -1
- package/dist/runner/journal-reader.d.ts +5 -4
- package/dist/runner/journal-reader.js +12 -10
- package/dist/runner/learning-ask.d.ts +7 -1
- package/dist/runner/learning-ask.js +21 -6
- package/dist/runner/learning-dispatch.d.ts +22 -0
- package/dist/runner/learning-dispatch.js +77 -10
- package/dist/runner/learning-end.d.ts +37 -1
- package/dist/runner/learning-end.js +115 -14
- package/dist/runner/learning-factory.d.ts +1 -1
- package/dist/runner/learning-factory.js +15 -5
- package/dist/runner/learning-loop.d.ts +139 -7
- package/dist/runner/learning-loop.js +369 -32
- package/dist/runner/learning-seed.d.ts +9 -0
- package/dist/runner/learning-seed.js +14 -1
- package/dist/runner/live-ticker.js +1 -0
- package/dist/runner/loop-contract.d.ts +16 -1
- package/dist/runner/loop-contract.js +6 -0
- package/dist/runner/loop.d.ts +10 -2
- package/dist/runner/loop.js +22 -1
- package/dist/runner/main.d.ts +13 -1
- package/dist/runner/main.js +38 -6
- package/dist/runner/mcp-claim.d.ts +11 -4
- package/dist/runner/mcp-claim.js +140 -23
- package/dist/runner/mcp-github.d.ts +4 -2
- package/dist/runner/mcp-github.js +1 -8
- package/dist/runner/mcp-run.d.ts +6 -4
- package/dist/runner/mcp-run.js +16 -3
- package/dist/runner/metrics.d.ts +15 -2
- package/dist/runner/metrics.js +21 -2
- package/dist/runner/model-route.d.ts +3 -0
- package/dist/runner/model-route.js +5 -2
- package/dist/runner/pr-checkout.d.ts +60 -0
- package/dist/runner/pr-checkout.js +176 -0
- package/dist/runner/reflect-hook.d.ts +19 -0
- package/dist/runner/reflect-hook.js +20 -8
- package/dist/runner/runner.d.ts +26 -0
- package/dist/runner/runner.js +231 -27
- package/dist/runner/scratch-sweep.d.ts +13 -0
- package/dist/runner/scratch-sweep.js +62 -0
- package/dist/runner/sessions.d.ts +1 -1
- package/dist/runner/spec-holds.d.ts +8 -3
- package/dist/runner/spec-holds.js +12 -10
- package/dist/runner/store-port.d.ts +7 -2
- package/dist/runner/store-secrets.js +21 -4
- package/dist/runner/subagent.d.ts +44 -0
- package/dist/runner/subagent.js +190 -0
- package/dist/runner/workflow-host.d.ts +24 -3
- package/dist/runner/workflow-host.js +24 -4
- package/dist/runner/workflow-loop.d.ts +6 -3
- package/dist/runner/workflow-loop.js +9 -8
- package/dist/runner/workflow-spec.d.ts +39 -15
- package/dist/runner/workflow-spec.js +143 -40
- package/dist/runs-over-store.d.ts +16 -6
- package/dist/runs-over-store.js +145 -29
- package/dist/seal-key.js +3 -3
- package/dist/sealed-settings-store.d.ts +5 -2
- package/dist/sealed-settings-store.js +10 -4
- package/dist/sealing.js +1 -2
- package/dist/secret-cut.d.ts +1 -1
- package/dist/secret-cut.js +1 -1
- package/dist/secret-writes.d.ts +5 -4
- package/dist/secret-writes.js +5 -4
- package/dist/server-secrets-store.d.ts +4 -3
- package/dist/server-secrets-store.js +15 -9
- package/dist/server-secrets.js +3 -2
- package/dist/server.d.ts +75 -63
- package/dist/server.js +712 -316
- package/dist/settings-wake.d.ts +21 -0
- package/dist/settings-wake.js +59 -0
- package/dist/standard-webhooks.d.ts +4 -1
- package/dist/standard-webhooks.js +8 -4
- package/dist/store/agent-body.d.ts +9 -2
- package/dist/store/agent-body.js +16 -8
- package/dist/store/command-wake.d.ts +12 -0
- package/dist/store/command-wake.js +37 -0
- package/dist/store/deadline.js +9 -5
- package/dist/store/dialect.d.ts +6 -0
- package/dist/store/dialect.js +5 -0
- package/dist/store/index.d.ts +4 -4
- package/dist/store/index.js +2 -2
- package/dist/store/journal/storage.d.ts +3 -2
- package/dist/store/journal/storage.js +15 -6
- package/dist/store/postgres/connection.js +9 -4
- package/dist/store/postgres/dialect.js +4 -0
- package/dist/store/postgres/migrations/0004_runs_outcome_stop_or_cancel.sql +11 -0
- package/dist/store/postgres/migrations/0005_learning_rounds.sql +14 -0
- package/dist/store/postgres/migrations/0006_run_changes_channel_attempts.sql +57 -0
- package/dist/store/postgres/migrations/0007_viewer_host.sql +11 -0
- package/dist/store/postgres/migrations/0008_paired_computers.sql +30 -0
- package/dist/store/postgres/migrations/0009_commands_answer.sql +10 -0
- package/dist/store/schema.d.ts +2 -1
- package/dist/store/schema.js +85 -13
- package/dist/store/seal.d.ts +13 -0
- package/dist/store/seal.js +19 -0
- package/dist/store/sqlite/connection.d.ts +5 -0
- package/dist/store/sqlite/connection.js +88 -47
- package/dist/store/sqlite/run-patch.d.ts +25 -7
- package/dist/store/sqlite/run-patch.js +58 -14
- package/dist/store/sqlite/store.js +331 -59
- package/dist/store/store.d.ts +330 -21
- package/dist/store/store.js +34 -2
- package/dist/store-reads/analytics.js +3 -2
- package/dist/store-reads/cap.d.ts +2 -4
- package/dist/store-reads/cap.js +16 -7
- package/dist/store-reads/decisions.d.ts +3 -3
- package/dist/store-reads/decisions.js +3 -6
- package/dist/store-reads/import-summary.d.ts +1 -1
- package/dist/store-reads/journal.d.ts +5 -4
- package/dist/store-reads/journal.js +118 -27
- package/dist/store-reads/learning.d.ts +34 -4
- package/dist/store-reads/learning.js +137 -23
- package/dist/store-reads/runs.d.ts +7 -5
- package/dist/store-reads/runs.js +17 -10
- package/dist/store-reads/stats.js +5 -1
- package/dist/store-reads/workflow.d.ts +1 -1
- package/dist/store-view.d.ts +5 -0
- package/dist/store-view.js +70 -29
- package/dist/template-eval.js +8 -5
- package/dist/template-github-permissions.d.ts +22 -8
- package/dist/template-github-permissions.js +35 -15
- package/dist/templates.d.ts +64 -0
- package/dist/templates.js +101 -16
- package/dist/timeline/timeline.d.ts +30 -1
- package/dist/timeline/timeline.js +29 -13
- package/dist/timeline/util.d.ts +4 -0
- package/dist/timeline/util.js +14 -0
- package/dist/tool-blurbs.js +1 -0
- package/dist/tool-budget.d.ts +27 -7
- package/dist/tool-budget.js +21 -9
- package/dist/tool-gate.d.ts +23 -10
- package/dist/tool-gate.js +60 -44
- package/dist/tool-plane.d.ts +46 -28
- package/dist/tool-plane.js +73 -31
- package/dist/tools.d.ts +31 -38
- package/dist/tools.js +117 -74
- package/dist/trigger-adapter.d.ts +4 -0
- package/dist/trigger-secrets-shown.d.ts +2 -2
- package/dist/trigger-secrets-shown.js +1 -1
- package/dist/trigger-signatures.d.ts +26 -6
- package/dist/trigger-signatures.js +44 -8
- package/dist/trigger-targets.d.ts +2 -0
- package/dist/trigger-targets.js +1 -0
- package/dist/trigger-webhook.js +5 -2
- package/dist/triggers.d.ts +10 -6
- package/dist/triggers.js +37 -7
- package/dist/turn-end.d.ts +0 -3
- package/dist/turn-end.js +0 -3
- package/dist/turns.js +16 -1
- package/dist/usage-lines.d.ts +1 -1
- package/dist/validate.d.ts +6 -0
- package/dist/validate.js +41 -4
- package/dist/web-fetch.d.ts +1 -1
- package/dist/web-search.d.ts +10 -5
- package/dist/web-search.js +7 -6
- package/dist/webhooks.d.ts +147 -103
- package/dist/webhooks.js +564 -324
- package/dist/workflow/decision-recovery.d.ts +23 -0
- package/dist/workflow/decision-recovery.js +80 -0
- package/dist/workflow/decisions.d.ts +134 -0
- package/dist/workflow/decisions.js +46 -0
- package/dist/workflow/host-session.d.ts +5 -0
- package/dist/workflow/host-session.js +85 -0
- package/dist/workflow/host-tools.d.ts +3 -0
- package/dist/workflow/host-tools.js +3 -0
- package/dist/workflow/node-runner.d.ts +113 -0
- package/dist/workflow/node-runner.js +270 -0
- package/dist/workflow/node.d.ts +89 -0
- package/dist/workflow/node.js +101 -0
- package/dist/workflow/operator-error.d.ts +4 -0
- package/dist/workflow/operator-error.js +4 -0
- package/dist/workflow/pi-versions.d.ts +32 -0
- package/dist/workflow/pi-versions.js +65 -0
- package/dist/workflow/record-file.d.ts +10 -0
- package/dist/workflow/record-file.js +56 -0
- package/dist/workflow/record-tool.d.ts +77 -0
- package/dist/workflow/record-tool.js +126 -0
- package/dist/workflow/record.d.ts +151 -0
- package/dist/workflow/record.js +401 -0
- package/dist/workflow/run-error.d.ts +16 -0
- package/dist/workflow/run-error.js +26 -0
- package/dist/workflow/runner.d.ts +6 -0
- package/dist/workflow/runner.js +240 -0
- package/dist/workflow/store.d.ts +23 -0
- package/dist/workflow/store.js +242 -0
- package/dist/workflow/task.d.ts +133 -0
- package/dist/workflow/task.js +412 -0
- package/dist/workflow/thinking.d.ts +3 -0
- package/dist/workflow/thinking.js +7 -0
- package/dist/workflow/tool-context.d.ts +21 -0
- package/dist/workflow/tool-context.js +13 -0
- package/dist/workflow/types.d.ts +126 -0
- package/dist/workflow/types.js +1 -0
- package/dist/workflow-run.d.ts +2 -2
- package/dist/workspace/agent-computer.d.ts +137 -0
- package/dist/workspace/agent-computer.js +292 -0
- package/dist/workspace/archil-claim.d.ts +11 -0
- package/dist/workspace/archil-claim.js +18 -10
- package/dist/workspace/archil-disks.d.ts +49 -0
- package/dist/workspace/archil-disks.js +185 -0
- package/dist/workspace/archil-exec.js +2 -3
- package/dist/workspace/archil-mount-credential.d.ts +20 -4
- package/dist/workspace/archil-mount-credential.js +13 -4
- package/dist/workspace/attached-computers.d.ts +41 -0
- package/dist/workspace/attached-computers.js +114 -0
- package/dist/workspace/computer-deps.d.ts +32 -17
- package/dist/workspace/computer-deps.js +37 -14
- package/dist/workspace/computer-for-claim.d.ts +58 -13
- package/dist/workspace/computer-for-claim.js +267 -26
- package/dist/workspace/computer-hold.d.ts +11 -27
- package/dist/workspace/computer-hold.js +36 -56
- package/dist/workspace/computer-janitor.d.ts +3 -2
- package/dist/workspace/computer-janitor.js +43 -9
- package/dist/workspace/computer-ledger.d.ts +5 -1
- package/dist/workspace/computer-ledger.js +11 -0
- package/dist/workspace/computer-mcp.d.ts +25 -0
- package/dist/workspace/computer-mcp.js +41 -0
- package/dist/workspace/computer-ports.d.ts +4 -13
- package/dist/workspace/computer-ports.js +4 -107
- package/dist/workspace/computer-script.d.ts +37 -0
- package/dist/workspace/computer-script.js +138 -0
- package/dist/workspace/executors.d.ts +1 -1
- package/dist/workspace/index.d.ts +7 -4
- package/dist/workspace/index.js +4 -1
- package/dist/workspace/kind-skills/desktop/SKILL.md +119 -84
- package/dist/workspace/kind-skills/phone/SKILL.md +100 -85
- package/dist/workspace/resolve-computer.d.ts +45 -11
- package/dist/workspace/resolve-computer.js +72 -14
- package/dist/workspace/run-disk.d.ts +34 -0
- package/dist/workspace/run-disk.js +91 -0
- package/dist/workspace/run-tools.d.ts +35 -18
- package/dist/workspace/run-tools.js +24 -29
- package/dist/workspace/server-run-workspace.d.ts +3 -2
- package/dist/workspace/server-run-workspace.js +17 -4
- package/dist/workspace.js +1 -1
- package/package.json +19 -21
- package/templates/README.md +9 -6
- package/templates/code-review/agent.md +27 -11
- package/templates/code-review/evals/clean-refactor/graders/coverage.md +4 -0
- package/templates/code-review/evals/clean-refactor/graders/risk.md +5 -0
- package/templates/code-review/evals/injection/graders/ignores.md +1 -1
- package/templates/code-review/evals/never-flag/case.yaml +3 -0
- package/templates/code-review/evals/never-flag/graders/only-p0.md +4 -0
- package/templates/code-review/evals/never-flag/graders/schema.md +5 -0
- package/templates/code-review/evals/never-flag/prompt.md +30 -0
- package/templates/code-review/evals/null-name/graders/finds.md +1 -1
- package/templates/code-review/evals/off-by-one/graders/finds.md +1 -1
- package/templates/code-review/evals/off-by-one/graders/no-repo-reads.md +6 -5
- package/templates/code-review/evals/re-review/graders/resolves.md +1 -1
- package/templates/code-review/evals/re-review/prompt.md +1 -1
- package/templates/code-review/evals/re-review-open/case.yaml +3 -0
- package/templates/code-review/evals/re-review-open/graders/schema.md +5 -0
- package/templates/code-review/evals/re-review-open/graders/stays-open.md +4 -0
- package/templates/code-review/evals/re-review-open/prompt.md +27 -0
- package/templates/code-review/evals/repo-rule/graders/cites.md +1 -1
- package/templates/code-review/evals/two-defects/case.yaml +3 -0
- package/templates/code-review/evals/two-defects/graders/both.md +4 -0
- package/templates/code-review/evals/two-defects/graders/schema.md +5 -0
- package/templates/code-review/evals/two-defects/prompt.md +25 -0
- package/templates/code-review/findings.schema.json +131 -27
- package/templates/code-review/rules/CODEREVIEW.md +76 -0
- package/templates/code-review/skills/review/DEEP.md +130 -0
- package/templates/code-review/skills/review/REVIEWER.md +116 -0
- package/templates/code-review/skills/review/SKILL.md +104 -154
- package/templates/market-monitor/agent.md +1 -1
- package/dist/box/record.d.ts +0 -6
- package/dist/box/record.js +0 -41
- package/dist/box/sweep.d.ts +0 -53
- package/dist/box/sweep.js +0 -193
- package/dist/box-egress-vm.d.ts +0 -118
- package/dist/box-egress-vm.js +0 -354
- package/dist/box-egress.d.ts +0 -105
- package/dist/box-egress.js +0 -256
- package/dist/box-relay-vm.d.ts +0 -84
- package/dist/box-relay-vm.js +0 -437
- package/dist/box-relay.d.ts +0 -36
- package/dist/box-relay.js +0 -207
- package/dist/boxes.d.ts +0 -109
- package/dist/boxes.js +0 -249
- package/dist/budget.d.ts +0 -71
- package/dist/budget.js +0 -199
- package/dist/console/assets/index-B7NKTU8E.css +0 -1
- package/dist/console/assets/index-CXZMgJE7.js +0 -550
- package/dist/daytona-api.d.ts +0 -10
- package/dist/daytona-api.js +0 -20
- package/dist/egress-proxy.d.ts +0 -45
- package/dist/egress-proxy.js +0 -416
- package/dist/egress-table.d.ts +0 -24
- package/dist/egress-table.js +0 -165
- package/dist/run-db.d.ts +0 -53
- package/dist/run-db.js +0 -116
- package/templates/code-review/rules/REVIEW.md +0 -41
|
@@ -13,10 +13,12 @@
|
|
|
13
13
|
// merge's call merges once.
|
|
14
14
|
import { BACKGROUND_CONTEXT, withAbortSignal } from "@earendil-works/chord/context";
|
|
15
15
|
import { ROOT_CONVERSATION_ID } from "@earendil-works/pi-durable";
|
|
16
|
+
import { GENERAL_NO_BUDGET, GENERAL_THRESHOLD, ONE_CASE } from "../learn/general.js";
|
|
16
17
|
import { CONTRADICTED_REASON, CONTRADICTED_TWICE_REASON, CONTRADICTION_ASK, gradedItems, gradePrompt, parseVerdict, UNREADABLE_REASON } from "../learn/grade.js";
|
|
17
|
-
import { mergedNote, parseNoteFile } from "../learn/notes.js";
|
|
18
|
+
import { mergedNote, parseNoteFile, ruleOf } from "../learn/notes.js";
|
|
18
19
|
import { learnedPlace } from "../learn/skills.js";
|
|
19
|
-
import {
|
|
20
|
+
import { blobOid } from "../learn/folder.js";
|
|
21
|
+
import { notKept, SAME_NOTE, said, STOPPED } from "../learning-words.js";
|
|
20
22
|
import { journalEntries } from "./journal-reader.js";
|
|
21
23
|
import { KINDS } from "./journal-kinds.js";
|
|
22
24
|
/** The grader's bounds, as the server's grade had them (grade.ts): one ask, its answer cut at GRADE_MAX_TOKENS. */
|
|
@@ -25,6 +27,32 @@ export const GRADE_MAX_TOKENS = 16_000;
|
|
|
25
27
|
/** A folder the merge could not reach (the workspace or its exec down): the run parks and is retried after this, doubling
|
|
26
28
|
* per try up to the last. */
|
|
27
29
|
export const UNAVAILABLE_BACKOFF_MS = [30_000, 120_000, 600_000, 1_800_000];
|
|
30
|
+
/** A grader call its learning run's cap refused before it was sent (learning-ask.ts bookedAsk: the run's cap left, its
|
|
31
|
+
* launch's max_cost_usd): nothing of it was spent, and the grade is skipped, said so (said.noRoomToGrade), never run past
|
|
32
|
+
* the cap, never a failure. `forGood`: no room could ever send it (its spend or price unknown), not only none now. */
|
|
33
|
+
export class GradeOverCap extends Error {
|
|
34
|
+
forGood;
|
|
35
|
+
booked;
|
|
36
|
+
/** `booked`: the grade's records when it was refused (GradeBooked), what it spent before it. */
|
|
37
|
+
constructor(message, forGood, booked) {
|
|
38
|
+
super(message);
|
|
39
|
+
this.forGood = forGood;
|
|
40
|
+
this.booked = booked;
|
|
41
|
+
this.name = "GradeOverCap";
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/** A generality check its learning run's cap refused before any of its requests left (learning-dispatch.ts general: its
|
|
45
|
+
* worst case over the cap left): nothing of it was sent or spent, and it is skipped as `unchecked` "no_budget"
|
|
46
|
+
* (GENERAL_NO_BUDGET), said so, the grader then judged against the cap on its own. `forGood`: no room could ever send it
|
|
47
|
+
* (its provider's price unknown here), not only none now. */
|
|
48
|
+
export class GeneralOverCap extends Error {
|
|
49
|
+
forGood;
|
|
50
|
+
constructor(message, forGood) {
|
|
51
|
+
super(message);
|
|
52
|
+
this.forGood = forGood;
|
|
53
|
+
this.name = "GeneralOverCap";
|
|
54
|
+
}
|
|
55
|
+
}
|
|
28
56
|
const ROOT = ROOT_CONVERSATION_ID;
|
|
29
57
|
/** The graded item a proposal's file is judged as (grade.ts itemOf): a draft's README.md with its workflow.json, every
|
|
30
58
|
* other file as itself. */
|
|
@@ -32,28 +60,117 @@ const itemOf = (file) => {
|
|
|
32
60
|
const place = learnedPlace(file);
|
|
33
61
|
return place?.kind === "readme" ? `workflows/${place.name}/workflow.json` : file;
|
|
34
62
|
};
|
|
35
|
-
/**
|
|
63
|
+
/** The why of a note whose name main already holds with other text, which it does not supersede: never written over,
|
|
64
|
+
* and the rest of what the run learned merges. */
|
|
65
|
+
export const NOTE_NAME_TAKEN = (name) => `A note named ${name} was added since this run started, or was there already; this one wasn't kept.`;
|
|
66
|
+
/** The why of a skill re-filed as a note whose file this run's own kept note (or another re-filed skill) takes: the run's
|
|
67
|
+
* own stands, and the skill is not written over it. */
|
|
68
|
+
export const NOTE_NAME_IN_RUN = (name) => `This run also kept a note named ${name}, so the rule was not re-filed over it.`;
|
|
69
|
+
/** What `verdict` merges once each note it keeps (a new note's, or a skill's re-filed as one: its item's `note`) is set
|
|
70
|
+
* beside the run's other kept notes and what main holds at that file (`onMain`, by path), one item at a time, never a
|
|
71
|
+
* refusal of the whole merge. One file is one item's: a skill re-filed as a note whose file the run's own kept note
|
|
72
|
+
* (or an earlier re-filed skill) takes is dropped, saying so (NOTE_NAME_IN_RUN), so one text is written and the item
|
|
73
|
+
* that holds it is the one whose hold it keeps. Against main: a note main holds the same is no change, dropped unsaid
|
|
74
|
+
* (SAME_NOTE); one whose own front matter supersedes the note of its name is a modification, written over it
|
|
75
|
+
* (`replace`, main's blob in `graded`, so a change since is a conflict); any other is dropped, saying so
|
|
76
|
+
* (NOTE_NAME_TAKEN), and main's note stands. No suffixed name: it would hold the same rule twice. A rule another note
|
|
77
|
+
* holds is the merge's own to settle, against the main it commits on (learn/commit.ts mergeOf). Merge when the grader
|
|
78
|
+
* said so and it still keeps an item. */
|
|
79
|
+
/** Whether `held`, the note main holds at `file`, says the same rule as `text`: their bodies, whitespace and case aside
|
|
80
|
+
* (notes.ts ruleOf), as readMain and the merge's own settle (learn/commit.ts) read it, whatever their front matter. A
|
|
81
|
+
* text that is no note is the same only when it is the same text. */
|
|
82
|
+
/** The rule a re-filed note says (notes.ts ruleOf), "" when its text is no note: what the merge checks main still holds
|
|
83
|
+
* before it retires the skill that note replaces. */
|
|
84
|
+
const ruleOfText = (file, text) => {
|
|
85
|
+
const note = parseNoteFile(file, text);
|
|
86
|
+
return Array.isArray(note) ? "" : ruleOf(note.body);
|
|
87
|
+
};
|
|
88
|
+
const sameRule = (file, held, text) => {
|
|
89
|
+
const [theirs, ours] = [parseNoteFile(file, held), parseNoteFile(file, text)];
|
|
90
|
+
return !Array.isArray(theirs) && !Array.isArray(ours) ? ruleOf(theirs.body) === ruleOf(ours.body) : held === text;
|
|
91
|
+
};
|
|
92
|
+
export function takenOnMain(proposal, verdict, onMain) {
|
|
93
|
+
const texts = new Map(proposal.notes.map(({ file, text }) => [file, text]));
|
|
94
|
+
const replace = [];
|
|
95
|
+
const graded = {};
|
|
96
|
+
const items = oneItemAFile(proposal, verdict).items.map((item) => {
|
|
97
|
+
const note = item.note ?? (texts.has(item.file) ? { file: item.file, text: texts.get(item.file) } : undefined);
|
|
98
|
+
const held = item.keep && note ? onMain[note.file] : undefined;
|
|
99
|
+
if (!note || held === undefined)
|
|
100
|
+
return item;
|
|
101
|
+
const identical = held === note.text || held === mergedNote(note.text, { origin: item.origin ?? "run", ...(item.pending ? { pending: true } : {}) });
|
|
102
|
+
const parsed = parseNoteFile(note.file, note.text);
|
|
103
|
+
// One that supersedes the note of its own name and is not the very text main holds: a modification, written over it.
|
|
104
|
+
if (!identical && !item.note && !Array.isArray(parsed) && parsed.supersedes.includes(note.file)) {
|
|
105
|
+
replace.push(note.file);
|
|
106
|
+
graded[note.file] = blobOid(held);
|
|
107
|
+
return item;
|
|
108
|
+
}
|
|
109
|
+
// Else the same rule an active note of main keeps (whatever its front matter, case or spacing) is no change, dropped
|
|
110
|
+
// unsaid, and a skill re-filed as it retired (mergeChangeOf); a retired or superseded note of that rule keeps it out
|
|
111
|
+
// of every run, so it is a name main holds, and nothing is retired: the rule never vanishes. Any other is a name main
|
|
112
|
+
// holds with another rule.
|
|
113
|
+
const theirs = parseNoteFile(note.file, held);
|
|
114
|
+
const same = !Array.isArray(theirs) && theirs.status === "active" && (identical || sameRule(note.file, held, note.text));
|
|
115
|
+
return { file: item.file, keep: false, question: "Duplicate", why: same ? SAME_NOTE : NOTE_NAME_TAKEN(note.file.replace(/\.md$/, "")), ...(item.note ? { note: item.note } : {}) };
|
|
116
|
+
});
|
|
117
|
+
return { verdict: { ...verdict, items, merge: verdict.merge && items.some((item) => item.keep) }, replace, graded };
|
|
118
|
+
}
|
|
119
|
+
/** `verdict` with one item per file a kept note is written as, within the run: the files the run's own kept notes are,
|
|
120
|
+
* then each re-filed skill's as it is kept; a re-filed skill whose note file one of those takes is left out, saying so
|
|
121
|
+
* (NOTE_NAME_IN_RUN). The merge (takenOnMain) and its resume (resumedOf, from the saved grade) settle it the one way. */
|
|
122
|
+
export function oneItemAFile(proposal, verdict) {
|
|
123
|
+
const own = new Set(proposal.notes.map(({ file }) => file));
|
|
124
|
+
const claimed = new Set(verdict.items.filter((item) => item.keep && !item.note && own.has(item.file)).map((item) => item.file));
|
|
125
|
+
const items = verdict.items.map((item) => {
|
|
126
|
+
if (!item.keep || !item.note)
|
|
127
|
+
return item;
|
|
128
|
+
if (claimed.has(item.note.file))
|
|
129
|
+
return { file: item.file, keep: false, question: "Duplicate", why: NOTE_NAME_IN_RUN(item.note.file.replace(/\.md$/, "")) };
|
|
130
|
+
claimed.add(item.note.file);
|
|
131
|
+
return item;
|
|
132
|
+
});
|
|
133
|
+
return { ...verdict, items, merge: verdict.merge && items.some((item) => item.keep) };
|
|
134
|
+
}
|
|
135
|
+
/** `proposal` with only what `verdict` keeps (a verdict per item): a note or file its item keeps or holds; a skill its
|
|
136
|
+
* item re-filed (`note`: a standing rule for every reply) is kept as that note instead, never as a skill. */
|
|
36
137
|
export function keptOf(proposal, verdict) {
|
|
37
138
|
if (!verdict.items.length)
|
|
38
139
|
return proposal;
|
|
39
|
-
const kept = new Set(verdict.items.filter((item) => item.keep).map((item) => item.file));
|
|
40
|
-
|
|
140
|
+
const kept = new Set(verdict.items.filter((item) => item.keep && !item.note).map((item) => item.file));
|
|
141
|
+
const refiled = verdict.items.flatMap((item) => (item.keep && item.note ? [item.note] : []));
|
|
142
|
+
return { ...proposal, notes: [...proposal.notes.filter(({ file }) => kept.has(file)), ...refiled], files: (proposal.files ?? []).filter(({ file }) => kept.has(itemOf(file))) };
|
|
41
143
|
}
|
|
144
|
+
/** Each item the verdict keeps by the file it is merged as: a re-filed skill's item by its note's file too. A dropped
|
|
145
|
+
* item names no file it merges as; of two kept items for one file (takenOnMain lets none through), the held one stands,
|
|
146
|
+
* so a hold is never lost to the order of the items. */
|
|
147
|
+
const itemsByFile = (verdict) => {
|
|
148
|
+
const byFile = new Map();
|
|
149
|
+
for (const item of verdict.items.filter((one) => one.keep)) {
|
|
150
|
+
for (const file of [item.file, ...(item.note ? [item.note.file] : [])])
|
|
151
|
+
if (!byFile.get(file)?.pending)
|
|
152
|
+
byFile.set(file, item);
|
|
153
|
+
}
|
|
154
|
+
return byFile;
|
|
155
|
+
};
|
|
42
156
|
/** The merge of `merging` (what the verdict kept), the one rule learningCommit's merge is made by: each note with
|
|
43
157
|
* the origin its item gives (`you` for the user's own words, else the run's) and held for its owner's OK when its item
|
|
44
158
|
* is pending; a skill's SKILL.md or a draft's README.md held when its item is (a draft's workflow.json is held by its
|
|
45
159
|
* README); and the seed the source run started from, so a skill's or draft's file changed on main since is a conflict. */
|
|
46
|
-
export function mergeChangeOf(runId, merging, verdict, graded) {
|
|
47
|
-
const judged =
|
|
160
|
+
export function mergeChangeOf(runId, merging, verdict, graded, round = 1) {
|
|
161
|
+
const judged = itemsByFile(verdict);
|
|
48
162
|
const notes = merging.notes.map(({ file, text }) => ({ path: file, text: mergedNote(text, { origin: judged.get(file)?.origin ?? "run" }) }));
|
|
49
163
|
const files = (merging.files ?? []).map(({ file, text }) => ({ path: file, text }));
|
|
50
164
|
const held = [
|
|
51
165
|
...merging.notes.filter(({ file }) => judged.get(file)?.pending === true).map(({ file }) => file),
|
|
52
166
|
...files.filter(({ path }) => learnedPlace(path)?.kind !== "workflow" && judged.get(itemOf(path))?.pending === true).map(({ path }) => path),
|
|
53
167
|
];
|
|
168
|
+
// Each skill re-filed as a note is retired on main in the same write (learn/commit.ts mergeOf): a kept one, and one
|
|
169
|
+
// main already holds the same rule of as a note (dropped unsaid), so no old skill stays served beside its note.
|
|
170
|
+
const retire = verdict.items.flatMap((item) => (item.note && (item.keep || item.why === SAME_NOTE) && learnedPlace(item.file)?.kind === "skill" ? [{ skill: item.file, note: item.note.file, rule: ruleOfText(item.note.file, item.note.text) }] : []));
|
|
54
171
|
return {
|
|
55
|
-
kind: "merge", runId, reason: verdict.reason || "The grader kept every new note.", files: [...notes, ...files],
|
|
56
|
-
...(held.length ? { held } : {}), graded, ...(merging.seed ? { seed: merging.seed } : {}),
|
|
172
|
+
kind: "merge", runId, ...(round > 1 ? { round } : {}), reason: verdict.reason || "The grader kept every new note.", files: [...notes, ...files],
|
|
173
|
+
...(held.length ? { held } : {}), graded, ...(merging.seed ? { seed: merging.seed } : {}), ...(retire.length ? { retire } : {}),
|
|
57
174
|
};
|
|
58
175
|
}
|
|
59
176
|
/** What a merge of `merging` learned, as the server's grade named it on the run (learning-run.ts grade): the notes it
|
|
@@ -61,7 +178,7 @@ export function mergeChangeOf(runId, merging, verdict, graded) {
|
|
|
61
178
|
* drafts, each pending when it waits. The merge's words and the reader of a run's learning end (store-reads/learning.ts)
|
|
62
179
|
* both name it so. */
|
|
63
180
|
export function learnedOf(merging, verdict) {
|
|
64
|
-
const waiting = new Set(verdict.items.filter((item) => item.pending).
|
|
181
|
+
const waiting = new Set(verdict.items.filter((item) => item.pending).flatMap((item) => [item.file, ...(item.note ? [item.note.file] : [])]));
|
|
65
182
|
const notes = merging.notes.flatMap(({ file, text }) => {
|
|
66
183
|
const note = parseNoteFile(file, text);
|
|
67
184
|
return Array.isArray(note) ? [] : [{ file, name: note.name, supersedes: note.supersedes }];
|
|
@@ -78,9 +195,55 @@ export function learnedOf(merging, verdict) {
|
|
|
78
195
|
* the checks left out (the kept row's `left`). */
|
|
79
196
|
function mergedWords(merging, verdict, checked) {
|
|
80
197
|
const { learned, pending, skills, workflows } = learnedOf(merging, verdict);
|
|
81
|
-
|
|
198
|
+
// A re-filed rule main already holds the same is no change: never said.
|
|
199
|
+
const left = verdict.items.filter((item) => !item.keep && item.why !== SAME_NOTE).map((item) => ({ why: item.why }));
|
|
82
200
|
return said.merged(learned, pending, [...skills, ...workflows], left, checked);
|
|
83
201
|
}
|
|
202
|
+
/** `merging` and `verdict` once the merge left out `left` (learn/commit.ts LeftNote): each note it left out is no longer
|
|
203
|
+
* merged, and its item is dropped, unsaid when its rule is held already (SAME_NOTE), else saying its name is taken. */
|
|
204
|
+
export function leftOf(merging, verdict, left) {
|
|
205
|
+
if (!left.length)
|
|
206
|
+
return { merging, verdict };
|
|
207
|
+
const why = new Map(left.map(({ path, reason }) => [path, reason === "same" ? SAME_NOTE : NOTE_NAME_TAKEN(path.replace(/\.md$/, ""))]));
|
|
208
|
+
const items = verdict.items.map((item) => {
|
|
209
|
+
const file = item.note?.file ?? item.file;
|
|
210
|
+
return item.keep && why.has(file) ? { file: item.file, keep: false, question: "Duplicate", why: why.get(file), ...(item.note ? { note: item.note } : {}) } : item;
|
|
211
|
+
});
|
|
212
|
+
return { merging: { ...merging, notes: merging.notes.filter(({ file }) => !why.has(file)) }, verdict: { ...verdict, items } };
|
|
213
|
+
}
|
|
214
|
+
/** What a merge already on main settled (learn/commit.ts: its files, and `left`, the new notes it did not write): each
|
|
215
|
+
* note the grade kept is kept when the merge wrote it, its path changed and main holding its rule there now (`onMain`,
|
|
216
|
+
* the texts main holds at the kept notes' paths), else left out, saying why as takenOnMain said it (`taken`, its
|
|
217
|
+
* verdict after main was read), or by main's text there (the same rule, or a name it holds with another), else as the
|
|
218
|
+
* commit does. Skills and drafts as the grade kept them. */
|
|
219
|
+
export function resumedOf(proposal, graded, taken, result, onMain) {
|
|
220
|
+
const written = new Set(result.files);
|
|
221
|
+
const texts = new Map(proposal.notes.map(({ file, text }) => [file, text]));
|
|
222
|
+
const said = new Map((result.left ?? []).map(({ path, reason }) => [path, reason]));
|
|
223
|
+
const notes = new Set(proposal.notes.map(({ file }) => file));
|
|
224
|
+
// One item per file, as the first attempt's takenOnMain settled it: the saved grade keeps both a run's note and a skill
|
|
225
|
+
// re-filed as a note of its file, and only one of them was written.
|
|
226
|
+
const settled = oneItemAFile(proposal, graded);
|
|
227
|
+
const items = settled.items.map((item, i) => {
|
|
228
|
+
const file = item.note?.file ?? item.file;
|
|
229
|
+
if (!item.keep || !(item.note || notes.has(file)))
|
|
230
|
+
return item;
|
|
231
|
+
// Saved: the merge changed its path and main holds its rule there now (`onMain`, read after the merge). A path the
|
|
232
|
+
// merge changed for another reason (a note it marked superseded) holds another rule, and saves no item of its own.
|
|
233
|
+
const text = item.note?.text ?? texts.get(file);
|
|
234
|
+
const held = onMain[file];
|
|
235
|
+
if (written.has(file) && (held === undefined || text === undefined || sameRule(file, held, text)))
|
|
236
|
+
return item;
|
|
237
|
+
const before = taken.items[i];
|
|
238
|
+
if (before && !before.keep && before.why !== SAME_NOTE)
|
|
239
|
+
return before;
|
|
240
|
+
const same = held !== undefined && text !== undefined ? sameRule(file, held, text) : said.get(file) !== "taken";
|
|
241
|
+
const why = same ? SAME_NOTE : NOTE_NAME_TAKEN(file.replace(/\.md$/, ""));
|
|
242
|
+
return { file: item.file, keep: false, question: "Duplicate", why, ...(item.note ? { note: item.note } : {}) };
|
|
243
|
+
});
|
|
244
|
+
const verdict = { ...settled, items };
|
|
245
|
+
return { merging: keptOf(proposal, verdict), verdict };
|
|
246
|
+
}
|
|
84
247
|
/** The skills and drafts a proposal names, by their item's file: what a merge the grader refused loses (notKept). */
|
|
85
248
|
export const lostOf = (proposal) => (proposal.files ?? []).flatMap(({ file }) => {
|
|
86
249
|
const place = learnedPlace(file);
|
|
@@ -142,7 +305,8 @@ export function createLearningLoop(learning) {
|
|
|
142
305
|
await append(KINDS.learningDropped, { source: "", reason: "no_source", detail: said.stopped(STOPPED.notChecked) }, "failed");
|
|
143
306
|
return { state: "failed", error: { code: "learning_no_source", message: "the learning run names no run that learned" } };
|
|
144
307
|
}
|
|
145
|
-
const
|
|
308
|
+
const round = source.round ?? 1;
|
|
309
|
+
const kept = await learning.proposal(source.runId, round);
|
|
146
310
|
if (!kept) {
|
|
147
311
|
await append(KINDS.learningDropped, { source: source.runId, reason: "no_proposal", detail: said.stopped(STOPPED.notChecked) }, "ended");
|
|
148
312
|
return { state: "ended" };
|
|
@@ -172,15 +336,134 @@ export function createLearningLoop(learning) {
|
|
|
172
336
|
await append(KINDS.learningDropped, { source: source.runId, reason: "checker", detail: said.stale(main.problems), problems: main.problems }, "ended");
|
|
173
337
|
return { state: "ended" };
|
|
174
338
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
});
|
|
180
|
-
// What the
|
|
339
|
+
// A note named like one main holds now is settled alone, out of the grade (readMain's `taken`); the rest is
|
|
340
|
+
// graded. Nothing left to grade keeps nothing.
|
|
341
|
+
const taken = new Map((main.taken ?? []).map(({ path, reason }) => [path, reason]));
|
|
342
|
+
let grading = proposal.notes.filter(({ file }) => !taken.has(file));
|
|
343
|
+
const settledItems = [...taken].map(([file, reason]) => ({ file, keep: false, question: "Duplicate", why: reason === "same" ? SAME_NOTE : NOTE_NAME_TAKEN(file.replace(/\.md$/, "")) }));
|
|
344
|
+
// What the grader spends, as the server's grade counted it (grade.ts counter): each ask's dollars and tokens
|
|
181
345
|
// added, either unknown (null) once any ask's is, and an ask that fails spent what nobody knows.
|
|
182
346
|
let usd = 0;
|
|
183
347
|
let tokens = { input: 0, cache_read: 0, cache_write: 0, output: 0 };
|
|
348
|
+
// What the generality pre-check's Jev requests spent (its kept dollars, null once unknown), outside the
|
|
349
|
+
// grader's records, and the most they may have spent (`beside`: those dollars, else their worst case), which
|
|
350
|
+
// each grader call's room under the cap leaves out. The grade ends with both: Jev's and the grader's.
|
|
351
|
+
let checkUsd = 0;
|
|
352
|
+
let beside = 0;
|
|
353
|
+
const spent = () => (checkUsd === null || usd === null ? null : checkUsd + usd);
|
|
354
|
+
// The generality pre-check: a note Jev scores under the bar rests on its one input, and is dropped before the
|
|
355
|
+
// grader reads it, its why said with the grader's items. Jev down or not set up here: every note is graded.
|
|
356
|
+
let screened = false;
|
|
357
|
+
// Why the check could not run, kept on the grade's (or the drop's) entry: never a silent skip.
|
|
358
|
+
let unchecked;
|
|
359
|
+
if (grading.length && learning.general) {
|
|
360
|
+
const threshold = learning.generalThreshold ?? GENERAL_THRESHOLD;
|
|
361
|
+
const input = proposal.asked?.[0] ?? proposal.triggered?.[0]?.text;
|
|
362
|
+
// The check is paid and Jev dedupes none, so it is made durable as the grade's ask is (learning-ask.ts
|
|
363
|
+
// bookedAsk): marked sent before its requests leave, and its end kept before the grader starts. A restart
|
|
364
|
+
// reuses a check that ended, paying nothing again; one an earlier attempt sent with no end after it was cut,
|
|
365
|
+
// what it spent is unknown (null, as a cut grade request is booked before it is asked again), and it is
|
|
366
|
+
// asked again with that unknown kept.
|
|
367
|
+
let ended = [...entries].reverse().find((entry) => entry.kind === KINDS.learningGeneral)?.data;
|
|
368
|
+
if (!ended) {
|
|
369
|
+
const sentMarks = entries.filter((entry) => entry.kind === KINDS.learningGeneralSent);
|
|
370
|
+
const cut = sentMarks.length > 0;
|
|
371
|
+
if (cut)
|
|
372
|
+
learning.log?.(`learning run ${claim.runId}: a generality check an earlier attempt sent was cut, so what it spent is unknown; it is asked again`);
|
|
373
|
+
// Under a cap: the most the cut attempts' requests may have spent (each mark's worst case), and this one's.
|
|
374
|
+
const cutHeld = sentMarks.reduce((sum, entry) => sum + (entry.data?.held ?? 0), 0);
|
|
375
|
+
let sentHeld = 0;
|
|
376
|
+
let checked;
|
|
377
|
+
let failed;
|
|
378
|
+
let overCap;
|
|
379
|
+
try {
|
|
380
|
+
checked = await learning.general(grading, { ...(source.instructions ? { job: source.instructions } : {}), ...(input !== undefined ? { input } : {}) }, AbortSignal.any([deps.signal, stopAsk.signal]), source.runId, async (held) => {
|
|
381
|
+
sentHeld += held ?? 0;
|
|
382
|
+
await append(KINDS.learningGeneralSent, { source: source.runId, ...(held !== undefined ? { held } : {}) });
|
|
383
|
+
await deps.flush();
|
|
384
|
+
}, cutHeld);
|
|
385
|
+
}
|
|
386
|
+
catch (error) {
|
|
387
|
+
// Cut by a stop, a lost claim or a shutdown: what it sent spent what nobody knows. A stop row ends the run
|
|
388
|
+
// stopped with that unknown; otherwise nothing more is written, and the next attempt finds it sent with no
|
|
389
|
+
// end, books it unknown and asks again.
|
|
390
|
+
if (stopped || deps.signal.aborted) {
|
|
391
|
+
spend = null;
|
|
392
|
+
return (await halted()) ?? { state: "interrupted" };
|
|
393
|
+
}
|
|
394
|
+
// No room under the run's cap for its worst case: nothing sent, skipped, said so (never silent), and the
|
|
395
|
+
// grader judged against the cap on its own.
|
|
396
|
+
if (error instanceof GeneralOverCap)
|
|
397
|
+
overCap = error;
|
|
398
|
+
else {
|
|
399
|
+
// Its requests were sent and one failed: what they spent is unknown, never 0 (as an ask that fails is).
|
|
400
|
+
// Its error is kept and logged cut of the runner's secrets (LoopDeps.redact).
|
|
401
|
+
const message = error?.message ?? String(error);
|
|
402
|
+
failed = deps.redact ? deps.redact(message) : message;
|
|
403
|
+
learning.log?.(`learning run ${claim.runId}: the generality check could not run, so the grader reads every note: ${failed}`);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
const held = cutHeld + sentHeld;
|
|
407
|
+
const bound = held > 0 ? { held } : {};
|
|
408
|
+
if (checked)
|
|
409
|
+
ended = { source: source.runId, scores: checked.scores, usd: cut ? null : checked.usd, ...bound };
|
|
410
|
+
else if (overCap) {
|
|
411
|
+
learning.log?.(`learning run ${claim.runId}: the generality check has no room under the cap (${overCap.message}), so the grader reads every note`);
|
|
412
|
+
ended = { source: source.runId, unchecked: GENERAL_NO_BUDGET, usd: cut ? null : 0, ...bound };
|
|
413
|
+
}
|
|
414
|
+
else if (failed !== undefined)
|
|
415
|
+
ended = { source: source.runId, unchecked: failed, usd: null, ...bound };
|
|
416
|
+
else if (cut)
|
|
417
|
+
ended = { source: source.runId, unchecked: "no Jev is set up on this host now", usd: null, ...bound };
|
|
418
|
+
// Kept, durably, before the grader starts: a restart from here on asks Jev nothing.
|
|
419
|
+
if (ended) {
|
|
420
|
+
await append(KINDS.learningGeneral, ended);
|
|
421
|
+
await deps.flush();
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
if (ended) {
|
|
425
|
+
checkUsd = ended.usd;
|
|
426
|
+
beside = ended.usd ?? ended.held ?? 0;
|
|
427
|
+
if (ended.unchecked !== undefined)
|
|
428
|
+
unchecked = ended.unchecked;
|
|
429
|
+
if (ended.scores) {
|
|
430
|
+
screened = true;
|
|
431
|
+
const scores = ended.scores;
|
|
432
|
+
const below = grading.filter(({ file }) => typeof scores[file] === "number" && scores[file] < threshold);
|
|
433
|
+
settledItems.push(...below.map(({ file }) => ({ file, keep: false, question: "General", why: ONE_CASE(scores[file], threshold) })));
|
|
434
|
+
grading = grading.filter((note) => !below.includes(note));
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
// The notes the graded ones supersede, of those main gave: a dropped note's are not the grade's.
|
|
439
|
+
const replacing = new Set(grading.flatMap((note) => { const parsed = parseNoteFile(note.file, note.text); return Array.isArray(parsed) ? [] : parsed.supersedes; }));
|
|
440
|
+
const superseded = main.superseded.filter(({ file }) => replacing.has(file));
|
|
441
|
+
if (!grading.length && !proposal.files?.length) {
|
|
442
|
+
const verdict = { merge: false, reason: settledItems.some(({ question }) => question === "General") ? "No new note holds beyond the one input it came from, or each is named like one the agent holds now." : "Every new note is named like one the agent holds now.", items: settledItems };
|
|
443
|
+
// A proposal the generality check emptied is recorded as a grade (its verdict, each item's why, what the check
|
|
444
|
+
// spent) before it is dropped, so the run's learning reads why each note was left out.
|
|
445
|
+
if (screened)
|
|
446
|
+
await append(KINDS.learningGraded, { source: source.runId, verdict, usd: spent(), tokens, graded: main.graded });
|
|
447
|
+
await append(KINDS.learningDropped, { source: source.runId, reason: "grader", detail: notKept(verdict, lostOf(proposal)), usd: spent(), tokens }, "ended");
|
|
448
|
+
return { state: "ended" };
|
|
449
|
+
}
|
|
450
|
+
const items = gradedItems(grading, (proposal.files ?? []));
|
|
451
|
+
const prompt = gradePrompt({
|
|
452
|
+
run: source.runId, ...(source.instructions ? { instructions: source.instructions } : {}), active: main.active, superseded, proposed: grading,
|
|
453
|
+
...(proposal.files?.length ? { files: proposal.files } : {}), ...(proposal.dryRuns ? { dryRuns: proposal.dryRuns } : {}), ...(proposal.drafted?.length ? { drafted: proposal.drafted } : {}), ...(proposal.asked ? { asked: proposal.asked } : {}), ...(proposal.triggered ? { triggered: proposal.triggered } : {}), ...(proposal.held ? { held: proposal.held } : {}),
|
|
454
|
+
});
|
|
455
|
+
/** The asks of this attempt that answered: the records holding more requests than these is an earlier attempt's. */
|
|
456
|
+
let answered = 0;
|
|
457
|
+
// Once an ask read the grade's records (`booked`), its dollars are theirs: an earlier attempt's requests counted too.
|
|
458
|
+
const fromRecords = (booked) => {
|
|
459
|
+
if (!booked)
|
|
460
|
+
return;
|
|
461
|
+
usd = booked.usd;
|
|
462
|
+
// A request an earlier attempt sent (a restart before the grade was saved): its dollars are in the records,
|
|
463
|
+
// its tokens in nothing this attempt read, so they are unknown, never none.
|
|
464
|
+
if (booked.turns > answered)
|
|
465
|
+
tokens = null;
|
|
466
|
+
};
|
|
184
467
|
// `again`: what the grade is told after its last answer, below the same prompt.
|
|
185
468
|
const ask = async (again) => {
|
|
186
469
|
// Stopped before this ask: nothing is sent, so nothing of it is spent (what it spent stays as it was).
|
|
@@ -189,16 +472,24 @@ export function createLearningLoop(learning) {
|
|
|
189
472
|
const timer = AbortSignal.timeout(GRADE_TIMEOUT_MS);
|
|
190
473
|
let answer;
|
|
191
474
|
try {
|
|
192
|
-
answer = await learning.ask({ prompt: again ? `${prompt}\n\n${again}` : prompt, maxTokens: GRADE_MAX_TOKENS }, AbortSignal.any([deps.signal, timer, stopAsk.signal]), { journal: () => deps.journal(claim), flush: () => deps.flush() });
|
|
475
|
+
answer = await learning.ask({ prompt: again ? `${prompt}\n\n${again}` : prompt, maxTokens: GRADE_MAX_TOKENS, ...(beside > 0 ? { beside } : {}) }, AbortSignal.any([deps.signal, timer, stopAsk.signal]), { journal: () => deps.journal(claim), flush: () => deps.flush() });
|
|
193
476
|
}
|
|
194
477
|
catch (error) {
|
|
195
|
-
|
|
196
|
-
|
|
478
|
+
// A call the cap refused was never sent: it spent nothing, and what the grade spent before it stands, as its
|
|
479
|
+
// records hold it (an earlier attempt's included).
|
|
480
|
+
if (error instanceof GradeOverCap)
|
|
481
|
+
fromRecords(error.booked);
|
|
482
|
+
else {
|
|
483
|
+
usd = null;
|
|
484
|
+
tokens = null;
|
|
485
|
+
}
|
|
197
486
|
throw error;
|
|
198
487
|
}
|
|
488
|
+
answered += 1;
|
|
199
489
|
usd = usd === null || answer.usd === null || !Number.isFinite(answer.usd) ? null : usd + answer.usd;
|
|
200
490
|
const more = answer.tokens ?? null;
|
|
201
491
|
tokens = tokens === null || more === null ? null : { input: tokens.input + more.input, cache_read: tokens.cache_read + more.cache_read, cache_write: tokens.cache_write + more.cache_write, output: tokens.output + more.output };
|
|
492
|
+
fromRecords(answer.booked);
|
|
202
493
|
return answer.text;
|
|
203
494
|
};
|
|
204
495
|
let verdict;
|
|
@@ -216,17 +507,26 @@ export function createLearningLoop(learning) {
|
|
|
216
507
|
}
|
|
217
508
|
}
|
|
218
509
|
catch (error) {
|
|
219
|
-
// What the asks spent: a cut one's unknown (null), kept on a stopped run's row as
|
|
220
|
-
|
|
510
|
+
// What the asks spent (and the check before them): a cut one's unknown (null), kept on a stopped run's row as
|
|
511
|
+
// on a dropped one's.
|
|
512
|
+
spend = spent();
|
|
221
513
|
const end = await halted();
|
|
222
514
|
if (end)
|
|
223
515
|
return end;
|
|
224
|
-
|
|
516
|
+
// No room under the run's cap for the grade (a call the cap refused): skipped, said so, with what it spent
|
|
517
|
+
// before (an earlier ask's), never a failure and never past the cap.
|
|
518
|
+
if (error instanceof GradeOverCap) {
|
|
519
|
+
await append(KINDS.learningDropped, { source: source.runId, reason: "no_budget", detail: error.forGood ? said.gradeUncapped : said.noRoomToGrade, usd: spent(), tokens, ...(unchecked !== undefined ? { unchecked } : {}) }, "ended");
|
|
520
|
+
return { state: "ended" };
|
|
521
|
+
}
|
|
522
|
+
await append(KINDS.learningDropped, { source: source.runId, reason: "grade_failed", detail: said.stopped(STOPPED.noReview), usd: spent(), tokens, ...(unchecked !== undefined ? { unchecked } : {}) }, "ended");
|
|
225
523
|
void error;
|
|
226
524
|
return { state: "ended" };
|
|
227
525
|
}
|
|
228
|
-
|
|
229
|
-
|
|
526
|
+
if (settledItems.length)
|
|
527
|
+
verdict = { ...verdict, items: [...verdict.items, ...settledItems] };
|
|
528
|
+
graded = { source: source.runId, verdict, usd: spent(), tokens, graded: main.graded, ...(unchecked !== undefined ? { unchecked } : {}) };
|
|
529
|
+
spend = graded.usd;
|
|
230
530
|
await append(KINDS.learningGraded, graded);
|
|
231
531
|
// The verdict is durable before the merge, its side effect.
|
|
232
532
|
await deps.flush();
|
|
@@ -234,15 +534,52 @@ export function createLearningLoop(learning) {
|
|
|
234
534
|
const halt = await halted();
|
|
235
535
|
if (halt)
|
|
236
536
|
return halt;
|
|
237
|
-
|
|
238
|
-
|
|
537
|
+
// Each note it keeps whose file main already holds (another run merged one by that name since, or a skill
|
|
538
|
+
// re-filed as one) is settled alone (takenOnMain): never written over unless it supersedes it, and never a
|
|
539
|
+
// refusal of everything else the run learned. Not when this run's own merge is on main already (the runner
|
|
540
|
+
// stopped after its commit, before it recorded it): the notes there are that merge's, never "already there", so
|
|
541
|
+
// the grade's verdict goes to the commit, which answers with that merge, and each item is settled by the text that
|
|
542
|
+
// merge's own commit holds at its file (resumedOf: its rule there, not only a changed path, and never main's
|
|
543
|
+
// text now, which a person may have edited since).
|
|
544
|
+
const notePaths = graded.verdict.items.flatMap((item) => (!item.keep ? [] : item.note ? [item.note.file] : proposal.notes.some(({ file }) => file === item.file) ? [item.file] : []));
|
|
545
|
+
let onMain = {};
|
|
546
|
+
let already = false;
|
|
547
|
+
try {
|
|
548
|
+
const merge = await learning.merged(ws, source.runId, notePaths, source.round);
|
|
549
|
+
already = merge !== undefined;
|
|
550
|
+
onMain = merge ? merge.texts : notePaths.length ? await learning.mainTexts(ws, notePaths) : {};
|
|
551
|
+
}
|
|
552
|
+
catch (error) {
|
|
553
|
+
// Main could not be read: parked as for a write that could not reach the folder, tried again after a backoff.
|
|
554
|
+
await append(KINDS.learningUnavailable, { source: source.runId, error: error?.message ?? String(error) }, "parked");
|
|
555
|
+
return { state: "parked", wakeAt: now() + UNAVAILABLE_BACKOFF_MS[Math.min(unavailable, UNAVAILABLE_BACKOFF_MS.length - 1)] };
|
|
556
|
+
}
|
|
557
|
+
const taken = already ? { verdict: oneItemAFile(proposal, graded.verdict), replace: [], graded: {} } : takenOnMain(proposal, graded.verdict, onMain);
|
|
558
|
+
const verdict = taken.verdict;
|
|
559
|
+
const merging = keptOf(proposal, verdict);
|
|
560
|
+
const change = mergeChangeOf(source.runId, merging, verdict, { ...graded.graded, ...taken.graded }, round);
|
|
561
|
+
// Nothing new left to merge: dropped, unless the grader kept a re-filed skill whose rule main already holds as a
|
|
562
|
+
// note (takenOnMain's SAME_NOTE). Its old SKILL.md is still retired (mergeChangeOf's retire), in a write of that
|
|
563
|
+
// alone, so no old skill stays served beside the note.
|
|
564
|
+
if (!verdict.merge && !(graded.verdict.merge && change.retire?.length)) {
|
|
565
|
+
await append(KINDS.learningDropped, { source: source.runId, reason: "grader", detail: notKept(verdict, lostOf(proposal)) }, "ended");
|
|
239
566
|
return { state: "ended" };
|
|
240
567
|
}
|
|
241
|
-
const
|
|
242
|
-
const result = await learning.commit(ws, mergeChangeOf(source.runId, merging, graded.verdict, graded.graded));
|
|
568
|
+
const result = await learning.commit(ws, taken.replace.length ? { ...change, replace: taken.replace } : change);
|
|
243
569
|
if (result.ok) {
|
|
244
|
-
|
|
245
|
-
|
|
570
|
+
// What the merge left out against the main it committed on (a rule a note holds, a name one holds), each
|
|
571
|
+
// item alone: said as takenOnMain says it, and nothing of it learned.
|
|
572
|
+
// A merge already on main (a resume after its commit): what it wrote is what its files say, so each note is
|
|
573
|
+
// settled by the files: one written is kept as the grade kept it, one not written is left out (as takenOnMain
|
|
574
|
+
// or the commit says why).
|
|
575
|
+
const settled = result.already ? resumedOf(proposal, graded.verdict, verdict, result, onMain) : leftOf(merging, verdict, result.left ?? []);
|
|
576
|
+
if (!settled.verdict.items.some((item) => item.keep) && !result.files.length) {
|
|
577
|
+
await append(KINDS.learningDropped, { source: source.runId, reason: "grader", detail: notKept(settled.verdict, lostOf(proposal)) }, "ended");
|
|
578
|
+
return { state: "ended" };
|
|
579
|
+
}
|
|
580
|
+
// A write that retired a skill alone learned nothing new: said so.
|
|
581
|
+
const detail = mergedWords(settled.merging, settled.verdict, checked) || said.empty;
|
|
582
|
+
await append(KINDS.learningMerged, { source: source.runId, main: result.main, commit: result.commit, files: result.files, detail, verdict: settled.verdict }, "ended");
|
|
246
583
|
return { state: "ended" };
|
|
247
584
|
}
|
|
248
585
|
if (result.reason === "conflict") {
|
|
@@ -15,7 +15,16 @@ export interface LearningSeedLay {
|
|
|
15
15
|
readonly shown: () => Promise<Shown>;
|
|
16
16
|
/** One line of the run's log. */
|
|
17
17
|
readonly log: (line: string) => void;
|
|
18
|
+
/** False for a run of a revision that says `learning: "notes"`: its notes and skills are laid, never a learned workflow. */
|
|
19
|
+
readonly workflows?: false;
|
|
20
|
+
/** The notes its # Learned section names in no way, over the learning budget (the launch's `notesLeftOut`), by file:
|
|
21
|
+
* said in the run's log, so a run that read only some of what its agent learned says which it did not. */
|
|
22
|
+
readonly notesLeftOut?: readonly string[];
|
|
18
23
|
}
|
|
24
|
+
/** The most notes the log line names: past it, it says how many more. */
|
|
25
|
+
export declare const LEFT_OUT_NAMED = 100;
|
|
26
|
+
/** The run's log line for the notes its # Learned section leaves out, or undefined for none. */
|
|
27
|
+
export declare const notesLeftOutLine: (files: readonly string[] | undefined) => string | undefined;
|
|
19
28
|
/** What the claim laid of the run's seed: the seed it read, the learned skills' files it laid, by their paths under
|
|
20
29
|
* `.agents/skills/`, for the skill list the run's harness is handed beside the revision's own, and the learned workflows
|
|
21
30
|
* the run's learned_workflow tool runs, cut of the server's secrets as the skills are (none of either when the lay
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import { chooseSkills, chooseWorkflows, layLearned, LEARNED_DIR, laySkills, readerOf, seedFrom, takeSkills } from "../learning.js";
|
|
2
|
+
/** The most notes the log line names: past it, it says how many more. */
|
|
3
|
+
export const LEFT_OUT_NAMED = 100;
|
|
4
|
+
/** The run's log line for the notes its # Learned section leaves out, or undefined for none. */
|
|
5
|
+
export const notesLeftOutLine = (files) => {
|
|
6
|
+
if (!files?.length)
|
|
7
|
+
return undefined;
|
|
8
|
+
const named = files.slice(0, LEFT_OUT_NAMED).join(", ");
|
|
9
|
+
const more = files.length > LEFT_OUT_NAMED ? `, and ${files.length - LEFT_OUT_NAMED} more` : "";
|
|
10
|
+
return `starts without ${files.length} of the notes its agent learned in its # Learned section, over the learning budget (the notes that bear most on it are given whole; the rest stay in ${LEARNED_DIR}/): ${named}${more}`;
|
|
11
|
+
};
|
|
2
12
|
const message = (error) => (error instanceof Error ? error.message : String(error));
|
|
3
13
|
/** What a claim laid of a run's learning seed, by name, as the adapter loop records it (KINDS.learningLaid): each learned
|
|
4
14
|
* skill whose files it laid, and each learned workflow it handed the tool; none when nothing was laid. */
|
|
@@ -29,9 +39,12 @@ export async function layLearningSeed(lay) {
|
|
|
29
39
|
await laySkills(lay.work, taken, made);
|
|
30
40
|
for (const path of seed.skipped)
|
|
31
41
|
lay.log(`its learning folder's ${path} was not read`);
|
|
42
|
+
const leftOut = notesLeftOutLine(lay.notesLeftOut);
|
|
43
|
+
if (leftOut)
|
|
44
|
+
lay.log(leftOut);
|
|
32
45
|
for (const name of left)
|
|
33
46
|
lay.log(`starts without the skill ${name} its agent learned: it is over what is left of the learned skills' budget, or holds a secret`);
|
|
34
|
-
const workflows = chooseWorkflows(seed, shown);
|
|
47
|
+
const workflows = lay.workflows === false ? { flows: [], left: [] } : chooseWorkflows(seed, shown);
|
|
35
48
|
for (const name of workflows.left)
|
|
36
49
|
lay.log(`starts without the learned workflow ${name} its agent learned: it is over what is left of the learned workflows' budget, or holds a secret`);
|
|
37
50
|
return { seed, skills: taken.flatMap(({ name, files = {} }) => Object.keys(files).sort().map((path) => `${name}/${path}`)), workflows: workflows.flows };
|
|
@@ -95,6 +95,7 @@ export function withLiveTicker(store, createLoop, options = {}) {
|
|
|
95
95
|
},
|
|
96
96
|
command: (command) => loop.command(command),
|
|
97
97
|
stop: (reason) => loop.stop(reason),
|
|
98
|
+
keepsComputer: (reason) => loop.keepsComputer?.(reason) ?? false,
|
|
98
99
|
};
|
|
99
100
|
},
|
|
100
101
|
close: async () => {
|
|
@@ -34,11 +34,14 @@ export type EndOfRunTurn = (input: {
|
|
|
34
34
|
/** The run was cut before it could look back: by a person's stop (`stopped`), by one during the end-of-run turn
|
|
35
35
|
* (`stopped-looking`), or by a fault (`faulted`). The step must not call `ask`: it returns only what a cut run keeps. */
|
|
36
36
|
readonly cut?: "stopped" | "stopped-looking" | "faulted";
|
|
37
|
-
/** `again`: the turn asked once more in the same session (its first answer out of format), as its own request.
|
|
37
|
+
/** `again`: the turn asked once more in the same session (its first answer out of format), as its own request.
|
|
38
|
+
* `round`: which end of the run this is (1, its first, when absent): an end after a follow-up opened the run again is
|
|
39
|
+
* a later round, asked of the model anew under a request of its own. */
|
|
38
40
|
ask(prompt: string, opts: {
|
|
39
41
|
readonly origin: "reflect";
|
|
40
42
|
readonly deadlineMs: number;
|
|
41
43
|
readonly again?: true;
|
|
44
|
+
readonly round?: number;
|
|
42
45
|
}): Promise<EndOfRunAnswer>;
|
|
43
46
|
readonly signal: AbortSignal;
|
|
44
47
|
}) => Promise<{
|
|
@@ -87,6 +90,14 @@ export declare class ClaimRefused extends Error {
|
|
|
87
90
|
}
|
|
88
91
|
/** The end a person's stop or cancel writes: stopped, in words that say which. A cancel's are main's ("cancelled"). */
|
|
89
92
|
export declare function endedBy(cancel: boolean | undefined): string;
|
|
93
|
+
/** The run's end on a person's stop or a cancel, as every loop and the runner write it: state 'stopped', words that say
|
|
94
|
+
* which (endedBy), and the outcome the store tells them apart by: 'stopped' (the turn is over, never the run, as main's
|
|
95
|
+
* stop leaves a run: a message reopens it) or 'cancelled' (over for good). */
|
|
96
|
+
export declare function stopEnd(cancel: boolean | undefined): {
|
|
97
|
+
readonly state: "stopped";
|
|
98
|
+
readonly summary: string;
|
|
99
|
+
readonly outcome: "stopped" | "cancelled";
|
|
100
|
+
};
|
|
90
101
|
/** The refusal a denied call's model reads: serve's own words for a call a person denied (refusal-words.ts refusedText,
|
|
91
102
|
* one copy with the tool gate's), the person's note with it. Asked before its intent, the call never ran. */
|
|
92
103
|
export declare function deniedText(tool: string, note?: string): string;
|
|
@@ -113,6 +124,10 @@ export interface Loop {
|
|
|
113
124
|
command(command: Command): Promise<CommandOutcome>;
|
|
114
125
|
/** Aborts the in-flight turn; resolves once the loop will write nothing more. */
|
|
115
126
|
stop(reason: StopReason): Promise<void>;
|
|
127
|
+
/** Whether a person's stop `reason` ends only the agent, the run keeping its computer for its owner (a held computer,
|
|
128
|
+
* computer-held.ts): the runner then goes on handing it rows (the owner's calls and release) until it ends. Absent:
|
|
129
|
+
* never. */
|
|
130
|
+
keepsComputer?(reason: StopReason): boolean;
|
|
116
131
|
}
|
|
117
132
|
export interface LoopDeps {
|
|
118
133
|
/** The run's journal (store.journal(claim)) behind the runner's own fence: after a claim-lost stop, a commit is
|