@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
package/bin/cliclick
ADDED
|
Binary file
|
package/dist/brand.d.ts
ADDED
package/dist/brand.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// MIRROR: studio packages/lib/brand/src/brand.ts (@nordhavnhq/brand)
|
|
2
|
+
/**
|
|
3
|
+
* The product's name as people see it on the command line. It is a WORKING
|
|
4
|
+
* NAME, so it lives here and nowhere else in the runner: renaming is this file
|
|
5
|
+
* (and the shared register it mirrors). The runner is published on its own, so
|
|
6
|
+
* it carries a copy instead of importing @nordhavnhq/brand: its build is plain
|
|
7
|
+
* tsc (no bundler), so an import would need that private package at runtime.
|
|
8
|
+
*
|
|
9
|
+
* Internal names that stay: the `nordhavn` binary and the `@nordhavnhq/runner`
|
|
10
|
+
* package, which global installs and the updater look up by that name.
|
|
11
|
+
* Pre-rename `JUSTMADE_*` and `HAVEN_*` variables still work (`legacy-env.ts`).
|
|
12
|
+
*/
|
|
13
|
+
const PRODUCT_NAME = 'Nordhavn OS';
|
|
14
|
+
export const BRAND = {
|
|
15
|
+
name: PRODUCT_NAME,
|
|
16
|
+
/** The agent runner on somebody's machine. */
|
|
17
|
+
runner: `${PRODUCT_NAME} Runner`,
|
|
18
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type CliCtx } from './prompts.js';
|
|
2
|
+
/**
|
|
3
|
+
* `agent add` and `agent relink` are gone: a runner hosts one agent, and
|
|
4
|
+
* `nordhavn link <code>` pairs the machine and connects that agent in one go.
|
|
5
|
+
* Kept as commands that say so, for muscle memory.
|
|
6
|
+
*/
|
|
7
|
+
export declare function removedAgentCommand(): Promise<void>;
|
|
8
|
+
export declare function remove(ctx: CliCtx): Promise<void>;
|
|
9
|
+
export declare function list(ctx: CliCtx): Promise<void>;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { loadConfig, saveConfig, removeAgent, agentHomeDir, agentRef, resolveAgentRef } from '../config.js';
|
|
2
|
+
import { dim, green, red, bold, showHelp, helpOpt, printAmbiguous } from '../utils/format.js';
|
|
3
|
+
import { wantsHelp } from './prompts.js';
|
|
4
|
+
/**
|
|
5
|
+
* `agent add` and `agent relink` are gone: a runner hosts one agent, and
|
|
6
|
+
* `nordhavn link <code>` pairs the machine and connects that agent in one go.
|
|
7
|
+
* Kept as commands that say so, for muscle memory.
|
|
8
|
+
*/
|
|
9
|
+
export async function removedAgentCommand() {
|
|
10
|
+
console.log('');
|
|
11
|
+
console.log(red(' Removed: a runner hosts one agent; run `nordhavn link <code>` with a code from the agent\'s page in the studio.\n'));
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
export async function remove(ctx) {
|
|
15
|
+
if (wantsHelp(ctx)) {
|
|
16
|
+
showHelp('nordhavn agent remove <agent>', 'Remove an agent from config', [helpOpt(dim('<agent>'), 'Agent to remove; use slug@organisation when a slug exists in more than one')], ['nordhavn agent remove atlas', 'nordhavn agent remove atlas@klant-x']);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
console.log('');
|
|
20
|
+
const config = await loadConfig();
|
|
21
|
+
if (!config) {
|
|
22
|
+
console.log(red(' Not configured. Run `nordhavn init` first.\n'));
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
const ref = ctx.subarg;
|
|
26
|
+
if (!ref) {
|
|
27
|
+
console.log(red(' Usage: nordhavn agent remove <agent>\n'));
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
const agent = requireAgent(config, ref);
|
|
31
|
+
const removedRef = agentRef(config, agent);
|
|
32
|
+
const updated = removeAgent(config, agent);
|
|
33
|
+
await saveConfig(updated);
|
|
34
|
+
console.log(green(` ✓ Agent "${removedRef}" removed.`));
|
|
35
|
+
console.log(dim(` ${updated.agents.length} agent(s) remaining.\n`));
|
|
36
|
+
}
|
|
37
|
+
export async function list(ctx) {
|
|
38
|
+
if (wantsHelp(ctx)) {
|
|
39
|
+
showHelp('nordhavn agent ls', 'List all configured agents', [], ['nordhavn agent ls']);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
console.log('');
|
|
43
|
+
const config = await loadConfig();
|
|
44
|
+
if (!config) {
|
|
45
|
+
console.log(red(' Not configured. Run `nordhavn init` first.\n'));
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
if (config.agents.length === 0) {
|
|
49
|
+
console.log(dim(' No agent configured. Run `nordhavn link <code>` with a code from the agent\'s page in the studio.\n'));
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
// Organisation is noise while there is only one pairing, and essential once
|
|
53
|
+
// there are several - so it only appears when it can actually differ.
|
|
54
|
+
const showOrg = config.hosts.length > 1;
|
|
55
|
+
console.log(bold(' Agents\n'));
|
|
56
|
+
for (const agent of config.agents) {
|
|
57
|
+
const state = agent.enabled ? green('●') : dim('○');
|
|
58
|
+
const home = agentHomeDir(config, agent).replace(config.home, '').replace(/^[/\\]/, '');
|
|
59
|
+
const org = showOrg ? dim(` · ${agent.organisationSlug ?? 'unknown organisation'}`) : '';
|
|
60
|
+
console.log(` ${state} ${bold(agentRef(config, agent))} ${dim(`· ${home}/`)}${org}`);
|
|
61
|
+
}
|
|
62
|
+
console.log('');
|
|
63
|
+
console.log(dim(` Home: ${config.home}`));
|
|
64
|
+
console.log(dim(` ${config.agents.length} agent(s) configured.\n`));
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Resolve a user-typed agent reference or exit with a readable error. A bare
|
|
68
|
+
* slug that names several agents is refused rather than guessed at.
|
|
69
|
+
*/
|
|
70
|
+
function requireAgent(config, ref) {
|
|
71
|
+
const found = resolveAgentRef(config, ref);
|
|
72
|
+
if ('agent' in found)
|
|
73
|
+
return found.agent;
|
|
74
|
+
if ('ambiguous' in found) {
|
|
75
|
+
printAmbiguous(config, ref, found.ambiguous);
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
78
|
+
console.log(red(` Agent "${ref}" not found.\n`));
|
|
79
|
+
process.exit(1);
|
|
80
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { existsSync, statSync, readdirSync } from 'node:fs';
|
|
2
|
+
import { resolve, join } from 'node:path';
|
|
3
|
+
import { loadConfig, saveConfig, addProjectsRoot, removeProjectsRoot } from '../config.js';
|
|
4
|
+
import { dim, green, red, bold, cyan, showHelp, helpOpt } from '../utils/format.js';
|
|
5
|
+
import { wantsHelp } from './prompts.js';
|
|
6
|
+
// ─── nordhavn folder <add|rm|ls> ──────
|
|
7
|
+
//
|
|
8
|
+
// Manage the folders on this machine the runner may open projects from - its
|
|
9
|
+
// access scope. For a dispatched project the runner uses `<folder>/<slug>`. The
|
|
10
|
+
// actual project<->folder coupling is done in the studio UI; the CLI only decides
|
|
11
|
+
// which folders the runner is allowed to touch. This is runner scope, not the
|
|
12
|
+
// agent's: the agent still only ever gets its single project folder.
|
|
13
|
+
async function requireConfig() {
|
|
14
|
+
const config = await loadConfig();
|
|
15
|
+
if (!config) {
|
|
16
|
+
console.log(red(' Not configured. Run `nordhavn init` first.\n'));
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
return config;
|
|
20
|
+
}
|
|
21
|
+
/** Print the folders plus which project slugs auto-resolve inside them. */
|
|
22
|
+
function printFolders(config) {
|
|
23
|
+
const folders = config.projectsRoots ?? [];
|
|
24
|
+
console.log(bold('\n Project folders'));
|
|
25
|
+
if (folders.length === 0) {
|
|
26
|
+
console.log(dim(' none - add one with `nordhavn folder add <path>`'));
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
for (const folder of folders) {
|
|
30
|
+
console.log(` ${folder}${existsSync(folder) ? '' : red(' (missing)')}`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
// The project slugs the runner can currently open: a directory in a folder.
|
|
34
|
+
const seen = new Set();
|
|
35
|
+
const rows = [];
|
|
36
|
+
for (const folder of folders) {
|
|
37
|
+
if (!existsSync(folder))
|
|
38
|
+
continue;
|
|
39
|
+
try {
|
|
40
|
+
for (const d of readdirSync(folder, { withFileTypes: true })) {
|
|
41
|
+
if (!d.isDirectory() || d.name.startsWith('.') || seen.has(d.name))
|
|
42
|
+
continue;
|
|
43
|
+
seen.add(d.name);
|
|
44
|
+
rows.push({ slug: d.name, path: join(folder, d.name) });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch { /* unreadable folder - skip */ }
|
|
48
|
+
}
|
|
49
|
+
rows.sort((a, b) => a.slug.localeCompare(b.slug));
|
|
50
|
+
console.log(bold('\n Openable projects (slug = folder name)'));
|
|
51
|
+
if (rows.length === 0) {
|
|
52
|
+
console.log(dim(' none - drop a repo named by its project slug in a folder'));
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
for (const { slug, path } of rows)
|
|
56
|
+
console.log(` ${cyan(slug)} ${dim('->')} ${path}`);
|
|
57
|
+
}
|
|
58
|
+
console.log('');
|
|
59
|
+
console.log(dim(` Agents home: ${config.home}\n`));
|
|
60
|
+
}
|
|
61
|
+
export async function folderCommand(ctx) {
|
|
62
|
+
const action = ctx.resolvedCommand.split(':')[1] ?? 'ls';
|
|
63
|
+
if (action === 'help' || wantsHelp(ctx)) {
|
|
64
|
+
showHelp('nordhavn folder <add|rm|ls> [path]', 'Manage the folders the runner may open projects from', [
|
|
65
|
+
helpOpt(cyan('ls'), 'List folders and the projects they expose'),
|
|
66
|
+
helpOpt(`${cyan('add')} ${dim('<path>')}`, 'Allow the runner to open projects from a folder (e.g. a drive)'),
|
|
67
|
+
helpOpt(`${cyan('rm')} ${dim('<path>')}`, 'Stop opening projects from a folder'),
|
|
68
|
+
], ['nordhavn folder ls', 'nordhavn folder add /Volumes/Drive2/code']);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const config = await requireConfig();
|
|
72
|
+
if (action === 'ls') {
|
|
73
|
+
printFolders(config);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const rawPath = ctx.subarg;
|
|
77
|
+
if (!rawPath) {
|
|
78
|
+
console.log(red(` Usage: nordhavn folder ${action} <path>\n`));
|
|
79
|
+
process.exit(1);
|
|
80
|
+
}
|
|
81
|
+
const path = resolve(rawPath);
|
|
82
|
+
if (action === 'add') {
|
|
83
|
+
if (!existsSync(path) || !statSync(path).isDirectory()) {
|
|
84
|
+
console.log(red(` "${path}" is not a directory.\n`));
|
|
85
|
+
process.exit(1);
|
|
86
|
+
}
|
|
87
|
+
await saveConfig(addProjectsRoot(config, path));
|
|
88
|
+
console.log(green(`\n ✓ Added project folder: ${path}`));
|
|
89
|
+
console.log(dim(' The runner can now open any project whose slug matches a subfolder here.\n'));
|
|
90
|
+
}
|
|
91
|
+
else if (action === 'rm') {
|
|
92
|
+
if (!config.projectsRoots?.includes(path)) {
|
|
93
|
+
console.log(red(` "${path}" is not a project folder.\n`));
|
|
94
|
+
process.exit(1);
|
|
95
|
+
}
|
|
96
|
+
await saveConfig(removeProjectsRoot(config, path));
|
|
97
|
+
console.log(green(`\n ✓ Removed project folder: ${path}\n`));
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
console.log(red(` Unknown action "${action}". Use add, rm or ls.\n`));
|
|
101
|
+
process.exit(1);
|
|
102
|
+
}
|
|
103
|
+
}
|
package/dist/cli/init.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { mkdirSync } from 'node:fs';
|
|
2
|
+
import { homedir } from 'node:os';
|
|
3
|
+
import { join, resolve } from 'node:path';
|
|
4
|
+
import { saveConfig, loadConfig, getConfigPath } from '../config.js';
|
|
5
|
+
import { dim, green, bold, yellow, showHelp } from '../utils/format.js';
|
|
6
|
+
import { profileLabel, isDefaultProfile } from '../paths.js';
|
|
7
|
+
import { ask, wantsHelp } from './prompts.js';
|
|
8
|
+
export async function init(ctx) {
|
|
9
|
+
if (wantsHelp(ctx)) {
|
|
10
|
+
showHelp('nordhavn init', 'Configure this runner (studio URL + agents home)', [], ['nordhavn init']);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
console.log('');
|
|
14
|
+
const profile = profileLabel();
|
|
15
|
+
console.log(bold(' Setup') + (profile ? ' ' + yellow(`(${profile} profile)`) : '') + '\n');
|
|
16
|
+
// Production points at the hosted studio by default; non-prod profiles
|
|
17
|
+
// (e.g. dev) default to a local studio.
|
|
18
|
+
const defaultStudioUrl = isDefaultProfile() ? 'https://os.nordhavn.ai' : 'http://localhost:3000';
|
|
19
|
+
const studioInput = await ask(` Studio URL ${dim(`(${defaultStudioUrl})`)}: `);
|
|
20
|
+
// The **home** root holds each agent's private folder (`<home>/agent_<slug>`) -
|
|
21
|
+
// their own space for things they build for themselves. The repos agents help
|
|
22
|
+
// with live in the project folders below and are coupled to a project in the
|
|
23
|
+
// studio UI, so this is NOT where project work happens.
|
|
24
|
+
const defaultHome = join(homedir(), '.nordhavn-os', 'home');
|
|
25
|
+
const homeInput = await ask(` Agents home folder ${dim(`(${defaultHome})`)}: `);
|
|
26
|
+
const rawHome = homeInput || defaultHome;
|
|
27
|
+
const home = rawHome.startsWith('~')
|
|
28
|
+
? join(homedir(), rawHome.slice(1))
|
|
29
|
+
: resolve(rawHome);
|
|
30
|
+
mkdirSync(home, { recursive: true });
|
|
31
|
+
// Projects folder: a directory holding your project checkouts. The runner
|
|
32
|
+
// offers its subfolders to the studio UI, where you couple one per project.
|
|
33
|
+
// You can add more folders later (e.g. a second drive) with `folder add`.
|
|
34
|
+
const defaultProjectsRoot = join(homedir(), 'projects');
|
|
35
|
+
const projectsRootInput = await ask(` Projects folder ${dim(`(${defaultProjectsRoot})`)}: `);
|
|
36
|
+
const rawProjectsRoot = projectsRootInput || defaultProjectsRoot;
|
|
37
|
+
const projectsRoot = rawProjectsRoot.startsWith('~')
|
|
38
|
+
? join(homedir(), rawProjectsRoot.slice(1))
|
|
39
|
+
: resolve(rawProjectsRoot);
|
|
40
|
+
// Preserve an existing pairing + agents + project folders when re-initialising -
|
|
41
|
+
// `init` only (re)configures studio URL, home, and the first project folder.
|
|
42
|
+
const existing = await loadConfig();
|
|
43
|
+
await saveConfig({
|
|
44
|
+
// Strip any trailing slash so URL building never produces a `//api/...`
|
|
45
|
+
// double slash (the studio 302-redirects that to the SPA HTML).
|
|
46
|
+
studioUrl: (studioInput || defaultStudioUrl).replace(/\/+$/, ''),
|
|
47
|
+
home,
|
|
48
|
+
// Keep any extra folders added later; ensure the one just entered is present.
|
|
49
|
+
projectsRoots: Array.from(new Set([projectsRoot, ...(existing?.projectsRoots ?? [])])),
|
|
50
|
+
// Pairings are set up by `nordhavn link`; re-running `init` never drops
|
|
51
|
+
// them, nor the organisation that owns the flat home layout.
|
|
52
|
+
hosts: existing?.hosts ?? [],
|
|
53
|
+
flatHomeOrg: existing?.flatHomeOrg ?? null,
|
|
54
|
+
agents: existing?.agents ?? [],
|
|
55
|
+
});
|
|
56
|
+
console.log('');
|
|
57
|
+
console.log(green(` ✓ Studio configured.`));
|
|
58
|
+
console.log(dim(` Agents home: ${home}`));
|
|
59
|
+
console.log(dim(` Projects folder: ${projectsRoot}`));
|
|
60
|
+
console.log(dim(` Filesystem: agents are jailed to their project + home`));
|
|
61
|
+
console.log(dim(` Config: ${getConfigPath()}`));
|
|
62
|
+
console.log('');
|
|
63
|
+
console.log(dim(' Next:'));
|
|
64
|
+
console.log(dim(' 1. Generate a code on the agent\'s page in the studio.'));
|
|
65
|
+
console.log(dim(' 2. Run `nordhavn link <code>` to pair this machine and connect that agent.'));
|
|
66
|
+
console.log(dim(' 3. `nordhavn folder add <path>` for each folder with your repos, then couple projects in the studio UI.\n'));
|
|
67
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { loadConfig, agentRef, resolveAgentRef } from '../config.js';
|
|
2
|
+
import { liveStatus, readAllStatuses, isAlive, isStatusAlive, spawnDetachedAgent, } from '../runtime/daemon.js';
|
|
3
|
+
import { dim, green, red, showHelp, helpOpt, printAmbiguous } from '../utils/format.js';
|
|
4
|
+
import { wantsHelp } from './prompts.js';
|
|
5
|
+
function wantsDebug(ctx) {
|
|
6
|
+
return ctx.cmdArgs.includes('--debug') || ctx.cmdArgs.includes('-v');
|
|
7
|
+
}
|
|
8
|
+
/** Other agents driven by the same foreground process `pid`. */
|
|
9
|
+
function foregroundPeers(ref, pid) {
|
|
10
|
+
return readAllStatuses().filter(s => s.ref !== ref && s.pid === pid && isStatusAlive(s));
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Turn a user-typed agent argument into the local ref used for status and log
|
|
14
|
+
* files. `down` and `restart` address running processes, so an entry that only
|
|
15
|
+
* exists as a status file (its config row was removed while it ran) still has
|
|
16
|
+
* to be reachable - hence the fallback to a live status entry.
|
|
17
|
+
*/
|
|
18
|
+
function resolveRefOrExit(config, input) {
|
|
19
|
+
const found = resolveAgentRef(config, input);
|
|
20
|
+
if ('agent' in found)
|
|
21
|
+
return agentRef(config, found.agent);
|
|
22
|
+
if ('ambiguous' in found) {
|
|
23
|
+
printAmbiguous(config, input, found.ambiguous);
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
const running = readAllStatuses().filter(s => s.ref === input || s.slug === input);
|
|
27
|
+
if (running.length === 1)
|
|
28
|
+
return running[0].ref;
|
|
29
|
+
return input;
|
|
30
|
+
}
|
|
31
|
+
async function waitForExit(pid, timeoutMs) {
|
|
32
|
+
const deadline = Date.now() + timeoutMs;
|
|
33
|
+
while (Date.now() < deadline) {
|
|
34
|
+
if (!isAlive(pid))
|
|
35
|
+
return true;
|
|
36
|
+
await new Promise(resolve => setTimeout(resolve, 150));
|
|
37
|
+
}
|
|
38
|
+
return !isAlive(pid);
|
|
39
|
+
}
|
|
40
|
+
export async function down(ctx) {
|
|
41
|
+
if (wantsHelp(ctx)) {
|
|
42
|
+
showHelp('nordhavn down [agent]', 'Bring agent(s) offline', [helpOpt(dim('[agent]'), 'Agent to stop; every running agent if omitted. Use slug@organisation when a slug exists in more than one')], ['nordhavn down', 'nordhavn down atlas', 'nordhavn down atlas@klant-x']);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
console.log('');
|
|
46
|
+
// No slug: terminate every distinct runtime process.
|
|
47
|
+
if (!ctx.subarg) {
|
|
48
|
+
const pids = new Set();
|
|
49
|
+
for (const s of readAllStatuses())
|
|
50
|
+
if (isStatusAlive(s))
|
|
51
|
+
pids.add(s.pid);
|
|
52
|
+
if (pids.size === 0) {
|
|
53
|
+
console.log(dim(' No agents running.\n'));
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
let killed = 0;
|
|
57
|
+
for (const pid of pids) {
|
|
58
|
+
try {
|
|
59
|
+
process.kill(pid, 'SIGTERM');
|
|
60
|
+
killed++;
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
console.log(red(` Failed to signal pid ${pid}: ${err.message}`));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
console.log(green(` ✓ Stopped ${killed} runtime process(es).\n`));
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const config = await loadConfig();
|
|
70
|
+
if (!config) {
|
|
71
|
+
console.log(red(' Not configured. Run `nordhavn init` first.\n'));
|
|
72
|
+
process.exit(1);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const ref = resolveRefOrExit(config, ctx.subarg);
|
|
76
|
+
const live = liveStatus(ref);
|
|
77
|
+
if (!live) {
|
|
78
|
+
console.log(dim(` ${ref} is not running.\n`));
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
// A foreground process can drive several agents - refuse to take the whole
|
|
82
|
+
// session down for one of them; the operator should Ctrl+C it instead.
|
|
83
|
+
if (live.mode === 'foreground') {
|
|
84
|
+
const peers = foregroundPeers(ref, live.pid);
|
|
85
|
+
if (peers.length > 0) {
|
|
86
|
+
console.log(red(` ${ref} runs in a foreground session (pid ${live.pid}) with ${peers.length} other agent(s).`));
|
|
87
|
+
console.log(dim(` Ctrl+C that session, or use \`nordhavn up ${ref} -d\` for per-agent control.\n`));
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
try {
|
|
92
|
+
process.kill(live.pid, 'SIGTERM');
|
|
93
|
+
console.log(green(` ✓ ${ref} stopped ${dim(`(pid ${live.pid})`)}\n`));
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
console.log(red(` Failed to stop ${ref}: ${err.message}\n`));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
export async function restart(ctx) {
|
|
100
|
+
if (wantsHelp(ctx)) {
|
|
101
|
+
showHelp('nordhavn restart [agent]', 'Restart agent(s) in the background', [helpOpt(dim('[agent]'), 'Agent to restart; every running agent if omitted. Use slug@organisation when a slug exists in more than one')], ['nordhavn restart atlas', 'nordhavn restart atlas@klant-x', 'nordhavn restart']);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
console.log('');
|
|
105
|
+
const config = await loadConfig();
|
|
106
|
+
if (!config) {
|
|
107
|
+
console.log(red(' Not configured. Run `nordhavn init` first.\n'));
|
|
108
|
+
process.exit(1);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const targets = ctx.subarg
|
|
112
|
+
? [resolveRefOrExit(config, ctx.subarg)]
|
|
113
|
+
: readAllStatuses().filter(s => isStatusAlive(s)).map(s => s.ref);
|
|
114
|
+
if (targets.length === 0) {
|
|
115
|
+
console.log(dim(' No agents to restart.\n'));
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const knownRefs = new Set(config.agents.map(a => agentRef(config, a)));
|
|
119
|
+
const debug = wantsDebug(ctx);
|
|
120
|
+
for (const ref of targets) {
|
|
121
|
+
if (!knownRefs.has(ref)) {
|
|
122
|
+
console.log(red(` Agent "${ref}" not found.`));
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
const live = liveStatus(ref);
|
|
126
|
+
if (live) {
|
|
127
|
+
if (live.mode === 'foreground' && foregroundPeers(ref, live.pid).length > 0) {
|
|
128
|
+
console.log(red(` ${ref} runs in a shared foreground session - stop that session manually.`));
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
try {
|
|
132
|
+
process.kill(live.pid, 'SIGTERM');
|
|
133
|
+
}
|
|
134
|
+
catch { /* already gone */ }
|
|
135
|
+
if (!await waitForExit(live.pid, 5000)) {
|
|
136
|
+
console.log(red(` ${ref} did not stop within 5s - skipped.`));
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
try {
|
|
141
|
+
const pid = spawnDetachedAgent(ref, debug);
|
|
142
|
+
console.log(green(` ✓ ${ref} restarted ${dim(`(pid ${pid})`)}`));
|
|
143
|
+
}
|
|
144
|
+
catch (err) {
|
|
145
|
+
console.log(red(` Failed to restart ${ref}: ${err.message}`));
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
console.log('');
|
|
149
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type CliCtx } from './prompts.js';
|
|
2
|
+
/**
|
|
3
|
+
* Redeem a code from an agent's page in the studio and make this machine that
|
|
4
|
+
* agent's runner: one command pairs the machine AND connects its agent.
|
|
5
|
+
*
|
|
6
|
+
* A runner hosts one agent, with one pairing: the one of its agent's
|
|
7
|
+
* organisation. The code names the agent, so `link` simply makes this runner
|
|
8
|
+
* that agent - whatever agent or organisation it hosted before is replaced,
|
|
9
|
+
* and says so. A code for the agent already hosted here rotates both its host
|
|
10
|
+
* token and its agent token ("re-link").
|
|
11
|
+
*
|
|
12
|
+
* The studio rotates this machine's existing host row when it can (see
|
|
13
|
+
* `pairingProofs`), so its project<->folder mapping survives and no dead row is
|
|
14
|
+
* left behind holding a token that still works. A previous row that was
|
|
15
|
+
* revoked meanwhile still yields a new row - which the output then says out
|
|
16
|
+
* loud. What is shared across re-links is deliberate - `home` and
|
|
17
|
+
* `projectsRoots` describe this machine, not an organisation.
|
|
18
|
+
*/
|
|
19
|
+
export declare function link(ctx: CliCtx): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Remove a pairing and every agent that belongs to it - the inverse of `link`,
|
|
22
|
+
* for a client whose work is finished or a studio this machine should no longer
|
|
23
|
+
* answer to.
|
|
24
|
+
*
|
|
25
|
+
* Refuses while any of the organisation's agents are still running. Their host
|
|
26
|
+
* token disappears with the pairing, so the process would keep spinning on a
|
|
27
|
+
* connection it can no longer make instead of failing where the operator can
|
|
28
|
+
* see it. Stopping them from here is tempting but wrong: a foreground session
|
|
29
|
+
* can drive agents from several organisations at once, and killing it would
|
|
30
|
+
* take the others down too - which is exactly why `down` refuses that case as
|
|
31
|
+
* well.
|
|
32
|
+
*
|
|
33
|
+
* The studio-side `Runner` row is left alone: there is no local endpoint to
|
|
34
|
+
* revoke it, and unlike a re-pair there is no code being redeemed that could
|
|
35
|
+
* carry the proof of ownership along (see `pairingProofs`), so this says
|
|
36
|
+
* so rather than pretending the machine is gone from the organisation.
|
|
37
|
+
*
|
|
38
|
+
* Agent home directories are left on disk, matching `agent remove`. That is why
|
|
39
|
+
* `flatHomeOrg` is not cleared here - see `removePairing` and
|
|
40
|
+
* `canClaimFlatHome` for how the flat layout is protected afterwards.
|
|
41
|
+
*/
|
|
42
|
+
export declare function unlink(ctx: CliCtx): Promise<void>;
|