Ship War Room UX, CEO inbox, mobile chat, and Agents NAS workspace.

Make A2A togglable, keep reply context while reading, route agent data to //10.4.7.11/share/Agents, and polish themes plus export-intel sync cancel.
This commit is contained in:
Aissa
2026-08-16 22:40:32 +00:00
parent 910ba465d7
commit c5ea8cbb63
26 changed files with 2891 additions and 407 deletions
+518 -58
View File
@@ -17,6 +17,21 @@ window.WarRoomHub = (function () {
rooms: [],
room: null,
messages: [],
chatSearch: '',
searchOpen: false,
toolsOpen: false,
screenCleared: false,
autoDebate: true,
ceoInboxOpen: false,
ceoInbox: [],
ceoUnread: 0,
replyTo: null,
replyHighlightId: null,
stickToBottom: true,
showJumpLatest: false,
_typingScrollAt: 0,
rosterCollapsed: true,
a2aPausedUntil: 0,
draft: '',
busy: false,
me: { username: '', avatar_url: '', role: '' },
@@ -37,9 +52,9 @@ window.WarRoomHub = (function () {
callSlug: '',
voiceRecording: false,
voiceBusy: false,
speakReplies: true,
speakReplies: false,
voiceRoomOpen: false,
voiceRoomAgents: ['herman'],
voiceRoomAgents: ['herman', 'bizdev', 'finance', 'retail', 'marketing'],
voiceSpeakingKey: '',
voiceLastHeard: '',
_voiceRec: null,
@@ -49,6 +64,7 @@ window.WarRoomHub = (function () {
async init() {
this.voiceRoomOpen = false;
this.busy = false;
this._sendLock = false;
await Promise.all([this.loadMe(), this.loadSouls(), this.loadRooms()]);
var params = new URLSearchParams(window.location.search || '');
var want = params.get('room');
@@ -58,7 +74,13 @@ window.WarRoomHub = (function () {
if (wr) await this.openRoom(wr.id);
else if (this.rooms.length) await this.openRoom(this.rooms[0].id);
}
try {
var saved = localStorage.getItem('flk-warroom-a2a');
this.autoDebate = (saved === null || saved === '1' || saved === 'true');
} catch (e) { this.autoDebate = true; }
this.startPoll();
this.loadCeoInbox();
if (this.autoDebate && this.room && this.room.kind === 'warroom') this.scheduleContinue(60000);
},
destroy() {
@@ -129,26 +151,35 @@ window.WarRoomHub = (function () {
async openRoom(id) {
if (!id) return;
id = parseInt(id, 10);
this.busy = true;
this.status = '';
this.typing = null;
try {
if (!(this.rooms || []).length) await this.loadRooms();
var meta = (this.rooms || []).find(function (r) { return Number(r.id) === id; }) || null;
var r = await fetch('/api/agents/warroom/rooms/' + id + '/messages?limit=120').then(function (x) {
return x.json();
});
this.room = r.room;
// messages API returns {items}, NOT {room} — keep room from rooms list
this.room = meta || r.room || { id: id, kind: 'warroom', title: 'War Room' };
this.messages = this.normalizeList(r.items || []);
this.lastId = this.maxId(this.messages);
this.stickToBottom = true;
this.showJumpLatest = false;
this.$nextTick(function () {
this.paintAvatars();
this.scrollLog();
this.scrollLog(true);
this.focusComposer();
}.bind(this));
var last = (this.messages || [])[(this.messages || []).length - 1];
if (last && last.sender_type === 'agent' && this.room && this.room.kind === 'warroom') {
this.scheduleContinue(4000);
if (this.autoDebate) this.scheduleContinue(60000);
}
} catch (e) {
this.status = e.message || 'Laden mislukt';
// Still keep a usable room id so send works
if (!this.room) this.room = { id: id, kind: 'warroom', title: 'War Room' };
}
this.busy = false;
},
@@ -203,12 +234,44 @@ window.WarRoomHub = (function () {
return changed;
},
scrollLog() {
isNearBottom(el, px) {
if (!el) return true;
var gap = el.scrollHeight - el.scrollTop - el.clientHeight;
return gap <= (px == null ? 80 : px);
},
onLogScroll() {
var el = this.$refs && this.$refs.wrLog;
if (el) el.scrollTop = el.scrollHeight;
if (!el) return;
var near = this.isNearBottom(el, 100);
this.stickToBottom = near;
this.showJumpLatest = !near;
},
scrollLog(force) {
var el = this.$refs && this.$refs.wrLog;
if (!el) return;
if (!force && !this.stickToBottom) {
this.showJumpLatest = true;
return;
}
el.scrollTop = el.scrollHeight;
this.stickToBottom = true;
this.showJumpLatest = false;
},
jumpToLatest() {
this.stickToBottom = true;
this.showJumpLatest = false;
this.scrollLog(true);
},
startPoll() {
var selfCeo = this;
if (!this._ceoPoll) {
this._ceoPoll = setInterval(function () { selfCeo.loadCeoInbox(); }, 20000);
}
var self = this;
if (this._poll) clearInterval(this._poll);
this._poll = setInterval(function () { self.pollNew(); }, 4000);
@@ -283,6 +346,7 @@ window.WarRoomHub = (function () {
},
onDraftInput() {
if ((this.draft || '').trim()) this.pauseA2A(90000);
var d = this.draft || '';
var m = /(^|\s)@([a-zA-Z0-9_-]*)$/.exec(d);
if (m) {
@@ -344,51 +408,153 @@ window.WarRoomHub = (function () {
this.pendingFiles = (this.pendingFiles || []).filter(function (_, i) { return i !== idx; });
},
focusComposer() {
try {
var el = this.$refs && this.$refs.wrInput;
if (el) {
el.removeAttribute('disabled');
el.readOnly = false;
el.focus();
}
} catch (e) {}
},
canSend() {
return !this.busy && this.room && (((this.draft || '').trim()) || (this.pendingFiles || []).length);
var hasText = !!(this.draft || '').trim();
var hasFiles = !!(this.pendingFiles || []).length;
return !!(hasText || hasFiles);
},
async ensureRoom() {
if (this.room && this.room.id) return true;
try {
await this.loadRooms();
var wr = this.warroomRoom();
if (wr) {
await this.openRoom(wr.id);
} else {
// fallback: known warroom id 1
await this.openRoom(1);
}
} catch (e) {}
return !!(this.room && this.room.id);
},
onEnter(e) {
if (e && e.shiftKey) return; // Shift+Enter = nieuwe regel
if (this.mentionOpen) {
var sug = this.mentionSuggestions();
if (sug && sug.length) {
if (e) e.preventDefault();
this.pickMention(sug[this.mentionIndex] || sug[0]);
return;
}
}
if (e) e.preventDefault();
this.send();
},
async send() {
var text = (this.draft || '').trim();
var files = (this.pendingFiles || []).slice();
if (!this.room || this.busy) return;
if (!text && !files.length) return;
// Never get stuck behind a stale busy flag
if (this._sendLock) return;
this._sendLock = true;
this.busy = true;
this.mentionOpen = false;
this.emojiOpen = false;
var okRoom = await this.ensureRoom();
if (!okRoom) {
this.busy = false;
this._sendLock = false;
this.status = 'Room niet geladen — klik ↻';
if (window.Cockpit) Cockpit.toast(this.status, 'error');
return;
}
// Instant UI — no waiting for network/LLM
var tempId = 'local-' + Date.now();
var replySnapshot = this.replyTo ? {
id: this.replyTo.id,
agent_key: this.replyTo.agent_key,
username: this.replyTo.username,
sender_type: this.replyTo.sender_type,
excerpt: this.replyTo.excerpt,
label: this.replyTo.label,
} : null;
var replyToId = replySnapshot ? replySnapshot.id : null;
var optimisticMeta = {};
if (files.length) optimisticMeta.attachments = files;
if (replySnapshot) optimisticMeta.reply_to = replySnapshot;
var optimistic = {
id: tempId,
room_id: this.room.id,
sender_type: 'user',
content: text || (files.length ? '(bijlage)' : ''),
username: (this.me && this.me.username) || 'Jij',
sender_avatar_url: (this.me && this.me.avatar_url) || null,
metadata: optimisticMeta,
created_at: new Date().toISOString(),
};
this.draft = '';
this.pendingFiles = [];
this.replyTo = null;
this.replyHighlightId = replyToId;
this.pauseA2A(90000);
this.typing = null;
this.status = 'Verzenden…';
this.upsertMessage(optimistic);
this.status = '';
this.stickToBottom = true;
this.$nextTick(function () {
this.scrollLog(true);
this.focusComposer();
}.bind(this));
try {
var resp = await fetch('/api/agents/warroom/rooms/' + this.room.id + '/messages/stream', {
method: 'POST',
credentials: 'same-origin',
headers: { 'Content-Type': 'application/json', Accept: 'text/event-stream' },
body: JSON.stringify({ content: text, attachments: files }),
body: JSON.stringify({ content: text, attachments: files, reply_to_id: replyToId }),
});
if (!resp.ok) {
var err = await resp.json().catch(function () { return {}; });
throw new Error(err.detail || ('HTTP ' + resp.status));
}
await this.consumeStream(resp);
this.status = '';
this.scheduleContinue(2000);
// Drop temp bubble if server user msg arrived with real id
this.messages = (this.messages || []).filter(function (m) {
return m.id !== tempId;
});
// Herlaad recente geschiedenis (merge) zodat reply-parent niet "kwijt" raakt in de UI
await this.refreshMessages({ silent: true });
if (replyToId) {
var self = this;
this.$nextTick(function () {
self.scrollToMessage(replyToId);
setTimeout(function () { self.replyHighlightId = null; }, 4000);
});
}
if (this.autoDebate) this.scheduleContinue(60000);
} catch (e) {
this.draft = text;
this.pendingFiles = files;
// Keep optimistic message; restore draft only on hard fail
this.status = e.message || 'Verzenden mislukt';
if (window.Cockpit) Cockpit.toast(this.status, 'error');
}
this.typing = null;
this.busy = false;
this._sendLock = false;
this.$nextTick(function () {
this.paintAvatars();
this.scrollLog();
this.scrollLog(true);
this.focusComposer();
}.bind(this));
},
async consumeStream(resp) {
var reader = resp.body.getReader();
var decoder = new TextDecoder();
@@ -422,6 +588,7 @@ window.WarRoomHub = (function () {
}
var type = ev.event || '';
if (type === 'user' && ev.message) {
this.messages = (this.messages || []).filter(function (m) { return String(m.id).indexOf('local-') !== 0; });
this.upsertMessage(ev.message);
this.status = 'Agent typt…';
this.$nextTick(function () { this.scrollLog(); }.bind(this));
@@ -434,7 +601,9 @@ window.WarRoomHub = (function () {
text: '',
};
this.status = (this.typing.display_name || 'Agent') + ' typt…';
this.$nextTick(function () { this.scrollLog(); }.bind(this));
// alleen meescrollen als je al onderaan zit
if (this.stickToBottom) this.$nextTick(function () { this.scrollLog(); }.bind(this));
else this.showJumpLatest = true;
} else if (type === 'typing') {
if (!this.typing || this.typing.agent_key !== ev.agent_key) {
this.typing = {
@@ -446,11 +615,20 @@ window.WarRoomHub = (function () {
this.typing.text = (this.typing.text || '') + (ev.delta || '');
// force alpine refresh
this.typing = Object.assign({}, this.typing);
this.$nextTick(function () { this.scrollLog(); }.bind(this));
// geen jump tijdens teruglezen; max 1x / 600ms als je onderaan zit
if (this.stickToBottom) {
var now = Date.now();
if (now - (this._typingScrollAt || 0) > 600) {
this._typingScrollAt = now;
this.$nextTick(function () { this.scrollLog(); }.bind(this));
}
} else {
this.showJumpLatest = true;
}
} else if (type === 'agent' && ev.message) {
this.typing = null;
this.upsertMessage(ev.message);
if (ev.message.content) this.speakText(ev.message.content, ev.message.agent_key);
if (this.voiceRoomOpen && this.speakReplies && ev.message.content) this.speakText(ev.message.content, ev.message.agent_key);
this.$nextTick(function () {
this.paintAvatars();
this.scrollLog();
@@ -468,54 +646,142 @@ window.WarRoomHub = (function () {
},
onKey(e) {
if (!this.mentionOpen) return;
var sug = this.mentionSuggestions();
if (this.mentionOpen && sug.length) {
if (e.key === 'ArrowDown') {
e.preventDefault();
this.mentionIndex = (this.mentionIndex + 1) % sug.length;
return;
}
if (e.key === 'ArrowUp') {
e.preventDefault();
this.mentionIndex = (this.mentionIndex - 1 + sug.length) % sug.length;
return;
}
if (e.key === 'Enter' || e.key === 'Tab') {
e.preventDefault();
this.pickMention(sug[this.mentionIndex] || sug[0]);
return;
}
if (e.key === 'Escape') {
this.mentionOpen = false;
return;
}
}
if (e.key === 'Enter' && !e.shiftKey) {
if (!sug.length) return;
if (e.key === 'ArrowDown') {
e.preventDefault();
this.send();
this.mentionIndex = (this.mentionIndex + 1) % sug.length;
return;
}
if (e.key === 'ArrowUp') {
e.preventDefault();
this.mentionIndex = (this.mentionIndex - 1 + sug.length) % sug.length;
return;
}
if (e.key === 'Tab') {
e.preventDefault();
this.pickMention(sug[this.mentionIndex] || sug[0]);
return;
}
if (e.key === 'Escape') {
this.mentionOpen = false;
}
},
scheduleContinue(delayMs) {
if (!this.autoDebate || !this.room || this.room.kind !== 'warroom') return;
if (this._continueTimer) clearTimeout(this._continueTimer);
if (!this.autoDebate) return;
var self = this;
this._continueTimer = setTimeout(function () { self.runContinue(2); }, delayMs || 2500);
// default: rustig tempo (~50s), niet elke paar seconden
var wait = (typeof delayMs === 'number' && delayMs >= 0) ? delayMs : 50000;
this._continueTimer = setTimeout(function () { self.runContinue(1); }, wait);
},
toggleA2A() {
this.autoDebate = !this.autoDebate;
try { localStorage.setItem('flk-warroom-a2a', this.autoDebate ? '1' : '0'); } catch (e) {}
if (this._continueTimer) clearTimeout(this._continueTimer);
if (this.autoDebate) {
this.status = 'A2A aan — agents mogen onderling verder praten';
this.scheduleContinue(8000);
if (window.Cockpit) Cockpit.toast('A2A aan', 'ok');
} else {
this.status = 'A2A uit — alleen reacties op jouw berichten';
this.a2aPausedUntil = 0;
if (window.Cockpit) Cockpit.toast('A2A uit', 'ok');
}
},
pauseA2A(ms) {
this.a2aPausedUntil = Date.now() + (ms || 45000);
if (this._continueTimer) clearTimeout(this._continueTimer);
},
setReply(m) {
if (!m || !m.id || String(m.id).indexOf('local-') === 0) return;
this.replyTo = {
id: m.id,
agent_key: m.agent_key || null,
username: m.username || null,
sender_type: m.sender_type,
excerpt: ((m.content || '').trim().slice(0, 160)) + (((m.content || '').length > 160) ? '…' : ''),
label: this.labelForMessage(m),
};
this.replyHighlightId = m.id;
this.pauseA2A(90000);
this.$nextTick(function () {
this.scrollToMessage(m.id);
this.focusComposer();
}.bind(this));
},
scrollToMessage(id) {
if (id == null) return;
var root = (this.$refs && this.$refs.wrLog) || document;
var el = root.querySelector && root.querySelector('[data-msg-id="' + id + '"]');
if (el && el.scrollIntoView) {
try { el.scrollIntoView({ block: 'center', behavior: 'smooth' }); } catch (e) {
el.scrollIntoView(true);
}
}
},
async refreshMessages(opts) {
opts = opts || {};
if (!this.room || !this.room.id) return;
try {
var r = await fetch('/api/agents/warroom/rooms/' + this.room.id + '/messages?limit=200', {
credentials: 'same-origin',
}).then(function (x) { return x.json(); });
var items = this.normalizeList(r.items || []);
if (items.length) {
this.messages = items;
this.lastId = this.maxId(items);
}
if (!opts.silent) {
this.$nextTick(function () {
this.paintAvatars();
this.scrollLog();
}.bind(this));
} else {
this.$nextTick(function () { this.paintAvatars(); }.bind(this));
}
} catch (e) { /* quiet */ }
},
clearReply() {
this.replyTo = null;
this.replyHighlightId = null;
},
replyPreview(m) {
var meta = (m && m.metadata) || {};
return meta.reply_to || null;
},
async runContinue(turns) {
if (!this.autoDebate || !this.room || this.room.kind !== 'warroom') return;
if (this.busy || this._continueBusy) return;
// only continue if last message is from an agent (they are mid-debate)
var last = (this.messages || [])[(this.messages || []).length - 1];
if (!last || last.sender_type !== 'agent') return;
if (this.busy || this._continueBusy || this._sendLock) {
this.scheduleContinue(20000);
return;
}
if (Date.now() < (this.a2aPausedUntil || 0)) {
this.scheduleContinue(Math.max(10000, this.a2aPausedUntil - Date.now()));
return;
}
// niet doorkletsen terwijl jij typt
if ((this.draft || '').trim().length > 0 || this.replyTo) {
this.scheduleContinue(25000);
return;
}
this._continueBusy = true;
this.status = 'Agents overleggen verder…';
this.status = 'A2A — agents reageren…';
try {
var resp = await fetch('/api/agents/warroom/rooms/' + this.room.id + '/continue?turns=' + (turns || 2), {
var resp = await fetch('/api/agents/warroom/rooms/' + this.room.id + '/continue?turns=' + (turns || 1), {
method: 'POST',
credentials: 'same-origin',
headers: { Accept: 'text/event-stream', 'Content-Type': 'application/json' },
@@ -525,16 +791,208 @@ window.WarRoomHub = (function () {
this.busy = true;
await this.consumeStream(resp);
this.busy = false;
this.status = '';
// keep the debate alive a bit while the tab is open
this.scheduleContinue(12000);
this.status = 'A2A live';
// keep conversation alive
this.scheduleContinue(55000);
} catch (e) {
this.busy = false;
this.status = '';
this.status = 'A2A hervatten…';
this.scheduleContinue(45000);
}
this._continueBusy = false;
},
async loadCeoInbox() {
try {
var r = await fetch('/api/agents/warroom/ceo-inbox?limit=40', { credentials: 'same-origin' })
.then(function (x) { return x.json(); });
this.ceoInbox = r.items || [];
this.ceoUnread = r.unread || 0;
} catch (e) {
this.ceoInbox = this.ceoInbox || [];
}
},
openCeoInbox() {
this.ceoInboxOpen = true;
this.loadCeoInbox();
},
closeCeoInbox() {
this.ceoInboxOpen = false;
},
async markCeoRead(id) {
try {
await fetch('/api/agents/warroom/ceo-inbox/read', {
method: 'POST',
credentials: 'same-origin',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(id ? { ids: [id] } : { all: true }),
});
await this.loadCeoInbox();
} catch (e) {}
},
async markAllCeoRead() {
await this.markCeoRead(null);
if (window.Cockpit) Cockpit.toast('CEO-inbox gelezen', 'ok');
},
isCeoDirect(m) {
if (!m) return false;
if (m.ceo_inbox_id || (m.metadata && m.metadata.ceo_direct)) return true;
var c = (m.content || '').toLowerCase();
return c.indexOf('@aissa') >= 0 || c.indexOf('@ceo') >= 0 || c.indexOf('@ervoorz') >= 0;
},
formatMsgTime(m) {
var raw = (m && (m.created_at || m.createdAt || m.ts)) || '';
if (!raw) return '';
var d = new Date(raw);
if (isNaN(d.getTime())) return '';
return d.toLocaleTimeString('nl-NL', { hour: '2-digit', minute: '2-digit' });
},
formatMsgDate(m) {
var raw = (m && (m.created_at || m.createdAt || m.ts)) || '';
if (!raw) return '';
var d = new Date(raw);
if (isNaN(d.getTime())) return '';
var today = new Date();
var yest = new Date(); yest.setDate(today.getDate() - 1);
var same = function (a, b) {
return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
};
if (same(d, today)) return 'Vandaag';
if (same(d, yest)) return 'Gisteren';
return d.toLocaleDateString('nl-NL', { weekday: 'short', day: 'numeric', month: 'short', year: 'numeric' });
},
dayKey(m) {
var raw = (m && (m.created_at || m.createdAt || m.ts)) || '';
if (!raw) return '';
var d = new Date(raw);
if (isNaN(d.getTime())) return '';
return d.getFullYear() + '-' + (d.getMonth()+1) + '-' + d.getDate();
},
showDaySep(idx) {
var list = this.visibleMessages();
if (!list.length || idx < 0 || idx >= list.length) return false;
if (idx === 0) return !!this.dayKey(list[idx]);
return this.dayKey(list[idx]) !== this.dayKey(list[idx - 1]);
},
visibleMessages() {
if (this.screenCleared) return [];
var q = (this.chatSearch || '').trim().toLowerCase();
var list = this.messages || [];
if (!q) return list;
return list.filter(function (m) {
var hay = [
m.content || '',
m.agent_key || '',
m.username || '',
m.display_name || '',
m.sender_type || '',
].join(' ').toLowerCase();
return hay.indexOf(q) >= 0;
});
},
toggleSearch() {
this.searchOpen = !this.searchOpen;
this.toolsOpen = false;
if (this.searchOpen) {
var self = this;
this.$nextTick(function () {
var el = self.$refs && self.$refs.wrSearch;
if (el) el.focus();
});
} else {
this.chatSearch = '';
}
},
clearScreen() {
this.screenCleared = true;
this.status = 'Scherm geleegd (berichten blijven bewaard)';
if (window.Cockpit) Cockpit.toast('Chat-scherm geleegd', 'ok');
},
restoreScreen() {
this.screenCleared = false;
this.status = '';
this.$nextTick(function () { this.scrollLog(); }.bind(this));
},
async clearChatHistory() {
if (!this.room) return;
if (!window.confirm('Alle berichten in dit kanaal permanent van het scherm wissen (soft-delete)?')) return;
try {
var r = await fetch('/api/agents/warroom/rooms/' + this.room.id + '/messages', {
method: 'DELETE',
credentials: 'same-origin',
}).then(function (x) { return x.json().then(function (d) { return { ok: x.ok, d: d }; }); });
if (!r.ok) throw new Error((r.d && (r.d.detail || r.d.message)) || 'Wissen mislukt');
this.messages = [];
this.screenCleared = false;
this.lastId = 0;
this.status = 'Geschiedenis gewist (' + ((r.d && r.d.cleared) || 0) + ')';
if (window.Cockpit) Cockpit.toast('Chatgeschichte gewist', 'ok');
} catch (e) {
if (window.Cockpit) Cockpit.toast(e.message || 'Wissen mislukt', 'error');
}
},
downloadChat(fmt) {
fmt = fmt || 'txt';
var list = this.messages || [];
if (!list.length) {
if (window.Cockpit) Cockpit.toast('Geen berichten om te downloaden', 'info');
return;
}
var title = (this.room && (this.room.title || this.room.kind)) || 'war-room';
var stamp = new Date().toISOString().slice(0, 19).replace(/[:T]/g, '-');
var filename = 'foodlinkk-' + String(title).replace(/[^\w\-]+/g, '_') + '-' + stamp;
var body = '';
var mime = 'text/plain;charset=utf-8';
if (fmt === 'json') {
body = JSON.stringify({ room: this.room, exported_at: new Date().toISOString(), messages: list }, null, 2);
filename += '.json';
mime = 'application/json;charset=utf-8';
} else if (fmt === 'md') {
body = '# ' + title + '\n\n_Geëxporteerd: ' + new Date().toLocaleString('nl-NL') + '_\n\n';
list.forEach(function (m) {
var who = this.labelForMessage(m) + (m.agent_key ? (' (@' + m.agent_key + ')') : '');
var when = this.formatMsgDate(m) + ' ' + this.formatMsgTime(m);
body += '### ' + who + ' · ' + when.trim() + '\n\n' + (m.content || '') + '\n\n---\n\n';
}.bind(this));
filename += '.md';
mime = 'text/markdown;charset=utf-8';
} else {
body = title + '\nGeëxporteerd: ' + new Date().toLocaleString('nl-NL') + '\n' + ('='.repeat(48)) + '\n\n';
list.forEach(function (m) {
var who = this.labelForMessage(m) + (m.agent_key ? (' (@' + m.agent_key + ')') : '');
var when = (this.formatMsgDate(m) + ' ' + this.formatMsgTime(m)).trim();
body += '[' + when + '] ' + who + ':\n' + (m.content || '') + '\n\n';
}.bind(this));
filename += '.txt';
}
var blob = new Blob([body], { type: mime });
var a = document.createElement('a');
a.href = URL.createObjectURL(blob);
a.download = filename;
document.body.appendChild(a);
a.click();
setTimeout(function () { URL.revokeObjectURL(a.href); a.remove(); }, 500);
this.toolsOpen = false;
if (window.Cockpit) Cockpit.toast('Download gestart (' + fmt + ')', 'ok');
},
async deleteMessage(m) {
if (!this.room || !m || !m.id) return;
if (!window.confirm('Bericht verwijderen?')) return;
@@ -554,8 +1012,10 @@ window.WarRoomHub = (function () {
removeDeletedIds(ids) {
if (!ids || !ids.length) return;
var set = {};
ids.forEach(function (id) { set[id] = true; });
this.messages = (this.messages || []).filter(function (m) { return !set[m.id]; });
ids.forEach(function (id) { set[String(id)] = true; });
this.messages = (this.messages || []).filter(function (m) {
return !set[String(m.id)];
});
},
@@ -566,9 +1026,9 @@ window.WarRoomHub = (function () {
return;
}
if (!(this.voiceRoomAgents || []).length) {
this.voiceRoomAgents = ['herman'];
this.voiceRoomAgents = ['herman', 'bizdev', 'finance', 'retail', 'marketing'];
}
this.speakReplies = true;
// voorlezen blijft uit tot gebruiker 🔊 aanzet
this.voiceRoomOpen = true;
this.callOpen = false;
this.status = 'Voice Room open — houd 🎤 in om te praten';