@symerian/symi 3.5.0 → 3.5.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.
Files changed (62) hide show
  1. package/dist/build-info.json +3 -3
  2. package/dist/bundled/boot-md/handler.js +4 -4
  3. package/dist/bundled/session-memory/handler.js +4 -4
  4. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  5. package/dist/{chrome-C_I81hbq.js → chrome-B7-rO4i9.js} +4 -4
  6. package/dist/{chrome-BKUACyeO.js → chrome-DPjznJQ-.js} +4 -4
  7. package/dist/control-ui/css/revert-red-theme.md +141 -0
  8. package/dist/control-ui/css/style.css +5843 -0
  9. package/dist/control-ui/css/style.css.backup-2026-03-03-162525 +3546 -0
  10. package/dist/control-ui/css/style.css.backup-before-red-2026-03-03-162525 +3546 -0
  11. package/dist/control-ui/css/style.css.backup-before-red-theme-2026-03-03-162530 +3546 -0
  12. package/dist/control-ui/css/style.css.pre-2row +2165 -0
  13. package/dist/control-ui/css/style.css.pre-brand +1776 -0
  14. package/dist/control-ui/css/style.css.pre-history +1974 -0
  15. package/dist/control-ui/css/style.css.pre-nav +2264 -0
  16. package/dist/control-ui/css/style.css.pre-newsession +1898 -0
  17. package/dist/control-ui/css/style.css.pre-queue +2195 -0
  18. package/dist/control-ui/css/style.css.pre-red-prompt +2524 -0
  19. package/dist/control-ui/css/style.css.pre-stop +2239 -0
  20. package/dist/control-ui/css/style.css.pre-textarea +2184 -0
  21. package/dist/control-ui/css/style.css.pre-watchdog +1848 -0
  22. package/dist/control-ui/css/style.css.red-theme +2999 -0
  23. package/dist/control-ui/index.html +1049 -0
  24. package/dist/control-ui/js/app.js +1304 -0
  25. package/dist/control-ui/js/app.js.pre-2row +463 -0
  26. package/dist/control-ui/js/app.js.pre-heartbeat-filter +595 -0
  27. package/dist/control-ui/js/app.js.pre-newsession +408 -0
  28. package/dist/control-ui/js/app.js.pre-queue +476 -0
  29. package/dist/control-ui/js/app.js.pre-stop +564 -0
  30. package/dist/control-ui/js/app.js.pre-textarea +467 -0
  31. package/dist/control-ui/js/app.js.pre-watchdog +293 -0
  32. package/dist/control-ui/js/connections.js +438 -0
  33. package/dist/control-ui/js/gateway.js +233 -0
  34. package/dist/control-ui/js/gateway.js.pre-stop +110 -0
  35. package/dist/control-ui/js/history.js +732 -0
  36. package/dist/control-ui/js/logs.js +238 -0
  37. package/dist/control-ui/js/menu.js +232 -0
  38. package/dist/control-ui/js/menu.js.pre-nav +66 -0
  39. package/dist/control-ui/js/metrics.js +53 -0
  40. package/dist/control-ui/js/models.js +138 -0
  41. package/dist/control-ui/js/render.js +882 -0
  42. package/dist/control-ui/js/render.test.js +112 -0
  43. package/dist/control-ui/js/scheduling.js +461 -0
  44. package/dist/control-ui/js/settings.js +910 -0
  45. package/dist/control-ui/js/slash-autocomplete.js +168 -0
  46. package/dist/control-ui/js/subagents.js +560 -0
  47. package/dist/control-ui/js/utils.js +29 -0
  48. package/dist/control-ui/vendor/highlight.min.js +2518 -0
  49. package/dist/control-ui/vendor/marked.min.js +69 -0
  50. package/dist/{deliver-DyO3QD8O.js → deliver-DTRkeYm3.js} +4 -4
  51. package/dist/{deliver-Cjyb6h4g.js → deliver-oWGJwzFf.js} +4 -4
  52. package/dist/extensionAPI.js +4 -4
  53. package/dist/llm-slug-generator.js +4 -4
  54. package/dist/{manager-rvtFoeFT.js → manager-CFenq_aO.js} +1 -1
  55. package/dist/{manager-PTSjHNVq.js → manager-CsxTf96V.js} +1 -1
  56. package/dist/{pi-embedded-BPuUM-gD.js → pi-embedded-Cdub5Vs9.js} +10 -10
  57. package/dist/{pw-ai-BFS9ezWe.js → pw-ai-BOOB8qoi.js} +1 -1
  58. package/dist/{pw-ai-Cx-Ko_FL.js → pw-ai-D2pEVS5n.js} +1 -1
  59. package/dist/{synthesis-7UL3pCpj.js → synthesis-Be9nYyDd.js} +4 -4
  60. package/dist/{synthesis-fD8J2vag.js → synthesis-CBIT6Vnk.js} +4 -4
  61. package/dist/{unified-runner-BIiKFnNF.js → unified-runner-BVvvnjXW.js} +10 -10
  62. package/package.json +1 -1
