hivedesk 0.0.0-stage → 0.1.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/CHANGELOG.md +38 -0
- package/FIRST-RUN.md +108 -0
- package/LICENSE +21 -0
- package/PROTOCOL.md +363 -0
- package/README.md +188 -2
- package/assets/banner.png +0 -0
- package/assets/banner.svg +513 -0
- package/assets/crew/designer.svg +42 -0
- package/assets/crew/dev.svg +43 -0
- package/assets/crew/mel.svg +44 -0
- package/assets/crew/qa.svg +43 -0
- package/assets/crew/writer.svg +40 -0
- package/assets/icons/approval.svg +1 -0
- package/assets/icons/arrow.svg +1 -0
- package/assets/icons/chat.svg +1 -0
- package/assets/icons/check.svg +1 -0
- package/assets/icons/clock.svg +1 -0
- package/assets/icons/code.svg +1 -0
- package/assets/icons/compass.svg +1 -0
- package/assets/icons/contact-sheet.svg +1 -0
- package/assets/icons/copy.svg +1 -0
- package/assets/icons/cpu.svg +1 -0
- package/assets/icons/design.svg +1 -0
- package/assets/icons/download.svg +1 -0
- package/assets/icons/folder.svg +1 -0
- package/assets/icons/github-honey.svg +1 -0
- package/assets/icons/github.svg +1 -0
- package/assets/icons/globe.svg +1 -0
- package/assets/icons/gpu.svg +1 -0
- package/assets/icons/hire.svg +1 -0
- package/assets/icons/hive.svg +1 -0
- package/assets/icons/key.svg +1 -0
- package/assets/icons/lend.svg +1 -0
- package/assets/icons/linkedin-honey.svg +1 -0
- package/assets/icons/linkedin.svg +1 -0
- package/assets/icons/linux.svg +1 -0
- package/assets/icons/lock.svg +1 -0
- package/assets/icons/macos.svg +1 -0
- package/assets/icons/model.svg +1 -0
- package/assets/icons/npm.svg +1 -0
- package/assets/icons/office.svg +1 -0
- package/assets/icons/offline.svg +1 -0
- package/assets/icons/plan.svg +1 -0
- package/assets/icons/playbook.svg +1 -0
- package/assets/icons/preview.svg +1 -0
- package/assets/icons/qa.svg +1 -0
- package/assets/icons/queue.svg +1 -0
- package/assets/icons/replay.svg +1 -0
- package/assets/icons/sparkle.svg +1 -0
- package/assets/icons/sprite.svg +45 -0
- package/assets/icons/star.svg +1 -0
- package/assets/icons/stop.svg +1 -0
- package/assets/icons/tag.svg +1 -0
- package/assets/icons/terminal.svg +1 -0
- package/assets/icons/wand.svg +1 -0
- package/assets/icons/windows.svg +1 -0
- package/assets/icons/words.svg +1 -0
- package/assets/icons/writer.svg +1 -0
- package/assets/icons/x.svg +1 -0
- package/assets/illustrations/bee.svg +27 -0
- package/assets/illustrations/crew.svg +248 -0
- package/assets/illustrations/first-run.svg +48 -0
- package/assets/illustrations/hardware.svg +39 -0
- package/assets/illustrations/lend.svg +67 -0
- package/assets/illustrations/privacy.svg +39 -0
- package/assets/logo.svg +13 -0
- package/assets/mascot-dark.svg +197 -0
- package/assets/mascot.png +0 -0
- package/assets/mascot.svg +194 -0
- package/assets/mel-wave.svg +205 -0
- package/assets/og.svg +255 -0
- package/assets/social-preview.png +0 -0
- package/assets/social-preview.svg +255 -0
- package/desktop/README.md +230 -0
- package/desktop/app/resources/icons/appIcon.png +0 -0
- package/desktop/app/resources/icons/trayIcon.png +0 -0
- package/desktop/app/resources/icons/trayIcon@2x.png +0 -0
- package/desktop/browser.js +64 -0
- package/desktop/controller.js +405 -0
- package/desktop/detect.js +79 -0
- package/desktop/i18n.json +462 -0
- package/desktop/icons/hivedesk.icns +0 -0
- package/desktop/icons/hivedesk.ico +0 -0
- package/desktop/icons/icon-512.png +0 -0
- package/desktop/icons/icon.svg +27 -0
- package/desktop/icons/tray.svg +9 -0
- package/desktop/index.js +44 -0
- package/desktop/instance.js +94 -0
- package/desktop/launcher/linux/AppRun +5 -0
- package/desktop/launcher/linux/hivedesk +11 -0
- package/desktop/launcher/linux/hivedesk.desktop +9 -0
- package/desktop/launcher/macos/Info.plist +19 -0
- package/desktop/launcher/macos/hivedesk +23 -0
- package/desktop/launcher/windows/Launcher.cs +103 -0
- package/desktop/main.js +63 -0
- package/desktop/native.js +153 -0
- package/desktop/platform.js +74 -0
- package/desktop/runtime.js +109 -0
- package/desktop/scripts/fetch-node.mjs +42 -0
- package/desktop/scripts/icons.mjs +65 -0
- package/desktop/scripts/package.mjs +117 -0
- package/desktop/scripts/runtime-assets.mjs +32 -0
- package/desktop/scripts/smoke.mjs +63 -0
- package/desktop/shell.html +221 -0
- package/desktop/state.js +100 -0
- package/desktop/strings.js +74 -0
- package/desktop/wsclient.js +99 -0
- package/desktop/zip.js +38 -0
- package/extensions/pomodoro/hivedesk-extension.json +17 -0
- package/extensions/pomodoro/widget.css +17 -0
- package/extensions/pomodoro/widget.html +26 -0
- package/extensions/pomodoro/widget.js +68 -0
- package/extensions/seo-check/hivedesk-extension.json +31 -0
- package/extensions/seo-check/main.js +20 -0
- package/extensions/seo-check/rules.js +44 -0
- package/extensions/seo-check/widget.css +17 -0
- package/extensions/seo-check/widget.html +20 -0
- package/extensions/seo-check/widget.js +42 -0
- package/extensions/tradutor/hivedesk-extension.json +34 -0
- package/i18n/README.pt-BR.md +170 -0
- package/i18n/de.json +2082 -0
- package/i18n/en.json +2082 -0
- package/i18n/es.json +2082 -0
- package/i18n/fr.json +2082 -0
- package/i18n/index.js +165 -0
- package/i18n/it.json +2082 -0
- package/i18n/ja.json +2082 -0
- package/i18n/ko.json +2082 -0
- package/i18n/pt-BR.json +2082 -0
- package/i18n/ru.json +2082 -0
- package/i18n/zh-CN.json +2082 -0
- package/package.json +66 -4
- package/src/brain/cloud.js +294 -0
- package/src/brain/fake.js +58 -0
- package/src/brain/hardware.js +66 -0
- package/src/brain/http.js +169 -0
- package/src/brain/keys.js +65 -0
- package/src/brain/local.js +166 -0
- package/src/brain/manager.js +459 -0
- package/src/brain/models.js +230 -0
- package/src/brain/relay.js +94 -0
- package/src/brain/runtime.js +120 -0
- package/src/brain/schema.js +124 -0
- package/src/brain/types.js +69 -0
- package/src/bus.js +131 -0
- package/src/changelog/activity.js +131 -0
- package/src/changelog/index.js +148 -0
- package/src/changelog/keepachangelog.js +243 -0
- package/src/changelog/mel.js +22 -0
- package/src/changelog/report.js +223 -0
- package/src/cli.js +285 -0
- package/src/collab/index.js +43 -0
- package/src/crew/brief.js +180 -0
- package/src/crew/engine.js +658 -0
- package/src/crew/memory.js +35 -0
- package/src/crew/planner.js +166 -0
- package/src/crew/prompts/index.js +228 -0
- package/src/crew/prompts/roles.js +45 -0
- package/src/crew/scheduler.js +229 -0
- package/src/crew/taskgraph.js +87 -0
- package/src/crew/worker.js +300 -0
- package/src/crew/workers.js +56 -0
- package/src/demo.js +224 -0
- package/src/doctor.js +69 -0
- package/src/extensions/create.js +171 -0
- package/src/extensions/engine-hook.js +41 -0
- package/src/extensions/host.js +608 -0
- package/src/extensions/index.js +117 -0
- package/src/extensions/intent.js +46 -0
- package/src/extensions/manifest.js +206 -0
- package/src/extensions/sandbox-child.js +102 -0
- package/src/extensions/sandbox.js +141 -0
- package/src/extensions/themes.js +113 -0
- package/src/extensions/zip.js +98 -0
- package/src/github/api.js +176 -0
- package/src/github/git.js +265 -0
- package/src/github/index.js +715 -0
- package/src/github/intent.js +156 -0
- package/src/github/store.js +78 -0
- package/src/index.js +127 -0
- package/src/lend/guard.js +76 -0
- package/src/lend/index.js +100 -0
- package/src/memory/index.js +207 -0
- package/src/playbooks/index.js +111 -0
- package/src/replay/index.js +36 -0
- package/src/replay/reduce.js +275 -0
- package/src/server.js +490 -0
- package/src/tools/approvals.js +62 -0
- package/src/tools/check.js +107 -0
- package/src/tools/diff.js +100 -0
- package/src/tools/index.js +200 -0
- package/src/tools/run.js +142 -0
- package/src/tools/workspace.js +146 -0
- package/src/wizard/config.js +26 -0
- package/src/wizard/core.js +300 -0
- package/src/wizard/i18n.js +108 -0
- package/src/wizard/index.js +51 -0
- package/src/wizard/tty.js +165 -0
- package/src/ws.js +320 -0
- package/themes/alto-contraste.hivedesk-theme.json +52 -0
- package/themes/colmeia-clara.hivedesk-theme.json +51 -0
- package/themes/floresta.hivedesk-theme.json +51 -0
- package/themes/meia-noite.hivedesk-theme.json +51 -0
- package/themes/mel.hivedesk-theme.json +51 -0
- package/themes/neon.hivedesk-theme.json +51 -0
- package/themes/papel.hivedesk-theme.json +51 -0
- package/themes/pixel.hivedesk-theme.json +51 -0
- package/ui/changelog/changelog.css +37 -0
- package/ui/changelog/index.js +211 -0
- package/ui/changelog/markdown.js +54 -0
- package/ui/css/hive.css +804 -0
- package/ui/css/polish.css +282 -0
- package/ui/editor/code-window.js +804 -0
- package/ui/editor/editor.css +152 -0
- package/ui/editor/languages.js +54 -0
- package/ui/editor/linediff.js +82 -0
- package/ui/editor/monaco.js +94 -0
- package/ui/editor/register.js +183 -0
- package/ui/editor/vs/LICENSE +21 -0
- package/ui/editor/vs/ThirdPartyNotices.txt +448 -0
- package/ui/editor/vs/VENDORED.txt +42 -0
- package/ui/editor/vs/base/browser/ui/codicons/codicon/codicon.ttf +0 -0
- package/ui/editor/vs/base/worker/workerMain.js +31 -0
- package/ui/editor/vs/basic-languages/bat/bat.js +10 -0
- package/ui/editor/vs/basic-languages/cpp/cpp.js +10 -0
- package/ui/editor/vs/basic-languages/csharp/csharp.js +10 -0
- package/ui/editor/vs/basic-languages/css/css.js +12 -0
- package/ui/editor/vs/basic-languages/dart/dart.js +10 -0
- package/ui/editor/vs/basic-languages/dockerfile/dockerfile.js +10 -0
- package/ui/editor/vs/basic-languages/go/go.js +10 -0
- package/ui/editor/vs/basic-languages/graphql/graphql.js +10 -0
- package/ui/editor/vs/basic-languages/handlebars/handlebars.js +10 -0
- package/ui/editor/vs/basic-languages/html/html.js +10 -0
- package/ui/editor/vs/basic-languages/ini/ini.js +10 -0
- package/ui/editor/vs/basic-languages/java/java.js +10 -0
- package/ui/editor/vs/basic-languages/javascript/javascript.js +10 -0
- package/ui/editor/vs/basic-languages/kotlin/kotlin.js +10 -0
- package/ui/editor/vs/basic-languages/less/less.js +11 -0
- package/ui/editor/vs/basic-languages/lua/lua.js +10 -0
- package/ui/editor/vs/basic-languages/markdown/markdown.js +10 -0
- package/ui/editor/vs/basic-languages/perl/perl.js +10 -0
- package/ui/editor/vs/basic-languages/php/php.js +10 -0
- package/ui/editor/vs/basic-languages/powershell/powershell.js +10 -0
- package/ui/editor/vs/basic-languages/pug/pug.js +10 -0
- package/ui/editor/vs/basic-languages/python/python.js +10 -0
- package/ui/editor/vs/basic-languages/r/r.js +10 -0
- package/ui/editor/vs/basic-languages/ruby/ruby.js +10 -0
- package/ui/editor/vs/basic-languages/rust/rust.js +10 -0
- package/ui/editor/vs/basic-languages/scala/scala.js +10 -0
- package/ui/editor/vs/basic-languages/scss/scss.js +12 -0
- package/ui/editor/vs/basic-languages/shell/shell.js +10 -0
- package/ui/editor/vs/basic-languages/sql/sql.js +10 -0
- package/ui/editor/vs/basic-languages/swift/swift.js +13 -0
- package/ui/editor/vs/basic-languages/typescript/typescript.js +10 -0
- package/ui/editor/vs/basic-languages/xml/xml.js +10 -0
- package/ui/editor/vs/basic-languages/yaml/yaml.js +10 -0
- package/ui/editor/vs/editor/editor.main.css +8 -0
- package/ui/editor/vs/editor/editor.main.js +798 -0
- package/ui/editor/vs/language/css/cssMode.js +13 -0
- package/ui/editor/vs/language/css/cssWorker.js +77 -0
- package/ui/editor/vs/language/html/htmlMode.js +13 -0
- package/ui/editor/vs/language/html/htmlWorker.js +454 -0
- package/ui/editor/vs/language/json/jsonMode.js +19 -0
- package/ui/editor/vs/language/json/jsonWorker.js +42 -0
- package/ui/editor/vs/language/typescript/tsMode.js +10 -0
- package/ui/editor/vs/loader.js +11 -0
- package/ui/extensions/bridge.js +151 -0
- package/ui/extensions/index.js +415 -0
- package/ui/extensions/strings.js +245 -0
- package/ui/favicon.svg +1 -0
- package/ui/github/confirm.js +114 -0
- package/ui/github/github.css +73 -0
- package/ui/github/index.js +346 -0
- package/ui/github/strings/de.json +245 -0
- package/ui/github/strings/en.json +245 -0
- package/ui/github/strings/es.json +245 -0
- package/ui/github/strings/fr.json +245 -0
- package/ui/github/strings/it.json +245 -0
- package/ui/github/strings/ja.json +245 -0
- package/ui/github/strings/ko.json +245 -0
- package/ui/github/strings/pt-BR.json +245 -0
- package/ui/github/strings/ru.json +245 -0
- package/ui/github/strings/zh-CN.json +245 -0
- package/ui/github/t.js +36 -0
- package/ui/index.html +97 -0
- package/ui/js/about.js +38 -0
- package/ui/js/actions.js +64 -0
- package/ui/js/bees.js +176 -0
- package/ui/js/brainstate.js +49 -0
- package/ui/js/dialog.js +50 -0
- package/ui/js/diff.js +47 -0
- package/ui/js/dock.js +139 -0
- package/ui/js/dom.js +142 -0
- package/ui/js/fx.js +91 -0
- package/ui/js/help.js +72 -0
- package/ui/js/highlight.js +142 -0
- package/ui/js/hive.js +33 -0
- package/ui/js/i18n.js +170 -0
- package/ui/js/main.js +323 -0
- package/ui/js/menu.js +238 -0
- package/ui/js/net.js +174 -0
- package/ui/js/notify.js +98 -0
- package/ui/js/palette.js +159 -0
- package/ui/js/sound.js +76 -0
- package/ui/js/store.js +271 -0
- package/ui/js/tooltip.js +200 -0
- package/ui/js/topbar.js +193 -0
- package/ui/js/tour.js +248 -0
- package/ui/js/voice/index.js +323 -0
- package/ui/js/voice/intents.js +106 -0
- package/ui/js/voice/listener.js +67 -0
- package/ui/js/voice/session.js +147 -0
- package/ui/js/widgets/approvals.js +64 -0
- package/ui/js/widgets/brief.js +170 -0
- package/ui/js/widgets/chat.js +151 -0
- package/ui/js/widgets/files.js +219 -0
- package/ui/js/widgets/hire.js +121 -0
- package/ui/js/widgets/lend.js +73 -0
- package/ui/js/widgets/memory.js +109 -0
- package/ui/js/widgets/playbooks.js +79 -0
- package/ui/js/widgets/preview.js +86 -0
- package/ui/js/widgets/prompts.js +56 -0
- package/ui/js/widgets/providers.js +100 -0
- package/ui/js/widgets/replay.js +177 -0
- package/ui/js/widgets/runlog.js +87 -0
- package/ui/js/widgets/settings.js +284 -0
- package/ui/js/widgets/timeline.js +141 -0
- package/ui/js/widgets/util.js +51 -0
- package/ui/js/widgets/worker.js +135 -0
- package/ui/js/wm.js +539 -0
- package/ui/lend/collab/client.js +394 -0
- package/ui/lend/collab/crdt.js +275 -0
- package/ui/lend/collab/docs.js +136 -0
- package/ui/lend/collab/frames.js +127 -0
- package/ui/lend/collab/panel.js +227 -0
- package/ui/lend/collab/roles.js +65 -0
- package/ui/lend/collab/session.js +401 -0
- package/ui/lend/core/bridge.js +209 -0
- package/ui/lend/core/bytes.js +99 -0
- package/ui/lend/core/emitter.js +25 -0
- package/ui/lend/core/frames.js +171 -0
- package/ui/lend/core/link.js +32 -0
- package/ui/lend/core/mqtt.js +219 -0
- package/ui/lend/core/pairing.js +144 -0
- package/ui/lend/core/paste.js +34 -0
- package/ui/lend/core/qr.js +382 -0
- package/ui/lend/core/ratelimit.js +50 -0
- package/ui/lend/core/relay.js +89 -0
- package/ui/lend/core/rendezvous.js +73 -0
- package/ui/lend/core/rtc.js +172 -0
- package/ui/lend/core/session.js +254 -0
- package/ui/lend/core/sha256.js +151 -0
- package/ui/lend/core/wordlist.js +135 -0
- package/ui/lend/core/words.js +129 -0
- package/ui/lend/hive.js +99 -0
- package/ui/lend/index.html +21 -0
- package/ui/lend/index.js +108 -0
- package/ui/lend/join-window.js +251 -0
- package/ui/lend/lend-screen.js +210 -0
- package/ui/lend/lend.css +246 -0
- package/ui/lend/text.js +82 -0
- package/ui/lend/view.js +237 -0
- package/ui/manifest.webmanifest +13 -0
- package/ui/office/audio.js +194 -0
- package/ui/office/office.css +166 -0
- package/ui/office/office.js +568 -0
- package/ui/office/popout.js +46 -0
- package/ui/office/scene.js +1843 -0
- package/ui/offline.html +28 -0
- package/ui/pwa.js +5 -0
- package/ui/screenshots/hive-1440-de.png +0 -0
- package/ui/screenshots/hive-1440-ja.png +0 -0
- package/ui/screenshots/hive-1440-job-running.png +0 -0
- package/ui/screenshots/hive-1440-model-download.png +0 -0
- package/ui/screenshots/hive-1440-pt-BR.png +0 -0
- package/ui/screenshots/hive-1440-tooltip.png +0 -0
- package/ui/screenshots/hive-1440-tour-step1.png +0 -0
- package/ui/screenshots/hive-1440-tour-step5.png +0 -0
- package/ui/screenshots/hive-1920-context-menu.png +0 -0
- package/ui/screenshots/hive-1920-desktop-menu.png +0 -0
- package/ui/screenshots/hive-1920-hire.png +0 -0
- package/ui/screenshots/hive-1920-job-running.png +0 -0
- package/ui/screenshots/hive-1920-palette.png +0 -0
- package/ui/screenshots/hive-1920-replay.png +0 -0
- package/ui/screenshots/hive-375-phone.png +0 -0
- package/ui/screenshots/office-1440-approval.png +0 -0
- package/ui/screenshots/office-1440-celebrate.png +0 -0
- package/ui/screenshots/office-1440-working.png +0 -0
- package/ui/screenshots/office-1920-approval.png +0 -0
- package/ui/screenshots/office-1920-celebrate.png +0 -0
- package/ui/screenshots/office-1920-working.png +0 -0
- package/ui/screenshots/office-widget.png +0 -0
- package/ui/sw.js +25 -0
- package/ui/themes/core.js +413 -0
- package/ui/themes/index.js +497 -0
- package/ui/themes/sounds.js +61 -0
- package/ui/themes/themes.css +156 -0
- package/ui/vendor/monsoon-0.2.0.min.css +1 -0
- package/ui/vendor/voodoo-1.0.0.full.min.js +1799 -0
- package/ui/widget.css +57 -0
- package/ui/widget.html +38 -0
- package/ui/widget.js +144 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0 (2026-10-17)
|
|
4
|
+
|
|
5
|
+
First release.
|
|
6
|
+
|
|
7
|
+
### Start
|
|
8
|
+
|
|
9
|
+
* `npx hivedesk` asks a few questions in a terminal wizard (language, folder, brain, download, working mode, crew), each with a recommended default; later runs ask only "Use the same setup?". `--yes`, or no terminal, skips the questions. See FIRST-RUN.md.
|
|
10
|
+
* The model is chosen from the hardware (Qwen2.5-Coder 0.5B to 14B, Q4_K_M) and the reason is shown in one line. Free disk and free RAM are checked first; the runtime (node-llama-cpp) is installed into `~/.hivedesk` on first use; the download resumes and is checked against its SHA-256.
|
|
11
|
+
* Loading is GPU first: as many layers as fit next to the context, no memory map on the GPU (0.45 GB resident for the 3B instead of 2.4 GB), a refusal to load when free RAM is short, and the 1.5B on the CPU when the GPU cannot take the model.
|
|
12
|
+
* Ollama, LM Studio, and cloud providers with your own key (Anthropic, OpenAI, xAI, Google Gemini, any OpenAI compatible endpoint) work behind the same brain interface. Keys stay in `~/.hivedesk/keys.json`; the browser only sees "configured". A brain can be chosen per worker; tokens are counted per brain.
|
|
13
|
+
* hivedesk opens as a native desktop window (from `desktop/`), as an app style browser window, or in the browser; the desktop is installable as an app and shows a "start hivedesk" page when the server is not running.
|
|
14
|
+
* `--demo` runs a scripted job with no model; every event is labeled as a demo. `--doctor` checks Node, the GPU, RAM, disk and the models present.
|
|
15
|
+
|
|
16
|
+
### The crew
|
|
17
|
+
|
|
18
|
+
* Mel, Dev, Designer, QA and Writer, plus workers you hire with a role, a color and a list of tools.
|
|
19
|
+
* The prompt refiner: Mel turns the request into a brief (goal, files and features, constraints, acceptance criteria, open questions with defaults). Vague requests get up to 3 multiple choice questions. The job waits until you use the brief, edit it or keep your own words.
|
|
20
|
+
* The loop: brief, plan, task graph, workers taking turns on one model through a fair scheduler, tools, QA against the acceptance criteria with findings by severity, at most 3 fix rounds, done.
|
|
21
|
+
* Quality for small local models: one task per worker, read before edit, small search and replace patches, checks after every change, "done" checked against the checks, a short scratchpad of decisions, loops stopped by Mel.
|
|
22
|
+
* Every model call is assembled from tagged sections (role, objective, context, tools, rules, process, output) within a token budget per model family; the Prompts window shows the exact prompt, the answer and the budget of each turn.
|
|
23
|
+
* At the end, a report (what was built, files, checks, what is missing) and an improved prompt with 2 or 3 next prompts, copyable and savable as a playbook.
|
|
24
|
+
* Every tool call is a JSON action checked by a schema; the local model is grammar constrained.
|
|
25
|
+
* Workspace tools: list, read, write, edit, delete, run (allow list, timeout, output cap, Node permission flags when available), static checks and preview.
|
|
26
|
+
* Approval mode (on by default) for commands, deletes and changes to files that existed before the job. Task retry, reassign and cancel, and pausing a worker.
|
|
27
|
+
|
|
28
|
+
### Memory and history
|
|
29
|
+
|
|
30
|
+
* Local memory: project facts, decisions, preferences and session summaries, small and capped, in `.hivedesk/memory.json` and `~/.hivedesk/memory.json`, with search, pin, edit, delete, "forget this" and an off switch.
|
|
31
|
+
* One session file per job in `.hivedesk/sessions/`; any session can be reopened and continued.
|
|
32
|
+
* Playbooks: a job that ends well is saved and reused for similar requests.
|
|
33
|
+
* Replay: `events.jsonl` is the source of truth; any moment can be rebuilt.
|
|
34
|
+
|
|
35
|
+
### Other
|
|
36
|
+
|
|
37
|
+
* Lend your PC: a paired friend's model can take turns for your crew (see the README).
|
|
38
|
+
* The protocol for the UI and plug-ins is in PROTOCOL.md.
|
package/FIRST-RUN.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# What `npx hivedesk` does on the first run
|
|
2
|
+
|
|
3
|
+
This is the exact behavior of the engine. The README and the site quote it.
|
|
4
|
+
|
|
5
|
+
## 1. The setup wizard (terminal)
|
|
6
|
+
|
|
7
|
+
`npx hivedesk` in a terminal starts a short wizard. Every question has a recommended default, so pressing Enter all the way works. Arrows move, Space ticks, Enter confirms, Ctrl+C quits.
|
|
8
|
+
|
|
9
|
+
1. **Welcome:** Mel's header and one line on what hivedesk does.
|
|
10
|
+
2. **Language:** Português or English, preselected from the OS locale. This is the language of the wizard; the desktop has its own language menu.
|
|
11
|
+
3. **Project folder:** this folder, or type a path. Files go to `<folder>/.hivedesk/`.
|
|
12
|
+
4. **Brain:** first the detected hardware (GPU and VRAM, RAM, free disk), then the options:
|
|
13
|
+
* the recommended local model from the table below, with its size and the reason (tagged "recommended");
|
|
14
|
+
* the other local sizes;
|
|
15
|
+
* Ollama or LM Studio, when one is running on this machine (then it is the recommended choice);
|
|
16
|
+
* a cloud provider with your own API key: Anthropic, OpenAI, xAI, Google Gemini, or any OpenAI compatible endpoint (OpenRouter, Groq, Mistral, a local server). The key is typed hidden, saved only in `~/.hivedesk/keys.json`, and a tiny test call says OK or shows the error;
|
|
17
|
+
* demo mode, with no model (a scripted crew to look around).
|
|
18
|
+
5. **Download:** for a local model that is not downloaded yet, the size, the source (Hugging Face, Qwen) and the destination, then "Download it now?" (Enter is yes). Saying no goes back to step 4.
|
|
19
|
+
6. **Working mode:** approve each risky step (recommended) or automatic.
|
|
20
|
+
7. **Crew:** the default crew (Mel, Dev, Designer, QA, Writer) or pick the roles with a checkbox list.
|
|
21
|
+
8. **Summary**, then "Open hivedesk now?" and "Open as an app (its own window)?" (both default to yes).
|
|
22
|
+
|
|
23
|
+
The answers are saved in `~/.hivedesk/config.json` (never the API key). On later runs the wizard asks only "Use the same setup as last time?"; answering no runs the full wizard with the old answers as defaults.
|
|
24
|
+
|
|
25
|
+
When the wizard does not run:
|
|
26
|
+
|
|
27
|
+
| Case | What happens |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| `--yes` | no questions: the saved setup, or the recommended defaults below |
|
|
30
|
+
| no terminal (a script, CI) | the same as `--yes` |
|
|
31
|
+
| `--demo`, `--model`, `--brain`, `--lend`, `--join` | those flags decide, no wizard |
|
|
32
|
+
|
|
33
|
+
## 2. The model, chosen by the hardware
|
|
34
|
+
|
|
35
|
+
Free disk and free RAM are checked first. All models are Qwen2.5-Coder Instruct, Q4_K_M, from the official Qwen repositories on Hugging Face:
|
|
36
|
+
|
|
37
|
+
| Hardware | Model | Download | Runs on |
|
|
38
|
+
| --- | --- | --- | --- |
|
|
39
|
+
| GPU with 10 GB of VRAM or more | 14B | 9.0 GB | GPU |
|
|
40
|
+
| GPU with 7 to 10 GB of VRAM | 7B | 4.7 GB | GPU |
|
|
41
|
+
| GPU with 4 to 7 GB of VRAM (for example a GTX 1060 6 GB) | 3B | 2.1 GB | GPU, every layer, so it is fast and leaves VRAM for the context |
|
|
42
|
+
| No usable GPU, 16 GB of RAM or more | 3B | 2.1 GB | CPU |
|
|
43
|
+
| No usable GPU, 8 to 16 GB of RAM | 1.5B | 1.1 GB | CPU |
|
|
44
|
+
| Under 8 GB of RAM | 0.5B | 0.5 GB | CPU, with a warning that results will be basic and a suggestion to use Ollama, LM Studio or a key |
|
|
45
|
+
|
|
46
|
+
The decision and the reason are shown in one line in the terminal and in the UI, for example:
|
|
47
|
+
"NVIDIA GeForce GTX 1060 6GB (6.4 GB VRAM) found: using Qwen2.5-Coder 3B (2.1 GB), fully on the GPU."
|
|
48
|
+
Change it later in Settings (a list with sizes and a "recommended" tag) or with `--model 14b|7b|3b|1.5b|0.5b|<path to a GGUF file>`.
|
|
49
|
+
|
|
50
|
+
If Ollama or LM Studio is running (and the wizard did not choose something else), hivedesk uses it and downloads nothing. With Ollama it prefers a `qwen2.5-coder` model.
|
|
51
|
+
|
|
52
|
+
## 3. Runtime, download and loading
|
|
53
|
+
|
|
54
|
+
1. **The local runtime** `node-llama-cpp` is installed into `~/.hivedesk/runtime/` the first time (it is not a dependency of the package, so `npx hivedesk` itself stays small). It uses prebuilt binaries (CUDA, Vulkan, Metal or CPU). If the user's npm cache is locked or broken, the install is retried once with a private cache.
|
|
55
|
+
2. **The download** goes to `~/.hivedesk/models/` with a progress bar (speed and time left) in the terminal and in the UI. A cut download resumes where it stopped. The file is checked against its published SHA-256 before use.
|
|
56
|
+
3. **Loading, GPU first:**
|
|
57
|
+
* as many layers as fit go to the GPU next to the context; the log and the model status say how many, for example "vulkan, 37 of 37 layers on the GPU". If less than half of the layers fit, it does not run the model half on the CPU: it steps down to the next smaller model on the GPU (see below);
|
|
58
|
+
* on the GPU the weights are read once and uploaded, so almost nothing stays in RAM (measured with the 3B on a GTX 1060: 0.45 GB resident, against 2.4 GB when the file is memory mapped); on the CPU they are memory mapped, not copied;
|
|
59
|
+
* free RAM is checked before loading: 2.5 GB when the model goes to the GPU, the model size plus 1.5 GB (at least 4 GB) on the CPU. With less, it does not load, so the machine does not freeze; it says how much is free and what to do;
|
|
60
|
+
* context size: 4096 tokens, or 8192 on a GPU with 8 GB of VRAM or more (`--ctx` overrides it).
|
|
61
|
+
4. **The window:** the server listens on `127.0.0.1` (port 4174 when free, otherwise any free port) with a secret token, and hivedesk opens in its own app window when a Chromium based browser is installed (Edge, Chrome, Brave or Chromium, started with `--app` and a separate profile in `~/.hivedesk/browser-profile`); otherwise in the default browser. `--browser` forces the normal browser, `--no-open` opens nothing. The desktop can also be installed from the browser ("Install hivedesk"): the installed app opens the local server, and shows a "start hivedesk" page when it is not running. The token is kept in `~/.hivedesk/token` so the installed app keeps working; `--new-token` makes a new one.
|
|
62
|
+
|
|
63
|
+
## 4. Second run
|
|
64
|
+
|
|
65
|
+
The runtime and the model are cached in `~/.hivedesk/`, so a second run asks one question (or none with `--yes`) and is ready in the time it takes to load the model: 11 to 50 seconds for the 3B on a GTX 1060 6 GB in our runs.
|
|
66
|
+
|
|
67
|
+
## 5. Every job
|
|
68
|
+
|
|
69
|
+
1. **The prompt refiner.** Mel first rewrites the request as a brief: the goal, what to build (files and features), the constraints, acceptance criteria as a checklist, and open questions with the defaults it will use. A short, vague request ("crie um app") is expanded into a concrete small project with up to 3 multiple choice questions (type of app, style, where the data is saved), each with a default. The job waits: the UI shows your request next to the brief with **Edit**, **Use this** and **Use mine**. Settings can turn the refiner off.
|
|
70
|
+
2. **Memory.** A few relevant memories (decisions, preferences, past sessions) are put into the prompts; the UI shows which. Memory is stored only on this computer (`.hivedesk/memory.json`, `~/.hivedesk/memory.json`, `.hivedesk/sessions/`) and can be viewed, edited, pinned, deleted, forgotten or turned off in the Memory window. It reaches a cloud provider only when that provider is the brain serving the job.
|
|
71
|
+
3. **The crew works** from the approved brief: one task per worker at a time, read before edit, small patches, checks after every change, QA against the acceptance criteria with findings by severity, at most 3 fix rounds, then an honest report. The crew writes its prompts and replies in English.
|
|
72
|
+
4. **The report** lists what was built, the files changed, the checks and their results, and what is still missing, plus an **improved prompt** that would rebuild or extend the result next time and 2 or 3 suggested next prompts. Both can be copied with one click and saved as a playbook.
|
|
73
|
+
|
|
74
|
+
## Opting out
|
|
75
|
+
|
|
76
|
+
| Flag | Effect |
|
|
77
|
+
| --- | --- |
|
|
78
|
+
| `--yes` | no questions (saved setup or defaults) |
|
|
79
|
+
| `--no-download` | never downloads; if no model is found the UI says "no model yet: choose one" and offers the download |
|
|
80
|
+
| `--model <name or path>` | `14b`, `7b`, `3b`, `1.5b`, `0.5b`, or a GGUF file |
|
|
81
|
+
| `--brain ollama` / `--brain lmstudio` | use that server and nothing else |
|
|
82
|
+
| `--brain anthropic\|openai\|xai\|gemini\|compatible` | a cloud provider with the key saved in Settings, Providers (or `HIVEDESK_API_KEY`) |
|
|
83
|
+
| `--demo` | no model at all: a scripted job replays; every event is labeled as a demo |
|
|
84
|
+
| `--doctor` | prints the checks (Node, GPU, RAM, disk, models found) and exits |
|
|
85
|
+
| `--no-open`, `--browser` | open nothing, or the normal browser instead of an app window |
|
|
86
|
+
|
|
87
|
+
`HIVEDESK_HOME` moves the cache folder.
|
|
88
|
+
|
|
89
|
+
## When something goes wrong
|
|
90
|
+
|
|
91
|
+
Every failure prints a plain message and a suggestion, in the terminal and in the UI. The server keeps running so you can fix it from Settings.
|
|
92
|
+
|
|
93
|
+
| Problem | What hivedesk does | Suggestion shown |
|
|
94
|
+
| --- | --- | --- |
|
|
95
|
+
| Not enough free disk for the chosen model | tries the next smaller model that fits; if none fits, stops before downloading | free some space, or use `--model` with a file you already have, or run Ollama or LM Studio |
|
|
96
|
+
| No network (runtime install or model download) | stops that step, keeps any partial download for later | check the connection and press Retry, or use `--model <file.gguf>`, or `--demo` to look around |
|
|
97
|
+
| The model does not fit in the GPU memory (less than half of the layers, or not the context) | loads the next smaller model on the GPU instead (downloading it first if needed), and says so | close other GPU apps, or keep the smaller model |
|
|
98
|
+
| The GPU backend fails to initialize | loads the 1.5B model on the CPU instead (downloading it first if needed), and says so | update the GPU driver, or keep the CPU mode (slower) |
|
|
99
|
+
| Not enough free RAM to load the model | does not load it | close some apps and press Retry, or use a smaller model, or Ollama or LM Studio |
|
|
100
|
+
| The runtime install fails | retries once with a private npm cache, then stops and keeps the server up | run `hivedesk --doctor`, or use Ollama or LM Studio with `--brain` |
|
|
101
|
+
| The model file is corrupt (checksum mismatch) | deletes it and downloads it again once | none unless it fails twice |
|
|
102
|
+
| A cloud key is refused, rate limited or times out | a clear error (HTTP 401, 429 after waiting for `retry-after`, or the timeout); the key never appears in logs or events | check the key in Settings, Providers |
|
|
103
|
+
|
|
104
|
+
## Honest limits
|
|
105
|
+
|
|
106
|
+
* Without a model nothing is generated. The first run needs a download of 0.5 to 9.0 GB unless a model server is already running or you use a cloud key.
|
|
107
|
+
* Measured on a GTX 1060 6 GB with the 3B fully on the GPU: 17 to 39 tokens per second while writing, a tiny static page in about 2 to 2.5 minutes after loading. On the CPU only, expect a few tokens per second.
|
|
108
|
+
* Workers take turns on one model, so a job takes minutes, not seconds, and small models still make mistakes: read the report, it says what is missing.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Alexandre Kohler
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/PROTOCOL.md
ADDED
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
# hivedesk protocol (version 1)
|
|
2
|
+
|
|
3
|
+
This file is the contract between the engine (`src/`), the desktop UI (`ui/`) and P2P lending (`src/lend/`, `ui/lend/`).
|
|
4
|
+
It only grows: fields and types may be added, nothing is renamed or removed while `protocol` is `1`.
|
|
5
|
+
Clients must ignore fields and event types they do not know.
|
|
6
|
+
|
|
7
|
+
## 1. Transport and auth
|
|
8
|
+
|
|
9
|
+
* The server binds `127.0.0.1` only, on `--port` or a random free port.
|
|
10
|
+
* Every run creates a random secret token (32 hex chars). The browser is opened at `http://127.0.0.1:<port>/?t=<token>`.
|
|
11
|
+
* Every HTTP request and the WebSocket upgrade must carry the token in one of:
|
|
12
|
+
* query `?t=<token>`
|
|
13
|
+
* header `Authorization: Bearer <token>`
|
|
14
|
+
* cookie `hivedesk_token=<token>` (the server sets it, `HttpOnly; SameSite=Strict; Path=/`, on the first request that had a valid `?t=`, so the UI assets, `/api/*` calls and the preview iframe work without repeating it)
|
|
15
|
+
* A request without a valid token gets `401 {"error":{"code":"unauthorized","message":"..."}}`.
|
|
16
|
+
* The WebSocket also rejects an `Origin` header that is not `http://127.0.0.1:<port>` or `http://localhost:<port>`. A missing `Origin` (non browser client, tests) is allowed when the token is valid.
|
|
17
|
+
* WebSocket endpoint: `GET /ws?t=<token>`. Text frames only, one JSON object per frame (UTF-8). The server sends a ping every 20 s; clients answer with the standard pong (browsers do it automatically).
|
|
18
|
+
|
|
19
|
+
## 2. Frames
|
|
20
|
+
|
|
21
|
+
Every frame is a JSON object with a `kind`.
|
|
22
|
+
|
|
23
|
+
### Server to UI
|
|
24
|
+
|
|
25
|
+
| kind | when | shape |
|
|
26
|
+
| --- | --- | --- |
|
|
27
|
+
| `hello` | right after connect | `{ "kind":"hello", "protocol":1, "version":"0.1.0", "demo":false, "lend":false, "lastSeq":42, "state":State }` |
|
|
28
|
+
| `event` | every logged event, in order | `{ "kind":"event", "event":Event }` |
|
|
29
|
+
| `live` | ephemeral updates, never logged | `{ "kind":"live", "type":"...", "data":{...} }` |
|
|
30
|
+
| `reply` | answer to a command | `{ "kind":"reply", "id":"c7", "ok":true, "result":{...} }` or `{ "kind":"reply", "id":"c7", "ok":false, "error":{ "code":"bad_request", "message":"..." } }` |
|
|
31
|
+
| `brain.request` | the scheduler wants a model turn from a brain attached by this client (section 6) | `{ "kind":"brain.request", "brainId":"b_remote_1", "requestId":"r_12", "messages":[Message], "options":ChatOptions }` |
|
|
32
|
+
| `brain.cancel` | the scheduler aborts a pending request | `{ "kind":"brain.cancel", "brainId":"b_remote_1", "requestId":"r_12" }` |
|
|
33
|
+
|
|
34
|
+
After `hello`, a client that reconnects can ask for missed events with the `events.since` command.
|
|
35
|
+
|
|
36
|
+
### UI to server
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{ "kind": "command", "id": "c7", "type": "job.create", "data": { "request": "a tiny static landing page" } }
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
`id` is chosen by the client and echoed in the `reply`. Commands are also accepted over REST (`POST /api/command`, section 5).
|
|
43
|
+
|
|
44
|
+
## 3. Events
|
|
45
|
+
|
|
46
|
+
Events are the source of truth. They are appended to `.hivedesk/events.jsonl` (one JSON object per line) and broadcast to every client.
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"seq": 17,
|
|
51
|
+
"ts": "2026-10-16T18:20:31.512Z",
|
|
52
|
+
"type": "task.status",
|
|
53
|
+
"jobId": "j_3",
|
|
54
|
+
"demo": true,
|
|
55
|
+
"data": { "taskId": "t_3_2", "status": "running" }
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
* `seq`: integer, starts at 1, strictly increasing per `.hivedesk` folder (continues across restarts).
|
|
60
|
+
* `ts`: ISO 8601 UTC.
|
|
61
|
+
* `type`: dotted name, see the list below.
|
|
62
|
+
* `jobId`: present when the event belongs to a job.
|
|
63
|
+
* `demo`: present and `true` on every event produced by `--demo`. The UI must show a visible "Demo" label while `hello.demo` is true or it renders demo events.
|
|
64
|
+
* `data`: payload, shape depends on `type`.
|
|
65
|
+
|
|
66
|
+
### Shared shapes
|
|
67
|
+
|
|
68
|
+
```text
|
|
69
|
+
Worker { id, name, role, color, avatar, prompt, tools: string[], builtin: boolean, paused?: boolean }
|
|
70
|
+
avatar is a short glyph or a URL path under /assets/; color is a CSS hex color.
|
|
71
|
+
builtin ids: "mel", "dev", "designer", "qa", "writer"; hired ids start with "w_".
|
|
72
|
+
Task { id, jobId, title, detail, assignee, dependsOn: string[], status, attempts, kind }
|
|
73
|
+
status: "pending" | "ready" | "running" | "review" | "done" | "failed" | "blocked" | "skipped"
|
|
74
|
+
kind: "build" | "qa" | "fix" | "docs"
|
|
75
|
+
Job { id, request, status, approval, refine, createdAt, finishedAt?, taskIds: string[], playbookId?, summary?,
|
|
76
|
+
briefProposed?: Brief, brief?: { text, source }, report?: Report & { improvedPrompt, nextPrompts } }
|
|
77
|
+
status: "refining" | "awaiting_brief" | "planning" | "running" | "done" | "failed" | "cancelled"
|
|
78
|
+
Brief { goal, build: string[], constraints: string[], acceptance: string[], questions: [{ question, options: string[], answer }], text }
|
|
79
|
+
text is the Markdown the user sees and edits; acceptance items are "- [ ] ..." lines in it.
|
|
80
|
+
Report { built, files: [{ path, op, added, removed }], checks: [{ name, ok, detail }], missing: string[], turns, seconds }
|
|
81
|
+
Approval { id, jobId, taskId, workerId, tool, args, summary, diff?, createdAt }
|
|
82
|
+
Playbook { id, title, request, prompt?, keywords: string[], tasks: [{ title, detail, assignee, dependsOn: number[] , kind }], createdAt, uses }
|
|
83
|
+
Message { role: "system" | "user" | "assistant", content: string }
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Event types
|
|
87
|
+
|
|
88
|
+
| type | data |
|
|
89
|
+
| --- | --- |
|
|
90
|
+
| `session.started` | `{ version, protocol, dir, workspace, demo, lend, pid }` |
|
|
91
|
+
| `session.stopped` | `{ reason }` |
|
|
92
|
+
| `settings.changed` | `{ approvalMode?: boolean, brain?: BrainChoice, sound?: boolean, ... }` (only the changed keys) |
|
|
93
|
+
| `brain.status` | `{ state, backend, model?, detail?, hint?, ctx? }` (hint: a plain suggestion to show with an error) state: `"none"` (no model yet) \| `"needs_download"` \| `"downloading"` \| `"loading"` \| `"ready"` \| `"error"` |
|
|
94
|
+
| `brain.download.required` | `{ model, file, url, bytes, source }` information only: the download starts by itself right after (see FIRST-RUN.md). With `--no-download` it does not start and the UI offers a button that sends `brain.download` |
|
|
95
|
+
| `brain.download.started` | `{ model, file, url, bytes, source, path }` |
|
|
96
|
+
| `brain.download.finished` | `{ model, path, bytes, ms }` |
|
|
97
|
+
| `brain.download.failed` | `{ model, code, message, hint }` code: `"no_disk"` \| `"no_network"` \| `"http"` \| `"aborted"` \| `"io"` \| `"checksum"` |
|
|
98
|
+
| `brain.runtime` | `{ state: "installing" \| "ready" \| "failed", package: "node-llama-cpp", version?, path?, message?, hint? }` |
|
|
99
|
+
| `brain.fallback` | `{ from: { backend, model?, gpu? }, to: { backend, model?, gpu? }, reason }` for example a failed GPU init moving to the CPU and a smaller model |
|
|
100
|
+
| `brain.choice` | `{ model, id, file, bytes, source, gpu, reason, warning? }` the automatic choice from the hardware table (FIRST-RUN.md) in one line, for example "NVIDIA GeForce GTX 1060 6GB (6.4 GB VRAM) found: using Qwen2.5-Coder 3B (2.1 GB), fully on the GPU." |
|
|
101
|
+
| `hardware.detected` | `{ os, arch, cpus, ramBytes, freeRamBytes, gpu: { name?, vramBytes?, backend? } \| null, diskFreeBytes }` |
|
|
102
|
+
| `brain.attached` | `{ brainId, label, kind: "local" \| "remote", model? }` |
|
|
103
|
+
| `brain.detached` | `{ brainId, reason }` |
|
|
104
|
+
| `brain.served` | `{ requestId, promptChars, completionTokens, ms }` (lend side: a request from a friend was answered) |
|
|
105
|
+
| `crew.hired` | `{ worker: Worker }` (also emitted for the builtin crew at first start) |
|
|
106
|
+
| `crew.updated` | `{ worker: Worker }` |
|
|
107
|
+
| `crew.fired` | `{ workerId }` |
|
|
108
|
+
| `job.created` | `{ job: Job }` |
|
|
109
|
+
| `job.refining` | `{ workerId: "mel" }` Mel is writing the brief |
|
|
110
|
+
| `brief.proposed` | `{ original, brief: Brief, vague }` (`vague`: the request was short, so the brief expands it and asks up to 3 multiple choice questions) the job waits (status `awaiting_brief`) until `brief.approve` |
|
|
111
|
+
| `brief.approved` | `{ text, source: "refined" \| "edited" \| "original", brief?: Brief, by?: "user" \| "auto" }` the planner and the workers work from `text` |
|
|
112
|
+
| `job.report` | `{ report: Report, improvedPrompt, nextPrompts: string[] }` after `job.done` or `job.failed` |
|
|
113
|
+
| `memory.used` | `{ items: [{ id, text, kind, scope }] }` the memories put into this job's prompts |
|
|
114
|
+
| `memory.changed` | `{ count }` |
|
|
115
|
+
| `providers.changed` | `{ providers: { [id]: { label, configured, model, baseUrl?, keyHint } } }` never a key |
|
|
116
|
+
| `worker.note` | `{ workerId, taskId, text }` a decision the worker wrote in its scratchpad |
|
|
117
|
+
| `job.planning` | `{ workerId: "mel", playbookId?, playbookScore? }` |
|
|
118
|
+
| `job.planned` | `{ tasks: Task[], playbookId? }` |
|
|
119
|
+
| `job.done` | `{ summary, files: string[] }` |
|
|
120
|
+
| `job.failed` | `{ error }` |
|
|
121
|
+
| `job.cancelled` | `{ by: "user" }` |
|
|
122
|
+
| `task.added` | `{ task: Task }` (QA or the planner adds a fix task later) |
|
|
123
|
+
| `task.status` | `{ taskId, status, note? }` (`ready` means pending with every dependency done) |
|
|
124
|
+
| `task.updated` | `{ task: { id, ...changed fields } }` for example a new `assignee` |
|
|
125
|
+
| `job.resumed` | `{ by: "user" }` a finished or failed job runs again after `task.retry` |
|
|
126
|
+
| `queue.updated` | `{ running: [{ workerId, taskId, brainId }], waiting: [{ workerId, taskId }] }` |
|
|
127
|
+
| `turn.started` | `{ turnId, workerId, taskId, brainId, n, budget? }` (n: turn number inside the task; budget: `{ family, limit, used, sections, trimmed, version }` of the assembled prompt) |
|
|
128
|
+
| `turn.ended` | `{ turnId, workerId, taskId, brainId, promptTokens, completionTokens, ms, tps, error? }` |
|
|
129
|
+
| `worker.status` | `{ workerId, status, detail? }` status: `"idle"` \| `"queued"` \| `"thinking"` \| `"tool"` \| `"waiting_approval"` \| `"error"` |
|
|
130
|
+
| `chat.message` | `{ id, channel, from, text, taskId? }` channel: `"general"` or `"dm:<workerId>"`; from: a worker id, `"user"` or `"system"` |
|
|
131
|
+
| `tool.called` | `{ callId, workerId, taskId, tool, args }` |
|
|
132
|
+
| `tool.result` | `{ callId, ok, result?, error? }` result is truncated to 4 KB in the log |
|
|
133
|
+
| `file.changed` | `{ path, op: "create" \| "modify" \| "delete", diff, bytes, added, removed, content?, workerId, taskId }` path is relative to the workspace with `/` separators; `content` is included when the file is 64 KB or less (replay uses it) |
|
|
134
|
+
| `run.finished` | `{ callId, command, exitCode, timedOut, ms, stdout, stderr }` (each capped at 16 KB) |
|
|
135
|
+
| `approval.requested` | `{ approval: Approval }` |
|
|
136
|
+
| `approval.resolved` | `{ approvalId, approved, by: "user" \| "auto", note? }` |
|
|
137
|
+
| `qa.report` | `{ taskId, passed, issues: string[] }` |
|
|
138
|
+
| `playbook.saved` | `{ playbook: Playbook }` |
|
|
139
|
+
| `playbook.used` | `{ playbookId, score }` |
|
|
140
|
+
| `playbook.deleted` | `{ playbookId }` |
|
|
141
|
+
| `lend.*` | reserved for `src/lend/`; the engine logs and forwards them untouched |
|
|
142
|
+
|
|
143
|
+
### Live frames (not logged)
|
|
144
|
+
|
|
145
|
+
| type | data |
|
|
146
|
+
| --- | --- |
|
|
147
|
+
| `turn.token` | `{ turnId, workerId, text }` streamed model text |
|
|
148
|
+
| `brain.stats` | `{ brainId, tps, queue: number, loaded: boolean }` |
|
|
149
|
+
| `brain.download.progress` | `{ model, received, total, bps }` |
|
|
150
|
+
| `brain.runtime.progress` | `{ line }` install output of the runtime |
|
|
151
|
+
| `run.output` | `{ callId, stream: "stdout" \| "stderr", text }` |
|
|
152
|
+
|
|
153
|
+
## 4. Commands
|
|
154
|
+
|
|
155
|
+
| type | data | result |
|
|
156
|
+
| --- | --- | --- |
|
|
157
|
+
| `ping` | `{}` | `{ pong: true, ts }` |
|
|
158
|
+
| `job.create` | `{ request, approval?: boolean, refine?: boolean, playbookId?: string }` (`refine` defaults to `settings.refine`, true) | `{ jobId }` |
|
|
159
|
+
| `brief.approve` | `{ jobId, use: "refined" \| "edited" \| "original", text?, answers? }` (`text` with `edited`; `answers`: the picked option per question, by index) | `{}` |
|
|
160
|
+
| `memory.list` | `{ q? }` | `{ entries: MemoryEntry[], enabled }` |
|
|
161
|
+
| `memory.add` | `{ text, scope?: "project" \| "user", kind?, pinned? }` | `{ entry }` |
|
|
162
|
+
| `memory.update` | `{ id, text?, pinned?, kind? }` | `{ entry }` |
|
|
163
|
+
| `memory.delete` | `{ id }` | `{}` |
|
|
164
|
+
| `memory.forget` | `{ text }` removes the entry that best matches ("forget this") | `{ forgotten }` |
|
|
165
|
+
| `session.list` | `{}` | `{ sessions: [{ id, request, startedAt, status, summary, improvedPrompt, files }] }` |
|
|
166
|
+
| `session.get` | `{ id }` | `{ id, records }` (the lines of `.hivedesk/sessions/<id>.jsonl`) |
|
|
167
|
+
| `session.continue` | `{ id, request? }` a new job that continues that session | `{ jobId }` |
|
|
168
|
+
| `provider.list` | `{}` | `{ providers }` as in `providers.changed` |
|
|
169
|
+
| `provider.setKey` | `{ provider, key?, model?, baseUrl? }` provider: `anthropic`, `openai`, `xai`, `gemini`, `compatible` | `{ provider }` (public view) |
|
|
170
|
+
| `provider.removeKey` | `{ provider }` | `{ removed }` |
|
|
171
|
+
| `provider.test` | `{ provider, model? }` a tiny request | `{ ok, model?, ms, error?, code? }` |
|
|
172
|
+
| `provider.models` | `{ provider }` from the provider, or defaults | `{ models }` |
|
|
173
|
+
| `turn.recent` | `{}` the last 40 model turns kept in memory | `{ turns: [{ turnId, workerId, taskId, jobId, brainId, budget, chars, ts }] }` |
|
|
174
|
+
| `turn.prompt` | `{ turnId }` | `{ turnId, messages, response, budget, ... }` the exact prompt and answer |
|
|
175
|
+
| `playbook.save` | `{ jobId }` keep a job plan and its improved prompt as a playbook | `{ playbook }` |
|
|
176
|
+
| `job.cancel` | `{ jobId }` | `{}` |
|
|
177
|
+
| `chat.send` | `{ channel, text }` user message; in a running job it is added to the context of the addressed worker (or Mel for `general`) | `{ id }` |
|
|
178
|
+
| `approval.resolve` | `{ approvalId, approved: boolean, note? }` | `{}` |
|
|
179
|
+
| `crew.hire` | `{ name, role, prompt, color?, avatar?, tools?: string[] }` | `{ worker }` |
|
|
180
|
+
| `crew.update` | `{ workerId, ...fields }`; `paused: true` makes the scheduler skip that worker's turns (they keep their place in the queue) until `paused: false` | `{ worker }` |
|
|
181
|
+
| `crew.fire` | `{ workerId }` (builtin workers cannot be fired) | `{}` |
|
|
182
|
+
| `task.retry` | `{ taskId }` a failed, blocked, cancelled or done task goes back in line (status `ready`, or `pending` while its dependencies run); tasks blocked by it are unblocked; a job that already ended is reopened (`job.resumed`) | `{}` |
|
|
183
|
+
| `task.reassign` | `{ taskId, workerId }` hand a task that is not done to another worker (`task.updated`); a running task stops and starts again with the new worker; a failed one is also retried | `{}` |
|
|
184
|
+
| `task.cancel` | `{ taskId }` the task becomes `skipped` (a running one is stopped); tasks that depend on it become `blocked` | `{}` |
|
|
185
|
+
| `settings.set` | `{ approvalMode?, sound?, refine?: boolean, crew?: string[], memory?: boolean, workerBrains?: { [workerId]: provider | "default" } }` (`crew`: the builtin roles that take part; Mel and hired workers always do) | `{ settings }` |
|
|
186
|
+
| `brain.probe` | `{}` | `{ hardware, options: BrainOption[], recommended }` |
|
|
187
|
+
| `brain.select` | `BrainChoice` | `{ status }` |
|
|
188
|
+
| `brain.download` | `{ model? }` start (or retry) the automatic model download; needed only after `--no-download` or a failure | `{}` |
|
|
189
|
+
| `brain.attach` | `{ label, model?, ctx? }` this WebSocket becomes a remote brain (section 6) | `{ brainId }` |
|
|
190
|
+
| `brain.respond` | `{ requestId, ok, result?: ChatResult, error?: string }` | `{}` |
|
|
191
|
+
| `brain.token` | `{ requestId, text }` optional streaming for a pending request | none (no reply) |
|
|
192
|
+
| `brain.detach` | `{ brainId }` | `{}` |
|
|
193
|
+
| `brain.chat` | `{ messages, options }` run one turn on the local brain; only accepted when the server runs with `--lend` | `ChatResult` |
|
|
194
|
+
| `events.since` | `{ seq, limit? }` | `{ events: Event[], lastSeq }` |
|
|
195
|
+
| `replay.at` | `{ seq }` | `{ state: State }` state rebuilt from events 1..seq |
|
|
196
|
+
| `replay.marks` | `{}` | `{ marks: [{ seq, ts, kind: "job" \| "done" \| "failed" \| "cancelled" \| "approval", jobId, label? }], lastSeq }` jump points for the scrubber |
|
|
197
|
+
| `files.list` | `{}` | `{ files: [{ path, bytes }] }` |
|
|
198
|
+
| `files.read` | `{ path }` | `{ path, content }` |
|
|
199
|
+
| `playbook.list` | `{}` | `{ playbooks }` |
|
|
200
|
+
| `playbook.delete` | `{ playbookId }` | `{}` |
|
|
201
|
+
| `doctor` | `{}` | `DoctorReport` |
|
|
202
|
+
|
|
203
|
+
```text
|
|
204
|
+
BrainChoice { backend: "local" | "ollama" | "lmstudio" | "openai" | "fake", model?, url?, key? }
|
|
205
|
+
key is kept in memory only and never logged; settings.changed shows "key": "set".
|
|
206
|
+
BrainOption { backend, label, model?, url?, available: boolean, reason?, bytes?, recommended? }
|
|
207
|
+
DoctorReport { ok, checks: [{ id, label, ok, detail, hint? }], hardware, models: [{ file, bytes, path }] }
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
```text
|
|
211
|
+
MemoryEntry { id, scope: "project" | "user", kind: "fact" | "preference" | "rejected" | "session" | "decision", text, pinned, uses, createdAt, updatedAt? }
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Error codes in a failed `reply`: `bad_request`, `not_found`, `conflict`, `unauthorized`, `not_lending`, `busy`, `internal`, plus short snake_case codes from plug-ins (for example `rate_limited`). An unknown command answers `bad_request` with the message `unknown command: <type>`.
|
|
215
|
+
|
|
216
|
+
## 5. REST
|
|
217
|
+
|
|
218
|
+
All JSON unless noted. Same token rule as section 1.
|
|
219
|
+
|
|
220
|
+
| method and path | answer |
|
|
221
|
+
| --- | --- |
|
|
222
|
+
| `GET /` | `ui/index.html` (text/html) |
|
|
223
|
+
| `GET /<path>` | static file from `ui/` |
|
|
224
|
+
| `GET /assets/<path>` | static file from `assets/` |
|
|
225
|
+
| `GET /lib/reduce.js` | the engine reducer as an ES module, so the UI can rebuild state for the replay scrubber without a round trip |
|
|
226
|
+
| `GET /api/health` | `{ ok: true, version, protocol, demo, lend }` |
|
|
227
|
+
| `GET /api/state` | `State` |
|
|
228
|
+
| `GET /api/events?since=0&limit=500` | `{ events, lastSeq }` |
|
|
229
|
+
| `GET /api/replay?seq=N` | `State` at seq N |
|
|
230
|
+
| `GET /api/files` | `{ files: [{ path, bytes }] }` |
|
|
231
|
+
| `GET /api/file?path=index.html` | `{ path, content }` |
|
|
232
|
+
| `GET /api/playbooks` | `{ playbooks }` |
|
|
233
|
+
| `GET /api/doctor` | `DoctorReport` |
|
|
234
|
+
| `POST /api/command` | body `{ "type": "...", "data": {...} }`, answer `{ ok, result }` or `{ ok:false, error }` |
|
|
235
|
+
| `GET /manifest.webmanifest`, `/sw.js`, `/offline.html`, `/pwa.js` | the installable app shell; no token needed (no data in them) |
|
|
236
|
+
| `GET /preview/<path>` | the workspace served as a static site (`/preview/` serves `index.html`). This route does not need the token: it is read only, checks the Host header, and is served with `Content-Security-Policy: sandbox allow-scripts ...` so the page runs in an opaque origin and cannot call the API |
|
|
237
|
+
|
|
238
|
+
### State
|
|
239
|
+
|
|
240
|
+
```text
|
|
241
|
+
State {
|
|
242
|
+
protocol, version, demo, lend, lastSeq,
|
|
243
|
+
settings: { approvalMode, sound, brain: BrainChoice (no key) },
|
|
244
|
+
brain: { state, backend, model?, detail? },
|
|
245
|
+
brains: [{ brainId, label, kind, model? }],
|
|
246
|
+
crew: Worker[],
|
|
247
|
+
workers: { [workerId]: { status, detail?, taskId? } },
|
|
248
|
+
jobs: Job[], newest last
|
|
249
|
+
tasks: { [taskId]: Task },
|
|
250
|
+
queue: { running: [...], waiting: [...] },
|
|
251
|
+
approvals: Approval[], pending only
|
|
252
|
+
chat: { [channel]: ChatMessage[] }, last 200 per channel
|
|
253
|
+
files: { [path]: { bytes, content?, lastSeq } },
|
|
254
|
+
runs: run.finished data[], last 50
|
|
255
|
+
playbooks: Playbook[],
|
|
256
|
+
usage: { [brainId]: { prompt, completion, turns } }, tokens per brain this session
|
|
257
|
+
providers: { [id]: { label, configured, model } }, never keys
|
|
258
|
+
notes: { [workerId]: [{ text, taskId, ts }] }, worker scratchpads
|
|
259
|
+
choice: brain.choice data, memoryCount: number,
|
|
260
|
+
tokens: { prompt, completion }
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
## 6. Brains and remote brains
|
|
265
|
+
|
|
266
|
+
How the engine picks and installs a brain on start (no questions asked) is described in FIRST-RUN.md.
|
|
267
|
+
|
|
268
|
+
### The Brain interface (JS, `src/brain/types.js`)
|
|
269
|
+
|
|
270
|
+
```js
|
|
271
|
+
/**
|
|
272
|
+
* @typedef {Object} ChatOptions
|
|
273
|
+
* @property {object} [schema] JSON schema the answer must match (grammar constrained when the backend supports it)
|
|
274
|
+
* @property {Array<{name:string, description:string, parameters:object}>} [tools] informational; the schema is the authority
|
|
275
|
+
* @property {number} [maxTokens]
|
|
276
|
+
* @property {number} [temperature]
|
|
277
|
+
* @property {AbortSignal} [signal] not sent over the wire
|
|
278
|
+
* @property {(text:string)=>void} [onToken] not sent over the wire
|
|
279
|
+
*
|
|
280
|
+
* @typedef {Object} ChatResult
|
|
281
|
+
* @property {string} text raw model text
|
|
282
|
+
* @property {any} [json] parsed object when a schema was given
|
|
283
|
+
* @property {number} promptTokens
|
|
284
|
+
* @property {number} completionTokens
|
|
285
|
+
* @property {number} ms
|
|
286
|
+
* @property {string} [model]
|
|
287
|
+
*
|
|
288
|
+
* @typedef {Object} Brain
|
|
289
|
+
* @property {string} id
|
|
290
|
+
* @property {string} label
|
|
291
|
+
* @property {"local"|"remote"|"cloud"} kind
|
|
292
|
+
* @property {Set<string>} [only] the scheduler gives this brain only the turns of these workers
|
|
293
|
+
* @property {(messages: Message[], options?: ChatOptions) => Promise<ChatResult>} chat
|
|
294
|
+
* @property {() => object} [info]
|
|
295
|
+
* @property {() => Promise<void>} [close]
|
|
296
|
+
*/
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
Rules for every brain:
|
|
300
|
+
|
|
301
|
+
* One `chat` call at a time per brain. The scheduler never calls a brain that is busy.
|
|
302
|
+
* When `schema` is given, the answer must be a single JSON value matching it. The local adapter enforces this with a grammar. A brain that cannot (for example a plain endpoint) returns the text and the engine parses and validates it, retrying once with the error appended.
|
|
303
|
+
* `chat` rejects with an `Error` on failure or abort. The scheduler marks the turn failed and may retry on another brain.
|
|
304
|
+
|
|
305
|
+
### The scheduler
|
|
306
|
+
|
|
307
|
+
`src/crew/scheduler.js` keeps a pool of brains and one fair queue of turns (round robin over workers, oldest first inside a worker). When a brain is free it takes the next turn. With only the local brain there is exactly one turn at a time; every attached remote brain adds one more slot. `queue.updated` and `turn.started.brainId` show who runs where.
|
|
308
|
+
|
|
309
|
+
```js
|
|
310
|
+
scheduler.addBrain(brain) // emits brain.attached
|
|
311
|
+
scheduler.removeBrain(brainId) // emits brain.detached; a running turn on it is re-queued
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### Remote brain over the WebSocket (no engine code needed)
|
|
315
|
+
|
|
316
|
+
1. A client (the lend UI on the host) sends `brain.attach { label, model, ctx }` and gets `{ brainId }`.
|
|
317
|
+
2. The engine adds a relay brain to the scheduler. When it gets a turn, the engine sends `brain.request` to that same WebSocket.
|
|
318
|
+
3. The client carries the request to the friend (WebRTC), the friend's browser sends `brain.chat` to the friend's own hivedesk started with `--lend`, and the answer goes back the same way.
|
|
319
|
+
4. The client answers with `brain.respond { requestId, ok, result }` (it may stream `brain.token` before). Timeout: 180 s, then the turn is re-queued on another brain.
|
|
320
|
+
5. `brain.detach` or closing the WebSocket removes the brain.
|
|
321
|
+
|
|
322
|
+
Only `messages` and `options` (schema, maxTokens, temperature) travel. No file content leaves the host unless it is part of a prompt, and nothing on the friend's machine is read or written.
|
|
323
|
+
|
|
324
|
+
### Server side plug-in (optional)
|
|
325
|
+
|
|
326
|
+
At start, if `src/lend/index.js` exists, the engine calls its default export:
|
|
327
|
+
|
|
328
|
+
```js
|
|
329
|
+
export default function register({ scheduler, bus, server, config }) {}
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
* `bus.emit(type, data, { jobId })` appends and broadcasts an event (use `lend.*` types).
|
|
333
|
+
* `bus.on(listener)` receives every event.
|
|
334
|
+
* `server.route(method, path, handler)` adds a REST route under the same token check, `handler(req, res, url)`.
|
|
335
|
+
* `server.command(type, handler)` adds a command, `handler(data, client) => result`.
|
|
336
|
+
* `config` has `{ dir, port, token, lend, demo, version }`.
|
|
337
|
+
|
|
338
|
+
The engine does not depend on `src/lend/`; when it is missing, lending is simply off.
|
|
339
|
+
|
|
340
|
+
## 7. Files on disk
|
|
341
|
+
|
|
342
|
+
Shared cache for every project (override with the env var `HIVEDESK_HOME`):
|
|
343
|
+
|
|
344
|
+
```text
|
|
345
|
+
~/.hivedesk/
|
|
346
|
+
runtime/ node-llama-cpp installed here on first use (not a dependency of the package)
|
|
347
|
+
models/ downloaded GGUF files (partial downloads end in .part and resume)
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
Per project:
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
```text
|
|
354
|
+
<dir>/.hivedesk/
|
|
355
|
+
events.jsonl append-only event log (source of truth)
|
|
356
|
+
state.json snapshot, rewritten at most every 2 s and on exit (a cache; deleted is fine)
|
|
357
|
+
playbooks/ one <id>.json per playbook
|
|
358
|
+
workspace/ the files the crew builds (preview serves this)
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
## 8. Demo mode
|
|
362
|
+
|
|
363
|
+
`hivedesk --demo` uses a scripted fake brain, so the whole loop runs with no model. Every event carries `"demo": true`, `session.started.data.demo` is true, `hello.demo` is true, and Mel posts a first `chat.message` in `general`: "This is a demo. No model is running; the crew follows a script."
|