@nordhavnhq/runner 0.0.0-stage → 0.95.0
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/bin/cliclick +0 -0
- package/dist/brand.d.ts +5 -0
- package/dist/brand.js +18 -0
- package/dist/cli/agent.d.ts +9 -0
- package/dist/cli/agent.js +80 -0
- package/dist/cli/folder.d.ts +2 -0
- package/dist/cli/folder.js +103 -0
- package/dist/cli/init.d.ts +2 -0
- package/dist/cli/init.js +67 -0
- package/dist/cli/lifecycle.d.ts +3 -0
- package/dist/cli/lifecycle.js +149 -0
- package/dist/cli/link.d.ts +42 -0
- package/dist/cli/link.js +314 -0
- package/dist/cli/logs.d.ts +2 -0
- package/dist/cli/logs.js +147 -0
- package/dist/cli/prompts.d.ts +7 -0
- package/dist/cli/prompts.js +13 -0
- package/dist/cli/ps.d.ts +2 -0
- package/dist/cli/ps.js +81 -0
- package/dist/cli/relay.d.ts +4 -0
- package/dist/cli/relay.js +29 -0
- package/dist/cli/update.d.ts +6 -0
- package/dist/cli/update.js +131 -0
- package/dist/config.d.ts +166 -0
- package/dist/config.js +383 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +145 -0
- package/dist/legacy-env.d.ts +4 -0
- package/dist/legacy-env.js +32 -0
- package/dist/paths.d.ts +37 -0
- package/dist/paths.js +92 -0
- package/dist/runtime/daemon.d.ts +57 -0
- package/dist/runtime/daemon.js +159 -0
- package/dist/runtime/dev-start.d.ts +31 -0
- package/dist/runtime/dev-start.js +110 -0
- package/dist/runtime/file-claims.d.ts +58 -0
- package/dist/runtime/file-claims.js +174 -0
- package/dist/runtime/fs-browse.d.ts +18 -0
- package/dist/runtime/fs-browse.js +104 -0
- package/dist/runtime/fs-checkout.d.ts +154 -0
- package/dist/runtime/fs-checkout.js +1049 -0
- package/dist/runtime/fs-git-index.d.ts +22 -0
- package/dist/runtime/fs-git-index.js +133 -0
- package/dist/runtime/fs-git.d.ts +16 -0
- package/dist/runtime/fs-git.js +424 -0
- package/dist/runtime/git-relay.d.ts +46 -0
- package/dist/runtime/git-relay.js +259 -0
- package/dist/runtime/git-unpushed.d.ts +36 -0
- package/dist/runtime/git-unpushed.js +93 -0
- package/dist/runtime/node-version.d.ts +12 -0
- package/dist/runtime/node-version.js +39 -0
- package/dist/runtime/preview-tunnel.d.ts +16 -0
- package/dist/runtime/preview-tunnel.js +135 -0
- package/dist/runtime/processes.d.ts +61 -0
- package/dist/runtime/processes.js +408 -0
- package/dist/runtime/project-node-download.d.ts +17 -0
- package/dist/runtime/project-node-download.js +137 -0
- package/dist/runtime/project-node.d.ts +65 -0
- package/dist/runtime/project-node.js +223 -0
- package/dist/runtime/reap-scratch.d.ts +22 -0
- package/dist/runtime/reap-scratch.js +112 -0
- package/dist/runtime/spill-tool-output.d.ts +14 -0
- package/dist/runtime/spill-tool-output.js +84 -0
- package/dist/runtime/up.d.ts +6 -0
- package/dist/runtime/up.js +1325 -0
- package/dist/tools/_coerce.d.ts +2 -0
- package/dist/tools/_coerce.js +26 -0
- package/dist/tools/_commit-scope.d.ts +14 -0
- package/dist/tools/_commit-scope.js +70 -0
- package/dist/tools/_jail.d.ts +68 -0
- package/dist/tools/_jail.js +209 -0
- package/dist/tools/_output.d.ts +24 -0
- package/dist/tools/_output.js +48 -0
- package/dist/tools/_ripgrep.d.ts +46 -0
- package/dist/tools/_ripgrep.js +148 -0
- package/dist/tools/_run-worktree.d.ts +10 -0
- package/dist/tools/_run-worktree.js +27 -0
- package/dist/tools/_shell-words.d.ts +15 -0
- package/dist/tools/_shell-words.js +43 -0
- package/dist/tools/_sonar/astro.d.ts +6 -0
- package/dist/tools/_sonar/astro.js +45 -0
- package/dist/tools/_sonar/blade.d.ts +3 -0
- package/dist/tools/_sonar/blade.js +53 -0
- package/dist/tools/_sonar/build.d.ts +44 -0
- package/dist/tools/_sonar/build.js +147 -0
- package/dist/tools/_sonar/changed.d.ts +21 -0
- package/dist/tools/_sonar/changed.js +230 -0
- package/dist/tools/_sonar/diagnose/delta.d.ts +27 -0
- package/dist/tools/_sonar/diagnose/delta.js +64 -0
- package/dist/tools/_sonar/diagnose/detect.d.ts +39 -0
- package/dist/tools/_sonar/diagnose/detect.js +117 -0
- package/dist/tools/_sonar/diagnose/index.d.ts +13 -0
- package/dist/tools/_sonar/diagnose/index.js +217 -0
- package/dist/tools/_sonar/diagnose/lint-worker.d.ts +1 -0
- package/dist/tools/_sonar/diagnose/lint-worker.js +48 -0
- package/dist/tools/_sonar/diagnose/pool.d.ts +22 -0
- package/dist/tools/_sonar/diagnose/pool.js +149 -0
- package/dist/tools/_sonar/diagnose/rules.d.ts +23 -0
- package/dist/tools/_sonar/diagnose/rules.js +131 -0
- package/dist/tools/_sonar/diagnose/types-worker.d.ts +1 -0
- package/dist/tools/_sonar/diagnose/types-worker.js +183 -0
- package/dist/tools/_sonar/files.d.ts +14 -0
- package/dist/tools/_sonar/files.js +121 -0
- package/dist/tools/_sonar/graph.d.ts +34 -0
- package/dist/tools/_sonar/graph.js +164 -0
- package/dist/tools/_sonar/hints.d.ts +116 -0
- package/dist/tools/_sonar/hints.js +545 -0
- package/dist/tools/_sonar/imports.d.ts +38 -0
- package/dist/tools/_sonar/imports.js +275 -0
- package/dist/tools/_sonar/index.d.ts +79 -0
- package/dist/tools/_sonar/index.js +462 -0
- package/dist/tools/_sonar/keys.d.ts +5 -0
- package/dist/tools/_sonar/keys.js +248 -0
- package/dist/tools/_sonar/laravel-routes.d.ts +15 -0
- package/dist/tools/_sonar/laravel-routes.js +263 -0
- package/dist/tools/_sonar/laravel.d.ts +64 -0
- package/dist/tools/_sonar/laravel.js +326 -0
- package/dist/tools/_sonar/location.d.ts +33 -0
- package/dist/tools/_sonar/location.js +137 -0
- package/dist/tools/_sonar/map.d.ts +43 -0
- package/dist/tools/_sonar/map.js +212 -0
- package/dist/tools/_sonar/parse.d.ts +3 -0
- package/dist/tools/_sonar/parse.js +76 -0
- package/dist/tools/_sonar/prewarm.d.ts +9 -0
- package/dist/tools/_sonar/prewarm.js +96 -0
- package/dist/tools/_sonar/prisma.d.ts +9 -0
- package/dist/tools/_sonar/prisma.js +51 -0
- package/dist/tools/_sonar/refs.d.ts +7 -0
- package/dist/tools/_sonar/refs.js +273 -0
- package/dist/tools/_sonar/render.d.ts +66 -0
- package/dist/tools/_sonar/render.js +498 -0
- package/dist/tools/_sonar/resolve.d.ts +63 -0
- package/dist/tools/_sonar/resolve.js +402 -0
- package/dist/tools/_sonar/roots.d.ts +4 -0
- package/dist/tools/_sonar/roots.js +42 -0
- package/dist/tools/_sonar/routes.d.ts +5 -0
- package/dist/tools/_sonar/routes.js +247 -0
- package/dist/tools/_sonar/serve.d.ts +12 -0
- package/dist/tools/_sonar/serve.js +104 -0
- package/dist/tools/_sonar/suggest.d.ts +23 -0
- package/dist/tools/_sonar/suggest.js +114 -0
- package/dist/tools/_sonar/tests.d.ts +21 -0
- package/dist/tools/_sonar/tests.js +134 -0
- package/dist/tools/_sonar/tsconfig.d.ts +34 -0
- package/dist/tools/_sonar/tsconfig.js +188 -0
- package/dist/tools/_sonar/types.d.ts +81 -0
- package/dist/tools/_sonar/types.js +6 -0
- package/dist/tools/_symbols.d.ts +27 -0
- package/dist/tools/_symbols.js +461 -0
- package/dist/tools/_test-report.d.ts +47 -0
- package/dist/tools/_test-report.js +203 -0
- package/dist/tools/_touched.d.ts +44 -0
- package/dist/tools/_touched.js +195 -0
- package/dist/tools/_upload.d.ts +26 -0
- package/dist/tools/_upload.js +132 -0
- package/dist/tools/_worktree-setup.d.ts +29 -0
- package/dist/tools/_worktree-setup.js +204 -0
- package/dist/tools/browser.d.ts +2 -0
- package/dist/tools/browser.js +8 -0
- package/dist/tools/commit-guard.d.ts +44 -0
- package/dist/tools/commit-guard.js +165 -0
- package/dist/tools/computer.d.ts +13 -0
- package/dist/tools/computer.js +952 -0
- package/dist/tools/console.d.ts +44 -0
- package/dist/tools/console.js +739 -0
- package/dist/tools/database.d.ts +28 -0
- package/dist/tools/database.js +152 -0
- package/dist/tools/filesystem.d.ts +36 -0
- package/dist/tools/filesystem.js +506 -0
- package/dist/tools/git-tag.d.ts +10 -0
- package/dist/tools/git-tag.js +164 -0
- package/dist/tools/git.d.ts +52 -0
- package/dist/tools/git.js +1272 -0
- package/dist/tools/http.d.ts +12 -0
- package/dist/tools/http.js +119 -0
- package/dist/tools/image.d.ts +8 -0
- package/dist/tools/image.js +551 -0
- package/dist/tools/index.d.ts +13 -0
- package/dist/tools/index.js +58 -0
- package/dist/tools/outline.d.ts +20 -0
- package/dist/tools/outline.js +98 -0
- package/dist/tools/search.d.ts +17 -0
- package/dist/tools/search.js +391 -0
- package/dist/tools/sonar.d.ts +17 -0
- package/dist/tools/sonar.js +231 -0
- package/dist/tools/testing.d.ts +36 -0
- package/dist/tools/testing.js +273 -0
- package/dist/tools/upload.d.ts +8 -0
- package/dist/tools/upload.js +106 -0
- package/dist/tools/webcam.d.ts +28 -0
- package/dist/tools/webcam.js +967 -0
- package/dist/update/install-kind.d.ts +35 -0
- package/dist/update/install-kind.js +109 -0
- package/dist/update/install.d.ts +32 -0
- package/dist/update/install.js +187 -0
- package/dist/update/manifest.d.ts +18 -0
- package/dist/update/manifest.js +73 -0
- package/dist/update/peers.d.ts +18 -0
- package/dist/update/peers.js +43 -0
- package/dist/update/policy.d.ts +20 -0
- package/dist/update/policy.js +49 -0
- package/dist/update/supervisor.d.ts +25 -0
- package/dist/update/supervisor.js +83 -0
- package/dist/update/updater.d.ts +44 -0
- package/dist/update/updater.js +116 -0
- package/dist/utils/format.d.ts +50 -0
- package/dist/utils/format.js +190 -0
- package/dist/version.d.ts +17 -0
- package/dist/version.js +63 -0
- package/dist/version.json +5 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/act-tools.d.ts +15 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/act-tools.js +541 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/cast-hub.d.ts +25 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/cast-hub.js +137 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/guard.d.ts +21 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/guard.js +104 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/host-protocol.d.ts +47 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/host-protocol.js +41 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/host.d.ts +18 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/host.js +15 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/index.d.ts +13 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/index.js +28 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/live-input.d.ts +74 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/live-input.js +93 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/live-open.d.ts +4 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/live-open.js +57 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/live.d.ts +148 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/live.js +179 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/local-live.d.ts +31 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/local-live.js +262 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/marks.d.ts +36 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/marks.js +173 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/page-events.d.ts +27 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/page-events.js +82 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/page-tools.d.ts +13 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/page-tools.js +526 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/params.d.ts +12 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/params.js +32 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/pick.d.ts +24 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/pick.js +76 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/session.d.ts +225 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/session.js +507 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/shots.d.ts +11 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/shots.js +103 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/show.d.ts +10 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/show.js +190 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/target.d.ts +37 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/target.js +82 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/tour.d.ts +19 -0
- package/node_modules/@nordhavnhq/runner-browser/dist/tour.js +178 -0
- package/node_modules/@nordhavnhq/runner-browser/package.json +18 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/config.d.ts +96 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/config.js +25 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/connection.d.ts +276 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/connection.js +507 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/constants.d.ts +48 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/constants.js +95 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/contract/batch.d.ts +94 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/contract/batch.js +219 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/contract/calls.d.ts +136 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/contract/calls.js +214 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/contract/fs.d.ts +735 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/contract/fs.js +40 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/contract/loop.d.ts +362 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/contract/loop.js +703 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/contract/own-files.d.ts +105 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/contract/own-files.js +202 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/contract/phases.d.ts +204 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/contract/phases.js +497 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/contract/pins.d.ts +45 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/contract/pins.js +176 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/contract/processes.d.ts +74 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/contract/processes.js +72 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/contract/release-tag.d.ts +59 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/contract/release-tag.js +117 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/contract/replay.d.ts +62 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/contract/replay.js +84 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/contract/tool-names.d.ts +27 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/contract/tool-names.js +80 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/contract/version.d.ts +22 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/contract/version.js +22 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/contract/wire.d.ts +595 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/contract/wire.js +85 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/index.d.ts +43 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/index.js +50 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/inference.d.ts +135 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/inference.js +945 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/mcp.d.ts +67 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/mcp.js +47 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/platform.d.ts +21 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/platform.js +25 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/auto-load.d.ts +39 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/auto-load.js +67 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/background-commands.d.ts +61 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/background-commands.js +58 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/chat-run-ends.d.ts +23 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/chat-run-ends.js +42 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/duration.d.ts +6 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/duration.js +12 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/events.d.ts +150 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/events.js +36 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/extract-json.d.ts +14 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/extract-json.js +49 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/handle-chat.d.ts +109 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/handle-chat.js +894 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/handle-task.d.ts +73 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/handle-task.js +765 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/loop.d.ts +246 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/loop.js +621 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/messages.d.ts +88 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/messages.js +188 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/pending-steers.d.ts +15 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/pending-steers.js +10 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/phased-loop.d.ts +16 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/phased-loop.js +97 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/project-instructions.d.ts +22 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/project-instructions.js +47 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/run-tools.d.ts +26 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/run-tools.js +48 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/scratch-prompt.d.ts +8 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/scratch-prompt.js +19 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/side-question.d.ts +76 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/side-question.js +155 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/task-validation.d.ts +43 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/task-validation.js +37 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/unload-toolset.d.ts +49 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/unload-toolset.js +104 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/write-scope.d.ts +16 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/write-scope.js +6 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/tools/delegate.d.ts +86 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/tools/delegate.js +141 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/tools/index.d.ts +179 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/tools/index.js +35 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/tools/mcp.d.ts +21 -0
- package/node_modules/@nordhavnhq/runner-runtime/dist/tools/mcp.js +179 -0
- package/node_modules/@nordhavnhq/runner-runtime/package.json +18 -0
- package/package.json +33 -4
- package/README.md +0 -3
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A run's own files: the files of the checkout a chat or a task changed
|
|
3
|
+
* itself, so an agent in a shared checkout knows which changes are its own
|
|
4
|
+
* and which are another run's, instead of guessing.
|
|
5
|
+
*
|
|
6
|
+
* Read off its tool steps, the same way everywhere: by the studio when it
|
|
7
|
+
* builds the dispatch frame (`project.ownFiles`), by the runtime while the run
|
|
8
|
+
* goes on (`runner_git_status` -> `yours`), and by the code app. A write or an
|
|
9
|
+
* edit that worked makes a file the run's own, and so does every file a shell
|
|
10
|
+
* command that worked changed (`runner_run_command`: the runner compares git
|
|
11
|
+
* status before and after, and hands the paths on as the step's `touched`); a
|
|
12
|
+
* commit of it (`runner_git_commit`, or the person's commit from the code app)
|
|
13
|
+
* hands it back until the next change. A command in the background, or a dev
|
|
14
|
+
* server, reports nothing: it is still running when its step ends.
|
|
15
|
+
*
|
|
16
|
+
* Part of the agent contract (see `version.ts`), copied verbatim into the
|
|
17
|
+
* runner.
|
|
18
|
+
*/
|
|
19
|
+
/** The tools whose worked step makes its `path` the run's own. */
|
|
20
|
+
export declare const OWN_FILE_WRITE_TOOLS: readonly string[];
|
|
21
|
+
/** The tool whose worked step makes every path in its `touched` the run's own. */
|
|
22
|
+
export declare const OWN_FILE_COMMAND_TOOL = "runner_run_command";
|
|
23
|
+
/** The tool that hands committed files back. */
|
|
24
|
+
export declare const OWN_FILE_COMMIT_TOOL = "runner_git_commit";
|
|
25
|
+
/** Most own files a frame carries: the ones changed last. */
|
|
26
|
+
export declare const OWN_FILES_MAX = 500;
|
|
27
|
+
/** One tool step as a timeline stores it, or as the runtime has it in hand. */
|
|
28
|
+
export interface OwnFileStep {
|
|
29
|
+
tool: string;
|
|
30
|
+
args: unknown;
|
|
31
|
+
/** `error` for a step that failed; anything else is read off `result`. */
|
|
32
|
+
status?: string | null;
|
|
33
|
+
result?: string | null;
|
|
34
|
+
/** The files of the checkout a shell command changed (`OWN_FILE_COMMAND_TOOL`), as the checkout names them. */
|
|
35
|
+
touched?: readonly string[] | null;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A path as the checkout names it (`src/a.ts`): no `./` in front, no `/`
|
|
39
|
+
* behind, forward slashes. Null for the checkout itself and for a path
|
|
40
|
+
* outside it (absolute, `../`, a drive letter): no run owns that.
|
|
41
|
+
*/
|
|
42
|
+
export declare function checkoutPath(value: unknown): string | null;
|
|
43
|
+
/** A repo's folder (`repo` arg) as the checkout names it: `''` for the checkout itself, null when outside it. */
|
|
44
|
+
export declare function checkoutRepo(value: unknown): string | null;
|
|
45
|
+
/** A path relative to a repo of the checkout, as the checkout names it. */
|
|
46
|
+
export declare function inCheckout(repo: string, path: unknown): string | null;
|
|
47
|
+
/** A path of the checkout relative to a repo of it; null when the repo does not hold it. */
|
|
48
|
+
export declare function inRepo(repo: string, path: string): string | null;
|
|
49
|
+
/**
|
|
50
|
+
* Did the step fail? Its status says so, or its result: `Error: ...` (how a
|
|
51
|
+
* runner tool answers a failure) or `{ "success": false }`.
|
|
52
|
+
*/
|
|
53
|
+
export declare function ownFileStepFailed(step: Pick<OwnFileStep, 'status' | 'result'>): boolean;
|
|
54
|
+
/** The file a write or an edit that worked changed, as the checkout names it; null for anything else. */
|
|
55
|
+
export declare function ownFileWritten(step: OwnFileStep): string | null;
|
|
56
|
+
/**
|
|
57
|
+
* Every file a step that worked changed, as the checkout names it: the path of
|
|
58
|
+
* a write or an edit, or what a shell command touched. Empty for anything else.
|
|
59
|
+
*/
|
|
60
|
+
export declare function ownFilesWritten(step: OwnFileStep): string[];
|
|
61
|
+
/** What a commit took: its repo, and the files of the checkout it named, or all of the repo. */
|
|
62
|
+
export interface OwnFilesCommit {
|
|
63
|
+
repo: string;
|
|
64
|
+
paths: string[] | 'all';
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* What a `runner_git_commit` that worked committed: the paths it was given,
|
|
68
|
+
* or the whole repo for `all` and for `mine` (which stages exactly the run's
|
|
69
|
+
* own files). Null for any other step, and for one that failed.
|
|
70
|
+
*/
|
|
71
|
+
export declare function ownFilesCommitted(step: OwnFileStep): OwnFilesCommit | null;
|
|
72
|
+
/** Hand committed files back: they are no longer the run's own until it changes them again. */
|
|
73
|
+
export declare function releaseOwnFiles(files: Set<string>, commit: OwnFilesCommit): void;
|
|
74
|
+
/**
|
|
75
|
+
* Apply one step to a run's own files, in place. The set keeps the order of
|
|
76
|
+
* the last change: a file changed again moves to the end.
|
|
77
|
+
*/
|
|
78
|
+
export declare function applyOwnFileStep(files: Set<string>, step: OwnFileStep): void;
|
|
79
|
+
/** One line of a run's timeline: a tool step, or a commit the person made from the code app. */
|
|
80
|
+
export type OwnFileEvent = ({
|
|
81
|
+
kind: 'step';
|
|
82
|
+
} & OwnFileStep) | {
|
|
83
|
+
kind: 'commit';
|
|
84
|
+
repo: string;
|
|
85
|
+
files: readonly string[];
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* A run's own files from its timeline (oldest first), the last changed last,
|
|
89
|
+
* at most `OWN_FILES_MAX`.
|
|
90
|
+
*/
|
|
91
|
+
export declare function ownFilesOf(events: Iterable<OwnFileEvent>): string[];
|
|
92
|
+
/** A git status split in what is the run's own and what is not. */
|
|
93
|
+
export interface OwnFilesSplit {
|
|
94
|
+
/** Changed paths (relative to the repo) the run changed itself. */
|
|
95
|
+
yours: string[];
|
|
96
|
+
/** Every other changed path: another run's, a person's, or a command's. */
|
|
97
|
+
others: string[];
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Split the changed paths of a repo (as `git status` names them, relative to
|
|
101
|
+
* the repo; an untracked folder ends in `/`) in the run's own and the rest. An
|
|
102
|
+
* untracked folder that holds an own file counts as the run's: its own files
|
|
103
|
+
* are listed in `yours` one by one.
|
|
104
|
+
*/
|
|
105
|
+
export declare function splitOwnFiles(changed: Iterable<string>, own: Iterable<string>, repo: string): OwnFilesSplit;
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A run's own files: the files of the checkout a chat or a task changed
|
|
3
|
+
* itself, so an agent in a shared checkout knows which changes are its own
|
|
4
|
+
* and which are another run's, instead of guessing.
|
|
5
|
+
*
|
|
6
|
+
* Read off its tool steps, the same way everywhere: by the studio when it
|
|
7
|
+
* builds the dispatch frame (`project.ownFiles`), by the runtime while the run
|
|
8
|
+
* goes on (`runner_git_status` -> `yours`), and by the code app. A write or an
|
|
9
|
+
* edit that worked makes a file the run's own, and so does every file a shell
|
|
10
|
+
* command that worked changed (`runner_run_command`: the runner compares git
|
|
11
|
+
* status before and after, and hands the paths on as the step's `touched`); a
|
|
12
|
+
* commit of it (`runner_git_commit`, or the person's commit from the code app)
|
|
13
|
+
* hands it back until the next change. A command in the background, or a dev
|
|
14
|
+
* server, reports nothing: it is still running when its step ends.
|
|
15
|
+
*
|
|
16
|
+
* Part of the agent contract (see `version.ts`), copied verbatim into the
|
|
17
|
+
* runner.
|
|
18
|
+
*/
|
|
19
|
+
/** The tools whose worked step makes its `path` the run's own. */
|
|
20
|
+
export const OWN_FILE_WRITE_TOOLS = ['runner_write_file', 'runner_edit_file'];
|
|
21
|
+
/** The tool whose worked step makes every path in its `touched` the run's own. */
|
|
22
|
+
export const OWN_FILE_COMMAND_TOOL = 'runner_run_command';
|
|
23
|
+
/** The tool that hands committed files back. */
|
|
24
|
+
export const OWN_FILE_COMMIT_TOOL = 'runner_git_commit';
|
|
25
|
+
/** Most own files a frame carries: the ones changed last. */
|
|
26
|
+
export const OWN_FILES_MAX = 500;
|
|
27
|
+
const str = (v) => (typeof v === 'string' ? v : '');
|
|
28
|
+
/**
|
|
29
|
+
* A path as the checkout names it (`src/a.ts`): no `./` in front, no `/`
|
|
30
|
+
* behind, forward slashes. Null for the checkout itself and for a path
|
|
31
|
+
* outside it (absolute, `../`, a drive letter): no run owns that.
|
|
32
|
+
*/
|
|
33
|
+
export function checkoutPath(value) {
|
|
34
|
+
const raw = str(value).trim();
|
|
35
|
+
if (!raw || raw.startsWith('/') || /^[a-z]:[\\/]/i.test(raw))
|
|
36
|
+
return null;
|
|
37
|
+
const path = raw.replace(/\\/g, '/').replace(/^(\.\/)+/, '').replace(/\/+$/, '');
|
|
38
|
+
if (!path || path === '.' || path === '..' || path.startsWith('../'))
|
|
39
|
+
return null;
|
|
40
|
+
return path;
|
|
41
|
+
}
|
|
42
|
+
/** A repo's folder (`repo` arg) as the checkout names it: `''` for the checkout itself, null when outside it. */
|
|
43
|
+
export function checkoutRepo(value) {
|
|
44
|
+
const raw = str(value).trim();
|
|
45
|
+
if (!raw || raw === '.' || raw === './')
|
|
46
|
+
return '';
|
|
47
|
+
return checkoutPath(raw);
|
|
48
|
+
}
|
|
49
|
+
/** A path relative to a repo of the checkout, as the checkout names it. */
|
|
50
|
+
export function inCheckout(repo, path) {
|
|
51
|
+
const own = checkoutPath(path);
|
|
52
|
+
if (own == null)
|
|
53
|
+
return null;
|
|
54
|
+
return repo ? `${repo}/${own}` : own;
|
|
55
|
+
}
|
|
56
|
+
/** A path of the checkout relative to a repo of it; null when the repo does not hold it. */
|
|
57
|
+
export function inRepo(repo, path) {
|
|
58
|
+
if (!repo)
|
|
59
|
+
return path;
|
|
60
|
+
return path.startsWith(`${repo}/`) ? path.slice(repo.length + 1) : null;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Did the step fail? Its status says so, or its result: `Error: ...` (how a
|
|
64
|
+
* runner tool answers a failure) or `{ "success": false }`.
|
|
65
|
+
*/
|
|
66
|
+
export function ownFileStepFailed(step) {
|
|
67
|
+
if (step.status === 'error')
|
|
68
|
+
return true;
|
|
69
|
+
const raw = str(step.result).trimStart();
|
|
70
|
+
if (/^error\b/i.test(raw))
|
|
71
|
+
return true;
|
|
72
|
+
if (raw.startsWith('{')) {
|
|
73
|
+
try {
|
|
74
|
+
return JSON.parse(raw).success === false;
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
// A clipped result is no longer JSON: read the flag off the text.
|
|
78
|
+
return /^\{\s*"success"\s*:\s*false\b/.test(raw);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
/** The file a write or an edit that worked changed, as the checkout names it; null for anything else. */
|
|
84
|
+
export function ownFileWritten(step) {
|
|
85
|
+
if (!OWN_FILE_WRITE_TOOLS.includes(step.tool) || ownFileStepFailed(step))
|
|
86
|
+
return null;
|
|
87
|
+
const args = step.args && typeof step.args === 'object' ? step.args : {};
|
|
88
|
+
return checkoutPath(args.path);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Every file a step that worked changed, as the checkout names it: the path of
|
|
92
|
+
* a write or an edit, or what a shell command touched. Empty for anything else.
|
|
93
|
+
*/
|
|
94
|
+
export function ownFilesWritten(step) {
|
|
95
|
+
const written = ownFileWritten(step);
|
|
96
|
+
if (written)
|
|
97
|
+
return [written];
|
|
98
|
+
if (step.tool !== OWN_FILE_COMMAND_TOOL || !step.touched?.length || ownFileStepFailed(step))
|
|
99
|
+
return [];
|
|
100
|
+
const paths = new Set();
|
|
101
|
+
for (const path of step.touched) {
|
|
102
|
+
const own = checkoutPath(path);
|
|
103
|
+
if (own)
|
|
104
|
+
paths.add(own);
|
|
105
|
+
}
|
|
106
|
+
return [...paths];
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* What a `runner_git_commit` that worked committed: the paths it was given,
|
|
110
|
+
* or the whole repo for `all` and for `mine` (which stages exactly the run's
|
|
111
|
+
* own files). Null for any other step, and for one that failed.
|
|
112
|
+
*/
|
|
113
|
+
export function ownFilesCommitted(step) {
|
|
114
|
+
if (step.tool !== OWN_FILE_COMMIT_TOOL || ownFileStepFailed(step))
|
|
115
|
+
return null;
|
|
116
|
+
const args = step.args && typeof step.args === 'object' ? step.args : {};
|
|
117
|
+
const repo = checkoutRepo(args.repo);
|
|
118
|
+
if (repo == null)
|
|
119
|
+
return null;
|
|
120
|
+
if (args.all === true || args.mine === true)
|
|
121
|
+
return { repo, paths: 'all' };
|
|
122
|
+
const paths = Array.isArray(args.paths)
|
|
123
|
+
? args.paths.map(p => inCheckout(repo, p)).filter((p) => p != null)
|
|
124
|
+
: [];
|
|
125
|
+
return paths.length ? { repo, paths } : null;
|
|
126
|
+
}
|
|
127
|
+
/** Hand committed files back: they are no longer the run's own until it changes them again. */
|
|
128
|
+
export function releaseOwnFiles(files, commit) {
|
|
129
|
+
if (commit.paths === 'all') {
|
|
130
|
+
for (const file of [...files]) {
|
|
131
|
+
if (inRepo(commit.repo, file) != null)
|
|
132
|
+
files.delete(file);
|
|
133
|
+
}
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
for (const path of commit.paths)
|
|
137
|
+
files.delete(path);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Apply one step to a run's own files, in place. The set keeps the order of
|
|
141
|
+
* the last change: a file changed again moves to the end.
|
|
142
|
+
*/
|
|
143
|
+
export function applyOwnFileStep(files, step) {
|
|
144
|
+
const written = ownFilesWritten(step);
|
|
145
|
+
if (written.length) {
|
|
146
|
+
for (const path of written) {
|
|
147
|
+
files.delete(path);
|
|
148
|
+
files.add(path);
|
|
149
|
+
}
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
const commit = ownFilesCommitted(step);
|
|
153
|
+
if (commit)
|
|
154
|
+
releaseOwnFiles(files, commit);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* A run's own files from its timeline (oldest first), the last changed last,
|
|
158
|
+
* at most `OWN_FILES_MAX`.
|
|
159
|
+
*/
|
|
160
|
+
export function ownFilesOf(events) {
|
|
161
|
+
const files = new Set();
|
|
162
|
+
for (const event of events) {
|
|
163
|
+
if (event.kind === 'step')
|
|
164
|
+
applyOwnFileStep(files, event);
|
|
165
|
+
else {
|
|
166
|
+
const repo = checkoutRepo(event.repo) ?? '';
|
|
167
|
+
const paths = event.files.map(f => checkoutPath(f)).filter((p) => p != null);
|
|
168
|
+
releaseOwnFiles(files, { repo, paths });
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return [...files].slice(-OWN_FILES_MAX);
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Split the changed paths of a repo (as `git status` names them, relative to
|
|
175
|
+
* the repo; an untracked folder ends in `/`) in the run's own and the rest. An
|
|
176
|
+
* untracked folder that holds an own file counts as the run's: its own files
|
|
177
|
+
* are listed in `yours` one by one.
|
|
178
|
+
*/
|
|
179
|
+
export function splitOwnFiles(changed, own, repo) {
|
|
180
|
+
const mine = new Set();
|
|
181
|
+
for (const file of own) {
|
|
182
|
+
const path = inRepo(repo, file);
|
|
183
|
+
if (path != null)
|
|
184
|
+
mine.add(path);
|
|
185
|
+
}
|
|
186
|
+
const yours = new Set();
|
|
187
|
+
const others = new Set();
|
|
188
|
+
for (const path of changed) {
|
|
189
|
+
if (path.endsWith('/')) {
|
|
190
|
+
const inside = [...mine].filter(p => p.startsWith(path));
|
|
191
|
+
if (inside.length)
|
|
192
|
+
inside.forEach(p => yours.add(p));
|
|
193
|
+
else
|
|
194
|
+
others.add(path);
|
|
195
|
+
}
|
|
196
|
+
else if (mine.has(path))
|
|
197
|
+
yours.add(path);
|
|
198
|
+
else
|
|
199
|
+
others.add(path);
|
|
200
|
+
}
|
|
201
|
+
return { yours: [...yours], others: [...others] };
|
|
202
|
+
}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plan, then execute: a run of a kind that plans first (a bugfix, a feature)
|
|
3
|
+
* on an agent whose plan or exec model differs from its own model works in
|
|
4
|
+
* phases, each on the model that fits it.
|
|
5
|
+
*
|
|
6
|
+
* - PLAN, on the plan model: read and reproduce, change nothing, and end with
|
|
7
|
+
* `studio_submit_plan`. The studio stores the plan and the run goes on at
|
|
8
|
+
* once: it makes room in the budget for the estimate (up to the task's
|
|
9
|
+
* ceiling), and a schema migration only means the task ends in review.
|
|
10
|
+
* The plan phase has a ceiling of its own (`PLAN_MAX_ROUNDS`, nudged from
|
|
11
|
+
* `PLAN_NUDGE_AFTER_ROUNDS`): it used to get every round the run had, and
|
|
12
|
+
* reading on the most expensive model was most of what a run cost.
|
|
13
|
+
* - EXEC, on the exec model, on a FRESH chain: the system prompt (with the
|
|
14
|
+
* pins), the request, the plan, the files the plan phase read and what it
|
|
15
|
+
* read of the plan's files (`execReadExcerpts`), and the tool groups the
|
|
16
|
+
* plan named already loaded, so the chain never changes its tools. None of
|
|
17
|
+
* the plan phase's turns or thinking: a provider caches per model, and a
|
|
18
|
+
* thinking block is bound to the exact history it was written with, so a
|
|
19
|
+
* switch is a new chain, never an edit of the old one (the transcript stays
|
|
20
|
+
* append-only within a chain, see loop.ts).
|
|
21
|
+
* - ESCALATED, on the plan model again, for a few rounds: asked for with
|
|
22
|
+
* `studio_escalate`, or on its own after two failing test runs in a row,
|
|
23
|
+
* `ESCALATE_AFTER_IDLE_ROUNDS` rounds without a file change, or a loop-guard
|
|
24
|
+
* trip. It ends with a short reply, and exec starts a fresh chain with it.
|
|
25
|
+
*
|
|
26
|
+
* Part of the agent contract (see `version.ts`), copied verbatim into the
|
|
27
|
+
* runner. The orchestration lives here, `runPhasedLoop`; each runtime hands in
|
|
28
|
+
* how ONE phase runs (its own loop, its own transport bound to the phase's
|
|
29
|
+
* slot), like `runBatch` takes how one call is made. No imports: what it needs
|
|
30
|
+
* from loop.ts (the working-set ledger) is handed in too.
|
|
31
|
+
*/
|
|
32
|
+
export declare const SUBMIT_PLAN_TOOL = "studio_submit_plan";
|
|
33
|
+
export declare const ESCALATE_TOOL = "studio_escalate";
|
|
34
|
+
/** The phase tools: offered only in a run with phases, handled by the loops. */
|
|
35
|
+
export declare const PHASE_TOOL_NAMES: ReadonlySet<string>;
|
|
36
|
+
/** A model the dispatch resolved for a phase (`resolveAgentSlotModel`). */
|
|
37
|
+
export interface PhaseModel {
|
|
38
|
+
aiProviderId: number;
|
|
39
|
+
model: string;
|
|
40
|
+
}
|
|
41
|
+
/** What `studio_submit_plan` takes, and what the exec phase starts from. */
|
|
42
|
+
export interface SubmittedPlan {
|
|
43
|
+
approach: string;
|
|
44
|
+
files: string[];
|
|
45
|
+
repro: string;
|
|
46
|
+
risks: string;
|
|
47
|
+
estimate: {
|
|
48
|
+
calls: number;
|
|
49
|
+
usd?: number;
|
|
50
|
+
};
|
|
51
|
+
/** True when the plan changes a database schema (a migration): a person approves it first. */
|
|
52
|
+
schemaMigration?: boolean;
|
|
53
|
+
/** Tool groups the work needs, loaded before the exec phase's first call: a load mid-chain changes the tools and writes the whole run to the cache again. */
|
|
54
|
+
toolGroups?: string[];
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The phases of a run, on the dispatch (`agentConfig.phases`). Present only
|
|
58
|
+
* when the run plans first; absent, the run is today's single-model loop.
|
|
59
|
+
*/
|
|
60
|
+
export interface RunPhasesConfig {
|
|
61
|
+
plan: PhaseModel;
|
|
62
|
+
exec: PhaseModel;
|
|
63
|
+
/** A plan this run of the task already has (approved at the gate, or passed before a resume): the run starts in exec. */
|
|
64
|
+
approvedPlan?: SubmittedPlan;
|
|
65
|
+
}
|
|
66
|
+
export type RunPhaseName = 'plan' | 'exec' | 'escalated';
|
|
67
|
+
/** The agent slot each phase's inference runs on. */
|
|
68
|
+
export declare const PHASE_SLOT: Readonly<Record<RunPhaseName, 'plan' | 'exec'>>;
|
|
69
|
+
/** Rounds an escalation may take before exec takes over again. */
|
|
70
|
+
export declare const ESCALATION_MAX_ROUNDS = 6;
|
|
71
|
+
/** Escalations one run may make (asked for or automatic). */
|
|
72
|
+
export declare const MAX_ESCALATIONS = 2;
|
|
73
|
+
/** Failing `runner_test` runs in a row that escalate on their own. */
|
|
74
|
+
export declare const ESCALATE_AFTER_FAILED_TESTS = 2;
|
|
75
|
+
/** Exec rounds without a file change that escalate on their own (only where files can change). */
|
|
76
|
+
export declare const ESCALATE_AFTER_IDLE_ROUNDS = 8;
|
|
77
|
+
/** Rounds the plan phase may take: the plan model is the expensive one, and reading is cheaper on exec's. */
|
|
78
|
+
export declare const PLAN_MAX_ROUNDS = 12;
|
|
79
|
+
/** Plan rounds after which the planner is asked to submit with what it knows. */
|
|
80
|
+
export declare const PLAN_NUDGE_AFTER_ROUNDS = 8;
|
|
81
|
+
/** Most of what earlier phases read of the plan's files that an exec chain starts with (characters). */
|
|
82
|
+
export declare const EXEC_EXCERPT_MAX_CHARS = 24000;
|
|
83
|
+
/** Tools that change files or the repository: refused in the plan phase, which only reads and reproduces. */
|
|
84
|
+
export declare const PLAN_PHASE_BLOCKED_TOOLS: ReadonlySet<string>;
|
|
85
|
+
export declare const PLAN_PHASE_BRIEF: string;
|
|
86
|
+
/** How the studio answers a plan that passed its gate; anything else is a gate that waits or a refusal. */
|
|
87
|
+
export declare const PLAN_PASSED_PREFIX = "Plan accepted.";
|
|
88
|
+
export declare const PLAN_NUDGE = "You are in the plan phase: submit your plan with `studio_submit_plan` to start the work. If nothing needs to change, reply once more with your proof and the run ends.";
|
|
89
|
+
/** What the planner is told as its rounds run out: after `PLAN_NUDGE_AFTER_ROUNDS`, and before its last one. */
|
|
90
|
+
export declare function planRoundsNudge(used: number, max: number): string;
|
|
91
|
+
export declare const EXEC_PHASE_BRIEF: string;
|
|
92
|
+
export declare function escalationBrief(reason: string): string;
|
|
93
|
+
/** Exec without a plan: the plan phase ran out of rounds before it submitted one. */
|
|
94
|
+
export declare const EXEC_WITHOUT_PLAN = "The plan phase ran out of rounds before it handed in a plan, so nobody checked one: find the change from what it found and read. When the change needs a database schema migration, ask a person with studio_ask before you make it.";
|
|
95
|
+
export declare const ESCALATION_ACK = "Escalated: after this round the planning model takes over on a fresh context with your reason, the plan and the files you worked with, and hands back what it found.";
|
|
96
|
+
export declare const ESCALATION_SPENT = "Not escalated: this run already escalated 2 times. Carry on with what you have, or ask a person with studio_ask when only they can unblock you.";
|
|
97
|
+
export declare const ESCALATION_IN_ESCALATION = "You are the escalation: write your findings as a plain reply (no tool call) to hand back to the executor.";
|
|
98
|
+
export declare const PHASE_TOOL_NOT_HERE = "Not available in this phase.";
|
|
99
|
+
export declare function planPhaseRefusal(toolName: string): string;
|
|
100
|
+
/** The plan in a call's arguments, or what is wrong with it (`studio_submit_plan`, both sides). */
|
|
101
|
+
export declare function readPlanArgs(raw: unknown): SubmittedPlan | string;
|
|
102
|
+
/** The plan as the exec phase and a person read it. */
|
|
103
|
+
export declare function renderPlan(plan: SubmittedPlan): string;
|
|
104
|
+
/**
|
|
105
|
+
* What earlier phases read of the given files (`runner_read_file` results, the
|
|
106
|
+
* newest read of each range first), within `maxChars`. The exec chain starts
|
|
107
|
+
* with it: it used to get the file names only and read every one of them again
|
|
108
|
+
* on the exec model. `files` null: any file read. Empty when nothing matches.
|
|
109
|
+
*/
|
|
110
|
+
export declare function execReadExcerpts(messages: readonly PhaseMessage[], files: readonly string[] | null, maxChars?: number): string;
|
|
111
|
+
/** Whether a `runner_test` result is a failing run (true), a passing one (false), or neither (null). */
|
|
112
|
+
export declare function testRunFailed(toolName: string, result: string): boolean | null;
|
|
113
|
+
/** The message shape both loops speak, reduced to what a phase opening needs. */
|
|
114
|
+
export interface PhaseMessage {
|
|
115
|
+
role: string;
|
|
116
|
+
content: unknown;
|
|
117
|
+
}
|
|
118
|
+
export interface PhaseUsage {
|
|
119
|
+
inputTokens: number;
|
|
120
|
+
outputTokens: number;
|
|
121
|
+
costMicros: number;
|
|
122
|
+
cacheCreationTokens?: number;
|
|
123
|
+
cacheReadTokens?: number;
|
|
124
|
+
contextTokens?: number;
|
|
125
|
+
}
|
|
126
|
+
/** What a runtime's loop returns, as far as the phases read it. */
|
|
127
|
+
export interface PhaseLoopResult<M> {
|
|
128
|
+
finalReply: string;
|
|
129
|
+
stopReason: string;
|
|
130
|
+
finalThoughts: string | null;
|
|
131
|
+
messages: M[];
|
|
132
|
+
totalUsage: PhaseUsage;
|
|
133
|
+
finalModel: string;
|
|
134
|
+
rounds: number;
|
|
135
|
+
handoff?: string | null;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* What a phase's loop must do besides its ordinary work; the runtime wires it
|
|
139
|
+
* into its tool executor and its round hooks (see `runPhasedLoop`).
|
|
140
|
+
*/
|
|
141
|
+
export interface PhaseGuard {
|
|
142
|
+
/** Before a tool runs: an answer instead of running it (a phase tool, a refusal), or null to run it. */
|
|
143
|
+
intercept(name: string, args: unknown): {
|
|
144
|
+
result: string;
|
|
145
|
+
isError: boolean;
|
|
146
|
+
} | null;
|
|
147
|
+
/** After a tool ran. */
|
|
148
|
+
observe(name: string, args: unknown, outcome: {
|
|
149
|
+
result: string;
|
|
150
|
+
isError: boolean;
|
|
151
|
+
}): void;
|
|
152
|
+
/** After a round: true ends this phase (the next starts on a fresh chain). */
|
|
153
|
+
endRound(): boolean;
|
|
154
|
+
/** After a round that did not end the phase: a message to add before the next round, or null. */
|
|
155
|
+
nudge(): string | null;
|
|
156
|
+
/** The run ended the round itself (a terminal task status): no switch follows. */
|
|
157
|
+
cancel(): void;
|
|
158
|
+
/** A plain reply: a nudge to go on with, `true` when it ends the phase as it is (the run's own reply hook is skipped), or null for the run's own handling. */
|
|
159
|
+
onReply(reply: string): string | true | null;
|
|
160
|
+
}
|
|
161
|
+
/** One phase, as the runtime is asked to run it. */
|
|
162
|
+
export interface PhaseRun<M> {
|
|
163
|
+
phase: RunPhaseName;
|
|
164
|
+
slot: 'plan' | 'exec';
|
|
165
|
+
/** A fresh chain: the run's request with the phase's brief (and the plan, the working set). */
|
|
166
|
+
initialMessages: M[];
|
|
167
|
+
maxRounds: number;
|
|
168
|
+
/** Rounds earlier phases used: hooks see the run's round, not the phase's. */
|
|
169
|
+
roundOffset: number;
|
|
170
|
+
/** What earlier phases cost (micros): the run's cost cap counts the whole run. */
|
|
171
|
+
spentMicros: number;
|
|
172
|
+
closeOnLoop: boolean;
|
|
173
|
+
/** Whether the loop writes handoff notes when it stops for this reason (`review`: the short variant). */
|
|
174
|
+
handoffOn: (stopReason: string) => boolean | 'review';
|
|
175
|
+
initialPinnedNotes: Array<[string, string]>;
|
|
176
|
+
onPins: (notes: Array<[string, string]>) => void;
|
|
177
|
+
guard: PhaseGuard;
|
|
178
|
+
}
|
|
179
|
+
export interface PhasedLoopOpts<M extends PhaseMessage, R extends PhaseLoopResult<M>> {
|
|
180
|
+
config: RunPhasesConfig;
|
|
181
|
+
/** The run's opening: its request (the last user message gets the phase brief). */
|
|
182
|
+
initialMessages: M[];
|
|
183
|
+
/** The run's mutable tool registry: the phase tools and the plan phase's blocked tools come and go with the phase. */
|
|
184
|
+
registry: Map<string, unknown>;
|
|
185
|
+
maxRounds: number;
|
|
186
|
+
closeOnLoop: boolean;
|
|
187
|
+
/** Whether a run that stops for this reason writes handoff notes (`review`: the short variant). */
|
|
188
|
+
writeHandoff: (stopReason: string) => boolean | 'review';
|
|
189
|
+
initialPinnedNotes?: Array<[string, string]>;
|
|
190
|
+
/** loop.ts's `workingSetLedger`, handed in. */
|
|
191
|
+
ledger: (messages: readonly M[]) => string;
|
|
192
|
+
runPhase: (run: PhaseRun<M>) => Promise<R>;
|
|
193
|
+
/** Told when a phase starts (logging, activity). */
|
|
194
|
+
onPhase?: (phase: RunPhaseName, why: string) => void;
|
|
195
|
+
/** Loads tool groups into `registry` (`studio_load_toolset`): the plan's `toolGroups`, before the exec chain starts. */
|
|
196
|
+
loadToolGroups?: (groups: string[]) => Promise<void>;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Run a task in phases (see the top of this file). Returns the last phase's
|
|
200
|
+
* result with the whole run's usage and rounds, and the plan.
|
|
201
|
+
*/
|
|
202
|
+
export declare function runPhasedLoop<M extends PhaseMessage, R extends PhaseLoopResult<M>>(opts: PhasedLoopOpts<M, R>): Promise<R & {
|
|
203
|
+
plan: SubmittedPlan | null;
|
|
204
|
+
}>;
|