@@ -0,0 +1,463 @@
1
+ // ── Symi UI — Live Gateway App ────────────────────────────────────────
2
+
3
+ const responseArea = document.getElementById('response-area');
4
+ const promptInput = document.getElementById('prompt-input');
5
+ const sendBtn = document.getElementById('send-btn');
6
+ const newSessionBtn = document.getElementById('new-session-btn');
7
+
8
+ let isStreaming = false;
9
+ let currentRunId = null;
10
+ let streamBubble = null;
11
+ let streamContent = null;
12
+ let streamStart = 0;
13
+
14
+ // ── Watchdog + elapsed timer state ────────────────────────────────
15
+ let watchdogTimer = null; // fires if no activity for WATCHDOG_MS
16
+ let elapsedTimer = null; // ticks every second to show run duration
17
+ let activityStart = 0; // timestamp of when current run began
18
+ let elapsedBaseText = ''; // base sub-text for the elapsed display
19
+ const WATCHDOG_MS = 90000; // 90 seconds of silence → failure
20
+
21
+ // ── Utility ───────────────────────────────────────────────────────
22
+ const sleep = ms => new Promise(r => setTimeout(r, ms));
23
+ function escapeHtml(t) {
24
+ return t.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
25
+ }
26
+
27
+ // ── Status indicator (top-right of response area) ─────────────────
28
+ const statusEl = document.createElement('div');
29
+ statusEl.className = 'conn-status';
30
+ statusEl.innerHTML = '<span class="conn-dot dot-yellow pulse"></span><span class="conn-label">connecting…</span>';
31
+ responseArea.before(statusEl);
32
+
33
+ function setStatus(state) { // 'connecting' | 'online' | 'offline'
34
+ const dot = statusEl.querySelector('.conn-dot');
35
+ const label = statusEl.querySelector('.conn-label');
36
+ dot.className = `conn-dot ${state === 'online' ? 'dot-green pulse' : state === 'offline' ? 'dot-red' : 'dot-yellow pulse'}`;
37
+ label.textContent = state === 'online' ? 'live' : state === 'offline' ? 'disconnected' : 'connecting…';
38
+ }
39
+
40
+ // ── Render helpers ─────────────────────────────────────────────────
41
+ function addUserMessage(text) {
42
+ const msg = document.createElement('div');
43
+ msg.className = 'message user-msg';
44
+ msg.innerHTML = `<div class="bubble">${escapeHtml(text)}</div><div class="message-clearfix"></div>`;
45
+ responseArea.appendChild(msg);
46
+ msg.scrollIntoView({ behavior: 'smooth', block: 'end' });
47
+ }
48
+
49
+ // ── Thinking bubble ────────────────────────────────────────────────
50
+ function createThinkingBubble() {
51
+ const msg = document.createElement('div');
52
+ msg.className = 'message symi-msg thinking-msg';
53
+ msg.innerHTML = `
54
+ <div class="bubble thinking-bubble">
55
+ <div class="think-header">
56
+ <span class="think-badge">◈ PROCESSING</span>
57
+ <span class="think-dots"><span>.</span><span>.</span><span>.</span></span>
58
+ </div>
59
+ <div class="think-bar-wrap"><div class="think-bar"></div></div>
60
+ </div>
61
+ <div class="message-clearfix"></div>
62
+ `;
63
+ responseArea.appendChild(msg);
64
+ msg.scrollIntoView({ behavior: 'smooth', block: 'end' });
65
+ return msg;
66
+ }
67
+
68
+ // ── Stream bubble lifecycle ────────────────────────────────────────
69
+ function openStreamBubble() {
70
+ streamStart = Date.now();
71
+ const msg = document.createElement('div');
72
+ msg.className = 'message symi-msg stream-msg';
73
+ msg.innerHTML = `<div class="bubble stream-bubble streaming"><div class="bubble-content"></div></div><div class="message-clearfix"></div>`;
74
+ responseArea.appendChild(msg);
75
+ streamBubble = msg.querySelector('.stream-bubble');
76
+ streamContent = msg.querySelector('.bubble-content');
77
+ msg.scrollIntoView({ behavior: 'smooth', block: 'end' });
78
+ return msg;
79
+ }
80
+
81
+ function updateStream(text) {
82
+ if (!streamContent) return;
83
+ streamContent.textContent = text;
84
+ responseArea.scrollTop = responseArea.scrollHeight;
85
+ }
86
+
87
+ function closeStreamBubble(model = 'claude-sonnet-4-6') {
88
+ if (!streamBubble) return;
89
+ streamBubble.classList.remove('streaming');
90
+ streamBubble.classList.add('done');
91
+
92
+ // Apply full markdown rendering to the final text
93
+ const rawText = streamContent?.textContent ?? '';
94
+ if (streamContent && rawText) {
95
+ streamContent.innerHTML = '';
96
+ const textBlock = renderBlock({ type: 'text', text: rawText });
97
+ streamContent.appendChild(textBlock);
98
+ window.applyHighlighting(streamContent);
99
+ }
100
+
101
+ const elapsed = Date.now() - streamStart;
102
+ const chars = Math.round(rawText.length / 4);
103
+
104
+ // Add copy button
105
+ const copyBtn = document.createElement('button');
106
+ copyBtn.className = 'msg-copy-btn msg-copy-visible';
107
+ copyBtn.title = 'Copy';
108
+ copyBtn.onclick = function() { window.copyMessage(this); };
109
+ copyBtn.innerHTML = `<svg width="12" height="12" viewBox="0 0 24 24" fill="none">
110
+ <rect x="9" y="9" width="13" height="13" rx="2" stroke="currentColor" stroke-width="2"/>
111
+ <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" stroke="currentColor" stroke-width="2"/>
112
+ </svg>`;
113
+ streamBubble.appendChild(copyBtn);
114
+
115
+ const footer = document.createElement('div');
116
+ footer.className = 'telemetry';
117
+ footer.innerHTML = `
118
+ <span class="tele-item">✦ ${model}</span>
119
+ <span class="tele-sep">·</span>
120
+ <span class="tele-item">${chars} tokens</span>
121
+ <span class="tele-sep">·</span>
122
+ <span class="tele-item">${elapsed}ms</span>
123
+ `;
124
+ streamBubble.appendChild(footer);
125
+ requestAnimationFrame(() => {
126
+ footer.classList.add('tele-visible');
127
+ // Scroll to bottom immediately after markdown + footer are in the DOM
128
+ responseArea.scrollTop = responseArea.scrollHeight;
129
+ });
130
+
131
+ // Second scroll after the fit-content width transition finishes (0.3s)
132
+ setTimeout(() => { responseArea.scrollTop = responseArea.scrollHeight; }, 350);
133
+
134
+ streamBubble = null;
135
+ streamContent = null;
136
+ }
137
+
138
+ // ── Elapsed timer ─────────────────────────────────────────────────
139
+ function startElapsedTimer(baseText) {
140
+ stopElapsedTimer();
141
+ activityStart = Date.now();
142
+ elapsedBaseText = baseText;
143
+ elapsedTimer = setInterval(() => {
144
+ const secs = Math.floor((Date.now() - activityStart) / 1000);
145
+ const m = Math.floor(secs / 60);
146
+ const s = String(secs % 60).padStart(2, '0');
147
+ if (asoSub) asoSub.textContent = `${elapsedBaseText} ${m}:${s}`;
148
+ }, 1000);
149
+ }
150
+
151
+ function stopElapsedTimer() {
152
+ if (elapsedTimer) { clearInterval(elapsedTimer); elapsedTimer = null; }
153
+ }
154
+
155
+ // ── Watchdog ───────────────────────────────────────────────────────
156
+ function armWatchdog() {
157
+ clearWatchdog();
158
+ watchdogTimer = setTimeout(() => handleRunFailure('timeout'), WATCHDOG_MS);
159
+ }
160
+
161
+ function clearWatchdog() {
162
+ if (watchdogTimer) { clearTimeout(watchdogTimer); watchdogTimer = null; }
163
+ }
164
+
165
+ // ── Unified run failure handler ────────────────────────────────────
166
+ // Called when: watchdog fires, gateway disconnects mid-run, or server
167
+ // sends an explicit error event. Cleans up all state and shows the user
168
+ // a clear error message + ERROR orb state.
169
+ function handleRunFailure(reason) {
170
+ // Stop timers immediately
171
+ stopElapsedTimer();
172
+ clearWatchdog();
173
+
174
+ // Clean up any in-flight UI elements
175
+ if (thinkingEl) { thinkingEl.remove(); thinkingEl = null; }
176
+ if (streamBubble) {
177
+ // Don't render markdown on a partial/failed response — just mark it failed
178
+ streamBubble.classList.remove('streaming');
179
+ streamBubble.classList.add('done', 'stream-failed');
180
+ streamBubble = null;
181
+ streamContent = null;
182
+ }
183
+
184
+ // Human-readable reason labels
185
+ const labels = {
186
+ timeout: `No response received after ${WATCHDOG_MS / 1000}s — the agent may still be running in the background`,
187
+ disconnected: 'Connection lost mid-run — gateway disconnected',
188
+ };
189
+ const label = labels[reason] || reason;
190
+
191
+ // Inject error bubble into the feed
192
+ const errEl = document.createElement('div');
193
+ errEl.className = 'message symi-msg';
194
+ errEl.innerHTML = `
195
+ <div class="bubble stream-bubble done run-error-bubble">
196
+ <div class="run-error-icon">⚠</div>
197
+ <div class="bubble-content run-error-text">${escapeHtml(label)}</div>
198
+ </div>
199
+ <div class="message-clearfix"></div>
200
+ `;
201
+ responseArea.appendChild(errEl);
202
+ requestAnimationFrame(() => { responseArea.scrollTop = responseArea.scrollHeight; });
203
+
204
+ // Show ERROR state on orb, then reset input
205
+ setAgentStatus('error');
206
+ isStreaming = false;
207
+ currentRunId = null;
208
+ enableInput();
209
+ }
210
+
211
+ // ── Render history (on first connect) ─────────────────────────────
212
+ function renderHistory(messages) {
213
+ responseArea.innerHTML = '';
214
+ for (const m of messages) {
215
+ if (!m || !m.role) continue;
216
+ const hasContent = Array.isArray(m.content)
217
+ ? m.content.some(b => (b.text ?? b.thinking ?? b.name ?? '').trim())
218
+ : extractText(m.content).trim();
219
+ if (!hasContent) continue;
220
+
221
+ const el = window.renderMessage(m);
222
+ responseArea.appendChild(el);
223
+ window.applyHighlighting(el);
224
+ }
225
+
226
+ // Scroll to very bottom after history renders
227
+ requestAnimationFrame(() => { responseArea.scrollTop = responseArea.scrollHeight; });
228
+ }
229
+
230
+ // ── Gateway event handler ──────────────────────────────────────────
231
+ let thinkingEl = null;
232
+
233
+ function handleGatewayEvent(event) {
234
+ if (event.event !== 'chat') return;
235
+ const p = event.payload;
236
+ if (!p || p.sessionKey !== window.SESSION_KEY) return;
237
+
238
+ if (p.state === 'delta') {
239
+ // Each delta proves the agent is alive — reset the watchdog
240
+ armWatchdog();
241
+
242
+ // First delta — remove thinking bubble, open stream bubble
243
+ if (thinkingEl) { thinkingEl.remove(); thinkingEl = null; }
244
+ if (!streamBubble) {
245
+ openStreamBubble();
246
+ setAgentStatus('streaming');
247
+ }
248
+
249
+ const text = extractText(p.message);
250
+ if (text) updateStream(text);
251
+
252
+ } else if (p.state === 'final') {
253
+ stopElapsedTimer();
254
+ clearWatchdog();
255
+ closeStreamBubble();
256
+ setAgentStatus('done');
257
+ isStreaming = false;
258
+ currentRunId = null;
259
+ enableInput();
260
+
261
+ } else if (p.state === 'aborted') {
262
+ // Clean abort (user-initiated or model decided to stop) — not an error
263
+ stopElapsedTimer();
264
+ clearWatchdog();
265
+ if (streamBubble) closeStreamBubble();
266
+ if (thinkingEl) { thinkingEl.remove(); thinkingEl = null; }
267
+ setAgentStatus('idle');
268
+ isStreaming = false;
269
+ currentRunId = null;
270
+ enableInput();
271
+
272
+ } else if (p.state === 'error') {
273
+ // Server-reported error — route through unified failure handler
274
+ handleRunFailure(p.error?.message || 'Server reported an error');
275
+ }
276
+ }
277
+
278
+ // ── Agent Status Orb ───────────────────────────────────────────────
279
+ const asoPanel = document.getElementById('agent-status-panel');
280
+ const asoLabel = document.getElementById('aso-label');
281
+ const asoSub = document.getElementById('aso-sub');
282
+ let asoDoneTimer = null;
283
+
284
+ const ASO_STATES = {
285
+ idle: { state: 'idle', label: 'STANDBY', sub: 'Awaiting your prompt' },
286
+ waiting: { state: 'waiting', label: 'WAITING', sub: 'Sending to Symi\u2026' },
287
+ thinking: { state: 'thinking', label: 'PROCESSING', sub: 'Reasoning through request' },
288
+ streaming: { state: 'streaming', label: 'RESPONDING', sub: 'Generating response' },
289
+ done: { state: 'done', label: 'COMPLETE', sub: 'Response ready' },
290
+ error: { state: 'error', label: 'FAILED', sub: 'Run ended unexpectedly' },
291
+ };
292
+
293
+ function setAgentStatus(key) {
294
+ if (!asoPanel) return;
295
+
296
+ // Clear any pending auto-transition timers
297
+ if (asoDoneTimer) { clearTimeout(asoDoneTimer); asoDoneTimer = null; }
298
+
299
+ const s = ASO_STATES[key] || ASO_STATES.idle;
300
+ asoPanel.dataset.state = s.state;
301
+ if (asoLabel) asoLabel.textContent = s.label;
302
+ if (asoSub) asoSub.textContent = s.sub;
303
+
304
+ // ── Elapsed timer management ──────────────────────────────────
305
+ if (key === 'thinking') {
306
+ // Start elapsed timer and watchdog when processing begins
307
+ armWatchdog();
308
+ startElapsedTimer('Reasoning through request');
309
+ } else if (key === 'streaming') {
310
+ // Transition from thinking → streaming: keep watchdog running (will be
311
+ // reset on each delta), switch elapsed timer base text
312
+ elapsedBaseText = 'Generating response';
313
+ } else {
314
+ // Any terminal/non-active state: stop elapsed timer and watchdog
315
+ stopElapsedTimer();
316
+ clearWatchdog();
317
+ }
318
+
319
+ // ── Auto-revert timers ────────────────────────────────────────
320
+ if (key === 'done') {
321
+ asoDoneTimer = setTimeout(() => setAgentStatus('idle'), 3000);
322
+ }
323
+ if (key === 'error') {
324
+ asoDoneTimer = setTimeout(() => setAgentStatus('idle'), 4000);
325
+ }
326
+ }
327
+
328
+ // ── Input state ────────────────────────────────────────────────────
329
+ function disableInput() {
330
+ promptInput.disabled = true;
331
+ sendBtn.disabled = true;
332
+ newSessionBtn.disabled = true;
333
+ sendBtn.classList.add('btn-loading');
334
+ }
335
+
336
+ function enableInput() {
337
+ promptInput.disabled = false;
338
+ sendBtn.disabled = false;
339
+ newSessionBtn.disabled = false;
340
+ sendBtn.classList.remove('btn-loading');
341
+ promptInput.focus();
342
+ }
343
+
344
+ // ── Send handler ───────────────────────────────────────────────────
345
+ async function handleSend() {
346
+ if (isStreaming || !gateway.connected) return;
347
+ const text = promptInput.value.trim();
348
+ if (!text) return;
349
+
350
+ isStreaming = true;
351
+ promptInput.value = '';
352
+ disableInput();
353
+
354
+ addUserMessage(text);
355
+ await sleep(200);
356
+
357
+ setAgentStatus('waiting');
358
+ thinkingEl = createThinkingBubble();
359
+ setAgentStatus('thinking');
360
+
361
+ try {
362
+ await gateway.send(text);
363
+ // Response will arrive via chat events — watchdog is now armed
364
+ } catch (err) {
365
+ // gateway.send() itself failed (e.g. not connected, network error)
366
+ handleRunFailure(err.message || 'Failed to send message');
367
+ }
368
+ }
369
+
370
+ // ── New Session handler ────────────────────────────────────────────
371
+ async function handleNewSession() {
372
+ if (isStreaming || !gateway.connected) return;
373
+
374
+ disableInput();
375
+ setAgentStatus('waiting');
376
+
377
+ try {
378
+ // Send the /new slash command — gateway resets the session
379
+ await gateway.send('/new');
380
+
381
+ // Fade out existing messages, then show cleared state
382
+ responseArea.style.transition = 'opacity 0.25s ease';
383
+ responseArea.style.opacity = '0';
384
+
385
+ await sleep(260);
386
+
387
+ responseArea.innerHTML = '';
388
+ responseArea.style.opacity = '1';
389
+
390
+ // Show empty-state indicator
391
+ const cleared = document.createElement('div');
392
+ cleared.className = 'session-cleared';
393
+ cleared.innerHTML = `
394
+ <div class="session-cleared-icon">◈</div>
395
+ <div class="session-cleared-text">NEW SESSION STARTED</div>
396
+ `;
397
+ responseArea.appendChild(cleared);
398
+
399
+ setAgentStatus('idle');
400
+
401
+ // Show archive toast — lets user jump directly to history if they regret it
402
+ if (typeof window.showArchiveToast === 'function') window.showArchiveToast();
403
+
404
+ // After a short pause, remove the cleared indicator and let history load
405
+ await sleep(1800);
406
+ cleared.style.transition = 'opacity 0.4s ease';
407
+ cleared.style.opacity = '0';
408
+ await sleep(420);
409
+ cleared.remove();
410
+
411
+ } catch (err) {
412
+ handleRunFailure(err.message || 'Failed to start new session');
413
+ return;
414
+ }
415
+
416
+ enableInput();
417
+ }
418
+
419
+ sendBtn.addEventListener('click', handleSend);
420
+ newSessionBtn.addEventListener('click', handleNewSession);
421
+ promptInput.addEventListener('keydown', e => {
422
+ if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); handleSend(); }
423
+ });
424
+
425
+ // Clicking anywhere on the prompt bar (padding, icon, gaps) focuses the input
426
+ document.getElementById('prompt-bar').addEventListener('click', e => {
427
+ const inSend = sendBtn.contains(e.target) || e.target === sendBtn;
428
+ const inNewSession = newSessionBtn.contains(e.target) || e.target === newSessionBtn;
429
+ if (!inSend && !inNewSession) {
430
+ promptInput.focus();
431
+ }
432
+ });
433
+
434
+ // ── Gateway setup ──────────────────────────────────────────────────
435
+ const gateway = new SymiGateway();
436
+
437
+ gateway.addEventListener('connect', () => {
438
+ setStatus('online');
439
+ enableInput();
440
+ // History arrives via separate 'history' event pushed by the server
441
+ });
442
+
443
+ gateway.addEventListener('history', (e) => {
444
+ const msgs = Array.isArray(e.detail?.messages) ? e.detail.messages : [];
445
+ renderHistory(msgs);
446
+ });
447
+
448
+ gateway.addEventListener('disconnect', () => {
449
+ setStatus('offline');
450
+ // If the gateway drops while a run is in progress, surface the failure
451
+ // immediately rather than leaving the UI in a permanently locked state.
452
+ if (isStreaming) {
453
+ handleRunFailure('disconnected');
454
+ }
455
+ });
456
+
457
+ gateway.addEventListener('event', (e) => {
458
+ handleGatewayEvent(e.detail);
459
+ });
460
+
461
+ // Start connecting
462
+ disableInput();
463
+ gateway.start();