@clagentic/console 1.12.0 → 1.13.0-beta.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 (243) hide show
  1. package/README.md +7 -1
  2. package/bin/cli.js +18 -15
  3. package/lib/agent-roster-ws.js +38 -13
  4. package/lib/agent-roster.js +111 -12
  5. package/lib/agents.js +68 -33
  6. package/lib/atomic-install.js +334 -0
  7. package/lib/build-changes.js +33 -4
  8. package/lib/build-sha.json +2 -2
  9. package/lib/build-update-offer.js +12 -0
  10. package/lib/chat-width.js +31 -0
  11. package/lib/cli/agent-usage.js +126 -0
  12. package/lib/cli/arg-validation.js +1 -1
  13. package/lib/cli/compact-output.js +69 -0
  14. package/lib/cli/ipc-subcommands.js +92 -67
  15. package/lib/cli/output.js +28 -0
  16. package/lib/cli/restart-verb.js +132 -0
  17. package/lib/cli/schedule-input-subcommands.js +45 -8
  18. package/lib/cli/session-subcommands.js +37 -11
  19. package/lib/cli/settings-subcommands.js +74 -0
  20. package/lib/cli-transcript-title.js +56 -3
  21. package/lib/client-files.js +79 -0
  22. package/lib/daemon.js +100 -28
  23. package/lib/default-avatar-color.js +4 -0
  24. package/lib/drain.js +58 -10
  25. package/lib/mcp-tool-input.js +2 -2
  26. package/lib/model-families.js +49 -1
  27. package/lib/notify/type-registry.js +4 -0
  28. package/lib/notify/types.js +7 -4
  29. package/lib/pages.js +13 -63
  30. package/lib/permission-summary.js +12 -16
  31. package/lib/plan-usage-reader.js +70 -0
  32. package/lib/project-connection.js +4 -2
  33. package/lib/project-filesystem.js +6 -7
  34. package/lib/project-notifications.js +55 -8
  35. package/lib/project-prompt-expiry-settings.js +42 -0
  36. package/lib/project-sessions.js +52 -0
  37. package/lib/project-settings-gate.js +98 -0
  38. package/lib/project-user-mention.js +3 -2
  39. package/lib/project.js +1 -1
  40. package/lib/prompt-expiry-settings.js +49 -0
  41. package/lib/prompt-expiry.js +24 -3
  42. package/lib/prompt-kinds/codecs.js +6 -2
  43. package/lib/public/app.js +36 -36
  44. package/lib/public/css/admin.css +156 -170
  45. package/lib/public/css/agent-messages.css +24 -24
  46. package/lib/public/css/agent-picker.css +90 -38
  47. package/lib/public/css/agent-roster.css +61 -27
  48. package/lib/public/css/at-agents.css +10 -10
  49. package/lib/public/css/base.css +207 -184
  50. package/lib/public/css/chat-layout.css +228 -0
  51. package/lib/public/css/command-palette.css +86 -88
  52. package/lib/public/css/diagnostics.css +78 -204
  53. package/lib/public/css/diff.css +10 -10
  54. package/lib/public/css/filebrowser.css +32 -60
  55. package/lib/public/css/home-hub.css +100 -100
  56. package/lib/public/css/icon-strip.css +195 -238
  57. package/lib/public/css/input.css +191 -212
  58. package/lib/public/css/login-panel.css +16 -16
  59. package/lib/public/css/loop.css +96 -187
  60. package/lib/public/css/mention.css +49 -110
  61. package/lib/public/css/menus.css +162 -169
  62. package/lib/public/css/messages.css +49 -123
  63. package/lib/public/css/mobile-nav.css +207 -264
  64. package/lib/public/css/notifications-center.css +45 -124
  65. package/lib/public/css/overlay.css +269 -0
  66. package/lib/public/css/overlays.css +134 -156
  67. package/lib/public/css/playbook.css +41 -41
  68. package/lib/public/css/profile.css +43 -112
  69. package/lib/public/css/rewind.css +112 -112
  70. package/lib/public/css/scheduler-modal.css +27 -135
  71. package/lib/public/css/scheduler.css +204 -210
  72. package/lib/public/css/server-settings.css +173 -239
  73. package/lib/public/css/session-search.css +20 -20
  74. package/lib/public/css/settings-nav.css +197 -0
  75. package/lib/public/css/sidebar.css +213 -304
  76. package/lib/public/css/skills.css +121 -135
  77. package/lib/public/css/sticky-notes.css +114 -200
  78. package/lib/public/css/stt.css +17 -26
  79. package/lib/public/css/team-panel.css +36 -36
  80. package/lib/public/css/team-view.css +9 -9
  81. package/lib/public/css/title-bar.css +83 -100
  82. package/lib/public/css/tooltip.css +10 -10
  83. package/lib/public/css/user-settings.css +78 -131
  84. package/lib/public/css/user-shell.css +125 -29
  85. package/lib/public/index.html +178 -177
  86. package/lib/public/manifest.json +0 -2
  87. package/lib/public/modules/admin.js +54 -92
  88. package/lib/public/modules/agent-avatar.js +134 -3
  89. package/lib/public/modules/agent-messages.js +2 -1
  90. package/lib/public/modules/agent-picker.js +23 -21
  91. package/lib/public/modules/agent-roster-groups.js +128 -0
  92. package/lib/public/modules/agent-roster.js +40 -11
  93. package/lib/public/modules/app-connection.js +13 -1
  94. package/lib/public/modules/app-cursors.js +9 -9
  95. package/lib/public/modules/app-favicon.js +8 -16
  96. package/lib/public/modules/app-header.js +28 -19
  97. package/lib/public/modules/app-history-replay.js +67 -4
  98. package/lib/public/modules/app-home-hub.js +15 -0
  99. package/lib/public/modules/app-loop-ui.js +41 -47
  100. package/lib/public/modules/app-loop-wizard.js +9 -10
  101. package/lib/public/modules/app-messages.js +32 -36
  102. package/lib/public/modules/app-misc.js +22 -92
  103. package/lib/public/modules/app-modals.js +98 -0
  104. package/lib/public/modules/app-notifications.js +124 -135
  105. package/lib/public/modules/app-panels.js +28 -32
  106. package/lib/public/modules/app-projects.js +30 -40
  107. package/lib/public/modules/app-rate-limit.js +26 -9
  108. package/lib/public/modules/app-rendering.js +128 -110
  109. package/lib/public/modules/app-skills-install.js +6 -4
  110. package/lib/public/modules/assistant-identity.js +55 -0
  111. package/lib/public/modules/at-agents.js +3 -0
  112. package/lib/public/modules/build-guard.js +25 -11
  113. package/lib/public/modules/chat-width-choice.js +75 -0
  114. package/lib/public/modules/chat-width-prefs.js +52 -0
  115. package/lib/public/modules/chat-width.js +102 -0
  116. package/lib/public/modules/collapsible-text.js +36 -4
  117. package/lib/public/modules/command-palette.js +28 -34
  118. package/lib/public/modules/context-sources.js +3 -5
  119. package/lib/public/modules/diagnostics.js +130 -129
  120. package/lib/public/modules/info-panel.js +31 -0
  121. package/lib/public/modules/injected-identity.js +8 -8
  122. package/lib/public/modules/input-list-menu.js +39 -0
  123. package/lib/public/modules/input.js +22 -21
  124. package/lib/public/modules/markdown.js +10 -11
  125. package/lib/public/modules/mcp-ui.js +4 -14
  126. package/lib/public/modules/mention.js +100 -229
  127. package/lib/public/modules/message-header.js +80 -0
  128. package/lib/public/modules/message-participants.js +39 -0
  129. package/lib/public/modules/mobile-action-sheet.js +46 -0
  130. package/lib/public/modules/mobile-nav-sheet.js +104 -0
  131. package/lib/public/modules/model-families.js +41 -4
  132. package/lib/public/modules/note-order.js +39 -0
  133. package/lib/public/modules/notifications.js +35 -52
  134. package/lib/public/modules/overlay-history.js +73 -19
  135. package/lib/public/modules/overlay-menu.js +123 -0
  136. package/lib/public/modules/overlay-modal.js +186 -0
  137. package/lib/public/modules/overlay-registry.js +392 -0
  138. package/lib/public/modules/overlay-stack.js +110 -0
  139. package/lib/public/modules/overlay.js +117 -0
  140. package/lib/public/modules/popover-position.js +18 -2
  141. package/lib/public/modules/preference-sync.js +28 -0
  142. package/lib/public/modules/profile.js +24 -49
  143. package/lib/public/modules/project-settings.js +27 -172
  144. package/lib/public/modules/prompt-expiry-controls.js +46 -0
  145. package/lib/public/modules/prompt-kinds/command-summary.js +149 -0
  146. package/lib/public/modules/prompt-kinds/permission.js +70 -92
  147. package/lib/public/modules/prompts.js +1 -2
  148. package/lib/public/modules/qrcode.js +6 -21
  149. package/lib/public/modules/queued-button.js +15 -2
  150. package/lib/public/modules/rewind.js +9 -3
  151. package/lib/public/modules/schedule-time.js +32 -7
  152. package/lib/public/modules/scheduled-outbox.js +51 -18
  153. package/lib/public/modules/scheduler-config.js +87 -127
  154. package/lib/public/modules/scheduler.js +29 -26
  155. package/lib/public/modules/serialized-save.js +79 -0
  156. package/lib/public/modules/server-settings.js +75 -65
  157. package/lib/public/modules/session-grants.js +16 -19
  158. package/lib/public/modules/session-list-avatars.js +98 -0
  159. package/lib/public/modules/session-vendor-state.js +86 -0
  160. package/lib/public/modules/settings-access.js +35 -0
  161. package/lib/public/modules/settings-hub.js +125 -0
  162. package/lib/public/modules/settings-nav.js +182 -0
  163. package/lib/public/modules/shell-line.js +24 -0
  164. package/lib/public/modules/sidebar-mobile.js +151 -195
  165. package/lib/public/modules/sidebar-projects.js +88 -129
  166. package/lib/public/modules/sidebar-sessions.js +66 -34
  167. package/lib/public/modules/sidebar.js +2 -2
  168. package/lib/public/modules/skills.js +11 -26
  169. package/lib/public/modules/sticky-notes.js +19 -16
  170. package/lib/public/modules/stt.js +9 -23
  171. package/lib/public/modules/terminal.js +86 -90
  172. package/lib/public/modules/theme-choice.js +126 -0
  173. package/lib/public/modules/theme-colors.js +19 -0
  174. package/lib/public/modules/theme-prefs.js +121 -0
  175. package/lib/public/modules/theme.js +227 -605
  176. package/lib/public/modules/tool-palette.js +7 -17
  177. package/lib/public/modules/tools.js +8 -10
  178. package/lib/public/modules/user-settings.js +59 -115
  179. package/lib/public/modules/user-shell.js +9 -2
  180. package/lib/public/modules/utils.js +10 -12
  181. package/lib/public/modules/vendor-picker.js +4 -2
  182. package/lib/public/modules/vendor-registry.js +1 -2
  183. package/lib/public/style.css +3 -1
  184. package/lib/public/sw.js +9 -2
  185. package/lib/public/theme-core.js +411 -0
  186. package/lib/request-body.js +70 -0
  187. package/lib/sdk-bridge.js +227 -88
  188. package/lib/sdk-message-processor.js +44 -16
  189. package/lib/server-admin.js +198 -200
  190. package/lib/server-auth.js +16 -13
  191. package/lib/server-dm.js +4 -3
  192. package/lib/server-settings.js +177 -130
  193. package/lib/server.js +87 -36
  194. package/lib/session-background-tasks.js +79 -0
  195. package/lib/session-directory.js +138 -13
  196. package/lib/session-input-ipc.js +2 -0
  197. package/lib/session-input.js +39 -5
  198. package/lib/session-list-avatars.js +16 -0
  199. package/lib/session-reclaim.js +37 -25
  200. package/lib/session-vendor.js +37 -0
  201. package/lib/sessions.js +99 -34
  202. package/lib/settings-ipc.js +60 -0
  203. package/lib/settings-registry.js +86 -0
  204. package/lib/terminal-manager.js +17 -5
  205. package/lib/theme-files.js +132 -0
  206. package/lib/theme-seed.js +136 -0
  207. package/lib/themes/clagentic-dark.json +13 -6
  208. package/lib/themes/clagentic-light.json +12 -5
  209. package/lib/updater.js +6 -4
  210. package/lib/usage-store.js +97 -10
  211. package/lib/users-preferences.js +118 -19
  212. package/lib/users.js +19 -10
  213. package/lib/vendor-catalog.js +130 -0
  214. package/lib/ws-schema.js +4 -2
  215. package/lib/yoke/adapters/claude.js +81 -1
  216. package/lib/yoke/adapters/codex-user-shell.js +87 -23
  217. package/lib/yoke/adapters/codex.js +89 -5
  218. package/lib/yoke/codex-binary.js +59 -0
  219. package/package.json +1 -1
  220. package/scripts/check-test-count.js +5 -0
  221. package/scripts/install-local-test.js +50 -9
  222. package/scripts/write-build-sha.js +18 -2
  223. package/lib/public/css/channel-layout.css +0 -329
  224. package/lib/themes/ayu-light.json +0 -9
  225. package/lib/themes/catppuccin-latte.json +0 -9
  226. package/lib/themes/catppuccin-mocha.json +0 -9
  227. package/lib/themes/dracula.json +0 -9
  228. package/lib/themes/everforest-light.json +0 -9
  229. package/lib/themes/everforest.json +0 -9
  230. package/lib/themes/github-light.json +0 -9
  231. package/lib/themes/gruvbox-dark.json +0 -9
  232. package/lib/themes/gruvbox-light.json +0 -9
  233. package/lib/themes/monokai.json +0 -9
  234. package/lib/themes/nord-light.json +0 -9
  235. package/lib/themes/nord.json +0 -9
  236. package/lib/themes/one-dark.json +0 -9
  237. package/lib/themes/one-light.json +0 -9
  238. package/lib/themes/rose-pine-dawn.json +0 -9
  239. package/lib/themes/rose-pine.json +0 -9
  240. package/lib/themes/solarized-dark.json +0 -9
  241. package/lib/themes/solarized-light.json +0 -9
  242. package/lib/themes/tokyo-night-light.json +0 -9
  243. package/lib/themes/tokyo-night.json +0 -9
