hivedesk 1.0.0 → 1.0.2

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.
Files changed (93) hide show
  1. package/CHANGELOG.md +143 -111
  2. package/README.md +307 -303
  3. package/desktop/controller.js +85 -7
  4. package/desktop/native.js +4 -1
  5. package/desktop/release-notes/1.0.1.json +12 -0
  6. package/desktop/release-notes/1.0.2.json +12 -0
  7. package/desktop/scripts/package.mjs +11 -0
  8. package/desktop/shell.html +5 -2
  9. package/desktop/workarea.js +440 -0
  10. package/i18n/README.pt-BR.md +308 -304
  11. package/i18n/de.json +247 -4
  12. package/i18n/en.json +247 -4
  13. package/i18n/es.json +247 -4
  14. package/i18n/fr.json +247 -4
  15. package/i18n/it.json +247 -4
  16. package/i18n/ja.json +247 -4
  17. package/i18n/ko.json +247 -4
  18. package/i18n/parts/downloads.de.json +29 -0
  19. package/i18n/parts/downloads.en.json +29 -0
  20. package/i18n/parts/downloads.es.json +29 -0
  21. package/i18n/parts/downloads.fr.json +29 -0
  22. package/i18n/parts/downloads.it.json +29 -0
  23. package/i18n/parts/downloads.ja.json +29 -0
  24. package/i18n/parts/downloads.ko.json +29 -0
  25. package/i18n/parts/downloads.pt-BR.json +29 -0
  26. package/i18n/parts/downloads.ru.json +29 -0
  27. package/i18n/parts/downloads.zh-CN.json +29 -0
  28. package/i18n/parts/office.de.json +184 -0
  29. package/i18n/parts/office.en.json +184 -0
  30. package/i18n/parts/office.es.json +184 -0
  31. package/i18n/parts/office.fr.json +184 -0
  32. package/i18n/parts/office.it.json +184 -0
  33. package/i18n/parts/office.ja.json +184 -0
  34. package/i18n/parts/office.ko.json +184 -0
  35. package/i18n/parts/office.pt-BR.json +184 -0
  36. package/i18n/parts/office.ru.json +184 -0
  37. package/i18n/parts/office.zh-CN.json +184 -0
  38. package/i18n/pt-BR.json +247 -4
  39. package/i18n/ru.json +247 -4
  40. package/i18n/zh-CN.json +247 -4
  41. package/package.json +3 -2
  42. package/src/brain/manager.js +23 -7
  43. package/src/brain/models.js +146 -30
  44. package/src/brain/runtime.js +61 -13
  45. package/src/crew/domains/flow.js +2 -1
  46. package/src/crew/engine.js +172 -22
  47. package/src/crew/legacy.js +72 -0
  48. package/src/crew/planner.js +14 -1
  49. package/src/crew/talk.js +110 -3
  50. package/src/crew/taskgraph.js +12 -2
  51. package/src/crew/worker.js +60 -2
  52. package/src/index.js +4 -1
  53. package/src/p2p/doctor.js +4 -1
  54. package/src/phone/hub.js +15 -3
  55. package/src/phone/port.js +1 -1
  56. package/src/replay/reduce.js +1 -0
  57. package/src/tools/check.js +2 -0
  58. package/src/voice/index.js +1 -1
  59. package/src/voice/piper.js +10 -4
  60. package/src/voice/store.js +2 -1
  61. package/src/voice/whisper.js +63 -25
  62. package/ui/city/activity.js +4 -1
  63. package/ui/city/city.js +5 -5
  64. package/ui/city/scene.js +2 -1
  65. package/ui/css/hive.css +20 -0
  66. package/ui/js/dock.js +2 -2
  67. package/ui/js/dom.js +23 -18
  68. package/ui/js/i18n.js +12 -0
  69. package/ui/js/main.js +43 -3
  70. package/ui/js/md.js +130 -0
  71. package/ui/js/net.js +6 -0
  72. package/ui/js/palette.js +2 -2
  73. package/ui/js/store.js +20 -2
  74. package/ui/js/topbar.js +2 -2
  75. package/ui/js/voice/index.js +3 -2
  76. package/ui/js/widgets/brief.js +28 -10
  77. package/ui/js/widgets/chat.js +16 -4
  78. package/ui/js/widgets/files.js +3 -3
  79. package/ui/js/widgets/memory.js +3 -3
  80. package/ui/js/widgets/replay.js +3 -3
  81. package/ui/js/widgets/settings.js +2 -2
  82. package/ui/js/widgets/timeline.js +2 -2
  83. package/ui/js/widgets/worker.js +17 -6
  84. package/ui/models/index.js +3 -2
  85. package/ui/models/window.js +2 -2
  86. package/ui/office/office.js +145 -106
  87. package/ui/office/popout.js +4 -3
  88. package/ui/office/scene.js +47 -28
  89. package/ui/phone/core/client.js +11 -5
  90. package/ui/phone/desktop.js +2 -1
  91. package/ui/widget.html +8 -8
  92. package/ui/widget.js +35 -20
  93. package/ui/workbench/searchview.js +3 -3
