hivedesk 1.0.0 → 1.0.1
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 +122 -111
- package/desktop/controller.js +85 -7
- package/desktop/native.js +4 -1
- package/desktop/release-notes/1.0.1.json +12 -0
- package/desktop/scripts/package.mjs +134 -123
- package/desktop/shell.html +5 -2
- package/desktop/workarea.js +440 -0
- package/i18n/de.json +247 -4
- package/i18n/en.json +247 -4
- package/i18n/es.json +247 -4
- package/i18n/fr.json +247 -4
- package/i18n/it.json +247 -4
- package/i18n/ja.json +247 -4
- package/i18n/ko.json +247 -4
- package/i18n/parts/downloads.de.json +29 -0
- package/i18n/parts/downloads.en.json +29 -0
- package/i18n/parts/downloads.es.json +29 -0
- package/i18n/parts/downloads.fr.json +29 -0
- package/i18n/parts/downloads.it.json +29 -0
- package/i18n/parts/downloads.ja.json +29 -0
- package/i18n/parts/downloads.ko.json +29 -0
- package/i18n/parts/downloads.pt-BR.json +29 -0
- package/i18n/parts/downloads.ru.json +29 -0
- package/i18n/parts/downloads.zh-CN.json +29 -0
- package/i18n/parts/office.de.json +184 -0
- package/i18n/parts/office.en.json +184 -0
- package/i18n/parts/office.es.json +184 -0
- package/i18n/parts/office.fr.json +184 -0
- package/i18n/parts/office.it.json +184 -0
- package/i18n/parts/office.ja.json +184 -0
- package/i18n/parts/office.ko.json +184 -0
- package/i18n/parts/office.pt-BR.json +184 -0
- package/i18n/parts/office.ru.json +184 -0
- package/i18n/parts/office.zh-CN.json +184 -0
- package/i18n/pt-BR.json +247 -4
- package/i18n/ru.json +247 -4
- package/i18n/zh-CN.json +247 -4
- package/package.json +3 -2
- package/src/brain/manager.js +23 -7
- package/src/brain/models.js +146 -30
- package/src/brain/runtime.js +61 -13
- package/src/crew/domains/flow.js +2 -1
- package/src/crew/engine.js +172 -22
- package/src/crew/legacy.js +72 -0
- package/src/crew/planner.js +14 -1
- package/src/crew/talk.js +110 -3
- package/src/crew/taskgraph.js +12 -2
- package/src/crew/worker.js +60 -2
- package/src/index.js +4 -1
- package/src/phone/hub.js +15 -3
- package/src/phone/port.js +1 -1
- package/src/replay/reduce.js +1 -0
- package/src/tools/check.js +2 -0
- package/src/voice/index.js +1 -1
- package/src/voice/piper.js +10 -4
- package/src/voice/store.js +2 -1
- package/src/voice/whisper.js +63 -25
- package/ui/city/activity.js +4 -1
- package/ui/city/city.js +5 -5
- package/ui/city/scene.js +2 -1
- package/ui/css/hive.css +20 -0
- package/ui/js/dock.js +2 -2
- package/ui/js/dom.js +23 -18
- package/ui/js/i18n.js +12 -0
- package/ui/js/main.js +43 -3
- package/ui/js/md.js +130 -0
- package/ui/js/net.js +6 -0
- package/ui/js/palette.js +2 -2
- package/ui/js/store.js +20 -2
- package/ui/js/topbar.js +2 -2
- package/ui/js/voice/index.js +3 -2
- package/ui/js/widgets/brief.js +28 -10
- package/ui/js/widgets/chat.js +16 -4
- package/ui/js/widgets/files.js +3 -3
- package/ui/js/widgets/memory.js +3 -3
- package/ui/js/widgets/replay.js +3 -3
- package/ui/js/widgets/settings.js +2 -2
- package/ui/js/widgets/timeline.js +2 -2
- package/ui/js/widgets/worker.js +17 -6
- package/ui/models/index.js +3 -2
- package/ui/models/window.js +2 -2
- package/ui/office/office.js +662 -623
- package/ui/office/popout.js +4 -3
- package/ui/office/scene.js +47 -28
- package/ui/phone/core/client.js +11 -5
- package/ui/phone/desktop.js +2 -1
- package/ui/widget.html +8 -8
- package/ui/widget.js +35 -20
- package/ui/workbench/searchview.js +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,111 +1,122 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## 1.0.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*
|
|
9
|
-
* The
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
|
|
31
|
-
###
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* A
|
|
36
|
-
|
|
37
|
-
###
|
|
38
|
-
*
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
*
|
|
45
|
-
* A
|
|
46
|
-
* A
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
*
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
*
|
|
73
|
-
* The
|
|
74
|
-
*
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
*
|
|
111
|
-
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.0.1 (2026-10-20)
|
|
4
|
+
|
|
5
|
+
* Downloading a model works in the desktop app again. The packages bring the npm of their bundled Node.js, so a PC without Node.js can install the local runtime; npm runs without a shell, so a user folder with spaces stays one path; a broken runtime folder is retried fresh; and a failed install says why.
|
|
6
|
+
* Downloads of models and voices recover from a crash (a finished part file is verified and kept), report a full disk, a locked file, 404, 403, 429 and server errors with their own message and the real host, share one file when the same model is asked twice, and honor a short Retry-After. Voice works in a user folder with accents, a missing or blocked speech program fails at once with a clear message, and a busy port picks another.
|
|
7
|
+
* The brief no longer blocks a job: "ok", "pode continuar", "sim" and the like in the chat approve it in 10 languages, the brief has buttons in the chat, the status says it waits for you, and a brief survives a restart. Questions like "where is my page?" are answered from the real job state, and a chat reply never claims work that did not start.
|
|
8
|
+
* Model text is rendered as safe markdown in the windows and chats, and stripped in bubbles and notifications.
|
|
9
|
+
* The Office view, the mini widget, the worker roles and the crew's chat lines are translated in 10 languages.
|
|
10
|
+
* On Windows, a maximized window keeps the taskbar visible, and a window saved off screen comes back. The loading screen shows a Retry button instead of spinning forever.
|
|
11
|
+
* The crew finishes more jobs on a local model: QA runs after a partly failed build so its fix rounds can repair it, a worker's history is trimmed to fit a 4096 token context, and a local model's plan gives each worker its own task so two workers never edit the same file at once.
|
|
12
|
+
* A phone that connects no longer shows a "null" line, and the computer name it sees falls back to the profile name and the system name.
|
|
13
|
+
|
|
14
|
+
## 1.0.0 (2026-10-18)
|
|
15
|
+
|
|
16
|
+
hivedesk becomes a peer to peer environment where AI agents, people and machines work together as one City. Your agents. Your machines. Your City.
|
|
17
|
+
|
|
18
|
+
### P2P and the City
|
|
19
|
+
* Every install has an Ed25519 identity. A friend joins with a six word invite, both screens show the same check words, and nothing is shared until you accept. Sessions are end to end encrypted, every grant is explicit, off by default, has an expiry and can be revoked at once, and every grant, refusal and revoke goes to a hash chained audit log.
|
|
20
|
+
* The City reads the real state: machines, agents, tasks, jobs and peers, with the Machines panel and the Activity stream. Demo data is labeled and never mixed with real data.
|
|
21
|
+
|
|
22
|
+
### Compute: GPU and CPU with friends
|
|
23
|
+
* Borrow a friend's GPU or CPU as remote inference jobs with a lease, limits, heartbeats, cancel and revoke. A whole crew job can think on a friend's machine; every write or run that comes from there waits for your approval.
|
|
24
|
+
* The scheduler picks local GPU, local CPU or a friend's machine and says why, with an honest speed estimate. A failed job offers Retry locally, Retry another peer, Use partial or Cancel.
|
|
25
|
+
* Pooled giant models (experimental, off by default): a model too big for one PC runs split across friends' GPUs and CPUs over the encrypted session, only when the granted memory really fits it.
|
|
26
|
+
|
|
27
|
+
### Models
|
|
28
|
+
* A catalog of 57 models with quantized variants, pinned by SHA-256, with the memory each one needs. hivedesk reads your GPU, RAM and disk, recommends one and asks before any download. Works on CPU only machines too.
|
|
29
|
+
* Automatic model rotation: the router picks an installed model for each role and task and keeps a few loaded within your memory budget.
|
|
30
|
+
|
|
31
|
+
### The crew
|
|
32
|
+
* Not only websites: mobile apps (installable PWA plus a Capacitor project), desktop apps, APIs, CLI tools, browser extensions, games and data scripts, with tested offline skeletons and specialists for mobile, desktop, backend, security, data and DevOps.
|
|
33
|
+
* When a request is unclear, Mel asks: at most four questions with two to five options, the recommended one first with its reason, Other, and Decide for me.
|
|
34
|
+
* Security mode audits a project read only: exposed secrets (masked), risky code and risky dependencies, with severity, file and line. Fixes run only after your approval.
|
|
35
|
+
* A library of 672 playbooks, picked per request, and an improved prompt at the end of every job.
|
|
36
|
+
|
|
37
|
+
### Remote desktop, phone and voice
|
|
38
|
+
* Remote desktop with a 10 digit address: copy, paste, connect. The person who is called decides what to allow (view, control, clipboard, files) and sees a red Stop button. All monitors, file send, and copy here, paste there. The key behind an address is pinned on first use. On macOS, view only for now.
|
|
39
|
+
* Phone remote: scan a QR code, check the six words, accept, and follow jobs, answer approvals, chat with the crew and see the screen from your phone.
|
|
40
|
+
* Voice mode: a hands free conversation with Mel, speech to text on your own PC, barge in, and every action read back before it runs.
|
|
41
|
+
|
|
42
|
+
### Workbench, installers and the rest
|
|
43
|
+
* A code workbench with editor groups, explorer, search, a real terminal (shareable with a friend), source control and GitHub.
|
|
44
|
+
* Installers for Windows (a small online setup and an offline one, per user, no admin), macOS (DMG) and Linux (AppImage, deb, rpm and an install script), with signed automatic updates and rollback.
|
|
45
|
+
* A local profile with a name and an avatar from a gallery, real stats and achievements. Only the name and avatar are shared with friends.
|
|
46
|
+
* A more serious 1.0 design, 10 languages everywhere, and a new site.
|
|
47
|
+
|
|
48
|
+
### Security
|
|
49
|
+
* A full review before release: local commands need the app's own origin, peer and phone approvals are strict, plans and chat from guests or peers never act as the owner, the .git folder is closed to the crew, node flags are allowlisted, the uninstaller removes only what it installed, and model downloads need a hash and a size cap.
|
|
50
|
+
|
|
51
|
+
## 0.2.1 (security) (2026-10-17)
|
|
52
|
+
|
|
53
|
+
A security update for Code together, Lend your PC, Hive City, `--demo` and extensions. Please update.
|
|
54
|
+
|
|
55
|
+
* Guest roles are checked by the engine itself, not only by the host's browser. Every guest command carries the guest's role; a missing role counts as a viewer. A viewer can read and chat; a collaborator can also post tasks and jobs, edit files under the host's approval and bring a building into the city. Hiring agents, changing an agent's tools, rooms, settings, models and providers stay with the host.
|
|
56
|
+
* A building in the city can use only a model its owner lends itself. The host's own models, cloud brains and other guests' models can no longer be tied to a guest's building.
|
|
57
|
+
* A guest's agents join with read and check tools only. Only the host can grant more tools, and an agent from an older version that still holds write tools comes back with the safe set.
|
|
58
|
+
* Work that does not come from the person at this PC always waits for the host's answer, even with approval mode off: writes and saves from a guest (new files included), and every write, run or package script of a task whose model turns ran on a friend's machine. The approval card says where the action comes from, `npm run` and `npm test` show the script they would run, turning approval mode off does not approve these, and a guest cannot answer them.
|
|
59
|
+
* Lend your PC: Cancel now stops the model on the lender. Each pairing is a lease with a maximum duration and number of turns (60 minutes and 200 turns by default) that expires on its own. Lent turns run only on the lender's local models: never on a model the lender itself borrowed, and never on the lender's cloud keys unless the lender allows it for that pairing. A model allowlist can be set per pairing (`lend.grant`). The older `brain.chat` entry goes through the same checks, and very deep or very large remote schemas are refused.
|
|
60
|
+
* `--demo` runs in a temporary folder with its own home, never in a real project: a non empty `--dir` is refused, `--demo-dir <folder>` picks a folder on purpose, and a folder that holds a real hivedesk log is always refused. A demo run in a folder no longer labels later real runs as Demo.
|
|
61
|
+
* Extensions: each extension runs in its own sandbox process, and the engine knows which extension is calling from the process it started, not from what the process says.
|
|
62
|
+
|
|
63
|
+
## 0.2.0 (2026-10-17)
|
|
64
|
+
|
|
65
|
+
Hive City: hivedesk becomes a small distributed system for AI agents on people's computers. The city is the new home view.
|
|
66
|
+
|
|
67
|
+
### Hive City, engine side (CITY-PROTOCOL.md)
|
|
68
|
+
|
|
69
|
+
* The city is the state of the system: buildings, rooms, agents, tasks, hops and GPU borrows are `city.*` events in the same append-only log, reduced by `src/city/state.js` (served at `/lib/city.js`) into `state.city` and `hello.state.city`.
|
|
70
|
+
* Persistent agents: every crew worker is an agent with a home room, a level and XP from finished work (work 10, review 4, test 3, plus 5 for a task done without a loop), stats, tools and a private memory (at most 40 entries of 300 characters, editable and pinnable). Agents are saved per machine in `~/.hivedesk/city/agents/`, so they keep their level and memory across projects; pinned entries, facts, preferences and decisions go into their prompts.
|
|
71
|
+
* Rooms with rules: Lobby, Design, Code, Review, Test, Ops and Library, each with its allowed tools (an agent's tools are cut to the room's while it works there), what it accepts, an optional approval gate and a host only flag (Ops). Extensions add rooms with `city.room.add`.
|
|
72
|
+
* The task bus: tasks are created by you (in a room or on an agent), by Mel (a Lobby task is planned into crew tasks; every planner task of a job appears on the board) or by the agents (a failed review or test sends work back). Idle agents bid by skill, level and machine load; claims, hops, verdicts, loops and approvals are events.
|
|
73
|
+
* The pipeline: Design writes a spec and criteria, Code runs a crew job with one task, Review reads the diff against the criteria (a model turn for city tasks; the checks of the changed files for planner tasks), Test runs the static checks (for planner tasks, the crew QA report). Failures loop back to the author with the issues, at most 3 times, then the task is blocked. You can approve or send back a task at any hop.
|
|
74
|
+
* Machines: your PC is a building with a stable id, its GPU, model and load. A Code together guest can bring their machine and agents (`city.machine.join`); a friend's agent thinks on its own machine's lent brain, and that brain serves only that friend's agents and accepted borrows.
|
|
75
|
+
* GPU borrowing: an agent asks another machine for a number of turns and minutes, the lender accepts (and may lower the limits) or refuses, every turn is counted, and either side can stop it. It rides the existing lend relay and the lender's guard; only prompts and answers travel.
|
|
76
|
+
* Ownership and safety: the owner of a machine, agent or task wins. Guest commands are signed by the host's browser (`roles.js`), limited to 40 per 10 seconds, and a guest's tasks run with approval mode on, without `run` and `delete_file`, and never in Ops. The full memory of an agent never goes into the log.
|
|
77
|
+
* Replication and persistence: late joiners get a snapshot plus the tail (`city.sync`); after a restart the same agents come back and unfinished tasks open again in their room.
|
|
78
|
+
* `--demo` plays a city scenario (a friend joins with six words, Dev borrows her GPU for three turns, a task goes Design, Code, Review, Test, done), every event labeled demo. `--no-city` turns the city off.
|
|
79
|
+
* The 0.1 APIs are unchanged; PROTOCOL.md gains `hello.city`, `state.city`, `Job.cityTaskId`, the `forbidden` error code and the `city.*` event and command families.
|
|
80
|
+
|
|
81
|
+
## 0.1.1 (2026-10-17)
|
|
82
|
+
|
|
83
|
+
* Node.js 20 or newer is required (Node 18 has reached end of life and lacks the global Web Crypto API that pairing uses). The doctor check, the launchers and the docs say so.
|
|
84
|
+
* The website shows the real Office mode and the desktop downloads for Windows, macOS and Linux.
|
|
85
|
+
* The README on npm matches the current requirements.
|
|
86
|
+
|
|
87
|
+
## 0.1.0 (2026-10-17)
|
|
88
|
+
|
|
89
|
+
First release.
|
|
90
|
+
|
|
91
|
+
### Start
|
|
92
|
+
|
|
93
|
+
* `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.
|
|
94
|
+
* 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.
|
|
95
|
+
* 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.
|
|
96
|
+
* Other local runtimes and cloud providers with your own key 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.
|
|
97
|
+
* 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.
|
|
98
|
+
* `--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.
|
|
99
|
+
|
|
100
|
+
### The crew
|
|
101
|
+
|
|
102
|
+
* Mel, Dev, Designer, QA and Writer, plus workers you hire with a role, a color and a list of tools.
|
|
103
|
+
* 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.
|
|
104
|
+
* 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.
|
|
105
|
+
* 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.
|
|
106
|
+
* 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.
|
|
107
|
+
* 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.
|
|
108
|
+
* Every tool call is a JSON action checked by a schema; the local model is grammar constrained.
|
|
109
|
+
* Workspace tools: list, read, write, edit, delete, run (allow list, timeout, output cap, Node permission flags when available), static checks and preview.
|
|
110
|
+
* 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.
|
|
111
|
+
|
|
112
|
+
### Memory and history
|
|
113
|
+
|
|
114
|
+
* 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.
|
|
115
|
+
* One session file per job in `.hivedesk/sessions/`; any session can be reopened and continued.
|
|
116
|
+
* Playbooks: a job that ends well is saved and reused for similar requests.
|
|
117
|
+
* Replay: `events.jsonl` is the source of truth; any moment can be rebuilt.
|
|
118
|
+
|
|
119
|
+
### Other
|
|
120
|
+
|
|
121
|
+
* Lend your PC: a paired friend's model can take turns for your crew (see the README).
|
|
122
|
+
* The protocol for the UI and plug-ins is in PROTOCOL.md.
|
package/desktop/controller.js
CHANGED
|
@@ -9,6 +9,7 @@ import { checkWebview, decideLaunch } from './detect.js';
|
|
|
9
9
|
import { ensureRuntime } from './runtime.js';
|
|
10
10
|
import { launchNative, runtimeConfig } from './native.js';
|
|
11
11
|
import { WindowStore, MIN } from './state.js';
|
|
12
|
+
import { WinDisplays, WorkAreaMax, clampToDisplays, centerIn, workAreaBounds, reachable, validRect } from './workarea.js';
|
|
12
13
|
import { lockFile, acquireLock, releaseLock } from './instance.js';
|
|
13
14
|
import { openAppWindow, openDefaultBrowser } from './browser.js';
|
|
14
15
|
import { desktopStrings, pickLocale } from './strings.js';
|
|
@@ -17,6 +18,7 @@ import { UpdateService } from './update/service.js';
|
|
|
17
18
|
import { GALLERY, readProfile, writeProfile } from './profile/index.js';
|
|
18
19
|
|
|
19
20
|
const HERE = path.dirname(fileURLToPath(import.meta.url));
|
|
21
|
+
const sleep = (ms) => new Promise((r) => { const t = setTimeout(r, ms); t.unref?.(); });
|
|
20
22
|
const SHELL = path.join(HERE, 'shell.html');
|
|
21
23
|
const OS_NAME = { win32: 'windows', darwin: 'macos', linux: 'linux' };
|
|
22
24
|
|
|
@@ -96,6 +98,20 @@ export async function openDesktop(o) {
|
|
|
96
98
|
// HIVEDESK_DESKTOP_HIDDEN=1: tests of a whole package, invisible (hidden window, no tray, no browser).
|
|
97
99
|
const hidden = !!o.hidden || env.HIVEDESK_DESKTOP_HIDDEN === '1';
|
|
98
100
|
let settings = store.settings();
|
|
101
|
+
// The frame of this run (a change in the menu applies at the next start, like the native style).
|
|
102
|
+
const frame = settings.frame;
|
|
103
|
+
// Windows with the custom frame: maximize onto the work area of the monitor (desktop/workarea.js).
|
|
104
|
+
// o.displays: a display source for tests ({ list(): Promise<Display[] | null>, close() }).
|
|
105
|
+
const workArea = (o.platform || process.platform) === 'win32' && frame !== 'system' && !hidden;
|
|
106
|
+
const displaySource = workArea ? (o.displays || new WinDisplays()) : null;
|
|
107
|
+
const displays = () => (displaySource ? displaySource.list().catch(() => null) : Promise.resolve(null));
|
|
108
|
+
// Asked at once, so the helper is warm and the saved bounds can be checked before the window opens.
|
|
109
|
+
const displaysAtStart = workArea ? displays() : null;
|
|
110
|
+
// Neutralino's window.setSize turns WS_THICKFRAME and WS_MAXIMIZEBOX back on when resizable is true (its
|
|
111
|
+
// default): a sizing border on the borderless window and a native maximize for Win+Up. The custom frame
|
|
112
|
+
// resizes from its own edges, so on Windows every setSize says resizable: false (the style it started with).
|
|
113
|
+
const sizeExtra = workArea ? { resizable: false } : {};
|
|
114
|
+
let wmax = null;
|
|
99
115
|
let native = null;
|
|
100
116
|
let mode = 'none';
|
|
101
117
|
let trayOk = false;
|
|
@@ -151,7 +167,11 @@ export async function openDesktop(o) {
|
|
|
151
167
|
const [size, pos, max, min] = await Promise.all([
|
|
152
168
|
native.call('window.getSize'), native.call('window.getPosition'), native.call('window.isMaximized'), native.call('window.isMinimized')
|
|
153
169
|
]);
|
|
154
|
-
|
|
170
|
+
const bounds = { width: size.width, height: size.height, x: pos.x, y: pos.y };
|
|
171
|
+
// The custom frame on Windows is never natively maximized: a native maximize (Win+Up, the taskbar)
|
|
172
|
+
// turns into the work area maximize here, and "maximized" is the work area state.
|
|
173
|
+
const maximized = wmax ? await wmax.sync({ nativeMax: !!max, minimized: !!min, bounds }) : !!max;
|
|
174
|
+
return { ...bounds, maximized, minimized: !!min };
|
|
155
175
|
} catch {
|
|
156
176
|
return null;
|
|
157
177
|
}
|
|
@@ -160,9 +180,35 @@ export async function openDesktop(o) {
|
|
|
160
180
|
if (hidden) return;
|
|
161
181
|
const s = await windowState();
|
|
162
182
|
if (!s || s.minimized) return;
|
|
163
|
-
|
|
183
|
+
// While maximized the normal bounds are the restore bounds (known for the work area maximize).
|
|
184
|
+
if (s.maximized) store.save(validRect(wmax?.restore) ? { ...wmax.restore, maximized: true } : { maximized: true });
|
|
164
185
|
else store.save({ width: s.width, height: s.height, x: s.x, y: s.y, maximized: false });
|
|
165
186
|
}
|
|
187
|
+
async function toggleMaximize() {
|
|
188
|
+
if (wmax && !wmax.nativeOnly) {
|
|
189
|
+
if (await wmax.toggle()) return;
|
|
190
|
+
log('window: no display information, using the native maximize');
|
|
191
|
+
}
|
|
192
|
+
await native.call((await native.call('window.isMaximized')) ? 'window.unmaximize' : 'window.maximize');
|
|
193
|
+
}
|
|
194
|
+
/** Once the page is up: the saved maximize on the work area, and on macOS and Linux a window kept on its screen. */
|
|
195
|
+
async function placeAfterReady(state) {
|
|
196
|
+
if (hidden || !native || native.closed) return;
|
|
197
|
+
if (wmax) {
|
|
198
|
+
if (wmax.maximized) await wmax.ensure();
|
|
199
|
+
else if (state.maximized && !(await wmax.maximize())) await native.call('window.maximize');
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
// The shell reports the screen it is on (CSS pixels, the runtime's units on macOS and Linux).
|
|
203
|
+
const scr = readyInfo.screen;
|
|
204
|
+
if (frame === 'system' || state.maximized || !validRect(scr)) return;
|
|
205
|
+
const [size, pos] = await Promise.all([native.call('window.getSize'), native.call('window.getPosition')]);
|
|
206
|
+
const b = { x: pos.x, y: pos.y, width: size.width, height: size.height };
|
|
207
|
+
if (!reachable([{ monitor: scr, work: scr }], b)) {
|
|
208
|
+
const c = centerIn(scr, b.width, b.height);
|
|
209
|
+
await native.call('window.move', { x: c.x, y: c.y });
|
|
210
|
+
}
|
|
211
|
+
}
|
|
166
212
|
|
|
167
213
|
async function show() {
|
|
168
214
|
if (mode === 'browser') { openAppWindow(o.url, { home: o.home }); return; }
|
|
@@ -180,6 +226,7 @@ export async function openDesktop(o) {
|
|
|
180
226
|
await saveState();
|
|
181
227
|
store.flush();
|
|
182
228
|
if (!hidden) releaseLock(lock);
|
|
229
|
+
displaySource?.close();
|
|
183
230
|
if (native) await native.exit();
|
|
184
231
|
if (o.quit) o.quit();
|
|
185
232
|
}
|
|
@@ -224,6 +271,7 @@ export async function openDesktop(o) {
|
|
|
224
271
|
await saveState();
|
|
225
272
|
store.flush();
|
|
226
273
|
releaseLock(lock);
|
|
274
|
+
displaySource?.close();
|
|
227
275
|
if (native) await native.exit();
|
|
228
276
|
native = null;
|
|
229
277
|
const child = spawn(process.execPath, [process.argv[1], ...argv], { stdio: 'ignore', detached: true, windowsHide: true, env: { ...process.env, HIVEDESK_DESKTOP: '1' } });
|
|
@@ -259,7 +307,7 @@ export async function openDesktop(o) {
|
|
|
259
307
|
server.route('GET', '/api/desktop/shell', (req, res) => {
|
|
260
308
|
const html = fs.readFileSync(SHELL, 'utf8');
|
|
261
309
|
const cfg = {
|
|
262
|
-
start, platform, native: mode === 'native', strings: shellLabels(), min: MIN, state: publicState(), version: o.version || '', locale: S.locale,
|
|
310
|
+
start, platform, native: mode === 'native', strings: shellLabels(), min: MIN, state: publicState({ maximized: !!wmax?.maximized }), version: o.version || '', locale: S.locale,
|
|
263
311
|
update: updates ? updates.state() : null,
|
|
264
312
|
// First run (the DMG and the Linux packages have no installer wizard): ask for a name and an avatar once.
|
|
265
313
|
profile: { needed: !hidden && !readProfile(o.home) && !settings.profileAsked, gallery: GALLERY.avatars, nameMax: 32 }
|
|
@@ -282,7 +330,7 @@ export async function openDesktop(o) {
|
|
|
282
330
|
});
|
|
283
331
|
server.route('POST', '/api/desktop/ready', async (req, res) => {
|
|
284
332
|
const b = await readBody(req);
|
|
285
|
-
if (b.frame) { readyInfo.frame = b.detail || {}; readyResolve(readyInfo); }
|
|
333
|
+
if (b.frame) { readyInfo.frame = b.detail || {}; if (validRect(b.screen)) readyInfo.screen = b.screen; readyResolve(readyInfo); }
|
|
286
334
|
if (b.shell) readyInfo.shell = true;
|
|
287
335
|
json(res, 200, { ok: true });
|
|
288
336
|
});
|
|
@@ -292,12 +340,12 @@ export async function openDesktop(o) {
|
|
|
292
340
|
try {
|
|
293
341
|
switch (b.op) {
|
|
294
342
|
case 'minimize': await native.call('window.minimize'); break;
|
|
295
|
-
case 'toggleMaximize': await
|
|
343
|
+
case 'toggleMaximize': await toggleMaximize(); await saveState(); break;
|
|
296
344
|
case 'close': await onClose(); break;
|
|
297
345
|
case 'move': if (Number.isFinite(b.x) && Number.isFinite(b.y)) await native.call('window.move', { x: Math.round(b.x), y: Math.round(b.y) }); break;
|
|
298
346
|
case 'bounds':
|
|
299
347
|
if ([b.x, b.y, b.width, b.height].every(Number.isFinite)) {
|
|
300
|
-
await native.call('window.setSize', { width: Math.round(b.width), height: Math.round(b.height) });
|
|
348
|
+
await native.call('window.setSize', { width: Math.round(b.width), height: Math.round(b.height), ...sizeExtra });
|
|
301
349
|
await native.call('window.move', { x: Math.round(b.x), y: Math.round(b.y) });
|
|
302
350
|
}
|
|
303
351
|
break;
|
|
@@ -440,11 +488,38 @@ export async function openDesktop(o) {
|
|
|
440
488
|
});
|
|
441
489
|
if (shown) { o.progress?.(null); log(S.t('cli.desktop.downloadOk', { size: S.bytes(rt.target.bytes) })); }
|
|
442
490
|
const state = store.load();
|
|
491
|
+
// Windows, custom frame: saved bounds outside every display are moved onto one, and a window saved
|
|
492
|
+
// maximized opens straight on the work area of its monitor with the saved normal bounds to restore.
|
|
493
|
+
let open = state;
|
|
494
|
+
let restoreAtStart = null;
|
|
495
|
+
let workAtStart = null;
|
|
496
|
+
if (workArea) {
|
|
497
|
+
const list = await Promise.race([displaysAtStart, sleep(3000).then(() => null)]);
|
|
498
|
+
if (list) {
|
|
499
|
+
const normal = state.x !== undefined
|
|
500
|
+
? clampToDisplays(list, { x: state.x, y: state.y, width: state.width, height: state.height }, MIN)
|
|
501
|
+
: centerIn((list.find((d) => d.primary) || list[0]).work, state.width, state.height);
|
|
502
|
+
if (state.x !== undefined) open = { ...state, ...normal };
|
|
503
|
+
if (state.maximized) {
|
|
504
|
+
restoreAtStart = normal;
|
|
505
|
+
workAtStart = workAreaBounds(list, normal);
|
|
506
|
+
if (workAtStart) open = { ...state, ...workAtStart };
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
443
510
|
native = await launchNative({
|
|
444
511
|
binary: rt.path, appDir: path.join(o.home, 'desktop', 'app'),
|
|
445
|
-
config: runtimeConfig({ url: shellUrl, state, frame
|
|
512
|
+
config: runtimeConfig({ url: shellUrl, state: open, frame, hidden, version: o.version })
|
|
446
513
|
});
|
|
447
514
|
mode = 'native';
|
|
515
|
+
if (workArea) {
|
|
516
|
+
wmax = new WorkAreaMax({ call: (m, d) => native.call(m, d), displays, min: MIN, sizeExtra });
|
|
517
|
+
if (workAtStart) wmax.adopt(restoreAtStart, workAtStart);
|
|
518
|
+
} else if (state.maximized && !hidden && frame !== 'system') {
|
|
519
|
+
// macOS ([NSWindow zoom:] uses the visibleFrame) and Linux (the window manager) keep the dock,
|
|
520
|
+
// the menu bar and the panels free with the native maximize of the borderless window.
|
|
521
|
+
native.call('window.maximize').catch((err) => log(`window: ${err.message}`));
|
|
522
|
+
}
|
|
448
523
|
native.on('windowClose', () => { onClose().catch(() => {}); });
|
|
449
524
|
native.on('windowFocus', () => { focused = true; });
|
|
450
525
|
native.on('windowBlur', () => { focused = false; });
|
|
@@ -460,6 +535,7 @@ export async function openDesktop(o) {
|
|
|
460
535
|
const timer = new Promise((r) => setTimeout(() => r(null), Number(env.HIVEDESK_READY_MS) || 30000));
|
|
461
536
|
const ok = await Promise.race([ready, timer]);
|
|
462
537
|
if (!ok) throw Object.assign(new Error('not ready'), { code: 'not_ready' });
|
|
538
|
+
try { await placeAfterReady(state); } catch (err) { log(`window: ${err.message}`); }
|
|
463
539
|
if (!hidden) {
|
|
464
540
|
try { await native.call('os.setTray', { icon: trayIcon(), menuItems: trayMenu() }); trayOk = true; } catch (err) { log(`tray: ${err.message}`); }
|
|
465
541
|
}
|
|
@@ -495,6 +571,7 @@ export async function openDesktop(o) {
|
|
|
495
571
|
clearInterval(poll);
|
|
496
572
|
store.flush();
|
|
497
573
|
if (!hidden) releaseLock(lock);
|
|
574
|
+
displaySource?.close();
|
|
498
575
|
if (native) native.kill();
|
|
499
576
|
};
|
|
500
577
|
process.once('exit', onExit);
|
|
@@ -512,6 +589,7 @@ export async function openDesktop(o) {
|
|
|
512
589
|
process.removeListener('exit', onExit);
|
|
513
590
|
store.flush();
|
|
514
591
|
if (!hidden) releaseLock(lock);
|
|
592
|
+
displaySource?.close();
|
|
515
593
|
if (native) await native.exit();
|
|
516
594
|
native = null;
|
|
517
595
|
}
|
package/desktop/native.js
CHANGED
|
@@ -75,7 +75,10 @@ export function runtimeConfig({ url, title = 'hivedesk', state, frame = 'custom'
|
|
|
75
75
|
hidden: !!hidden, skipTaskbar: !!hidden, center: state.x === undefined
|
|
76
76
|
};
|
|
77
77
|
if (state.x !== undefined && !hidden) { win.x = state.x; win.y = state.y; }
|
|
78
|
-
|
|
78
|
+
// Only the system frame starts natively maximized. A borderless window maximized by the runtime covers the
|
|
79
|
+
// whole monitor on Windows (taskbar included), so the custom frame opens at normal bounds (or already on
|
|
80
|
+
// the work area) and the controller maximizes it (desktop/workarea.js).
|
|
81
|
+
if (state.maximized && !hidden && frame === 'system') win.maximize = true;
|
|
79
82
|
return {
|
|
80
83
|
applicationId: 'io.github.kwy404.hivedesk', version, defaultMode: 'window', port: 0,
|
|
81
84
|
documentRoot: '/resources/', url, enableServer: true, enableNativeAPI: true,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"en": "hivedesk 1.0.1. Downloading a model works in the desktop app again: the app brings its own npm for the local runtime, and a user folder with spaces in its name no longer breaks the install. When something still fails, the message says why. A phone that connects now shows the real computer name instead of null.",
|
|
3
|
+
"pt-BR": "hivedesk 1.0.1. Baixar modelos volta a funcionar no app de desktop: o app traz o próprio npm para o motor local, e uma pasta de usuário com espaços no nome não quebra mais a instalação. Se algo ainda falhar, a mensagem diz o motivo. Um celular que conecta agora mostra o nome real do computador em vez de null.",
|
|
4
|
+
"es": "hivedesk 1.0.1. Descargar modelos vuelve a funcionar en la app de escritorio: la app trae su propio npm para el motor local, y una carpeta de usuario con espacios en el nombre ya no rompe la instalación. Si algo aún falla, el mensaje dice por qué. Un móvil que se conecta ahora muestra el nombre real del equipo en lugar de null.",
|
|
5
|
+
"fr": "hivedesk 1.0.1. Le téléchargement des modèles fonctionne de nouveau dans l'application de bureau : l'application apporte son propre npm pour le moteur local, et un dossier utilisateur dont le nom contient des espaces ne casse plus l'installation. Si quelque chose échoue encore, le message dit pourquoi. Un téléphone qui se connecte affiche maintenant le vrai nom de l'ordinateur au lieu de null.",
|
|
6
|
+
"de": "hivedesk 1.0.1. Modelle laden in der Desktop-App wieder: Die App bringt ihr eigenes npm für die lokale Laufzeit mit, und ein Benutzerordner mit Leerzeichen im Namen bricht die Installation nicht mehr ab. Wenn noch etwas fehlschlägt, nennt die Meldung den Grund. Ein verbundenes Handy zeigt jetzt den echten Computernamen statt null.",
|
|
7
|
+
"it": "hivedesk 1.0.1. Scaricare i modelli funziona di nuovo nell'app desktop: l'app porta il proprio npm per il motore locale, e una cartella utente con spazi nel nome non blocca più l'installazione. Se qualcosa fallisce ancora, il messaggio dice perché. Un telefono che si collega ora mostra il vero nome del computer invece di null.",
|
|
8
|
+
"ja": "hivedesk 1.0.1。デスクトップアプリでモデルのダウンロードが再び動作します。アプリはローカル実行環境用に独自の npm を同梱し、名前に空白を含むユーザーフォルダーでもインストールが失敗しなくなりました。それでも失敗した場合は、メッセージに理由が表示されます。スマートフォンが接続すると、null ではなく実際のコンピューター名が表示されます。",
|
|
9
|
+
"ko": "hivedesk 1.0.1. 데스크톱 앱에서 모델 다운로드가 다시 작동합니다. 앱이 로컬 런타임용 npm을 직접 포함하며, 이름에 공백이 있는 사용자 폴더에서도 설치가 더 이상 실패하지 않습니다. 그래도 실패하면 메시지가 이유를 알려 줍니다. 휴대폰이 연결되면 null 대신 실제 컴퓨터 이름이 표시됩니다.",
|
|
10
|
+
"zh-CN": "hivedesk 1.0.1。桌面应用中下载模型恢复正常:应用自带用于本地运行时的 npm,用户文件夹名称中包含空格也不会再导致安装失败。如果仍有失败,提示会说明原因。手机连接时现在显示电脑的真实名称,而不是 null。",
|
|
11
|
+
"ru": "hivedesk 1.0.1. Загрузка моделей снова работает в настольном приложении: приложение приносит собственный npm для локальной среды, а папка пользователя с пробелами в имени больше не ломает установку. Если что-то всё же не удаётся, сообщение объясняет причину. Подключённый телефон теперь показывает настоящее имя компьютера вместо null."
|
|
12
|
+
}
|