@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,595 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire contract for **Studio -> Agent** WebSocket frames, as the agent runtime
|
|
3
|
+
* reads them.
|
|
4
|
+
*
|
|
5
|
+
* Part of the agent contract (see `version.ts`), copied verbatim into the
|
|
6
|
+
* runner. The studio's Zod schemas in `server/schemas/ws-agent-dispatch.ts`
|
|
7
|
+
* validate what goes out; these are the types the runner (and the studio's own
|
|
8
|
+
* internal runtime) consume. `server/schemas/ws-agent-dispatch.contract.ts`
|
|
9
|
+
* holds the two together at compile time: a field the studio sends that these
|
|
10
|
+
* types do not describe, or one these types promise that the studio does not
|
|
11
|
+
* send, fails the studio's typecheck.
|
|
12
|
+
*
|
|
13
|
+
* No runtime validation here - the studio validates outbound. The runner uses
|
|
14
|
+
* `recogniseDispatch` at the message boundary to drop frames whose `type` it
|
|
15
|
+
* does not know.
|
|
16
|
+
*/
|
|
17
|
+
import type { FsBrowseFrame, FsMkdirFrame, FsListFrame, FsReadFrame, FsBytesFrame, FsWriteFrame, FsEntryFrame, FsStatusFrame, FsPathsFrame, FsSonarFrame, FsReposFrame, FsBranchesFrame, FsLogFrame, FsShowFrame, FsBlameFrame, FsDiffFrame, FsGitFrame } from './fs.js';
|
|
18
|
+
import type { RunPhasesConfig } from './phases.js';
|
|
19
|
+
/** Absent fields arrive as explicit `null`: the stored message metadata is
|
|
20
|
+
* replayed verbatim into the history. */
|
|
21
|
+
export interface AttachmentRef {
|
|
22
|
+
uid?: string | null;
|
|
23
|
+
url: string;
|
|
24
|
+
name: string;
|
|
25
|
+
type?: string | null;
|
|
26
|
+
size?: number | null;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A tool the agent ran during a turn, replayed back into its own history so
|
|
30
|
+
* the model recognises the action as real rather than hallucinated. Validated by
|
|
31
|
+
* `historyToolCallSchema` in the studio's `ws-agent-dispatch.ts`. Deliberately
|
|
32
|
+
* minimal: name + a small truncated arg slice + ok/fail + a short result
|
|
33
|
+
* snippet. The full tool output is never carried.
|
|
34
|
+
*/
|
|
35
|
+
export interface HistoryToolCall {
|
|
36
|
+
name: string;
|
|
37
|
+
args?: Record<string, unknown>;
|
|
38
|
+
ok: boolean;
|
|
39
|
+
result?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface HistoryEntry {
|
|
42
|
+
role: string;
|
|
43
|
+
content: string;
|
|
44
|
+
userName?: string;
|
|
45
|
+
attachments?: AttachmentRef[];
|
|
46
|
+
/** Tools this (agent) turn ran before producing `content`. Present only on
|
|
47
|
+
* agent entries; expanded into tool-call/tool-result message pairs. */
|
|
48
|
+
toolCalls?: HistoryToolCall[];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Per-agent runtime tunables. Prompt ingredients (system prompt, personality,
|
|
52
|
+
* role, memory, timezone) are NOT here - the studio assembles the finished
|
|
53
|
+
* prompt server-side and ships it as the frame's `systemPrompt`. The runner
|
|
54
|
+
* is a dumb executor and never sees raw prompt ingredients.
|
|
55
|
+
*/
|
|
56
|
+
export interface AgentConfigPayload {
|
|
57
|
+
maxCostPerTurn?: number;
|
|
58
|
+
maxToolRounds?: number;
|
|
59
|
+
maxLoopMs?: number;
|
|
60
|
+
/** How long a `studio_call_agent` from this agent may run. The studio owns
|
|
61
|
+
* the clock; the runner forwards it on `delegate:request` and keeps a
|
|
62
|
+
* backstop just past it. */
|
|
63
|
+
delegateTimeoutMs?: number;
|
|
64
|
+
toolResultTruncateChars?: number;
|
|
65
|
+
validationRetries?: number;
|
|
66
|
+
/** The agent model's context-window size (tokens). Lets the agentic loop
|
|
67
|
+
* trigger token-budget compaction at a fraction of the real window instead
|
|
68
|
+
* of a fixed default, so big-window models use their full headroom. Omitted
|
|
69
|
+
* when the studio couldn't resolve the window (dynamic/uncurated models). */
|
|
70
|
+
contextWindowTokens?: number;
|
|
71
|
+
/** Optional cheaper model used ONLY for context compaction (the loop's
|
|
72
|
+
* rolling conversation summary). Compaction is mechanical summarization, so
|
|
73
|
+
* it does not need the agent's reasoning model - pointing it at a small fast
|
|
74
|
+
* model cuts the cost of a fold by an order of magnitude. Omitted = not
|
|
75
|
+
* configured = the loop summarizes with the agent's own model. Forwarded
|
|
76
|
+
* verbatim as `modelOverride` on the /api/mcp/inference call. */
|
|
77
|
+
compactionModelOverride?: {
|
|
78
|
+
aiProviderId: number;
|
|
79
|
+
model: string;
|
|
80
|
+
};
|
|
81
|
+
/** The run plans first and then works, each phase on its own model
|
|
82
|
+
* (phases.ts, `runPhasedLoop`). Present only for a task of a kind that
|
|
83
|
+
* plans first on an agent whose plan or exec model differs from its own;
|
|
84
|
+
* absent, the run is the single-model loop. Each call names its slot and
|
|
85
|
+
* phase on /api/mcp/inference, where the studio resolves the model. */
|
|
86
|
+
phases?: RunPhasesConfig;
|
|
87
|
+
/** Every inference call of this dispatch runs on this slot of the agent:
|
|
88
|
+
* `explore` for a read-only working copy (`studio_call_agent` with
|
|
89
|
+
* `tier: 'explore'`). Absent = the agent's own model. */
|
|
90
|
+
inferenceSlot?: 'explore';
|
|
91
|
+
/** Tools the agent has registered for this turn. Studio ships only the
|
|
92
|
+
* bootstrap set plus anything previously loaded in this conversation via
|
|
93
|
+
* `studio_load_toolset`. Everything else lives in `toolGroups[].tools[]` as
|
|
94
|
+
* a cheap name+description index and is registered on demand. Tools with
|
|
95
|
+
* a non-null `mcpPath` are executed via HTTP against the studio's MCP
|
|
96
|
+
* endpoints; tools with null `mcpPath` run locally inside the runner.
|
|
97
|
+
* The long `Tool.instructions` text is intentionally NOT here - fetched
|
|
98
|
+
* on-demand via `studio_get_tool_instructions`. */
|
|
99
|
+
toolDefs?: ToolDefPayload[];
|
|
100
|
+
/** Capability-grouped index of every tool the agent has access to,
|
|
101
|
+
* including ones not yet loaded. Each group carries its tools by name +
|
|
102
|
+
* short description so the LLM can decide what to load via
|
|
103
|
+
* `studio_load_toolset` without an extra round-trip. Only groups with at
|
|
104
|
+
* least one allowed tool ship. */
|
|
105
|
+
toolGroups?: ToolGroupPayload[];
|
|
106
|
+
[key: string]: unknown;
|
|
107
|
+
}
|
|
108
|
+
export interface ToolGroupPayload {
|
|
109
|
+
key: string;
|
|
110
|
+
name: string;
|
|
111
|
+
description: string;
|
|
112
|
+
/** Tools in this group the agent is allowed to use. Name + short
|
|
113
|
+
* description only - full schemas are fetched on demand via
|
|
114
|
+
* `studio_load_toolset` (or shipped directly in `toolDefs` when bootstrap
|
|
115
|
+
* or previously loaded in this conversation). */
|
|
116
|
+
tools: {
|
|
117
|
+
name: string;
|
|
118
|
+
description: string;
|
|
119
|
+
}[];
|
|
120
|
+
}
|
|
121
|
+
export interface ToolDefPayload {
|
|
122
|
+
name: string;
|
|
123
|
+
description: string;
|
|
124
|
+
parametersSchema: Record<string, unknown>;
|
|
125
|
+
/** Short status label shown on the studio floorplan during execution. */
|
|
126
|
+
activityLabel?: string | null;
|
|
127
|
+
/** HTTP method the runner uses to call this tool against the studio MCP API.
|
|
128
|
+
* null means the tool is executed locally inside the runner. */
|
|
129
|
+
mcpMethod?: string | null;
|
|
130
|
+
/** MCP endpoint path. May contain {param} placeholders that are
|
|
131
|
+
* interpolated from the tool arguments. null = local tool. */
|
|
132
|
+
mcpPath?: string | null;
|
|
133
|
+
/** When true, tool arguments go as query params instead of request body. */
|
|
134
|
+
mcpQuery?: boolean;
|
|
135
|
+
}
|
|
136
|
+
export interface ProjectRef {
|
|
137
|
+
slug: string;
|
|
138
|
+
name: string;
|
|
139
|
+
/** Local checkout path the studio coupled for THIS dispatch's runner (set via
|
|
140
|
+
* the studio UI picker). The runner jails tools here after validating it's
|
|
141
|
+
* inside one of its folders. Absent/null = not coupled on this runner, so the
|
|
142
|
+
* agent falls back to its own home (no project code). */
|
|
143
|
+
folder?: string | null;
|
|
144
|
+
/** Set for a task run of a project that gives every code run its own
|
|
145
|
+
* worktree (`Project.codeWorktreePerRun`): the branch (`task/<uid>`) the
|
|
146
|
+
* runner makes the run's worktree on from `folder` (or reuses, on a
|
|
147
|
+
* resume), running the project's worktree setup script, and roots the
|
|
148
|
+
* run's tools in. Absent = the run works in `folder` itself. */
|
|
149
|
+
worktreeBranch?: string;
|
|
150
|
+
/** The folder of `folder` (relative, POSIX, e.g. `apps/code`) this run may
|
|
151
|
+
* change: writes, deletes, the shell's cwd and commits stay inside it, reads
|
|
152
|
+
* stay on the whole checkout and searches default to it. In a run's own
|
|
153
|
+
* worktree it applies relative to the worktree root. A folder that does not
|
|
154
|
+
* exist blocks every write in the checkout. Absent = the whole checkout.
|
|
155
|
+
* The server sends it from runner 0.5.1 on: the session's own scope, else
|
|
156
|
+
* the folder its surface is linked to. */
|
|
157
|
+
scope?: string;
|
|
158
|
+
/** Absolute folders on this runner beside the checkout (its active
|
|
159
|
+
* workspace folders, `CodeWorkspaceFolder`): the run may read and change
|
|
160
|
+
* them too. The runner keeps the ones outside its folder roots, or gone,
|
|
161
|
+
* out of the jail; relative paths still resolve against the checkout and
|
|
162
|
+
* `scope` holds only inside it. Sent from runner 0.89.0 on. */
|
|
163
|
+
workspaceFolders?: string[];
|
|
164
|
+
/** The files of the checkout this chat or task changed itself and has not
|
|
165
|
+
* committed since (`own-files.ts`), the last changed last: what
|
|
166
|
+
* `runner_git_status` names as `yours`. A call carries its caller's.
|
|
167
|
+
* Absent from an older studio: the run starts from none. */
|
|
168
|
+
ownFiles?: string[];
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Optional dispatch hint that switches the CLI to direct-call mode for
|
|
172
|
+
* this turn. Present only when Studio resolved the agent's provider as
|
|
173
|
+
* `routing: 'runtime'` (e.g. local Ollama / LM Studio).
|
|
174
|
+
*/
|
|
175
|
+
export interface InferenceHint {
|
|
176
|
+
routing: 'runtime';
|
|
177
|
+
baseUrl: string;
|
|
178
|
+
model: string;
|
|
179
|
+
apiKey?: string | null;
|
|
180
|
+
customId?: number;
|
|
181
|
+
}
|
|
182
|
+
export interface ConnectedFrame {
|
|
183
|
+
type: 'connected';
|
|
184
|
+
agent: {
|
|
185
|
+
slug: string;
|
|
186
|
+
name: string;
|
|
187
|
+
role: string;
|
|
188
|
+
};
|
|
189
|
+
onlineUsers?: unknown[];
|
|
190
|
+
tasks?: {
|
|
191
|
+
id: number;
|
|
192
|
+
action: string;
|
|
193
|
+
}[];
|
|
194
|
+
/** Latest runner version the studio knows about. When this is newer than the
|
|
195
|
+
* runner's own version, the CLI prints an "update available" notice. Absent
|
|
196
|
+
* when talking to an older studio that doesn't report it. */
|
|
197
|
+
latestRunnerVersion?: string;
|
|
198
|
+
/** The studio's `AGENT_CONTRACT_VERSION`. When it differs from the runner's
|
|
199
|
+
* own, the two hold different copies of this contract and one of them is
|
|
200
|
+
* out of date. Absent from a studio that predates the stamp. */
|
|
201
|
+
agentContract?: string;
|
|
202
|
+
/** Of the queue rows the runner said it still runs (`running` on the
|
|
203
|
+
* connect url), those the studio kept: they go on, frames and all. The
|
|
204
|
+
* rest the studio settled or starts over, so the runner stops them.
|
|
205
|
+
* Absent from a studio that starts every one over. */
|
|
206
|
+
keptRuns?: number[];
|
|
207
|
+
}
|
|
208
|
+
export interface ChatDispatchFrame {
|
|
209
|
+
type: 'chat';
|
|
210
|
+
conversationId: string;
|
|
211
|
+
messageId?: number | null;
|
|
212
|
+
agentSlug: string;
|
|
213
|
+
userName?: string;
|
|
214
|
+
/** Public UUID of the triggering user - safe to forward to the OS log endpoint. */
|
|
215
|
+
userUuid?: string;
|
|
216
|
+
history: HistoryEntry[];
|
|
217
|
+
/** The fully-assembled system prompt, built server-side by the studio.
|
|
218
|
+
* The runner uses it verbatim - no local prompt assembly. */
|
|
219
|
+
systemPrompt: string;
|
|
220
|
+
agentConfig?: AgentConfigPayload;
|
|
221
|
+
inference?: InferenceHint;
|
|
222
|
+
queueId: number;
|
|
223
|
+
/** UID of this dispatch's queue entry. Echoed back on every MCP tool call so
|
|
224
|
+
* the studio's `mcp-project-scope` middleware can resolve the invocation
|
|
225
|
+
* project - which is what makes project-scoped secrets (`${secret:KEY}`,
|
|
226
|
+
* studio_get_secret) resolve inside a project-linked chat, exactly like a
|
|
227
|
+
* task. Optional: an older studio that doesn't send it leaves chat secret
|
|
228
|
+
* resolution org-scoped (pre-fix behaviour). */
|
|
229
|
+
queueUid?: string;
|
|
230
|
+
/** Project this chat is bound to. Studio passes it per dispatch (agents are
|
|
231
|
+
* cross-project). Omitted for DMs and ephemeral terminal pings. Used as the
|
|
232
|
+
* project pin on file uploads. */
|
|
233
|
+
project?: ProjectRef | null;
|
|
234
|
+
/** This turn is being spoken in a MEETING: a studio room where several people
|
|
235
|
+
* and several agents share ONE transcript, and who speaks next is decided by
|
|
236
|
+
* a server-side router rather than by the person replying.
|
|
237
|
+
*
|
|
238
|
+
* The runtime needs it for `cutoffNotice`, which is appended after the loop
|
|
239
|
+
* and therefore outside the model's reach: its one-to-one wording tells the
|
|
240
|
+
* reader to "reply continue", and in a room that is wrong twice over - the
|
|
241
|
+
* next turn is routed and may land on the chair or on a colleague, so this
|
|
242
|
+
* agent has no claim on it. Everything else a meeting implies arrives as
|
|
243
|
+
* prose inside `systemPrompt`; only this needed a typed field.
|
|
244
|
+
*
|
|
245
|
+
* Optional: an older studio does not send it, which leaves the runtime on
|
|
246
|
+
* the one-to-one wording it has always used. Absent is read as `false`. */
|
|
247
|
+
inMeeting?: boolean;
|
|
248
|
+
/** The studio keeps what the agent says between tool calls as lines of
|
|
249
|
+
* this chat (a room, a code session): send each as `chat:narration`.
|
|
250
|
+
* Absent (an older studio, an ordinary chat): only the answer to a steer
|
|
251
|
+
* is sent, and only a room's asides count as said. */
|
|
252
|
+
keepsAsides?: boolean;
|
|
253
|
+
/** The person who started this chat connected a git relay: what the agent
|
|
254
|
+
* commits here is theirs, and a push goes out through their machine.
|
|
255
|
+
* Absent when they have none (a task, nobody behind the turn, an older
|
|
256
|
+
* studio): the agent commits and pushes as it always did. */
|
|
257
|
+
gitRelay?: ChatGitRelay;
|
|
258
|
+
}
|
|
259
|
+
/** The git relay of the person behind a chat turn, as the runner needs it. */
|
|
260
|
+
export interface ChatGitRelay {
|
|
261
|
+
/** Commit as this person: their machine's git identity (`GitRelayStatus`). */
|
|
262
|
+
commitAs: {
|
|
263
|
+
name: string;
|
|
264
|
+
email: string;
|
|
265
|
+
};
|
|
266
|
+
/** The agent, named on every such commit as `Co-authored-by: name <email>`.
|
|
267
|
+
* `email` is `<slug>@justmade.be`; optional so an older server's frame still
|
|
268
|
+
* parses (the runner then builds the same address from its own slug). */
|
|
269
|
+
agent: {
|
|
270
|
+
name: string;
|
|
271
|
+
email?: string;
|
|
272
|
+
};
|
|
273
|
+
/** The relay is on the runner this turn runs on: it pushes from here, as
|
|
274
|
+
* it always did. Otherwise a push goes to the studio as a bundle
|
|
275
|
+
* (`POST /api/agents/git-relay/push`), for their machine to push. */
|
|
276
|
+
local: boolean;
|
|
277
|
+
}
|
|
278
|
+
export interface TaskDispatchFrame {
|
|
279
|
+
type: 'task';
|
|
280
|
+
queueId: number;
|
|
281
|
+
queueUid: string;
|
|
282
|
+
action: string;
|
|
283
|
+
input?: unknown;
|
|
284
|
+
/** Fully-assembled system prompt for the task run, built server-side. */
|
|
285
|
+
systemPrompt: string;
|
|
286
|
+
/** The task instruction shown to the agent as its first user message. */
|
|
287
|
+
userPrompt: string;
|
|
288
|
+
/** Pre-rendered mid-loop nudge replayed when a task with a result schema
|
|
289
|
+
* reaches a final answer without calling `studio_update_task`. Present iff
|
|
290
|
+
* the task carries a result schema - its presence is the "has result
|
|
291
|
+
* schema" flag. */
|
|
292
|
+
schemaReminder?: string;
|
|
293
|
+
agentConfig?: AgentConfigPayload;
|
|
294
|
+
inference?: InferenceHint;
|
|
295
|
+
/** Project this task is bound to (studio passes it per dispatch; agents are
|
|
296
|
+
* cross-project). Used as the project pin on file uploads. */
|
|
297
|
+
project?: ProjectRef | null;
|
|
298
|
+
}
|
|
299
|
+
export interface TaskCancelFrame {
|
|
300
|
+
type: 'task:cancel';
|
|
301
|
+
queueId: number;
|
|
302
|
+
taskUid?: string;
|
|
303
|
+
}
|
|
304
|
+
export interface TaskSteerFrame {
|
|
305
|
+
type: 'task:steer';
|
|
306
|
+
queueId: number;
|
|
307
|
+
taskUid?: string;
|
|
308
|
+
message: string;
|
|
309
|
+
/** The steer's entry uid. A runner that knows it says so once the run has
|
|
310
|
+
* read the message (`task:steer-applied`); until then the studio shows it
|
|
311
|
+
* as waiting. Absent for a steer nobody waits on (a decision, a call). */
|
|
312
|
+
steerId?: string;
|
|
313
|
+
}
|
|
314
|
+
export interface ChatCancelFrame {
|
|
315
|
+
type: 'chat:cancel';
|
|
316
|
+
conversationId: string;
|
|
317
|
+
}
|
|
318
|
+
export interface ChatSteerFrame {
|
|
319
|
+
type: 'chat:steer';
|
|
320
|
+
conversationId: string;
|
|
321
|
+
message: string;
|
|
322
|
+
/** The person's line (entry uid): acked with `chat:steer-applied` once the
|
|
323
|
+
* turn has read it, so the studio draws it in the transcript only then. */
|
|
324
|
+
steerId?: string;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Studio → CLI: a side question (`/btw`) about this chat. The runtime answers
|
|
328
|
+
* it in ONE inference call without tools, on top of the last request the
|
|
329
|
+
* chat's turn sent (running or recently finished), so the provider's prompt
|
|
330
|
+
* cache is hit; the turn itself is neither stopped nor steered. `prompt` is
|
|
331
|
+
* the last user message, already rendered by the studio (rules, earlier side
|
|
332
|
+
* questions, the question). Reply: `fs:result` with the answer in `output`,
|
|
333
|
+
* or `ok: false` with `SIDE_QUESTION_NO_CONTEXT` when the runtime holds no
|
|
334
|
+
* context for the chat (the studio then answers from the transcript).
|
|
335
|
+
* Only sent to a runner that reports `SIDE_QUESTION_FEATURE` in its `config`.
|
|
336
|
+
*/
|
|
337
|
+
export interface ChatSideQuestionFrame {
|
|
338
|
+
type: 'chat:side-question';
|
|
339
|
+
requestId: string;
|
|
340
|
+
conversationId: string;
|
|
341
|
+
prompt: string;
|
|
342
|
+
}
|
|
343
|
+
/** The `features` entry of the runner's `config` frame that says it answers
|
|
344
|
+
* `chat:side-question`. */
|
|
345
|
+
export declare const SIDE_QUESTION_FEATURE = "side-question";
|
|
346
|
+
/** The `error` of a side question the runtime holds no context for. */
|
|
347
|
+
export declare const SIDE_QUESTION_NO_CONTEXT = "no-context";
|
|
348
|
+
/**
|
|
349
|
+
* Studio → CLI: only sent for `routing: 'runtime'` agents - studio-routed
|
|
350
|
+
* provider titles are generated in-studio and broadcast as `chat:title`
|
|
351
|
+
* directly. The CLI calls its local provider using `inference` and posts
|
|
352
|
+
* the title back via `chat:title`.
|
|
353
|
+
*/
|
|
354
|
+
export interface ChatGenerateTitleFrame {
|
|
355
|
+
type: 'chat:generate-title';
|
|
356
|
+
conversationId: string;
|
|
357
|
+
userMessage: string;
|
|
358
|
+
agentMessage: string;
|
|
359
|
+
inference: InferenceHint;
|
|
360
|
+
/** The naming rule for this chat (a code session names the work). Absent
|
|
361
|
+
* from an older studio: the CLI then uses its own default rule. */
|
|
362
|
+
system?: string;
|
|
363
|
+
}
|
|
364
|
+
export interface RestartFrame {
|
|
365
|
+
type: 'restart';
|
|
366
|
+
}
|
|
367
|
+
export interface PongFrame {
|
|
368
|
+
type: 'pong';
|
|
369
|
+
}
|
|
370
|
+
export interface ChatAckFrame {
|
|
371
|
+
type: 'chat:ack';
|
|
372
|
+
conversationId: string;
|
|
373
|
+
messageId: number;
|
|
374
|
+
}
|
|
375
|
+
export interface ResultAckFrame {
|
|
376
|
+
type: 'result:ack';
|
|
377
|
+
queueId: number;
|
|
378
|
+
}
|
|
379
|
+
export interface ProgressAckFrame {
|
|
380
|
+
type: 'progress:ack';
|
|
381
|
+
taskId?: string | number;
|
|
382
|
+
}
|
|
383
|
+
export interface ErrorFrame {
|
|
384
|
+
type: 'error';
|
|
385
|
+
message: string;
|
|
386
|
+
issues?: unknown[];
|
|
387
|
+
}
|
|
388
|
+
/** Studio → CLI: result of an agent-to-agent delegation. */
|
|
389
|
+
export interface DelegateResultFrame {
|
|
390
|
+
type: 'delegate:result';
|
|
391
|
+
requestId: string;
|
|
392
|
+
output?: string;
|
|
393
|
+
error?: string;
|
|
394
|
+
/** The files of the checkout the call changed (its writes and edits that
|
|
395
|
+
* worked, `own-files.ts`): from now on the caller's own as well. */
|
|
396
|
+
ownFiles?: string[];
|
|
397
|
+
}
|
|
398
|
+
/** Studio → CLI: a user came online in the studio. */
|
|
399
|
+
export interface PresenceUserOnlineFrame {
|
|
400
|
+
type: 'presence:user-online';
|
|
401
|
+
userUuid: string;
|
|
402
|
+
name: string;
|
|
403
|
+
}
|
|
404
|
+
/** Studio → CLI: a user went offline in the studio. */
|
|
405
|
+
export interface PresenceUserOfflineFrame {
|
|
406
|
+
type: 'presence:user-offline';
|
|
407
|
+
userUuid: string;
|
|
408
|
+
name: string;
|
|
409
|
+
}
|
|
410
|
+
export type PresenceUserFrame = PresenceUserOnlineFrame | PresenceUserOfflineFrame;
|
|
411
|
+
/** Studio → CLI: transport-level liveness probe. The CLI replies immediately
|
|
412
|
+
* from the WS message handler with `health:pong`, so RTT reflects pure
|
|
413
|
+
* socket round-trip without touching the agent loop. */
|
|
414
|
+
export interface HealthPingFrame {
|
|
415
|
+
type: 'health:ping';
|
|
416
|
+
nonce: string;
|
|
417
|
+
}
|
|
418
|
+
/** Studio → CLI: runtime-loop liveness probe. The CLI must schedule the
|
|
419
|
+
* `loop:probe:ack` reply through the event loop (e.g. `setImmediate`) so a
|
|
420
|
+
* missing ack means the agent runtime is stuck rather than the socket
|
|
421
|
+
* being dead. The LLM is never touched. */
|
|
422
|
+
export interface LoopProbeFrame {
|
|
423
|
+
type: 'loop:probe';
|
|
424
|
+
nonce: string;
|
|
425
|
+
}
|
|
426
|
+
/** Studio → CLI: the studio renamed this agent. Runner reconciles config /
|
|
427
|
+
* status files and (in detached mode) restarts itself once in-flight work
|
|
428
|
+
* drains so the new slug is honoured by the log-file FD. Token survives. */
|
|
429
|
+
export interface AgentRenamedFrame {
|
|
430
|
+
type: 'agent:renamed';
|
|
431
|
+
oldSlug: string;
|
|
432
|
+
newSlug: string;
|
|
433
|
+
}
|
|
434
|
+
/** The git relay of a runner: it pushes, in the name of the person who paired
|
|
435
|
+
* it and with their own key, what an agent on ANOTHER runner committed. The
|
|
436
|
+
* key never leaves the machine; every push waits for that person's click in
|
|
437
|
+
* a dialog the runner shows itself. Opt-in, kept on the machine, never in the
|
|
438
|
+
* studio. `enabled`: the person connected it (and has not disconnected it);
|
|
439
|
+
* `githubLogin`: who GitHub says the key is (`ssh -T git@github.com`),
|
|
440
|
+
* `gitName`/`gitEmail`: the machine's git identity, the author of what is
|
|
441
|
+
* committed for that person elsewhere; `dialog`: this machine can ask (a
|
|
442
|
+
* runner that cannot show the dialog refuses every push). */
|
|
443
|
+
export interface GitRelayStatus {
|
|
444
|
+
enabled: boolean;
|
|
445
|
+
githubLogin: string | null;
|
|
446
|
+
gitName: string | null;
|
|
447
|
+
gitEmail: string | null;
|
|
448
|
+
host: string;
|
|
449
|
+
connectedAt: string | null;
|
|
450
|
+
dialog: boolean;
|
|
451
|
+
}
|
|
452
|
+
/** Studio → CLI: how this runner's git relay stands. Reply: `fs:result` with
|
|
453
|
+
* `relay`. */
|
|
454
|
+
export interface RelayStatusFrame {
|
|
455
|
+
type: 'relay:status';
|
|
456
|
+
requestId: string;
|
|
457
|
+
}
|
|
458
|
+
/** Studio → CLI: the person `by` asks to connect this runner's git relay.
|
|
459
|
+
* The runner asks them in its own dialog, then tests the key. Reply:
|
|
460
|
+
* `fs:result` with `relay`, or an error (refused, no key). */
|
|
461
|
+
export interface RelayConnectFrame {
|
|
462
|
+
type: 'relay:connect';
|
|
463
|
+
requestId: string;
|
|
464
|
+
by: {
|
|
465
|
+
name: string;
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
/** Studio → CLI: disconnect the git relay, without asking (giving up access
|
|
469
|
+
* is never gated). Reply: `fs:result` with `relay`. */
|
|
470
|
+
export interface RelayDisconnectFrame {
|
|
471
|
+
type: 'relay:disconnect';
|
|
472
|
+
requestId: string;
|
|
473
|
+
}
|
|
474
|
+
/** Studio → CLI: push what `agent` committed on another runner, a git bundle
|
|
475
|
+
* (`bundle`, base64) holding `refs/heads/<branch>`, to `remote` (the URL of
|
|
476
|
+
* the agent's checkout; only GitHub). The runner reads what it shows and
|
|
477
|
+
* checks from the bundle itself (never from this frame's text), refuses a
|
|
478
|
+
* protected or unprefixed branch before it asks, and pushes from a mirror of
|
|
479
|
+
* its own, never a person's checkout, never forced. Reply: `fs:result` with
|
|
480
|
+
* git's `output` and the pushed `sha`, or an error (refused, timed out). */
|
|
481
|
+
export interface RelayPushFrame {
|
|
482
|
+
type: 'relay:push';
|
|
483
|
+
requestId: string;
|
|
484
|
+
agent: {
|
|
485
|
+
name: string;
|
|
486
|
+
};
|
|
487
|
+
remote: string;
|
|
488
|
+
branch: string;
|
|
489
|
+
bundle: string;
|
|
490
|
+
}
|
|
491
|
+
/** Studio → runner, the answer to `POST /api/agents/git-relay/push`: an agent
|
|
492
|
+
* on one runner hands the studio a bundle of its branch, and the studio sends
|
|
493
|
+
* it on (`relay:push`) to the relay of the person who started the chat. Only
|
|
494
|
+
* ever theirs. `pushed`: their machine pushed it (`runner` names it);
|
|
495
|
+
* `refused`: it did not, `reason` says why (refused there, a rule, no
|
|
496
|
+
* answer); `waiting`: none of `person`'s runners has its relay online, the
|
|
497
|
+
* studio keeps the push and tries again when one is back. */
|
|
498
|
+
export type GitRelayPushReply = {
|
|
499
|
+
status: 'pushed';
|
|
500
|
+
sha: string;
|
|
501
|
+
output: string;
|
|
502
|
+
runner: string;
|
|
503
|
+
} | {
|
|
504
|
+
status: 'refused';
|
|
505
|
+
reason: string;
|
|
506
|
+
} | {
|
|
507
|
+
status: 'waiting';
|
|
508
|
+
person: string;
|
|
509
|
+
};
|
|
510
|
+
/** Studio → CLI: stop a process the runner keeps running (`ProcessInfo`,
|
|
511
|
+
* processes.ts), by its id; a person in the code app asks it. The runner
|
|
512
|
+
* ends its process group and reports it with `proc:state`. */
|
|
513
|
+
export interface ProcStopFrame {
|
|
514
|
+
type: 'proc:stop';
|
|
515
|
+
processId: string;
|
|
516
|
+
}
|
|
517
|
+
/** Studio → CLI: start a dev server for a person in the code app (a surface's
|
|
518
|
+
* Dev environment). `root` is the project's checkout and must lie inside one
|
|
519
|
+
* of the runner's folder roots; `cwd` is relative to it (`''` its root) and may
|
|
520
|
+
* not leave it. `command` must be one the runner takes for a dev server and
|
|
521
|
+
* none it blocks. The runner hands it a free port in `PORT` (a dev server that
|
|
522
|
+
* ignores it picks its own, read from its output as always), tracks it under
|
|
523
|
+
* `processId` (`proc:state`, a preview with it) and answers `fs:result` on
|
|
524
|
+
* `requestId`: `ok` once it is spawned, else `error`. `startedBy`: the
|
|
525
|
+
* person's name, on the process as `ProcessInfo.startedBy`. */
|
|
526
|
+
export interface ProcStartFrame {
|
|
527
|
+
type: 'proc:start';
|
|
528
|
+
requestId: string;
|
|
529
|
+
processId: string;
|
|
530
|
+
root: string;
|
|
531
|
+
cwd: string;
|
|
532
|
+
command: string;
|
|
533
|
+
startedBy: string;
|
|
534
|
+
}
|
|
535
|
+
/** Studio → CLI: a preview of a process is open: `url` is a public address
|
|
536
|
+
* that reaches `port` on this machine. The runner opens the tunnel
|
|
537
|
+
* (`/_ws/preview?id=<previewId>&key=<key>`, processes.ts) and serves what
|
|
538
|
+
* comes in from `localhost:<port>` until the preview or the process ends.
|
|
539
|
+
* `requestId` answers the runner's own `preview:request`; null when a person
|
|
540
|
+
* opened it in the code app. */
|
|
541
|
+
export interface PreviewOpenFrame {
|
|
542
|
+
type: 'preview:open';
|
|
543
|
+
requestId: string | null;
|
|
544
|
+
processId: string;
|
|
545
|
+
previewId: string;
|
|
546
|
+
url: string;
|
|
547
|
+
key: string;
|
|
548
|
+
port: number;
|
|
549
|
+
}
|
|
550
|
+
/** Studio → CLI: a preview was closed (by a person, or its process ended):
|
|
551
|
+
* the runner closes its tunnel and does not open it again. */
|
|
552
|
+
export interface PreviewCloseFrame {
|
|
553
|
+
type: 'preview:close';
|
|
554
|
+
previewId: string;
|
|
555
|
+
}
|
|
556
|
+
/** Studio → CLI: no preview for the runner's `preview:request` (`error`
|
|
557
|
+
* says why: previews are off on this studio, the process is unknown or has
|
|
558
|
+
* no port). */
|
|
559
|
+
export interface PreviewRefusedFrame {
|
|
560
|
+
type: 'preview:refused';
|
|
561
|
+
requestId: string;
|
|
562
|
+
error: string;
|
|
563
|
+
}
|
|
564
|
+
/** Studio -> CLI: the live view of the agent browser (runner_browser_*).
|
|
565
|
+
* Mirrors BrowserDispatchFrame in packages/os/os-shared/types/browser-live.ts;
|
|
566
|
+
* @nordhavnhq/runner-browser (src/live.ts) handles them. `input` is a BrowserInput,
|
|
567
|
+
* kept loose here because the runtime does not know the browser tools. */
|
|
568
|
+
export type BrowserDispatchFrame = {
|
|
569
|
+
type: 'browser:list';
|
|
570
|
+
} | {
|
|
571
|
+
type: 'browser:watch';
|
|
572
|
+
sessionId: string;
|
|
573
|
+
} | {
|
|
574
|
+
type: 'browser:unwatch';
|
|
575
|
+
sessionId: string;
|
|
576
|
+
} | {
|
|
577
|
+
type: 'browser:input';
|
|
578
|
+
sessionId: string;
|
|
579
|
+
input: {
|
|
580
|
+
kind: string;
|
|
581
|
+
} & Record<string, unknown>;
|
|
582
|
+
by?: string;
|
|
583
|
+
} | {
|
|
584
|
+
type: 'browser:open';
|
|
585
|
+
requestId: string;
|
|
586
|
+
url?: string;
|
|
587
|
+
profile?: string;
|
|
588
|
+
headed?: boolean;
|
|
589
|
+
viewport?: string;
|
|
590
|
+
byUserId: number;
|
|
591
|
+
by: string;
|
|
592
|
+
};
|
|
593
|
+
export type AgentDispatchFrame = ConnectedFrame | ChatDispatchFrame | TaskDispatchFrame | TaskCancelFrame | TaskSteerFrame | ChatCancelFrame | ChatSteerFrame | ChatSideQuestionFrame | ChatGenerateTitleFrame | RestartFrame | PongFrame | ChatAckFrame | ResultAckFrame | ProgressAckFrame | ErrorFrame | DelegateResultFrame | PresenceUserFrame | HealthPingFrame | LoopProbeFrame | AgentRenamedFrame | FsBrowseFrame | FsMkdirFrame | FsListFrame | FsReadFrame | FsBytesFrame | FsWriteFrame | FsEntryFrame | FsStatusFrame | FsPathsFrame | FsSonarFrame | FsReposFrame | FsBranchesFrame | FsLogFrame | FsShowFrame | FsBlameFrame | FsDiffFrame | FsGitFrame | RelayStatusFrame | RelayConnectFrame | RelayDisconnectFrame | RelayPushFrame | ProcStopFrame | ProcStartFrame | PreviewOpenFrame | PreviewCloseFrame | PreviewRefusedFrame | BrowserDispatchFrame;
|
|
594
|
+
export declare const KNOWN_DISPATCH_TYPES: ReadonlySet<AgentDispatchFrame['type']>;
|
|
595
|
+
export declare function recogniseDispatch(raw: unknown): AgentDispatchFrame | null;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire contract for **Studio -> Agent** WebSocket frames, as the agent runtime
|
|
3
|
+
* reads them.
|
|
4
|
+
*
|
|
5
|
+
* Part of the agent contract (see `version.ts`), copied verbatim into the
|
|
6
|
+
* runner. The studio's Zod schemas in `server/schemas/ws-agent-dispatch.ts`
|
|
7
|
+
* validate what goes out; these are the types the runner (and the studio's own
|
|
8
|
+
* internal runtime) consume. `server/schemas/ws-agent-dispatch.contract.ts`
|
|
9
|
+
* holds the two together at compile time: a field the studio sends that these
|
|
10
|
+
* types do not describe, or one these types promise that the studio does not
|
|
11
|
+
* send, fails the studio's typecheck.
|
|
12
|
+
*
|
|
13
|
+
* No runtime validation here - the studio validates outbound. The runner uses
|
|
14
|
+
* `recogniseDispatch` at the message boundary to drop frames whose `type` it
|
|
15
|
+
* does not know.
|
|
16
|
+
*/
|
|
17
|
+
/** The `features` entry of the runner's `config` frame that says it answers
|
|
18
|
+
* `chat:side-question`. */
|
|
19
|
+
export const SIDE_QUESTION_FEATURE = 'side-question';
|
|
20
|
+
/** The `error` of a side question the runtime holds no context for. */
|
|
21
|
+
export const SIDE_QUESTION_NO_CONTEXT = 'no-context';
|
|
22
|
+
export const KNOWN_DISPATCH_TYPES = new Set([
|
|
23
|
+
'connected',
|
|
24
|
+
'chat',
|
|
25
|
+
'task',
|
|
26
|
+
'task:cancel',
|
|
27
|
+
'task:steer',
|
|
28
|
+
'chat:cancel',
|
|
29
|
+
'chat:steer',
|
|
30
|
+
'chat:side-question',
|
|
31
|
+
'chat:generate-title',
|
|
32
|
+
'restart',
|
|
33
|
+
'pong',
|
|
34
|
+
'chat:ack',
|
|
35
|
+
'result:ack',
|
|
36
|
+
'progress:ack',
|
|
37
|
+
'error',
|
|
38
|
+
'delegate:result',
|
|
39
|
+
'presence:user-online',
|
|
40
|
+
'presence:user-offline',
|
|
41
|
+
'health:ping',
|
|
42
|
+
'loop:probe',
|
|
43
|
+
'agent:renamed',
|
|
44
|
+
'fs:browse',
|
|
45
|
+
'fs:mkdir',
|
|
46
|
+
'fs:list',
|
|
47
|
+
'fs:read',
|
|
48
|
+
'fs:bytes',
|
|
49
|
+
'fs:write',
|
|
50
|
+
'fs:entry',
|
|
51
|
+
'fs:status',
|
|
52
|
+
'fs:paths',
|
|
53
|
+
'fs:sonar',
|
|
54
|
+
'fs:repos',
|
|
55
|
+
'fs:branches',
|
|
56
|
+
'fs:log',
|
|
57
|
+
'fs:show',
|
|
58
|
+
'fs:blame',
|
|
59
|
+
'fs:diff',
|
|
60
|
+
'fs:git',
|
|
61
|
+
'relay:status',
|
|
62
|
+
'relay:connect',
|
|
63
|
+
'relay:disconnect',
|
|
64
|
+
'relay:push',
|
|
65
|
+
'proc:stop',
|
|
66
|
+
'proc:start',
|
|
67
|
+
'preview:open',
|
|
68
|
+
'preview:close',
|
|
69
|
+
'preview:refused',
|
|
70
|
+
'browser:list',
|
|
71
|
+
'browser:watch',
|
|
72
|
+
'browser:unwatch',
|
|
73
|
+
'browser:input',
|
|
74
|
+
'browser:open',
|
|
75
|
+
]);
|
|
76
|
+
export function recogniseDispatch(raw) {
|
|
77
|
+
if (!raw || typeof raw !== 'object')
|
|
78
|
+
return null;
|
|
79
|
+
const type = raw.type;
|
|
80
|
+
if (typeof type !== 'string')
|
|
81
|
+
return null;
|
|
82
|
+
if (!KNOWN_DISPATCH_TYPES.has(type))
|
|
83
|
+
return null;
|
|
84
|
+
return raw;
|
|
85
|
+
}
|