@@ -0,0 +1,128 @@
1
+ // agent-roster-groups.js - the three groups the Team view's Agents section is
2
+ // drawn in, and the leading mark of a row that has no operator-chosen avatar.
3
+ //
4
+ // The server (lib/agent-roster.js) says which group each identity belongs to,
5
+ // read from what the vendors reported (lib/vendor-catalog.js); nothing here
6
+ // names a model, a helper or a vendor. An entry whose group is missing or
7
+ // unknown is a named agent, so nothing is ever dropped from the view.
8
+ //
9
+ // DOM-light: builders only, no app state, no icon library import. The caller
10
+ // resolves the <i data-lucide> placeholders with refreshIcons once placed.
11
+
12
+ export var GROUP = { AGENT: "agent", HELPER: "helper", MODEL: "model" };
13
+
14
+ // Named agents are always open; the other two groups start collapsed.
15
+ export var GROUPS = [
16
+ { id: GROUP.AGENT, title: "Named agents", collapsible: false },
17
+ { id: GROUP.HELPER, title: "Built-in helpers", collapsible: true },
18
+ { id: GROUP.MODEL, title: "Models", collapsible: true },
19
+ ];
20
+
21
+ // The glyph a row with no chosen avatar and no vendor logo shows, per group.
22
+ var GLYPH_ICON = { helper: "wrench", model: "cpu", agent: "bot" };
23
+
24
+ /** Splits the roster into {agent, helper, model}, keeping each list's order. */
25
+ export function partitionRoster(agents) {
26
+ var out = { agent: [], helper: [], model: [] };
27
+ (Array.isArray(agents) ? agents : []).forEach(function (a) {
28
+ var group = a && (a.group === GROUP.HELPER || a.group === GROUP.MODEL) ? a.group : GROUP.AGENT;
29
+ out[group].push(a);
30
+ });
31
+ return out;
32
+ }
33
+
34
+ /**
35
+ * What a redraw depends on: each agent's key, avatar choice, group and vendor
36
+ * (the vendor picks a model's logo) and the project and source of each place,
37
+ * without any sighting time (they change on every use). While a picker is open,
38
+ * a roster that differs only in times does not redraw it, so a seed being typed
39
+ * is not lost; one that gains or loses a place does.
40
+ */
41
+ export function choicesSignature(list) {
42
+ return JSON.stringify((list || []).map(function (a) {
43
+ var places = (a.places || []).map(function (p) { return [p.project || null, p.source || null]; });
44
+ return [a.key, a.avatar || null, a.group || null, a.vendor || null, places];
45
+ }));
46
+ }
47
+
48
+ function el(tag, className, text) {
49
+ var node = document.createElement(tag);
50
+ if (className) node.className = className;
51
+ if (text !== undefined && text !== null) node.textContent = text;
52
+ return node;
53
+ }
54
+
55
+ /**
56
+ * The mark of a helper or model row that has no chosen avatar: a model shows the
57
+ * logo of the vendor whose list held it (logoUrl, from the agent registry), and
58
+ * falls back to a neutral chip icon when the registry holds none; a helper shows
59
+ * the neutral tool icon, never the robot.
60
+ * @param {string} group "helper" or "model"
61
+ * @param {?string} logoUrl
62
+ * @param {number} size
63
+ */
64
+ export function buildGroupMark(group, logoUrl, size) {
65
+ if (group === GROUP.MODEL && logoUrl) {
66
+ var img = el("img", "ar-avatar ar-logo");
67
+ img.alt = "";
68
+ img.width = size;
69
+ img.height = size;
70
+ img.src = logoUrl;
71
+ img.setAttribute("data-ar-mark", "logo");
72
+ return img;
73
+ }
74
+ var glyph = el("span", "ar-avatar ar-glyph");
75
+ glyph.setAttribute("data-ar-mark", group === GROUP.HELPER ? "tool" : "neutral");
76
+ glyph.setAttribute("role", "img");
77
+ var icon = document.createElement("i");
78
+ icon.setAttribute("data-lucide", GLYPH_ICON[group] || GLYPH_ICON.agent);
79
+ glyph.appendChild(icon);
80
+ return glyph;
81
+ }
82
+
83
+ /**
84
+ * The avatar of one row. A chosen avatar shows in every group (deps.chosen says
85
+ * whether the operator picked one, deps.plain draws it); without one a named
86
+ * agent keeps its seeded robot (deps.plain too), a helper shows the neutral tool
87
+ * icon and a model the logo of the vendor whose list held it.
88
+ * @param {{key: string, group?: string, vendor?: ?string}} agent
89
+ * @param {number} size
90
+ * @param {{chosen: function(string): boolean, plain: function(string, number): Element,
91
+ * logoFor: function(string): ?string}} deps
92
+ */
93
+ export function buildRowAvatar(agent, size, deps) {
94
+ var grouped = agent.group === GROUP.HELPER || agent.group === GROUP.MODEL;
95
+ if (grouped && !deps.chosen(agent.key)) {
96
+ return buildGroupMark(agent.group, agent.vendor ? deps.logoFor(agent.vendor) || null : null, size);
97
+ }
98
+ return deps.plain(agent.key, size);
99
+ }
100
+
101
+ /**
102
+ * One group: a heading with its count, then its rows. A collapsible group is a
103
+ * toggle button; its rows are only built when it is expanded.
104
+ * @param {{id: string, title: string, collapsible: boolean}} group
105
+ * @param {Array<Element>} rows
106
+ * @param {{count: number, expanded: boolean, onToggle: function()}} state
107
+ * count is how many identities the group holds, shown even while collapsed
108
+ */
109
+ export function buildGroupSection(group, rows, state) {
110
+ var section = el("section", "ar-group ar-group-" + group.id);
111
+ section.setAttribute("data-ar-group", group.id);
112
+ var label = group.title + " (" + state.count + ")";
113
+ if (group.collapsible) {
114
+ var toggle = el("button", "ar-group-toggle", label);
115
+ toggle.setAttribute("type", "button");
116
+ toggle.setAttribute("aria-expanded", state.expanded ? "true" : "false");
117
+ toggle.addEventListener("click", state.onToggle);
118
+ section.appendChild(toggle);
119
+ } else {
120
+ section.appendChild(el("h3", "ar-group-title", label));
121
+ }
122
+ if (!group.collapsible || state.expanded) {
123
+ var list = el("div", "ar-list");
124
+ rows.forEach(function (row) { list.appendChild(row); });
125
+ section.appendChild(list);
126
+ }
127
+ return section;
128
+ }
@@ -14,12 +14,20 @@
14
14
  import { getWs } from "./ws-ref.js";
