@clagentic/console 1.3.0-beta.1 → 1.3.0-beta.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.
@@ -9,6 +9,7 @@ import { startLogoAnimation, stopLogoAnimation } from './console-logo.js';
9
9
  import { hasSendableContent } from './input.js';
10
10
  import { processMessage } from './app-messages.js';
11
11
  import { flushPendingExtMessages } from './app-misc.js';
12
+ import { isHomeHubVisible } from './app-home-hub.js';
12
13
  import { resetTerminals } from './terminal.js';
13
14
  import { closeDmUserPicker } from './sidebar-users.js';
14
15
  import { openDm } from './app-dm.js';
@@ -138,6 +139,21 @@ function onConnected() {
138
139
 
139
140
  // Session restore is now server-driven (user-presence.json).
140
141
  try { localStorage.removeItem("clagentic-active-dm"); localStorage.removeItem("clay-active-dm"); } catch (e) {}
142
+
143
+ // If the home hub was visible when the connection came up (common on mobile
144
+ // PWA cold-start where showHomeHub() fires before the WS is open), re-request
145
+ // hub data now that the socket is ready. Without this, the recent sessions and
146
+ // schedules cards show empty because the initial hub_recent_sessions_list send
147
+ // in showHomeHub() was dropped when readyState !== 1.
148
+ if (isHomeHubVisible()) {
149
+ try {
150
+ var hubWs = getWs();
151
+ if (hubWs && hubWs.readyState === 1) {
152
+ hubWs.send(JSON.stringify({ type: "hub_schedules_list" }));
153
+ hubWs.send(JSON.stringify({ type: "hub_recent_sessions_list" }));
154
+ }
155
+ } catch (e) {}
156
+ }
141
157
  }
142
158
 
