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
@@ -1,11 +1,11 @@
1
1
  // A worker's own window: avatar, status, current task, live model output, tool calls
2
2
  // and a direct chat.
3
3
 
4
- import { h, icon, clear, fmtDuration } from '../dom.js';
4
+ import { h, icon, clear, fmtDuration, mdNode } from '../dom.js';
5
5
  import { beeAvatar } from '../bees.js';
6
6
  import { register } from '../wm.js';
7
7
  import * as wm from '../wm.js';
8
- import { S, rev, ui, worker, extra } from '../store.js';
8
+ import { S, rev, ui, worker, extra, roleName } from '../store.js';
9
9
  import { provide } from '../menu.js';
10
10
  import * as act from '../actions.js';
11
11
  import { t, fmtNumber } from '../i18n.js';
@@ -40,7 +40,7 @@ export function workerMenu(w) {
40
40
  if (!w) return null;
41
41
  const builtin = w.builtin || ['mel', 'dev', 'designer', 'qa', 'writer'].includes(w.id);
42
42
  return [
43
- { header: t('worker.menu.header', { name: w.name, role: w.role || t('worker.menu.roleFallback') }) },
43
+ { header: t('worker.menu.header', { name: w.name, role: roleName(w) || t('worker.menu.roleFallback') }) },
44
44
  { label: t('worker.menu.chat'), icon: 'chat', action: () => wm.open('worker', w.id) },
45
45
  { label: t('worker.menu.assign'), icon: 'plan', disabled: !!ui.replay, action: () => assignTask(w.id) },
46
46
  { label: w.paused ? t('worker.menu.resume') : t('worker.menu.pause'), icon: w.paused ? 'arrow' : 'stop', disabled: !!ui.replay, action: () => act.pauseWorker(w.id, !w.paused) },
@@ -87,7 +87,7 @@ register('worker', {
87
87
  head.append(beeAvatar(w, 48, { ring: true, status: w.paused ? 'queued' : st.key }),
88
88
  h('div', { class: 'grow' },
89
89
  h('div', { class: 'wk-name', text: w.name }),
90
- h('div', { class: 'wk-role ellipsis', text: w.role || '' }),
90
+ h('div', { class: 'wk-role ellipsis', text: roleName(w) }),
91
91
  h('div', { class: 'wk-stat' }, h('span', { class: `sdot sdot-${st.key}` }), h('span', { class: 'ellipsis', text: task && st.key !== 'idle' ? `${st.label} · ${task.title}` : st.label }))),
92
92
  h('button', { class: 'ibtn', type: 'button', 'aria-label': t('worker.actions', { name: w.name }), tip: 'tip.worker.actions', 'aria-haspopup': 'menu', on: { click: (e) => import('../menu.js').then((m) => { const r = e.currentTarget.getBoundingClientRect(); m.open({ x: r.left, y: r.bottom + 4, items: workerMenu(w) }); }) } },
93
93
  h('span', { html: '<svg class="ico" viewBox="0 0 24 24"><circle cx="5" cy="12" r="1.6" fill="currentColor" stroke="none"/><circle cx="12" cy="12" r="1.6" fill="currentColor" stroke="none"/><circle cx="19" cy="12" r="1.6" fill="currentColor" stroke="none"/></svg>' })));
@@ -100,15 +100,26 @@ register('worker', {
100
100
  const active = !turn.ended && ['thinking', 'tool'].includes(st);
101
101
  stream.hidden = !turn.text && !active;
102
102
  if (stream.hidden) return;
103
- const pre = stream.querySelector('pre') || h('pre', { 'aria-live': 'off' });
103
+ const pre = stream.querySelector('pre.turn-raw') || h('pre', { class: 'turn-raw', 'aria-live': 'off' });
104
104
  const label = active
105
105
  ? t('worker.stream.active', { n: turn.n ?? '' })
106
106
  : [t('worker.stream.last'), turn.ms ? fmtDuration(turn.ms) : null, turn.tps ? t('worker.stream.tps', { tps: fmtNumber(turn.tps, { minimumFractionDigits: 1, maximumFractionDigits: 1 }) }) : null].filter(Boolean).join(' · ');
107
107
  if (!stream.firstChild) stream.append(h('div', { class: 'stream-h', tip: 'tip.worker.stream' }, icon('model', 'ico-sm'), h('span', { class: 'grow lbl-t' }), h('span', { class: 'spin' })), pre);
108
108
  stream.querySelector('.lbl-t').textContent = label;
109
109
  stream.querySelector('.spin').hidden = !active;
110
+ stream.querySelector('.md-turn')?.remove();
111
+ pre.hidden = false;
110
112
  let txt = turn.text.length > 4000 ? `...${turn.text.slice(-4000)}` : turn.text;
111
- if (!active) { try { txt = JSON.stringify(JSON.parse(turn.text), null, 2); } catch {} }
113
+ if (!active) {
114
+ let json = false;
115
+ try { txt = JSON.stringify(JSON.parse(turn.text), null, 2); json = true; } catch {}
116
+ // A finished answer in words is markdown ("1. **Dev**: ..."): rendered, not shown raw.
117
+ if (!json && txt.trim()) {
118
+ pre.hidden = true;
119
+ stream.append(mdNode(txt, 'md-turn'));
120
+ return;
121
+ }
122
+ }
112
123
  pre.textContent = txt;
113
124
  if (active && !turn.text) pre.append(h('span', { class: 'faint', text: `${t('worker.stream.waiting')} ` }));
114
125
  if (active) pre.append(h('span', { class: 'caret' }));
@@ -11,7 +11,7 @@ import * as net from '/js/net.js';
11
11
  import { S, rev, ui, extra, onEvent } from '/js/store.js';
12
12
  import { openDialog } from '/js/dialog.js';
13
13
  import { notify } from '/js/notify.js';
14
- import { fmtNumber, L } from '/js/i18n.js';
14
+ import { fmtNumber, L, dlError } from '/js/i18n.js';
15
15
  import { track } from '/js/widgets/util.js';
16
16
  import { T, strings, ready } from './t.js';
17
17
 
@@ -169,7 +169,8 @@ function progressView(onClose) {
169
169
  return;
170
170
  }
171
171
  if (d.phase === 'failed' || b.state === 'error') {
172
- put(box, h('div', { class: 'honest bad' }, icon('x'), h('div', {}, h('b', { text: d.message || b.detail || T('models.dl.failed') }), d.hint || b.hint ? h('div', { class: 'small', text: d.hint || b.hint }) : null)),
172
+ const failure = dlError(d.phase === 'failed' ? d : { ...b, message: b.detail });
173
+ put(box, h('div', { class: 'honest bad' }, icon('x'), h('div', {}, h('b', { text: failure.text || T('models.dl.failed') }), failure.detail ? h('div', { class: 'small', text: failure.detail }) : null)),
173
174
  h('div', { class: 'row', style: 'justify-content:flex-end' },
174
175
  d.id ? h('button', { type: 'button', class: 'btn btn-sm btn-primary', text: T('models.btn.retry'), on: { click: () => consent(d.id, { via: 'card' }) } }) : null,
175
176
  h('button', { type: 'button', class: 'btn btn-sm btn-quiet', text: T('models.btn.close'), on: { click: onClose } })));
@@ -13,7 +13,7 @@ import * as net from '/js/net.js';
13
13
  import { rev } from '/js/store.js';
14
14
  import { openDialog } from '/js/dialog.js';
15
15
  import { notify } from '/js/notify.js';
16
- import { fmtNumber, L } from '/js/i18n.js';
16
+ import { fmtNumber, L, dlError } from '/js/i18n.js';
17
17
  import { track } from '/js/widgets/util.js';
18
18
  import { T, strings } from './t.js';
19
19
  import { mx, analyze, loadCatalog, optionOf, shortName, modelOf, hardwarePanel, whyText, whereText, speedText, qualityBars, licenseLine, put, gb, errText, openConsent } from './index.js';
@@ -43,7 +43,7 @@ net.on('event', (frame) => {
43
43
  } else if (/^models\.install\.(finished|failed|cancelled|queued|started)$/.test(e.type) || e.type === 'models.deleted' || e.type === 'brain.download.finished') {
44
44
  if (/finished|deleted/.test(e.type)) analyze();
45
45
  else refreshDisk();
46
- if (e.type === 'models.install.failed') notify({ title: T('models.dl.failed'), body: e.data.message, tone: 'bad', icon: 'download' });
46
+ if (e.type === 'models.install.failed') notify({ title: T('models.dl.failed'), body: dlError(e.data).text, tone: 'bad', icon: 'download' });
47
47
  } else if (/^pool\.(lend|share|flag|build)/.test(e.type)) {
48
48
  loadShare();
49
49
  } else if (e.type === 'models.router.changed') {
@@ -3,8 +3,11 @@
3
3
  // same engine events as every widget. Click a bee to chat, right click for its menu,
4
4
  // drag a sticky note from Mel's board onto a bee to hand the task over.
5
5
 
6
- import { h, icon, clear, reducedMotion } from '/js/dom.js';
7
- import { S, rev, ui, worker, onEvent, currentJob, jobTasks } from '/js/store.js';
6
+ import { h, icon, clear, reducedMotion, append } from '/js/dom.js';
7
+ import { S, rev, ui, worker, onEvent, currentJob, jobTasks, roleName } from '/js/store.js';
8
+ import { t, onLocale } from '/js/i18n.js';
9
+ import { mdLine } from '/js/md.js';
10
+ import { setTip } from '/js/tooltip.js';
8
11
  import * as net from '/js/net.js';
9
12
  import * as wm from '/js/wm.js';
10
13
  import * as menu from '/js/menu.js';
@@ -16,11 +19,12 @@ import * as audio from './audio.js';
16
19
  import { openWidget, openPip, pipSupported } from './popout.js';
17
20
 
18
21
  const VIEW_KEY = 'hivedesk.view.v2'; // v2: City became the default home in 0.2.0
19
- const MODE_LABEL = {
20
- idle: 'Idle', sleep: 'Napping (idle)', type: 'Typing', plan: 'Planning on the board', wait: 'In the queue for the model',
21
- stuck: 'Waiting for your approval', test: 'Running checks', read: 'Reading files', error: 'Error', celebrate: 'Celebrating',
22
- paused: 'Paused', fly: 'Flying over',
23
- };
22
+ // What a bee is doing in the scene, read in the current language when shown (office.mode.*).
23
+ export const MODES = ['idle', 'sleep', 'type', 'plan', 'wait', 'stuck', 'test', 'read', 'error', 'celebrate', 'paused', 'fly'];
24
+ const modeLabel = (m) => (MODES.includes(m) ? t(`office.mode.${m}`) : '');
25
+ export const JOB_STATES = ['refining', 'awaiting_brief', 'planning', 'running', 'done', 'failed', 'cancelled'];
26
+ const roleOf = (w) => roleName(w) || t('office.worker');
27
+ const statusOf = (w, m, st) => (w.paused ? t('office.mode.paused') : modeLabel(m) || STATUS_LABEL[st.status] || st.status);
24
28
 
25
29
  let layer;
26
30
  let scene;
@@ -63,7 +67,7 @@ export function initOffice({ desk, barRight, addDockItem }) {
63
67
  linkCss();
64
68
  readHourOverride();
65
69
  deskEl = desk;
66
- layer = h('section', { class: 'of-layer', hidden: true, 'aria-label': 'Office. The crew at work. Tab to a bee or a note, Enter to open, Shift F10 for its menu.' });
70
+ layer = h('section', { class: 'of-layer', hidden: true, ta: 'office.view.aria' });
67
71
  canvas = h('canvas', { class: 'of-canvas', 'aria-hidden': 'true' });
68
72
  hitLayer = h('div', { class: 'of-hits' });
69
73
  tip = h('div', { class: 'of-tip', role: 'tooltip', id: 'of-tip' });
@@ -86,23 +90,34 @@ export function initOffice({ desk, barRight, addDockItem }) {
86
90
  new ResizeObserver(() => { if (mode === 'office') scene.resize(layer.clientWidth, layer.clientHeight); }).observe(layer);
87
91
 
88
92
  // the toggle in the top bar
89
- seg = h('div', { class: 'of-seg', role: 'group', 'aria-label': 'View' },
90
- h('button', { type: 'button', dataset: { v: 'office' }, title: 'Office: the crew at work', on: { click: () => setMode('office') } }, officeGlyph(), h('span', { text: 'Office' })),
91
- h('button', { type: 'button', dataset: { v: 'desktop' }, title: 'Desktop: windows and widgets', on: { click: () => setMode('desktop') } }, icon('hive', 'ico-sm'), h('span', { text: 'Desktop' })));
93
+ const segOffice = h('button', { type: 'button', dataset: { v: 'office' }, on: { click: () => setMode('office') } }, officeGlyph(), h('span', { tx: 'office.seg.office' }));
94
+ const segDesk = h('button', { type: 'button', dataset: { v: 'desktop' }, on: { click: () => setMode('desktop') } }, icon('hive', 'ico-sm'), h('span', { tx: 'office.seg.desktop' }));
95
+ seg = h('div', { class: 'of-seg', role: 'group', ta: 'office.seg.aria' }, segOffice, segDesk);
92
96
  barRight?.prepend(seg);
93
97
 
94
- addDockItem?.({
95
- id: 'widget', label: 'Mini widget', sub: 'a small always on view',
98
+ const dockBtn = addDockItem?.({
99
+ id: 'widget', label: t('office.dock.label'), sub: () => t('office.dock.sub'),
96
100
  content: h('span', { class: 'dk-hex' }, miniGlyph()),
97
101
  onClick: () => openWidget(),
98
102
  menu: () => [
99
- { header: 'Mini widget' },
100
- { label: 'Pop out a window (360 by 480)', icon: 'preview', action: () => openWidget() },
101
- { label: 'Picture in picture', icon: 'preview', disabled: !pipSupported(), action: () => openPip() },
103
+ { header: t('office.dock.label') },
104
+ { label: t('office.dock.popOut'), icon: 'preview', action: () => openWidget() },
105
+ { label: t('office.dock.pip'), icon: 'preview', disabled: !pipSupported(), action: () => openPip() },
102
106
  { sep: true },
103
- { label: mode === 'office' ? 'Back to the desktop' : 'Open the Office', icon: 'hive', action: () => setMode(mode === 'office' ? 'desktop' : 'office') },
107
+ { label: mode === 'office' ? t('office.dock.toDesktop') : t('office.dock.toOffice'), icon: 'hive', action: () => setMode(mode === 'office' ? 'desktop' : 'office') },
104
108
  ],
105
109
  });
110
+ // the dock keeps the label it got: keep it in the current language
111
+ const dockTip = () => { if (!dockBtn?.setAttribute) return; dockBtn.setAttribute('aria-label', t('office.dock.label')); setTip(dockBtn, { title: t('office.dock.label'), help: t('office.dock.sub') }); };
112
+ dockBtn?.addEventListener?.('pointerenter', dockTip);
113
+ dockBtn?.addEventListener?.('focus', dockTip);
114
+ const paintStatic = () => {
115
+ segOffice.title = t('office.seg.officeTitle');
116
+ segDesk.title = t('office.seg.desktopTitle');
117
+ dockTip();
118
+ };
119
+ paintStatic();
120
+ onLocale(() => { paintStatic(); paintSound(); if (hud.segs) hud.segs._key = null; paintHud(); });
106
121
 
107
122
  // engine wiring
108
123
  net.on('hello', () => { scene.reset(); shownHoney = null; paintHud(); });
@@ -212,26 +227,30 @@ function buildHud() {
212
227
  hud.xpLv = h('span', { class: 'of-xp-lv' });
213
228
  // progress is a segmented timeline: one segment per task, colored by its state
214
229
  hud.segs = h('span', { class: 'of-tl', 'aria-hidden': 'true' });
215
- hud.xp = h('div', { class: 'of-xp', role: 'progressbar', 'aria-label': 'Job progress', 'aria-valuemin': '0', 'aria-valuemax': '100' }, xpFill, hud.segs);
230
+ hud.xp = h('div', { class: 'of-xp', role: 'progressbar', ta: 'office.hud.progress', 'aria-valuemin': '0', 'aria-valuemax': '100' }, xpFill, hud.segs);
216
231
  hud.xpFill = xpFill;
217
232
  hud.state = h('span', { class: 'of-chip' });
233
+ // waiting for the user's OK on Mel's brief: one clear way to it
234
+ hud.openBrief = h('button', { type: 'button', class: 'btn btn-xs btn-primary of-brief-btn', style: 'justify-self:start', hidden: true, tx: 'office.hud.openBrief', on: { click: () => { setMode('desktop'); wm.open('brief'); } } });
218
235
  const job = h('div', { class: 'of-card of-job' },
219
- h('div', { class: 'of-row' }, h('span', { class: 'of-k', text: 'Current job' }), hud.state),
236
+ h('div', { class: 'of-row' }, h('span', { class: 'of-k', tx: 'office.hud.currentJob' }), hud.state),
220
237
  hud.req,
221
238
  h('div', { class: 'of-row', style: 'gap:10px' }, hud.xpLv, hud.xp),
222
- hud.xpText);
239
+ hud.xpText,
240
+ hud.openBrief);
223
241
 
224
242
  const doneMark = h('span', { class: 'of-jar', html: CHECK_SVG, 'aria-hidden': 'true' });
225
243
  hud.honeyN = h('b', { text: '0' });
226
- hud.honey = h('div', { class: 'of-pill of-honey', title: 'Finished tasks in this workspace' }, doneMark, hud.honeyN, h('span', { class: 'of-faint', text: 'tasks done' }));
244
+ hud.honeyT = h('span', { class: 'of-faint' });
245
+ hud.honey = h('div', { class: 'of-pill of-honey' }, doneMark, hud.honeyN, hud.honeyT);
227
246
  hud.clock = h('div', { class: 'of-pill of-clock' });
228
247
  hud.sound = h('button', { type: 'button', class: 'of-ib', on: { click: () => { audio.setAmbient(!audio.ambientOn()); paintSound(); } } });
229
- const pop = h('button', { type: 'button', class: 'of-ib', title: 'Pop out the mini widget', 'aria-label': 'Pop out the mini widget', on: { click: () => openWidget() } }, miniGlyph());
230
- const pip = h('button', { type: 'button', class: 'of-ib', title: 'Picture in picture', 'aria-label': 'Picture in picture mini window', hidden: !pipSupported(), on: { click: () => openPip() } }, pipGlyph());
231
- const stats = h('div', { class: 'of-stats' }, hud.honey, hud.clock, h('div', { class: 'of-pill of-tools' }, hud.sound, pop, pip));
248
+ hud.pop = h('button', { type: 'button', class: 'of-ib', ta: 'office.hud.popOut', on: { click: () => openWidget() } }, miniGlyph());
249
+ hud.pip = h('button', { type: 'button', class: 'of-ib', ta: 'office.hud.pipAria', hidden: !pipSupported(), on: { click: () => openPip() } }, pipGlyph());
250
+ const stats = h('div', { class: 'of-stats' }, hud.honey, hud.clock, h('div', { class: 'of-pill of-tools' }, hud.sound, hud.pop, hud.pip));
232
251
 
233
252
  hud.queue = h('div', { class: 'of-card of-queue' });
234
- hud.feed = h('ol', { class: 'of-card of-feed', 'aria-label': 'Office activity', 'aria-live': 'polite' });
253
+ hud.feed = h('ol', { class: 'of-card of-feed', ta: 'office.hud.feed', 'aria-live': 'polite' });
235
254
  hud.banner = h('div', { class: 'of-banner', role: 'status', hidden: true });
236
255
  hud.empty = h('div', { class: 'of-empty', hidden: true });
237
256
  paintSound();
@@ -241,8 +260,12 @@ function buildHud() {
241
260
  function paintSound() {
242
261
  const on = audio.ambientOn();
243
262
  hud.sound.setAttribute('aria-pressed', String(on));
244
- hud.sound.setAttribute('aria-label', on ? 'Office sounds on' : 'Office sounds off');
245
- hud.sound.title = on ? 'Office sounds on (soft room tone, typing, wings)' : 'Office sounds off';
263
+ hud.sound.setAttribute('aria-label', on ? t('office.hud.soundOn') : t('office.hud.soundOff'));
264
+ hud.sound.title = on ? t('office.hud.soundOnTitle') : t('office.hud.soundOff');
265
+ // the other fixed titles of the HUD, in the current language
266
+ hud.honey.title = t('office.hud.honeyTitle');
267
+ hud.pop.title = t('office.hud.popOut');
268
+ hud.pip.title = t('office.hud.pip');
246
269
  hud.sound.innerHTML = on
247
270
  ? '<svg class="ico" viewBox="0 0 24 24"><path d="M4 9.5h3.5L12 5.5v13l-4.5-4H4z"/><path d="M15.5 9a4.2 4.2 0 0 1 0 6M18 6.5a8 8 0 0 1 0 11"/></svg>'
248
271
  : '<svg class="ico" viewBox="0 0 24 24"><path d="M4 9.5h3.5L12 5.5v13l-4.5-4H4z"/><path d="M16 9.5l5 5M21 9.5l-5 5"/></svg>';
@@ -269,21 +292,26 @@ function paintHud() {
269
292
  hud.xp.setAttribute('aria-valuenow', String(pct));
270
293
  hud.xpLv.textContent = `${pct}%`;
271
294
  paintTimeline(tasks);
272
- hud.xpText.textContent = {
273
- refining: 'Mel is writing a clear brief from your request',
274
- awaiting_brief: 'Mel waits for you: check the brief in its window',
275
- planning: 'Mel is writing the plan on the board',
276
- }[j.status] || `${done} of ${total} tasks done${running ? `. Now: ${nowLine(s, runningTasks[0])}${running > 1 ? ` (+${running - 1} more)` : ''}` : ''}`;
277
- hud.state.textContent = { refining: 'Brief', awaiting_brief: 'Waiting for you', planning: 'Planning', running: 'Working', done: 'Done', failed: 'Failed', cancelled: 'Cancelled' }[j.status] || j.status;
295
+ if (['refining', 'awaiting_brief', 'planning'].includes(j.status)) hud.xpText.textContent = t(`office.hud.line.${j.status}`);
296
+ else {
297
+ const progress = t('office.hud.done', { done, total });
298
+ let what = running ? nowLine(s, runningTasks[0]) : '';
299
+ if (running > 1) what = t('office.hud.more', { what, count: running - 1 });
300
+ hud.xpText.textContent = running ? t('office.hud.doneNow', { progress, what }) : progress;
301
+ }
302
+ hud.state.textContent = JOB_STATES.includes(j.status) ? t(`office.state.${j.status}`) : j.status;
278
303
  hud.state.dataset.s = j.status;
304
+ hud.openBrief.hidden = j.status !== 'awaiting_brief';
279
305
  } else {
280
- hud.req.textContent = 'No job yet. Ask the crew in the box above.';
306
+ hud.req.textContent = t('office.hud.noJob');
307
+ hud.req.title = '';
281
308
  hud.xpFill.style.width = '0%';
282
309
  hud.xpLv.textContent = '0%';
283
- hud.xpText.textContent = 'Each task of a job is one segment of the timeline.';
310
+ hud.xpText.textContent = t('office.hud.noJobHint');
284
311
  paintTimeline([]);
285
- hud.state.textContent = 'Resting';
312
+ hud.state.textContent = t('office.state.idle');
286
313
  hud.state.dataset.s = 'idle';
314
+ hud.openBrief.hidden = true;
287
315
  }
288
316
  // honey
289
317
  const honey = doneCount(s);
@@ -295,32 +323,33 @@ function paintHud() {
295
323
  clear(hud.queue);
296
324
  const running = s.queue.running || [];
297
325
  const waiting = s.queue.waiting || [];
298
- hud.queue.append(h('div', { class: 'of-k', text: 'Turn on the model' }));
326
+ hud.queue.append(h('div', { class: 'of-k', text: t('office.queue.title') }));
299
327
  const row = h('div', { class: 'of-qrow' });
300
328
  if (running.length) {
301
- for (const q of running) row.append(h('span', { class: 'of-q of-q-on', title: `${worker(q.workerId).name} has the model now` }, beeAvatar(worker(q.workerId), 26, { ring: true, status: 'thinking' })));
302
- if (running.length === 1) row.append(h('span', { class: 'of-qname' }, h('b', { text: worker(running[0].workerId).name }), h('span', { class: 'of-faint', text: s.tasks[running[0].taskId]?.title || 'thinking' })));
329
+ for (const q of running) row.append(h('span', { class: 'of-q of-q-on', title: t('office.queue.hasModel', { name: worker(q.workerId).name }) }, beeAvatar(worker(q.workerId), 26, { ring: true, status: 'thinking' })));
330
+ if (running.length === 1) row.append(h('span', { class: 'of-qname' }, h('b', { text: worker(running[0].workerId).name }), h('span', { class: 'of-faint', text: mdLine(s.tasks[running[0].taskId]?.title || '', 80) || t('office.queue.thinking') })));
303
331
  }
304
- else row.append(h('span', { class: 'of-faint small', text: 'The model is free' }));
332
+ else row.append(h('span', { class: 'of-faint small', text: t('office.queue.free') }));
305
333
  if (waiting.length) {
306
334
  row.append(h('span', { class: 'of-qsep', html: '<svg viewBox="0 0 16 16" class="ico ico-sm"><circle cx="8" cy="8" r="6.2"/><path d="M8 4.6V8l2.4 1.6"/></svg>' }));
307
- for (const q of waiting.slice(0, 6)) row.append(h('span', { class: 'of-q', title: `${worker(q.workerId).name} is in the queue` }, beeAvatar(worker(q.workerId), 22, { ring: true })));
335
+ for (const q of waiting.slice(0, 6)) row.append(h('span', { class: 'of-q', title: t('office.queue.inQueue', { name: worker(q.workerId).name }) }, beeAvatar(worker(q.workerId), 22, { ring: true })));
308
336
  if (waiting.length > 6) row.append(h('span', { class: 'of-faint small', text: `+${waiting.length - 6}` }));
309
337
  }
310
- hud.queue.append(row, h('div', { class: 'of-faint tiny', text: (s.brains || []).length > 1 ? `${s.brains.length} brains attached, so ${s.brains.length} bees can think at once.` : 'One shared model: the bees take turns, so a job takes minutes.' }));
338
+ hud.queue.append(row, h('div', { class: 'of-faint tiny', text: (s.brains || []).length > 1 ? t('office.queue.brains', { count: s.brains.length }) : t('office.queue.oneModel') }));
311
339
  // nothing hired yet / no state yet
312
340
  hud.empty.hidden = !!(s.crew || []).length;
313
- hud.empty.textContent = ui.hello ? 'The office is empty.' : 'Opening the office...';
341
+ hud.empty.textContent = ui.hello ? t('office.empty') : t('office.opening');
314
342
  }
315
343
 
316
344
  /** The running task in words: who does what right now, from the worker's real status. */
317
- function nowLine(s, t) {
318
- if (!t) return '';
319
- const w = worker(t.assignee);
320
- const st = s.workers?.[t.assignee] || {};
321
- const what = { thinking: 'is thinking about', tool: 'is working on', queued: 'waits for the model for', waiting_approval: 'waits for your approval on' }[st.status] || (t.status === 'review' ? 'reviews' : 'works on');
322
- return `${w.name} ${what} "${t.title}"`;
345
+ function nowLine(s, task) {
346
+ if (!task) return '';
347
+ const w = worker(task.assignee);
348
+ const st = s.workers?.[task.assignee] || {};
349
+ const what = NOW_KEYS.includes(st.status) ? st.status : task.status === 'review' ? 'review' : 'works';
350
+ return t(`office.now.${what}`, { name: w.name, title: mdLine(task.title, 80) });
323
351
  }
352
+ const NOW_KEYS = ['thinking', 'tool', 'queued', 'waiting_approval'];
324
353
 
325
354
  function paintClock() {
326
355
  const hr = hourNow();
@@ -328,7 +357,10 @@ function paintClock() {
328
357
  hud.clock.textContent = `${dayPhase(hr)} · ${String(hh).padStart(2, '0')}:${String(mm).padStart(2, '0')}`;
329
358
  }
330
359
 
331
- function paintHoney() { if (hud.honeyN) hud.honeyN.textContent = String(shownHoney ?? 0); }
360
+ function paintHoney() {
361
+ if (hud.honeyN) hud.honeyN.textContent = String(shownHoney ?? 0);
362
+ if (hud.honeyT) hud.honeyT.textContent = t('office.hud.tasksDone', { count: shownHoney ?? 0 });
363
+ }
332
364
  function bumpHoney() {
333
365
  const real = doneCount(S());
334
366
  shownHoney = Math.min(real, (shownHoney ?? 0) + 1);
@@ -338,43 +370,46 @@ function bumpHoney() {
338
370
  /** The segmented timeline: one segment per task of the job, in order, colored by its state. */
339
371
  function paintTimeline(tasks) {
340
372
  if (!hud.segs) return;
341
- const key = tasks.map((t) => `${t.id}:${t.status}`).join('|');
373
+ const key = tasks.map((x) => `${x.id}:${x.status}`).join('|');
342
374
  if (hud.segs._key === key) return;
343
375
  hud.segs._key = key;
344
376
  clear(hud.segs);
345
- for (const t of tasks) hud.segs.append(h('i', { dataset: { s: t.status }, title: `${t.title}: ${TASK_LABEL[t.status] || t.status}` }));
377
+ for (const x of tasks) hud.segs.append(h('i', { dataset: { s: x.status }, title: `${mdLine(x.title, 120)}: ${TASK_LABEL[x.status] || x.status}` }));
346
378
  }
347
379
 
348
- /* activity feed: short, human lines from real events */
380
+ /* activity feed: short, human lines from real events (tx keys, so a language switch rewrites them) */
349
381
  function feed(ev) {
350
382
  if (!hud.feed) return;
351
383
  const d = ev.data || {};
352
384
  const s = S();
353
385
  const name = (id) => worker(id).name;
386
+ const title = (task) => mdLine(task.title, 80);
354
387
  let line = null; let tone = '';
355
388
  switch (ev.type) {
356
- case 'job.created': line = 'New job on the board'; tone = 'honey'; break;
357
- case 'job.planned': line = `Mel planned ${d.tasks?.length || 0} tasks`; break;
358
- case 'brief.proposed': line = 'Mel wrote a brief: use it, edit it or keep yours'; tone = 'warn'; break;
359
- case 'brief.approved': line = d.source === 'original' ? 'Working from your words' : 'Brief approved, planning'; break;
389
+ case 'job.created': line = ['office.feed.jobCreated']; tone = 'honey'; break;
390
+ case 'job.planned': line = ['office.feed.jobPlanned', { count: d.tasks?.length || 0 }]; break;
391
+ case 'brief.proposed': line = ['office.feed.briefProposed']; tone = 'warn'; break;
392
+ case 'brief.approved': line = [d.source === 'original' ? 'office.feed.briefOriginal' : 'office.feed.briefApproved']; break;
360
393
  case 'task.status': {
361
- const t = s.tasks[d.taskId];
362
- if (!t) break;
363
- if (d.status === 'running') line = `${name(t.assignee)} started "${t.title}"`;
364
- else if (d.status === 'done') { line = `${name(t.assignee)} finished "${t.title}"`; tone = 'ok'; }
365
- else if (d.status === 'failed') { line = `${name(t.assignee)} is stuck on "${t.title}"`; tone = 'bad'; }
394
+ const task = s.tasks[d.taskId];
395
+ if (!task) break;
396
+ if (d.status === 'running') line = ['office.feed.started', { name: name(task.assignee), title: title(task) }];
397
+ else if (d.status === 'done') { line = ['office.feed.finished', { name: name(task.assignee), title: title(task) }]; tone = 'ok'; }
398
+ else if (d.status === 'failed') { line = ['office.feed.stuck', { name: name(task.assignee), title: title(task) }]; tone = 'bad'; }
366
399
  break;
367
400
  }
368
- case 'file.changed': line = `${name(d.workerId)} ${d.op === 'create' ? 'wrote' : d.op === 'delete' ? 'deleted' : 'edited'} ${d.path}`; break;
369
- case 'approval.requested': line = `${name(d.approval?.workerId)} waits for your approval`; tone = 'warn'; break;
370
- case 'qa.report': line = d.passed ? 'QA: all checks passed' : `QA found ${d.issues?.length || 0} issue${d.issues?.length === 1 ? '' : 's'}`; tone = d.passed ? 'ok' : 'bad'; break;
371
- case 'task.updated': if (d.task?.assignee) line = `Task handed to ${name(d.task.assignee)}`; break;
372
- case 'crew.hired': if (ui.hello && !d.worker?.builtin) { line = `${d.worker?.name} joined the crew`; tone = 'honey'; } break;
373
- case 'job.done': line = 'Job complete'; tone = 'ok'; break;
401
+ case 'file.changed': line = [d.op === 'create' ? 'office.feed.fileCreate' : d.op === 'delete' ? 'office.feed.fileDelete' : 'office.feed.fileEdit', { name: name(d.workerId), path: String(d.path || '') }]; break;
402
+ case 'approval.requested': line = ['office.feed.approval', { name: name(d.approval?.workerId) }]; tone = 'warn'; break;
403
+ case 'qa.report': line = d.passed ? ['office.feed.qaPassed'] : ['office.feed.qaIssues', { count: d.issues?.length || 0 }]; tone = d.passed ? 'ok' : 'bad'; break;
404
+ case 'task.updated': if (d.task?.assignee) line = ['office.feed.handed', { name: name(d.task.assignee) }]; break;
405
+ case 'crew.hired': if (ui.hello && !d.worker?.builtin) { line = ['office.feed.joined', { name: d.worker?.name || '' }]; tone = 'honey'; } break;
406
+ case 'job.done': line = ['office.feed.jobDone']; tone = 'ok'; break;
374
407
  default: break;
375
408
  }
376
409
  if (!line) return;
377
- const li = h('li', { dataset: { tone } }, h('span', { class: 'of-dot' }), h('span', { text: line }));
410
+ const li = h('li', { dataset: { tone } }, h('span', { class: 'of-dot' }), h('span', { tx: line[0], txArgs: line[1] }));
411
+ // the brief waits for the user's OK: the line opens it
412
+ if (ev.type === 'brief.proposed') li.append(h('button', { type: 'button', class: 'btn btn-xs btn-quiet', style: 'margin-left:6px', tx: 'office.hud.openBrief', on: { click: () => { setMode('desktop'); wm.open('brief'); } } }));
378
413
  hud.feed.prepend(li);
379
414
  while (hud.feed.children.length > 5) hud.feed.lastChild.remove();
380
415
  if (!reducedMotion() && mode === 'office') li.animate([{ opacity: 0, transform: 'translateY(-4px)' }, { opacity: 1, transform: 'none' }], { duration: 200, easing: 'cubic-bezier(.2,0,0,1)' });
@@ -385,8 +420,8 @@ function banner(ev) {
385
420
  clear(b);
386
421
  // a calm activity toast: a check, the summary and one action
387
422
  b.append(h('span', { class: 'of-jar of-jar-big', html: CHECK_SVG, 'aria-hidden': 'true' }),
388
- h('div', {}, h('strong', { text: 'Job complete' }), h('div', { class: 'of-faint', text: String(ev.data?.summary || 'The crew finished the job.').slice(0, 140) })),
389
- h('button', { type: 'button', class: 'btn btn-xs btn-quiet', text: 'Open preview', on: { click: () => { setMode('desktop'); wm.open('preview'); } } }));
423
+ h('div', {}, h('strong', { tx: 'office.banner.title' }), h('div', { class: 'of-faint', text: mdLine(ev.data?.summary || '', 140) || t('office.banner.fallback') })),
424
+ h('button', { type: 'button', class: 'btn btn-xs btn-quiet', tx: 'office.banner.preview', on: { click: () => { setMode('desktop'); wm.open('preview'); } } }));
390
425
  b.hidden = false;
391
426
  if (!reducedMotion()) b.animate([{ opacity: 0, transform: 'translate(-50%, 6px)' }, { opacity: 1, transform: 'translate(-50%, 0)' }], { duration: 200, easing: 'cubic-bezier(.2,0,0,1)' });
392
427
  clearTimeout(b._t);
@@ -427,8 +462,8 @@ function syncHits(sc) {
427
462
  n.style.width = `${Math.round(hit.w)}px`;
428
463
  n.style.height = `${Math.round(hit.h)}px`;
429
464
  }
430
- const t = s.tasks[hit.id];
431
- const label = t ? `Task: ${t.title}. ${TASK_LABEL[t.status] || t.status}. Assigned to ${worker(t.assignee).name}. Enter to hand it to another bee.` : 'Task';
465
+ const task = s.tasks[hit.id];
466
+ const label = task ? t('office.note.aria', { title: mdLine(task.title, 120), status: TASK_LABEL[task.status] || task.status, name: worker(task.assignee).name }) : t('office.note.task');
432
467
  if (n._label !== label) { n._label = label; n.setAttribute('aria-label', label); }
433
468
  }
434
469
  for (const [id, n] of notes) if (!nseen.has(id) && !(drag && drag.taskId === id)) { n.remove(); notes.delete(id); }
@@ -437,10 +472,12 @@ function syncHits(sc) {
437
472
  function beeLabel(id, a, s) {
438
473
  const w = worker(id);
439
474
  const st = s.workers[id] || { status: 'idle' };
440
- const t = st.taskId && s.tasks[st.taskId];
475
+ const task = st.taskId && s.tasks[st.taskId];
441
476
  const m = a ? (a.seg ? 'fly' : a.mode) : 'idle';
442
477
  const lv = levelOf(s, id);
443
- return `${w.name}, ${w.role || 'worker'}${lv != null ? `, level ${lv}` : ''}. ${w.paused ? 'Paused' : MODE_LABEL[m] || STATUS_LABEL[st.status] || st.status}${t ? `. Task: ${t.title}` : ''}. Enter to chat.`;
478
+ const who = lv != null ? t('office.bee.whoLevel', { name: w.name, role: roleOf(w), level: lv }) : t('office.bee.who', { name: w.name, role: roleOf(w) });
479
+ const status = statusOf(w, m, st);
480
+ return task ? t('office.bee.ariaTask', { who, status, title: mdLine(task.title, 120) }) : t('office.bee.aria', { who, status });
444
481
  }
445
482
 
446
483
  function makeBee(id) {
@@ -460,14 +497,15 @@ function beeMenu(id) {
460
497
  const w = worker(id);
461
498
  const s = S();
462
499
  const st = s.workers[id] || {};
463
- const mine = Object.values(s.tasks).filter((t) => t.assignee === id);
464
- const retryable = mine.filter((t) => ['failed', 'blocked'].includes(t.status)).pop() || (st.taskId && s.tasks[st.taskId]);
500
+ const mine = Object.values(s.tasks).filter((x) => x.assignee === id);
501
+ const retryable = mine.filter((x) => ['failed', 'blocked'].includes(x.status)).pop() || (st.taskId && s.tasks[st.taskId]);
502
+ const lv = levelOf(s, id);
465
503
  return [
466
- { header: `${w.name} · ${w.role || 'worker'}${levelOf(s, id) != null ? ` · level ${levelOf(s, id)}` : ''}` },
467
- { label: `Chat with ${w.name}`, icon: 'chat', action: () => wm.open('worker', id) },
468
- { label: w.paused ? 'Resume' : 'Pause', icon: w.paused ? 'arrow' : 'stop', disabled: !!ui.replay, action: () => act.pauseWorker(id, !w.paused) },
469
- { label: retryable ? `Retry "${retryable.title}"` : 'Retry (nothing to retry)', icon: 'replay', disabled: !retryable || !!ui.replay, action: () => act.retryTask(retryable.id) },
470
- { label: 'Open files', icon: 'folder', action: () => { setMode('desktop'); wm.open('files'); } },
504
+ { header: lv != null ? t('office.menu.headerLevel', { name: w.name, role: roleOf(w), level: lv }) : t('office.menu.header', { name: w.name, role: roleOf(w) }) },
505
+ { label: t('office.menu.chat', { name: w.name }), icon: 'chat', action: () => wm.open('worker', id) },
506
+ { label: w.paused ? t('office.menu.resume') : t('office.menu.pause'), icon: w.paused ? 'arrow' : 'stop', disabled: !!ui.replay, action: () => act.pauseWorker(id, !w.paused) },
507
+ { label: retryable ? t('office.menu.retryTask', { title: mdLine(retryable.title, 60) }) : t('office.menu.retryNone'), icon: 'replay', disabled: !retryable || !!ui.replay, action: () => act.retryTask(retryable.id) },
508
+ { label: t('office.menu.files'), icon: 'folder', action: () => { setMode('desktop'); wm.open('files'); } },
471
509
  ];
472
510
  }
473
511
 
@@ -491,27 +529,27 @@ function makeNote(id) {
491
529
 
492
530
  function noteMenu(id) {
493
531
  const s = S();
494
- const t = s.tasks[id];
495
- if (!t) return null;
496
- const off = !!ui.replay || t.status === 'done';
532
+ const task = s.tasks[id];
533
+ if (!task) return null;
534
+ const off = !!ui.replay || task.status === 'done';
497
535
  return [
498
- { header: t.title },
499
- { label: 'Hand to', icon: 'hire', disabled: off, items: s.crew.filter((w) => w.id !== t.assignee).map((w) => ({ label: `${w.name} (${w.role || 'worker'})`, iconEl: beeAvatar(w, 18, { ring: false }), action: () => reassign(id, w.id) })) },
500
- { label: 'Retry', icon: 'replay', disabled: !!ui.replay || !['failed', 'blocked', 'done', 'skipped'].includes(t.status), action: () => act.retryTask(id) },
501
- { label: 'Cancel task', icon: 'x', danger: true, disabled: !!ui.replay || ['done', 'skipped'].includes(t.status), action: () => act.cancelTask(id) },
536
+ { header: mdLine(task.title, 60) },
537
+ { label: t('office.menu.handTo'), icon: 'hire', disabled: off, items: s.crew.filter((w) => w.id !== task.assignee).map((w) => ({ label: t('office.menu.handToWho', { name: w.name, role: roleOf(w) }), iconEl: beeAvatar(w, 18, { ring: false }), action: () => reassign(id, w.id) })) },
538
+ { label: t('office.menu.retry'), icon: 'replay', disabled: !!ui.replay || !['failed', 'blocked', 'done', 'skipped'].includes(task.status), action: () => act.retryTask(id) },
539
+ { label: t('office.menu.cancel'), icon: 'x', danger: true, disabled: !!ui.replay || ['done', 'skipped'].includes(task.status), action: () => act.cancelTask(id) },
502
540
  ];
503
541
  }
504
542
 
505
543
  function reassign(taskId, workerId) {
506
- const t = S().tasks[taskId];
507
- if (!t || t.assignee === workerId) return;
544
+ const task = S().tasks[taskId];
545
+ if (!task || task.assignee === workerId) return;
508
546
  act.reassignTask(taskId, workerId);
509
547
  }
510
548
 
511
549
  function startDrag(e, el, id) {
512
550
  if (e.button !== 0 || ui.replay) return;
513
- const t = S().tasks[id];
514
- if (!t || t.status === 'done') return;
551
+ const task = S().tasks[id];
552
+ if (!task || task.status === 'done') return;
515
553
  const x0 = e.clientX; const y0 = e.clientY;
516
554
  let ghost = null;
517
555
  const move = (ev) => {
@@ -519,7 +557,7 @@ function startDrag(e, el, id) {
519
557
  if (!drag) {
520
558
  drag = { taskId: id, el };
521
559
  scene.dragTask = id;
522
- ghost = h('div', { class: 'of-drag', 'aria-hidden': 'true' }, h('i', { style: `background:${worker(t.assignee).color}` }), h('span', { text: t.title }));
560
+ ghost = h('div', { class: 'of-drag', 'aria-hidden': 'true' }, h('i', { style: `background:${worker(task.assignee).color}` }), h('span', { text: mdLine(task.title, 60) }));
523
561
  layer.append(ghost);
524
562
  layer.classList.add('of-dragging');
525
563
  hideTip();
@@ -570,29 +608,30 @@ function showTip(el, id) {
570
608
  const w = worker(id);
571
609
  const a = scene.actors.get(id);
572
610
  const st = s.workers[id] || { status: 'idle' };
573
- const t = st.taskId && s.tasks[st.taskId];
611
+ const task = st.taskId && s.tasks[st.taskId];
574
612
  const m = a ? (a.seg ? 'fly' : a.mode) : 'idle';
575
- const lastTask = t || Object.values(s.tasks).filter((x) => x.assignee === id && x.status === 'running').pop();
613
+ const lastTask = task || Object.values(s.tasks).filter((x) => x.assignee === id && x.status === 'running').pop();
576
614
  const done = Object.values(s.tasks).filter((x) => x.assignee === id && x.status === 'done').length;
615
+ const lv = levelOf(s, id);
577
616
  clear(tip);
578
617
  tip.append(
579
- h('div', { class: 'of-tip-h' }, beeAvatar(w, 30, { ring: true }), h('div', {}, h('strong', { text: w.name }), h('div', { class: 'of-faint', text: w.role || 'worker' })), levelOf(s, id) != null ? h('span', { class: 'of-lv', text: `L${levelOf(s, id)}` }) : null),
580
- h('div', { class: 'of-tip-r' }, h('span', { class: 'of-faint', text: 'Status' }), h('span', { text: w.paused ? 'Paused' : MODE_LABEL[m] || STATUS_LABEL[st.status] || st.status })),
581
- h('div', { class: 'of-tip-r' }, h('span', { class: 'of-faint', text: 'Task' }), h('span', { text: lastTask ? lastTask.title : 'None right now' })),
582
- h('div', { class: 'of-tip-r' }, h('span', { class: 'of-faint', text: 'Done' }), h('span', { text: `${done} task${done === 1 ? '' : 's'}` })),
583
- h('div', { class: 'of-tip-f', text: 'Click to chat · right click for more' }));
618
+ h('div', { class: 'of-tip-h' }, beeAvatar(w, 30, { ring: true }), h('div', {}, h('strong', { text: w.name }), h('div', { class: 'of-faint', text: roleOf(w) })), lv != null ? h('span', { class: 'of-lv', text: t('office.level', { level: lv }) }) : null),
619
+ h('div', { class: 'of-tip-r' }, h('span', { class: 'of-faint', tx: 'office.tip.status' }), h('span', { text: statusOf(w, m, st) })),
620
+ h('div', { class: 'of-tip-r' }, h('span', { class: 'of-faint', tx: 'office.tip.task' }), h('span', { text: lastTask ? mdLine(lastTask.title, 80) : t('office.tip.none') })),
621
+ h('div', { class: 'of-tip-r' }, h('span', { class: 'of-faint', tx: 'office.tip.done' }), h('span', { text: t('office.tip.doneCount', { count: done }) })),
622
+ h('div', { class: 'of-tip-f', tx: 'office.tip.foot' }));
584
623
  tip.dataset.for = `bee:${id}`;
585
624
  place(el);
586
625
  }
587
626
 
588
627
  function showNoteTip(el, id) {
589
628
  const s = S();
590
- const t = s.tasks[id];
591
- if (!t) return;
629
+ const task = s.tasks[id];
630
+ if (!task) return;
592
631
  clear(tip);
593
- tip.append(h('div', { class: 'of-tip-h' }, h('div', {}, h('strong', { text: t.title }), h('div', { class: 'of-faint', text: `${TASK_LABEL[t.status] || t.status} · ${worker(t.assignee).name}` }))),
594
- t.detail ? h('div', { class: 'of-tip-d', text: String(t.detail).slice(0, 180) }) : null,
595
- h('div', { class: 'of-tip-f', text: t.status === 'done' ? 'Done' : 'Drag onto a bee to hand it over · Enter for options' }));
632
+ append(tip, [h('div', { class: 'of-tip-h' }, h('div', {}, h('strong', { text: mdLine(task.title, 120) }), h('div', { class: 'of-faint', text: t('office.tip.noteMeta', { status: TASK_LABEL[task.status] || task.status, name: worker(task.assignee).name }) }))),
633
+ task.detail ? h('div', { class: 'of-tip-d', text: mdLine(task.detail, 180) }) : null,
634
+ h('div', { class: 'of-tip-f', tx: task.status === 'done' ? 'office.tip.noteDone' : 'office.tip.noteFoot' })]);
596
635
  tip.dataset.for = `note:${id}`;
597
636
  place(el);
598
637
  }
@@ -4,6 +4,7 @@
4
4
 
5
5
  import { withToken } from '/js/net.js';
6
6
  import { notify } from '/js/notify.js';
7
+ import { t } from '/js/i18n.js';
7
8
 
8
9
  const W = 360;
9
10
  const H = 480;
@@ -16,7 +17,7 @@ export function openWidget() {
16
17
  const left = Math.max(0, (screen.availWidth || 1280) - W - 32);
17
18
  const win = window.open(url, 'hivedesk-widget', `popup=yes,width=${W},height=${H},left=${left},top=80`);
18
19
  if (!win) {
19
- notify({ title: 'The browser blocked the pop up', body: 'Allow pop ups for this page, or open /widget.html in a new tab.', tone: 'warn' });
20
+ notify({ title: t('office.popout.blocked'), body: t('office.popout.blockedHelp'), tone: 'warn' });
20
21
  return null;
21
22
  }
22
23
  win.focus?.();
@@ -29,7 +30,7 @@ export async function openPip() {
29
30
  try {
30
31
  pipWin = await window.documentPictureInPicture.requestWindow({ width: W, height: H });
31
32
  } catch (err) {
32
- notify({ title: 'Picture in picture did not open', body: String(err?.message || err), tone: 'warn' });
33
+ notify({ title: t('office.popout.pipFailed'), body: String(err?.message || err), tone: 'warn' });
33
34
  return null;
34
35
  }
35
36
  const doc = pipWin.document;
@@ -39,7 +40,7 @@ export async function openPip() {
39
40
  doc.head.append(style);
40
41
  const frame = doc.createElement('iframe');
41
42
  frame.src = withToken('/widget.html?pip=1');
42
- frame.title = 'hivedesk mini widget';
43
+ frame.title = t('office.widget.aria');
43
44
  doc.body.append(frame);
44
45
  pipWin.addEventListener('pagehide', () => { pipWin = null; });
45
46
  return pipWin;