15
15
  import { registerTeamSection, isSectionContainerShown } from "./team-view.js";
16
16
  import { relativeTime } from "./relative-time.js";
17
- import { setAgentAvatars, refreshAgentAvatars, createAgentAvatar } from "./agent-avatar.js";
17
+ import { setAgentAvatars, refreshAgentAvatars, createAgentAvatar, agentAvatarChoice } from "./agent-avatar.js";
18
18
  import { buildAvatarPicker } from "./agent-avatar-picker.js";
19
+ import { GROUPS, partitionRoster, choicesSignature, buildRowAvatar, buildGroupSection } from "./agent-roster-groups.js";
20
+ import { VENDOR_AVATARS } from "./vendor-registry.js";
21
+ import { setClaudeModelFamilies } from "./model-families.js";
22
+ import { refreshIcons } from "./icons.js";
19
23
 
20
24
  var SECTION_ID = "agent-roster";
21
25
  var AVATAR_SIZE = 40;
22
26
 
27
+ // The two lower groups start collapsed; what the operator opens stays open
28
+ // across redraws.
29
+ var expandedGroups = Object.create(null);
30
+
23
31
  var agents = null;
24
32
  var pickerKey = null;
25
33
  var failure = null;
@@ -63,18 +71,28 @@ function choose(key, ref) {
63
71
  send({ type: "agent_avatar_set", key: key, avatar: ref });
64
72
  }
