nio-cat 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/hub.js +4 -1
- package/web/app/app.js +3 -2
- package/web/sw.js +1 -1
package/package.json
CHANGED
package/src/hub.js
CHANGED
|
@@ -99,7 +99,10 @@ class Hub extends EventEmitter {
|
|
|
99
99
|
|
|
100
100
|
push(s, kind, data = {}) {
|
|
101
101
|
const last = s.events[s.events.length - 1];
|
|
102
|
-
if (last && last.open && kind !== 'text-chunk')
|
|
102
|
+
if (last && last.open && kind !== 'text-chunk') {
|
|
103
|
+
delete last.open;
|
|
104
|
+
this.emit('out', { type: 'event', session: s.id, event: last });
|
|
105
|
+
}
|
|
103
106
|
const ev = { seq: ++s.seq, t: Date.now(), kind, ...data };
|
|
104
107
|
s.events.push(ev);
|
|
105
108
|
if (s.events.length > MAX_EVENTS) s.events.splice(0, s.events.length - MAX_EVENTS);
|
package/web/app/app.js
CHANGED
|
@@ -168,9 +168,10 @@ async function pollLoop(ctrl) {
|
|
|
168
168
|
for (const id of [...state.approvals.keys()]) if (!aps.some((a) => a.id === id)) { state.approvals.delete(id); renderChrome(); if (r.name === 'approvals') render(); }
|
|
169
169
|
const evs = r.name === 'session' && state.events.get(r.id);
|
|
170
170
|
if (evs && state.sessions.has(r.id)) {
|
|
171
|
-
const
|
|
171
|
+
const open = [...evs.values()].filter((e) => e.open).map((e) => e.seq);
|
|
172
|
+
const since = open.length ? Math.min(...open) - 1 : Math.max(0, ...evs.keys());
|
|
172
173
|
const d = await api(`/api/sessions/${r.id}?since=${since}`);
|
|
173
|
-
for (const e of d.events)
|
|
174
|
+
for (const e of d.events) { const old = evs.get(e.seq); if (!old || old.open || old.text !== e.text) handle({ type: 'event', session: r.id, event: e }); }
|
|
174
175
|
}
|
|
175
176
|
}
|
|
176
177
|
} catch (e) {
|
package/web/sw.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// nio · service worker: obre l'app encara que no hi hagi connexió i mostra els avisos.
|
|
2
|
-
const SHELL = 'nio-shell-
|
|
2
|
+
const SHELL = 'nio-shell-v21';
|
|
3
3
|
const FILES = ['/app', '/app/style.css', '/app/app.js', '/bot.css', '/bot.js', '/board.css', '/board.js', '/favicon.svg', '/manifest.webmanifest'];
|
|
4
4
|
|
|
5
5
|
self.addEventListener('install', (e) => {
|