143
159
  export function connect() {
@@ -68,6 +68,11 @@ var stickyBottomInputBound = false;
68
68
  export function getStickyBottom() { return stickyBottom; }
69
69
 
70
70
  function pinToBottomNow() {
71
+ // Suppress scroll-during-replay: history messages render fast enough that
72
+ // every per-message pin is visible as a janky scroll on mobile. We do one
73
+ // instant jump at history_done instead (replayingHistory is cleared before
74
+ // armStickyBottom fires there, so that final pin goes through unguarded).
75
+ if (store.get('replayingHistory')) return;
71
76
  var messagesEl = getMessagesEl();
72
77
  if (!messagesEl) return;
73
78
  messagesEl.scrollTop = messagesEl.scrollHeight;
@@ -186,6 +191,10 @@ export function addToMessages(el) {
186
191
 
187
192
  export function scrollToBottom() {
188
193
  if (prependAnchor) return;
194
+ // During history replay, every appended message calls scrollToBottom(), which
195
+ // queues a rAF. On mobile these all fire visibly, making it look like the page
196
+ // is scrolling through history. Suppress — history_done does one final jump.
197
+ if (store.get('replayingHistory')) return;
189
198
  var newMsgBtn = document.getElementById("new-msg-btn");
190
199
  if (isUserScrolledUp) {
191
200
  newMsgBtn.textContent = NEW_MSG_BTN_ACTIVITY;
@@ -119,27 +119,11 @@ export function parseEmojis(el) {
119
119
 
120
120
  var langAliases = { jsonl: "json", dotenv: "bash" };
121
121
 
122
- export function highlightCodeBlocks(el) {
123
- // Defer all syntax highlighting + copy-button injection while replaying
124
- // history. Doing this per-message during replay triggers a long tail of
125
- // sequential reflows that the sticky-bottom scroll observer chases for
126
- // 4-8s. After history_done, app-messages.js calls this once on the full
127
- // messages container, so unhighlighted blocks (selector :not(.hljs))
128
- // are picked up in a single pass.
129
- if (store.get('replayingHistory')) return;
130
- el.querySelectorAll("pre code:not(.hljs):not(.language-mermaid)").forEach(function (block) {
131
- var cls = Array.from(block.classList).find(function (c) { return c.startsWith("language-"); });
132
- if (cls) {
133
- var lang = cls.replace("language-", "");
134
- if (langAliases[lang]) {
135
- block.classList.remove(cls);
136
- block.classList.add("language-" + langAliases[lang]);
137
- }
138
- }
139
- hljs.highlightElement(block);
140
- });
122
+ // Inject copy buttons into all <pre> blocks in el that don't have one yet.
123
+ // Shared by the sync highlight path (per-message streaming) and the batched
124
+ // path (post-history_done full-container pass).
125
+ export function injectCopyButtons(el) {
141
126
  el.querySelectorAll("pre:not(.has-copy-btn):not([data-mermaid-processed])").forEach(function (pre) {
142
- // Skip non-content code blocks (tool details, diffs, etc.)
143
127
  if (!pre.querySelector("code")) return;
144
128
  pre.classList.add("has-copy-btn");
145
129
  pre.style.position = "relative";
@@ -162,6 +146,28 @@ export function highlightCodeBlocks(el) {
162
146
  });
163
147
  }
164
148
 
149
+ export function highlightCodeBlocks(el) {
150
+ // Defer all syntax highlighting + copy-button injection while replaying
151
+ // history. Doing this per-message during replay triggers a long tail of
152
+ // sequential reflows that the sticky-bottom scroll observer chases for
153
+ // 4-8s. After history_done, app-messages.js calls this once on the full
154
+ // messages container, so unhighlighted blocks (selector :not(.hljs))
155
+ // are picked up in a single pass.
156
+ if (store.get('replayingHistory')) return;
157
+ el.querySelectorAll("pre code:not(.hljs):not(.language-mermaid)").forEach(function (block) {
158
+ var cls = Array.from(block.classList).find(function (c) { return c.startsWith("language-"); });
159
+ if (cls) {
160
+ var lang = cls.replace("language-", "");
161
+ if (langAliases[lang]) {
162
+ block.classList.remove(cls);
163
+ block.classList.add("language-" + langAliases[lang]);
164
+ }
165
+ }
166
+ hljs.highlightElement(block);
167
+ });
168
+ injectCopyButtons(el);
169
+ }
170
+
165
171
  export function renderMermaidBlocks(el) {
166
172
  // Same rationale as highlightCodeBlocks: defer mermaid renders until
167
173
  // history_done so they don't cause cascading layout shifts during replay.
@@ -202,7 +208,13 @@ export function renderMermaidBlocks(el) {
202
208
  }
203
209
  export function highlightCodeBlocksBatched(container, onDone) {
204
210
  var blocks = Array.prototype.slice.call(container.querySelectorAll("pre > code:not(.hljs)"));
205
- if (blocks.length === 0) { if (onDone) onDone(); return; }
211
+ if (blocks.length === 0) {
212
+ // No unhighlighted code blocks, but there may be pre blocks without copy
213
+ // buttons (e.g. plain code fences that were already highlighted). Inject now.
214
+ injectCopyButtons(container);
215
+ if (onDone) onDone();
216
+ return;
217
+ }
206
218
 
207
219
  var BATCH = 5; // blocks per idle callback
208
220
  var idx = 0;
@@ -222,6 +234,10 @@ export function highlightCodeBlocksBatched(container, onDone) {
222
234
  requestAnimationFrame(function () { processBatch(null); });
223
235
  }
224
236
  } else {
237
+ // All blocks highlighted — inject copy buttons in one pass over the
238
+ // whole container. This is the post-history_done batch path; the sync
239
+ // highlightCodeBlocks() path handles per-message streaming injection.
240
+ injectCopyButtons(container);
225
241
  if (onDone) onDone();
226
242
  }
227
243
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.3.0-beta.1",
6
+ "version": "1.3.0-beta.2",
7
7
  "description": "Self-hosted console for Claude Code and Codex. Multi-user, browser-based, persistent AI sessions.",
8
8
  "bin": {
9
9
  "clagentic-console": "./bin/cli.js"