65
73
 
74
+ // The logo of a model's vendor is the agent registry's icon for that vendor.
75
+ var avatarDeps = {
76
+ chosen: function (key) { return !!agentAvatarChoice(key); },
77
+ plain: function (key, size) { return createAgentAvatar(key, size, "ar-avatar"); },
78
+ logoFor: function (vendor) { return VENDOR_AVATARS[vendor] || null; },
79
+ };
80
+
81
+ function buildAvatar(agent) {
82
+ return buildRowAvatar(agent, AVATAR_SIZE, avatarDeps);
83
+ }
84
+
66
85
  function renderRow(agent) {
67
86
  var open = agent.key === pickerKey;
68
87
  var row = el("div", "ar-row" + (open ? " open" : ""));
69
88
  row.setAttribute("data-agent-key", agent.key);
70
89
 
71
90
  var head = el("div", "ar-head");
72
- head.appendChild(createAgentAvatar(agent.key, AVATAR_SIZE, "ar-avatar"));
91
+ head.appendChild(buildAvatar(agent));
73
92
 
74
93
  var main = el("div", "ar-main");
75
94
  main.appendChild(el("div", "ar-name", agent.key));
76
95
  var seen = el("div", "ar-seen");
77
- seen.appendChild(el("span", "ar-first", "First seen " + timeText(agent.firstSeen)));
78
96
  seen.appendChild(el("span", "ar-last", "Last seen " + timeText(agent.lastSeen)));
79
97
  main.appendChild(seen);
80
98
  var places = el("div", "ar-places");
@@ -109,9 +127,18 @@ function paint() {
109
127
  container.appendChild(empty);
110
128
  return;
111
129
  }
112
- var wrap = el("div", "ar-list");
113
- list.forEach(function (agent) { wrap.appendChild(renderRow(agent)); });
114
- container.appendChild(wrap);
130
+ var parts = partitionRoster(list);
131
+ GROUPS.forEach(function (group) {
132
+ var members = parts[group.id];
133
+ if (!members.length) return;
134
+ var rows = group.collapsible && !expandedGroups[group.id] ? [] : members.map(renderRow);
135
+ container.appendChild(buildGroupSection(group, rows, {
136
+ count: members.length,
137
+ expanded: !!expandedGroups[group.id],
138
+ onToggle: function () { expandedGroups[group.id] = !expandedGroups[group.id]; paint(); },
139
+ }));
140
+ });
141
+ refreshIcons(container);
115
142
  }
