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
package/ui/js/main.js CHANGED
@@ -38,7 +38,7 @@ import * as act from './actions.js';
38
38
  import { initOffice, addView, setMode, getMode } from '../office/office.js';
39
39
  import { initCity } from '../city/city.js';
40
40
  import * as i18n from './i18n.js';
41
- import { t } from './i18n.js';
41
+ import { t, dlError } from './i18n.js';
42
42
  import * as tooltip from './tooltip.js';
43
43
  import { celebrate } from './fx.js';
44
44
  import '../github/index.js'; // GitHub and Changelog windows, dock buttons, Ctrl K entries, runIntent
@@ -203,11 +203,48 @@ function paintConnection(c) {
203
203
  boot.querySelector('.spin')?.remove();
204
204
  return;
205
205
  }
206
- if (!ui.hello) return; // the boot screen already says "connecting"
206
+ if (!ui.hello) {
207
+ // Before the first hello the boot screen says "connecting"; after a few failed tries it says why and offers Retry.
208
+ if (c.state === 'offline' && c.attempts >= 3) bootStuck();
209
+ return;
210
+ }
207
211
  conn.replaceChildren(icon('offline'), h('span', { text: c.state === 'offline' ? t('conn.lost', { s: Math.max(1, Math.round((c.nextRetryAt - Date.now()) / 1000)) }) : t('conn.reconnecting') }),
208
212
  h('button', { type: 'button', class: 'btn btn-xs btn-quiet', text: t('conn.retry'), tip: 'tip.conn.retry', on: { click: () => net.retryNow() } }));
209
213
  conn.classList.add('on');
210
214
  }
215
+ // The boot screen never spins without end: no hello within BOOT_WAIT_MS (the engine is not reachable, the
216
+ // socket hangs, or it opened and nothing came) or a few failed tries show the reason and a Retry button.
217
+ const BOOT_WAIT_MS = 12000;
218
+ let bootWatch = setTimeout(bootStuck, BOOT_WAIT_MS);
219
+ function bootSay(title, text, params) {
220
+ const h1 = boot.querySelector('h1');
221
+ const p = boot.querySelector('p');
222
+ h1.dataset.tx = title;
223
+ p.dataset.tx = text;
224
+ if (params) p.setAttribute('data-tx-args', JSON.stringify(params)); else p.removeAttribute('data-tx-args');
225
+ h1.textContent = t(title);
226
+ p.textContent = t(text, params);
227
+ }
228
+ function bootStuck() {
229
+ clearTimeout(bootWatch);
230
+ if (ui.hello || ui.connection === 'unauthorized' || boot.classList.contains('stuck')) return;
231
+ boot.classList.add('stuck');
232
+ bootSay('boot.offline.title', 'boot.offline.text', { host: location.host });
233
+ boot.querySelector('.spin')?.setAttribute('hidden', '');
234
+ const retry = h('button', { type: 'button', class: 'btn btn-primary boot-retry', tx: 'boot.failed.retry', on: { click: bootRetry } });
235
+ boot.querySelector('.boot-in').append(retry);
236
+ retry.focus();
237
+ }
238
+ function bootRetry() {
239
+ boot.classList.remove('stuck');
240
+ boot.querySelector('.boot-retry')?.remove();
241
+ bootSay('boot.title', 'boot.text');
242
+ boot.querySelector('.spin')?.removeAttribute('hidden');
243
+ // A socket that is open but sent no hello is not worth keeping: load the page again.
244
+ if (net.isOpen()) { location.reload(); return; }
245
+ net.retryNow();
246
+ bootWatch = setTimeout(bootStuck, BOOT_WAIT_MS);
247
+ }
211
248
  let connTimer = null;
