@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
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { Context } from "@earendil-works/chord/context";
|
|
2
|
+
import type { JsonValue } from "@earendil-works/chord/json";
|
|
3
|
+
import { type ConversationId, type DocumentReader, type HookApi, type HookRegistration, type ToolExecutionApi, type ToolRegistration } from "@earendil-works/pi-durable";
|
|
4
|
+
import { type Delivery, type Disagreement, type RecordContract, type RecordStore } from "./record.js";
|
|
5
|
+
/** The record a conversation delivered, or null while it has not, and the delivery attempts it has spent. */
|
|
6
|
+
export declare const RecordDoc: import("@earendil-works/pi-durable").ConversationDocToken<{
|
|
7
|
+
record: JsonValue | null;
|
|
8
|
+
attempts: number;
|
|
9
|
+
}>;
|
|
10
|
+
/** The gate's own state beside the record: whether the second reading's round was spent, and what it still
|
|
11
|
+
* disagreed with in the delivered record. */
|
|
12
|
+
export declare const GateDoc: import("@earendil-works/pi-durable").ConversationDocToken<{
|
|
13
|
+
bounced: boolean;
|
|
14
|
+
disagreements: Disagreement[];
|
|
15
|
+
}>;
|
|
16
|
+
/** The core's store on a conversation's two documents, written through a tool call's commits. */
|
|
17
|
+
export declare function recordStore(api: Pick<ToolExecutionApi, "commit" | "snapshot" | "conversationId">, context: Context): RecordStore;
|
|
18
|
+
/** The record a conversation delivered, or undefined while it has not, with what its second reading still disagreed with. */
|
|
19
|
+
export declare function deliveredRecord(reader: Pick<DocumentReader, "snapshot">, conversationId: ConversationId, context: Context): Promise<{
|
|
20
|
+
record: JsonValue;
|
|
21
|
+
disagreements: Disagreement[];
|
|
22
|
+
} | undefined>;
|
|
23
|
+
/** The `submit` tool as a model is shown it for one record: what it delivers, and the record's top-level fields with
|
|
24
|
+
* their plain types and descriptions, none required, since a partial record is an attempt the core counts. A record
|
|
25
|
+
* that may be delivered as a workspace file is offered the envelope under `fileKey`. */
|
|
26
|
+
export declare function submitDefinition(record: {
|
|
27
|
+
schema: Record<string, unknown>;
|
|
28
|
+
label: string;
|
|
29
|
+
fileKey?: string;
|
|
30
|
+
}): {
|
|
31
|
+
description: string;
|
|
32
|
+
parameters: Record<string, unknown>;
|
|
33
|
+
};
|
|
34
|
+
export type RecordToolOptions = {
|
|
35
|
+
/** The one record this tool delivers: its schema, what the model is told it delivers ("the summary record") and
|
|
36
|
+
* the key it may be delivered under as a workspace file. Absent, the tool serves conversations with different
|
|
37
|
+
* records: it is registered with open parameters, each conversation's contract names its schema and file key, and
|
|
38
|
+
* the host presents each conversation its own definition (`submitDefinition`) in a request hook. */
|
|
39
|
+
record?: {
|
|
40
|
+
schema: Record<string, unknown>;
|
|
41
|
+
label: string;
|
|
42
|
+
fileKey?: string;
|
|
43
|
+
};
|
|
44
|
+
/** The delivery contract of the conversation that called: its schema, reviewers, host checks and file reader. It is
|
|
45
|
+
* read on every call, so a host may resolve it late (a conversation pi resumed before its owner reached it again). */
|
|
46
|
+
contract(api: Pick<ToolExecutionApi, "conversationId" | "snapshot">, context: Context): RecordContract | Promise<RecordContract>;
|
|
47
|
+
/** Told each delivery after its commit: a host writes its own rows from it. A throw is the caller's own failure. */
|
|
48
|
+
onDelivery?(delivery: Delivery, conversationId: ConversationId): void | Promise<void>;
|
|
49
|
+
/** Whether an error is the host's own failure. Such an error ends the node's run with `fatalText`, and the host is
|
|
50
|
+
* told through `onFatal`; any other error is the tool's and is thrown. */
|
|
51
|
+
fatal?: (error: unknown) => boolean;
|
|
52
|
+
onFatal?(error: unknown, conversationId: ConversationId): void;
|
|
53
|
+
fatalText?: string;
|
|
54
|
+
/** How a disagreement is told to the model when its record goes back (default `disagreementText`). */
|
|
55
|
+
say?: (disagreement: Disagreement) => string;
|
|
56
|
+
};
|
|
57
|
+
/** The `submit` tool. */
|
|
58
|
+
export declare function recordTool(options: RecordToolOptions): ToolRegistration;
|
|
59
|
+
export type RecordNudgeOptions = {
|
|
60
|
+
/** What is owed, as the nudge names it; undefined for a conversation this hook does not nudge (it owes no record). */
|
|
61
|
+
label(api: Pick<HookApi, "conversationId" | "snapshot">, context: Context): string | undefined | Promise<string | undefined>;
|
|
62
|
+
/** Counts one delivery attempt on the conversation's record, durably, before the model is nudged. A hook cannot
|
|
63
|
+
* commit, so the conversation's owner supplies the write. */
|
|
64
|
+
spend(conversationId: ConversationId, context: Context): Promise<void>;
|
|
65
|
+
/** Delivery attempts the conversation gets (default `DELIVERY_ATTEMPTS`). */
|
|
66
|
+
maxAttempts?: number;
|
|
67
|
+
};
|
|
68
|
+
/** The nudge: a yield with the record still owed continues the run with a reminder, each nudge one delivery attempt;
|
|
69
|
+
* past the attempts the run ends. The nudge that spends the last attempt still continues, so the model is asked once
|
|
70
|
+
* more after it. */
|
|
71
|
+
export declare function recordNudge(options: RecordNudgeOptions): HookRegistration;
|
|
72
|
+
/** One nudge's delivery attempt, as a commit on the conversation's record. */
|
|
73
|
+
export declare const spendNudge: (tx: {
|
|
74
|
+
doc(token: typeof RecordDoc, conversationId: ConversationId): Promise<{
|
|
75
|
+
attempts: number;
|
|
76
|
+
}>;
|
|
77
|
+
}, conversationId: ConversationId) => Promise<void>;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { defineDoc, defineTool, GenerationTask, hook, } from "@earendil-works/pi-durable";
|
|
2
|
+
import { DELIVERY_ATTEMPTS, deliver, deliveryTerminates, deliveryText, fileSubmission, mixedFileSubmission, nudgeText, repairRecord, VIOLATIONS_SHOWN, } from "./record.js";
|
|
3
|
+
import { SUBMIT_TOOL } from "./host-tools.js";
|
|
4
|
+
import { toolResult } from "./pi-versions.js";
|
|
5
|
+
/** The record a conversation delivered, or null while it has not, and the delivery attempts it has spent. */
|
|
6
|
+
export const RecordDoc = defineDoc({
|
|
7
|
+
kind: "agentrun.record", version: 1, scope: "conversation", history: "latest", fork: "initial", initial: () => ({ record: null, attempts: 0 }),
|
|
8
|
+
checkpointWhen: () => false,
|
|
9
|
+
});
|
|
10
|
+
/** The gate's own state beside the record: whether the second reading's round was spent, and what it still
|
|
11
|
+
* disagreed with in the delivered record. */
|
|
12
|
+
export const GateDoc = defineDoc({
|
|
13
|
+
kind: "agentrun.gate", version: 1, scope: "conversation", history: "latest", fork: "initial", initial: () => ({ bounced: false, disagreements: [] }),
|
|
14
|
+
checkpointWhen: () => false,
|
|
15
|
+
});
|
|
16
|
+
/** Where `prepareArguments` carries a call's arguments to `execute`. A record's own fields are never read as it. */
|
|
17
|
+
const RAW = "_raw";
|
|
18
|
+
/** The core's store on a conversation's two documents, written through a tool call's commits. */
|
|
19
|
+
export function recordStore(api, context) {
|
|
20
|
+
const id = api.conversationId;
|
|
21
|
+
return {
|
|
22
|
+
read: async () => ({
|
|
23
|
+
record: (await api.snapshot(RecordDoc, id, context)) ?? { record: null, attempts: 0 },
|
|
24
|
+
gate: (await api.snapshot(GateDoc, id, context)) ?? { bounced: false, disagreements: [] },
|
|
25
|
+
}),
|
|
26
|
+
reject: () => api.commit(async (tx) => { const state = await tx.doc(RecordDoc, id); state.attempts += 1; return state.attempts; }, context),
|
|
27
|
+
bounce: () => api.commit(async (tx) => {
|
|
28
|
+
(await tx.doc(GateDoc, id)).bounced = true;
|
|
29
|
+
const state = await tx.doc(RecordDoc, id);
|
|
30
|
+
state.attempts += 1;
|
|
31
|
+
return state.attempts;
|
|
32
|
+
}, context),
|
|
33
|
+
accept: (record, disagreements) => api.commit(async (tx) => {
|
|
34
|
+
const state = await tx.doc(RecordDoc, id);
|
|
35
|
+
state.record = record;
|
|
36
|
+
state.attempts += 1;
|
|
37
|
+
if (disagreements.length)
|
|
38
|
+
(await tx.doc(GateDoc, id)).disagreements = disagreements;
|
|
39
|
+
}, context),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/** The record a conversation delivered, or undefined while it has not, with what its second reading still disagreed with. */
|
|
43
|
+
export async function deliveredRecord(reader, conversationId, context) {
|
|
44
|
+
const state = await reader.snapshot(RecordDoc, conversationId, context);
|
|
45
|
+
if (state?.record == null)
|
|
46
|
+
return undefined;
|
|
47
|
+
return { record: state.record, disagreements: [...((await reader.snapshot(GateDoc, conversationId, context))?.disagreements ?? [])] };
|
|
48
|
+
}
|
|
49
|
+
/** The `submit` tool as a model is shown it for one record: what it delivers, and the record's top-level fields with
|
|
50
|
+
* their plain types and descriptions, none required, since a partial record is an attempt the core counts. A record
|
|
51
|
+
* that may be delivered as a workspace file is offered the envelope under `fileKey`. */
|
|
52
|
+
export function submitDefinition(record) {
|
|
53
|
+
const { schema, label, fileKey } = record;
|
|
54
|
+
const declared = schema.properties && typeof schema.properties === "object" ? schema.properties : {};
|
|
55
|
+
return {
|
|
56
|
+
description: fileKey
|
|
57
|
+
? `Deliver ${label}. Submit it inline, or for a large record write JSON in the workspace and pass {"${fileKey}":"relative/path.json"}. It ends the run. These parameters are the output schema: submit validates the record against it and returns the violations to fix, up to ${VIOLATIONS_SHOWN} per call, so there is no schema file to find and no need to validate the record yourself first.`
|
|
58
|
+
: `Deliver ${label}. Submit it inline as the tool arguments. It ends the run. These parameters are the output schema: submit validates the record against it and returns the violations to fix, up to ${VIOLATIONS_SHOWN} per call.`,
|
|
59
|
+
parameters: { type: "object", additionalProperties: true, properties: {
|
|
60
|
+
...Object.fromEntries(Object.entries(declared).filter(([key]) => key !== RAW).map(([key, property]) => [key, { ...(typeof property?.type === "string" ? { type: property.type } : {}), ...(typeof property?.description === "string" ? { description: property.description } : {}) }])),
|
|
61
|
+
...(fileKey ? { [fileKey]: { type: "string", description: "Workspace-relative path to the complete JSON record" } } : {})
|
|
62
|
+
} },
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/** A call's arguments as the core decides them: a file submission as it is, an inline record repaired as a transport
|
|
66
|
+
* spelling. The reserved file key beside inline fields is the transport's, never the record's. */
|
|
67
|
+
function carried(args, schema, fileKey) {
|
|
68
|
+
if (fileKey && (fileSubmission(args, fileKey) !== null || mixedFileSubmission(args, schema, fileKey)))
|
|
69
|
+
return args;
|
|
70
|
+
const inline = fileKey && args && typeof args === "object" && !Array.isArray(args) ? (({ [fileKey]: _reserved, ...rest }) => rest)(args) : args;
|
|
71
|
+
return repairRecord(inline, schema);
|
|
72
|
+
}
|
|
73
|
+
/** The `submit` tool. */
|
|
74
|
+
export function recordTool(options) {
|
|
75
|
+
const { record } = options;
|
|
76
|
+
const shown = record ? submitDefinition(record) : { description: "Deliver the record. It ends the run.", parameters: { type: "object", additionalProperties: true } };
|
|
77
|
+
const answer = (delivery, maxAttempts) => toolResult([{ type: "text", text: deliveryText(delivery, maxAttempts, options.say) }], {
|
|
78
|
+
...(delivery.status === "rejected" || delivery.status === "bounced" ? { isError: true } : {}),
|
|
79
|
+
...(deliveryTerminates(delivery) ? { control: { terminate: true } } : {}),
|
|
80
|
+
});
|
|
81
|
+
return defineTool({
|
|
82
|
+
name: SUBMIT_TOOL,
|
|
83
|
+
description: shown.description,
|
|
84
|
+
parameters: shown.parameters,
|
|
85
|
+
// Every call's arguments are carried to `execute`; one record's are repaired here, before the Harness validates.
|
|
86
|
+
prepareArguments: (args) => ({ [RAW]: record ? carried(args, record.schema, record.fileKey) : args }),
|
|
87
|
+
replay: "safe",
|
|
88
|
+
executionMode: "sequential",
|
|
89
|
+
execute: async (args, api, context) => {
|
|
90
|
+
try {
|
|
91
|
+
const contract = await options.contract(api, context);
|
|
92
|
+
const raw = args[RAW];
|
|
93
|
+
const delivery = await deliver({ ...contract, ...(options.fatal ? { fatal: options.fatal } : {}) }, recordStore(api, context), record ? raw : carried(raw, contract.schema, contract.file?.key));
|
|
94
|
+
await options.onDelivery?.(delivery, api.conversationId);
|
|
95
|
+
return answer(delivery, contract.maxAttempts ?? DELIVERY_ATTEMPTS);
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
if (!options.fatal?.(error))
|
|
99
|
+
throw error;
|
|
100
|
+
options.onFatal?.(error, api.conversationId);
|
|
101
|
+
return toolResult([{ type: "text", text: options.fatalText ?? "The run cannot record this submission; the run stops." }], { isError: true, control: { terminate: true } });
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
/** The nudge: a yield with the record still owed continues the run with a reminder, each nudge one delivery attempt;
|
|
107
|
+
* past the attempts the run ends. The nudge that spends the last attempt still continues, so the model is asked once
|
|
108
|
+
* more after it. */
|
|
109
|
+
export function recordNudge(options) {
|
|
110
|
+
return hook(GenerationTask, {
|
|
111
|
+
onYield: async (_answer, api, context) => {
|
|
112
|
+
const state = await api.snapshot(RecordDoc, api.conversationId, context);
|
|
113
|
+
if (state?.record != null)
|
|
114
|
+
return undefined;
|
|
115
|
+
const label = await options.label(api, context);
|
|
116
|
+
if (label === undefined || (state?.attempts ?? 0) >= (options.maxAttempts ?? DELIVERY_ATTEMPTS))
|
|
117
|
+
return undefined;
|
|
118
|
+
await options.spend(api.conversationId, context);
|
|
119
|
+
return { continue: nudgeText(label) };
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
/** One nudge's delivery attempt, as a commit on the conversation's record. */
|
|
124
|
+
export const spendNudge = async (tx, conversationId) => {
|
|
125
|
+
(await tx.doc(RecordDoc, conversationId)).attempts += 1;
|
|
126
|
+
};
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/** The record a node delivered, or null while it has not, and the delivery attempts it has spent. */
|
|
2
|
+
export type RecordState = {
|
|
3
|
+
record: unknown;
|
|
4
|
+
attempts: number;
|
|
5
|
+
};
|
|
6
|
+
/** What the second reading disagrees with in a record: its question, the kind of reading, the verdict and why. */
|
|
7
|
+
export type Disagreement = {
|
|
8
|
+
id: string;
|
|
9
|
+
kind: string;
|
|
10
|
+
verdict: string;
|
|
11
|
+
reasons: string[];
|
|
12
|
+
};
|
|
13
|
+
/** Whether the second reading's round was spent, and what it still disagreed with in the delivered record. */
|
|
14
|
+
export type GateState = {
|
|
15
|
+
bounced: boolean;
|
|
16
|
+
disagreements: Disagreement[];
|
|
17
|
+
};
|
|
18
|
+
/** Delivery attempts a node gets: rejections, the second reading's one bounce and nudges, each once. */
|
|
19
|
+
export declare const DELIVERY_ATTEMPTS = 6;
|
|
20
|
+
/** The most schema violations one rejected delivery lists; the submit tool's description tells the model the number. */
|
|
21
|
+
export declare const VIOLATIONS_SHOWN = 8;
|
|
22
|
+
/** One reviewer's reading of a structurally valid record. `no_verdict` is a reviewer that could not answer. */
|
|
23
|
+
export type Reading = "disagrees" | "agrees" | "no_verdict";
|
|
24
|
+
/** The second reading on one structurally valid submission: it sends the record back only while its round
|
|
25
|
+
* is unspent and a reviewer disagrees. A reviewer with no verdict never sends a record back. */
|
|
26
|
+
export declare function gate(bounced: boolean, readings: readonly Reading[]): "accept" | "bounce";
|
|
27
|
+
/** What a node is answered with. Only `delivered` is a delivery; each of the others spends one attempt. */
|
|
28
|
+
export type DeliveryEvent = "rejected" | "bounce" | "nudge" | "delivered";
|
|
29
|
+
/** A node's delivery, as far as the attempts count it. */
|
|
30
|
+
export type DeliveryCount = {
|
|
31
|
+
attempts: number;
|
|
32
|
+
delivered: boolean;
|
|
33
|
+
};
|
|
34
|
+
/** Whether a node's delivery has ended: it delivered, or its attempts are spent. */
|
|
35
|
+
export declare const deliveryEnded: (max: number, state: DeliveryCount) => boolean;
|
|
36
|
+
/** One answer applied to the count. An ended delivery takes no further answer; every other answer counts once. */
|
|
37
|
+
export declare function spend(max: number, state: DeliveryCount, event: DeliveryEvent): DeliveryCount;
|
|
38
|
+
/** What makes a schema one no `submit` call can satisfy: a call's arguments are an object, so the schema must be a
|
|
39
|
+
* JSON Schema object whose root type, when it names one, admits an object. A node runner refuses such a schema
|
|
40
|
+
* before any conversation exists. */
|
|
41
|
+
export declare function lintRecordRoot(schema: unknown): string[];
|
|
42
|
+
/** Where the schema expects an object or an array and the submitted value is a string that parses to one, the
|
|
43
|
+
* parsed value; where it expects a number, an integer, a boolean or null and admits no string, the scalar a
|
|
44
|
+
* string spells. Some model families serialise nested tool arguments as strings: the content is valid and
|
|
45
|
+
* every submit fails on its spelling. A string that parses to a container the field also admits is read as that
|
|
46
|
+
* container; only against a scalar does a field that admits a string keep the string. */
|
|
47
|
+
export declare function parseStringifiedContainers(value: unknown, schema: Record<string, unknown> | undefined, depth?: number, root?: unknown): unknown;
|
|
48
|
+
/** The path of every string that spells "no value" in a field whose schema admits JSON null and does not list it. */
|
|
49
|
+
export declare function nullSpellings(value: unknown, schema: unknown, root?: unknown, at?: string): string[];
|
|
50
|
+
/** The record with every such string replaced by JSON null, in place. A repair the record as a whole refuses
|
|
51
|
+
* (it satisfied its schema before and does not after) is undone in full, so a spelling stays only where null
|
|
52
|
+
* is inadmissible; `undo: false` leaves that judgement to a caller that repairs more of the record and judges the
|
|
53
|
+
* whole. `""` is a value and stays. */
|
|
54
|
+
export declare function healNullSpellings<T>(record: T, schema: Record<string, unknown>, options?: {
|
|
55
|
+
undo?: boolean;
|
|
56
|
+
}): T;
|
|
57
|
+
/** A record's transport spellings repaired against its schema, without touching `args`. */
|
|
58
|
+
export declare function repairRecord(args: unknown, schema: Record<string, unknown>): unknown;
|
|
59
|
+
/** The file a submission names and nothing else: `{ <key>: "relative/path.json" }`. */
|
|
60
|
+
export declare function fileSubmission(args: unknown, key: string): string | null;
|
|
61
|
+
/** A submission with fields beside the file key. Fields that form a whole record on their own are that record;
|
|
62
|
+
* otherwise the file holds the record, and each field beside it may only restate the file's value. A schema
|
|
63
|
+
* that declares the file key as its own field keeps it inline. */
|
|
64
|
+
export declare function mixedFileSubmission(args: unknown, schema: Record<string, unknown> | undefined, key: string): {
|
|
65
|
+
file: string;
|
|
66
|
+
extras: Record<string, unknown>;
|
|
67
|
+
} | null;
|
|
68
|
+
/** The fields beside the file key that the file's record does not hold with the same value. */
|
|
69
|
+
export declare function extrasNotInRecord(record: unknown, extras: Record<string, unknown>): string[];
|
|
70
|
+
/** One host check's refusal of a candidate: the problems the model must fix, and the reason they are grouped under. */
|
|
71
|
+
export type Refusal = {
|
|
72
|
+
problems: string[];
|
|
73
|
+
reason?: string;
|
|
74
|
+
};
|
|
75
|
+
/** A second reader of a structurally valid record. It returns what it disagrees with (nothing when it agrees or
|
|
76
|
+
* has no verdict). `round` says whether a disagreement still sends the record back. A reviewer that throws
|
|
77
|
+
* decides nothing, unless the contract's `fatal` claims the error. */
|
|
78
|
+
export type Reviewer = (candidate: unknown, context: {
|
|
79
|
+
round: boolean;
|
|
80
|
+
}) => Disagreement[] | Promise<Disagreement[]>;
|
|
81
|
+
export type RecordContract = {
|
|
82
|
+
/** The node's record schema, the `submit` tool's contract. */
|
|
83
|
+
schema: Record<string, unknown>;
|
|
84
|
+
/** Delivery attempts the node gets (default `DELIVERY_ATTEMPTS`). */
|
|
85
|
+
maxAttempts?: number;
|
|
86
|
+
/** A record may be delivered as a workspace file named under `key`; `read` returns the file's parsed JSON or
|
|
87
|
+
* throws (an error whose `code` is `ENOENT` for a file that is not there). Absent, a record is inline only. */
|
|
88
|
+
file?: {
|
|
89
|
+
key: string;
|
|
90
|
+
read(path: string): Promise<unknown>;
|
|
91
|
+
};
|
|
92
|
+
/** Contracts the host owns, held before the schema: each problem is said with the core's own findings. */
|
|
93
|
+
contracts?: (candidate: unknown) => string[] | Promise<string[]>;
|
|
94
|
+
/** Checks held after the schema, in order; the first refusal is the rejection. One that throws refuses with
|
|
95
|
+
* what it threw. */
|
|
96
|
+
checks?: ReadonlyArray<(candidate: unknown) => Refusal | null | Promise<Refusal | null>>;
|
|
97
|
+
/** The second reading, in order. */
|
|
98
|
+
reviewers?: readonly Reviewer[];
|
|
99
|
+
/** Whether a reviewer's error is the caller's own failure, to be thrown and not absorbed. */
|
|
100
|
+
fatal?: (error: unknown) => boolean;
|
|
101
|
+
};
|
|
102
|
+
/** The two states behind a node's delivery. Each write is one atomic change; `reject` and `bounce` return the
|
|
103
|
+
* attempts spent after it. The bounce spends the round before the model is told, so a crash cannot grant it twice. */
|
|
104
|
+
export type RecordStore = {
|
|
105
|
+
read(): Promise<{
|
|
106
|
+
record: RecordState;
|
|
107
|
+
gate: GateState;
|
|
108
|
+
}>;
|
|
109
|
+
reject(): Promise<number>;
|
|
110
|
+
bounce(): Promise<number>;
|
|
111
|
+
accept(record: unknown, disagreements: Disagreement[]): Promise<void>;
|
|
112
|
+
};
|
|
113
|
+
/** What one submission came to. `spent` says the delivery attempts are gone and the node's run ends here. */
|
|
114
|
+
export type Delivery = {
|
|
115
|
+
status: "already";
|
|
116
|
+
} | {
|
|
117
|
+
status: "rejected";
|
|
118
|
+
attempts: number;
|
|
119
|
+
spent: boolean;
|
|
120
|
+
reason: string;
|
|
121
|
+
problems: string[];
|
|
122
|
+
} | {
|
|
123
|
+
status: "bounced";
|
|
124
|
+
attempts: number;
|
|
125
|
+
spent: boolean;
|
|
126
|
+
disagreements: Disagreement[];
|
|
127
|
+
} | {
|
|
128
|
+
status: "accepted";
|
|
129
|
+
record: unknown;
|
|
130
|
+
disagreements: Disagreement[];
|
|
131
|
+
};
|
|
132
|
+
/** Decide one `submit` call. `args` are the call's arguments as the model sent them, or as `repairRecord`
|
|
133
|
+
* already repaired them. */
|
|
134
|
+
export declare function deliver(contract: RecordContract, store: RecordStore, args: unknown): Promise<Delivery>;
|
|
135
|
+
/** The `submit` tool's answer to the model for one delivery. */
|
|
136
|
+
export declare function deliveryText(delivery: Delivery, maxAttempts?: number, say?: (disagreement: Disagreement) => string): string;
|
|
137
|
+
/** One disagreement as the model reads it. */
|
|
138
|
+
export declare const disagreementText: (d: Disagreement) => string;
|
|
139
|
+
/** Whether a delivery ends the node's run: a record was delivered, or the attempts are spent. */
|
|
140
|
+
export declare const deliveryTerminates: (delivery: Delivery) => boolean;
|
|
141
|
+
/** The delivery contract a node's task ends with: the label, the file envelope when one is offered, the
|
|
142
|
+
* authoritative schema and the host's own delivery instructions. The model sees the exact schema only here. */
|
|
143
|
+
export declare function submitFooter(record: {
|
|
144
|
+
label: string;
|
|
145
|
+
schema: Record<string, unknown>;
|
|
146
|
+
fileKey?: string;
|
|
147
|
+
instructions?: string;
|
|
148
|
+
reviewed?: boolean;
|
|
149
|
+
}): string;
|
|
150
|
+
/** What a yield without a record is answered with, when the delivery has an attempt left for it. */
|
|
151
|
+
export declare const nudgeText: (label: string) => string;
|