116
143
 
117
144
  function renderSection(container) {
@@ -124,16 +151,18 @@ registerTeamSection({ id: SECTION_ID, title: "Agents", render: renderSection });
124
151
 
125
152
  // --- Messages from the server ---
126
153
 
127
- // The agents and their avatar choices, without the sighting times that change
128
- // on every use: while a picker is open, a roster that differs only in times does
129
- // not redraw it, so a seed being typed is not lost.
130
- function choicesSignature(list) {
131
- return JSON.stringify((list || []).map(function (a) { return [a.key, a.avatar || null]; }));
154
+ // The Claude model families come from the models the Claude vendor reported
155
+ // (its alias entries); the literal in model-families.js applies until it has.
156
+ function applyCatalogFamilies(catalog) {
157
+ (Array.isArray(catalog) ? catalog : []).forEach(function (entry) {
158
+ if (entry && entry.vendor === "claude") setClaudeModelFamilies(entry.models);
159
+ });
132
160
  }
133
161
 
134
162
  export function handleAgentRoster(msg) {
135
163
  var before = choicesSignature(agents);
136
164
  agents = Array.isArray(msg.agents) ? msg.agents : [];
165
+ applyCatalogFamilies(msg.catalog);
137
166
  setAgentAvatars(agents);
138
167
  refreshAgentAvatars();
139
168
  if (activeContainer && !isSectionContainerShown(activeContainer)) activeContainer = null;
@@ -79,9 +79,20 @@ var _blinkTypes = {
79
79
  rate_limit: true,
80
80
  };
81
81
 
82
+ // The boot watchdog in index.html marks the overlay data-state="boot-error"
83
+ // when the app failed to start; nothing here may overwrite that state.
84
+ function isBootError() {
85
+ return !!connectOverlay && connectOverlay.getAttribute("data-state") === "boot-error";
86
+ }
87
+
82
88
  export function initConnection() {
83
89
  connectOverlay = document.getElementById("connect-overlay");
84
90
 
91
+ // The static overlay text says the app is loading; once this runs the app
92
+ // has booted, so any overlay shown from here on is a reconnect.
93
+ var bootMsgEl = document.getElementById("connect-overlay-msg");
94
+ if (bootMsgEl && !isBootError()) bootMsgEl.textContent = "Reconnecting to server…";
95
+
85
96
  var signinBtn = document.getElementById("connect-overlay-signin-btn");
86
97
  if (signinBtn) {
87
98
  signinBtn.addEventListener("click", function () {
@@ -115,7 +126,7 @@ export function initConnection() {
115
126
  }
116
127
 
117
128
  // Connected state changed
118
- if (state.connected !== prev.connected) {
129
+ if (state.connected !== prev.connected && !isBootError()) {
119
130
  var sendBtn = getSendBtn();
120
131
  if (state.connected) {
121
132
  // Cancel any pending grace timer — reconnected before overlay was needed
@@ -260,6 +271,7 @@ function handleUnauthenticated() {
260
271
  if (overlayGraceTimer) { clearTimeout(overlayGraceTimer); overlayGraceTimer = null; }
261
272
  setStatus("disconnected");
262
273
  stopLogoAnimation();
274
+ if (isBootError()) return;
263
275
  var msgEl = document.getElementById("connect-overlay-msg");
264
276
  if (msgEl) msgEl.textContent = "Session expired — sign in again.";
265
277
  var signinBtn = document.getElementById("connect-overlay-signin-btn");
@@ -44,7 +44,7 @@ function createCursorElement(userId, displayName, color, avatarStyle, avatarSeed
44
44
  wrapper.className = "remote-cursor";
45
45
  wrapper.dataset.userId = userId;
46
46
  wrapper.style.position = "absolute";
47
- wrapper.style.zIndex = "9999";
47
+ wrapper.style.zIndex = "var(--z-cursor)";
48
48
  wrapper.style.pointerEvents = "none";
49
49
  wrapper.style.display = "none";
50
50
  wrapper.style.transition = "left 30ms linear, top 30ms linear";
@@ -56,11 +56,11 @@ function createCursorElement(userId, displayName, color, avatarStyle, avatarSeed
56
56
  svg.setAttribute("height", "20");
57
57
  svg.setAttribute("viewBox", "0 0 16 20");
58
58
  svg.style.display = "block";
59
- svg.style.filter = "drop-shadow(0 1px 2px rgba(0,0,0,0.3))";
59
+ svg.style.filter = "drop-shadow(0 1px 2px rgba(var(--shadow-rgb), 0.3))";
60
60
  var path = document.createElementNS("http://www.w3.org/2000/svg", "path");
61
61
  path.setAttribute("d", "M0 0 L0 16 L4.5 12 L8 19 L10.5 18 L7 11 L13 11 Z");
62
62
  path.setAttribute("fill", color);
63
- path.setAttribute("stroke", "#fff");
63
+ path.style.stroke = "var(--bg)";
64
64
  path.setAttribute("stroke-width", "1");
65
65
  svg.appendChild(path);
66
66
  wrapper.appendChild(svg);
@@ -76,14 +76,14 @@ function createCursorElement(userId, displayName, color, avatarStyle, avatarSeed
76
76
  var avatarImg = document.createElement("img");
77
77
  avatarImg.className = "remote-cursor-avatar";
78
78
  avatarImg.src = avatarCustom ? avatarCustom : avatarUrl(avatarStyle || "thumbs", avatarSeed || userId, 16);
79
- avatarImg.style.cssText = "width:14px;height:14px;border-radius:50%;background:#fff;flex-shrink:0;";
79
+ avatarImg.style.cssText = "width:14px;height:14px;border-radius:50%;background:var(--bg-alt);flex-shrink:0;";
80
80
  tag.appendChild(avatarImg);
81
81
 
82
82
  // Name label
83
83
  var label = document.createElement("span");
84
84
  label.className = "remote-cursor-label";
85
85
  label.textContent = displayName;
86
- label.style.cssText = "color:#fff;font-size:11px;font-weight:500;line-height:16px;font-family:inherit;";
86
+ label.style.cssText = "color:var(--on-av);font-size:11px;font-weight:500;line-height:16px;font-family:inherit;";
87
87
  tag.appendChild(label);
88
88
 
89
89
  wrapper.appendChild(tag);
@@ -151,11 +151,11 @@ function createOffscreenIndicator(userId, displayName, color) {
151
151
  btn.dataset.userId = userId;
152
152
  btn.style.cssText =
153
153
  "position:absolute;left:50%;transform:translateX(-50%);" +
154
- "z-index:10000;display:none;cursor:pointer;border:none;outline:none;" +
155
- "background:" + color + ";color:#fff;font-size:11px;font-weight:500;" +
154
+ "z-index:calc(var(--z-cursor) + 1);display:none;cursor:pointer;border:none;outline:none;" +
155
+ "background:" + color + ";color:var(--on-av);font-size:11px;font-weight:500;" +
156
156
  "padding:3px 10px 3px 8px;border-radius:12px;white-space:nowrap;" +
157
157
  "font-family:inherit;line-height:16px;opacity:0.9;" +
158
- "box-shadow:0 2px 8px rgba(0,0,0,0.2);pointer-events:auto;" +
158
+ "box-shadow:0 2px 8px rgba(var(--shadow-rgb), 0.2);pointer-events:auto;" +
159
159
  "transition:opacity 0.15s;";
160
160
  btn.addEventListener("mouseenter", function () { btn.style.opacity = "1"; });
161
161
  btn.addEventListener("mouseleave", function () { btn.style.opacity = "0.9"; });
@@ -302,7 +302,7 @@ export function handleRemoteSelection(msg) {
302
302
  highlight.className = "remote-selection";
303
303
  highlight.dataset.userId = userId;
304
304
  highlight.style.cssText =
305
- "position:absolute;pointer-events:none;z-index:9998;" +
305
+ "position:absolute;pointer-events:none;z-index:calc(var(--z-cursor) - 1);" +
306
306
  "background:" + color + ";" +
307
307
  "opacity:0.2;" +
308
308
  "border-radius:2px;" +
@@ -4,7 +4,7 @@
4
4
  import { refreshIcons } from './icons.js';
5
5
  import { store } from './store.js';
6
6
  import { getSendBtn, getStatusDot } from './dom-refs.js';
7
- import { onThemeChange, getChatLayout } from './theme.js';
7
+ import { onThemeChange } from './theme.js';
8
8
  import { getActivityEl, setActivityEl, addToMessages, scrollToBottom } from './app-rendering.js';
9
9
 
10
10
  // --- Module-owned state ---
@@ -253,15 +253,9 @@ export function setActivity(text) {
253
253
  // other. There is now exactly one source; this subscriber and the
254
254
  // project-icon dot (sidebar-projects.js) both derive from it.
255
255
  //
256
- // Gated to bubble layout only (mirrors input.js's optimistic-raise gate and
257
- // showClaudePreThinking's channel-only gate in app-rendering.js) — the two
258
- // footer renderers are mutually exclusive by design (wide-view <=> channel,
259
- // theme.js getChatLayout/setChatLayout), so this must not fight
260
- // .channel-pre-thinking for the same bottom-of-transcript slot in channel
261
- // layout. (lr-5edd64 comment #3: in channel layout this subscriber's raise/
262
- // clear is inert by this same gate — the channel footer's own presence
263
- // widget, .channel-pre-thinking, is driven separately and unaffected by
264
- // this change.)
256
+ // There is one layout, so this footer is the only working indicator: the
257
+ // separate pre-thinking widget the channel layout drew is gone, and a turn that
258
+ // has started and is not yet answered shows exactly this one.
265
259
  export function initActivityFooter() {
266
260
  store.subscribe(['processing'], function (state, prev) {
267
261
  if (state.processing === prev.processing) return;
@@ -295,12 +289,10 @@ export function initActivityFooter() {
295
289
  // updates that happen to carry the same 'processing' value along for the
296
290
  // ride.
297
291
  export function reconcileActivityFooter() {
298
- if (getChatLayout() !== "channel") {
299
- if (store.get('processing')) {
300
- setActivity("thinking");
301
- } else {
302
- setActivity(null);
303
- }
292
+ if (store.get('processing')) {
293
+ setActivity("thinking");
294
+ } else {
295
+ setActivity(null);
304
296
  }
305
297
  }
306
298
 
@@ -8,10 +8,11 @@ import { getWs } from './ws-ref.js';
8
8
  import { getMessagesEl } from './dom-refs.js';
9
9
  import { getActivityEl, setActivityEl, getTurnCounter, setTurnCounter, getPrependAnchor, setPrependAnchor, finalizeAssistantBlock, resetCurrentFullText } from './app-rendering.js';
10
10
  import { processMessage } from './app-messages.js';
11
+ import { canStitchDeltaRun, splitTrailingDeltaRun, stitchIntoTopMessage } from './app-history-replay.js';
11
12
  import { saveToolState, resetToolState, restoreToolState } from './tools.js';
12
13
  import { getSessionUsage, setSessionUsage, getContextData, setContextData, updateContextPanel, updateUsagePanel } from './app-panels.js';
13
14
  import { onHistoryPrepended as onSessionSearchHistoryPrepended } from './session-search.js';
14
- import { positionPopover } from './popover-position.js';
15
+ import { showOverlay } from './overlay.js';
15
16
  import { initKeepAliveButton } from './keep-alive.js';
16
17
 
17
18
  // --- Module-owned state ---
@@ -68,10 +69,9 @@ export function initHeader() {
68
69
  if (headerInfoBtn) {
69
70
  headerInfoBtn.addEventListener("click", function (e) {
70
71
  e.stopPropagation();
71
- if (sessionInfoPopover) { closeSessionInfoPopover(); return; }
72
+ if (sessionInfoPopover && sessionInfoPopover.isOpen()) { closeSessionInfoPopover(); return; }
72
73
 
73
- var pop = document.createElement("div");
74
- pop.className = "session-info-popover";
74
+ var rows = [];
75
75
 
76
76
  function addRow(label, value) {
77
77
  var val = value == null ? "-" : String(value);
@@ -89,7 +89,7 @@ export function initHeader() {
89
89
  setTimeout(function () { btn.innerHTML = iconHtml("copy"); refreshIcons(); }, 1200);
90
90
  });
91
91
  });
92
- pop.appendChild(row);
92
+ rows.push(row);
93
93
  }
94
94
 
95
95
  var s = store.snap();
@@ -103,26 +103,23 @@ export function initHeader() {
103
103
  addRow("Resume", resumeCmd);
104
104
  }
105
105
 
106
- document.body.appendChild(pop);
107
- sessionInfoPopover = pop;
108
- refreshIcons();
109
-
110
106
  // Four-edge clamp (lr-a10a): the prior right-only clamp could leave
111
107
  // the popover's bottom edge off-screen on short viewports.
112
- positionPopover(pop, headerInfoBtn, { placement: "below" });
113
- });
114
-
115
- document.addEventListener("click", function (e) {
116
- if (sessionInfoPopover && !sessionInfoPopover.contains(e.target) && !e.target.closest("#header-info-btn")) {
117
- closeSessionInfoPopover();
118
- }
108
+ sessionInfoPopover = showOverlay({
109
+ kind: "popover",
110
+ className: "session-info-popover",
111
+ content: rows,
112
+ anchor: headerInfoBtn,
113
+ opener: headerInfoBtn,
114
+ placement: "below",
115
+ });
119
116
  });
120
117
  }
121
118
  }
122
119
 
123
120
  export function closeSessionInfoPopover() {
124
121
  if (sessionInfoPopover) {
125
- sessionInfoPopover.remove();
122
+ sessionInfoPopover.close();
126
123
  sessionInfoPopover = null;
127
124
  }
128
125
  }
@@ -232,14 +229,26 @@ export function prependOlderHistory(items, meta) {
232
229
  // rendering pipeline, so it remains a stable reference across the batch.
233
230
  var siblingBeforeAnchor = anchorEl ? anchorEl.previousSibling : messagesEl.lastChild;
234
231
 
232
+ // The page's trailing delta records may continue the reply whose first
233
+ // message is the one already at the top; they are stitched into it below
234
+ // rather than rendered as a second headed message.
235
+ var stitched = canStitchDeltaRun(anchorEl) ? splitTrailingDeltaRun(items) : null;
236
+ var pageItems = stitched ? stitched.head : items;
237
+
235
238
  // Process each item through the rendering pipeline
236
- for (var i = 0; i < items.length; i++) {
237
- processMessage(items[i]);
239
+ for (var i = 0; i < pageItems.length; i++) {
240
+ processMessage(pageItems[i]);
238
241
  }
239
242
 
240
243
  // Finalize any open assistant block from the batch
241
244
  finalizeAssistantBlock();
242
245
 
246
+ // A stitch adds no new message, so a stitch-only page settles under the same
247
+ // rule as any page that rendered nothing new: it auto-advances below.
248
+ if (stitched && stitched.lead) {
249
+ savedFullText = stitchIntoTopMessage(anchorEl, savedMsgEl, savedFullText, stitched.lead);
250
+ }
251
+
243
252
  // Clear prepend mode
244
253
  setPrependAnchor(null);
245
254
 
@@ -10,9 +10,9 @@
10
10
  // original switch.
11
11
 
12
12
  import { store } from './store.js';
13
- import { renderMarkdown, highlightCodeBlocksBatched, renderMermaidBlocks } from './markdown.js';
13
+ import { renderMarkdown, renderMarkdownAsync, highlightCodeBlocksBatched, renderMermaidBlocks } from './markdown.js';
14
14
  import { getPendingNavigate, peekPendingNavigate } from './pending-navigate.js';
15
- import { armStickyBottom, disarmStickyBottom, scrollToBottom, finalizeAssistantBlock } from './app-rendering.js';
15
+ import { armStickyBottom, disarmStickyBottom, scrollToBottom, finalizeAssistantBlock, flushStreamBuffer, getFinalizedText, setFinalizedText, getLiveMessageText, applyRenderedHtml } from './app-rendering.js';
16
16
  import { applyDeadSessionTodoCompaction, markAllToolsDone } from './tools.js';
17
17
  import { accumulateContext, updateContextPanel, updateUsagePanel, getSessionUsage } from './app-panels.js';
18
18
  import { stopUrgentBlink } from './app-favicon.js';
@@ -42,6 +42,64 @@ export function handleHistoryMeta(msg, updateHistorySentinelFn) {
42
42
  }
43
43
  }
44
44
 
45
+ // One assistant reply is a run of consecutive "delta" records. The server
46
+ // trims the in-memory history at a fixed count, so the run whose first message
47
+ // is already rendered at the top can continue into the tail of the next older
48
+ // page. Rendering that tail as its own message would show a second header, so
49
+ // it is split off and stitched into the top message instead. The top message
50
+ // can only be the run's own message when it is an assistant message, which is
51
+ // all the client can see of the boundary.
52
+ export function canStitchDeltaRun(topEl) {
53
+ return !!(topEl && topEl.classList && topEl.classList.contains("msg-assistant"));
54
+ }
55
+
56
+ // Splits the trailing delta records off an older page. `lead` is their text in
57
+ // order; `head` is the rest of the page, to render normally.
58
+ export function splitTrailingDeltaRun(items) {
59
+ var cut = items.length;
60
+ while (cut > 0 && items[cut - 1] && items[cut - 1].type === "delta" && typeof items[cut - 1].text === "string") cut--;
61
+ var lead = "";
62
+ for (var i = cut; i < items.length; i++) lead += items[i].text;
63
+ return { head: items.slice(0, cut), lead: lead };
64
+ }
65
+
66
+ // Puts `lead` in front of the text of the already-rendered message `el` and
67
+ // redraws it, keeping one header. Returns the merged text.
68
+ // The render is async, so the write is skipped when the message no longer holds
69
+ // the merged text: a delta or a later stitch changed it, and whichever changed
70
+ // it redraws the message from its own full text, so nothing is lost.
71
+ export function stitchLeadingText(el, existingText, lead) {
72
+ var merged = lead + existingText;
73
+ var contentEl = el.querySelector(".md-content");
74
+ if (contentEl) {
75
+ renderMarkdownAsync(merged).then(function (html) {
76
+ setTimeout(function () {
77
+ if (!contentEl.isConnected) return;
78
+ if (getLiveMessageText(el) !== merged) return;
79
+ applyRenderedHtml(contentEl, html);
80
+ }, 0);
81
+ });
82
+ }
83
+ return merged;
84
+ }
85
+
86
+ // Stitches `lead` into a finalized top message.
87
+ export function stitchIntoFinalized(el, lead) {
88
+ var merged = stitchLeadingText(el, getFinalizedText(el), lead);
89
+ setFinalizedText(el, merged);
90
+ return merged;
91
+ }
92
+
93
+ // Stitches `lead` into the top message `el`. A message still streaming keeps its
94
+ // text in the live accumulator, so the merged text is returned for the caller to
95
+ // restore there; a finalized one keeps it in the finalized-text map. Returns the
96
+ // accumulator text to restore.
97
+ export function stitchIntoTopMessage(el, streamingEl, streamingText, lead) {
98
+ if (el === streamingEl) return stitchLeadingText(el, streamingText, lead);
99
+ stitchIntoFinalized(el, lead);
100
+ return streamingText;
101
+ }
102
+
45
103
  export function handleHistoryDone(msg) {
46
104
  var messagesEl = document.getElementById("messages");
47
105
  store.set({ replayingHistory: false });
@@ -117,7 +175,12 @@ export function handleHistoryDone(msg) {
117
175
  }
118
176
  updateContextPanel();
119
177
  updateUsagePanel();
120
- // Render + finalize any incomplete turn from the replayed history
178
+ // Render + finalize any incomplete turn from the replayed history. A reply
179
+ // still streaming is rendered but not finalized: flushing syncs the replayed
180
+ // text into the store without closing the block, so the live deltas append to
181
+ // it instead of opening a second message with a second header.
182
+ var stillProcessing = !!store.get('sessionIsProcessing');
183
+ if (stillProcessing) flushStreamBuffer();
121
184
  var _hs = store.snap();
122
185
  if (_hs.currentMsgEl && _hs.currentFullText) {
123
186
  var replayContentEl = _hs.currentMsgEl.querySelector(".md-content");
@@ -126,7 +189,7 @@ export function handleHistoryDone(msg) {
126
189
  }
127
190
  }
128
191
  markAllToolsDone();
129
- finalizeAssistantBlock();
192
+ if (!stillProcessing) finalizeAssistantBlock();
130
193
  stopUrgentBlink();
131
194
  // Scroll to tool element if navigating from file edit history.
132
195
  // nav/hasNavTarget are declared above (early arm block).
@@ -12,6 +12,9 @@ import { openSchedulerToTab } from './scheduler.js';
12
12
  import { exitDmMode } from './app-dm.js';
13
13
  import { openCommandPalette } from './command-palette.js';
14
14
  import { sessionActivity, indicatorClass } from './activity-state.js';
15
+ import {
16
+ sessionListAvatarsEnabled, onSessionListAvatarsChange, createSessionAgentAvatar
17
+ } from './session-list-avatars.js';
15
18
 
16
19
  function $hub(id) { return document.getElementById(id); }
17
20
 
@@ -447,7 +450,15 @@ export function handleHubSchedules(msg) {
447
450
  }
448
451
  }
449
452
 
453
+ var lastRecentSessionsMsg = null;
454
+
455
+ // Switching "Avatars in session list" redraws the rows already on the page.
456
+ onSessionListAvatarsChange(function () {
457
+ if (lastRecentSessionsMsg) handleHubRecentSessions(lastRecentSessionsMsg);
458
+ });
459
+
450
460
  export function handleHubRecentSessions(msg) {
461
+ lastRecentSessionsMsg = msg;
451
462
  var sessions = msg.sessions || [];
452
463
  var list = document.getElementById("hub-recent-sessions-list");
453
464
  if (!list) return;
@@ -496,6 +507,10 @@ export function handleHubRecentSessions(msg) {
496
507
  '<span class="hub-recent-title">' + escapeHtml(sess.title) + '</span>' +
497
508
  agentBadge +
498
509
  '<span class="hub-recent-time">' + timeStr + '</span>';
510
+ // With avatars on, the agent's avatar sits before the title; the name pill stays.
511
+ if (sess.agentName && sessionListAvatarsEnabled()) {
512
+ item.insertBefore(createSessionAgentAvatar(sess.agentName), item.querySelector(".hub-recent-title"));
513
+ }
499
514
  item.addEventListener("click", function () {
500
515
  var currentSlug = store.get('currentSlug');
501
516
  if (sess.projectSlug && sess.projectSlug !== currentSlug) {