212
249
  net.on('connection', (c) => {
213
250
  paintConnection(c);
@@ -220,6 +257,9 @@ let firstHello = true;
220
257
  net.on('hello', (f) => {
221
258
  loadHello(f);
222
259
  if (f.state?.settings?.sound === false) setMuted(true);
260
+ clearTimeout(bootWatch);
261
+ boot.classList.remove('stuck');
262
+ boot.querySelector('.boot-retry')?.remove();
223
263
  boot.classList.add('gone');
224
264
  setTimeout(() => boot.setAttribute('hidden', ''), 400);
225
265
  if (firstHello) {
@@ -272,7 +312,7 @@ onEvent((ev) => {
272
312
  if (d.state === 'error') notify({ title: t('brain.error.label'), body: d.detail || t('brain.error.detail'), tone: 'bad', sound: 'error', actions: [{ label: t('dock.settings'), run: () => wm.open('settings') }] });
273
313
  prevBrain = d.state;
274
314
  break;
275
- case 'brain.download.failed': notify({ title: t('note.dlStopped'), body: [d.message, d.hint].filter(Boolean).join(' '), tone: 'bad', sound: 'error', sticky: true, key: 'dl-fail', actions: [{ label: t('note.retry'), primary: true, run: () => act.startDownload(d.model) }, { label: t('dock.settings'), run: () => wm.open('settings') }] }); break;
315
+ case 'brain.download.failed': notify({ title: t('note.dlStopped'), body: dlError(d).text, tone: 'bad', sound: 'error', sticky: true, key: 'dl-fail', actions: [{ label: t('note.retry'), primary: true, run: () => act.startDownload(d.model) }, { label: t('dock.settings'), run: () => wm.open('settings') }] }); break;
276
316
  case 'brain.download.finished': notify({ title: t('note.dlDone'), body: shortModel(d.model), tone: 'ok', quiet: true }); break;
277
317
  case 'brain.fallback': notify({ title: t('note.fallback'), body: d.reason, tone: 'warn', icon: 'gpu', timeout: 9000 }); break;
278
318
  case 'brain.attached': if (d.kind === 'remote') notify({ title: t('note.brainJoined', { label: d.label }), body: t('note.brainJoinedBody'), tone: 'ok', icon: 'lend' }); break;
package/ui/js/md.js ADDED
@@ -0,0 +1,130 @@
1
+ // Safe markdown for what the model writes: chat lines, the last turn, briefs, reports, tasks, Activity.
2
+ // Everything is escaped first, then a small set of marks becomes HTML: bold, italics, inline code, code
3
+ // blocks (with a copy button), ordered and unordered lists, headings (scaled down), links (http and https
4
+ // only, rel noopener) and paragraphs. No raw HTML, no images. No DOM here, so Node tests import it;
5
+ // mdNode() in dom.js puts the result in the page. mdStrip() gives plain text for one line places
6
+ // (speech bubbles, notifications, toasts, titles).
7
+
8
+ const esc = (s) => String(s).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;');
9
+ const unesc = (s) => String(s).replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&amp;/g, '&');
10
+
11
+ /** An http or https URL as given, or null (javascript:, data:, relative and the rest are refused). */
12
+ export function safeUrl(u) {
13
+ const s = String(u || '').trim();
14
+ if (!/^https?:\/\/[^\s<>"']+$/i.test(s)) return null;
15
+ try {
16
+ const url = new URL(s);
17
+ return url.protocol === 'http:' || url.protocol === 'https:' ? s : null;
18
+ } catch {
19
+ return null;
20
+ }
21
+ }
22
+
23
+ /** Inline marks of one escaped line: code first (its content stays literal), then links, bold, italics. */
24
+ function inline(text) {
25
+ const codes = [];
26
+ const keep = (html) => { codes.push(html); return `\u0000${codes.length - 1}\u0000`; };
27
+ let s = esc(text).replace(/\u0000/g, '');
28
+ s = s.replace(/`([^`\n]+)`/g, (m, c) => keep(`<code class="ic">${c}</code>`));
29
+ // Images are not shown: ![alt](url) stays as its alt text.
30
+ s = s.replace(/!\[([^\]]*)\]\(([^)\s]*)\)/g, (m, alt) => alt);
31
+ s = s.replace(/\[([^\]\n]+)\]\(([^)\s]+)\)/g, (m, label, url) => {
32
+ const u = safeUrl(unesc(url));
33
+ return u ? keep(`<a href="${esc(u)}" target="_blank" rel="noopener noreferrer">${label}</a>`) : label;
34
+ });
35
+ s = s.replace(/(^|[\s(])(https?:\/\/[^\s<>()]+[^\s<>().,;:!?])/g, (m, pre, url) => {
36
+ const u = safeUrl(unesc(url));
37
+ return u ? `${pre}${keep(`<a href="${esc(u)}" target="_blank" rel="noopener noreferrer">${url}</a>`)}` : m;
38
+ });
39
+ s = s.replace(/\*\*(?=\S)([^*\n]*?\S)\*\*/g, '<strong>$1</strong>').replace(/__(?=\S)([^_\n]*?\S)__/g, '<strong>$1</strong>');
40
+ s = s.replace(/(^|[^*\w])\*(?=\S)([^*\n]*?\S)\*(?!\*)/g, '$1<em>$2</em>').replace(/(^|[^_\w])_(?=\S)([^_\n]*?\S)_(?![_\w])/g, '$1<em>$2</em>');
41
+ s = s.replace(/~~(?=\S)([^~\n]*?\S)~~/g, '<del>$1</del>');
42
+ return s.replace(/\u0000(\d+)\u0000/g, (m, i) => codes[Number(i)]);
43
+ }
44
+
45
+ /**
46
+ * Markdown to safe HTML.
47
+ * @param {string} md
48
+ * @param {{ copyLabel?: string|false }} [o] copyLabel: the text of the copy button of code blocks (translated by
49
+ * the caller); false: no copy button
50
+ */
51
+ export function mdToHtml(md, o = {}) {
52
+ const lines = String(md ?? '').replace(/\r\n?/g, '\n').split('\n');
53
+ const out = [];
54
+ let para = [];
55
+ let list = null; // { type: 'ul'|'ol', start, items: string[] }
56
+ const flushPara = () => { if (para.length) { out.push(`<p>${para.map(inline).join('<br>')}</p>`); para = []; } };
57
+ const flushList = () => {
58
+ if (!list) return;
59
+ const start = list.type === 'ol' && list.start !== 1 ? ` start="${list.start}"` : '';
60
+ out.push(`<${list.type}${start}>${list.items.map((i) => `<li>${inline(i)}</li>`).join('')}</${list.type}>`);
61
+ list = null;
62
+ };
63
+ for (let i = 0; i < lines.length; i++) {
64
+ const line = lines[i];
65
+ const fence = /^\s*(```+|~~~+)\s*([\w+#.-]*)\s*$/.exec(line);
66
+ if (fence) {
67
+ flushPara(); flushList();
68
+ const body = [];
69
+ let j = i + 1;
70
+ while (j < lines.length && !lines[j].trim().startsWith(fence[1])) body.push(lines[j++]);
71
+ i = j;
72
+ const lang = fence[2] ? ` data-lang="${esc(fence[2])}"` : '';
73
+ const copy = esc(o.copyLabel || 'Copy');
74
+ const button = o.copyLabel === false ? '' : `<button type="button" class="btn btn-xs btn-quiet md-copy" data-md-copy="" aria-label="${copy}">${copy}</button>`;
75
+ out.push(`<div class="md-code">${button}<pre class="cb"${lang}><code>${esc(body.join('\n'))}</code></pre></div>`);
76
+ continue;
77
+ }
78
+ const hd = /^\s{0,3}(#{1,6})\s+(.*?)\s*#*\s*$/.exec(line);
79
+ if (hd) {
80
+ flushPara(); flushList();
81
+ // Scaled down: a chat line is no page, # is a small heading.
82
+ const lvl = Math.min(hd[1].length + 3, 6);
83
+ out.push(`<h${lvl} class="md-h">${inline(hd[2])}</h${lvl}>`);
84
+ continue;
85
+ }
86
+ const ul = /^\s*[-*+]\s+(.*)$/.exec(line);
87
+ const ol = /^\s*(\d{1,6})[.)]\s+(.*)$/.exec(line);
88
+ if (ul || ol) {
89
+ flushPara();
90
+ const type = ul ? 'ul' : 'ol';
91
+ if (list && list.type !== type) flushList();
92
+ if (!list) list = { type, start: ol ? Number(ol[1]) : 1, items: [] };
93
+ list.items.push(ul ? ul[1] : ol[2]);
94
+ continue;
95
+ }
96
+ if (list && /^\s{2,}\S/.test(line)) { list.items[list.items.length - 1] += ` ${line.trim()}`; continue; }
97
+ if (/^\s*([-*_])(\s*\1){2,}\s*$/.test(line)) { flushPara(); flushList(); out.push('<hr>'); continue; }
98
+ const quote = /^\s*>\s?(.*)$/.exec(line);
99
+ if (quote) { flushPara(); flushList(); out.push(`<blockquote>${inline(quote[1])}</blockquote>`); continue; }
100
+ if (!line.trim()) { flushPara(); flushList(); continue; }
101
+ flushList();
102
+ para.push(line.trim());
103
+ }
104
+ flushPara(); flushList();
105
+ return out.join('');
106
+ }
107
+
108
+ /** Markdown to one plain line (or a few): marks gone, links as their label, code blocks as their text. */
109
+ export function mdStrip(md) {
110
+ return String(md ?? '').replace(/\r\n?/g, '\n')
111
+ .replace(/^\s*(```+|~~~+)[^\n]*$/gm, '')
112
+ .replace(/!\[([^\]]*)\]\([^)]*\)/g, '$1')
113
+ .replace(/\[([^\]]+)\]\([^)]*\)/g, '$1')
114
+ .replace(/^\s{0,3}#{1,6}\s+/gm, '')
115
+ .replace(/^\s*>\s?/gm, '')
116
+ .replace(/^\s*[-*+]\s+/gm, '')
117
+ .replace(/\*\*([^*\n]+)\*\*/g, '$1').replace(/__([^_\n]+)__/g, '$1')
118
+ .replace(/(^|[^*\w])\*([^*\n]+)\*/g, '$1$2').replace(/(^|[^_\w])_([^_\n]+)_(?!\w)/g, '$1$2')
119
+ .replace(/~~([^~\n]+)~~/g, '$1')
120
+ .replace(/`([^`\n]+)`/g, '$1')
121
+ .replace(/[ \t]+/g, ' ')
122
+ .replace(/\n{2,}/g, '\n')
123
+ .trim();
124
+ }
125
+
126
+ /** mdStrip on one line, for bubbles and toasts: newlines become spaces, cut at `max` characters. */
127
+ export function mdLine(md, max = 0) {
128
+ const s = mdStrip(md).replace(/\s*\n\s*/g, ' ');
129
+ return max && s.length > max ? `${s.slice(0, Math.max(1, max - 3)).replace(/\s+\S*$/, '')}...` : s;
130
+ }
package/ui/js/net.js CHANGED
@@ -59,7 +59,12 @@ export function connect() {
59
59
  const url = `${proto}//${location.host}/ws${token ? `?t=${encodeURIComponent(token)}` : ''}`;
60
60
  setState(connection.attempts ? 'reconnecting' : 'connecting');
61
61
  try { ws = new WebSocket(url); } catch (err) { scheduleRetry(); return; }
62
+ // A socket that neither opens nor fails (a port that swallows the handshake) is closed after a while,
63
+ // so the close handler retries instead of waiting on it forever.
64
+ const sock = ws;
65
+ const openTimer = setTimeout(() => { if (sock.readyState === 0) { try { sock.close(); } catch {} } }, 10000);
62
66
  ws.addEventListener('open', () => {
67
+ clearTimeout(openTimer);
63
68
  retry = 0;
64
69
  connection.attempts = 0;
65
70
  setState('open');
@@ -83,6 +88,7 @@ export function connect() {
83
88
  emit(frame.kind, frame);
84
89
  });
85
90
  ws.addEventListener('close', () => {
91
+ clearTimeout(openTimer);
86
92
  ws = null;
87
93
  for (const [id, p] of pending) {
88
94
  if (p.sentWhileOpen) { clearTimeout(p.timer); p.reject(Object.assign(new Error(tr('net.lostBeforeAnswer')), { code: 'offline' })); pending.delete(id); }
package/ui/js/palette.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { h, icon, esc } from './dom.js';
4
4
  import { beeAvatar } from './bees.js';
5
- import { S, ui } from './store.js';
5
+ import { S, ui, roleName } from './store.js';
6
6
  import { brainInfo } from './brainstate.js';
7
7
  import * as wm from './wm.js';
8
8
  import * as act from './actions.js';
@@ -51,7 +51,7 @@ function commands(q) {
51
51
  add('open', t('dock.settings'), () => wm.open('settings'), { icon: 'model' });
52
52
  add('open', t('dock.lend'), () => wm.open('lend'), { icon: 'lend' });
53
53
  add('open', t('dock.hire'), () => import('./widgets/hire.js').then((m) => m.openHire()), { icon: 'hire' });
54
- for (const w of s.crew) add('crew', t('pal.chatWith', { name: w.name }), () => wm.open('worker', w.id), { av: w, hint: w.role });
54
+ for (const w of s.crew) add('crew', t('pal.chatWith', { name: w.name }), () => wm.open('worker', w.id), { av: w, hint: roleName(w) });
55
55
  for (const a of s.approvals || []) {
56
56
  add('approvals', t('pal.approve', { what: a.summary || a.tool }), () => act.resolveApproval(a.id, true), { icon: 'check' });
57
57
  add('approvals', t('pal.reject', { what: a.summary || a.tool }), () => act.resolveApproval(a.id, false), { icon: 'x' });
package/ui/js/store.js CHANGED
@@ -92,6 +92,19 @@ export function applyEvent(ev) {
92
92
  else bump('all');
93
93
  }
94
94
 
95
+ // The roles of the built in workers and specialists come from the engine in English: shown in the desktop's language.
96
+ const ROLE_KEY = {
97
+ 'Foreman and planner': 'mel', Developer: 'dev', 'UI and styles': 'designer', 'Checks and tests': 'qa', 'README, copy and docs': 'writer',
98
+ 'Mobile developer': 'mobile', 'Desktop app developer': 'desktop', 'Backend developer': 'backend', 'Security reviewer': 'security',
99
+ 'Data engineer': 'data', 'DevOps engineer': 'devops'
100
+ };
101
+ /** A worker's role in the current language (a role the user typed stays as typed). Takes a worker or a role. */
102
+ export function roleName(w) {
103
+ const role = typeof w === 'string' ? w : w?.role;
104
+ const k = ROLE_KEY[role];
105
+ return k ? t(`crew.role.${k}`) : role || '';
106
+ }
107
+
95
108
  function workerOf(s, id) { return s.crew.find((w) => w.id === id); }
96
109
  export const worker = (id) => workerOf(S(), id) || fallbackWorker(id);
97
110
  function fallbackWorker(id) {
@@ -138,6 +151,11 @@ export function reduce(s, ev, isLive) {
138
151
  if (j) { j.status = 'running'; if (d.playbookId) j.playbookId = d.playbookId; }
139
152
  bump('jobs', 'tasks'); break;
140
153
  }
154
+ // The brief step: the job card, the top bar and the Office say what the job waits for.
155
+ case 'job.refining': { const j = job(s, ev.jobId); if (j) j.status = 'refining'; bump('jobs'); break; }
156
+ case 'brief.proposed': { const j = job(s, ev.jobId); if (j) { j.status = 'awaiting_brief'; j.briefProposed = d.brief; } bump('jobs'); break; }
157
+ case 'brief.approved': { const j = job(s, ev.jobId); if (j) { j.status = 'planning'; j.brief = { text: d.text, source: d.source }; } bump('jobs'); break; }
158
+ case 'job.resumed': { const j = job(s, ev.jobId); if (j) { j.status = 'running'; delete j.finishedAt; delete j.error; } bump('jobs'); break; }
141
159
  case 'job.done': { const j = job(s, ev.jobId); if (j) Object.assign(j, { status: 'done', summary: d.summary, files: d.files, finishedAt: ev.ts }); bump('jobs'); break; }
142
160
  case 'job.failed': { const j = job(s, ev.jobId); if (j) Object.assign(j, { status: 'failed', error: d.error, finishedAt: ev.ts }); bump('jobs'); break; }
143
161
  case 'job.cancelled': { const j = job(s, ev.jobId); if (j) Object.assign(j, { status: 'cancelled', finishedAt: ev.ts }); bump('jobs'); break; }
@@ -168,7 +186,7 @@ export function reduce(s, ev, isLive) {
168
186
  case 'worker.status': s.workers[d.workerId] = { ...(s.workers[d.workerId] || {}), status: d.status, detail: d.detail, taskId: d.taskId ?? s.workers[d.workerId]?.taskId }; bump('workers'); break;
169
187
  case 'chat.message': {
170
188
  const ch = d.channel || 'general';
171
- (s.chat[ch] ||= []).push({ ...d, ts: d.ts || ev.ts, seq: ev.seq });
189
+ (s.chat[ch] ||= []).push({ ...d, ts: d.ts || ev.ts, seq: ev.seq, ...(ev.jobId && !d.jobId ? { jobId: ev.jobId } : {}) });
172
190
  if (s.chat[ch].length > 200) s.chat[ch].splice(0, s.chat[ch].length - 200);
173
191
  bump('chat'); break;
174
192
  }
@@ -257,7 +275,7 @@ export function jobTasks(s, j) {
257
275
  }
258
276
 
259
277
  export function currentJob(s = S()) {
260
- for (let i = s.jobs.length - 1; i >= 0; i--) if (['planning', 'running'].includes(s.jobs[i].status)) return s.jobs[i];
278
+ for (let i = s.jobs.length - 1; i >= 0; i--) if (['refining', 'awaiting_brief', 'planning', 'running'].includes(s.jobs[i].status)) return s.jobs[i];
261
279
  return s.jobs[s.jobs.length - 1] || null;
262
280
  }
263
281
 
package/ui/js/topbar.js CHANGED
@@ -180,8 +180,8 @@ export function init(el) {
180
180
  const done = tasks.filter((t) => t.status === 'done').length;
181
181
  strip.append(h('div', { class: 'strip-cells', role: 'img', 'aria-label': t('top.strip.done', { done, count: tasks.length }) },
182
182
  tasks.length ? tasks.map((task) => h('span', { class: 'cell', dataset: { s: task.status }, 'data-tip-title': task.title, 'data-tip-help': TASK_LABEL[task.status] || task.status })) : h('span', { class: 'cell', dataset: { s: 'running' } })),
183
- h('button', { type: 'button', class: 'strip-label', style: 'border:0;background:none;cursor:pointer;text-align:left', 'data-tip-title': j.request, 'data-tip-help': t('tip.top.strip.help'), on: { click: () => wm.open('timeline') } },
184
- j.status === 'planning' ? t('top.strip.planning') : j.status === 'running' ? t('top.strip.running', { done, count: tasks.length, request: j.request }) : t('top.strip.ended', { status: j.status, request: j.request })));
183
+ h('button', { type: 'button', class: 'strip-label', style: 'border:0;background:none;cursor:pointer;text-align:left', 'data-tip-title': j.request, 'data-tip-help': t('tip.top.strip.help'), on: { click: () => wm.open(j.status === 'awaiting_brief' ? 'brief' : 'timeline') } },
184
+ j.status === 'refining' ? t('top.strip.refining') : j.status === 'awaiting_brief' ? t('top.strip.brief') : j.status === 'planning' ? t('top.strip.planning') : j.status === 'running' ? t('top.strip.running', { done, count: tasks.length, request: j.request }) : t('top.strip.ended', { status: j.status, request: j.request })));
185
185
  });
186
186
 
187
187
  document.addEventListener('keydown', (e) => {
@@ -9,7 +9,7 @@
9
9
  // Piper voice. Mel always asks before she acts (session.js).
10
10
 
11
11
  import { h, icon, reducedMotion, clear, append } from '../dom.js';
12
- import { t, locale, onLocale, LOCALES, setLocale } from '../i18n.js';
12
+ import { t, locale, onLocale, LOCALES, setLocale, dlError } from '../i18n.js';
13
13
  import { format } from '/i18n/index.js';
14
14
  import { S, worker, currentJob, jobTasks, onEvent } from '../store.js';
15
15
  import { command, on as onFrame, token } from '../net.js';
@@ -310,6 +310,7 @@ function showError(code, err) {
310
310
  NotFoundError: 'voice.err.mic', 'audio-capture': 'voice.err.mic', 'language-not-supported': 'voice.err.lang', network: 'voice.err.network',
311
311
  needs_download: 'voice.ui.errNeedsModel', needs_browser_consent: 'voice.ui.errNeedsBrowserOk', browser_unsupported: 'voice.err.unsupported',
312
312
  stt_failed: 'voice.ui.errStt', timeout: 'voice.ui.errTimeout',
313
+ stt_missing: 'voice.ui.errSttMissing', stt_blocked: 'voice.ui.errSttBlocked', stt_start: 'voice.ui.errSttStart', stt_model: 'voice.ui.errSttModel',
313
314
  }[code];
314
315
  session.state.reply = key ? vt(key) : vt('voice.say.failed', { message: err?.message || code });
315
316
  showOrb();
@@ -478,7 +479,7 @@ function paintDownloads() {
478
479
  const list = [...downloads.entries()];
479
480
  el.dl.hidden = !list.length;
480
481
  el.dl.replaceChildren(...list.map(([id, d]) => h('div', { class: 'vo-dl-i' },
481
- h('span', { class: 'tiny', text: d.error ? vt('voice.ui.dlFailed', { id, error: d.error }) : vt('voice.ui.dlProgress', { id, pct: pct(d) }) }),
482
+ h('span', { class: 'tiny', text: d.error ? vt('voice.ui.dlFailed', { id, error: dlError({ ...d, message: d.error }).text }) : vt('voice.ui.dlProgress', { id, pct: pct(d) }) }),
482
483
  d.error ? null : h('div', { class: 'vo-bar' }, h('i', { style: `width:${pct(d)}%` })))));
483
484
  }
484
485
 
@@ -2,12 +2,13 @@
2
2
  // Use this and Use mine), and the end of job report with the improved prompt and next prompts.
3
3
  // It keeps its own small state from the engine events, so it does not depend on the store reducer.
4
4
 
5
- import { h, icon, clear, copyText, fmtDuration } from '../dom.js';
5
+ import { h, icon, clear, copyText, fmtDuration, mdNode } from '../dom.js';
6
6
  import { register, open } from '../wm.js';
7
- import { S, ui, onEvent, worker } from '../store.js';
7
+ import { S, ui, rev, onEvent, worker } from '../store.js';
8
8
  import { beeAvatar } from '../bees.js';
9
9
  import { command } from '../net.js';
10
- import { notify } from '../notify.js';
10
+ import { notify, dismissKey } from '../notify.js';
11
+ import { mdLine } from '../md.js';
11
12
  import { t, tmap } from '../i18n.js';
12
13
  import { setTip } from '../tooltip.js';
13
14
  import { track, stateBox, btn } from './util.js';
@@ -38,16 +39,26 @@ function latest() {
38
39
  return null;
39
40
  }
40
41
 
42
+ /** Jobs whose waiting brief was already brought to the front in this window. */
43
+ const shown = new Set();
44
+
45
+ /** The brief never waits unseen: the window opens and a toast stays until the brief is decided. */
46
+ function showWaiting(jobId) {
47
+ shown.add(jobId);
48
+ open('brief');
49
+ notify({ title: t('brief.notify.title'), body: t('brief.notify.body'), tone: 'info', icon: 'plan', key: `brief-${jobId}`, sticky: true, actions: [{ label: t('brief.notify.review'), primary: true, run: () => open('brief') }] });
50
+ }
51
+
41
52
  onEvent((ev) => {
42
53
  const d = ev.data || {};
43
54
  if (ev.type === 'brief.proposed') {
44
55
  const e = entry(ev.jobId);
45
56
  Object.assign(e, { request: d.original, proposed: d.brief, approved: null });
46
57
  box.v++;
47
- open('brief');
48
- notify({ title: t('brief.notify.title'), body: t('brief.notify.body'), tone: 'info', icon: 'plan', key: `brief-${ev.jobId}`, actions: [{ label: t('brief.notify.review'), primary: true, run: () => open('brief') }] });
58
+ showWaiting(ev.jobId);
49
59
  } else if (ev.type === 'brief.approved') {
50
60
  entry(ev.jobId).approved = { text: d.text, source: d.source };
61
+ dismissKey(`brief-${ev.jobId}`);
51
62
  box.v++;
52
63
  } else if (ev.type === 'job.report') {
53
64
  entry(ev.jobId).report = { ...d.report, improvedPrompt: d.improvedPrompt, nextPrompts: d.nextPrompts };
@@ -58,6 +69,12 @@ onEvent((ev) => {
58
69
  }
59
70
  });
60
71
 
72
+ // A brief that already waited when this window connected (a reload, a restart of hivedesk) opens too, once.
73
+ track(() => [ui.hello, rev.jobs], () => {
74
+ if (!ui.hello || ui.replay) return;
75
+ for (const j of S().jobs) if (j.status === 'awaiting_brief' && !shown.has(j.id)) showWaiting(j.id);
76
+ });
77
+
61
78
  async function send(type, data, fail) {
62
79
  try { return await command(type, data); } catch (err) {
63
80
  notify({ title: fail, body: err.message, tone: 'bad', sound: 'error' });
@@ -81,7 +98,7 @@ function briefView(id, e) {
81
98
  const area = h('textarea', { class: 'brief-edit', rows: 14, 'aria-label': t('brief.editTitle') });
82
99
  area.value = p.text;
83
100
  const original = h('section', { class: 'brief-col' }, h('h4', { text: t('brief.request'), tip: 'tip.brief.head.request' }), h('p', { class: 'brief-orig', text: e.request }));
84
- const improved = h('section', { class: 'brief-col' }, h('h4', { tip: 'tip.brief.head.improved' }, t('brief.improved'), ' ', h('span', { class: 'hchip hchip-honey', text: t('brief.byMel') })), h('pre', { class: 'brief-text', text: p.text }));
101
+ const improved = h('section', { class: 'brief-col' }, h('h4', { tip: 'tip.brief.head.improved' }, t('brief.improved'), ' ', h('span', { class: 'hchip hchip-honey', text: t('brief.byMel') })), mdNode(p.text, 'brief-text brief-md'));
85
102
  const editing = h('section', { class: 'brief-col brief-editing', hidden: true }, h('h4', { text: t('brief.editTitle'), tip: 'tip.brief.head.editing' }), area);
86
103
  const busy = (b) => { for (const x of actions.querySelectorAll('button')) x.disabled = b || !!ui.replay; };
87
104
  const approve = async (use) => {
@@ -109,23 +126,23 @@ function briefView(id, e) {
109
126
  function reportView(id, r) {
110
127
  const files = h('ul', { class: 'rep-list' }, ...(r.files.length ? r.files.map((f) => h('li', {}, h('span', { class: 'mono', text: f.path }), ' ', h('span', { class: 'tiny faint', text: f.added || f.removed ? t('brief.report.fileStat', { op: f.op, added: f.added, removed: f.removed }) : f.op }))) : [h('li', { class: 'muted', text: t('brief.report.noFiles') })]));
111
128
  const checks = h('ul', { class: 'rep-list' }, ...(r.checks.length ? r.checks.map((c) => h('li', {}, h('span', { class: `hchip ${c.ok ? 'hchip-ok' : 'hchip-bad'}`, text: c.ok ? t('brief.report.checkOk') : t('brief.report.checkFailed') }), ' ', h('span', { class: 'mono small', text: c.name }), ' ', h('span', { class: 'tiny faint', text: c.detail || '' }))) : [h('li', { class: 'muted', text: t('brief.report.noChecks') })]));
112
- const missing = r.missing.length ? h('ul', { class: 'rep-list' }, ...r.missing.map((m) => h('li', { text: m }))) : h('p', { class: 'small muted', text: t('brief.report.noMissing') });
129
+ const missing = r.missing.length ? h('ul', { class: 'rep-list' }, ...r.missing.map((m) => h('li', { text: mdLine(m) }))) : h('p', { class: 'small muted', text: t('brief.report.noMissing') });
113
130
  const save = setTip(btn(t('brief.report.save'), async () => { const x = await send('playbook.save', { jobId: id }, t('brief.error.playbook')); if (x) notify({ title: t('brief.report.saved'), tone: 'ok', timeout: 1800 }); }, 'btn btn-xs btn-quiet', 'playbook'), { key: 'tip.brief.save' });
114
131
  if (ui.replay) save.disabled = true;
115
132
  return h('article', { class: 'appr report' },
116
133
  h('div', { class: 'appr-h' }, beeAvatar(worker('mel'), 30), h('div', { class: 'grow' }, h('div', { class: 'appr-t', text: t('brief.report.title') }), h('div', { class: 'small muted', text: t('brief.report.stats', { turns: r.turns, duration: fmtDuration(r.seconds * 1000) }) }))),
117
134
  h('div', { class: 'rep-body' },
118
- h('h4', { text: t('brief.report.built'), tip: 'tip.brief.head.built' }), h('p', { class: 'small', text: r.built }),
135
+ h('h4', { text: t('brief.report.built'), tip: 'tip.brief.head.built' }), mdNode(r.built, 'small'),
119
136
  h('h4', { text: t('brief.report.files'), tip: 'tip.brief.head.files' }), files,
120
137
  h('h4', { text: t('brief.report.checks'), tip: 'tip.brief.head.checks' }), checks,
121
138
  h('h4', { text: t('brief.report.missing'), tip: 'tip.brief.head.missing' }), missing,
122
139
  h('div', { class: 'rep-prompt' },
123
140
  h('div', { class: 'row' }, h('h4', { class: 'grow', text: t('brief.report.prompt'), tip: 'tip.brief.head.prompt' }), copyBtn(r.improvedPrompt, t('brief.report.promptCopied'), 'tip.brief.copyPrompt'), save),
124
141
  h('p', { class: 'small muted', text: t('brief.report.promptHelp') }),
125
- h('pre', { class: 'brief-text', text: r.improvedPrompt })),
142
+ mdNode(r.improvedPrompt, 'brief-text brief-md')),
126
143
  h('h4', { text: t('brief.report.next'), tip: 'tip.brief.head.next' }),
127
144
  h('div', { class: 'rep-next' }, ...(r.nextPrompts || []).map((p) => h('div', { class: 'row' },
128
- h('button', { type: 'button', class: 'btn btn-xs btn-quiet grow rep-next-b', text: p, tip: 'tip.brief.next', on: { click: () => newJob(p) }, disabled: !!ui.replay }),
145
+ h('button', { type: 'button', class: 'btn btn-xs btn-quiet grow rep-next-b', text: mdLine(p), tip: 'tip.brief.next', on: { click: () => newJob(p) }, disabled: !!ui.replay }),
129
146
  copyBtn(p, t('brief.report.nextCopied'), 'tip.brief.copyNext'))))));
130
147
  }
131
148
 
@@ -161,6 +178,7 @@ const css = `
161
178
  .brief-grid h4, .rep-body h4 { margin: 10px 0 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-t); }
162
179
  .brief-orig { margin: 0; padding: 10px; border: 1px dashed var(--line-2); border-radius: 6px; color: var(--text-2); }
163
180
  .brief-text { margin: 0; padding: 10px; white-space: pre-wrap; word-break: break-word; font: 12.5px/1.5 var(--font-mono); background: var(--bg-2); border: 1px solid var(--line); border-radius: 6px; max-height: 340px; overflow: auto; }
181
+ .brief-md { white-space: normal; font: 13px/1.55 var(--font-sans, inherit); color: var(--text-2); }
164
182
  .brief-editing { grid-column: 2; }
165
183
  .brief-edit { width: 100%; box-sizing: border-box; font: 12.5px/1.5 var(--font-mono); color: var(--text); background: var(--bg-2); border: 1px solid var(--accent-line); border-radius: 6px; padding: 10px; resize: vertical; }
166
184
  .rep-body { padding: 0 12px 12px; }
@@ -4,7 +4,7 @@ import { myAvatarEl } from '/profile/ui.js';
4
4
  import { h, icon, clear, fmtTime, richText, syncList } from '../dom.js';
5
5
  import { beeAvatar } from '../bees.js';
6
6
  import { register } from '../wm.js';
7
- import { S, rev, ui, worker } from '../store.js';
7
+ import { S, rev, ui, worker, roleName } from '../store.js';
8
8
  import { provide } from '../menu.js';
9
9
  import * as act from '../actions.js';
10
10
  import { t, fmtList } from '../i18n.js';
@@ -29,13 +29,18 @@ export function msgText(m) {
29
29
  /** The buttons under a crew question ("start as a task" or "just talk"); gone once one is picked. */
30
30
  function choiceRow(m) {
31
31
  if (!m.choices?.length || m.chosen || !m.replyTo || ui.replay) return null;
32
- const row = h('div', { class: 'row msg-choices', style: 'gap:6px;margin-top:6px;flex-wrap:wrap' });
32
+ // The brief buttons (use it, keep my request, open it) only while that brief still waits.
33
+ const briefJob = m.choices.some((c) => c.id === 'use') ? m.jobId : null;
34
+ if (briefJob && !briefWaits(briefJob)) return null;
35
+ const row = h('div', { class: 'row msg-choices', style: 'gap:6px;margin-top:6px;flex-wrap:wrap', dataset: briefJob ? { job: briefJob } : {} });
33
36
  const buttons = () => [...row.querySelectorAll('button')];
34
37
  for (const c of m.choices) {
35
38
  row.append(h('button', {
36
- type: 'button', class: `btn btn-xs${c.id === 'task' ? ' btn-primary' : ''}`, text: t(c.key),
39
+ type: 'button', class: `btn btn-xs${c.id === 'task' || c.id === 'use' ? ' btn-primary' : ''}`, text: t(c.key),
37
40
  on: {
38
41
  click: async () => {
42
+ // "Open the brief" stays on this desktop: the Brief window has Edit.
43
+ if (c.id === 'open') { wm.open('brief'); return; }
39
44
  for (const b of buttons()) b.disabled = true;
40
45
  const r = await act.chooseChat(m.replyTo, c.id);
41
46
  if (r) row.remove();
@@ -47,6 +52,8 @@ function choiceRow(m) {
47
52
  return row;
48
53
  }
49
54
 
55
+ const briefWaits = (jobId) => S().jobs.find((j) => j.id === jobId)?.status === 'awaiting_brief';
56
+
50
57
  function msgNode(m, prev) {
51
58
  const text = msgText(m);
52
59
  if (m.from === 'system') {
@@ -60,7 +67,7 @@ function msgNode(m, prev) {
60
67
  h('div', { style: 'min-width:0' },
61
68
  h('div', { class: 'msg-h' },
62
69
  h('span', { class: 'msg-n', text: w.name, style: m.from !== 'user' ? `color:color-mix(in oklab, ${w.color || '#F2A93B'} 45%, var(--text))` : '' }),
63
- w.role && m.from !== 'user' ? h('span', { class: 'msg-r', text: w.role }) : null,
70
+ w.role && m.from !== 'user' ? h('span', { class: 'msg-r', text: roleName(w) }) : null,
64
71
  h('span', { class: 'msg-t', text: fmtTime(m.ts) })),
65
72
  quote ? h('div', { class: 'reply-to', text: quote }) : null,
66
73
  // A question card line: the card replaces the plain text version (kept for the CLI and the voice orb).
@@ -135,6 +142,11 @@ export function chatFeed(channel, { placeholder, emptyTitle, emptyText, args } =
135
142
  });
136
143
 
137
144
  let shown = 0;
145
+ // A brief decided elsewhere (its window, another chat, "ok"): its buttons go away here too.
146
+ track(() => [rev.jobs, rev.chat], () => {
147
+ for (const row of feed.querySelectorAll('.msg-choices[data-job]')) if (!briefWaits(row.dataset.job)) row.remove();
148
+ });
149
+
138
150
  track(() => [rev.chat, rev.crew, ui.replay], () => {
139
151
  const list = S().chat[channel] || [];
140
152
  const pinned = sticky.before();
@@ -1,6 +1,6 @@
1
1
  // Files: the workspace tree with a diff viewer, plus the Code viewer window.
2
2
 
3
- import { h, icon, clear, fmtBytes, ago } from '../dom.js';
3
+ import { h, icon, clear, fmtBytes, ago, append } from '../dom.js';
4
4
  import { beeAvatar } from '../bees.js';
5
5
  import { register } from '../wm.js';
6
6
  import * as wm from '../wm.js';
@@ -200,9 +200,9 @@ register('code', {
200
200
  const f = S().files[path];
201
201
  ctx.setSub(path);
202
202
  clear(head);
203
- head.append(h('div', { class: 'grow crumbs ellipsis', text: path }), f ? h('span', { class: 'hchip hchip-mono', text: fmtBytes(f.bytes) }) : null,
203
+ append(head, [h('div', { class: 'grow crumbs ellipsis', text: path }), f ? h('span', { class: 'hchip hchip-mono', text: fmtBytes(f.bytes) }) : null,
204
204
  h('button', { class: 'ibtn', type: 'button', 'aria-label': t('files.menu.copyPath'), tip: 'tip.files.copyPath', on: { click: () => act.copy(path, t('files.pathCopied')) } }, icon('copy')),
205
- h('button', { class: 'ibtn', type: 'button', 'aria-label': t('files.menu.reveal'), tip: 'tip.files.reveal', on: { click: () => showFile(path) } }, icon('folder')));
205
+ h('button', { class: 'ibtn', type: 'button', 'aria-label': t('files.menu.reveal'), tip: 'tip.files.reveal', on: { click: () => showFile(path) } }, icon('folder'))]);
206
206
  if (!f) { clear(pane).append(stateBox({ icon: 'code', title: t('files.missing.title'), text: t('files.missing.text') })); lastSeq = -1; return; }
207
207
  if (f.lastSeq === lastSeq) return;
208
208
  lastSeq = f.lastSeq;
@@ -1,7 +1,7 @@
1
1
  // Memory: what the crew remembers about this project and about you, and the past sessions.
2
2
  // Everything shown here lives in .hivedesk/memory.json, ~/.hivedesk/memory.json and .hivedesk/sessions/.
3
3
 
4
- import { h, icon, clear, copyText } from '../dom.js';
4
+ import { h, icon, clear, copyText, append } from '../dom.js';
5
5
  import { register } from '../wm.js';
6
6
  import { S, ui, onEvent } from '../store.js';
7
7
  import { command } from '../net.js';
@@ -46,11 +46,11 @@ function sessionRow(s, refresh) {
46
46
  if (!r) return;
47
47
  const report = [...r.records].reverse().find((x) => x.type === 'report');
48
48
  const decisions = r.records.filter((x) => x.type === 'decision');
49
- detail.append(
49
+ append(detail, [
50
50
  report?.report ? h('p', { class: 'small', text: report.report.built || '' }) : h('p', { class: 'small muted', text: 'No report for this session.' }),
51
51
  report?.improvedPrompt ? h('div', { class: 'rep-prompt' }, h('div', { class: 'row' }, h('h4', { class: 'grow', text: 'Improved prompt' }), btn('Copy', () => copyText(report.improvedPrompt), 'btn btn-xs btn-quiet', 'copy')), h('pre', { class: 'brief-text', text: report.improvedPrompt })) : null,
52
52
  decisions.length ? h('ul', { class: 'rep-list' }, ...decisions.map((d) => h('li', { class: 'small', text: `${d.workerId}: ${d.text}` }))) : null,
53
- h('div', { class: 'row', style: 'margin-top:8px' }, input, btn('Continue this session', async () => { const x = await send('session.continue', { id: s.id, request: input.value }, 'Could not continue'); if (x) notify({ title: 'Continuing the session', tone: 'ok', timeout: 1800 }); }, 'btn btn-xs btn-ok')));
53
+ h('div', { class: 'row', style: 'margin-top:8px' }, input, btn('Continue this session', async () => { const x = await send('session.continue', { id: s.id, request: input.value }, 'Could not continue'); if (x) notify({ title: 'Continuing the session', tone: 'ok', timeout: 1800 }); }, 'btn btn-xs btn-ok'))]);
54
54
  };
55
55
  return h('li', { class: 'mem-srow' },
56
56
  h('div', { class: 'row' },
@@ -1,6 +1,6 @@
1
1
  // Replay scrubber: rebuild any moment from events.jsonl and show it on the whole desktop.
2
2
 
3
- import { h, icon, clear, fmtTime } from '../dom.js';
3
+ import { h, icon, clear, fmtTime, append } from '../dom.js';
4
4
  import { register } from '../wm.js';
5
5
  import { rev, ui, liveState, enterReplay, exitReplay, onEvent, worker } from '../store.js';
6
6
  import { command } from '../net.js';
@@ -115,11 +115,11 @@ register('replay', {
115
115
  clear(info);
116
116
  const ev = events.find((e) => e.seq === seq) || events[events.length - 1];
117
117
  if (!last) { info.append(h('span', { class: 'muted', text: t('replay.empty') })); return; }
118
- info.append(
118
+ append(info, [
119
119
  ui.replay ? h('span', { class: 'hchip hchip-honey', text: t('replay.replaying') }) : h('span', { class: 'hchip hchip-ok', text: t('replay.live') }),
120
120
  h('span', { class: 'mono tiny muted', text: t('replay.position', { seq, last }) }),
121
121
  ev?.ts ? h('span', { class: 'tiny muted', text: fmtTime(ev.ts) }) : null,
122
- h('span', { class: 'grow ellipsis', text: loaded ? describe(ev) : t('replay.loading') }));
122
+ h('span', { class: 'grow ellipsis', text: loaded ? describe(ev) : t('replay.loading') })]);
123
123
  liveBtn.disabled = !ui.replay;
124
124
  ctx.setSub(ui.replay ? t('replay.sub.at', { seq }) : t('replay.sub.live'));
125
125
  }
@@ -10,7 +10,7 @@ import * as act from '../actions.js';
10
10
  import { brainInfo, backendLabel, shortModel } from '../brainstate.js';
11
11
  import { setMuted, isMuted, preview as previewSound } from '../sound.js';
12
12
  import { enableSystem, systemEnabled, notify } from '../notify.js';
13
- import { t, tmap, fmtNumber, fmtKeys, fmtList, L, LOCALES, locale, setLocale } from '../i18n.js';
13
+ import { t, tmap, fmtNumber, fmtKeys, fmtList, L, LOCALES, locale, setLocale, dlError } from '../i18n.js';
14
14
  import { voiceSettings } from '../voice/index.js';
15
15
  import { setTip } from '../tooltip.js';
16
16
  import { track, btn } from './util.js';
@@ -66,7 +66,7 @@ function downloadCard() {
66
66
  h('span', { class: 'tiny muted', text: t('settings.download.orChoose') })));
67
67
  }
68
68
  } else if (phase === 'failed') {
69
- card.append(h('div', { class: 'honest bad', style: 'margin:0 0 10px' }, icon('x'), h('div', {}, h('b', { text: dd.message || t('settings.download.failed') }), dd.hint ? h('div', { class: 'small', style: 'margin-top:3px', text: dd.hint }) : null)),
69
+ card.append(h('div', { class: 'honest bad', style: 'margin:0 0 10px' }, icon('x'), h('div', {}, h('b', { text: dd.code ? dlError(dd).text : dd.message || t('settings.download.failed') }), (dd.code ? dlError(dd).detail : dd.hint) ? h('div', { class: 'small', style: 'margin-top:3px', text: dd.code ? dlError(dd).detail : dd.hint }) : null)),
70
70
  h('div', { class: 'row' }, tipped(btn(t('settings.download.retry'), () => act.startDownload(dd.model), 'btn btn-sm btn-primary', 'download'), 'tip.settings.retry')));
71
71
  }
72
72
  return card;
@@ -1,6 +1,6 @@
1
1
  // Timeline: every job with its task graph (dependency order), status and assignee.
2
2
 
3
- import { h, icon, clear, fmtDuration, ago } from '../dom.js';
3
+ import { h, icon, clear, fmtDuration, ago, mdNode } from '../dom.js';
4
4
  import { beeAvatar } from '../bees.js';
5
5
  import { register } from '../wm.js';
6
6
  import { S, rev, ui, jobTasks, worker, extra } from '../store.js';
@@ -80,7 +80,7 @@ function jobCard(j, isCur) {
80
80
  h('div', { class: 'task-r' }, beeAvatar(worker('mel'), 20)))));
81
81
  }
82
82
  if (tasks.length) card.append(h('div', { class: 'tasks', role: 'list' }, tasks.map((x, i) => taskRow(x, i, tasks))));
83
- if (j.status === 'done' && j.summary) card.append(h('div', { class: 'small muted', style: 'padding:0 12px 11px', text: j.summary }));
83
+ if (j.status === 'done' && j.summary) card.append(h('div', { class: 'small muted', style: 'padding:0 12px 11px' }, mdNode(j.summary)));
84
84
  if (j.status === 'failed' && j.error) card.append(h('div', { class: 'honest bad', style: 'margin:0 12px 12px' }, icon('x'), h('div', { text: typeof j.error === 'string' ? j.error : j.error.message || t('timeline.job.failedText') })));
85
85
  return card;
86
86
  }