@@ -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
- return { width: size.width, height: size.height, x: pos.x, y: pos.y, maximized: !!max, minimized: !!min };
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
- if (s.maximized) store.save({ maximized: true });
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 native.call((await native.call('window.isMaximized')) ? 'window.unmaximize' : 'window.maximize'); await saveState(); break;
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: settings.frame, hidden, version: o.version })
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
- if (state.maximized && !hidden) win.maximize = true;
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
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "en": "hivedesk 1.0.2. A new website in 10 languages, with a light and a dark theme. The relay check (hivedesk doctor --p2p) no longer prints a warning when a relay is an IP address. A download whose part file turned into a folder now stops with a clear message, and Code together links open the right page.",
3
+ "pt-BR": "hivedesk 1.0.2. Um site novo em 10 idiomas, com tema claro e escuro. A verificação do relay (hivedesk doctor --p2p) não mostra mais um aviso quando o relay é um endereço IP. Um download cujo arquivo parcial virou uma pasta agora para com uma mensagem clara, e os links de Code together abrem a página certa.",
4
+ "es": "hivedesk 1.0.2. Un sitio nuevo en 10 idiomas, con tema claro y oscuro. La comprobación del relay (hivedesk doctor --p2p) ya no muestra un aviso cuando el relay es una dirección IP. Una descarga cuyo archivo parcial se convirtió en carpeta ahora se detiene con un mensaje claro, y los enlaces de Code together abren la página correcta.",
5
+ "fr": "hivedesk 1.0.2. Un nouveau site en 10 langues, avec un thème clair et un thème sombre. La vérification du relais (hivedesk doctor --p2p) n'affiche plus d'avertissement quand le relais est une adresse IP. Un téléchargement dont le fichier partiel est devenu un dossier s'arrête maintenant avec un message clair, et les liens Code together ouvrent la bonne page.",
6
+ "de": "hivedesk 1.0.2. Eine neue Website in 10 Sprachen, mit hellem und dunklem Design. Die Relay-Prüfung (hivedesk doctor --p2p) zeigt keine Warnung mehr, wenn ein Relay eine IP-Adresse ist. Ein Download, dessen Teildatei zu einem Ordner wurde, stoppt jetzt mit einer klaren Meldung, und Code together-Links öffnen die richtige Seite.",
7
+ "it": "hivedesk 1.0.2. Un sito nuovo in 10 lingue, con tema chiaro e scuro. Il controllo del relay (hivedesk doctor --p2p) non mostra più un avviso quando il relay è un indirizzo IP. Un download il cui file parziale è diventato una cartella ora si ferma con un messaggio chiaro, e i link di Code together aprono la pagina giusta.",
8
+ "ja": "hivedesk 1.0.2。10言語に対応し、ライトとダークのテーマを備えた新しいWebサイトになりました。リレーの確認(hivedesk doctor --p2p)は、リレーがIPアドレスのときに警告を出さなくなりました。途中のファイルがフォルダーになってしまったダウンロードは、わかりやすいメッセージとともに止まるようになり、Code together のリンクは正しいページを開きます。",
9
+ "ko": "hivedesk 1.0.2. 10개 언어와 라이트, 다크 테마를 갖춘 새 웹사이트입니다. 릴레이 확인(hivedesk doctor --p2p)은 릴레이가 IP 주소일 때 더 이상 경고를 표시하지 않습니다. 임시 파일이 폴더로 바뀐 다운로드는 이제 분명한 메시지와 함께 멈추고, Code together 링크는 올바른 페이지를 엽니다.",
10
+ "zh-CN": "hivedesk 1.0.2。全新的网站,支持 10 种语言,提供浅色和深色主题。中继检查(hivedesk doctor --p2p)在中继为 IP 地址时不再显示警告。如果下载的临时文件变成了文件夹,下载现在会停止并给出清楚的提示;Code together 链接会打开正确的页面。",
11
+ "ru": "hivedesk 1.0.2. Новый сайт на 10 языках, со светлой и тёмной темой. Проверка ретранслятора (hivedesk doctor --p2p) больше не выводит предупреждение, когда ретранслятор задан IP-адресом. Загрузка, у которой временный файл оказался папкой, теперь останавливается с понятным сообщением, а ссылки Code together открывают нужную страницу."
12
+ }
@@ -1,6 +1,7 @@
1
1
  // Builds the folder of one downloadable package. Used by .github/workflows/desktop.yml.
2
2
  // node desktop/scripts/package.mjs --target windows-x64|macos-universal|linux-x64 --node <node binary> --out <dir>
3
3
  // [--launcher <hivedesk.exe>] (Windows: the compiled launcher)
4
+ // [--npm <npm folder>] (the npm package of the same Node.js build; found next to --node when left out)
4
5
  // The runtime binary comes from the pinned upstream archive and is checked against desktop/platform.js.
5
6
  import fs from 'node:fs';
6
7
  import os from 'node:os';
