@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
package/dist/import-sources.js
CHANGED
|
@@ -174,10 +174,12 @@ export async function readSession(file, source, { turns: keep = true, seen } = {
|
|
|
174
174
|
const provider = {};
|
|
175
175
|
const current = { keyed: new Map(), seen: seen ?? new Set(), copied: new Set() };
|
|
176
176
|
const codex = { events: false, held: [], records: false, responses: new Set(), items: new Map(), results: new Map() };
|
|
177
|
+
const titles = { summaries: [], uuids: new Set() };
|
|
177
178
|
const add = (turn, index = turns.length) => {
|
|
178
179
|
if (turn.role === "user") {
|
|
179
180
|
session.users += 1;
|
|
180
181
|
session.firstPrompt ??= turn.text;
|
|
182
|
+
session.titleText ??= personsWords(turn.text);
|
|
181
183
|
}
|
|
182
184
|
if (keep)
|
|
183
185
|
turns.splice(index, 0, turn);
|
|
@@ -199,7 +201,7 @@ export async function readSession(file, source, { turns: keep = true, seen } = {
|
|
|
199
201
|
continue;
|
|
200
202
|
const at = timeOf(value.timestamp);
|
|
201
203
|
// A copy of a record read already moves no time: its time was counted where it was first read.
|
|
202
|
-
const copy = record(value, at ?? last ?? 0, session, { add, names, turns, priced, provider, current, codex }) === false;
|
|
204
|
+
const copy = record(value, at ?? last ?? 0, session, { add, names, turns, priced, provider, current, codex, titles }) === false;
|
|
203
205
|
if (copy)
|
|
204
206
|
session.copies += 1;
|
|
205
207
|
if (at !== undefined && !copy) {
|
|
@@ -218,6 +220,9 @@ export async function readSession(file, source, { turns: keep = true, seen } = {
|
|
|
218
220
|
codex.held.forEach(({ index, turn }, k) => add(turn, index + k));
|
|
219
221
|
if (!session.id)
|
|
220
222
|
session.id = source === "pi" ? basename(file, ".jsonl").split("_").pop() : basename(file, ".jsonl");
|
|
223
|
+
const sourceTitle = titles.custom ?? titles.ai ?? titles.summaries.findLast(({ leaf }) => leaf === undefined || titles.uuids.has(leaf))?.title;
|
|
224
|
+
if (sourceTitle)
|
|
225
|
+
session.sourceTitle = sourceTitle;
|
|
221
226
|
if (first !== undefined)
|
|
222
227
|
session.startedAt = new Date(first).toISOString();
|
|
223
228
|
if (last !== undefined)
|
|
@@ -242,14 +247,51 @@ export function mostEffortOf(turns) {
|
|
|
242
247
|
return most;
|
|
243
248
|
}
|
|
244
249
|
const INTERRUPTED = /^\[Request interrupted by user/;
|
|
250
|
+
// The titles Claude Code writes into a session's file, each again as it changes, and the field each holds it in.
|
|
251
|
+
const CLAUDE_TITLES = new Map([
|
|
252
|
+
["custom-title", "customTitle"],
|
|
253
|
+
["ai-title", "aiTitle"],
|
|
254
|
+
["summary", "summary"],
|
|
255
|
+
]);
|
|
256
|
+
/** One of Claude Code's title records: kept by kind, the latest of each. A summary names the last message of the
|
|
257
|
+
* conversation it titles (leafUuid), which can be another session's: held until the file's end. */
|
|
258
|
+
function titleRecord(value, session, titles) {
|
|
259
|
+
// As written: the cut matches a key or a passphrase as the source wrote it, so the title is put on one line after it.
|
|
260
|
+
const title = str(value[CLAUDE_TITLES.get(value.type)])?.trim();
|
|
261
|
+
if (!title || (str(value.sessionId) && value.sessionId !== session.id))
|
|
262
|
+
return;
|
|
263
|
+
if (value.type === "custom-title")
|
|
264
|
+
titles.custom = title;
|
|
265
|
+
else if (value.type === "ai-title")
|
|
266
|
+
titles.ai = title;
|
|
267
|
+
else
|
|
268
|
+
titles.summaries.push({ title, ...(str(value.leafUuid) ? { leaf: value.leafUuid } : {}) });
|
|
269
|
+
}
|
|
270
|
+
// What Claude Code writes into a user message for the person's slash command (/clear, /model, /init, /resume …): the
|
|
271
|
+
// command's name, message and arguments, each in its own element, then its output and the preamble it puts before a
|
|
272
|
+
// local command's output. Only these elements, whole: a prompt the person wrote around them is theirs.
|
|
273
|
+
const CLI_ELEMENT = /<(command-name|command-message|command-args|local-command-stdout|local-command-stderr)>[\s\S]*?<\/\1>/g;
|
|
274
|
+
const CLI_PREAMBLE = /^Caveat: The messages below were generated by the user while running local commands\b/;
|
|
275
|
+
/** The person's own words in a user message's text, as they wrote them (spaces and lines kept, so a cut still matches
|
|
276
|
+
* a secret in them): none when the CLI wrote all of it (a slash command, its output, its preamble), or when there are
|
|
277
|
+
* no words at all. */
|
|
278
|
+
export function personsWords(text) {
|
|
279
|
+
const words = text.replace(CLI_ELEMENT, " ").trim();
|
|
280
|
+
const line = words.replace(/\s+/g, " ");
|
|
281
|
+
return line && !CLI_PREAMBLE.test(line) && !INTERRUPTED.test(line) ? words : undefined;
|
|
282
|
+
}
|
|
245
283
|
/** Claude Code's record; false for one read already (the import's earlier file, or this file's own repeat). */
|
|
246
|
-
function claudeRecord(value, at, session, { add, names, current }) {
|
|
284
|
+
function claudeRecord(value, at, session, { add, names, current, titles }) {
|
|
247
285
|
if (!session.id && str(value.sessionId))
|
|
248
286
|
session.id = value.sessionId;
|
|
249
287
|
if (!session.cwd && str(value.cwd))
|
|
250
288
|
session.cwd = value.cwd;
|
|
251
289
|
if (value.isSidechain === true)
|
|
252
290
|
session.child = true;
|
|
291
|
+
if (CLAUDE_TITLES.has(value.type))
|
|
292
|
+
return titleRecord(value, session, titles);
|
|
293
|
+
if (str(value.uuid))
|
|
294
|
+
titles.uuids.add(value.uuid);
|
|
253
295
|
if (value.type === "cost-state") {
|
|
254
296
|
// The last one is the session's: unknown when the CLI could not price a model it used.
|
|
255
297
|
session.costUsd = typeof value.totalCostUSD === "number" && Number.isFinite(value.totalCostUSD) && value.totalCostUSD >= 0 && value.hasUnknownModelCost !== true ? value.totalCostUSD : undefined;
|
package/dist/import.d.ts
CHANGED
|
@@ -131,11 +131,11 @@ export declare function transcriptOf(session: Session, cut: (value: unknown) =>
|
|
|
131
131
|
};
|
|
132
132
|
/** The secrets this server made and keeps, by value: its API token and its sign-in sessions' secret (still files beside the
|
|
133
133
|
* store), and its webhook's signing secret (`whsec_...`; webhooks.ts) and every value a trigger source keeps sealed, as
|
|
134
|
-
* store rows (server-secrets-store.ts), opened with the seal key of `env`, which the caller has (a dry run over a store
|
|
135
|
-
* keeps no secret has none, and does not ask); each signing secret's key in every spelling too. One pasted into a
|
|
134
|
+
* store rows (server-secrets-store.ts), opened with the seal key of `env`, which the caller has (a dry run over a store
|
|
135
|
+
* that keeps no secret has none, and does not ask); each signing secret's key in every spelling too. One pasted into a
|
|
136
136
|
* session is this server's own, so an import cuts it wherever it is, as it cuts the environment's keys. Not among them: a key-shaped value this server did not make (a
|
|
137
137
|
* `whsec_` from elsewhere). The per-run door token is gone (the runner cutover deleted it). A sealed value that does not
|
|
138
|
-
* open is said to `say
|
|
138
|
+
* open is said to `say` (the webhook's secret once, naming the data directory): the import goes on, and does not cut it. */
|
|
139
139
|
export declare function ownSecrets(store: {
|
|
140
140
|
triggerSettings: Pick<Store["triggerSettings"], "get" | "put" | "removeScope">;
|
|
141
141
|
flush(): Promise<void>;
|
package/dist/import.js
CHANGED
|
@@ -386,9 +386,12 @@ function merged(parts) {
|
|
|
386
386
|
// Known only when each file's is: a file whose spending is unknown (an unpriced model, no cost written) leaves the
|
|
387
387
|
// session's unknown, never a part of it stored as the whole.
|
|
388
388
|
const costUsd = priced.length < parts.length ? undefined : first.source === "claude-code" ? Math.max(...priced) : priced.reduce((n, cost) => n + cost, 0);
|
|
389
|
-
const { model: _model, startedAt: _start, endedAt: _end, costUsd: _cost, firstPrompt: _prompt, effort: _effort, ...rest } = first;
|
|
389
|
+
const { model: _model, startedAt: _start, endedAt: _end, costUsd: _cost, firstPrompt: _prompt, sourceTitle: _sourceTitle, titleText: _title, effort: _effort, ...rest } = first;
|
|
390
390
|
const model = last.model ?? first.model;
|
|
391
391
|
const firstPrompt = ordered.find((part) => part.firstPrompt !== undefined)?.firstPrompt;
|
|
392
|
+
// The session's title as its latest file wrote it, and the person's first words as its first file has them.
|
|
393
|
+
const sourceTitle = ordered.findLast((part) => part.sourceTitle !== undefined)?.sourceTitle;
|
|
394
|
+
const titleText = ordered.find((part) => part.titleText !== undefined)?.titleText;
|
|
392
395
|
return {
|
|
393
396
|
...rest,
|
|
394
397
|
...(model ? { model } : {}),
|
|
@@ -397,6 +400,8 @@ function merged(parts) {
|
|
|
397
400
|
state: last.state,
|
|
398
401
|
...(costUsd !== undefined ? { costUsd } : {}),
|
|
399
402
|
...(firstPrompt !== undefined ? { firstPrompt } : {}),
|
|
403
|
+
...(sourceTitle !== undefined ? { sourceTitle } : {}),
|
|
404
|
+
...(titleText !== undefined ? { titleText } : {}),
|
|
400
405
|
turns,
|
|
401
406
|
users: sum("users"),
|
|
402
407
|
activeMs: sum("activeMs"),
|
|
@@ -783,13 +788,30 @@ async function revisionFor(store, agentId, source, files, model, cut) {
|
|
|
783
788
|
const id = randomUUID();
|
|
784
789
|
return { id, create: { id, kind: "agentic", body, skills, note } };
|
|
785
790
|
}
|
|
791
|
+
/** An imported run's title, whole: the source's own (Claude Code's), else the person's first words, else where the
|
|
792
|
+
* session ran ("Session in billing-api"), never a CLI's command markup. A folder a key touches (as `keptName` judges it,
|
|
793
|
+
* a key across the folder and its parent among them) is not named at all: the cut of the title matches only a whole key,
|
|
794
|
+
* so the piece of one the folder holds would be left in it. */
|
|
795
|
+
function runTitleOf(session, cut) {
|
|
796
|
+
const generic = `${session.source} session`;
|
|
797
|
+
if (session.sourceTitle !== undefined)
|
|
798
|
+
return session.sourceTitle;
|
|
799
|
+
if (session.titleText !== undefined)
|
|
800
|
+
return session.titleText;
|
|
801
|
+
const cwd = session.cwd ?? "";
|
|
802
|
+
const parts = cwd.split("/");
|
|
803
|
+
const last = parts.findLastIndex((segment) => segment !== "");
|
|
804
|
+
if (last < 0)
|
|
805
|
+
return generic;
|
|
806
|
+
return touchedSegments(cwd, cut).includes(last) ? generic : `Session in ${parts[last]}`;
|
|
807
|
+
}
|
|
786
808
|
/** The secrets this server made and keeps, by value: its API token and its sign-in sessions' secret (still files beside the
|
|
787
809
|
* store), and its webhook's signing secret (`whsec_...`; webhooks.ts) and every value a trigger source keeps sealed, as
|
|
788
|
-
* store rows (server-secrets-store.ts), opened with the seal key of `env`, which the caller has (a dry run over a store
|
|
789
|
-
* keeps no secret has none, and does not ask); each signing secret's key in every spelling too. One pasted into a
|
|
810
|
+
* store rows (server-secrets-store.ts), opened with the seal key of `env`, which the caller has (a dry run over a store
|
|
811
|
+
* that keeps no secret has none, and does not ask); each signing secret's key in every spelling too. One pasted into a
|
|
790
812
|
* session is this server's own, so an import cuts it wherever it is, as it cuts the environment's keys. Not among them: a key-shaped value this server did not make (a
|
|
791
813
|
* `whsec_` from elsewhere). The per-run door token is gone (the runner cutover deleted it). A sealed value that does not
|
|
792
|
-
* open is said to `say
|
|
814
|
+
* open is said to `say` (the webhook's secret once, naming the data directory): the import goes on, and does not cut it. */
|
|
793
815
|
export async function ownSecrets(store, data, env, say = () => { }) {
|
|
794
816
|
if (!sealKeyOf(env[SEAL_KEY_ENV]))
|
|
795
817
|
throw new Error(`the server's own secrets open only under its seal key (${SEAL_KEY_ENV}), and none was handed`);
|
|
@@ -867,6 +889,9 @@ export async function runImport(store, plan, options) {
|
|
|
867
889
|
// Every file of it read: one holding only copies adds no records, but its subagents' folder is read with the rest.
|
|
868
890
|
const searched = [];
|
|
869
891
|
let read;
|
|
892
|
+
// The session's own title as the file written last holds it: a moved copy's /rename too, though its turns are
|
|
893
|
+
// copies the import leaves out.
|
|
894
|
+
let titled;
|
|
870
895
|
let changed = false;
|
|
871
896
|
for (const { file } of files) {
|
|
872
897
|
const stats = await stat(file).catch(() => null);
|
|
@@ -874,6 +899,8 @@ export async function runImport(store, plan, options) {
|
|
|
874
899
|
if (!part || !stats)
|
|
875
900
|
continue;
|
|
876
901
|
searched.push(part);
|
|
902
|
+
if (part.sourceTitle !== undefined && (!titled || stats.mtimeMs >= titled.at))
|
|
903
|
+
titled = { at: stats.mtimeMs, title: part.sourceTitle };
|
|
877
904
|
// A file of it holding only copies adds nothing to it.
|
|
878
905
|
if (ownless(part)) {
|
|
879
906
|
report.skipped.push({ what: file, why: "holds only records of sessions imported already", kind: "copies" });
|
|
@@ -887,6 +914,8 @@ export async function runImport(store, plan, options) {
|
|
|
887
914
|
if (!read)
|
|
888
915
|
continue;
|
|
889
916
|
const session = merged(parts);
|
|
917
|
+
if (titled)
|
|
918
|
+
session.sourceTitle = titled.title;
|
|
890
919
|
// A file of it changed since the scan above (a session still being written): what it holds now, read through
|
|
891
920
|
// secretlint again before any of it is cut.
|
|
892
921
|
if (changed)
|
|
@@ -908,7 +937,9 @@ export async function runImport(store, plan, options) {
|
|
|
908
937
|
if (estimate !== undefined)
|
|
909
938
|
Object.assign(metrics, { costUsdEst: estimate, costBasis: "catalog" });
|
|
910
939
|
const answer = session.turns.findLast((t) => t.role === "assistant" && t.text)?.text;
|
|
911
|
-
|
|
940
|
+
// Cut, then put on one line and clipped: a key the clip cut short, or a passphrase whose spaces were changed, would
|
|
941
|
+
// match no cut.
|
|
942
|
+
const title = clip(text(runTitleOf(session, text)).replace(/\s+/g, " ").trim(), 120);
|
|
912
943
|
await store.importRun({
|
|
913
944
|
id: randomUUID(),
|
|
914
945
|
agentId: project.agentId,
|
|
@@ -918,7 +949,7 @@ export async function runImport(store, plan, options) {
|
|
|
918
949
|
// An imported session is ended as it ended: a plain completion reads as 'ended', a stop or a failure as its own.
|
|
919
950
|
state: session.state === "completed" ? "ended" : session.state,
|
|
920
951
|
...(session.costUsd !== undefined ? { costUsd: session.costUsd } : {}),
|
|
921
|
-
...((answer ?? session.
|
|
952
|
+
...((answer ?? session.titleText) ? { summary: text(answer ?? session.titleText) } : {}),
|
|
922
953
|
metrics,
|
|
923
954
|
startedAt: Date.parse(session.startedAt ?? epoch0),
|
|
924
955
|
endedAt: Date.parse(session.endedAt ?? session.startedAt ?? epoch0),
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,4 @@ export { serveWithRunner } from "./runner/beside.js";
|
|
|
3
3
|
export { SERVER_LOCK, type ServerLock, ServerLockHeldError, takeServerLock } from "./server-lock.js";
|
|
4
4
|
export { ApiError, ERROR_STATUS, type ErrorCode } from "./errors.js";
|
|
5
5
|
export { defaultMaxRuns, type Health } from "./host.js";
|
|
6
|
-
export {
|
|
7
|
-
export { ASK_TOOL, BOUND_TOOLS, TOOLS, type ToolEntry } from "./tools.js";
|
|
8
|
-
export type { FauxHelpers } from "./model.js";
|
|
6
|
+
export { BOUND_TOOLS, TOOLS } from "./tools.js";
|
package/dist/index.js
CHANGED
|
@@ -3,5 +3,4 @@ export { serveWithRunner } from "./runner/beside.js";
|
|
|
3
3
|
export { SERVER_LOCK, ServerLockHeldError, takeServerLock } from "./server-lock.js";
|
|
4
4
|
export { ApiError, ERROR_STATUS } from "./errors.js";
|
|
5
5
|
export { defaultMaxRuns } from "./host.js";
|
|
6
|
-
export {
|
|
7
|
-
export { ASK_TOOL, BOUND_TOOLS, TOOLS } from "./tools.js";
|
|
6
|
+
export { BOUND_TOOLS, TOOLS } from "./tools.js";
|
package/dist/key-refusal.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export declare function redactedAnswer(text: string, secrets: readonly string[])
|
|
|
34
34
|
* included (a dictionary field can be keyed by anything a run wrote), its shape kept. Two names of one object that come
|
|
35
35
|
* out the same would merge one value over the other: that object is withheld whole, as "[redacted]". */
|
|
36
36
|
export declare function redactedOutput(value: unknown, secrets: readonly string[]): unknown;
|
|
37
|
-
/** What a thinking or text block may show while it streams
|
|
37
|
+
/** What a thinking or text block may show while it streams: what has streamed so far,
|
|
38
38
|
* redacted by the same rule as redacted(), less a fixed tail held back until the block ends, when its settled row
|
|
39
39
|
* replaces this one whole. A key whose head has streamed but not its tail cannot be found by any redactor, and a key
|
|
40
40
|
* ending inside the tail would show its head. So the tail is the most a held value takes in its widest form (6 times it,
|
package/dist/key-refusal.js
CHANGED
|
@@ -44,7 +44,7 @@ function detailOf(rest) {
|
|
|
44
44
|
return (text.split(/(?<=[.!?])\s/)[0] ?? "").slice(0, 200).replace(/[.\s]+$/, "");
|
|
45
45
|
}
|
|
46
46
|
/** The most of a run's error or a tool's output serve ever shows: a Timeline row's text, cut at 2000 characters
|
|
47
|
-
* (
|
|
47
|
+
* (`CAPS.text` in timeline/; a summary and a tool result's preview at 500), which the error box reads too. */
|
|
48
48
|
const SHOWN = 2000;
|
|
49
49
|
/** `text`, a run's error as serve shows it, with no held secret in it: the one rule learning's checker uses
|
|
50
50
|
* (learn/secrets.ts redactSecrets: each value as written, JSON-escaped, base64 at each offset, hex and percent-encoded,
|
|
@@ -128,7 +128,7 @@ export function redactedOutput(value, secrets) {
|
|
|
128
128
|
}
|
|
129
129
|
return value;
|
|
130
130
|
}
|
|
131
|
-
/** What a thinking or text block may show while it streams
|
|
131
|
+
/** What a thinking or text block may show while it streams: what has streamed so far,
|
|
132
132
|
* redacted by the same rule as redacted(), less a fixed tail held back until the block ends, when its settled row
|
|
133
133
|
* replaces this one whole. A key whose head has streamed but not its tail cannot be found by any redactor, and a key
|
|
134
134
|
* ending inside the tail would show its head. So the tail is the most a held value takes in its widest form (6 times it,
|
package/dist/learn/check.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type LearnedNote } from "./notes.js";
|
|
2
|
-
import { type DraftAsk, type DraftDryRun, type DraftReader } from "./skills.js";
|
|
2
|
+
import { type DraftAsk, type DraftDecisions, type DraftDryRun, type DraftReader } from "./skills.js";
|
|
3
3
|
/** Byte caps (UTF-8) and counts. Over a cap is refused, never cut. */
|
|
4
4
|
export declare const CAPS: Readonly<{
|
|
5
5
|
/** One note's file. */
|
|
@@ -24,7 +24,7 @@ export declare const CAPS: Readonly<{
|
|
|
24
24
|
workflows: 1;
|
|
25
25
|
}>;
|
|
26
26
|
/** The rule a problem breaks. SPEC.md lists each. */
|
|
27
|
-
export type Rule = "too_many_files" | "outside" | "file_name" | "file_mode" | "encoding" | "edited" | "deleted" | "exists" | "too_large" | "too_many_notes" | "invisible_unicode" | "secret_shape" | "secret_value" | "note" | "status" | "supersedes" | "index_full" | "skill" | "skill_outcome" | "too_many_skills" | "workflow" | "too_many_workflows" | "no_tool_list" | "executable_node" | "skill_front_matter" | "skill_status";
|
|
27
|
+
export type Rule = "too_many_files" | "outside" | "file_name" | "file_mode" | "encoding" | "edited" | "deleted" | "exists" | "too_large" | "too_many_notes" | "invisible_unicode" | "secret_shape" | "secret_value" | "note" | "status" | "supersedes" | "index_full" | "skill" | "skill_outcome" | "too_many_skills" | "workflow" | "too_many_workflows" | "no_tool_list" | "executable_node" | "skill_front_matter" | "skill_status" | "duplicate";
|
|
28
28
|
/** One problem with what a run proposed, printable as it is. */
|
|
29
29
|
export type Problem = {
|
|
30
30
|
readonly rule: Rule;
|
|
@@ -43,9 +43,12 @@ export type Change = {
|
|
|
43
43
|
};
|
|
44
44
|
/** The folder a proposal is checked against (the run's seed, or main at merge time): every path it holds, and its active
|
|
45
45
|
* notes. */
|
|
46
|
+
/** What a proposal is checked against: every path at the seed's top, its active notes, and `rules`, when the caller read
|
|
47
|
+
* the active notes' texts, each one's rule (notes.ts ruleOf) to its file: a new note of the same rule is a duplicate. */
|
|
46
48
|
export type Base = {
|
|
47
49
|
readonly files: Iterable<string>;
|
|
48
50
|
readonly active: readonly LearnedNote[];
|
|
51
|
+
readonly rules?: ReadonlyMap<string, string>;
|
|
49
52
|
};
|
|
50
53
|
/** A new note that passed, with its whole text. */
|
|
51
54
|
export type ProposedNote = LearnedNote & {
|
|
@@ -69,8 +72,14 @@ export type CheckInput = {
|
|
|
69
72
|
readonly ask?: DraftAsk;
|
|
70
73
|
/** Where each of `gated`'s denies was set (this agent's settings or this server's), for the refusal's words. */
|
|
71
74
|
readonly deniedBy?: Readonly<Record<string, "agent" | "server" | "default">>;
|
|
75
|
+
/** False for a run of a revision that says `learning: "notes"`: a workflow draft it gives is left out (rule `workflow`,
|
|
76
|
+
* NOTES_ONLY), and its notes and skill go on. */
|
|
77
|
+
readonly workflows?: false;
|
|
72
78
|
/** The workflow DSL a draft is read with; a proposal that holds a draft is checked with it, never without. */
|
|
73
79
|
readonly dsl?: DraftReader;
|
|
80
|
+
/** The decision providers a draft's decision nodes may ask, and the gate's setting of each (learn/skills.ts
|
|
81
|
+
* DraftDecisions, LS-07). Without them, a draft with a decision node is refused. */
|
|
82
|
+
readonly decisions?: DraftDecisions;
|
|
74
83
|
/** Each draft's dry run (skills.ts draftDryRun), by its workflow.json's path: one that failed is refused, rule
|
|
75
84
|
* `workflow`, when the draft has no other problem. A draft with none given is checked without one. */
|
|
76
85
|
readonly dryRuns?: Readonly<Record<string, DraftDryRun>>;
|
package/dist/learn/check.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// here with its bytes; nothing the checker refuses is ever written to git. Every problem it reports is printable: its
|
|
5
5
|
// path and detail are cut of the host's secrets and of text shaped like one, and a field over PRINT_MAX is redacted whole.
|
|
6
6
|
import { hiddenCharacter } from "./invisible.js";
|
|
7
|
-
import { INDEX_FILE, INDEX_LINES, NOTE_FILE, parseNoteFile } from "./notes.js";
|
|
7
|
+
import { INDEX_FILE, INDEX_LINES, NOTE_FILE, parseNoteFile, ruleOf } from "./notes.js";
|
|
8
8
|
import { learnedSecretShapes, redactLearned, valueMatcher } from "./secrets.js";
|
|
9
9
|
import { draftProblems, decodedStrings, DECODED_DEPTH, DRY_RUN_FAILED, frontKeys, frontValues, LEARNED_KEYS, learnedName, learnedPlace, setsStatus, skillProblems, WORKFLOWS_DIR } from "./skills.js";
|
|
10
10
|
/** The most the host adds to a run's note as it merges it: `origin: you` and `status: pending`, a front matter line
|
|
@@ -34,6 +34,8 @@ export const CAPS = Object.freeze({
|
|
|
34
34
|
workflows: 1,
|
|
35
35
|
});
|
|
36
36
|
const MODES = { "120000": "a link: never followed", "040000": "a folder: nothing in it was read" };
|
|
37
|
+
/** Why a draft from a run of a revision that learns notes alone (`learning: "notes"`) is left out. */
|
|
38
|
+
const NOTES_ONLY = "this agent learns notes and skills alone (learning: \"notes\"): it keeps no workflow draft";
|
|
37
39
|
/** Why a run's path is none of what it may propose. */
|
|
38
40
|
const OUTSIDE = "a run proposes notes at the folder's top, skills/<name>/SKILL.md, and workflows/<name>/ with its workflow.json and README.md";
|
|
39
41
|
/** `problem` as it may be printed: its path and detail cut of `values` and of every shape learning refuses, a bank's
|
|
@@ -137,6 +139,8 @@ function learnedChecked(change, place, refused, input, add) {
|
|
|
137
139
|
return add("file_name", place.kind === "skill" ? "a skill's name is lowercase letters, digits and single dashes, at most 64" : "a workflow's name is lowercase letters, digits, dashes and underscores, at most 64, starting with a letter or digit", path);
|
|
138
140
|
if (change.status === "deleted")
|
|
139
141
|
return add("deleted", "a run never deletes a skill or a workflow", path);
|
|
142
|
+
if (place.kind === "workflow" && input.workflows === false)
|
|
143
|
+
return add("workflow", NOTES_ONLY, path);
|
|
140
144
|
if (change.mode !== undefined && change.mode !== "100644")
|
|
141
145
|
return add("file_mode", MODES[change.mode] ?? "not a regular file: never read", path);
|
|
142
146
|
const size = change.size ?? change.bytes?.length ?? 0;
|
|
@@ -153,7 +157,7 @@ function learnedChecked(change, place, refused, input, add) {
|
|
|
153
157
|
if (place.kind === "workflow") {
|
|
154
158
|
if (!input.dsl)
|
|
155
159
|
throw new TypeError(`${path}: a workflow draft is read with the workflow DSL, which was not given`);
|
|
156
|
-
const problems = draftProblems(input.dsl, text, input.tools, input.gated, input.deniedBy, input.ask);
|
|
160
|
+
const problems = draftProblems(input.dsl, text, input.tools, input.gated, input.deniedBy, input.ask, input.decisions);
|
|
157
161
|
for (const { rule, detail } of problems)
|
|
158
162
|
add(rule, detail, path);
|
|
159
163
|
// A draft the checks pass whose dry run failed: its wiring breaks at run time, before any node is paid for.
|
|
@@ -224,7 +228,9 @@ export function checkProposal(input) {
|
|
|
224
228
|
}
|
|
225
229
|
const changes = given.slice(0, CAPS.changes);
|
|
226
230
|
const base = new Set(input.base.files);
|
|
227
|
-
|
|
231
|
+
// The new notes that pass their own checks, in the answer's order. Which of them is a duplicate is settled after,
|
|
232
|
+
// with the merge's checks (settled below).
|
|
233
|
+
const candidates = [];
|
|
228
234
|
const skills = [];
|
|
229
235
|
const workflows = new Set();
|
|
230
236
|
const added = [];
|
|
@@ -258,7 +264,7 @@ export function checkProposal(input) {
|
|
|
258
264
|
return;
|
|
259
265
|
if (["status", "superseded_by", "retired_from", "origin"].some((key) => note.keys.includes(key)))
|
|
260
266
|
return add("status", "a run never sets status, superseded_by, retired_from or origin: the host does, when it merges the note, a later one supersedes it or a person retires it", path);
|
|
261
|
-
|
|
267
|
+
candidates.push(note);
|
|
262
268
|
};
|
|
263
269
|
for (const change of changes)
|
|
264
270
|
one(change);
|
|
@@ -280,9 +286,121 @@ export function checkProposal(input) {
|
|
|
280
286
|
if (after.has(json) !== after.has(readme))
|
|
281
287
|
add("workflow", `the folder holds ${after.has(json) ? "workflow.json" : "README.md"} without the other file`, after.has(json) ? readme : json);
|
|
282
288
|
}
|
|
283
|
-
|
|
284
|
-
problems.push(...mergeProblems(input.base, notes, values));
|
|
289
|
+
const notes = problems.length ? [] : settled(candidates);
|
|
285
290
|
return { ok: problems.length === 0, problems, notes: problems.length ? [] : notes };
|
|
291
|
+
/** `candidates` once nothing else is wrong, settled in one order, so no note is ever lost to another's failure:
|
|
292
|
+
* 1. Each note alone against the base (ownProblems): what it supersedes, active there, and how many. One that fails
|
|
293
|
+
* is left out with its own reason.
|
|
294
|
+
* 2. The survivors by rule: the first of a rule holds it, the rest are its alternates. A rule the seed's active
|
|
295
|
+
* notes hold is held already (an alternate that supersedes its holder is an update, and holds it).
|
|
296
|
+
* 3. The holders' shared checks (sharedProblems): two notes superseding one note, the supersedes cap over the run,
|
|
297
|
+
* the index's lines, each counted in order, after the duplicates are out. A holder they refuse is left out with
|
|
298
|
+
* that reason, and its next alternate holds the rule in its place; then 3 again, until nothing changes (each
|
|
299
|
+
* round leaves one note out or more: bounded by the count).
|
|
300
|
+
* 4. Only then the alternates no rule needed are left out, each as the duplicate of its rule's holder.
|
|
301
|
+
* The notes that pass, in the answer's order. */
|
|
302
|
+
function settled(all) {
|
|
303
|
+
const survivors = all.filter((note) => {
|
|
304
|
+
const own = ownProblems(input.base, note);
|
|
305
|
+
for (const problem of own)
|
|
306
|
+
add(problem.rule, problem.detail, problem.path);
|
|
307
|
+
return own.length === 0;
|
|
308
|
+
});
|
|
309
|
+
const out = new Set();
|
|
310
|
+
for (;;) {
|
|
311
|
+
const { holders } = byRule(survivors.filter((note) => !out.has(note.file)));
|
|
312
|
+
const shared = sharedProblems(input.base, holders);
|
|
313
|
+
if (!shared.length) {
|
|
314
|
+
const { holders: kept, alternates } = byRule(survivors.filter((note) => !out.has(note.file)));
|
|
315
|
+
for (const [note, holder] of alternates)
|
|
316
|
+
add("duplicate", `it says what ${holder} says`, note.file);
|
|
317
|
+
return kept;
|
|
318
|
+
}
|
|
319
|
+
for (const problem of shared) {
|
|
320
|
+
add(problem.rule, problem.detail, problem.path);
|
|
321
|
+
out.add(problem.path);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
/** `notes` by rule, in order: the first of a rule holds it, the rest are its alternates (each with its holder). A
|
|
326
|
+
* rule the seed's active notes hold is held by that note, unless the new note supersedes it (an update), or any of
|
|
327
|
+
* `notes` does: a note this proposal supersedes keeps no rule after it, so a copy of its rule under another name is
|
|
328
|
+
* no duplicate, and the rule is never left with no active note. */
|
|
329
|
+
function byRule(notes) {
|
|
330
|
+
const going = new Set(notes.flatMap((note) => note.supersedes));
|
|
331
|
+
const rules = new Map([...(input.base.rules ?? [])].filter(([, holder]) => !going.has(holder)));
|
|
332
|
+
const holders = [];
|
|
333
|
+
const alternates = [];
|
|
334
|
+
for (const note of notes) {
|
|
335
|
+
const rule = ruleOf(note.body);
|
|
336
|
+
const holder = rules.get(rule);
|
|
337
|
+
if (holder !== undefined && !note.supersedes.includes(holder)) {
|
|
338
|
+
// An update of the holder the seed has, after a copy of its rule: the update holds the rule, the copy is its
|
|
339
|
+
// alternate (else the update is dropped as the copy's duplicate, and the copy as the seed's, on the next pass).
|
|
340
|
+
const original = input.base.rules?.get(rule);
|
|
341
|
+
const at = holders.findIndex((one) => one.file === holder);
|
|
342
|
+
if (original !== undefined && holder !== original && at >= 0 && note.supersedes.includes(original)) {
|
|
343
|
+
// At its own place in the answer (the end of the holders so far), not the copy's: the shared checks name notes
|
|
344
|
+
// in answer order, so an update must not jump ahead of a note between the two.
|
|
345
|
+
alternates.push([holders.splice(at, 1)[0], note.file]);
|
|
346
|
+
holders.push(note);
|
|
347
|
+
rules.set(rule, note.file);
|
|
348
|
+
continue;
|
|
349
|
+
}
|
|
350
|
+
alternates.push([note, holder]);
|
|
351
|
+
continue;
|
|
352
|
+
}
|
|
353
|
+
rules.set(rule, note.file);
|
|
354
|
+
holders.push(note);
|
|
355
|
+
}
|
|
356
|
+
return { holders, alternates };
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
/** What `note` alone cannot join `base` with, needing no other note: a `supersedes` that names no active note of `base`,
|
|
360
|
+
* or more of them than CAPS.supersedes. */
|
|
361
|
+
function ownProblems(base, note) {
|
|
362
|
+
const active = new Set(base.active.map((one) => one.file));
|
|
363
|
+
const out = note.supersedes.filter((old) => !active.has(old)).map((old) => ({ rule: "supersedes", path: note.file, detail: `it supersedes ${old}, which is not an active note` }));
|
|
364
|
+
if (note.supersedes.length > CAPS.supersedes)
|
|
365
|
+
out.push({ rule: "supersedes", path: note.file, detail: `it supersedes ${note.supersedes.length} notes; the cap is ${CAPS.supersedes} a run` });
|
|
366
|
+
return out;
|
|
367
|
+
}
|
|
368
|
+
/** What stops the holders `notes` (one a rule, each passing ownProblems) from joining `base` together, each named by the
|
|
369
|
+
* note it falls on. In the answer's order: a note that supersedes one an earlier note supersedes, or that takes the
|
|
370
|
+
* notes superseded past CAPS.supersedes (a note named counts toward neither, so a later one that fits is kept). Then
|
|
371
|
+
* the index over the rest, whole (each active new note a line, each note it supersedes one fewer), so a note that frees
|
|
372
|
+
* lines counts wherever it stands: past INDEX_LINES, the notes that add lines are named from the answer's end until
|
|
373
|
+
* it fits. */
|
|
374
|
+
function sharedProblems(base, notes) {
|
|
375
|
+
const out = [];
|
|
376
|
+
const replaced = new Set();
|
|
377
|
+
const fits = [];
|
|
378
|
+
for (const note of notes) {
|
|
379
|
+
const twice = note.supersedes.find((old) => replaced.has(old));
|
|
380
|
+
if (twice) {
|
|
381
|
+
out.push({ rule: "supersedes", path: note.file, detail: `${twice} is superseded by another new note too` });
|
|
382
|
+
continue;
|
|
383
|
+
}
|
|
384
|
+
const would = new Set([...replaced, ...note.supersedes]);
|
|
385
|
+
if (would.size > CAPS.supersedes) {
|
|
386
|
+
out.push({ rule: "supersedes", path: note.file, detail: `with it the new notes supersede ${would.size} notes; the cap is ${CAPS.supersedes} a run` });
|
|
387
|
+
continue;
|
|
388
|
+
}
|
|
389
|
+
for (const old of note.supersedes)
|
|
390
|
+
replaced.add(old);
|
|
391
|
+
fits.push(note);
|
|
392
|
+
}
|
|
393
|
+
const net = (note) => (note.status === "active" ? 1 : 0) - note.supersedes.length;
|
|
394
|
+
let lines = base.active.length + fits.reduce((sum, note) => sum + net(note), 0);
|
|
395
|
+
for (const note of [...fits].reverse()) {
|
|
396
|
+
if (lines <= INDEX_LINES)
|
|
397
|
+
break;
|
|
398
|
+
if (net(note) <= 0)
|
|
399
|
+
continue;
|
|
400
|
+
out.push({ rule: "index_full", path: note.file, detail: `with it the index would hold ${lines} lines; it holds at most ${INDEX_LINES}, so supersede a note rather than add one` });
|
|
401
|
+
lines -= net(note);
|
|
402
|
+
}
|
|
403
|
+
return out;
|
|
286
404
|
}
|
|
287
405
|
/** The notes the active ones of `notes` supersede, each by the note that supersedes it. A note that waits for its
|
|
288
406
|
* owner's OK (`status: pending`) supersedes nothing until it is approved: what it names stays active. The one rule the
|
package/dist/learn/commit.d.ts
CHANGED
|
@@ -3,8 +3,10 @@ import type { IndexEntry, NoteText } from "./grade.js";
|
|
|
3
3
|
import type { Workspace } from "../workspace/index.js";
|
|
4
4
|
export type LearningChange = {
|
|
5
5
|
kind: "merge";
|
|
6
|
-
/** The run that learned: the commit's Run-Id trailer and the diff file's name. */
|
|
6
|
+
/** The run that learned: the commit's Run-Id trailer and, with `round`, the diff file's name (runDiffKey). */
|
|
7
7
|
runId: string;
|
|
8
|
+
/** Which of the run's looks back merges (absent: its first): a follow-up's later round merges once of its own. */
|
|
9
|
+
round?: number;
|
|
8
10
|
/** The grader's reason: the commit's message and the log's `reason`. */
|
|
9
11
|
reason: string;
|
|
10
12
|
/** What merges, already checked: notes, a skill's files, a draft's files, each whole. */
|
|
@@ -26,6 +28,19 @@ export type LearningChange = {
|
|
|
26
28
|
* it (a person retired or approved it, another run's merge changed it) is a conflict, never written over. The
|
|
27
29
|
* script checks it on main as it commits. Optional, past COMMIT-API.md v1. */
|
|
28
30
|
seed?: string;
|
|
31
|
+
/** New notes written over the note main holds by the same name: each one the run's note supersedes by its own
|
|
32
|
+
* name (the learning loop's takenOnMain), its blob on main in `graded`, so a change since is a conflict. Any
|
|
33
|
+
* other new note main holds a note by when the merge commits is left out alone (`left`, `taken`). */
|
|
34
|
+
replace?: string[];
|
|
35
|
+
/** Skills re-filed as notes (grade.ts skillAsNote): each skill's SKILL.md main holds is retired in this write, so
|
|
36
|
+
* no old skill stays served beside the note that replaces it; not when `note` was left out as `taken` (another
|
|
37
|
+
* note holds that name, so the skill's rule would be lost). Its file is checked against the run's seed as a
|
|
38
|
+
* skill's file the merge writes is. */
|
|
39
|
+
retire?: {
|
|
40
|
+
skill: string;
|
|
41
|
+
note: string;
|
|
42
|
+
rule: string;
|
|
43
|
+
}[];
|
|
29
44
|
} | {
|
|
30
45
|
kind: "person";
|
|
31
46
|
action: "edited" | "created" | "retired" | "approved" | "restored";
|
|
@@ -43,11 +58,20 @@ export type LearningChange = {
|
|
|
43
58
|
/** Approved-Via: console. */
|
|
44
59
|
via?: "console";
|
|
45
60
|
};
|
|
61
|
+
/** A new note a merge left out, settled against the main it commits on: `same`, a rule main's active notes (or an
|
|
62
|
+
* earlier note of the merge) already hold, or main's note by that name says it (no change); `taken`, main holds a note
|
|
63
|
+
* by that name with another rule, never written over. */
|
|
64
|
+
export type LeftNote = {
|
|
65
|
+
path: string;
|
|
66
|
+
reason: "same" | "taken";
|
|
67
|
+
};
|
|
46
68
|
export type LearningCommitResult = {
|
|
47
69
|
ok: true;
|
|
48
70
|
main: string;
|
|
49
71
|
commit: string;
|
|
50
72
|
files: string[];
|
|
73
|
+
left?: LeftNote[];
|
|
74
|
+
already?: true;
|
|
51
75
|
} | {
|
|
52
76
|
ok: false;
|
|
53
77
|
reason: "conflict";
|
|
@@ -64,23 +88,35 @@ export type LearningCommitResult = {
|
|
|
64
88
|
/**
|
|
65
89
|
* One write on the folder's main, one exec of the learning script: a run's merge or a person's write, as `change` says.
|
|
66
90
|
* `ok` with the new main (its commit) and the paths the commit changed; `conflict` when an oid the caller read is
|
|
67
|
-
* another blob on main now; `refused` when the folder as it would be is refused (
|
|
68
|
-
*
|
|
91
|
+
* another blob on main now; `refused` when the folder as it would be is refused (the index past its lines, a note out
|
|
92
|
+
* of shape); a new note named like one main holds, or of a rule one holds, is left out alone (`left`); `unavailable` when the workspace or the exec failed (retry later). A merge whose
|
|
69
93
|
* run already merged here is `ok` with the commit that holds it, and writes nothing.
|
|
70
94
|
*/
|
|
71
95
|
export declare function learningCommit(ws: Workspace, change: LearningChange, opts?: {
|
|
72
96
|
retries?: number;
|
|
73
97
|
}): Promise<LearningCommitResult>;
|
|
74
|
-
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
|
|
98
|
+
/** The texts main holds at `paths`, each a note's file, by path: one main holds no note at is not in it. From the
|
|
99
|
+
* folder's snapshot and its bodies: no git, no exec. What a skill the grader re-filed as a note (grade.ts skillAsNote)
|
|
100
|
+
* would be written over, read before its merge. */
|
|
101
|
+
export declare function mainTexts(ws: Workspace, paths: readonly string[]): Promise<Record<string, string>>;
|
|
102
|
+
/** Run `runId`'s merge on the folder, when its diff file names one (readRunDiff): the texts its own commit holds at
|
|
103
|
+
* `paths`, each a note's file (one it holds nothing at is not in it), read at that commit, those paths alone (textsAt:
|
|
104
|
+
* one read-only exec, bounded by the paths asked, never the whole folder or its log), never main's now, which a person
|
|
105
|
+
* may have edited since. Undefined when the run merged nothing here. */
|
|
106
|
+
export declare function mergedAt(ws: Workspace, runId: string, paths: readonly string[], round?: number): Promise<{
|
|
107
|
+
texts: Record<string, string>;
|
|
108
|
+
} | undefined>;
|
|
109
|
+
/** Main as the grader reads it (the runner's learning loop `readMain`): every active note's index line, the whole text
|
|
110
|
+
* of each note the proposal supersedes, and the blob each of those was read at (`graded`, which the merge checks); the
|
|
111
|
+
* proposal's notes named like a note main holds now, settled alone (`taken`); or `problems` when the proposal cannot
|
|
112
|
+
* join main as it is (learn/check.ts mergeProblems). From the folder's snapshot and its bodies: no git, no exec. */
|
|
78
113
|
export declare function readMain(ws: Workspace, proposal: {
|
|
79
114
|
readonly notes: readonly NoteText[];
|
|
80
115
|
}): Promise<{
|
|
81
116
|
active: IndexEntry[];
|
|
82
117
|
superseded: NoteText[];
|
|
83
118
|
graded: Record<string, string>;
|
|
119
|
+
taken?: LeftNote[];
|
|
84
120
|
} | {
|
|
85
121
|
problems: Problem[];
|
|
86
122
|
}>;
|