@parcha/agentrun-serve 0.1.0-beta.34 → 0.1.0-beta.36
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 +263 -0
- package/README.md +339 -179
- package/dist/adapters.d.ts +15 -2
- package/dist/adapters.js +34 -2
- package/dist/agent-rows.d.ts +3 -1
- package/dist/agents-store.d.ts +2 -0
- package/dist/agents-store.js +25 -5
- 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 +90 -8
- package/dist/archil-settings.js +150 -14
- 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/bash-read-only.d.ts +13 -0
- package/dist/bash-read-only.js +77 -0
- 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 +2 -2
- package/dist/browser-cost.js +6 -4
- 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 +19 -44
- package/dist/cap.js +31 -77
- package/dist/cli.js +36 -27
- package/dist/computer-keys.d.ts +20 -10
- package/dist/computer-keys.js +36 -57
- package/dist/computer-routes.d.ts +1 -4
- package/dist/computer-routes.js +3 -5
- package/dist/computer-setting.d.ts +8 -5
- package/dist/computer-setting.js +91 -26
- package/dist/computer-view.d.ts +11 -2
- package/dist/computer-view.js +2 -1
- package/dist/computers.d.ts +54 -8
- package/dist/computers.js +101 -22
- package/dist/console/assets/index-BI4Byidu.js +550 -0
- package/dist/console/assets/index-C19gUF2n.css +1 -0
- package/dist/console/index.html +2 -2
- package/dist/content-filter.d.ts +7 -0
- package/dist/content-filter.js +23 -0
- package/dist/decision-cap.d.ts +7 -29
- package/dist/decision-cap.js +3 -94
- package/dist/docker-daemon.d.ts +2 -2
- package/dist/docker-daemon.js +2 -2
- package/dist/errors.d.ts +1 -0
- package/dist/errors.js +8 -5
- package/dist/explain.js +3 -1
- package/dist/faux-computers.js +4 -0
- package/dist/files.d.ts +1 -9
- package/dist/files.js +1 -9
- package/dist/github-connection.js +25 -7
- package/dist/github-faux.d.ts +26 -0
- package/dist/github-faux.js +76 -0
- package/dist/github.d.ts +28 -4
- package/dist/github.js +46 -10
- package/dist/gpu-words.d.ts +14 -0
- package/dist/gpu-words.js +21 -0
- package/dist/graph-served.d.ts +5 -3
- package/dist/graph-served.js +14 -6
- package/dist/graph-view.d.ts +2 -0
- package/dist/graph-view.js +29 -2
- 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-opencode/harness.js +0 -1
- package/dist/harness-opencode/host/policy.js +2 -2
- package/dist/harness.js +1 -1
- package/dist/host-tools.d.ts +8 -9
- package/dist/host-tools.js +7 -7
- package/dist/index.d.ts +2 -3
- package/dist/index.js +2 -2
- package/dist/key-refusal.d.ts +1 -1
- package/dist/key-refusal.js +2 -2
- package/dist/learn/check.d.ts +10 -2
- package/dist/learn/check.js +126 -8
- package/dist/learn/commit.d.ts +40 -6
- package/dist/learn/commit.js +164 -20
- package/dist/learn/folder.d.ts +11 -3
- package/dist/learn/folder.js +40 -16
- package/dist/learn/grade.d.ts +22 -2
- package/dist/learn/grade.js +127 -19
- package/dist/learn/index.d.ts +2 -2
- package/dist/learn/index.js +2 -2
- package/dist/learn/learning.sh +11 -13
- package/dist/learn/notes.d.ts +17 -3
- package/dist/learn/notes.js +19 -6
- package/dist/learn/reflect.d.ts +5 -2
- package/dist/learn/reflect.js +48 -32
- package/dist/learn/skills.d.ts +52 -5
- package/dist/learn/skills.js +104 -21
- package/dist/learned-nodes.d.ts +18 -0
- package/dist/learned-nodes.js +8 -0
- package/dist/learned-workflow.d.ts +27 -13
- package/dist/learned-workflow.js +110 -38
- package/dist/learning-cost.d.ts +79 -0
- package/dist/learning-cost.js +69 -0
- package/dist/learning-routes.d.ts +48 -2
- package/dist/learning-routes.js +99 -28
- package/dist/learning-run.d.ts +7 -5
- package/dist/learning-run.js +9 -6
- package/dist/learning-words.d.ts +3 -0
- package/dist/learning-words.js +6 -2
- package/dist/learning.d.ts +13 -28
- package/dist/learning.js +4 -18
- package/dist/llm.d.ts +4 -1
- package/dist/llm.js +4 -2
- package/dist/mcp-gateway.d.ts +6 -0
- package/dist/mcp-gateway.js +11 -1
- package/dist/mcp-probe.d.ts +8 -1
- package/dist/mcp-probe.js +62 -20
- package/dist/mcp-secret-writes.js +4 -0
- package/dist/mcp-servers-store.d.ts +12 -12
- package/dist/mcp-servers-store.js +8 -3
- package/dist/model.d.ts +8 -5
- package/dist/model.js +14 -6
- package/dist/openapi.d.ts +2 -0
- package/dist/openapi.js +236 -55
- package/dist/owner.d.ts +0 -1
- package/dist/owner.js +0 -2
- package/dist/pause.d.ts +2 -19
- package/dist/pause.js +5 -74
- package/dist/place-offers.d.ts +97 -0
- package/dist/place-offers.js +206 -0
- package/dist/place.d.ts +9 -13
- package/dist/place.js +22 -32
- package/dist/port-models.d.ts +12 -4
- package/dist/port-models.js +31 -9
- package/dist/print.d.ts +1 -8
- package/dist/print.js +1 -14
- package/dist/propose.d.ts +3 -0
- package/dist/propose.js +25 -19
- package/dist/run-cut.d.ts +5 -0
- package/dist/run-cut.js +19 -0
- package/dist/run-db.js +3 -3
- package/dist/run-launch.d.ts +18 -3
- package/dist/run-launch.js +11 -5
- package/dist/run-learning-served.d.ts +12 -1
- package/dist/run-manifest.d.ts +2 -2
- package/dist/run-manifest.js +2 -2
- package/dist/run-reads-over-store.d.ts +4 -2
- package/dist/run-reads-over-store.js +10 -8
- package/dist/run-secrets.js +3 -3
- package/dist/run-timeline-served.js +60 -38
- package/dist/run-view.d.ts +35 -16
- package/dist/run-view.js +64 -35
- package/dist/runnable.d.ts +6 -3
- package/dist/runnable.js +20 -4
- package/dist/runner/adapter-loop.d.ts +46 -5
- package/dist/runner/adapter-loop.js +381 -56
- package/dist/runner/adapter-run-spec.d.ts +46 -4
- package/dist/runner/adapter-run-spec.js +200 -45
- package/dist/runner/adapters/pi.d.ts +39 -3
- package/dist/runner/adapters/pi.js +124 -29
- package/dist/runner/beside.d.ts +8 -0
- package/dist/runner/beside.js +24 -2
- package/dist/runner/claim-secrets.d.ts +6 -0
- package/dist/runner/claim-secrets.js +15 -1
- package/dist/runner/cli-run-spec.d.ts +10 -0
- package/dist/runner/cli-run-spec.js +207 -64
- package/dist/runner/commands.d.ts +5 -1
- package/dist/runner/commands.js +3 -3
- package/dist/runner/conformance/harness.d.ts +1 -1
- package/dist/runner/conformance/harness.js +13 -10
- package/dist/runner/github-app.d.ts +7 -2
- package/dist/runner/github-app.js +46 -15
- package/dist/runner/harness-loops.d.ts +6 -1
- package/dist/runner/harness-loops.js +24 -1
- package/dist/runner/journal-kinds.d.ts +53 -7
- package/dist/runner/journal-kinds.js +29 -1
- package/dist/runner/learning-end.d.ts +15 -0
- package/dist/runner/learning-end.js +113 -20
- package/dist/runner/learning-factory.js +6 -2
- package/dist/runner/learning-loop.d.ts +75 -1
- package/dist/runner/learning-loop.js +215 -22
- package/dist/runner/learning-seed.d.ts +8 -0
- package/dist/runner/learning-seed.js +7 -1
- package/dist/runner/loop-contract.d.ts +12 -0
- package/dist/runner/loop-contract.js +6 -0
- package/dist/runner/loop.d.ts +5 -1
- package/dist/runner/loop.js +20 -0
- package/dist/runner/main.d.ts +9 -4
- package/dist/runner/main.js +38 -13
- package/dist/runner/mcp-claim.d.ts +7 -0
- package/dist/runner/mcp-claim.js +35 -2
- package/dist/runner/mcp-github.d.ts +15 -4
- package/dist/runner/mcp-github.js +55 -11
- package/dist/runner/mcp-run.d.ts +2 -0
- package/dist/runner/mcp-run.js +2 -0
- package/dist/runner/metrics.d.ts +18 -1
- package/dist/runner/metrics.js +81 -1
- package/dist/runner/model-route.d.ts +6 -0
- package/dist/runner/model-route.js +5 -2
- package/dist/runner/pr-checkout.d.ts +59 -0
- package/dist/runner/pr-checkout.js +176 -0
- package/dist/runner/reflect-hook.d.ts +1 -0
- package/dist/runner/reflect-hook.js +3 -3
- package/dist/runner/runner.js +136 -19
- package/dist/runner/spec-holds.d.ts +13 -3
- package/dist/runner/spec-holds.js +13 -10
- package/dist/runner/store-port.d.ts +4 -1
- package/dist/runner/store-secrets.js +17 -1
- package/dist/runner/subagent.d.ts +44 -0
- package/dist/runner/subagent.js +188 -0
- package/dist/runner/workflow-host.d.ts +25 -4
- package/dist/runner/workflow-host.js +26 -4
- package/dist/runner/workflow-loop.d.ts +9 -3
- package/dist/runner/workflow-loop.js +17 -10
- package/dist/runner/workflow-spec.d.ts +28 -13
- package/dist/runner/workflow-spec.js +247 -102
- package/dist/runs-over-store.d.ts +18 -7
- package/dist/runs-over-store.js +149 -31
- package/dist/seal-key.d.ts +0 -2
- package/dist/seal-key.js +0 -2
- package/dist/sealing.js +1 -2
- package/dist/secret-cut.d.ts +1 -1
- package/dist/secret-cut.js +1 -1
- package/dist/server-lock.js +4 -5
- package/dist/server.d.ts +49 -63
- package/dist/server.js +429 -230
- package/dist/stop-signals.d.ts +4 -2
- package/dist/stop-signals.js +5 -3
- package/dist/store/agent-body.d.ts +14 -3
- package/dist/store/agent-body.js +22 -8
- package/dist/store/deadline.d.ts +18 -0
- package/dist/store/deadline.js +49 -0
- package/dist/store/index.d.ts +3 -3
- package/dist/store/index.js +2 -2
- package/dist/store/journal/storage.js +2 -1
- package/dist/store/postgres/connection.d.ts +4 -0
- package/dist/store/postgres/connection.js +64 -13
- package/dist/store/postgres/migrations/0004_runs_outcome_stop_or_cancel.sql +11 -0
- package/dist/store/schema.d.ts +2 -1
- package/dist/store/schema.js +11 -8
- 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 -82
- package/dist/store/sqlite/run-patch.d.ts +18 -2
- package/dist/store/sqlite/run-patch.js +31 -2
- package/dist/store/sqlite/store.js +65 -11
- package/dist/store/store.d.ts +62 -12
- package/dist/store/store.js +22 -1
- package/dist/store-reads/analytics.js +3 -2
- package/dist/store-reads/cap.d.ts +1 -3
- package/dist/store-reads/cap.js +8 -6
- package/dist/store-reads/decisions.d.ts +2 -2
- package/dist/store-reads/decisions.js +3 -6
- package/dist/store-reads/journal.js +83 -15
- package/dist/store-reads/learning.d.ts +73 -3
- package/dist/store-reads/learning.js +232 -9
- package/dist/store-reads/runs.d.ts +6 -4
- package/dist/store-reads/runs.js +17 -10
- package/dist/store-reads/stats.js +5 -1
- package/dist/store-view.d.ts +15 -1
- package/dist/store-view.js +88 -29
- package/dist/template-eval.js +2 -1
- package/dist/templates.d.ts +73 -4
- package/dist/templates.js +113 -23
- package/dist/timeline/timeline.d.ts +11 -1
- package/dist/timeline/timeline.js +19 -4
- package/dist/tool-blurbs.js +1 -0
- package/dist/tool-budget.d.ts +26 -0
- package/dist/tool-budget.js +56 -0
- package/dist/tool-gate.d.ts +13 -3
- package/dist/tool-gate.js +15 -7
- package/dist/tool-plane.d.ts +42 -29
- package/dist/tool-plane.js +64 -27
- package/dist/tools.d.ts +53 -39
- package/dist/tools.js +174 -79
- package/dist/trigger-signatures.d.ts +1 -0
- package/dist/trigger-signatures.js +3 -1
- package/dist/triggers.d.ts +3 -3
- package/dist/triggers.js +2 -2
- package/dist/turn-end.d.ts +0 -3
- package/dist/turn-end.js +0 -3
- package/dist/uploads.d.ts +28 -5
- package/dist/uploads.js +82 -9
- package/dist/usage-lines.d.ts +1 -1
- package/dist/usage.d.ts +1 -47
- package/dist/usage.js +3 -82
- package/dist/validate.d.ts +8 -0
- package/dist/validate.js +40 -3
- package/dist/webhooks.d.ts +2 -1
- package/dist/webhooks.js +5 -2
- 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 +112 -0
- package/dist/workflow/node-runner.js +270 -0
- package/dist/workflow/node.d.ts +88 -0
- package/dist/workflow/node.js +99 -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 +9 -0
- package/dist/workflow/pi-versions.js +8 -0
- package/dist/workflow/readers.d.ts +36 -0
- package/dist/workflow/readers.js +145 -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 +76 -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 +411 -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/wal.d.ts +11 -0
- package/dist/workflow/wal.js +106 -0
- package/dist/workflow-run.d.ts +1 -1
- package/dist/workspace/agent-computer.d.ts +137 -0
- package/dist/workspace/agent-computer.js +292 -0
- package/dist/workspace/archil-claim.d.ts +13 -2
- package/dist/workspace/archil-claim.js +22 -13
- package/dist/workspace/archil-disk.d.ts +10 -1
- package/dist/workspace/archil-disk.js +4 -0
- package/dist/workspace/archil-disks.d.ts +49 -0
- package/dist/workspace/archil-disks.js +185 -0
- package/dist/workspace/archil-exec.d.ts +12 -2
- package/dist/workspace/archil-exec.js +18 -3
- package/dist/workspace/archil-mount-credential.d.ts +20 -4
- package/dist/workspace/archil-mount-credential.js +13 -4
- package/dist/workspace/archil.d.ts +2 -2
- package/dist/workspace/archil.js +25 -5
- package/dist/workspace/attach.js +2 -0
- package/dist/workspace/computer-deps.d.ts +18 -11
- package/dist/workspace/computer-deps.js +64 -40
- package/dist/workspace/computer-for-claim.d.ts +47 -9
- package/dist/workspace/computer-for-claim.js +236 -24
- package/dist/workspace/computer-janitor.d.ts +3 -2
- package/dist/workspace/computer-janitor.js +43 -9
- package/dist/workspace/computer-ledger.d.ts +3 -8
- package/dist/workspace/computer-ledger.js +7 -3
- package/dist/workspace/computer-providers.d.ts +5 -3
- package/dist/workspace/computer-providers.js +11 -9
- package/dist/workspace/hands.d.ts +5 -2
- package/dist/workspace/hands.js +4 -3
- package/dist/workspace/index.d.ts +5 -4
- package/dist/workspace/index.js +2 -1
- package/dist/workspace/local.d.ts +3 -0
- package/dist/workspace/local.js +9 -0
- package/dist/workspace/paths.js +3 -2
- package/dist/workspace/pi-env.d.ts +4 -0
- package/dist/workspace/pi-env.js +3 -2
- package/dist/workspace/resolve-computer.d.ts +48 -12
- package/dist/workspace/resolve-computer.js +88 -19
- package/dist/workspace/run-disk.d.ts +34 -0
- package/dist/workspace/run-disk.js +91 -0
- package/dist/workspace/run-tools.d.ts +6 -4
- package/dist/workspace/run-tools.js +17 -9
- package/dist/workspace/server-run-workspace.d.ts +3 -2
- package/dist/workspace/server-run-workspace.js +17 -4
- package/dist/workspace/workspace.d.ts +5 -0
- package/dist/workspace.d.ts +0 -3
- package/dist/workspace.js +2 -15
- package/package.json +11 -16
- package/skills/agentrun-serve/SKILL.md +1 -1
- package/templates/README.md +11 -8
- 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/mentions-defused/case.yaml +15 -0
- package/templates/code-review/evals/mentions-defused/fixtures/github-mcp.json +254 -0
- package/templates/code-review/evals/mentions-defused/graders/no-pings.md +16 -0
- package/templates/code-review/evals/mentions-defused/graders/posted-a-review.md +5 -0
- package/templates/code-review/evals/mentions-defused/graders/schema.md +5 -0
- package/templates/code-review/evals/mentions-defused/prompt.md +10 -0
- 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/kyb/evals/clean-public-company/graders/no-opensanctions.md +5 -0
- package/templates/kyb/evals/opensanctions-on/case.yaml +5 -0
- package/templates/kyb/evals/opensanctions-on/graders/licence-and-evidence.md +18 -0
- package/templates/kyb/evals/opensanctions-on/graders/schema.md +5 -0
- package/templates/kyb/evals/opensanctions-on/prompt.md +11 -0
- package/templates/release-notes/agent.md +11 -0
- 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 -76
- package/dist/budget.js +0 -204
- package/dist/console/assets/index-RPHGlXmM.js +0 -540
- package/dist/console/assets/index-opTN5Naq.css +0 -1
- 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/templates/code-review/rules/REVIEW.md +0 -41
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
// The runner's side of a github_app MCP server (runner/mcp-github.ts): the server's GitHub App, read from the store at each
|
|
2
|
-
// claim, bound into the mint the claim step calls, with the run's repository. The App's id and
|
|
3
|
-
// server sealed in trigger_settings (adapter "github", scope "server", AAD
|
|
4
|
-
// sealed-settings-store.ts writes them), opened here with the runner's seal key
|
|
2
|
+
// claim and again before each mint, bound into the mint the claim step calls, with the run's repository. The App's id and
|
|
3
|
+
// private key are the rows the server sealed in trigger_settings (adapter "github", scope "server", AAD
|
|
4
|
+
// trigger_settings|github|server|<field>, as sealed-settings-store.ts writes them), opened here with the runner's seal key.
|
|
5
5
|
// No App (never connected, disconnected, or rows that do not open under this key): no access, and such a server's calls
|
|
6
|
-
// are refused in words (GITHUB_UNUSABLE.noAccess).
|
|
6
|
+
// are refused in words (GITHUB_UNUSABLE.noAccess). An App disconnected or replaced while a run holds a token: its next
|
|
7
|
+
// mint is refused as disconnected, and the claim step drops and revokes the token it holds.
|
|
7
8
|
import { unseal } from "../sealing.js";
|
|
8
|
-
import { GITHUB_API, GITHUB_FIELDS, GITHUB_SCOPE, githubTargetOf, mintInstallationToken } from "../github.js";
|
|
9
|
+
import { GITHUB_API, GITHUB_FIELDS, GITHUB_SCOPE, githubCall, githubTargetOf, mintInstallationToken } from "../github.js";
|
|
9
10
|
import { isObject } from "../validate.js";
|
|
10
11
|
const ADAPTER = "github";
|
|
11
12
|
const aad = (field) => `trigger_settings|${ADAPTER}|${GITHUB_SCOPE}|${field}`;
|
|
12
|
-
/** The
|
|
13
|
-
*
|
|
14
|
-
|
|
15
|
-
* runner's own options (AdapterSpecDeps.githubApi); nothing kept, no environment variable and no flag reaches it. */
|
|
16
|
-
export async function githubAppAccess(store, sealKey, firstInput, { api = GITHUB_API, now = Date.now } = {}) {
|
|
17
|
-
if (!sealKey)
|
|
18
|
-
return undefined;
|
|
13
|
+
/** The server's App as the store holds it now, opened with `sealKey`: its id and private key, or undefined when there is none
|
|
14
|
+
* this key opens. */
|
|
15
|
+
async function appOf(store, sealKey) {
|
|
19
16
|
const rows = (await store.triggerSettings.get(ADAPTER)).filter((row) => row.scope === GITHUB_SCOPE);
|
|
20
17
|
const open = (field) => {
|
|
21
18
|
const row = rows.find((r) => r.field === field);
|
|
@@ -30,8 +27,42 @@ export async function githubAppAccess(store, sealKey, firstInput, { api = GITHUB
|
|
|
30
27
|
};
|
|
31
28
|
const appId = open(GITHUB_FIELDS.appId);
|
|
32
29
|
const pem = open(GITHUB_FIELDS.privateKey);
|
|
33
|
-
|
|
30
|
+
return appId && pem ? { appId, pem } : undefined;
|
|
31
|
+
}
|
|
32
|
+
/** The GitHub App access for one claim of a run whose first input is `firstInput` (run_launch's), or undefined when this
|
|
33
|
+
* server has no App the runner can open. Its mint goes to https://api.github.com (GITHUB_API): the App's JWT, signed
|
|
34
|
+
* with its key and good for every installation, goes nowhere else. `api` is a test runner's fake GitHub, given in the
|
|
35
|
+
* runner's own options (AdapterSpecDeps.githubApi); nothing kept, no environment variable and no flag reaches it.
|
|
36
|
+
* `fromGitHub`: the run's first input is a github trigger's firing (its launch's inputOrigin), whose payload tag names
|
|
37
|
+
* the repository and installation; any other run's tag is never read, only its owner's words. `hold`: each token minted
|
|
38
|
+
* joins the run's redactor (its `cut`), the first and every one after. */
|
|
39
|
+
export async function githubAppAccess(store, sealKey, firstInput, { api = GITHUB_API, now = Date.now, fromGitHub = false, hold } = {}) {
|
|
40
|
+
if (!sealKey)
|
|
41
|
+
return undefined;
|
|
42
|
+
const app = await appOf(store, sealKey);
|
|
43
|
+
if (!app)
|
|
34
44
|
return undefined;
|
|
35
|
-
const target = githubTargetOf(isObject(firstInput) ? firstInput.content : firstInput);
|
|
36
|
-
return {
|
|
45
|
+
const target = githubTargetOf(isObject(firstInput) ? firstInput.content : firstInput, { payload: fromGitHub });
|
|
46
|
+
return {
|
|
47
|
+
api,
|
|
48
|
+
target,
|
|
49
|
+
// The App read again before each mint: one disconnected or replaced since the claim makes no token for this run.
|
|
50
|
+
mint: async (to, permissions) => {
|
|
51
|
+
// A read that fails throws on: the step's github_failed path keeps the token held until it expires, never a disconnect.
|
|
52
|
+
const still = await appOf(store, sealKey);
|
|
53
|
+
if (!still || still.appId !== app.appId || still.pem !== app.pem)
|
|
54
|
+
return { ok: false, reason: "disconnected", message: "the GitHub App was disconnected or replaced on this server" };
|
|
55
|
+
const minted = await mintInstallationToken(api, app.appId, app.pem, to, now(), permissions);
|
|
56
|
+
if (minted.ok)
|
|
57
|
+
hold?.([minted.token]);
|
|
58
|
+
return minted;
|
|
59
|
+
},
|
|
60
|
+
// Before each call: the App as the store holds it now, the same id and key, or the run's token stops.
|
|
61
|
+
same: async () => {
|
|
62
|
+
const still = await appOf(store, sealKey);
|
|
63
|
+
return Boolean(still && still.appId === app.appId && still.pem === app.pem);
|
|
64
|
+
},
|
|
65
|
+
// An installation token revokes itself (DELETE /installation/token, the token its own credential): no App needed.
|
|
66
|
+
revoke: async (token) => void (await githubCall(api, "/installation/token", { method: "DELETE", jwt: token }).catch(() => undefined)),
|
|
67
|
+
};
|
|
37
68
|
}
|
|
@@ -2,7 +2,12 @@ import type { RunLaunch } from "../run-launch.js";
|
|
|
2
2
|
import { type AdapterSpecDeps } from "./adapter-run-spec.js";
|
|
3
3
|
import { type GradeRouteAsk } from "./learning-dispatch.js";
|
|
4
4
|
import type { GraderRoute } from "./learning-ask.js";
|
|
5
|
-
import type
|
|
5
|
+
import { ClaimRefused, type LoopFactory } from "./loop-contract.js";
|
|
6
|
+
/** A claimed run whose harness this host's memory never holds: its message is the host's words (neverFits). A claim
|
|
7
|
+
* refused for good, so a parked run it wakes fails too, never retried as a resume (runner.ts finish). */
|
|
8
|
+
export declare class NeverFits extends ClaimRefused {
|
|
9
|
+
name: string;
|
|
10
|
+
}
|
|
6
11
|
/** The dispatch's `resolve`, built from the runner's deps: it reads the run's revision (for a workflow revision) and
|
|
7
12
|
* returns the loop the run runs on, or undefined when this runner does not run it (the dispatch fails it in words). */
|
|
8
13
|
export declare function resolveRunnerLoop(deps: AdapterSpecDeps): (harness: string, launch: RunLaunch, runId: string) => Promise<LoopFactory | undefined>;
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
// The runner's dispatch switch (design 2.1: "the runner takes every run"): which loop a claimed run runs, by its revision
|
|
2
|
+
// and the harness its launch names. The runner holds one dispatch loop (dispatch.ts) for every run; at the claim the
|
|
3
|
+
// dispatch reads the launch and asks this switch for the run's inner loop:
|
|
4
|
+
// - a workflow revision runs on the workflow loop (createWorkflowLoop), whatever its harness name (a workflow's default
|
|
5
|
+
// harness is pi), so the revision is read here to tell it from an agentic pi run;
|
|
6
|
+
// - a built-in learning run (its launch names harness "learning") runs on the learning loop;
|
|
7
|
+
// - pi runs on the kernel's adapter loop with the run's pi spec (adapterRunSpecFromLaunch);
|
|
8
|
+
// - a CLI harness (claude-agent, codex, opencode) runs on the adapter loop with its own adapter;
|
|
9
|
+
// - anything else fails the run in words (the dispatch's UnknownHarness).
|
|
10
|
+
import { hostMemory, neverFits } from "../host.js";
|
|
1
11
|
import { resolveHarness } from "./adapters/index.js";
|
|
2
12
|
import { adapterRunSpecFromLaunch, PI_WIRES } from "./adapter-run-spec.js";
|
|
3
13
|
import { createAdapterLoop } from "./adapter-loop.js";
|
|
@@ -5,8 +15,14 @@ import { savedModelKeys, withModelKeys } from "./claim-secrets.js";
|
|
|
5
15
|
import { createDispatchLoop } from "./dispatch.js";
|
|
6
16
|
import { cliRunSpecFromLaunch } from "./cli-run-spec.js";
|
|
7
17
|
import { gradeModelFor, gradeRouteOf, learningLoopOf } from "./learning-dispatch.js";
|
|
18
|
+
import { ClaimRefused } from "./loop-contract.js";
|
|
8
19
|
import { createWorkflowLoop, isWorkflowRevision } from "./workflow-loop.js";
|
|
9
20
|
import { workflowSpecOf } from "./workflow-spec.js";
|
|
21
|
+
/** A claimed run whose harness this host's memory never holds: its message is the host's words (neverFits). A claim
|
|
22
|
+
* refused for good, so a parked run it wakes fails too, never retried as a resume (runner.ts finish). */
|
|
23
|
+
export class NeverFits extends ClaimRefused {
|
|
24
|
+
name = "NeverFits";
|
|
25
|
+
}
|
|
10
26
|
/** The dispatch's `resolve`, built from the runner's deps: it reads the run's revision (for a workflow revision) and
|
|
11
27
|
* returns the loop the run runs on, or undefined when this runner does not run it (the dispatch fails it in words). */
|
|
12
28
|
export function resolveRunnerLoop(deps) {
|
|
@@ -49,13 +65,20 @@ export function resolveRunnerLoop(deps) {
|
|
|
49
65
|
// runs the pi spec (adapterRunSpecFromLaunch). A harness with no entry is unknown here: the dispatch fails it in words.
|
|
50
66
|
const runner = resolveHarness(harness);
|
|
51
67
|
if (runner) {
|
|
68
|
+
// A run this host's memory never holds (host.ts neverFits: one run of its harness is more than the host has for runs)
|
|
69
|
+
// fails at its claim, in the words a start of it is refused in here (harness.ts harnessOffers): a run another host
|
|
70
|
+
// started, or one left before this host's memory shrank. Claimed alone (runner.ts claimByMemory), it would run past
|
|
71
|
+
// the host's memory and its OOM kill would take every run on it.
|
|
72
|
+
const tooBig = neverFits(harness, hostMemory());
|
|
73
|
+
if (tooBig)
|
|
74
|
+
throw new NeverFits(tooBig);
|
|
52
75
|
// A run that learns supplies its own end-of-run step (reflect + proposal over its store) from its spec builder now,
|
|
53
76
|
// where the run's Archil claim is: a Mode 2 run's learning folder is on its claim's disk, not this machine's local
|
|
54
77
|
// path (adapter-run-spec.ts / cli-run-spec.ts endOfRun). The loop prefers the spec's step over its deps' (stepOf); a
|
|
55
78
|
// run that does not learn supplies none. The same for the pi and the CLI spec.
|
|
56
79
|
return createAdapterLoop((claim, adapterRun) => runner.record === "loop"
|
|
57
80
|
? cliRunSpecFromLaunch(launch, adapterRun, deps, claim)
|
|
58
|
-
: adapterRunSpecFromLaunch(launch, adapterRun, deps, claim));
|
|
81
|
+
: adapterRunSpecFromLaunch(launch, adapterRun, deps, claim), deps.modelRetry ?? {});
|
|
59
82
|
}
|
|
60
83
|
return undefined;
|
|
61
84
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { MessageOrigin } from "../timeline/index.js";
|
|
2
|
+
/** The session (sessions.ts journalSessions) a workflow run's call nodes log their effects on (KINDS.nodeEffect). */
|
|
3
|
+
export declare const NODE_LOG_SESSION = "node-log";
|
|
2
4
|
/** The phase row before a message a CLI run sends again (adapter-loop.ts CliRecord.sending): its runner was lost after
|
|
3
5
|
* sending it, before the message was recorded, so the model may read it twice, and the turn it starts is paid like any
|
|
4
6
|
* other. */
|
|
@@ -20,7 +22,7 @@ export declare const KINDS: {
|
|
|
20
22
|
* a call nor a message, so the reader passes over it. */
|
|
21
23
|
readonly messageSending: "agentrun.message.sending";
|
|
22
24
|
/** A pi input the person did not type (a trigger's message): pi's user entry under the host's kind, its `data.origin`
|
|
23
|
-
* the Timeline's attribution (
|
|
25
|
+
* the Timeline's attribution (the timeline reads a host's user entry's own origin). The model
|
|
24
26
|
* reads it as any message. */
|
|
25
27
|
readonly input: "agentrun.input";
|
|
26
28
|
/** A tool call the gate asked a person about: the run parks on it. */
|
|
@@ -47,11 +49,28 @@ export declare const KINDS: {
|
|
|
47
49
|
/** The resume of a paused workflow run (a `resume` row), taken: the workflow goes on from its journal. Neither a call nor
|
|
48
50
|
* a message, so the reader passes over it. */
|
|
49
51
|
readonly resume: "agentrun.resume";
|
|
52
|
+
/** A paid call the cap refused for room, kept at its refusal (the Refusal): its pause lands at the model's next request
|
|
53
|
+
* (adapter-loop.ts pauseFor), and a claim lost before that restores it from here (pendingPauseOf). No run patch, and
|
|
54
|
+
* neither a call nor a message, so the reader passes over it. */
|
|
55
|
+
readonly pausePending: "agentrun.pause.pending";
|
|
56
|
+
/** A workflow call node's effect, as it starts and as it ends (pause.ts NodeLine: its path, item, tool, label, input,
|
|
57
|
+
* then its status and output or error), on the run's node-log session (NODE_LOG_SESSION): the run's graph lists its
|
|
58
|
+
* effects from these. Written as the effect runs, never for one the driver answers from its receipt. */
|
|
59
|
+
readonly nodeEffect: "agentrun.node.effect";
|
|
50
60
|
/** A CLI run's end-of-run turn (the loop's record): its prompt (`role: "person"`) and its answer (`role: "model"`, the
|
|
51
61
|
* text in `model` as pi's answer carries it), the entry and the answer of the submission its request id names, the
|
|
52
62
|
* same submission pi's adapter writes, so the step reads both alike. Neither a call nor a message: the reader passes
|
|
53
63
|
* over it, and the turn is never on the run's visible record. */
|
|
54
64
|
readonly endOfRunTurn: "agentrun.end-of-run.turn";
|
|
65
|
+
/** What a learning run's claim laid of its seed: the learned skills it was given (`skills`, by name) and the learned
|
|
66
|
+
* workflows its learned_workflow tool runs (`workflows`, by name). Written once per claim, on the root; the newest is
|
|
67
|
+
* what the run was given. Neither a call nor a message. */
|
|
68
|
+
readonly learningLaid: "agentrun.learning.laid";
|
|
69
|
+
/** A workflow run's model node's execution, as the runner kept it before running it (workflow-spec.ts onModelNode):
|
|
70
|
+
* `{ path, tier?, model }`, its execution path, the tier it asked for (absent for none) and the model id the run's route
|
|
71
|
+
* sent it to. On the node log (NODE_LOG_SESSION), for GET /runs/{id}/graph's nodes' `model` (graph-view.ts). Neither a
|
|
72
|
+
* call nor a message. */
|
|
73
|
+
readonly nodeModel: "agentrun.node.model";
|
|
55
74
|
/** A learning run's grade: the verdict and what it spent, written before its merge (a resumed run never asks again). */
|
|
56
75
|
readonly learningGraded: "agentrun.learning.graded";
|
|
57
76
|
/** A learning run's merge: the new main and its commit, with the run's end. */
|
|
@@ -107,6 +126,13 @@ export interface RaiseData {
|
|
|
107
126
|
readonly capUsd: number;
|
|
108
127
|
readonly takes: readonly number[];
|
|
109
128
|
}
|
|
129
|
+
/** The cap a run is held to now, from its journal: its newest raise's (a KINDS.raise entry above 0), else its launch's;
|
|
130
|
+
* none for a run launched with no cap. The one figure every reader of the run's cap takes: each request's admission
|
|
131
|
+
* (adapter-loop.ts capNow), the run's view, and its end-of-run look back (learning-end.ts). */
|
|
132
|
+
export declare function capNowOf(launchCapUsd: number | undefined, entries: readonly {
|
|
133
|
+
readonly kind: string;
|
|
134
|
+
readonly data?: unknown;
|
|
135
|
+
}[]): number | undefined;
|
|
110
136
|
/** What a run parked at its cap waits on (the kernel cap's parkOf): its cap, what the cap counted as taken, the least the
|
|
111
137
|
* refused request needs, the least cap that sends it and the raise offered, in the run's money units (dollars). */
|
|
112
138
|
export interface BudgetData {
|
|
@@ -123,6 +149,9 @@ export interface BudgetData {
|
|
|
123
149
|
};
|
|
124
150
|
/** The cap's words, as the run row's summary says them. */
|
|
125
151
|
readonly words: string;
|
|
152
|
+
/** A workflow run's: the label of the node whose step waits at the cap, null when it is not known. Absent on an agentic
|
|
153
|
+
* run's pause. */
|
|
154
|
+
readonly node?: string | null;
|
|
126
155
|
}
|
|
127
156
|
export interface CallStartData {
|
|
128
157
|
readonly callId: string;
|
|
@@ -130,9 +159,15 @@ export interface CallStartData {
|
|
|
130
159
|
readonly input: unknown;
|
|
131
160
|
/** May run again after a crash (it changes nothing outside the run): the tool registry's own flag. */
|
|
132
161
|
readonly replaySafe: boolean;
|
|
133
|
-
/** Written as the call reached its gate through a CLI's own MCP client,
|
|
134
|
-
* agentrun.call.sent mark (KINDS.callSent). */
|
|
162
|
+
/** Written as the call reached its gate through a CLI's own MCP client, or its tool bridge's gate asked about it, before
|
|
163
|
+
* any answer: nothing is sent until its agentrun.call.sent mark (KINDS.callSent). */
|
|
135
164
|
readonly parked?: true;
|
|
165
|
+
/** Parked in its CLI's tool bridge (adapter-loop.ts bridgeGate), not at an MCP door: the bridge holds the call and hands
|
|
166
|
+
* the CLI nothing while it waits, so no waiting result shows for it (store-reads/journal.ts piShaped), as on pi. */
|
|
167
|
+
readonly bridge?: true;
|
|
168
|
+
/** The harness's working directory (a CLI's), which an absolute path in `input` is built from: the run's rows name a
|
|
169
|
+
* path under it by its name in the workspace (store-reads/journal.ts runTimeline). */
|
|
170
|
+
readonly cwd?: string;
|
|
136
171
|
/** When it was written (ms, the loop's clock): the Timeline dates the call's row by it. */
|
|
137
172
|
readonly at?: number;
|
|
138
173
|
}
|
|
@@ -216,15 +251,26 @@ export declare function withdrawnAnswers(entries: readonly {
|
|
|
216
251
|
export interface EndData {
|
|
217
252
|
readonly state: "ended" | "stopped" | "failed";
|
|
218
253
|
readonly summary?: string;
|
|
219
|
-
/** How
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
254
|
+
/** How the run ended beside its state (the store's RunOutcome): an escalation's 'escalated'; a stopped end's 'stopped'
|
|
255
|
+
* (a person's stop: the turn is over, not the run) or 'cancelled' (stopEnd). */
|
|
256
|
+
readonly outcome?: "completed" | "escalated" | "stopped" | "cancelled";
|
|
257
|
+
/** What the run cost, as its end knows it: null when unknown, which clears a cost an earlier end of the run stored (a
|
|
258
|
+
* follow-up's end). Absent: the stored cost is left as it is. */
|
|
259
|
+
readonly costUsd?: number | null;
|
|
223
260
|
/** The run's metrics (the old StoredMetrics JSON). */
|
|
224
261
|
readonly metrics?: unknown;
|
|
225
262
|
/** A completed workflow run's output: the value at its workflow's output path (readWorkflowRun's `output`, null when it
|
|
226
263
|
* has none), kept at its end as main's server kept it on the run (runs.ts workflowEnd), and served as result.output. */
|
|
227
264
|
readonly output?: unknown;
|
|
265
|
+
/** An escalated workflow run's review (outcome escalated): why it waits for a person, as its escalate node said it. */
|
|
266
|
+
readonly review?: EndReview;
|
|
267
|
+
}
|
|
268
|
+
/** An escalated workflow run's review as its end keeps it: the escalation's kind, the escalate node's label (else the node
|
|
269
|
+
* it escalated at), and its summary (else the run's). Served as the run's `review`, `at` its end. */
|
|
270
|
+
export interface EndReview {
|
|
271
|
+
readonly kind: string | null;
|
|
272
|
+
readonly node: string | null;
|
|
273
|
+
readonly reason: string;
|
|
228
274
|
}
|
|
229
275
|
export interface SessionKeyData {
|
|
230
276
|
readonly key: string;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { INTERRUPTED_TEXT } from "@parcha/agentrun-kernel/kernel";
|
|
2
|
+
/** The session (sessions.ts journalSessions) a workflow run's call nodes log their effects on (KINDS.nodeEffect). */
|
|
3
|
+
export const NODE_LOG_SESSION = "node-log";
|
|
2
4
|
/** The phase row before a message a CLI run sends again (adapter-loop.ts CliRecord.sending): its runner was lost after
|
|
3
5
|
* sending it, before the message was recorded, so the model may read it twice, and the turn it starts is paid like any
|
|
4
6
|
* other. */
|
|
@@ -20,7 +22,7 @@ export const KINDS = {
|
|
|
20
22
|
* a call nor a message, so the reader passes over it. */
|
|
21
23
|
messageSending: "agentrun.message.sending",
|
|
22
24
|
/** A pi input the person did not type (a trigger's message): pi's user entry under the host's kind, its `data.origin`
|
|
23
|
-
* the Timeline's attribution (
|
|
25
|
+
* the Timeline's attribution (the timeline reads a host's user entry's own origin). The model
|
|
24
26
|
* reads it as any message. */
|
|
25
27
|
input: "agentrun.input",
|
|
26
28
|
/** A tool call the gate asked a person about: the run parks on it. */
|
|
@@ -47,11 +49,28 @@ export const KINDS = {
|
|
|
47
49
|
/** The resume of a paused workflow run (a `resume` row), taken: the workflow goes on from its journal. Neither a call nor
|
|
48
50
|
* a message, so the reader passes over it. */
|
|
49
51
|
resume: "agentrun.resume",
|
|
52
|
+
/** A paid call the cap refused for room, kept at its refusal (the Refusal): its pause lands at the model's next request
|
|
53
|
+
* (adapter-loop.ts pauseFor), and a claim lost before that restores it from here (pendingPauseOf). No run patch, and
|
|
54
|
+
* neither a call nor a message, so the reader passes over it. */
|
|
55
|
+
pausePending: "agentrun.pause.pending",
|
|
56
|
+
/** A workflow call node's effect, as it starts and as it ends (pause.ts NodeLine: its path, item, tool, label, input,
|
|
57
|
+
* then its status and output or error), on the run's node-log session (NODE_LOG_SESSION): the run's graph lists its
|
|
58
|
+
* effects from these. Written as the effect runs, never for one the driver answers from its receipt. */
|
|
59
|
+
nodeEffect: "agentrun.node.effect",
|
|
50
60
|
/** A CLI run's end-of-run turn (the loop's record): its prompt (`role: "person"`) and its answer (`role: "model"`, the
|
|
51
61
|
* text in `model` as pi's answer carries it), the entry and the answer of the submission its request id names, the
|
|
52
62
|
* same submission pi's adapter writes, so the step reads both alike. Neither a call nor a message: the reader passes
|
|
53
63
|
* over it, and the turn is never on the run's visible record. */
|
|
54
64
|
endOfRunTurn: "agentrun.end-of-run.turn",
|
|
65
|
+
/** What a learning run's claim laid of its seed: the learned skills it was given (`skills`, by name) and the learned
|
|
66
|
+
* workflows its learned_workflow tool runs (`workflows`, by name). Written once per claim, on the root; the newest is
|
|
67
|
+
* what the run was given. Neither a call nor a message. */
|
|
68
|
+
learningLaid: "agentrun.learning.laid",
|
|
69
|
+
/** A workflow run's model node's execution, as the runner kept it before running it (workflow-spec.ts onModelNode):
|
|
70
|
+
* `{ path, tier?, model }`, its execution path, the tier it asked for (absent for none) and the model id the run's route
|
|
71
|
+
* sent it to. On the node log (NODE_LOG_SESSION), for GET /runs/{id}/graph's nodes' `model` (graph-view.ts). Neither a
|
|
72
|
+
* call nor a message. */
|
|
73
|
+
nodeModel: "agentrun.node.model",
|
|
55
74
|
/** A learning run's grade: the verdict and what it spent, written before its merge (a resumed run never asks again). */
|
|
56
75
|
learningGraded: "agentrun.learning.graded",
|
|
57
76
|
/** A learning run's merge: the new main and its commit, with the run's end. */
|
|
@@ -79,6 +98,15 @@ export const ASK_PERSON_WAITING = "Waiting for your reply";
|
|
|
79
98
|
export const HANDOVER_WAITING = "Waiting for you in the browser";
|
|
80
99
|
/** The summaries of a run held in its claim while it waits on its person: the server tells run.needs_input by them. */
|
|
81
100
|
export const HELD_WAITS = new Set([ASK_PERSON_WAITING, HANDOVER_WAITING]);
|
|
101
|
+
/** The cap a run is held to now, from its journal: its newest raise's (a KINDS.raise entry above 0), else its launch's;
|
|
102
|
+
* none for a run launched with no cap. The one figure every reader of the run's cap takes: each request's admission
|
|
103
|
+
* (adapter-loop.ts capNow), the run's view, and its end-of-run look back (learning-end.ts). */
|
|
104
|
+
export function capNowOf(launchCapUsd, entries) {
|
|
105
|
+
if (launchCapUsd === undefined)
|
|
106
|
+
return undefined;
|
|
107
|
+
const raised = entries.findLast((entry) => entry.kind === KINDS.raise && typeof entry.data?.capUsd === "number" && entry.data.capUsd > 0);
|
|
108
|
+
return raised ? raised.data.capUsd : launchCapUsd;
|
|
109
|
+
}
|
|
82
110
|
/** What a call that already ended answers when it is asked for again (a parked call's resume, a CLI's re-issue of its id):
|
|
83
111
|
* its recorded output; for one a crash cut with none, the kernel's words for an outcome not known (INTERRUPTED_TEXT);
|
|
84
112
|
* else that `tool`'s call ended so. An error unless it ended done. */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type TimelineEvent } from "../timeline/index.js";
|
|
2
2
|
import { type LearningFolder } from "../learn/folder.js";
|
|
3
|
+
import type { RunPath } from "../learning-cost.js";
|
|
3
4
|
import { type RunLaunch } from "../run-launch.js";
|
|
4
5
|
import { type SignInReader } from "../run-view.js";
|
|
5
6
|
import type { Store } from "../store/store.js";
|
|
@@ -28,11 +29,25 @@ export interface LearningEndDeps {
|
|
|
28
29
|
/** The end-of-run step for a run launched with `launch`: undefined when its launch records no learning start (a run that
|
|
29
30
|
* does not learn is asked nothing and keeps nothing), else the reflect hook over the run's store. */
|
|
30
31
|
export declare function learningEndOfRun(launch: RunLaunch, deps: LearningEndDeps): EndOfRunTurn | undefined;
|
|
32
|
+
/** learned_workflow by every name a harness calls it: its own, and claude-agent's host-tool alias (`mcp__hands__<name>`).
|
|
33
|
+
* A harness that names it another way reads as another tool, so its run is asked as before. */
|
|
34
|
+
export declare const LEARNED_NAMES: ReadonlySet<string>;
|
|
31
35
|
/** Whether a run's job, by its timeline `rows` (the end-of-run turn's own, labelled LEARNING_LABEL, left out), gave
|
|
32
36
|
* nothing new to look back on: it called tools, every one of them learned_workflow (a workflow's own nested calls are
|
|
33
37
|
* its), each answering; no tool result failed or was refused; no error, approval or wait; and one message, its first,
|
|
34
38
|
* came in. Anything else is asked its end-of-run turn. */
|
|
35
39
|
export declare function onlyLearnedWorkflows(rows: readonly TimelineEvent[]): boolean;
|
|
40
|
+
/** The path a run took (learning-cost.ts RunPath), by its timeline `rows` as runTimeline labels them (its end-of-run
|
|
41
|
+
* turn's rows, LEARNING_LABEL, are the learning's and left out): `workflow` when its job did only what
|
|
42
|
+
* onlyLearnedWorkflows asks of a run with nothing new to look back on, `handed_back` when it called a learned workflow
|
|
43
|
+
* otherwise, `agent` when it called none. */
|
|
44
|
+
export declare function runPathOf(rows: readonly TimelineEvent[]): RunPath;
|
|
45
|
+
/** The learned workflow a run's job called last by its call's `name` (callArgsOf's arguments, in the job's order: `calls`),
|
|
46
|
+
* or null when it called none by a name. */
|
|
47
|
+
export declare function workflowNameOf(calls: readonly {
|
|
48
|
+
tool: string;
|
|
49
|
+
args: Record<string, unknown>;
|
|
50
|
+
}[]): string | null;
|
|
36
51
|
/** How many of an agent's latest runs draftForOf reads at most: a skill offered to fewer than DRAFT_AFTER_RUNS of them is
|
|
37
52
|
* no repeated job. */
|
|
38
53
|
export declare const DRAFT_SCAN_RUNS = 200;
|
|
@@ -37,7 +37,9 @@ import { said, STOPPED } from "../learning-words.js";
|
|
|
37
37
|
import { proposeRun } from "../propose.js";
|
|
38
38
|
import { learningStartOf, readLaunchBody, seedFailed } from "../run-launch.js";
|
|
39
39
|
import { costOf } from "../run-view.js";
|
|
40
|
+
import { readApprovers } from "../server-approvers.js";
|
|
40
41
|
import { runEntries, runReflect, runTimeline } from "../store-reads/journal.js";
|
|
42
|
+
import { capNowOf } from "./journal-kinds.js";
|
|
41
43
|
import { createReflectHook } from "./reflect-hook.js";
|
|
42
44
|
import { runnerSecrets } from "./redact.js";
|
|
43
45
|
/** The end-of-run step for a run launched with `launch`: undefined when its launch records no learning start (a run that
|
|
@@ -49,22 +51,24 @@ export function learningEndOfRun(launch, deps) {
|
|
|
49
51
|
const env = deps.env ?? process.env;
|
|
50
52
|
// The grade model the server named at the run's start (its learning start's), none: the agent's own grades it.
|
|
51
53
|
const gradeModel = start.gradeModel;
|
|
52
|
-
const capUsd = launch.maxCostUsd;
|
|
53
54
|
const hookFor = (runId) => createReflectHook({
|
|
54
55
|
// reflectSkip's facts: a run its cap stopped has no room left, and one whose spend is unknown under a cap cannot be
|
|
55
|
-
// kept within it.
|
|
56
|
+
// kept within it. The cap is the run's now (capNowOf: its newest raise's, else its launch's), the one its requests
|
|
57
|
+
// were admitted under, never the launch's alone. A person's stop comes to the hook as its `cut`.
|
|
56
58
|
facts: async (runId) => {
|
|
57
59
|
const costUsd = costOf(await runTimeline(deps.store, runId, BACKGROUND_CONTEXT, { settled: false }));
|
|
60
|
+
const capUsd = launch.maxCostUsd === undefined ? undefined : capNowOf(launch.maxCostUsd, await runEntries(deps.store, runId, BACKGROUND_CONTEXT));
|
|
58
61
|
return { learns: true, costUsd, ...(capUsd !== undefined ? { capUsd, capReached: costUsd !== null && costUsd >= capUsd } : {}) };
|
|
59
62
|
},
|
|
60
63
|
nothingNew: async (runId) => onlyLearnedWorkflows(await runTimeline(deps.store, runId, BACKGROUND_CONTEXT, { settled: false })),
|
|
61
64
|
// A draft asked for or not never stops the turn: a count that can't be read asks for none.
|
|
62
65
|
promptFacts: async (runId, agentId) => {
|
|
63
66
|
const { tools } = await draftTools(deps, runId);
|
|
64
|
-
|
|
67
|
+
// A notes run (`learning: "notes"`) is asked for no workflow draft, and its prompt describes none.
|
|
68
|
+
const draftFor = start.notesOnly ? [] : await draftForOf(deps, agentId, runId, start.skills ?? []).catch(() => []);
|
|
65
69
|
// With a draft asked for, what each tool its call nodes may run takes and gives, in the server's own words.
|
|
66
|
-
const described = draftFor.length ? await describedOf(tools) : [];
|
|
67
|
-
return { active: start.seedNotes ?? start.given.length, tools, draftFor, described };
|
|
70
|
+
const described = draftFor.length ? await describedOf(tools, deps.store) : [];
|
|
71
|
+
return { active: start.seedNotes ?? start.given.length, tools, draftFor, described, ...(start.notesOnly ? { workflows: false } : {}) };
|
|
68
72
|
},
|
|
69
73
|
asked: async (runId) => {
|
|
70
74
|
const [entries, reflect] = await Promise.all([runEntries(deps.store, runId, BACKGROUND_CONTEXT), runReflect(deps.store, runId, BACKGROUND_CONTEXT)]);
|
|
@@ -94,7 +98,7 @@ export function learningEndOfRun(launch, deps) {
|
|
|
94
98
|
check: async ({ runId, agentId, turn, outcome, refuse }) => {
|
|
95
99
|
if (start.seed === null)
|
|
96
100
|
throw new Error("the run's learning start names no commit of main to propose against");
|
|
97
|
-
return checkedOf(deps, { runId, agentId, seed: start.seed, turn, outcome, refuse });
|
|
101
|
+
return checkedOf(deps, { runId, agentId, seed: start.seed, turn, outcome, refuse, ...(start.notesOnly ? { workflows: false } : {}) });
|
|
98
102
|
},
|
|
99
103
|
// The learning run's id, one per run: a replayed end queues the same one (the store adds it once).
|
|
100
104
|
newRunId: () => `${runId}-learning`,
|
|
@@ -114,7 +118,7 @@ export function learningEndOfRun(launch, deps) {
|
|
|
114
118
|
}
|
|
115
119
|
/** learned_workflow by every name a harness calls it: its own, and claude-agent's host-tool alias (`mcp__hands__<name>`).
|
|
116
120
|
* A harness that names it another way reads as another tool, so its run is asked as before. */
|
|
117
|
-
const LEARNED_NAMES = new Set([LEARNED_WORKFLOW_TOOL, `mcp__hands__${LEARNED_WORKFLOW_TOOL}`]);
|
|
121
|
+
export const LEARNED_NAMES = new Set([LEARNED_WORKFLOW_TOOL, `mcp__hands__${LEARNED_WORKFLOW_TOOL}`]);
|
|
118
122
|
/** Whether a run's job, by its timeline `rows` (the end-of-run turn's own, labelled LEARNING_LABEL, left out), gave
|
|
119
123
|
* nothing new to look back on: it called tools, every one of them learned_workflow (a workflow's own nested calls are
|
|
120
124
|
* its), each answering; no tool result failed or was refused; no error, approval or wait; and one message, its first,
|
|
@@ -134,14 +138,94 @@ export function onlyLearnedWorkflows(rows) {
|
|
|
134
138
|
const answered = new Set(results.filter((row) => !row.parent_tool_use_id).map((row) => row.tool_use_id));
|
|
135
139
|
return calls.every((row) => answered.has(row.tool_use_id));
|
|
136
140
|
}
|
|
141
|
+
/** The path a run took (learning-cost.ts RunPath), by its timeline `rows` as runTimeline labels them (its end-of-run
|
|
142
|
+
* turn's rows, LEARNING_LABEL, are the learning's and left out): `workflow` when its job did only what
|
|
143
|
+
* onlyLearnedWorkflows asks of a run with nothing new to look back on, `handed_back` when it called a learned workflow
|
|
144
|
+
* otherwise, `agent` when it called none. */
|
|
145
|
+
export function runPathOf(rows) {
|
|
146
|
+
const ran = rows.some((row) => row.agent_label !== LEARNING_LABEL && row.kind === "tool_use" && !row.parent_tool_use_id && LEARNED_NAMES.has(row.tool_name ?? ""));
|
|
147
|
+
if (!ran)
|
|
148
|
+
return "agent";
|
|
149
|
+
return onlyLearnedWorkflows(rows) ? "workflow" : "handed_back";
|
|
150
|
+
}
|
|
151
|
+
/** The learned workflow a run's job called last by its call's `name` (callArgsOf's arguments, in the job's order: `calls`),
|
|
152
|
+
* or null when it called none by a name. */
|
|
153
|
+
export function workflowNameOf(calls) {
|
|
154
|
+
for (let i = calls.length - 1; i >= 0; i--) {
|
|
155
|
+
const call = calls[i];
|
|
156
|
+
if (LEARNED_NAMES.has(call.tool) && typeof call.args.name === "string")
|
|
157
|
+
return call.args.name;
|
|
158
|
+
}
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
/** Why each draft of `proposal` waits for its owner's OK whatever the grade: its steps calling an MCP tool with no
|
|
162
|
+
* declared price (skills.ts unpricedCalls), by its workflow.json's path, from the prices each server's row keeps
|
|
163
|
+
* (mcp-probe.ts McpPrices). A server the store can't read gives no price: held. */
|
|
164
|
+
async function heldOf(store, proposal) {
|
|
165
|
+
const files = (proposal?.files ?? []).filter((one) => typeof one?.file === "string" && one.file.endsWith("/workflow.json") && typeof one.text === "string");
|
|
166
|
+
const { draftMcpTools, unpricedCalls, unpricedLine } = await import("../learn/skills.js");
|
|
167
|
+
const rows = new Map();
|
|
168
|
+
const priced = new Map();
|
|
169
|
+
const held = {};
|
|
170
|
+
for (const { file, text } of files) {
|
|
171
|
+
let doc;
|
|
172
|
+
try {
|
|
173
|
+
doc = JSON.parse(text);
|
|
174
|
+
}
|
|
175
|
+
catch {
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
// Every MCP tool its call nodes run, as the workflow's own read reads them (draftMcpTools over the parsed JSON: an
|
|
179
|
+
// escaped "\/" is a slash there), its price read first (unpricedCalls asks synchronously).
|
|
180
|
+
for (const name of draftMcpTools(doc)) {
|
|
181
|
+
const [server, tool] = name.slice("mcp:".length).split("/");
|
|
182
|
+
if (!rows.has(server))
|
|
183
|
+
rows.set(server, store.mcp.server(server).catch(() => undefined));
|
|
184
|
+
const price = (await rows.get(server))?.prices?.[tool];
|
|
185
|
+
priced.set(name, typeof price === "number" && Number.isFinite(price) ? price : undefined);
|
|
186
|
+
}
|
|
187
|
+
const lines = unpricedCalls(doc, (tool) => priced.get(tool)).map(unpricedLine);
|
|
188
|
+
if (lines.length)
|
|
189
|
+
held[file] = lines;
|
|
190
|
+
}
|
|
191
|
+
return held;
|
|
192
|
+
}
|
|
193
|
+
/** The tools each saved MCP server lists now, by the server's name (none for one not saved, or a store that can't be
|
|
194
|
+
* read): what a wildcard grant names (tools.ts mcpGrantsListed). */
|
|
195
|
+
async function mcpListedOf(store) {
|
|
196
|
+
const rows = await store.mcp.servers().catch(() => []);
|
|
197
|
+
const byName = new Map(rows.map((row) => [row.name, (row.tools ?? []).flatMap((tool) => (typeof tool?.name === "string" ? [tool.name] : []))]));
|
|
198
|
+
return (server) => byName.get(server) ?? [];
|
|
199
|
+
}
|
|
137
200
|
/** What each of `tools` takes and gives a workflow's call node, in the server's own words for it (tools.ts ToolEntry's
|
|
138
|
-
* summary): the draft ask's `describe`.
|
|
139
|
-
|
|
201
|
+
* summary): the draft ask's `describe`. An MCP tool (`mcp:<server>/<tool>`, LS-07) is described by its server's listing
|
|
202
|
+
* as the store keeps it: what it does, the schema it takes and, when it lists one, the one it gives (reflect.ts cuts
|
|
203
|
+
* each line to its cap). A server or a tool the store does not list is described by none. */
|
|
204
|
+
async function describedOf(tools, store) {
|
|
140
205
|
const { toolOf } = await import("../tools.js");
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
206
|
+
const listed = new Map();
|
|
207
|
+
const out = [];
|
|
208
|
+
for (const name of tools) {
|
|
209
|
+
const mcp = /^mcp:([^/]+)\/(.+)$/.exec(name);
|
|
210
|
+
if (!mcp) {
|
|
211
|
+
const does = toolOf(name)?.summary;
|
|
212
|
+
if (does)
|
|
213
|
+
out.push({ name, does });
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
const server = mcp[1];
|
|
217
|
+
const tool = mcp[2];
|
|
218
|
+
if (!listed.has(server))
|
|
219
|
+
listed.set(server, store.mcp.server(server).catch(() => undefined));
|
|
220
|
+
const row = await listed.get(server);
|
|
221
|
+
const entry = (row?.tools ?? []).find((one) => one?.name === tool);
|
|
222
|
+
if (!entry)
|
|
223
|
+
continue;
|
|
224
|
+
const said = typeof entry.description === "string" && entry.description.trim() ? entry.description.trim() : typeof entry.title === "string" ? entry.title.trim() : "";
|
|
225
|
+
const does = [said ? `${said.replace(/[.\s]+$/, "")}.` : "", `Takes ${JSON.stringify(entry.input_schema ?? {})}.`, entry.output_schema !== undefined ? `Gives ${JSON.stringify(entry.output_schema)}.` : ""].filter(Boolean).join(" ");
|
|
226
|
+
out.push({ name, does });
|
|
227
|
+
}
|
|
228
|
+
return out;
|
|
145
229
|
}
|
|
146
230
|
/** How many of an agent's latest runs draftForOf reads at most: a skill offered to fewer than DRAFT_AFTER_RUNS of them is
|
|
147
231
|
* no repeated job. */
|
|
@@ -201,28 +285,34 @@ async function draftTools(deps, runId) {
|
|
|
201
285
|
const run = await deps.store.runs.get(runId);
|
|
202
286
|
const revision = run ? await deps.store.agents.revision(run.revisionId) : undefined;
|
|
203
287
|
if (revision?.kind !== "agentic")
|
|
204
|
-
return { tools: [], gated: {} };
|
|
288
|
+
return { tools: [], gated: {}, deniedBy: {}, asked: [] };
|
|
205
289
|
const body = revision.body;
|
|
206
|
-
const [{ learnedDraftTools }, { permissionFrom }, { loadToolSettings }] = await Promise.all([import("../tools.js"), import("../tool-gate.js"), import("../tool-plane.js")]);
|
|
290
|
+
const [{ learnedDraftTools, mcpGrantsListed }, { permissionFrom }, { loadToolSettings }] = await Promise.all([import("../tools.js"), import("../tool-gate.js"), import("../tool-plane.js")]);
|
|
207
291
|
// The server's settings from the one store, as the run's gate reads them: a stored row that does not read carries
|
|
208
292
|
// SETTINGS_UNREAD, which permissionFrom honours (no ask is lifted over a deny the row may hold).
|
|
209
293
|
const server = (await loadToolSettings(deps.store)).settings;
|
|
210
294
|
const agent = (body.toolSettings ?? {});
|
|
211
295
|
const approvals = body.approvals === "never" ? "never" : "ask";
|
|
212
|
-
|
|
213
|
-
|
|
296
|
+
// A server's wildcard grant read as the tools its server lists now (tools.ts mcpGrantsListed, LS-07).
|
|
297
|
+
const granted = (body.tools ?? []).some((name) => /^mcp:[^/]+\/\*$/.test(name)) ? mcpGrantsListed(body.tools ?? [], await mcpListedOf(deps.store)) : (body.tools ?? []);
|
|
298
|
+
// `deniedBy`: where each deny was set (the agent's tool settings, the server's, a default), which a left-out draft's
|
|
299
|
+
// words name.
|
|
300
|
+
const { tools, gated, deniedBy, asked } = learnedDraftTools(granted, (name) => permissionFrom(name, server, agent, approvals).permission, undefined, (name) => permissionFrom(name, server, agent, approvals).from, { mcp: true, approvers: await readApprovers(deps.store.settings) });
|
|
301
|
+
return { tools, gated, deniedBy, asked };
|
|
214
302
|
}
|
|
215
303
|
/** proposeRun's checks over the turn, against seed `seed`, in a directory of the step's own: the proposal it keeps there
|
|
216
304
|
* is read back for the hook to store with the run's end, and the directory is removed. */
|
|
217
305
|
async function checkedOf(deps, input) {
|
|
218
306
|
const runDir = await mkdtemp(join(tmpdir(), "agentrun-learning-end-"));
|
|
219
307
|
try {
|
|
220
|
-
const { tools, gated } = await draftTools(deps, input.runId);
|
|
308
|
+
const { tools, gated, deniedBy, asked } = await draftTools(deps, input.runId);
|
|
309
|
+
// #2424's card rule (learnedAskFits): a draft whose ask-set MCP tools would not all show on its approval card is refused.
|
|
310
|
+
const { learnedAskFits } = await import("../learned-workflow.js");
|
|
221
311
|
const turn = { answer: input.turn.answer, asked: [...input.turn.asked], ...(input.turn.triggered?.length ? { triggered: input.turn.triggered.map((one) => ({ ...one })) } : {}) };
|
|
222
312
|
const folder = deps.learningFolder(input.agentId);
|
|
223
313
|
let proposed;
|
|
224
314
|
try {
|
|
225
|
-
proposed = await proposeRun({ folder: folder.workspace, runDir, seed: input.seed, turn, refuse: input.refuse, outcome: input.outcome, tools, ...(Object.keys(gated).length ? { gated } : {}) });
|
|
315
|
+
proposed = await proposeRun({ folder: folder.workspace, runDir, seed: input.seed, turn, refuse: input.refuse, outcome: input.outcome, tools, ...(Object.keys(gated).length ? { gated } : {}), ...(Object.keys(deniedBy).length ? { deniedBy } : {}), ask: { asked, fits: learnedAskFits }, ...(input.workflows === false ? { workflows: false } : {}) });
|
|
226
316
|
}
|
|
227
317
|
finally {
|
|
228
318
|
await folder.end();
|
|
@@ -230,7 +320,10 @@ async function checkedOf(deps, input) {
|
|
|
230
320
|
if (proposed.state !== "proposed")
|
|
231
321
|
return proposed;
|
|
232
322
|
const proposal = JSON.parse(await readFile(join(runDir, PROPOSAL), "utf8"));
|
|
233
|
-
|
|
323
|
+
// A draft calling an MCP tool with no declared price waits for its owner's OK whatever the grade (LS-07): held here,
|
|
324
|
+
// from the prices the store keeps now, and said to the grader.
|
|
325
|
+
const held = await heldOf(deps.store, proposal);
|
|
326
|
+
return { ...proposed, proposal: Object.keys(held).length ? { ...proposal, held } : proposal };
|
|
234
327
|
}
|
|
235
328
|
finally {
|
|
236
329
|
await rm(runDir, { recursive: true, force: true });
|
|
@@ -6,8 +6,10 @@
|
|
|
6
6
|
// (passed in by the runner's wiring);
|
|
7
7
|
// folder the agent's learning folder in the server's data (learn/folder.ts learningWorkspace), ended after each run;
|
|
8
8
|
// readMain main as the grader reads it, from the folder's snapshot (learn/commit.ts readMain);
|
|
9
|
-
// commit the folder's one write (learn/commit.ts learningCommit)
|
|
10
|
-
|
|
9
|
+
// commit the folder's one write (learn/commit.ts learningCommit);
|
|
10
|
+
// merged the run's merge when it is on main already, with the texts its own commit holds (learn/commit.ts mergedAt),
|
|
11
|
+
// for a resume after its commit.
|
|
12
|
+
import { learningCommit, mainTexts, mergedAt, readMain } from "../learn/commit.js";
|
|
11
13
|
import { learningWorkspace } from "../learn/folder.js";
|
|
12
14
|
import { createLearningLoop } from "./learning-loop.js";
|
|
13
15
|
/** The harness a learning run's launch names (store/sqlite/run-patch.ts learningLaunchOf). */
|
|
@@ -32,6 +34,8 @@ export function learningLoopFactory(deps) {
|
|
|
32
34
|
folder: (agentId) => learningWorkspace({ mode: "local", agentId, data: deps.data, ...(deps.log ? { log: deps.log } : {}) }),
|
|
33
35
|
readMain: async (ws, proposal) => (await readMain(ws, { notes: proposal.notes })),
|
|
34
36
|
commit: async (ws, change) => (await learningCommit(ws, change)),
|
|
37
|
+
mainTexts: (ws, paths) => mainTexts(ws, paths),
|
|
38
|
+
merged: (ws, runId, paths) => mergedAt(ws, runId, paths),
|
|
35
39
|
...(deps.now ? { now: deps.now } : {}),
|
|
36
40
|
});
|
|
37
41
|
}
|