@@ -103,6 +104,16 @@ if (nodeLicense) fs.copyFileSync(nodeLicense, path.join(path.dirname(nodeDest),
103
104
  else console.warn('package: no Node.js LICENSE found next to the node binary');
104
105
  fs.copyFileSync(opts.node, nodeDest);
105
106
  fs.chmodSync(nodeDest, 0o755);
107
+ // npm goes with the bundled Node.js: the local model runtime (node-llama-cpp) is installed with it on first use,
108
+ // and a PC without Node.js has no other npm. It sits where src/brain/runtime.js looks for it: next to node.exe on
109
+ // Windows, in ../lib/node_modules on macOS and Linux, the layout of the official Node.js archives.
110
+ const npmSrc = opts.npm || [path.join(path.dirname(opts.node), 'node_modules', 'npm'), path.join(path.dirname(path.dirname(opts.node)), 'lib', 'node_modules', 'npm')]
111
+ .find((d) => fs.existsSync(path.join(d, 'bin', 'npm-cli.js')));
112
+ if (!npmSrc || !fs.existsSync(path.join(npmSrc, 'bin', 'npm-cli.js'))) throw new Error('package: npm was not found next to the bundled Node.js; pass --npm <folder>');
113
+ const npmDest = opts.target === 'windows-x64'
114
+ ? path.join(path.dirname(nodeDest), 'node_modules', 'npm')
115
+ : path.join(path.dirname(path.dirname(nodeDest)), 'lib', 'node_modules', 'npm');
116
+ fs.cpSync(npmSrc, npmDest, { recursive: true });
106
117
 
107
118
  const readme = [
108
119
  `hivedesk ${pkg.version} (${opts.target})`,
@@ -52,6 +52,7 @@
52
52
  iframe { position: fixed; top: var(--bar-h); left: 0; width: 100%; height: calc(100% - var(--bar-h)); border: 0; background: var(--bg); display: block; }
53
53
  .edge { position: fixed; z-index: 5; }
54
54
  .max .edge, .system .edge { display: none; }
55
+ .ctl .i-res { display: none; } .max:not(.mac) .ctl .i-max { display: none; } .max:not(.mac) .ctl .i-res { display: block; }
55
56
  .n { top: 0; left: 8px; right: 8px; height: 4px; cursor: ns-resize; } .s { bottom: 0; left: 8px; right: 8px; height: 5px; cursor: ns-resize; }
56
57
  .e { right: 0; top: 8px; bottom: 8px; width: 5px; cursor: ew-resize; } .w { left: 0; top: 8px; bottom: 8px; width: 5px; cursor: ew-resize; }
57
58
  .ne, .nw, .se, .sw { width: 9px; height: 9px; } .ne { top: 0; right: 0; cursor: nesw-resize; } .sw { bottom: 0; left: 0; cursor: nesw-resize; }
@@ -153,7 +154,7 @@
153
154
  <div class="ctl">
154
155
  <button class="menu" id="bMenu" aria-haspopup="true" aria-expanded="false"><svg width="14" height="14" viewBox="0 0 14 14" aria-hidden="true"><path d="M2 4h10M2 7h10M2 10h10" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"/></svg></button>
155
156
  <button class="min" id="bMin"><svg width="10" height="10" viewBox="0 0 10 10" aria-hidden="true"><path d="M1 5h8" stroke="currentColor"/></svg></button>
156
- <button class="max" id="bMax"><svg width="10" height="10" viewBox="0 0 10 10" aria-hidden="true"><rect x="1" y="1" width="8" height="8" fill="none" stroke="currentColor"/></svg></button>
157
+ <button class="max" id="bMax"><svg class="i-max" width="10" height="10" viewBox="0 0 10 10" aria-hidden="true"><rect x="1" y="1" width="8" height="8" fill="none" stroke="currentColor"/></svg><svg class="i-res" width="10" height="10" viewBox="0 0 10 10" aria-hidden="true"><path d="M3 2.5V1h6v6H7.5" fill="none" stroke="currentColor"/><rect x="1" y="3" width="6" height="6" fill="none" stroke="currentColor"/></svg></button>
157
158
  <button class="x" id="bClose"><svg width="10" height="10" viewBox="0 0 10 10" aria-hidden="true"><path d="M1 1l8 8M9 1 1 9" stroke="currentColor"/></svg></button>
158
159
  </div>
159
160
  </header>
@@ -337,7 +338,9 @@
337
338
  detail = { title: d.title, scripts: d.scripts.length, body: d.body ? d.body.children.length : 0 };
338
339
  } catch (err) { detail = { error: String(err) }; }
339
340
  ui.contentWindow.postMessage({ type: 'hivedesk:desktop:hello', platform: C.platform, native: C.native, ops: BRIDGE }, location.origin);
340
- api('ready', { frame: true, detail });
341
+ // The screen the window is on, so the controller can bring back a window saved outside every display.
342
+ const scr = { x: screen.availLeft || 0, y: screen.availTop || 0, width: screen.availWidth, height: screen.availHeight };
343
+ api('ready', { frame: true, detail, screen: scr });
341
344
  });
342
345
  // Updates: the panel under the title bar, the menu items and the About card.
343
346
  const U = L.update || {};